From: Anand Jain <anand.jain@xxxxxxxxxx>
btrfs su list -a /btrfs/sv1
ID 256 gen 6 top level 5 path <FS_TREE>/sv1
ID 258 gen 6 top level 5 path <FS_TREE>/ss1
Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
---
cmds-subvolume.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index a33c352..f8beecc 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -306,7 +306,7 @@ static int cmd_subvol_list(int argc, char **argv)
u64 top_id;
int ret;
int c;
- char *subvol;
+ char *subvol, *mnt = NULL;
int is_tab_result = 0;
int is_list_all = 0;
struct option long_options[] = {
@@ -398,9 +398,18 @@ static int cmd_subvol_list(int argc, char **argv)
return 13;
}
- fd = open_file_or_dir(subvol);
+ ret = find_mount_root(subvol, &mnt);
+ if (ret < 0) {
+ fprintf(stderr, "ERROR: find_mount_root failed on %s: "
+ "%s\n", subvol,
+ strerror(-ret));
+ return 12;
+ }
+
+ fd = open_file_or_dir(mnt);
if (fd < 0) {
fprintf(stderr, "ERROR: can't access '%s'\n", subvol);
+ free(mnt);
return 12;
}
@@ -412,6 +421,8 @@ static int cmd_subvol_list(int argc, char **argv)
ret = btrfs_list_subvols(fd, filter_set, comparer_set,
is_tab_result);
+
+ free(mnt);
if (ret)
return 19;
return 0;
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html