xfs_db: add merkle tree geometry calculations
Amend the btheight debugger command so that we can compute merkle tree
geometry for fsverity.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
diff --git a/db/btheight.c b/db/btheight.c
index 14081c9..cfac3ea 100644
--- a/db/btheight.c
+++ b/db/btheight.c
@@ -204,10 +204,6 @@
perror(p);
goto out;
}
- if (ptr_size == 0) {
- fprintf(stderr, _("%s: pointer size cannot be zero.\n"), tag);
- goto out;
- }
p = strtok(NULL, ":");
if (!p) {
@@ -222,8 +218,10 @@
blocksize -= XFS_BTREE_LBLOCK_LEN;
else if (!strcmp(p, "longcrc"))
blocksize -= XFS_BTREE_LBLOCK_CRC_LEN;
+ else if (!strcmp(p, "merkle"))
+ ; /* no header */
else {
- fprintf(stderr, _("%s: unrecognized btree header type."),
+ fprintf(stderr, _("%s: unrecognized btree header type.\n"),
p);
goto out;
}