X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=cmds-inspect-dump-super.c;h=e965267c5d96571539a267d7e16458fb897c6746;hb=591e44db21a2feb61d179630eaeb8ccc46e56d25;hp=c4a256501ac35085290b7514a407e2b460e3167b;hpb=a67efe43629e68039591c361fe4abd4656e0a71a;p=platform%2Fupstream%2Fbtrfs-progs.git diff --git a/cmds-inspect-dump-super.c b/cmds-inspect-dump-super.c index c4a2565..e965267 100644 --- a/cmds-inspect-dump-super.c +++ b/cmds-inspect-dump-super.c @@ -118,7 +118,7 @@ static void print_sys_chunk_array(struct btrfs_super_block *sb) len = btrfs_chunk_item_size(num_stripes); if (cur_offset + len > array_size) goto out_short_read; - print_chunk(buf, chunk); + print_chunk_item(buf, chunk); } else { error("unexpected item type %u in sys_array at offset %u", (u32)key.type, cur_offset); @@ -223,7 +223,7 @@ static struct readable_flag_entry incompat_flags_array[] = { DEF_INCOMPAT_FLAG_ENTRY(DEFAULT_SUBVOL), DEF_INCOMPAT_FLAG_ENTRY(MIXED_GROUPS), DEF_INCOMPAT_FLAG_ENTRY(COMPRESS_LZO), - DEF_INCOMPAT_FLAG_ENTRY(COMPRESS_LZOv2), + DEF_INCOMPAT_FLAG_ENTRY(COMPRESS_ZSTD), DEF_INCOMPAT_FLAG_ENTRY(BIG_METADATA), DEF_INCOMPAT_FLAG_ENTRY(EXTENDED_IREF), DEF_INCOMPAT_FLAG_ENTRY(RAID56), @@ -339,7 +339,10 @@ static void dump_superblock(struct btrfs_super_block *sb, int full) printf("csum\t\t\t0x"); for (i = 0, p = sb->csum; i < csum_size; i++) printf("%02x", p[i]); - if (check_csum_sblock(sb, csum_size)) + if (csum_type != BTRFS_CSUM_TYPE_CRC32 || + csum_size != btrfs_csum_sizes[BTRFS_CSUM_TYPE_CRC32]) + printf(" [UNKNOWN CSUM TYPE OR SIZE]"); + else if (check_csum_sblock(sb, csum_size)) printf(" [match]"); else printf(" [DON'T MATCH]"); @@ -472,7 +475,7 @@ static int load_and_dump_sb(char *filename, int fd, u64 sb_bytenr, int full, error("failed to read the superblock on %s at %llu", filename, (unsigned long long)sb_bytenr); - error("error = '%s', errno = %d", strerror(errno), errno); + error("error = '%m', errno = %d", errno); return 1; } printf("superblock: bytenr=%llu, device=%s\n", sb_bytenr, filename); @@ -518,8 +521,10 @@ int cmd_inspect_dump_super(int argc, char **argv) while (1) { int c; + enum { GETOPT_VAL_BYTENR = 257 }; static const struct option long_options[] = { {"all", no_argument, NULL, 'a'}, + {"bytenr", required_argument, NULL, GETOPT_VAL_BYTENR }, {"full", no_argument, NULL, 'f'}, {"force", no_argument, NULL, 'F'}, {"super", required_argument, NULL, 's' }, @@ -564,6 +569,11 @@ int cmd_inspect_dump_super(int argc, char **argv) } all = 0; break; + case GETOPT_VAL_BYTENR: + arg = arg_strtou64(optarg); + sb_bytenr = arg; + all = 0; + break; default: usage(cmd_inspect_dump_super_usage); } @@ -576,7 +586,7 @@ int cmd_inspect_dump_super(int argc, char **argv) filename = argv[i]; fd = open(filename, O_RDONLY); if (fd < 0) { - error("cannot open %s: %s", filename, strerror(errno)); + error("cannot open %s: %m", filename); ret = 1; goto out; }