Skip to content

Commit f7d4085

Browse files
committed
node.c: Print index values aligned and rename the second field to "key".
It's becoming more clear that the second field is used to binary search the entries without having to parse the entries themselves. It doesn't seem to be used for regular directory nodes, where the key is set to 0xFFFF for all entries but extent nodes have ascending values corresponding to the cumulative number of mapped clusters in the node after each entry, up to the point where the value oveflows 0xFFFF, after which 0xFFFF is written as key in all subsequent index entries (it's likely that the extent entry itself needs to be consulted for entries with 0xFFFF as key).
1 parent 918195e commit f7d4085

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

librefs/node.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3998,11 +3998,11 @@ static int parse_generic_block(
39983998
PRAX32(value_offsets_start_real));
39993999
i = value_offsets_start_real;
40004000
for(; i < value_offsets_end_real; i += 4) {
4001-
emit(prefix, indent + 1, "[%" PRIuz "] @ %" PRIu32 " / "
4002-
"0x%" PRIX32 ": %" PRIu16 " / "
4003-
"0x%" PRIX16 " (absolute: %" PRIu32 " / "
4004-
"0x%" PRIX32 ") flags / unknown: "
4005-
"0x%" PRIX16,
4001+
emit(prefix, indent + 1, "[%4" PRIuz "] @ "
4002+
"%4" PRIu32 " / 0x%04" PRIX32 ": Offset: "
4003+
"%5" PRIu16 " / 0x%04" PRIX16 " (absolute: "
4004+
"%5" PRIu32 " / 0x%04" PRIX32 ") Key: "
4005+
"%5" PRIu16 " / 0x%04" PRIX16,
40064006
PRAuz((i - value_offsets_start_real) /
40074007
4),
40084008
PRAu32(i),
@@ -4013,6 +4013,7 @@ static int parse_generic_block(
40134013
read_le16(&block[i])),
40144014
PRAX32(first_table_entry_end +
40154015
read_le16(&block[i])),
4016+
PRAu16(read_le16(&block[i + 2])),
40164017
PRAX16(read_le16(&block[i + 2])));
40174018
}
40184019
}

0 commit comments

Comments
 (0)