Whamcloud - gitweb
LU-14712 e2fsprogs: support EXT2_FLAG_BG_TRIMMED and EXT2_FLAGS_TRACK_TRIM
[tools/e2fsprogs.git] / lib / e2p / ls.c
index a132047..b40929c 100644 (file)
@@ -6,12 +6,16 @@
  *                                 Universite Pierre et Marie Curie (Paris VI)
  *
  * Copyright (C) 1995, 1996, 1997  Theodore Ts'o <tytso@mit.edu>
- * 
- * This file can be redistributed under the terms of the GNU Library General
- * Public License
+ *
+ * %Begin-Header%
+ * This file may be redistributed under the terms of the GNU Library
+ * General Public License, version 2.
+ * %End-Header%
  */
 
+#include "config.h"
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/types.h>
 #include <string.h>
 #include <grp.h>
 #include <time.h>
 
 #include "e2p.h"
+#include "support/quotaio.h"
 
-/*
- * The ext2fs library private definition of the ext2 superblock, so we
- * don't have to depend on the kernel's definition of the superblock,
- * which might not have the latest features.
- */
-struct ext2fs_sb {
-       __u32   s_inodes_count;         /* Inodes count */
-       __u32   s_blocks_count;         /* Blocks count */
-       __u32   s_r_blocks_count;       /* Reserved blocks count */
-       __u32   s_free_blocks_count;    /* Free blocks count */
-       __u32   s_free_inodes_count;    /* Free inodes count */
-       __u32   s_first_data_block;     /* First Data Block */
-       __u32   s_log_block_size;       /* Block size */
-       __s32   s_log_frag_size;        /* Fragment size */
-       __u32   s_blocks_per_group;     /* # Blocks per group */
-       __u32   s_frags_per_group;      /* # Fragments per group */
-       __u32   s_inodes_per_group;     /* # Inodes per group */
-       __u32   s_mtime;                /* Mount time */
-       __u32   s_wtime;                /* Write time */
-       __u16   s_mnt_count;            /* Mount count */
-       __s16   s_max_mnt_count;        /* Maximal mount count */
-       __u16   s_magic;                /* Magic signature */
-       __u16   s_state;                /* File system state */
-       __u16   s_errors;               /* Behaviour when detecting errors */
-       __u16   s_minor_rev_level;      /* minor revision level */
-       __u32   s_lastcheck;            /* time of last check */
-       __u32   s_checkinterval;        /* max. time between checks */
-       __u32   s_creator_os;           /* OS */
-       __u32   s_rev_level;            /* Revision level */
-       __u16   s_def_resuid;           /* Default uid for reserved blocks */
-       __u16   s_def_resgid;           /* Default gid for reserved blocks */
-       /*
-        * These fields are for EXT2_DYNAMIC_REV superblocks only.
-        *
-        * Note: the difference between the compatible feature set and
-        * the incompatible feature set is that if there is a bit set
-        * in the incompatible feature set that the kernel doesn't
-        * know about, it should refuse to mount the filesystem.
-        * 
-        * e2fsck's requirements are more strict; if it doesn't know
-        * about a feature in either the compatible or incompatible
-        * feature set, it must abort and not try to meddle with
-        * things it doesn't understand...
-        */
-       __u32   s_first_ino;            /* First non-reserved inode */
-       __u16   s_inode_size;           /* size of inode structure */
-       __u16   s_block_group_nr;       /* block group # of this superblock */
-       __u32   s_feature_compat;       /* compatible feature set */
-       __u32   s_feature_incompat;     /* incompatible feature set */
-       __u32   s_feature_ro_compat;    /* readonly-compatible feature set */
-       __u8    s_uuid[16];             /* 128-bit uuid for volume */
-       char    s_volume_name[16];      /* volume name */
-       char    s_last_mounted[64];     /* directory where last mounted */
-       __u32   s_reserved[206];        /* Padding to the end of the block */
-};
-
-static void print_user (unsigned short uid)
+static void print_user (unsigned short uid, FILE *f)
 {
        struct passwd *pw;
 
-       printf ("%u ", uid);
+       fprintf(f, "%u ", uid);
        pw = getpwuid (uid);
        if (pw == NULL)
-               printf ("(user unknown)\n");
+               fprintf(f, "(user unknown)\n");
        else
-               printf ("(user %s)\n", pw->pw_name);
+               fprintf(f, "(user %s)\n", pw->pw_name);
 }
 
