Lines Matching +full:depth +full:-
2 * Copyright 2000-2002 by Hans Reiser, licensing governed by reiserfs/README
4 * GRUB -- GRand Unified Bootloader
7 * (C) Copyright 2003 - 2004
11 * SPDX-License-Identifier: GPL-2.0+
52 return -1; in substring()
67 printf ("%-10s %4hd %6d %6d %9d %24.24s", in sd_print_item()
74 printf ("%-10s %4d %6d %6d %9d %24.24s", in sd_print_item()
83 return reiserfs_devread ((INFO->journal_block + block) << INFO->blocksize_shift, in journal_read()
94 int transactions = INFO->journal_transactions; in block_read()
95 int desc_block = INFO->journal_first_desc; in block_read()
96 int journal_mask = INFO->journal_block_count - 1; in block_read()
99 while (transactions-- > 0) in block_read()
111 journal_table += j_len - i; in block_read()
139 if (__le32_to_cpu(commit.j_realblock[i++ - JOURNAL_TRANS_HALF]) == blockNr) in block_read()
146 translatedNr = INFO->journal_block + ((desc_block + i) & journal_mask); in block_read()
149 blockNr, translatedNr - INFO->journal_block); in block_read()
157 return reiserfs_devread (translatedNr << INFO->blocksize_shift, start, len, buffer); in block_read()
161 * possible in the JOURNAL_START-JOURNAL_END space, but if it is full
171 unsigned int block_count = INFO->journal_block_count; in journal_init()
185 INFO->journal_first_desc = desc_block; in journal_init()
202 commit_block = (desc_block + __le32_to_cpu(desc.j_len) + 1) & (block_count - 1); in journal_init()
246 *journal_table++ = commit.j_realblock[i-JOURNAL_TRANS_HALF]; in journal_init()
249 __le32_to_cpu(commit.j_realblock[i-JOURNAL_TRANS_HALF]), in journal_init()
255 desc_block = (commit_block + 1) & (block_count - 1); in journal_init()
262 INFO->journal_transactions in journal_init()
263 = next_trans_id - __le32_to_cpu(header.j_last_flush_trans_id) - 1; in journal_init()
310 INFO->version = sb_version(&super); in reiserfs_mount()
311 INFO->blocksize = sb_blocksize(&super); in reiserfs_mount()
312 INFO->fullblocksize_shift = log2 (sb_blocksize(&super)); in reiserfs_mount()
313 INFO->blocksize_shift = INFO->fullblocksize_shift - SECTOR_BITS; in reiserfs_mount()
314 INFO->cached_slots = in reiserfs_mount()
315 (FSYSREISER_CACHE_SIZE >> INFO->fullblocksize_shift) - 1; in reiserfs_mount()
319 INFO->version, INFO->blocksize); in reiserfs_mount()
323 memset (INFO->blocks, 0, sizeof (INFO->blocks)); in reiserfs_mount()
327 || (SECTOR_SIZE << INFO->blocksize_shift) != sb_blocksize(&super)) in reiserfs_mount()
333 INFO->journal_transactions = 0; in reiserfs_mount()
336 INFO->journal_block = sb_journal_block(&super); in reiserfs_mount()
337 INFO->journal_block_count = sb_journal_size(&super); in reiserfs_mount()
338 if (is_power_of_two (INFO->journal_block_count)) in reiserfs_mount()
342 block_read (superblock >> INFO->blocksize_shift, in reiserfs_mount()
346 if (! block_read (sb_root_block(&super), 0, INFO->blocksize, (char*) ROOT)) in reiserfs_mount()
350 INFO->tree_depth = __le16_to_cpu(BLOCKHEAD (cache)->blk_level); in reiserfs_mount()
353 printf ("root read_in: block=%d, depth=%d\n", in reiserfs_mount()
354 sb_root_block(&super), INFO->tree_depth); in reiserfs_mount()
357 if (INFO->tree_depth >= MAX_HEIGHT) in reiserfs_mount()
359 if (INFO->tree_depth == DISK_LEAF_NODE_LEVEL) in reiserfs_mount()
363 memcpy (LEAF, ROOT, INFO->blocksize); in reiserfs_mount()
376 * 2-n other nodes on current path from bottom to top.
389 /* Read in the node at the current path and depth into the node cache.
390 * You must set INFO->blocks[depth] before.
393 read_tree_node (unsigned int blockNr, int depth) in read_tree_node() argument
395 char* cache = CACHE(depth); in read_tree_node()
396 int num_cached = INFO->cached_slots; in read_tree_node()
397 if (depth < num_cached) in read_tree_node()
402 if (blockNr == INFO->blocks[depth]) in read_tree_node()
409 printf (" next read_in: block=%d (depth=%d)\n", in read_tree_node()
410 blockNr, depth); in read_tree_node()
412 if (! block_read (blockNr, 0, INFO->blocksize, cache)) in read_tree_node()
415 if (__le16_to_cpu(BLOCKHEAD (cache)->blk_level) != depth) in read_tree_node()
421 INFO->blocks[depth] = blockNr; in read_tree_node()
426 * tree order. INFO->current_ih and
427 * INFO->current_info are adapted accordingly. */
431 int depth; in next_key() local
432 struct item_head *ih = INFO->current_ih + 1; in next_key()
437 __le32_to_cpu(INFO->current_ih->ih_key.k_dir_id), in next_key()
438 __le32_to_cpu(INFO->current_ih->ih_key.k_objectid), in next_key()
439 __le32_to_cpu(INFO->current_ih->ih_key.u.v1.k_offset), in next_key()
440 __le32_to_cpu(INFO->current_ih->ih_key.u.v1.k_uniqueness), in next_key()
441 __le16_to_cpu(INFO->current_ih->ih_version)); in next_key()
444 if (ih == &ITEMHEAD[__le16_to_cpu(BLOCKHEAD (LEAF)->blk_nr_item)]) in next_key()
446 depth = DISK_LEAF_NODE_LEVEL; in next_key()
452 if (depth == INFO->tree_depth) in next_key()
456 ih = (struct item_head *) &BLOCKHEAD (LEAF)->blk_right_delim_key; in next_key()
459 depth++; in next_key()
461 printf (" depth=%d, i=%d\n", depth, INFO->next_key_nr[depth]); in next_key()
464 while (INFO->next_key_nr[depth] == 0); in next_key()
466 if (depth == INFO->tree_depth) in next_key()
468 else if (depth <= INFO->cached_slots) in next_key()
469 cache = CACHE (depth); in next_key()
472 cache = read_tree_node (INFO->blocks[depth], depth); in next_key()
479 int nr_item = __le16_to_cpu(BLOCKHEAD (cache)->blk_nr_item); in next_key()
480 int key_nr = INFO->next_key_nr[depth]++; in next_key()
482 printf (" depth=%d, i=%d/%d\n", depth, key_nr, nr_item); in next_key()
486 INFO->next_key_nr[depth] = 0; in next_key()
488 cache = read_tree_node (dc_block_number(&(DC (cache)[key_nr])), --depth); in next_key()
492 while (depth > DISK_LEAF_NODE_LEVEL); in next_key()
497 INFO->current_ih = ih; in next_key()
498 INFO->current_item = &LEAF[__le16_to_cpu(ih->ih_item_location)]; in next_key()
501 __le32_to_cpu(INFO->current_ih->ih_key.k_dir_id), in next_key()
502 __le32_to_cpu(INFO->current_ih->ih_key.k_objectid), in next_key()
503 __le32_to_cpu(INFO->current_ih->ih_key.u.v1.k_offset), in next_key()
504 __le32_to_cpu(INFO->current_ih->ih_key.u.v1.k_uniqueness), in next_key()
505 __le16_to_cpu(INFO->current_ih->ih_version)); in next_key()
516 * searched key. INFO->next_key contains the next key after
524 int depth; in search_stat() local
532 depth = INFO->tree_depth; in search_stat()
535 while (depth > DISK_LEAF_NODE_LEVEL) in search_stat()
538 nr_item = __le16_to_cpu(BLOCKHEAD (cache)->blk_nr_item); in search_stat()
544 if (__le32_to_cpu(key->k_dir_id) > dir_id in search_stat()
545 || (__le32_to_cpu(key->k_dir_id) == dir_id in search_stat()
546 && (__le32_to_cpu(key->k_objectid) > objectid in search_stat()
547 || (__le32_to_cpu(key->k_objectid) == objectid in search_stat()
548 && (__le32_to_cpu(key->u.v1.k_offset) in search_stat()
549 | __le32_to_cpu(key->u.v1.k_uniqueness)) > 0)))) in search_stat()
555 printf (" depth=%d, i=%d/%d\n", depth, i, nr_item); in search_stat()
557 INFO->next_key_nr[depth] = (i == nr_item) ? 0 : i+1; in search_stat()
558 cache = read_tree_node (dc_block_number(&(DC (cache)[i])), --depth); in search_stat()
564 nr_item = __le16_to_cpu(BLOCKHEAD (LEAF)->blk_nr_item); in search_stat()
568 if (__le32_to_cpu(ih->ih_key.k_dir_id) == dir_id in search_stat()
569 && __le32_to_cpu(ih->ih_key.k_objectid) == objectid in search_stat()
570 && __le32_to_cpu(ih->ih_key.u.v1.k_offset) == 0 in search_stat()
571 && __le32_to_cpu(ih->ih_key.u.v1.k_uniqueness) == 0) in search_stat()
574 printf (" depth=%d, i=%d/%d\n", depth, i, nr_item); in search_stat()
576 INFO->current_ih = ih; in search_stat()
577 INFO->current_item = &LEAF[__le16_to_cpu(ih->ih_item_location)]; in search_stat()
596 filepos, len, (__u64) IH_KEY_OFFSET (INFO->current_ih) - 1); in reiserfs_read()
599 if (__le32_to_cpu(INFO->current_ih->ih_key.k_objectid) != INFO->fileinfo.k_objectid in reiserfs_read()
600 || IH_KEY_OFFSET (INFO->current_ih) > filepos + 1) in reiserfs_read()
602 search_stat (INFO->fileinfo.k_dir_id, INFO->fileinfo.k_objectid); in reiserfs_read()
608 if (__le32_to_cpu(INFO->current_ih->ih_key.k_objectid) != INFO->fileinfo.k_objectid) { in reiserfs_read()
612 offset = filepos - IH_KEY_OFFSET (INFO->current_ih) + 1; in reiserfs_read()
613 blocksize = __le16_to_cpu(INFO->current_ih->ih_item_len); in reiserfs_read()
620 if (IH_KEY_ISTYPE(INFO->current_ih, TYPE_DIRECT) in reiserfs_read()
627 to_read = blocksize - offset; in reiserfs_read()
631 memcpy (buf, INFO->current_item + offset, to_read); in reiserfs_read()
634 else if (IH_KEY_ISTYPE(INFO->current_ih, TYPE_INDIRECT)) in reiserfs_read()
636 blocksize = (blocksize >> 2) << INFO->fullblocksize_shift; in reiserfs_read()
644 __u32 blocknr = __le32_to_cpu(((__u32 *) INFO->current_item) in reiserfs_read()
645 [offset >> INFO->fullblocksize_shift]); in reiserfs_read()
646 int blk_offset = offset & (INFO->blocksize-1); in reiserfs_read()
647 to_read = INFO->blocksize - blk_offset; in reiserfs_read()
654 reiserfs_devread (blocknr << INFO->blocksize_shift, in reiserfs_read()
657 len -= to_read; in reiserfs_read()
669 return errnum ? 0 : buf - prev_buf; in reiserfs_read()
676 * postconditions: on a nonzero return, INFO->fileinfo contains the info
708 stat_data_v1(INFO->current_ih) ? sd_v1_mode((struct stat_data_v1 *) INFO->current_item) : in reiserfs_dir()
709 sd_v2_mode((struct stat_data *) (INFO->current_item)), in reiserfs_dir()
710 stat_data_v1(INFO->current_ih) ? sd_v1_size((struct stat_data_v1 *) INFO->current_item) : in reiserfs_dir()
711 sd_v2_size((struct stat_data *) INFO->current_item) in reiserfs_dir()
715 mode = stat_data_v1(INFO->current_ih) ? in reiserfs_dir()
716 sd_v1_mode((struct stat_data_v1 *) INFO->current_item) : in reiserfs_dir()
717 sd_v2_mode((struct stat_data *) INFO->current_item); in reiserfs_dir()
730 filemax = stat_data_v1(INFO->current_ih) ? in reiserfs_dir()
731 sd_v1_size((struct stat_data_v1 *) INFO->current_item) : in reiserfs_dir()
732 sd_v2_size((struct stat_data *) INFO->current_item); in reiserfs_dir()
739 if (filemax + len > sizeof (linkbuf) - 1) in reiserfs_dir()
749 INFO->fileinfo.k_dir_id = dir_id; in reiserfs_dir()
750 INFO->fileinfo.k_objectid = objectid; in reiserfs_dir()
794 filemax = stat_data_v1(INFO->current_ih) ? in reiserfs_dir()
795 sd_v1_size((struct stat_data_v1 *) INFO->current_item) : in reiserfs_dir()
796 sd_v2_size((struct stat_data *) INFO->current_item); in reiserfs_dir()
801 if (__le16_to_cpu(INFO->current_ih->ih_version) == ITEM_VERSION_2 in reiserfs_dir()
802 && sd_size_hi((struct stat_data *) INFO->current_item) > 0) in reiserfs_dir()
805 INFO->fileinfo.k_dir_id = dir_id; in reiserfs_dir()
806 INFO->fileinfo.k_objectid = objectid; in reiserfs_dir()
835 __le32_to_cpu(INFO->current_ih->ih_key.k_dir_id), in reiserfs_dir()
836 __le32_to_cpu(INFO->current_ih->ih_key.k_objectid), in reiserfs_dir()
837 __le32_to_cpu(INFO->current_ih->ih_key.u.v1.k_offset), in reiserfs_dir()
838 __le32_to_cpu(INFO->current_ih->ih_key.u.v1.k_uniqueness), in reiserfs_dir()
839 __le16_to_cpu(INFO->current_ih->ih_version)); in reiserfs_dir()
842 if (__le32_to_cpu(INFO->current_ih->ih_key.k_objectid) != objectid) in reiserfs_dir()
845 name_end = INFO->current_item + __le16_to_cpu(INFO->current_ih->ih_item_len); in reiserfs_dir()
846 de_head = (struct reiserfs_de_head *) INFO->current_item; in reiserfs_dir()
847 num_entries = __le16_to_cpu(INFO->current_ih->u.ih_entry_count); in reiserfs_dir()
850 char *filename = INFO->current_item + deh_location(de_head); in reiserfs_dir()
873 print_possibilities = -print_possibilities; in reiserfs_dir()
882 sd_print_item(INFO->current_ih, INFO->current_item); in reiserfs_dir()
898 num_entries--; in reiserfs_dir()
923 * U-Boot interface functions
929 * RETURN: 0 - OK, else grub_error_t errnum
959 * RETURN: >0 - OK, size of opened file
960 * <0 - ERROR -grub_error_t errnum
969 return -errnum; in reiserfs_open()