From 34be9609de977fe2e041c7b48fb9d4d0d6878bb1 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 15 Jul 2002 16:56:41 -0400 Subject: [PATCH] debugfs.c (do_show_super_stats): Calculate and print the number of directories on a filesystem --- because we can and because it can be useful. --- debugfs/ChangeLog | 6 ++++++ debugfs/debugfs.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/debugfs/ChangeLog b/debugfs/ChangeLog index 24977f0..aacb43d 100644 --- a/debugfs/ChangeLog +++ b/debugfs/ChangeLog @@ -1,3 +1,9 @@ +2002-07-15 Theodore Ts'o + + * debugfs.c (do_show_super_stats): Calculate and print the number + of directories on a filesystem --- because we can and + because it can be useful. + 2002-07-09 Theodore Ts'o * debugfs.c (do_rmdir), debugfs.8.in: Implement the rmdir command. diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index eaba9b8..e2f59c5 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -239,6 +239,7 @@ void do_show_super_stats(int argc, char *argv[]) FILE *out; struct ext2_group_desc *gdp; int c, header_only = 0; + int numdirs = 0; const char *usage = "Usage: show_super [-h]"; optind = 0; @@ -264,7 +265,10 @@ void do_show_super_stats(int argc, char *argv[]) out = open_pager(); list_super2(current_fs->super, out); - + for (i=0; i < current_fs->group_desc_count; i++) + numdirs += current_fs->group_desc[i].bg_used_dirs_count; + fprintf(out, "Directories: %d\n", numdirs); + if (header_only) { close_pager(out); return; -- 1.8.3.1