summaryrefslogtreecommitdiff
path: root/cmds-subvolume.c
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2018-01-21 00:24:50 -0800
committerDavid Sterba <dsterba@suse.com>2018-03-06 11:28:38 +0100
commitf0a376df4733dc6f0f0cdc529f4e7df64806f3f6 (patch)
tree6645ab539231cdda40e772d5b14ada360fed278d /cmds-subvolume.c
parentbbf7acbef09c6f35ab276e5c7a9e20a212a02308 (diff)
btrfs-progs: replace test_issubvolume() with btrfs_util_is_subvolume()
This gets the remaining occurrences that weren't covered by previous conversions. Signed-off-by: Omar Sandoval <osandov@fb.com> [ fixup test_issubvolume due to removed dependency patch ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-subvolume.c')
-rw-r--r--cmds-subvolume.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index 4c9ca6a3..ba57eaa0 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -630,6 +630,7 @@ static int cmd_subvol_snapshot(int argc, char **argv)
char *dupdir = NULL;
char *newname;
char *dstdir;
+ enum btrfs_util_error err;
struct btrfs_ioctl_vol_args_v2 args;
struct btrfs_qgroup_inherit *inherit = NULL;
DIR *dirstream1 = NULL, *dirstream2 = NULL;
@@ -677,13 +678,9 @@ static int cmd_subvol_snapshot(int argc, char **argv)
dst = argv[optind + 1];
retval = 1; /* failure */
- res = test_issubvolume(subvol);
- if (res < 0) {
- error("cannot access subvolume %s: %s", subvol, strerror(-res));
- goto out;
- }
- if (!res) {
- error("not a subvolume: %s", subvol);
+ err = btrfs_util_is_subvolume(subvol);
+ if (err) {
+ error_btrfs_util(err);
goto out;
}
@@ -886,13 +883,9 @@ static int cmd_subvol_find_new(int argc, char **argv)
subvol = argv[optind];
last_gen = arg_strtou64(argv[optind + 1]);
- ret = test_issubvolume(subvol);
- if (ret < 0) {
- error("cannot access subvolume %s: %s", subvol, strerror(-ret));
- return 1;
- }
- if (!ret) {
- error("not a subvolume: %s", subvol);
+ err = btrfs_util_is_subvolume(subvol);
+ if (err) {
+ error_btrfs_util(err);
return 1;
}