diff options
author | Dimitri John Ledkov <xnox@ubuntu.com> | 2016-09-08 12:29:10 +0100 |
---|---|---|
committer | Dimitri John Ledkov <xnox@ubuntu.com> | 2016-09-08 12:29:10 +0100 |
commit | 249a3592d5dfdec0e52b5e9e712339364ea758ed (patch) | |
tree | 54a81f37cfdccbb5ba1d3c925e6fd9261311550e /cmds-inspect-dump-super.c | |
parent | ca0dc13dd212ef8ca19fa6128115fe933b055437 (diff) |
New upstream release. (Closes: #836778)debian/4.7.2-1
Diffstat (limited to 'cmds-inspect-dump-super.c')
-rw-r--r-- | cmds-inspect-dump-super.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/cmds-inspect-dump-super.c b/cmds-inspect-dump-super.c index 3e09ee8c..aab50752 100644 --- a/cmds-inspect-dump-super.c +++ b/cmds-inspect-dump-super.c @@ -287,11 +287,29 @@ static void dump_superblock(struct btrfs_super_block *sb, int full) int i; char *s, buf[BTRFS_UUID_UNPARSED_SIZE]; u8 *p; + u32 csum_size; + u16 csum_type; + + csum_type = btrfs_super_csum_type(sb); + csum_size = BTRFS_CSUM_SIZE; + printf("csum_type\t\t%hu (", csum_type); + if (csum_type >= ARRAY_SIZE(btrfs_csum_sizes)) { + printf("INVALID"); + } else { + if (csum_type == BTRFS_CSUM_TYPE_CRC32) { + printf("crc32c"); + csum_size = btrfs_csum_sizes[csum_type]; + } else { + printf("unknown"); + } + } + printf(")\n"); + printf("csum_size\t\t%llu\n", (unsigned long long)csum_size); printf("csum\t\t\t0x"); - for (i = 0, p = sb->csum; i < btrfs_super_csum_size(sb); i++) + for (i = 0, p = sb->csum; i < csum_size; i++) printf("%02x", p[i]); - if (check_csum_sblock(sb, btrfs_super_csum_size(sb))) + if (check_csum_sblock(sb, csum_size)) printf(" [match]"); else printf(" [DON'T MATCH]"); @@ -363,10 +381,6 @@ static void dump_superblock(struct btrfs_super_block *sb, int full) printf("incompat_flags\t\t0x%llx\n", (unsigned long long)btrfs_super_incompat_flags(sb)); print_readable_incompat_flag(btrfs_super_incompat_flags(sb)); - printf("csum_type\t\t%llu\n", - (unsigned long long)btrfs_super_csum_type(sb)); - printf("csum_size\t\t%llu\n", - (unsigned long long)btrfs_super_csum_size(sb)); printf("cache_generation\t%llu\n", (unsigned long long)btrfs_super_cache_generation(sb)); printf("uuid_tree_generation\t%llu\n", @@ -511,7 +525,7 @@ int cmd_inspect_dump_super(int argc, char **argv) for (i = optind; i < argc; i++) { filename = argv[i]; - fd = open(filename, O_RDONLY, 0666); + fd = open(filename, O_RDONLY); if (fd < 0) { error("cannot open %s: %s", filename, strerror(errno)); ret = 1; |