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()
30 void hfs_find_exit(struct hfs_find_data *fd) in hfs_find_exit() argument
32 hfs_bnode_put(fd->bnode); in hfs_find_exit()
33 kfree(fd->search_key); in hfs_find_exit()
34 dprint(DBG_BNODE_REFS, "find_exit: %d (%p)\n", fd->tree->cnid, __builtin_return_address(0)); in hfs_find_exit()
35 up(&fd->tree->tree_lock); in hfs_find_exit()
36 fd->tree = NULL; in hfs_find_exit()
40 int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd) in __hfs_brec_find() argument
55 hfs_bnode_read(bnode, fd->key, off, keylen); in __hfs_brec_find()
56 cmpval = bnode->tree->keycmp(fd->key, fd->search_key); in __hfs_brec_find()
70 hfs_bnode_read(bnode, fd->key, off, keylen); in __hfs_brec_find()
73 fd->record = e; in __hfs_brec_find()
74 fd->keyoffset = off; in __hfs_brec_find()
75 fd->keylength = keylen; in __hfs_brec_find()
76 fd->entryoffset = off + keylen; in __hfs_brec_find()
77 fd->entrylength = len - keylen; in __hfs_brec_find()
83 int hfs_brec_find(struct hfs_find_data *fd) in hfs_brec_find() argument
91 tree = fd->tree; in hfs_brec_find()
92 if (fd->bnode) in hfs_brec_find()
93 hfs_bnode_put(fd->bnode); in hfs_brec_find()
94 fd->bnode = NULL; in hfs_brec_find()
114 res = __hfs_brec_find(bnode, fd); in hfs_brec_find()
117 if (fd->record < 0) in hfs_brec_find()
121 hfs_bnode_read(bnode, &data, fd->entryoffset, 4); in hfs_brec_find()
125 fd->bnode = bnode; in hfs_brec_find()
137 int hfs_brec_read(struct hfs_find_data *fd, void *rec, int rec_len) in hfs_brec_read() argument
141 res = hfs_brec_find(fd); in hfs_brec_read()
144 if (fd->entrylength > rec_len) in hfs_brec_read()
146 hfs_bnode_read(fd->bnode, rec, fd->entryoffset, fd->entrylength); in hfs_brec_read()
150 int hfs_brec_goto(struct hfs_find_data *fd, int cnt) in hfs_brec_goto() argument
157 bnode = fd->bnode; in hfs_brec_goto()
162 while (cnt > fd->record) { in hfs_brec_goto()
163 cnt -= fd->record + 1; in hfs_brec_goto()
164 fd->record = bnode->num_recs - 1; in hfs_brec_goto()
178 fd->record -= cnt; in hfs_brec_goto()
180 while (cnt >= bnode->num_recs - fd->record) { in hfs_brec_goto()
181 cnt -= bnode->num_recs - fd->record; in hfs_brec_goto()
182 fd->record = 0; in hfs_brec_goto()
196 fd->record += cnt; in hfs_brec_goto()
199 len = hfs_brec_lenoff(bnode, fd->record, &off); in hfs_brec_goto()
200 keylen = hfs_brec_keylen(bnode, fd->record); in hfs_brec_goto()
201 fd->keyoffset = off; in hfs_brec_goto()
202 fd->keylength = keylen; in hfs_brec_goto()
203 fd->entryoffset = off + keylen; in hfs_brec_goto()
204 fd->entrylength = len - keylen; in hfs_brec_goto()
205 hfs_bnode_read(bnode, fd->key, off, keylen); in hfs_brec_goto()
207 fd->bnode = bnode; in hfs_brec_goto()