[PATCH 21/22] Pad numerical output of debugfs readdir and add total entries
Valerie Aurora
val at versity.com
Tue Feb 11 13:19:19 PST 2025
For ease of comparison, zero pad the keys printed out by debugfs
readdir and pad the inode and version numbers with spaces. Also print
the total entries.
Signed-off-by: Valerie Aurora <val at versity.com>
---
cli/debugfs.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/cli/debugfs.c b/cli/debugfs.c
index 2ac47a8..3fc4c76 100644
--- a/cli/debugfs.c
+++ b/cli/debugfs.c
@@ -76,6 +76,7 @@ static void cmd_readdir(struct debugfs_context *ctx, int argc, char **argv)
struct ngnfs_readdir_entry *buf;
struct ngnfs_readdir_entry *ent;
const int size = NGNFS_READDIR_MIN_BUF_SIZE * 10;
+ u64 total = 0;
u64 pos;
int ret;
int i;
@@ -97,15 +98,17 @@ static void cmd_readdir(struct debugfs_context *ctx, int argc, char **argv)
ent = buf;
for (i = 0; i < ret; i++) {
- printf("%llu %llu %llu %.*s\n", ent->pos, ent->ino, ent->gen,
+ printf("%020llu %10llu %5llu %.*s\n", ent->pos, ent->ino, ent->gen,
ent->name_len, ent->name);
pos = ent->pos;
ent = (void *)ent + ent->next_offset;
}
+ total += ret;
if (pos++ == U64_MAX)
break;
}
+ printf("total %llu\n", total);
free(buf);
}
--
2.48.1
More information about the ngnfs-devel
mailing list