Lines Matching refs:sb
91 static int befs_btree_seekleaf(struct super_block *sb, befs_data_stream * ds,
96 static int befs_bt_read_super(struct super_block *sb, befs_data_stream * ds,
99 static int befs_bt_read_node(struct super_block *sb, befs_data_stream * ds,
110 static int befs_find_key(struct super_block *sb, befs_btree_node * node,
113 static char *befs_bt_get_key(struct super_block *sb, befs_btree_node * node,
134 befs_bt_read_super(struct super_block *sb, befs_data_stream * ds, in befs_bt_read_super() argument
140 befs_debug(sb, "---> befs_btree_read_super()"); in befs_bt_read_super()
142 bh = befs_read_datastream(sb, ds, 0, NULL); in befs_bt_read_super()
145 befs_error(sb, "Couldn't read index header."); in befs_bt_read_super()
149 befs_dump_index_entry(sb, od_sup); in befs_bt_read_super()
151 sup->magic = fs32_to_cpu(sb, od_sup->magic); in befs_bt_read_super()
152 sup->node_size = fs32_to_cpu(sb, od_sup->node_size); in befs_bt_read_super()
153 sup->max_depth = fs32_to_cpu(sb, od_sup->max_depth); in befs_bt_read_super()
154 sup->data_type = fs32_to_cpu(sb, od_sup->data_type); in befs_bt_read_super()
155 sup->root_node_ptr = fs64_to_cpu(sb, od_sup->root_node_ptr); in befs_bt_read_super()
156 sup->free_node_ptr = fs64_to_cpu(sb, od_sup->free_node_ptr); in befs_bt_read_super()
157 sup->max_size = fs64_to_cpu(sb, od_sup->max_size); in befs_bt_read_super()
161 befs_error(sb, "Index header has bad magic."); in befs_bt_read_super()
165 befs_debug(sb, "<--- befs_btree_read_super()"); in befs_bt_read_super()
169 befs_debug(sb, "<--- befs_btree_read_super() ERROR"); in befs_bt_read_super()
193 befs_bt_read_node(struct super_block *sb, befs_data_stream * ds, in befs_bt_read_node() argument
198 befs_debug(sb, "---> befs_bt_read_node()"); in befs_bt_read_node()
203 node->bh = befs_read_datastream(sb, ds, node_off, &off); in befs_bt_read_node()
205 befs_error(sb, "befs_bt_read_node() failed to read " in befs_bt_read_node()
207 befs_debug(sb, "<--- befs_bt_read_node() ERROR"); in befs_bt_read_node()
214 befs_dump_index_node(sb, node->od_node); in befs_bt_read_node()
216 node->head.left = fs64_to_cpu(sb, node->od_node->left); in befs_bt_read_node()
217 node->head.right = fs64_to_cpu(sb, node->od_node->right); in befs_bt_read_node()
218 node->head.overflow = fs64_to_cpu(sb, node->od_node->overflow); in befs_bt_read_node()
220 fs16_to_cpu(sb, node->od_node->all_key_count); in befs_bt_read_node()
222 fs16_to_cpu(sb, node->od_node->all_key_length); in befs_bt_read_node()
224 befs_debug(sb, "<--- befs_btree_read_node()"); in befs_bt_read_node()
247 befs_btree_find(struct super_block *sb, befs_data_stream * ds, in befs_btree_find() argument
255 befs_debug(sb, "---> befs_btree_find() Key: %s", key); in befs_btree_find()
257 if (befs_bt_read_super(sb, ds, &bt_super) != BEFS_OK) { in befs_btree_find()
258 befs_error(sb, in befs_btree_find()
266 befs_error(sb, "befs_btree_find() failed to allocate %u " in befs_btree_find()
275 if (befs_bt_read_node(sb, ds, this_node, node_off) != BEFS_OK) { in befs_btree_find()
276 befs_error(sb, "befs_btree_find() failed to read " in befs_btree_find()
282 res = befs_find_key(sb, this_node, key, &node_off); in befs_btree_find()
286 if (befs_bt_read_node(sb, ds, this_node, node_off) != BEFS_OK) { in befs_btree_find()
287 befs_error(sb, "befs_btree_find() failed to read " in befs_btree_find()
295 res = befs_find_key(sb, this_node, key, value); in befs_btree_find()
301 befs_debug(sb, "<--- befs_btree_find() Key %s not found", key); in befs_btree_find()
305 befs_debug(sb, "<--- befs_btree_find() Found key %s, value %Lu", in befs_btree_find()
313 befs_debug(sb, "<--- befs_btree_find() ERROR"); in befs_btree_find()
336 befs_find_key(struct super_block *sb, befs_btree_node * node, in befs_find_key() argument
346 befs_debug(sb, "---> befs_find_key() %s", findkey); in befs_find_key()
354 thiskey = befs_bt_get_key(sb, node, last, &keylen); in befs_find_key()
358 befs_debug(sb, "<--- befs_find_key() %s not found", findkey); in befs_find_key()
369 befs_debug(sb, "first: %d, last: %d, mid: %d", first, last, in befs_find_key()
371 thiskey = befs_bt_get_key(sb, node, mid, &keylen); in befs_find_key()
376 befs_debug(sb, "<--- befs_find_key() found %s at %d", in befs_find_key()
379 *value = fs64_to_cpu(sb, valarray[mid]); in befs_find_key()
388 *value = fs64_to_cpu(sb, valarray[mid + 1]); in befs_find_key()
390 *value = fs64_to_cpu(sb, valarray[mid]); in befs_find_key()
391 befs_debug(sb, "<--- befs_find_key() found %s at %d", thiskey, mid); in befs_find_key()
416 befs_btree_read(struct super_block *sb, befs_data_stream * ds, in befs_btree_read() argument
431 befs_debug(sb, "---> befs_btree_read()"); in befs_btree_read()
433 if (befs_bt_read_super(sb, ds, &bt_super) != BEFS_OK) { in befs_btree_read()
434 befs_error(sb, in befs_btree_read()
440 befs_error(sb, "befs_btree_read() failed to allocate %u " in befs_btree_read()
449 res = befs_btree_seekleaf(sb, ds, &bt_super, this_node, &node_off); in befs_btree_read()
455 befs_debug(sb, "<--- befs_btree_read() Tree is EMPTY"); in befs_btree_read()
469 befs_debug(sb, in befs_btree_read()
480 if (befs_bt_read_node(sb, ds, this_node, node_off) != BEFS_OK) { in befs_btree_read()
481 befs_error(sb, "befs_btree_read() failed to read " in befs_btree_read()
493 keystart = befs_bt_get_key(sb, this_node, cur_key, &keylen); in befs_btree_read()
495 befs_debug(sb, "Read [%Lu,%d]: keysize %d", node_off, cur_key, keylen); in befs_btree_read()
498 befs_error(sb, "befs_btree_read() keybuf too small (%u) " in befs_btree_read()
505 *value = fs64_to_cpu(sb, valarray[cur_key]); in befs_btree_read()
509 befs_debug(sb, "Read [%Lu,%d]: Key \"%.*s\", Value %Lu", node_off, in befs_btree_read()
515 befs_debug(sb, "<--- befs_btree_read()"); in befs_btree_read()
525 befs_debug(sb, "<--- befs_btree_read() ERROR"); in befs_btree_read()
545 befs_btree_seekleaf(struct super_block *sb, befs_data_stream * ds, in befs_btree_seekleaf() argument
550 befs_debug(sb, "---> befs_btree_seekleaf()"); in befs_btree_seekleaf()
552 if (befs_bt_read_node(sb, ds, this_node, *node_off) != BEFS_OK) { in befs_btree_seekleaf()
553 befs_error(sb, "befs_btree_seekleaf() failed to read " in befs_btree_seekleaf()
557 befs_debug(sb, "Seekleaf to root node %Lu", *node_off); in befs_btree_seekleaf()
560 befs_debug(sb, "<--- befs_btree_seekleaf() Tree is EMPTY"); in befs_btree_seekleaf()
567 befs_debug(sb, "befs_btree_seekleaf() encountered " in befs_btree_seekleaf()
574 *node_off = fs64_to_cpu(sb, valarray[0]); in befs_btree_seekleaf()
576 if (befs_bt_read_node(sb, ds, this_node, *node_off) != BEFS_OK) { in befs_btree_seekleaf()
577 befs_error(sb, "befs_btree_seekleaf() failed to read " in befs_btree_seekleaf()
582 befs_debug(sb, "Seekleaf to child node %Lu", *node_off); in befs_btree_seekleaf()
584 befs_debug(sb, "Node %Lu is a leaf node", *node_off); in befs_btree_seekleaf()
589 befs_debug(sb, "<--- befs_btree_seekleaf() ERROR"); in befs_btree_seekleaf()
677 befs_bt_get_key(struct super_block *sb, befs_btree_node * node, in befs_bt_get_key() argument
695 prev_key_end = fs16_to_cpu(sb, keylen_index[index - 1]); in befs_bt_get_key()
697 *keylen = fs16_to_cpu(sb, keylen_index[index]) - prev_key_end; in befs_bt_get_key()