path: root/utils.h
diff options
authorMisono, Tomohiro <>2017-09-04 14:05:34 +0900
committerDavid Sterba <>2017-09-08 16:15:05 +0200
commit88ef0b8397fa13f6114dc3ba5c8e88a7b7c992f9 (patch)
tree88ba31470ec21ef5884be89522cdbd5b00d93f92 /utils.h
parentf47587d83db2fd7beaf1ceb9feb8c3e16e2b352c (diff)
btrfs-progs: inspect rootid: Allow a file to be specified
Since cmd_inspect_rootid() calls btrfs_open_dir(), it rejects a file to be specified. But as the document says, a file should be supported. This patch introduces btrfs_open_file_or_dir(), which is a counterpart of btrfs_open_dir(), to safely check and open btrfs file or directory. The original btrfs_open_dir() content is moved to btrfs_open() and shared by both function. Signed-off-by: Tomohiro Misono <> Signed-off-by: David Sterba <>
Diffstat (limited to 'utils.h')
1 files changed, 2 insertions, 0 deletions
diff --git a/utils.h b/utils.h
index 091f8fab..d28a05a6 100644
--- a/utils.h
+++ b/utils.h
@@ -108,7 +108,9 @@ 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 verbose);
+int btrfs_open(const char *path, DIR **dirstream, int verbose, int dir_only);
int btrfs_open_dir(const char *path, DIR **dirstream, int verbose);
+int btrfs_open_file_or_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 */
#define strncpy_null(dest, src) __strncpy_null(dest, src, sizeof(dest))