From: Filipe Manana Date: Wed, 5 Feb 2025 12:23:11 +0000 (+0000) Subject: btrfs: send: implement fs_path_add_path() using fs_path_add() X-Git-Tag: v6.15-rc1~152^2~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3d37502e7d9aca163459c6d715a5e79250aeb33;p=thirdparty%2Flinux.git btrfs: send: implement fs_path_add_path() using fs_path_add() The helper fs_path_add_path() is basically a copy of fs_path_add() and it can be made a wrapper around fs_path_add(). So do that and also make it inline and constify its second argument. Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 2203745569e04..7a75f1d963f90 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -566,19 +566,9 @@ static int fs_path_add(struct fs_path *p, const char *name, int name_len) return 0; } -static int fs_path_add_path(struct fs_path *p, struct fs_path *p2) +static inline int fs_path_add_path(struct fs_path *p, const struct fs_path *p2) { - int ret; - const int p2_len = fs_path_len(p2); - char *prepared; - - ret = fs_path_prepare_for_add(p, p2_len, &prepared); - if (ret < 0) - goto out; - memcpy(prepared, p2->start, p2_len); - -out: - return ret; + return fs_path_add(p, p2->start, fs_path_len(p2)); } static int fs_path_add_from_extent_buffer(struct fs_path *p,