diff options
author | Theodore Ts'o <tytso@mit.edu> | 2017-02-16 18:54:41 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2017-02-16 18:54:41 -0500 |
commit | 03a179a10ef44c7057d5aad3d6654ee6b507f2ed (patch) | |
tree | 302f8de88c869643b649394aa45a86ee3b8ee443 /misc/dumpe2fs.c | |
parent | cec5c49e314b457522910ce74aa671dbfae2b1c3 (diff) | |
download | e2fsprogs-03a179a10ef44c7057d5aad3d6654ee6b507f2ed.tar.gz |
Refactor code to print journal superblock information
Move the code to list the journal superblock information to libe2p, so
it can be used by debugfs, and so we don't have two copies of
substantially the same code in dumpe2fs.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'misc/dumpe2fs.c')
-rw-r--r-- | misc/dumpe2fs.c | 85 |
1 files changed, 2 insertions, 83 deletions
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c index a034703b..621840ae 100644 --- a/misc/dumpe2fs.c +++ b/misc/dumpe2fs.c @@ -404,49 +404,7 @@ static void print_inline_journal_information(ext2_filsys fs) _("Journal superblock magic number invalid!\n")); exit(1); } - printf("%s", _("Journal features: ")); - for (i=0, mask_ptr=&jsb->s_feature_compat; i <3; i++,mask_ptr++) { - mask = be32_to_cpu(*mask_ptr); - for (j=0,m=1; j < 32; j++, m<<=1) { - if (mask & m) { - printf(" %s", e2p_jrnl_feature2string(i, m)); - printed++; - } - } - } - if (printed == 0) - printf(" (none)"); - printf("\n"); - fputs(_("Journal size: "), stdout); - if (ext2fs_has_feature_huge_file(fs->super) && - (inode.i_flags & EXT4_HUGE_FILE_FL)) - size = inode.i_blocks / (fs->blocksize / 1024); - else - size = inode.i_blocks >> 1; - if (size < 8192) - printf("%uk\n", size); - else - printf("%uM\n", size >> 10); - printf(_("Journal length: %u\n" - "Journal sequence: 0x%08x\n" - "Journal start: %u\n"), - (unsigned int)ntohl(jsb->s_maxlen), - (unsigned int)ntohl(jsb->s_sequence), - (unsigned int)ntohl(jsb->s_start)); - if (jsb->s_feature_compat & - ext2fs_cpu_to_be32(JFS_FEATURE_COMPAT_CHECKSUM)) - printf("%s", _("Journal checksum type: crc32\n")); - if ((jsb->s_feature_incompat & - ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_CSUM_V3)) || - (jsb->s_feature_incompat & - ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_CSUM_V2))) - printf(_("Journal checksum type: %s\n" - "Journal checksum: 0x%08x\n"), - journal_checksum_type_str(jsb->s_checksum_type), - ext2fs_be32_to_cpu(jsb->s_checksum)); - if (jsb->s_errno != 0) - printf(_("Journal errno: %d\n"), - (int) ntohl(jsb->s_errno)); + e2p_list_journal_super(stdout, buf, fs->blocksize, 0); } static void print_journal_information(ext2_filsys fs) @@ -474,46 +432,7 @@ static void print_journal_information(ext2_filsys fs) _("Couldn't find journal superblock magic numbers")); exit(1); } - - if (jsb->s_feature_compat & - ext2fs_cpu_to_be32(JFS_FEATURE_COMPAT_CHECKSUM)) - printf("%s", _("Journal checksum type: crc32\n")); - if ((jsb->s_feature_incompat & - ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_CSUM_V3)) || - (jsb->s_feature_incompat & - ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_CSUM_V2))) - printf(_("Journal checksum type: %s\n" - "Journal checksum: 0x%08x\n"), - journal_checksum_type_str(jsb->s_checksum_type), - ext2fs_be32_to_cpu(jsb->s_checksum)); - - printf("%s", _("Journal features: ")); - for (i = 0, mask_ptr = &jsb->s_feature_compat; i < 3; i++, mask_ptr++) { - mask = be32_to_cpu(*mask_ptr); - for (j = 0, m = 1; j < 32; j++, m <<= 1) { - if (mask & m) { - printf(" %s", e2p_jrnl_feature2string(i, m)); - printed++; - } - } - } - - printf(_("\nJournal block size: %u\n" - "Journal length: %u\n" - "Journal first block: %u\n" - "Journal sequence: 0x%08x\n" - "Journal start: %u\n" - "Journal number of users: %u\n"), - (unsigned int)ntohl(jsb->s_blocksize), (unsigned int)ntohl(jsb->s_maxlen), - (unsigned int)ntohl(jsb->s_first), (unsigned int)ntohl(jsb->s_sequence), - (unsigned int)ntohl(jsb->s_start), (unsigned int)ntohl(jsb->s_nr_users)); - - for (i=0; i < ntohl(jsb->s_nr_users); i++) { - uuid_unparse(&jsb->s_users[i*16], str); - printf(i ? " %s\n" - : _("Journal users: %s\n"), - str); - } + e2p_list_journal_super(stdout, buf, fs->blocksize, 0); } static void parse_extended_opts(const char *opts, blk64_t *superblock, |