aboutsummaryrefslogtreecommitdiffstats
path: root/utils.h
diff options
context:
space:
mode:
authorZhao Lei <zhaolei@cn.fujitsu.com>2015-10-12 21:23:02 +0800
committerDavid Sterba <dsterba@suse.com>2015-11-02 09:35:01 +0100
commit078618d82220e84609cffd074655faafbada4c24 (patch)
treebfc17db74656dd73489265f35104e5ea40a946da /utils.h
parent5e1a77c45c8447974fe8a315afc0659ce3f64f4c (diff)
downloadbtrfs-progs-078618d82220e84609cffd074655faafbada4c24.tar.gz
btrfs-progs-078618d82220e84609cffd074655faafbada4c24.tar.xz
btrfs-progs-078618d82220e84609cffd074655faafbada4c24.zip
btrfs-progs: use btrfs_open_dir in open_path_or_dev_mnt
Use btrfs_open_dir() in open_path_or_dev_mnt() to make the function return error when target is neither block device nor btrfs mount point. Also add "verbose" argument to let function output common error message instead of putting duplicated lines in caller. Before patch: # ./btrfs device stats /mnt/tmp1 ERROR: getting dev info for devstats failed: Inappropriate ioctl for device # ./btrfs replace start /dev/vdd /dev/vde /mnt/tmp1 ERROR: ioctl(DEV_REPLACE_STATUS) failed on "/mnt/tmp1": Inappropriate ioctl for device After patch: # ./btrfs device stats /mnt/tmp1 ERROR: not a btrfs filesystem: /mnt/tmp1 # ./btrfs replace start /dev/vdd /dev/vde /mnt/tmp1 ERROR: not a btrfs filesystem: /mnt/tmp1 Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils.h b/utils.h
index 044ea15..1dc12ec 100644
--- a/utils.h
+++ b/utils.h
@@ -158,7 +158,7 @@ char *__strncpy__null(char *dest, const char *src, size_t n);
int is_block_device(const char *file);
int is_mount_point(const char *file);
int check_arg_type(const char *input);
-int open_path_or_dev_mnt(const char *path, DIR **dirstream);
+int open_path_or_dev_mnt(const char *path, DIR **dirstream, int verbose);
int btrfs_open_dir(const char *path, DIR **dirstream, int verbose);
u64 btrfs_device_size(int fd, struct stat *st);
/* Helper to always get proper size of the destination string */