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()
31 void hfs_find_exit(struct hfs_find_data *fd) in hfs_find_exit() argument
33 hfs_bnode_put(fd->bnode); in hfs_find_exit()
34 kfree(fd->search_key); in hfs_find_exit()
36 fd->tree->cnid, __builtin_return_address(0)); in hfs_find_exit()
37 mutex_unlock(&fd->tree->tree_lock); in hfs_find_exit()
38 fd->tree = NULL; in hfs_find_exit()
42 int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd) in __hfs_brec_find() argument
61 hfs_bnode_read(bnode, fd->key, off, keylen); in __hfs_brec_find()
62 cmpval = bnode->tree->keycmp(fd->key, fd->search_key); in __hfs_brec_find()
80 hfs_bnode_read(bnode, fd->key, off, keylen); in __hfs_brec_find()
83 fd->record = e; in __hfs_brec_find()
84 fd->keyoffset = off; in __hfs_brec_find()
85 fd->keylength = keylen; in __hfs_brec_find()
86 fd->entryoffset = off + keylen; in __hfs_brec_find()
87 fd->entrylength = len - keylen; in __hfs_brec_find()
94 int hfs_brec_find(struct hfs_find_data *fd) in hfs_brec_find() argument
102 tree = fd->tree; in hfs_brec_find()
103 if (fd->bnode) in hfs_brec_find()
104 hfs_bnode_put(fd->bnode); in hfs_brec_find()
105 fd->bnode = NULL; in hfs_brec_find()
125 res = __hfs_brec_find(bnode, fd); in hfs_brec_find()
128 if (fd->record < 0) in hfs_brec_find()
132 hfs_bnode_read(bnode, &data, fd->entryoffset, 4); in hfs_brec_find()
136 fd->bnode = bnode; in hfs_brec_find()
148 int hfs_brec_read(struct hfs_find_data *fd, void *rec, int rec_len) in hfs_brec_read() argument
152 res = hfs_brec_find(fd); in hfs_brec_read()
155 if (fd->entrylength > rec_len) in hfs_brec_read()
157 hfs_bnode_read(fd->bnode, rec, fd->entryoffset, fd->entrylength); in hfs_brec_read()
161 int hfs_brec_goto(struct hfs_find_data *fd, int cnt) in hfs_brec_goto() argument
168 bnode = fd->bnode; in hfs_brec_goto()
173 while (cnt > fd->record) { in hfs_brec_goto()
174 cnt -= fd->record + 1; in hfs_brec_goto()
175 fd->record = bnode->num_recs - 1; in hfs_brec_goto()
189 fd->record -= cnt; in hfs_brec_goto()
191 while (cnt >= bnode->num_recs - fd->record) { in hfs_brec_goto()
192 cnt -= bnode->num_recs - fd->record; in hfs_brec_goto()
193 fd->record = 0; in hfs_brec_goto()
207 fd->record += cnt; in hfs_brec_goto()
210 len = hfs_brec_lenoff(bnode, fd->record, &off); in hfs_brec_goto()
211 keylen = hfs_brec_keylen(bnode, fd->record); in hfs_brec_goto()
216 fd->keyoffset = off; in hfs_brec_goto()
217 fd->keylength = keylen; in hfs_brec_goto()
218 fd->entryoffset = off + keylen; in hfs_brec_goto()
219 fd->entrylength = len - keylen; in hfs_brec_goto()
220 hfs_bnode_read(bnode, fd->key, off, keylen); in hfs_brec_goto()
222 fd->bnode = bnode; in hfs_brec_goto()