From: Theodore Ts'o Date: Mon, 1 Jun 2009 20:15:40 +0000 (-0400) Subject: e2p: Print 64-bit block numbers in the superblock X-Git-Tag: v1.41.90.wc1~114 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=0180a05e7449ba3ba6b15f7a5c372f712331cb89;p=tools%2Fe2fsprogs.git e2p: Print 64-bit block numbers in the superblock Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/e2p/ls.c b/lib/e2p/ls.c index eb9a772..f385fd7 100644 --- a/lib/e2p/ls.c +++ b/lib/e2p/ls.c @@ -164,6 +164,26 @@ static void print_super_flags(struct ext2_super_block * s, FILE *f) 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) @@ -219,9 +239,9 @@ void list_super2(struct ext2_super_block * sb, FILE *f) 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)); + 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));