Whamcloud - gitweb
debugfs.c (do_show_super_stats): Calculate and print the number
authorTheodore Ts'o <tytso@mit.edu>
Mon, 15 Jul 2002 20:56:41 +0000 (16:56 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 15 Jul 2002 20:56:41 +0000 (16:56 -0400)
of directories on a filesystem --- because we can and
because it can be useful.

debugfs/ChangeLog
debugfs/debugfs.c

index 24977f0..aacb43d 100644 (file)
@@ -1,3 +1,9 @@
+2002-07-15  Theodore Ts'o  <tytso@mit.edu>
+
+       * 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  <tytso@mit.edu>
 
        * debugfs.c (do_rmdir), debugfs.8.in: Implement the rmdir command.
index eaba9b8..e2f59c5 100644 (file)
@@ -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;