]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blobdiff - misc/findsuper.c
Merge branch 'maint' into next
[thirdparty/e2fsprogs.git] / misc / findsuper.c
index e793e3b175b4f1a7cec5a8017b1f7f118a1f9729..ff20b98853776ba436372dac2bf9499e43444df5 100644 (file)
@@ -30,7 +30,7 @@
  *   findsuper /dev/hda
  *   findsuper /dev/hda 437760 1024   (my disk has cyls of 855*512)
  *
- * I suppose the next step is to figgure out a way to determine if
+ * I suppose the next step is to figure out a way to determine if
  * the block found is the first superblock somehow, and if so, build
  * a partition table from the superblocks found... but this is still
  * useful as is.
@@ -75,7 +75,7 @@
  * For new systems that have a block group number in the superblock it
  * is immediately clear which superblock is the first of a partition.
  * For old systems where no group numbers are given, the first
- * superblock can be recognised by the timestamp: all superblock
+ * superblock can be recognized by the timestamp: all superblock
  * copies have the creation time in s_mtime, except the first, which
  * has the last time e2fsck or tune2fs wrote to the filesystem.
  *
@@ -83,6 +83,7 @@
 
 #define _FILE_OFFSET_BITS 64
 
+#include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -93,7 +94,7 @@
 
 #include "ext2fs/ext2_fs.h"
 #include "ext2fs/ext2fs.h"
-#include "nls-enable.h"
+#include "support/nls-enable.h"
 
 #undef DEBUG
 
@@ -130,6 +131,7 @@ int main(int argc, char *argv[])
        setlocale(LC_CTYPE, "");
        bindtextdomain(NLS_CAT_NAME, LOCALEDIR);
        textdomain(NLS_CAT_NAME);
+       set_com_err_gettext(gettext);
 #endif
 
        while ((c = getopt (argc, argv, "j")) != EOF) {
@@ -170,7 +172,7 @@ int main(int argc, char *argv[])
                optind++;
        }
        if (sk < 0) {
-               fprintf(stderr, _("startkb should be positive, not %Lu\n"), sk);
+               fprintf(stderr, _("startkb should be positive, not %llu\n"),sk);
                exit(1);
        }
 
@@ -181,11 +183,11 @@ int main(int argc, char *argv[])
        }
 
        /* Now, go looking for the superblock! */
-       printf(_("starting at %Lu, with %u byte increments\n"), sk, skiprate);
+       printf(_("starting at %llu, with %u byte increments\n"), sk, skiprate);
        if (print_jnl_copies)
                printf(_("[*] probably superblock written in the ext3 "
                         "journal superblock,\n\tso start/end/grp wrong\n"));
-       printf(_("byte_offset  byte_start     byte_end  fs_blocks blksz  grp  last_mount_time           sb_uuid label\n"));
+       printf(_("byte_offset  byte_start     byte_end  fs_blocks blksz  grp  mkfs/mount_time           sb_uuid label\n"));
        for (; lseek64(fd, sk, SEEK_SET) != -1 &&
               read(fd, &ext2, 512) == 512; sk += skiprate) {
                static unsigned char last_uuid[16] = "blah";
@@ -228,7 +230,10 @@ int main(int argc, char *argv[])
                        WHY("free_inodes_count > inodes_count (%u > %u)\n",
                            ext2.s_free_inodes_count, ext2.s_inodes_count);
 
-               tm = ext2.s_mtime;
+               if (ext2.s_mkfs_time != 0)
+                       tm = ext2.s_mkfs_time;
+               else
+                       tm = ext2.s_mtime;
                s = ctime(&tm);
                s[24] = 0;
                bsize = 1 << (ext2.s_log_block_size + 10);