btrfs-progs: merge subvol_uuid_search helpers

Due to ambiguity of error values in the public API subvol_uuid_search,
there was second version added. There's a separate copy in libbtrfs and
we don't have to distinguish in the internal code. All callers check for
IS_ERR and NULL, so we can safely merge the helpers into one.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-09-30 20:15:04 +02:00
parent e491d9cf25
commit ac5954ee36
2 changed files with 1 additions and 24 deletions

View File

@ -285,19 +285,6 @@ struct subvol_info *subvol_uuid_search(int mnt_fd,
u64 root_id, const u8 *uuid, u64 transid,
const char *path,
enum subvol_search_type type)
{
struct subvol_info *si;
si = subvol_uuid_search2(mnt_fd, root_id, uuid, transid, path, type);
if (IS_ERR(si))
return NULL;
return si;
}
struct subvol_info *subvol_uuid_search2(int mnt_fd,
u64 root_id, const u8 *uuid, u64 transid,
const char *path,
enum subvol_search_type type)
{
int ret = 0;
struct btrfs_root_item root_item;

View File

@ -46,22 +46,12 @@ struct subvol_info {
/*
* Search for a subvolume by given type (received uuid, root id, path), returns
* pointer to newly allocated struct subvol_info or NULL in case it's not found
* or there was another error. This ambiguity of error value is fixed by
* subvol_uuid_search2 that returns a negative errno in case of an error, of a
* valid pointer otherwise.
*
* This function will be deprecated in the future, please consider using v2 in
* new code unless you need to keep backward compatibility with older
* btrfs-progs.
* or there was another error.
*/
struct subvol_info *subvol_uuid_search(int mnt_fd,
u64 root_id, const u8 *uuid, u64 transid,
const char *path,
enum subvol_search_type type);
struct subvol_info *subvol_uuid_search2(int mnt_fd,
u64 root_id, const u8 *uuid, u64 transid,
const char *path,
enum subvol_search_type type);
void subvol_uuid_search_add(int mnt_fd, struct subvol_info *si);
int btrfs_subvolid_resolve(int fd, char *path, size_t path_len, u64 subvol_id);