Commit ade46c3a authored by Richard Weinberger's avatar Richard Weinberger

ubifs: Export xattr get and set functions

For fscrypto we need this function outside of xattr.c.
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent f6337d84
...@@ -1735,6 +1735,10 @@ extern const struct xattr_handler *ubifs_xattr_handlers[]; ...@@ -1735,6 +1735,10 @@ extern const struct xattr_handler *ubifs_xattr_handlers[];
ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size); ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size);
int ubifs_init_security(struct inode *dentry, struct inode *inode, int ubifs_init_security(struct inode *dentry, struct inode *inode,
const struct qstr *qstr); const struct qstr *qstr);
int ubifs_xattr_set(struct inode *host, const char *name, const void *value,
size_t size, int flags);
ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf,
size_t size);
/* super.c */ /* super.c */
struct inode *ubifs_iget(struct super_block *sb, unsigned long inum); struct inode *ubifs_iget(struct super_block *sb, unsigned long inum);
......
...@@ -269,8 +269,8 @@ static struct inode *iget_xattr(struct ubifs_info *c, ino_t inum) ...@@ -269,8 +269,8 @@ static struct inode *iget_xattr(struct ubifs_info *c, ino_t inum)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
static int __ubifs_setxattr(struct inode *host, const char *name, int ubifs_xattr_set(struct inode *host, const char *name, const void *value,
const void *value, size_t size, int flags) size_t size, int flags)
{ {
struct inode *inode; struct inode *inode;
struct ubifs_info *c = host->i_sb->s_fs_info; struct ubifs_info *c = host->i_sb->s_fs_info;
...@@ -329,8 +329,8 @@ static int __ubifs_setxattr(struct inode *host, const char *name, ...@@ -329,8 +329,8 @@ static int __ubifs_setxattr(struct inode *host, const char *name,
return err; return err;
} }
static ssize_t __ubifs_getxattr(struct inode *host, const char *name, ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf,
void *buf, size_t size) size_t size)
{ {
struct inode *inode; struct inode *inode;
struct ubifs_info *c = host->i_sb->s_fs_info; struct ubifs_info *c = host->i_sb->s_fs_info;
...@@ -486,7 +486,7 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host, ...@@ -486,7 +486,7 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
return err; return err;
} }
static int __ubifs_removexattr(struct inode *host, const char *name) static int ubifs_xattr_remove(struct inode *host, const char *name)
{ {
struct inode *inode; struct inode *inode;
struct ubifs_info *c = host->i_sb->s_fs_info; struct ubifs_info *c = host->i_sb->s_fs_info;
...@@ -548,7 +548,8 @@ static int init_xattrs(struct inode *inode, const struct xattr *xattr_array, ...@@ -548,7 +548,8 @@ static int init_xattrs(struct inode *inode, const struct xattr *xattr_array,
} }
strcpy(name, XATTR_SECURITY_PREFIX); strcpy(name, XATTR_SECURITY_PREFIX);
strcpy(name + XATTR_SECURITY_PREFIX_LEN, xattr->name); strcpy(name + XATTR_SECURITY_PREFIX_LEN, xattr->name);
err = __ubifs_setxattr(inode, name, xattr->value, xattr->value_len, 0); err = ubifs_xattr_set(inode, name, xattr->value,
xattr->value_len, 0);
kfree(name); kfree(name);
if (err < 0) if (err < 0)
break; break;
...@@ -572,7 +573,7 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode, ...@@ -572,7 +573,7 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode,
return err; return err;
} }
static int ubifs_xattr_get(const struct xattr_handler *handler, static int xattr_get(const struct xattr_handler *handler,
struct dentry *dentry, struct inode *inode, struct dentry *dentry, struct inode *inode,
const char *name, void *buffer, size_t size) const char *name, void *buffer, size_t size)
{ {
...@@ -580,10 +581,10 @@ static int ubifs_xattr_get(const struct xattr_handler *handler, ...@@ -580,10 +581,10 @@ static int ubifs_xattr_get(const struct xattr_handler *handler,
inode->i_ino, dentry, size); inode->i_ino, dentry, size);
name = xattr_full_name(handler, name); name = xattr_full_name(handler, name);
return __ubifs_getxattr(inode, name, buffer, size); return ubifs_xattr_get(inode, name, buffer, size);
} }
static int ubifs_xattr_set(const struct xattr_handler *handler, static int xattr_set(const struct xattr_handler *handler,
struct dentry *dentry, struct inode *inode, struct dentry *dentry, struct inode *inode,
const char *name, const void *value, const char *name, const void *value,
size_t size, int flags) size_t size, int flags)
...@@ -594,27 +595,27 @@ static int ubifs_xattr_set(const struct xattr_handler *handler, ...@@ -594,27 +595,27 @@ static int ubifs_xattr_set(const struct xattr_handler *handler,
name = xattr_full_name(handler, name); name = xattr_full_name(handler, name);
if (value) if (value)
return __ubifs_setxattr(inode, name, value, size, flags); return ubifs_xattr_set(inode, name, value, size, flags);
else else
return __ubifs_removexattr(inode, name); return ubifs_xattr_remove(inode, name);
} }
static const struct xattr_handler ubifs_user_xattr_handler = { static const struct xattr_handler ubifs_user_xattr_handler = {
.prefix = XATTR_USER_PREFIX, .prefix = XATTR_USER_PREFIX,
.get = ubifs_xattr_get, .get = xattr_get,
.set = ubifs_xattr_set, .set = xattr_set,
}; };
static const struct xattr_handler ubifs_trusted_xattr_handler = { static const struct xattr_handler ubifs_trusted_xattr_handler = {
.prefix = XATTR_TRUSTED_PREFIX, .prefix = XATTR_TRUSTED_PREFIX,
.get = ubifs_xattr_get, .get = xattr_get,
.set = ubifs_xattr_set, .set = xattr_set,
}; };
static const struct xattr_handler ubifs_security_xattr_handler = { static const struct xattr_handler ubifs_security_xattr_handler = {
.prefix = XATTR_SECURITY_PREFIX, .prefix = XATTR_SECURITY_PREFIX,
.get = ubifs_xattr_get, .get = xattr_get,
.set = ubifs_xattr_set, .set = xattr_set,
}; };
const struct xattr_handler *ubifs_xattr_handlers[] = { const struct xattr_handler *ubifs_xattr_handlers[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment