Lines Matching refs:fd
15 int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) in hfs_find_init() argument
21 fd->tree = tree; in hfs_find_init()
22 fd->bnode = NULL; in hfs_find_init()
26 fd->search_key = ptr; in hfs_find_init()
27 fd->key = ptr + tree->max_key_len + 2; in hfs_find_init()
46 void hfs_find_exit(struct hfs_find_data *fd) in hfs_find_exit() argument
48 hfs_bnode_put(fd->bnode); in hfs_find_exit()
49 kfree(fd->search_key); in hfs_find_exit()
51 fd->tree->cnid, __builtin_return_address(0)); in hfs_find_exit()
52 mutex_unlock(&fd->tree->tree_lock); in hfs_find_exit()
53 fd->tree = NULL; in hfs_find_exit()
57 int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd) in __hfs_brec_find() argument
76 hfs_bnode_read(bnode, fd->key, off, keylen); in __hfs_brec_find()
77 cmpval = bnode->tree->keycmp(fd->key, fd->search_key); in __hfs_brec_find()
95 hfs_bnode_read(bnode, fd->key, off, keylen); in __hfs_brec_find()
98 fd->record = e; in __hfs_brec_find()
99 fd->keyoffset = off; in __hfs_brec_find()
100 fd->keylength = keylen; in __hfs_brec_find()
101 fd->entryoffset = off + keylen; in __hfs_brec_find()
102 fd->entrylength = len - keylen; in __hfs_brec_find()
109 int hfs_brec_find(struct hfs_find_data *fd) in hfs_brec_find() argument
117 tree = fd->tree; in hfs_brec_find()
118 if (fd->bnode) in hfs_brec_find()
119 hfs_bnode_put(fd->bnode); in hfs_brec_find()
120 fd->bnode = NULL; in hfs_brec_find()
140 res = __hfs_brec_find(bnode, fd); in hfs_brec_find()
143 if (fd->record < 0) in hfs_brec_find()
147 hfs_bnode_read(bnode, &data, fd->entryoffset, 4); in hfs_brec_find()
151 fd->bnode = bnode; in hfs_brec_find()
163 int hfs_brec_read(struct hfs_find_data *fd, void *rec, int rec_len) in hfs_brec_read() argument
167 res = hfs_brec_find(fd); in hfs_brec_read()
170 if (fd->entrylength > rec_len) in hfs_brec_read()
172 hfs_bnode_read(fd->bnode, rec, fd->entryoffset, fd->entrylength); in hfs_brec_read()
176 int hfs_brec_goto(struct hfs_find_data *fd, int cnt) in hfs_brec_goto() argument
183 bnode = fd->bnode; in hfs_brec_goto()
188 while (cnt > fd->record) { in hfs_brec_goto()
189 cnt -= fd->record + 1; in hfs_brec_goto()
190 fd->record = bnode->num_recs - 1; in hfs_brec_goto()
204 fd->record -= cnt; in hfs_brec_goto()
206 while (cnt >= bnode->num_recs - fd->record) { in hfs_brec_goto()
207 cnt -= bnode->num_recs - fd->record; in hfs_brec_goto()
208 fd->record = 0; in hfs_brec_goto()
222 fd->record += cnt; in hfs_brec_goto()
225 len = hfs_brec_lenoff(bnode, fd->record, &off); in hfs_brec_goto()
226 keylen = hfs_brec_keylen(bnode, fd->record); in hfs_brec_goto()
231 fd->keyoffset = off; in hfs_brec_goto()
232 fd->keylength = keylen; in hfs_brec_goto()
233 fd->entryoffset = off + keylen; in hfs_brec_goto()
234 fd->entrylength = len - keylen; in hfs_brec_goto()
235 hfs_bnode_read(bnode, fd->key, off, keylen); in hfs_brec_goto()
237 fd->bnode = bnode; in hfs_brec_goto()