Whamcloud - gitweb
Add a new superblock field, s_mkfs_time, which indicates when
authorTheodore Ts'o <tytso@mit.edu>
Fri, 25 Oct 2002 21:29:55 +0000 (17:29 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 25 Oct 2002 21:29:55 +0000 (17:29 -0400)
the filesystem was created.  It is set via mke2fs, and printed
via list_super2() (which is called by dumpe2fs).

Also, list_super2() will now print "n/a" if the last mount time
(s_mtime) is zero.

lib/e2p/ChangeLog
lib/e2p/ls.c
lib/ext2fs/ChangeLog
lib/ext2fs/ext2_fs.h
lib/ext2fs/initialize.c

index 8c10fc1..252e40c 100644 (file)
@@ -1,3 +1,9 @@
+2002-10-25  Theodore Ts'o  <tytso@mit.edu>
+
+       * ls.c (list_super2): Print the s_mkfs_time field if it is
+               present.  If the last mount time (s_mtime) is zero, print
+               "n/a".
+
 2002-10-20  Theodore Ts'o  <tytso@valinux.com>
 
        * e2p.h (e2p_string2mntopt), mntopts.c, ls.c (print_mntopts):
index cc3e3ca..9e2b1b5 100644 (file)
@@ -207,11 +207,16 @@ void list_super2(struct ext2_super_block * sb, FILE *f)
        fprintf(f, "Fragments per group:      %u\n", sb->s_frags_per_group);
        fprintf(f, "Inodes per group:         %u\n", sb->s_inodes_per_group);
        fprintf(f, "Inode blocks per group:   %u\n", inode_blocks_per_group);
-       tm = sb->s_mtime;
        if (sb->s_first_meta_bg)
                fprintf(f, "First meta block group:   %u\n",
                        sb->s_first_meta_bg);
-       fprintf(f, "Last mount time:          %s", ctime(&tm));
+       if (sb->s_mkfs_time) {
+               tm = sb->s_mkfs_time;
+               fprintf(f, "Filesystem created:       %s", ctime(&tm));
+       }
+       tm = sb->s_mtime;
+       fprintf(f, "Last mount time:          %s",
+               sb->s_mtime ? ctime(&tm) : "n/a\n");
        tm = sb->s_wtime;
        fprintf(f, "Last write time:          %s", ctime(&tm));
        fprintf(f, "Mount count:              %u\n", sb->s_mnt_count);
index 5d0974f..079615c 100644 (file)
@@ -1,3 +1,11 @@
+2002-10-25  Theodore Ts'o  <tytso@mit.edu>
+
+       * ext2_fs.h: Add a new superblock field, s_mkfs_time, so that we
+               know when a filesystem was created.  (Sometimes this can
+               be useful...)
+
+       * initialize.c (ext2fs_initialize): Set the s_mkfs_time field.
+
 2002-10-20  Theodore Ts'o  <tytso@valinux.com>
 
        * ext2_fs.h (EXT3_DEFM_JMODE): Add new default mount options for
index ca53902..7cd679d 100644 (file)
@@ -440,7 +440,8 @@ struct ext2_super_block {
        __u16   s_reserved_word_pad;
        __u32   s_default_mount_opts;
        __u32   s_first_meta_bg;        /* First metablock group */
-       __u32   s_reserved[190];        /* Padding to the end of the block */
+       __u32   s_mkfs_time;            /* When the filesystem was created */
+       __u32   s_reserved[189];        /* Padding to the end of the block */
 };
 
 /*
index d9be945..ecb27d7 100644 (file)
@@ -127,7 +127,7 @@ errcode_t ext2fs_initialize(const char *name, int flags,
        }
 
        set_field(s_checkinterval, EXT2_DFL_CHECKINTERVAL);
-       super->s_lastcheck = time(NULL);
+       super->s_mkfs_time = super->s_lastcheck = time(NULL);
 
        super->s_creator_os = CREATOR_OS;