btrfs-progs: remove unused btrfs_get_subvol

Replaced by libbtrfsutil functions in 9005b603d7 ("btrfs-progs: use
libbtrfsutil for subvol show"). Also remove strdup_or_null as it's now
unused too.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-09-29 18:19:24 +02:00
parent 030caec819
commit d50da1e003
2 changed files with 0 additions and 52 deletions

View File

@ -1549,57 +1549,6 @@ int btrfs_list_subvols_print(int fd, struct btrfs_list_filter_set *filter_set,
return 0;
}
static char *strdup_or_null(const char *s)
{
if (!s)
return NULL;
return strdup(s);
}
int btrfs_get_subvol(int fd, struct root_info *the_ri)
{
int ret, rr;
struct root_lookup rl;
struct rb_node *rbn;
struct root_info *ri;
u64 root_id;
ret = lookup_path_rootid(fd, &root_id);
if (ret) {
errno = -ret;
error("cannot resolve rootid for path: %m");
return ret;
}
ret = btrfs_list_subvols(fd, &rl);
if (ret)
return ret;
rbn = rb_first(&rl.root);
while(rbn) {
ri = to_root_info(rbn);
rr = resolve_root(&rl, ri, root_id);
if (rr == -ENOENT) {
ret = -ENOENT;
rbn = rb_next(rbn);
continue;
}
if (!comp_entry_with_rootid(the_ri, ri, 0) ||
!uuid_compare(the_ri->uuid, ri->uuid)) {
memcpy(the_ri, ri, offsetof(struct root_info, path));
the_ri->path = strdup_or_null(ri->path);
the_ri->name = strdup_or_null(ri->name);
the_ri->full_path = strdup_or_null(ri->full_path);
ret = 0;
break;
}
rbn = rb_next(rbn);
}
rb_free_nodes(&rl.root, free_root_info);
return ret;
}
static int print_one_extent(int fd, struct btrfs_ioctl_search_header *sh,
struct btrfs_file_extent_item *item,
u64 found_gen, u64 *cache_dirid,

View File

@ -166,6 +166,5 @@ int btrfs_list_subvols_print(int fd, struct btrfs_list_filter_set *filter_set,
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);
int btrfs_get_subvol(int fd, struct root_info *the_ri);
#endif