summaryrefslogtreecommitdiff
path: root/btrfs-debug-tree.c
diff options
context:
space:
mode:
authorGui Hecheng <guihc.fnst@cn.fujitsu.com>2014-12-25 09:16:35 +0800
committerDavid Sterba <dsterba@suse.cz>2014-12-29 18:10:59 +0100
commit1bad43fbe002cd3c00dd82948f19cf73c74e2b75 (patch)
tree1385c45f4806170d0b24e62888b19fae46924b20 /btrfs-debug-tree.c
parent280434ebde0e88d1e0b774a1181ab4bb9c807d3c (diff)
btrfs-progs: refine btrfs-debug-tree error prompt when a mount point given
Now, if exec: # btrfs-debug-tree <mount_point> it echos: : Superblock bytenr is larger than device size But it is quite misleading, because it is a valid btrfs. In this case, we should tell the developer to provide a block device. After apply: : '<mount_point>' is not a block device Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'btrfs-debug-tree.c')
-rw-r--r--btrfs-debug-tree.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/btrfs-debug-tree.c b/btrfs-debug-tree.c
index e46500d8..9cdb35f9 100644
--- a/btrfs-debug-tree.c
+++ b/btrfs-debug-tree.c
@@ -179,6 +179,12 @@ int main(int ac, char **av)
if (check_argc_exact(ac, 1))
print_usage();
+ ret = check_arg_type(av[optind]);
+ if (ret != BTRFS_ARG_BLKDEV) {
+ fprintf(stderr, "'%s' is not a block device\n", av[optind]);
+ exit(1);
+ }
+
info = open_ctree_fs_info(av[optind], 0, 0, OPEN_CTREE_PARTIAL);
if (!info) {
fprintf(stderr, "unable to open %s\n", av[optind]);