From 1e6195885baa1d3aea7b75c6fb752ce293e1b936 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Tue, 15 Apr 2014 20:47:27 +0100 Subject: Btrfs-progs: allow compression property gets for read-only subvolumes Because the function open_file_or_dir() always opened the input file in read/write mode (O_RDWR), we were not able to due a compression property get against a file living in a read-only subvolume/snapshot. Fix this by opening the file with O_RDONLY mode if we're doing a property get. Signed-off-by: Filipe David Borba Manana Reviewed-by: Liu Bo Signed-off-by: David Sterba --- utils.h | 1 + 1 file changed, 1 insertion(+) (limited to 'utils.h') diff --git a/utils.h b/utils.h index 3c62066a..db8d63c3 100644 --- a/utils.h +++ b/utils.h @@ -72,6 +72,7 @@ int btrfs_scan_block_devices(int run_ioctl); u64 parse_size(char *s); u64 arg_strtou64(const char *str); int open_file_or_dir(const char *fname, DIR **dirstream); +int open_file_or_dir3(const char *fname, DIR **dirstream, int open_flags); void close_file_or_dir(int fd, DIR *dirstream); int get_fs_info(char *path, struct btrfs_ioctl_fs_info_args *fi_args, struct btrfs_ioctl_dev_info_args **di_ret); -- cgit v1.2.3