Lines Matching refs:fd
14 int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) in hfs_find_init() argument
18 fd->tree = tree; in hfs_find_init()
19 fd->bnode = NULL; in hfs_find_init()
23 fd->search_key = ptr; in hfs_find_init()
24 fd->key = ptr + tree->max_key_len + 2; in hfs_find_init()
43 void hfs_find_exit(struct hfs_find_data *fd) in hfs_find_exit() argument
45 hfs_bnode_put(fd->bnode); in hfs_find_exit()
46 kfree(fd->search_key); in hfs_find_exit()
48 fd->tree->cnid, __builtin_return_address(0)); in hfs_find_exit()
49 mutex_unlock(&fd->tree->tree_lock); in hfs_find_exit()
50 fd->tree = NULL; in hfs_find_exit()
54 struct hfs_find_data *fd, in hfs_find_1st_rec_by_cnid() argument
63 cur_cnid = fd->key->ext.cnid; in hfs_find_1st_rec_by_cnid()
64 search_cnid = fd->search_key->ext.cnid; in hfs_find_1st_rec_by_cnid()
66 cur_cnid = fd->key->cat.parent; in hfs_find_1st_rec_by_cnid()
67 search_cnid = fd->search_key->cat.parent; in hfs_find_1st_rec_by_cnid()
69 cur_cnid = fd->key->attr.cnid; in hfs_find_1st_rec_by_cnid()
70 search_cnid = fd->search_key->attr.cnid; in hfs_find_1st_rec_by_cnid()
92 struct hfs_find_data *fd, in hfs_find_rec_by_key() argument
99 cmpval = bnode->tree->keycmp(fd->key, fd->search_key); in hfs_find_rec_by_key()
113 int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd, in __hfs_brec_find() argument
133 hfs_bnode_read(bnode, fd->key, off, keylen); in __hfs_brec_find()
134 if (rec_found(bnode, fd, &b, &e, &rec)) { in __hfs_brec_find()
147 hfs_bnode_read(bnode, fd->key, off, keylen); in __hfs_brec_find()
151 fd->record = e; in __hfs_brec_find()
152 fd->keyoffset = off; in __hfs_brec_find()
153 fd->keylength = keylen; in __hfs_brec_find()
154 fd->entryoffset = off + keylen; in __hfs_brec_find()
155 fd->entrylength = len - keylen; in __hfs_brec_find()
163 int hfs_brec_find(struct hfs_find_data *fd, search_strategy_t do_key_compare) in hfs_brec_find() argument
171 tree = fd->tree; in hfs_brec_find()
172 if (fd->bnode) in hfs_brec_find()
173 hfs_bnode_put(fd->bnode); in hfs_brec_find()
174 fd->bnode = NULL; in hfs_brec_find()
194 res = __hfs_brec_find(bnode, fd, do_key_compare); in hfs_brec_find()
197 if (fd->record < 0) in hfs_brec_find()
201 hfs_bnode_read(bnode, &data, fd->entryoffset, 4); in hfs_brec_find()
205 fd->bnode = bnode; in hfs_brec_find()
217 int hfs_brec_read(struct hfs_find_data *fd, void *rec, int rec_len) in hfs_brec_read() argument
221 res = hfs_brec_find(fd, hfs_find_rec_by_key); in hfs_brec_read()
224 if (fd->entrylength > rec_len) in hfs_brec_read()
226 hfs_bnode_read(fd->bnode, rec, fd->entryoffset, fd->entrylength); in hfs_brec_read()
230 int hfs_brec_goto(struct hfs_find_data *fd, int cnt) in hfs_brec_goto() argument
237 bnode = fd->bnode; in hfs_brec_goto()
242 while (cnt > fd->record) { in hfs_brec_goto()
243 cnt -= fd->record + 1; in hfs_brec_goto()
244 fd->record = bnode->num_recs - 1; in hfs_brec_goto()
258 fd->record -= cnt; in hfs_brec_goto()
260 while (cnt >= bnode->num_recs - fd->record) { in hfs_brec_goto()
261 cnt -= bnode->num_recs - fd->record; in hfs_brec_goto()
262 fd->record = 0; in hfs_brec_goto()
276 fd->record += cnt; in hfs_brec_goto()
279 len = hfs_brec_lenoff(bnode, fd->record, &off); in hfs_brec_goto()
280 keylen = hfs_brec_keylen(bnode, fd->record); in hfs_brec_goto()
285 fd->keyoffset = off; in hfs_brec_goto()
286 fd->keylength = keylen; in hfs_brec_goto()
287 fd->entryoffset = off + keylen; in hfs_brec_goto()
288 fd->entrylength = len - keylen; in hfs_brec_goto()
289 hfs_bnode_read(bnode, fd->key, off, keylen); in hfs_brec_goto()
291 fd->bnode = bnode; in hfs_brec_goto()