2008-05-21 12:49:58

by Kalpak Shah

[permalink] [raw]
Subject: [PATCH] Display bad depth in error message

Hi,

It would be good to actually print the bad htree depth as part of the error message.

Signed-off-by: Kalpak Shah <[email protected]>

Index: e2fsprogs-1.40.7/e2fsck/pass2.c
===================================================================
--- e2fsprogs-1.40.7.orig/e2fsck/pass2.c
+++ e2fsprogs-1.40.7/e2fsck/pass2.c
@@ -213,6 +213,7 @@ void e2fsck_pass2(e2fsck_t ctx)
if (dx_db->type == DX_DIRBLOCK_LEAF) {
depth = htree_depth(dx_dir, dx_db);
if (depth != dx_dir->depth) {
+ pctx.num = dx_dir->depth;
code = PR_2_HTREE_BAD_DEPTH;
fix_problem(ctx, code, &pctx);
bad_dir++;
Index: e2fsprogs-1.40.7/e2fsck/problem.c
===================================================================
--- e2fsprogs-1.40.7.orig/e2fsck/problem.c
+++ e2fsprogs-1.40.7/e2fsck/problem.c
@@ -1288,7 +1288,7 @@ static struct e2fsck_problem problem_tab

/* Node in HTREE directory has invalid depth */
{ PR_2_HTREE_BAD_DEPTH,
- N_("@p @h %d: node (%B) has @n depth\n"),
+ N_("@p @h %d: node (%B) has @n depth (%N)\n"),
PROMPT_NONE, 0 },

/* Duplicate directory entry found */

Thanks,
Kalpak