{
struct root_lookup root_lookup;
struct root_lookup root_sort;
- int ret;
- u64 top_id = (full_path ? 0 : btrfs_list_get_path_rootid(fd));
+ int ret = 0;
+ u64 top_id = 0;
+
+ if (full_path)
+ ret = btrfs_list_get_path_rootid(fd, &top_id);
+ if (ret)
+ return ret;
ret = btrfs_list_subvols(fd, &root_lookup);
if (ret)
int btrfs_get_subvol(int fd, struct root_info *the_ri)
{
- int ret = 1, rr;
+ int ret, rr;
struct root_lookup rl;
struct rb_node *rbn;
struct root_info *ri;
- u64 root_id = btrfs_list_get_path_rootid(fd);
+ u64 root_id;
+
+ ret = btrfs_list_get_path_rootid(fd, &root_id);
+ if (ret)
+ return ret;
- if (btrfs_list_subvols(fd, &rl))
+ ret = btrfs_list_subvols(fd, &rl);
+ if (ret)
return ret;
rbn = rb_first(&rl.root);
struct rb_node *n;
char *ret_path = NULL;
int ret;
- u64 top_id = btrfs_list_get_path_rootid(fd);
+ u64 top_id;
+
+ ret = btrfs_list_get_path_rootid(fd, &top_id);
+ if (ret)
+ return ERR_PTR(ret);
ret = __list_subvol_search(fd, &root_lookup);
if (ret < 0)
return 0;
}
-u64 btrfs_list_get_path_rootid(int fd)
+int btrfs_list_get_path_rootid(int fd, u64 *treeid)
{
int ret;
struct btrfs_ioctl_ino_lookup_args args;
strerror(errno));
return ret;
}
- return args.treeid;
+ *treeid = args.treeid;
+ return 0;
}
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);
-u64 btrfs_list_get_path_rootid(int fd);
+int btrfs_list_get_path_rootid(int fd, u64 *treeid);
int btrfs_get_subvol(int fd, struct root_info *the_ri);
goto out;
}
- top_id = btrfs_list_get_path_rootid(fd);
+ ret = btrfs_list_get_path_rootid(fd, &top_id);
+ if (ret) {
+ fprintf(stderr, "ERROR: can't get rootid for '%s'\n", subvol);
+ goto out;
+ }
if (is_list_all)
btrfs_list_setup_filter(&filter_set,
goto out;
}
- sv_id = btrfs_list_get_path_rootid(fd);
- if (sv_id < 0) {
+ ret = btrfs_list_get_path_rootid(fd, &sv_id);
+ if (ret) {
fprintf(stderr, "ERROR: can't get rootid for '%s'\n",
fullpath);
goto out;
goto out;
}
- mntid = btrfs_list_get_path_rootid(mntfd);
- if (mntid < 0) {
+ ret = btrfs_list_get_path_rootid(mntfd, &mntid);
+ if (ret) {
fprintf(stderr, "ERROR: can't get rootid for '%s'\n", mnt);
goto out;
}