summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmds-inspect.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/cmds-inspect.c b/cmds-inspect.c
index a13a170..40ab49b 100644
--- a/cmds-inspect.c
+++ b/cmds-inspect.c
@@ -116,11 +116,9 @@ static int cmd_inspect_inode_resolve(int argc, char **argv)
if (check_argc_exact(argc - optind, 2))
usage(cmd_inspect_inode_resolve_usage);
- fd = open_file_or_dir(argv[optind+1], &dirstream);
- if (fd < 0) {
- fprintf(stderr, "ERROR: can't access '%s'\n", argv[optind+1]);
+ fd = btrfs_open_dir(argv[optind + 1], &dirstream, 1);
+ if (fd < 0)
return 1;
- }
ret = __ino_to_path_fd(arg_strtou64(argv[optind]), fd, verbose,
argv[optind+1]);
@@ -189,9 +187,8 @@ static int cmd_inspect_logical_resolve(int argc, char **argv)
loi.size = size;
loi.inodes = ptr_to_u64(inodes);
- fd = open_file_or_dir(argv[optind+1], &dirstream);
+ fd = btrfs_open_dir(argv[optind + 1], &dirstream, 1);
if (fd < 0) {
- fprintf(stderr, "ERROR: can't access '%s'\n", argv[optind+1]);
ret = 12;
goto out;
}
@@ -239,10 +236,8 @@ static int cmd_inspect_logical_resolve(int argc, char **argv)
name);
BUG_ON(ret >= bytes_left);
free(name);
- path_fd = open_file_or_dir(full_path, &dirs);
+ path_fd = btrfs_open_dir(full_path, &dirs, 1);
if (path_fd < 0) {
- fprintf(stderr, "ERROR: can't access "
- "'%s'\n", full_path);
ret = -ENOENT;
goto out;
}
@@ -279,9 +274,8 @@ static int cmd_inspect_subvolid_resolve(int argc, char **argv)
if (check_argc_exact(argc, 3))
usage(cmd_inspect_subvolid_resolve_usage);
- fd = open_file_or_dir(argv[2], &dirstream);
+ fd = btrfs_open_dir(argv[2], &dirstream, 1);
if (fd < 0) {
- fprintf(stderr, "ERROR: can't access '%s'\n", argv[2]);
ret = -ENOENT;
goto out;
}
@@ -320,9 +314,8 @@ static int cmd_inspect_rootid(int argc, char **argv)
if (check_argc_exact(argc, 2))
usage(cmd_inspect_rootid_usage);
- fd = open_file_or_dir(argv[1], &dirstream);
+ fd = btrfs_open_dir(argv[1], &dirstream, 1);
if (fd < 0) {
- fprintf(stderr, "ERROR: can't access '%s'\n", argv[1]);
ret = -ENOENT;
goto out;
}
@@ -619,9 +612,8 @@ static int cmd_inspect_min_dev_size(int argc, char **argv)
if (check_argc_exact(argc - optind, 1))
usage(cmd_inspect_min_dev_size_usage);
- fd = open_file_or_dir(argv[optind], &dirstream);
+ fd = btrfs_open_dir(argv[optind], &dirstream, 1);
if (fd < 0) {
- fprintf(stderr, "ERROR: can't access '%s'\n", argv[optind]);
ret = -ENOENT;
goto out;
}