[PATCH 2/2] btrfs-progs: refine btrfs-debug-tree error prompt when a mount point given

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
	: 'usage: btrfs-debug-tree [options] device

Signed-off-by: Gui Hecheng <guihc.fnst@xxxxxxxxxxxxxx>
---
 btrfs-debug-tree.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/btrfs-debug-tree.c b/btrfs-debug-tree.c
index e46500d..7f079a9 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]);
+		print_usage();
+	}
+
 	info = open_ctree_fs_info(av[optind], 0, 0, OPEN_CTREE_PARTIAL);
 	if (!info) {
 		fprintf(stderr, "unable to open %s\n", av[optind]);
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux