@@ -1801,7 +1801,7 @@ int btrfs_list_find_updated_files(int fd, u64 root_id, u64 oldest_gen)
return ret;
}
-char *btrfs_list_path_for_root(int fd, u64 root)
+char *btrfs_list_path_for_root(int fd, u64 root, bool full_path)
{
struct root_lookup root_lookup;
struct rb_node *n;
@@ -1832,8 +1832,13 @@ char *btrfs_list_path_for_root(int fd, u64 root)
break;
}
if (entry->root_id == root) {
- ret_path = entry->full_path;
- entry->full_path = NULL;
+ if (full_path) {
+ ret_path = entry->full_path;
+ entry->full_path = NULL;
+ } else {
+ ret_path = entry->name;
+ entry->name = NULL;
+ }
}
n = rb_prev(n);
@@ -172,7 +172,7 @@ int btrfs_list_subvols_print(int fd, struct btrfs_list_filter_set *filter_set,
const char *raw_prefix);
int btrfs_list_find_updated_files(int fd, u64 root_id, u64 oldest_gen);
int btrfs_list_get_default_subvolume(int fd, u64 *default_id);
-char *btrfs_list_path_for_root(int fd, u64 root);
+char *btrfs_list_path_for_root(int fd, u64 root, bool full_path);
int btrfs_list_get_path_rootid(int fd, u64 *treeid);
int btrfs_get_subvol(int fd, struct root_info *the_ri);
int btrfs_get_toplevel_subvol(int fd, struct root_info *the_ri);
@@ -236,7 +236,7 @@ static int cmd_inspect_logical_resolve(const struct cmd_struct *cmd,
DIR *dirs = NULL;
if (getpath) {
- name = btrfs_list_path_for_root(fd, root);
+ name = btrfs_list_path_for_root(fd, root, false);
if (IS_ERR(name)) {
ret = PTR_ERR(name);
goto out;
@@ -657,7 +657,7 @@ int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s)
goto skip;
path = btrfs_list_path_for_root(mnt_fd,
- btrfs_search_header_objectid(sh));
+ btrfs_search_header_objectid(sh), true);
if (!path)
path = strdup("");
if (IS_ERR(path)) {