Lines Matching refs:fd
14 static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd);
15 static int hfs_brec_update_parent(struct hfs_find_data *fd);
65 int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len) in hfs_brec_insert() argument
74 tree = fd->tree; in hfs_brec_insert()
75 if (!fd->bnode) { in hfs_brec_insert()
81 fd->bnode = node; in hfs_brec_insert()
82 fd->record = -1; in hfs_brec_insert()
85 key_len = (fd->search_key->key_len | 1) + 1; in hfs_brec_insert()
88 rec = fd->record + 1; in hfs_brec_insert()
91 node = fd->bnode; in hfs_brec_insert()
102 new_node = hfs_bnode_split(fd); in hfs_brec_insert()
132 hfs_bnode_write(node, fd->search_key, data_off, key_len); in hfs_brec_insert()
141 hfs_bnode_read_key(node, fd->search_key, data_off + size); in hfs_brec_insert()
142 hfs_brec_update_parent(fd); in hfs_brec_insert()
146 hfs_bnode_put(fd->bnode); in hfs_brec_insert()
151 fd->bnode = hfs_bnode_find(tree, new_node->parent); in hfs_brec_insert()
159 hfs_bnode_read_key(new_node, fd->search_key, 14); in hfs_brec_insert()
160 __hfs_brec_find(fd->bnode, fd); in hfs_brec_insert()
166 key_len = fd->search_key->key_len + 1; in hfs_brec_insert()
168 fd->search_key->key_len = tree->max_key_len; in hfs_brec_insert()
177 int hfs_brec_remove(struct hfs_find_data *fd) in hfs_brec_remove() argument
183 tree = fd->tree; in hfs_brec_remove()
184 node = fd->bnode; in hfs_brec_remove()
186 rec_off = tree->node_size - (fd->record + 2) * 2; in hfs_brec_remove()
195 fd->record, fd->keylength + fd->entrylength); in hfs_brec_remove()
204 node = fd->bnode = parent; in hfs_brec_remove()
206 __hfs_brec_find(node, fd); in hfs_brec_remove()
213 size = fd->keylength + fd->entrylength; in hfs_brec_remove()
222 hfs_bnode_move(node, fd->keyoffset, fd->keyoffset + size, in hfs_brec_remove()
223 data_off - fd->keyoffset - size); in hfs_brec_remove()
226 if (!fd->record) in hfs_brec_remove()
227 hfs_brec_update_parent(fd); in hfs_brec_remove()
231 static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd) in hfs_bnode_split() argument
239 tree = fd->tree; in hfs_bnode_split()
240 node = fd->bnode; in hfs_bnode_split()
282 if (fd->record + 1 < num_recs) { in hfs_bnode_split()
292 fd->bnode = new_node; in hfs_bnode_split()
293 fd->record -= num_recs; in hfs_bnode_split()
294 fd->keyoffset -= data_start - 14; in hfs_bnode_split()
295 fd->entryoffset -= data_start - 14; in hfs_bnode_split()
352 static int hfs_brec_update_parent(struct hfs_find_data *fd) in hfs_brec_update_parent() argument
360 tree = fd->tree; in hfs_brec_update_parent()
361 node = fd->bnode; in hfs_brec_update_parent()
370 __hfs_brec_find(parent, fd); in hfs_brec_update_parent()
371 if (fd->record < 0) in hfs_brec_update_parent()
374 rec = fd->record; in hfs_brec_update_parent()
380 fd->keylength = newkeylen = tree->max_key_len + 1; in hfs_brec_update_parent()
382 rec, fd->keylength, newkeylen); in hfs_brec_update_parent()
386 diff = newkeylen - fd->keylength; in hfs_brec_update_parent()
394 fd->bnode = parent; in hfs_brec_update_parent()
395 new_node = hfs_bnode_split(fd); in hfs_brec_update_parent()
398 parent = fd->bnode; in hfs_brec_update_parent()
399 rec = fd->record; in hfs_brec_update_parent()
417 hfs_bnode_copy(parent, fd->keyoffset, node, 14, newkeylen); in hfs_brec_update_parent()
419 hfs_bnode_write_u8(parent, fd->keyoffset, newkeylen - 1); in hfs_brec_update_parent()
432 fd->bnode = hfs_bnode_find(tree, new_node->parent); in hfs_brec_update_parent()
434 hfs_bnode_read_key(new_node, fd->search_key, 14); in hfs_brec_update_parent()
437 __hfs_brec_find(fd->bnode, fd); in hfs_brec_update_parent()
438 hfs_brec_insert(fd, &cnid, sizeof(cnid)); in hfs_brec_update_parent()
439 hfs_bnode_put(fd->bnode); in hfs_brec_update_parent()
446 hfs_bnode_read_key(node, fd->search_key, 14); in hfs_brec_update_parent()
454 fd->bnode = node; in hfs_brec_update_parent()