mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 05:00:55 +07:00
duplicate ovl_getxattr()
ovl_getattr() returns the value of an xattr in a kmalloced buffer. There are two callers: ovl_copy_up_meta_inode_data() (copy_up.c) ovl_get_redirect_xattr() (util.c) This patch just copies ovl_getxattr() to copy_up.c, the following patches will deal with the differences in idividual callers. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
c86243b090
commit
fee0f2980a
@ -784,6 +784,39 @@ static bool ovl_need_meta_copy_up(struct dentry *dentry, umode_t mode,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ssize_t ovl_getxattr(struct dentry *dentry, char *name, char **value,
|
||||||
|
size_t padding)
|
||||||
|
{
|
||||||
|
ssize_t res;
|
||||||
|
char *buf = NULL;
|
||||||
|
|
||||||
|
res = vfs_getxattr(dentry, name, NULL, 0);
|
||||||
|
if (res < 0) {
|
||||||
|
if (res == -ENODATA || res == -EOPNOTSUPP)
|
||||||
|
return -ENODATA;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res != 0) {
|
||||||
|
buf = kzalloc(res + padding, GFP_KERNEL);
|
||||||
|
if (!buf)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
res = vfs_getxattr(dentry, name, buf, res);
|
||||||
|
if (res < 0)
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
*value = buf;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
pr_warn_ratelimited("failed to get xattr %s: err=%zi)\n",
|
||||||
|
name, res);
|
||||||
|
kfree(buf);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/* Copy up data of an inode which was copied up metadata only in the past. */
|
/* Copy up data of an inode which was copied up metadata only in the past. */
|
||||||
static int ovl_copy_up_meta_inode_data(struct ovl_copy_up_ctx *c)
|
static int ovl_copy_up_meta_inode_data(struct ovl_copy_up_ctx *c)
|
||||||
{
|
{
|
||||||
|
@ -299,8 +299,6 @@ int ovl_lock_rename_workdir(struct dentry *workdir, struct dentry *upperdir);
|
|||||||
int ovl_check_metacopy_xattr(struct dentry *dentry);
|
int ovl_check_metacopy_xattr(struct dentry *dentry);
|
||||||
bool ovl_is_metacopy_dentry(struct dentry *dentry);
|
bool ovl_is_metacopy_dentry(struct dentry *dentry);
|
||||||
char *ovl_get_redirect_xattr(struct dentry *dentry, int padding);
|
char *ovl_get_redirect_xattr(struct dentry *dentry, int padding);
|
||||||
ssize_t ovl_getxattr(struct dentry *dentry, char *name, char **value,
|
|
||||||
size_t padding);
|
|
||||||
|
|
||||||
static inline bool ovl_is_impuredir(struct dentry *dentry)
|
static inline bool ovl_is_impuredir(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
|
@ -882,8 +882,8 @@ bool ovl_is_metacopy_dentry(struct dentry *dentry)
|
|||||||
return (oe->numlower > 1);
|
return (oe->numlower > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t ovl_getxattr(struct dentry *dentry, char *name, char **value,
|
static ssize_t ovl_getxattr(struct dentry *dentry, char *name, char **value,
|
||||||
size_t padding)
|
size_t padding)
|
||||||
{
|
{
|
||||||
ssize_t res;
|
ssize_t res;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user