* %End-Header%
*/
+#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
fputs("(none)\n", f);
}
+static __u64 e2p_blocks_count(struct ext2_super_block *super)
+{
+ return super->s_blocks_count |
+ (super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT ?
+ (__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 |
+ (super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT ?
+ (__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 |
+ (super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT ?
+ (__u64) super->s_free_blocks_hi << 32 : 0);
+}
#ifndef EXT2_INODE_SIZE
#define EXT2_INODE_SIZE(s) sizeof(struct ext2_inode)
#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";
+ }
+}
+
void list_super2(struct ext2_super_block * sb, FILE *f)
{
int inode_blocks_per_group;
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", sb->s_mount_opts);
fprintf(f, "Filesystem state: ");
print_fs_state (f, sb->s_state);
fprintf(f, "\n");
fprintf(f, "Filesystem OS type: %s\n", str);
free(str);
fprintf(f, "Inode count: %u\n", sb->s_inodes_count);
- fprintf(f, "Block count: %u\n", sb->s_blocks_count);
- fprintf(f, "Reserved block count: %u\n", sb->s_r_blocks_count);
- fprintf(f, "Free blocks: %u\n", sb->s_free_blocks_count);
+ fprintf(f, "Block count: %llu\n", e2p_blocks_count(sb));
+ fprintf(f, "Reserved block count: %llu\n", e2p_r_blocks_count(sb));
+ if (sb->s_overhead_blocks)
+ fprintf(f, "Overhead blocks: %u\n",
+ sb->s_overhead_blocks);
+ fprintf(f, "Free blocks: %llu\n", 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));
- fprintf(f, "Fragment size: %u\n", EXT2_FRAG_SIZE(sb));
+ if (sb->s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_BIGALLOC)
+ fprintf(f, "Cluster size: %u\n",
+ EXT2_CLUSTER_SIZE(sb));
+ else
+ fprintf(f, "Fragment size: %u\n",
+ EXT2_CLUSTER_SIZE(sb));
+ if (sb->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT)
+ 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);
- fprintf(f, "Fragments per group: %u\n", sb->s_frags_per_group);
+ if (sb->s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_BIGALLOC)
+ 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, "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);
tm = sb->s_first_error_time;
fprintf(f, "First error time: %s", ctime(&tm));
memset(buf, 0, sizeof(buf));
- strncpy(buf, sb->s_first_error_func,
+ strncpy(buf, (char *)sb->s_first_error_func,
sizeof(sb->s_first_error_func));
fprintf(f, "First error function: %s\n", buf);
fprintf(f, "First error line #: %u\n",
tm = sb->s_last_error_time;
fprintf(f, "Last error time: %s", ctime(&tm));
memset(buf, 0, sizeof(buf));
- strncpy(buf, sb->s_last_error_func,
+ strncpy(buf, (char *)sb->s_last_error_func,
sizeof(sb->s_last_error_func));
fprintf(f, "Last error function: %s\n", buf);
fprintf(f, "Last error line #: %u\n",
fprintf(f, "Last error block #: %llu\n",
sb->s_last_error_block);
}
+ if (sb->s_feature_incompat & EXT4_FEATURE_INCOMPAT_MMP) {
+ fprintf(f, "MMP block number: %llu\n",
+ (long long)sb->s_mmp_block);
+ fprintf(f, "MMP update interval: %u\n",
+ sb->s_mmp_update_interval);
+ }
+ if (sb->s_usr_quota_inum)
+ fprintf(f, "User quota inode: %u\n",
+ sb->s_usr_quota_inum);
+ if (sb->s_grp_quota_inum)
+ fprintf(f, "Group quota inode: %u\n",
+ sb->s_grp_quota_inum);
+
+ if (sb->s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) {
+ fprintf(f, "Checksum type: %s\n",
+ checksum_type(sb->s_checksum_type));
+ fprintf(f, "Checksum: 0x%08x\n",
+ sb->s_checksum);
+ }
}
void list_super (struct ext2_super_block * s)