diff options
author | Zhao Lei <zhaolei@cn.fujitsu.com> | 2015-10-12 21:22:55 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2015-11-02 09:35:00 +0100 |
commit | d0c0f90b3885125c2c6e55eed097617a5f1baa15 (patch) | |
tree | 8ab0c6357a1c4e7b248e0472b66c8a1830075562 /cmds-fi-usage.c | |
parent | 2dfb710803e0ba9f02cb4950c3195b0f88f110ef (diff) |
btrfs-progs: filesystem: use btrfs_open_dir for btrfs filesystem command
We can use btrfs_open_dir() to check whether target dir is
in btrfs's mount point before open, instead of checking it in
kernel space of ioctl, and return fuzzy error message.
Before patch:
# (/mnt/tmp is not btrfs mountpoint)
#
# btrfs filesystem df /mnt/tmp
ERROR: couldn't get space info - Inappropriate ioctl for device
ERROR: get_df failed Inappropriate ioctl for device
#
After patch:
# ./btrfs filesystem df /mnt/tmp
ERROR: not btrfs filesystem: /mnt/tmp
#
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-fi-usage.c')
-rw-r--r-- | cmds-fi-usage.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/cmds-fi-usage.c b/cmds-fi-usage.c index 50d63337..5fefed46 100644 --- a/cmds-fi-usage.c +++ b/cmds-fi-usage.c @@ -901,10 +901,8 @@ int cmd_filesystem_usage(int argc, char **argv) int chunkcount = 0; int devcount = 0; - fd = open_file_or_dir(argv[i], &dirstream); + fd = btrfs_open_dir(argv[i], &dirstream, 1); if (fd < 0) { - fprintf(stderr, "ERROR: can't access '%s'\n", - argv[i]); ret = 1; goto out; } |