-static void print_group (unsigned short gid)
+static void print_group (unsigned short gid, FILE *f)
 {
        struct group *gr;
 
-       printf ("%u ", gid);
+       fprintf(f, "%u ", gid);
        gr = getgrgid (gid);
        if (gr == NULL)
-               printf ("(group unknown)\n");
+               fprintf(f, "(group unknown)\n");
        else
-               printf ("(group %s)\n", gr->gr_name);
+               fprintf(f, "(group %s)\n", gr->gr_name);
 }
 
 #define MONTH_INT (86400 * 30)
@@ -147,98 +96,403 @@ static const char *interval_string(unsigned int secs)
        return buf;
 }
 
+static void print_features(struct ext2_super_block * s, FILE *f)
+{
+#ifdef EXT2_DYNAMIC_REV
+       int     i, j, printed=0;
+       __u32   *mask = &s->s_feature_compat, m;
+
+       fprintf(f, "Filesystem features:     ");
+       for (i=0; i <3; i++,mask++) {
+               for (j=0,m=1; j < 32; j++, m<<=1) {
+                       if (*mask & m) {
+                               fprintf(f, " %s", e2p_feature2string(i, m));
+                               printed++;
+                       }
+               }
+       }
+       if (printed == 0)
+               fprintf(f, " (none)");
+       fprintf(f, "\n");
+#endif
+}
+
+static void print_mntopts(struct ext2_super_block * s, FILE *f)
+{
+#ifdef EXT2_DYNAMIC_REV
+       int     i, printed=0;
+       __u32   mask = s->s_default_mount_opts, m;
+
+       fprintf(f, "Default mount options:   ");
+       if (mask & EXT3_DEFM_JMODE) {
+               fprintf(f, " %s", e2p_mntopt2string(mask & EXT3_DEFM_JMODE));
+               printed++;
+       }
+       for (i=0,m=1; i < 32; i++, m<<=1) {
+               if (m & EXT3_DEFM_JMODE)
+                       continue;
+               if (mask & m) {
+                       fprintf(f, " %s", e2p_mntopt2string(m));
+                       printed++;
+               }
+       }
+       if (printed == 0)
+               fprintf(f, " (none)");
+       fprintf(f, "\n");
+#endif
+}
+
+static void print_super_flags(struct ext2_super_block * s, FILE *f)
+{
+       int     flags_found = 0;
+
+       if (s->s_flags == 0)
+               return;
+
+       fputs("Filesystem flags:         ", f);
+       if (s->s_flags & EXT2_FLAGS_SIGNED_HASH) {
+               fputs("signed_directory_hash ", f);
+               flags_found++;
+       }
+       if (s->s_flags & EXT2_FLAGS_UNSIGNED_HASH) {
+               fputs("unsigned_directory_hash ", f);
+               flags_found++;
+       }
+       if (s->s_flags & EXT2_FLAGS_TEST_FILESYS) {
+               fputs("test_filesystem ", f);
+               flags_found++;
+       }
+       if (s->s_flags & EXT2_FLAGS_TRACK_TRIM) {
+               fputs("track_trim ", f);
+               flags_found++;
+       }
+       if (s->s_flags & EXT2_FLAGS_HAS_IOPS) {
+               fputs("iops ", f);
+               flags_found++;
+       }
+       if (flags_found)
+               fputs("\n", f);
+       else
+               fputs("(none)\n", f);
+}
+
+static __u64 e2p_blocks_count(struct ext2_super_block *super)
+{
+       return super->s_blocks_count |
+               (ext2fs_has_feature_64bit(super) ?
+               (__u64) super->s_blocks_count_hi << 32 : 0);
+}
+
+static __u64 e2p_r_blocks_count(struct ext2_super_block *super)
+{
+       return super->s_r_blocks_count |
+               (ext2fs_has_feature_64bit(super) ?
+               (__u64) super->s_r_blocks_count_hi << 32 : 0);
+}
+
+static __u64 e2p_free_blocks_count(struct ext2_super_block *super)
+{
+       return super->s_free_blocks_count |
+               (ext2fs_has_feature_64bit(super) ?
+               (__u64) super->s_free_blocks_hi << 32 : 0);
+}
 
 #ifndef EXT2_INODE_SIZE
 #define EXT2_INODE_SIZE(s) sizeof(struct ext2_inode)
 #endif
 
-void list_super (struct ext2_super_block * s)
+#ifndef EXT2_GOOD_OLD_REV
+#define EXT2_GOOD_OLD_REV 0
+#endif
+
+static const char *checksum_type(__u8 type)
+{
+       switch (type) {
+       case EXT2_CRC32C_CHKSUM:
+               return "crc32c";
+       default:
+               return "unknown";
+       }
+}
+
+static const char *quota_prefix[MAXQUOTAS] = {
+       [USRQUOTA] = "User quota inode:",
+       [GRPQUOTA] = "Group quota inode:",
+       [PRJQUOTA] = "Project quota inode:",
+};
+
+/**
+ * Convert type of quota to written representation
+ */
+static const char *quota_type2prefix(enum quota_type qtype)
+{
+       return quota_prefix[qtype];
+}
+
+void list_super2(struct ext2_super_block * sb, FILE *f)
 {
        int inode_blocks_per_group;
-       struct ext2fs_sb *sb = (struct ext2fs_sb *) s;
-       char buf[80];
-       const char *os;
+       char *str;
        time_t  tm;
+       enum quota_type qtype;
 
-       inode_blocks_per_group = (((s->s_inodes_per_group *
-                                   EXT2_INODE_SIZE(s)) +
-                                  EXT2_BLOCK_SIZE(s) - 1) /
-                                 EXT2_BLOCK_SIZE(s));
-       printf ("Filesystem magic number:  0x%04X\n", s->s_magic);
-       printf ("Filesystem revision #:    %d\n", s->s_rev_level);
-       if (sb->s_volume_name[0]) {
-               memset(buf, 0, sizeof(buf));
-               strncpy(buf, sb->s_volume_name, sizeof(sb->s_volume_name));
-       } else
-               strcpy(buf, "<none>");
-       printf("Filesystem volume name:   %s\n", buf);
-       if (sb->s_last_mounted[0]) {
-               memset(buf, 0, sizeof(buf));
-               strncpy(buf, sb->s_last_mounted, sizeof(sb->s_last_mounted));
-       } else
-               strcpy(buf, "<not available>");
-       printf("Last mounted on:          %s\n", buf);
-       if (!e2p_is_null_uuid(sb->s_uuid)) {
-               e2p_uuid_to_str(sb->s_uuid, buf);
+       inode_blocks_per_group = (((sb->s_inodes_per_group *
+                                   EXT2_INODE_SIZE(sb)) +
+                                  EXT2_BLOCK_SIZE(sb) - 1) /
+                                 EXT2_BLOCK_SIZE(sb));
+       if (sb->s_volume_name[0])
+               fprintf(f, "Filesystem volume name:   %.*s\n",
+                       EXT2_LEN_STR(sb->s_volume_name));
+       else
+               fprintf(f, "Filesystem volume name:   <none>\n");
+       if (sb->s_last_mounted[0])
+               fprintf(f, "Last mounted on:          %.*s\n",
+                       EXT2_LEN_STR(sb->s_last_mounted));
+       else
+               fprintf(f, "Last mounted on:          <not available>\n");
+       fprintf(f, "Filesystem UUID:          %s\n", e2p_uuid2str(sb->s_uuid));
+       fprintf(f, "Filesystem magic number:  0x%04X\n", sb->s_magic);
+       fprintf(f, "Filesystem revision #:    %d", sb->s_rev_level);
+       if (sb->s_rev_level == EXT2_GOOD_OLD_REV) {
+               fprintf(f, " (original)\n");
+#ifdef EXT2_DYNAMIC_REV
+       } else if (sb->s_rev_level == EXT2_DYNAMIC_REV) {
+               fprintf(f, " (dynamic)\n");
+#endif
        } else
-               strcpy(buf, "<none>");
-       printf("Filesystem UUID:          %s\n", buf);
-       printf ("Filesystem state:        ");
-       print_fs_state (stdout, s->s_state);
-       printf ("\n");
-       printf ("Errors behavior:          ");
-       print_fs_errors (stdout, s->s_errors);
-       printf ("\n");
-       switch (s->s_creator_os) {
-           case EXT2_OS_LINUX: os = "Linux"; break;
-           case EXT2_OS_HURD:  os = "GNU"; break;
-           case EXT2_OS_MASIX: os = "Masix"; break;
-           default:            os = "unknown"; break;
-       }
-       printf("Filesystem OS type:       %s\n", os);
-       printf("Inode count:              %u\n", s->s_inodes_count);
-       printf("Block count:              %u\n", s->s_blocks_count);
-       printf("Reserved block count:     %u\n", s->s_r_blocks_count);
-       printf("Free blocks:              %u\n", s->s_free_blocks_count);
-       printf("Free inodes:              %u\n", s->s_free_inodes_count);
-       printf("First block:              %u\n", s->s_first_data_block);
-       printf("Block size:               %u\n", EXT2_BLOCK_SIZE(s));
-       printf("Fragment size:            %u\n", EXT2_FRAG_SIZE(s));
-       printf("Blocks per group:         %u\n", s->s_blocks_per_group);
-       printf("Fragments per group:      %u\n", s->s_frags_per_group);
-       printf("Inodes per group:         %u\n", s->s_inodes_per_group);
-       printf("Inode blocks per group:   %u\n", inode_blocks_per_group);
-       tm = s->s_mtime;
-       printf("Last mount time:          %s", ctime(&tm));
-       tm = s->s_wtime;
-       printf("Last write time:          %s", ctime(&tm));
-       printf("Mount count:              %u\n", s->s_mnt_count);
-       printf("Maximum mount count:      %d\n", s->s_max_mnt_count);
-       tm = s->s_lastcheck;
-       printf("Last checked:             %s", ctime(&tm));
-       printf("Check interval:           %u (%s)\n", s->s_checkinterval,
-              interval_string(s->s_checkinterval));
-       if (s->s_checkinterval)
+               fprintf(f, " (unknown)\n");
+       print_features(sb, f);
+       print_super_flags(sb, f);
+       print_mntopts(sb, f);
+       if (sb->s_mount_opts[0])
+               fprintf(f, "Mount options:            %.*s\n",
+                       EXT2_LEN_STR(sb->s_mount_opts));
+       fprintf(f, "Filesystem state:        ");
+       print_fs_state (f, sb->s_state);
+       fprintf(f, "\n");
+       fprintf(f, "Errors behavior:          ");
+       print_fs_errors(f, sb->s_errors);
+       fprintf(f, "\n");
+       str = e2p_os2string(sb->s_creator_os);
+       fprintf(f, "Filesystem OS type:       %s\n", str);
+       free(str);
+       fprintf(f, "Inode count:              %u\n", sb->s_inodes_count);
+       fprintf(f, "Block count:              %llu\n",
+               (unsigned long long) e2p_blocks_count(sb));
+       fprintf(f, "Reserved block count:     %llu\n",
+               (unsigned long long) e2p_r_blocks_count(sb));
+       if (sb->s_overhead_clusters)
+               fprintf(f, "Overhead clusters:        %u\n",
+                       sb->s_overhead_clusters);
+       fprintf(f, "Free blocks:              %llu\n",
+               (unsigned long long) e2p_free_blocks_count(sb));
+       fprintf(f, "Free inodes:              %u\n", sb->s_free_inodes_count);
+       fprintf(f, "First block:              %u\n", sb->s_first_data_block);
+       fprintf(f, "Block size:               %u\n", EXT2_BLOCK_SIZE(sb));
+       if (ext2fs_has_feature_bigalloc(sb))
+               fprintf(f, "Cluster size:             %u\n",
+                       EXT2_CLUSTER_SIZE(sb));
+       else
+               fprintf(f, "Fragment size:            %u\n",
+                       EXT2_CLUSTER_SIZE(sb));
+       if (ext2fs_has_feature_64bit(sb))
+               fprintf(f, "Group descriptor size:    %u\n", sb->s_desc_size);
+       if (sb->s_reserved_gdt_blocks)
+               fprintf(f, "Reserved GDT blocks:      %u\n",
+                       sb->s_reserved_gdt_blocks);
+       fprintf(f, "Blocks per group:         %u\n", sb->s_blocks_per_group);
+       if (ext2fs_has_feature_bigalloc(sb))
+               fprintf(f, "Clusters per group:       %u\n",
+                       sb->s_clusters_per_group);
+       else
+               fprintf(f, "Fragments per group:      %u\n",
+                       sb->s_clusters_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);
+       if (sb->s_raid_stride)
+               fprintf(f, "RAID stride:              %u\n",
+                       sb->s_raid_stride);
+       if (sb->s_raid_stripe_width)
+               fprintf(f, "RAID stripe width:        %u\n",
+                       sb->s_raid_stripe_width);
+       if (sb->s_first_meta_bg)
+               fprintf(f, "First meta block group:   %u\n",
+                       sb->s_first_meta_bg);
+       if (sb->s_log_groups_per_flex)
+               fprintf(f, "Flex block group size:    %u\n",
+                       1U << sb->s_log_groups_per_flex);
+       tm = ext2fs_get_tstamp(sb, s_mkfs_time);
+       if (tm)
+               fprintf(f, "Filesystem created:       %s", ctime(&tm));
+       tm = ext2fs_get_tstamp(sb, s_mtime);
+       fprintf(f, "Last mount time:          %s", tm ? ctime(&tm) : "n/a\n");
+       tm = ext2fs_get_tstamp(sb, s_wtime);
+       fprintf(f, "Last write time:          %s", ctime(&tm));
+       fprintf(f, "Mount count:              %u\n", sb->s_mnt_count);
+       fprintf(f, "Maximum mount count:      %d\n", sb->s_max_mnt_count);
+       tm = ext2fs_get_tstamp(sb, s_lastcheck);
+       fprintf(f, "Last checked:             %s", ctime(&tm));
+       fprintf(f, "Check interval:           %u (%s)\n", sb->s_checkinterval,
+              interval_string(sb->s_checkinterval));
+       if (sb->s_checkinterval)
        {
-               time_t next;
-
-               next = s->s_lastcheck + s->s_checkinterval;
-               printf("Next check after:         %s", ctime(&next));
+               tm += sb->s_checkinterval;
+               fprintf(f, "Next check after:         %s", ctime(&tm));
        }
-#ifdef EXT2_DEF_RESUID
-       printf("Reserved blocks uid:      ");
-       print_user(s->s_def_resuid);
-       printf("Reserved blocks gid:      ");
-       print_group(s->s_def_resgid);
-#endif
-#ifdef EXT2_DYNAMIC_REV
-       if (s->s_rev_level >= EXT2_DYNAMIC_REV) {
-               printf("First inode:              %d\n", s->s_first_ino);
-               printf("Inode size:               %d\n", s->s_inode_size);
+#define POW2(x) ((__u64) 1 << (x))
+       if (sb->s_kbytes_written) {
+               fprintf(f, "Lifetime writes:          ");
+               if (sb->s_kbytes_written < POW2(13))
+                       fprintf(f, "%llu kB\n",
+                               (unsigned long long) sb->s_kbytes_written);
+               else if (sb->s_kbytes_written < POW2(23))
+                 fprintf(f, "%llu MB\n", (unsigned long long)
+                         (sb->s_kbytes_written + POW2(9)) >> 10);
+               else if (sb->s_kbytes_written < POW2(33))
+                 fprintf(f, "%llu GB\n", (unsigned long long)
+                               (sb->s_kbytes_written + POW2(19)) >> 20);
+               else if (sb->s_kbytes_written < POW2(43))
+                       fprintf(f, "%llu TB\n", (unsigned long long)
+                               (sb->s_kbytes_written + POW2(29)) >> 30);
+               else
+                       fprintf(f, "%llu PB\n", (unsigned long long)
+                               (sb->s_kbytes_written + POW2(39)) >> 40);
+       }
+       fprintf(f, "Reserved blocks uid:      ");
+       print_user(sb->s_def_resuid, f);
+       fprintf(f, "Reserved blocks gid:      ");
+       print_group(sb->s_def_resgid, f);
+       if (sb->s_rev_level >= EXT2_DYNAMIC_REV) {
+               fprintf(f, "First inode:              %d\n", sb->s_first_ino);
+               fprintf(f, "Inode size:               %d\n", sb->s_inode_size);
+               if (sb->s_min_extra_isize)
+                       fprintf(f, "Required extra isize:     %d\n",
+                               sb->s_min_extra_isize);
+               if (sb->s_want_extra_isize)
+                       fprintf(f, "Desired extra isize:      %d\n",
+                               sb->s_want_extra_isize);
+       }
+       if (!e2p_is_null_uuid(sb->s_journal_uuid))
+               fprintf(f, "Journal UUID:             %s\n",
+                       e2p_uuid2str(sb->s_journal_uuid));
+       if (sb->s_journal_inum)
+               fprintf(f, "Journal inode:            %u\n",
+                       sb->s_journal_inum);
+       if (sb->s_journal_dev)
+               fprintf(f, "Journal device:           0x%04x\n",
+                       sb->s_journal_dev);
+       if (sb->s_last_orphan)
+               fprintf(f, "First orphan inode:       %u\n",
+                       sb->s_last_orphan);
+       if (ext2fs_has_feature_dir_index(sb) ||
+           sb->s_def_hash_version)
+               fprintf(f, "Default directory hash:   %s\n",
+                       e2p_hash2string(sb->s_def_hash_version));
+       if (!e2p_is_null_uuid(sb->s_hash_seed))
+               fprintf(f, "Directory Hash Seed:      %s\n",
+                       e2p_uuid2str(sb->s_hash_seed));
+       if (sb->s_jnl_backup_type) {
+               fprintf(f, "Journal backup:           ");
+               switch (sb->s_jnl_backup_type) {
+               case 1:
+                       fprintf(f, "inode blocks\n");
+                       break;
+               default:
+                       fprintf(f, "type %u\n", sb->s_jnl_backup_type);
+               }
+       }
+       if (sb->s_backup_bgs[0] || sb->s_backup_bgs[1]) {
+               fprintf(f, "Backup block groups:      ");
+               if (sb->s_backup_bgs[0])
+                       fprintf(f, "%u ", sb->s_backup_bgs[0]);
+               if (sb->s_backup_bgs[1])
+                       fprintf(f, "%u ", sb->s_backup_bgs[1]);
+               fputc('\n', f);
+       }
+       if (sb->s_snapshot_inum) {
+               fprintf(f, "Snapshot inode:           %u\n",
+                       sb->s_snapshot_inum);
+               fprintf(f, "Snapshot ID:              %u\n",
+                       sb->s_snapshot_id);
+               fprintf(f, "Snapshot reserved blocks: %llu\n",
+                       (unsigned long long) sb->s_snapshot_r_blocks_count);
+       }
+       if (sb->s_snapshot_list)
+               fprintf(f, "Snapshot list head:       %u\n",
+                       sb->s_snapshot_list);
+       if (sb->s_error_count)
+               fprintf(f, "FS Error count:           %u\n",
+                       sb->s_error_count);
+       tm = ext2fs_get_tstamp(sb, s_first_error_time);
+       if (tm) {
+               fprintf(f, "First error time:         %s", ctime(&tm));
+               fprintf(f, "First error function:     %.*s\n",
+                       EXT2_LEN_STR(sb->s_first_error_func));
+               fprintf(f, "First error line #:       %u\n",
+                       sb->s_first_error_line);
+               if (sb->s_first_error_ino)
+                       fprintf(f, "First error inode #:      %u\n",
+                               sb->s_first_error_ino);
+               if (sb->s_first_error_block)
+                       fprintf(f, "First error block #:      %llu\n",
+                               (unsigned long long) sb->s_first_error_block);
+               if (sb->s_first_error_errcode)
+                       fprintf(f, "First error err:          %s\n",
+                               e2p_errcode2str(sb->s_first_error_errcode));
+       }
+       tm = ext2fs_get_tstamp(sb, s_last_error_time);
+       if (tm) {
+               fprintf(f, "Last error time:          %s", ctime(&tm));
+               fprintf(f, "Last error function:      %.*s\n",
+                       EXT2_LEN_STR(sb->s_last_error_func));
+               fprintf(f, "Last error line #:        %u\n",
+                       sb->s_last_error_line);
+               if (sb->s_last_error_ino)
+                       fprintf(f, "Last error inode #:       %u\n",
+                               sb->s_last_error_ino);
+               if (sb->s_last_error_block)
+                       fprintf(f, "Last error block #:       %llu\n",
+                               (unsigned long long) sb->s_last_error_block);
+               if (sb->s_last_error_errcode)
+                       fprintf(f, "Last error err:           %s\n",
+                               e2p_errcode2str(sb->s_last_error_errcode));
+       }
+       if (ext2fs_has_feature_mmp(sb)) {
+               fprintf(f, "MMP block number:         %llu\n",
+                       (unsigned long long) sb->s_mmp_block);
+               fprintf(f, "MMP update interval:      %u\n",
+                       sb->s_mmp_update_interval);
+       }
+       for (qtype = 0; qtype < MAXQUOTAS; qtype++) {
+               if (*quota_sb_inump(sb, qtype) != 0)
+                       fprintf(f, "%-26s%u\n",
+                               quota_type2prefix(qtype),
+                               *quota_sb_inump(sb, qtype));
        }
-#endif
-}
 
+       if (ext2fs_has_feature_metadata_csum(sb)) {
+               fprintf(f, "Checksum type:            %s\n",
+                       checksum_type(sb->s_checksum_type));
+               fprintf(f, "Checksum:                 0x%08x\n",
+                       sb->s_checksum);
+       }
+       if (!e2p_is_null_uuid(sb->s_encrypt_pw_salt))
+               fprintf(f, "Encryption PW Salt:       %s\n",
+                       e2p_uuid2str(sb->s_encrypt_pw_salt));
 
+       if (ext2fs_has_feature_csum_seed(sb))
+               fprintf(f, "Checksum seed:            0x%08x\n",
+                       sb->s_checksum_seed);
+       if (ext2fs_has_feature_casefold(sb))
+               fprintf(f, "Character encoding:       %s\n",
+                       e2p_encoding2str(sb->s_encoding));
+       if (ext2fs_has_feature_orphan_file(sb))
+               fprintf(f, "Orphan file inode:        %u\n",
+                       sb->s_orphan_file_inum);
+}
 
+void list_super (struct ext2_super_block * s)
+{
+       list_super2(s, stdout);
+}