aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2016-09-19 15:42:06 -0400
committerRichard Weinberger <richard@nod.at>2016-12-12 17:07:38 -0500
commitade46c3a6029dea49dbc6c7734b0f6a78d3f104c (patch)
tree53342245590e3ea5d0f8a0ca954ed22beb456033 /fs/ubifs
parentf6337d842668ad47f01d5f2dcd3730484f09d6fa (diff)
ubifs: Export xattr get and set functions
For fscrypto we need this function outside of xattr.c. Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/ubifs.h4
-rw-r--r--fs/ubifs/xattr.c35
2 files changed, 22 insertions, 17 deletions
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index fe94300d4c08..0f8a3ec6a7fe 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -1735,6 +1735,10 @@ extern const struct xattr_handler *ubifs_xattr_handlers[];
1735ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size); 1735ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size);
1736int ubifs_init_security(struct inode *dentry, struct inode *inode, 1736int ubifs_init_security(struct inode *dentry, struct inode *inode,
1737 const struct qstr *qstr); 1737 const struct qstr *qstr);
1738int ubifs_xattr_set(struct inode *host, const char *name, const void *value,
1739 size_t size, int flags);
1740ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf,
1741 size_t size);
1738 1742
1739/* super.c */ 1743/* super.c */
1740struct inode *ubifs_iget(struct super_block *sb, unsigned long inum); 1744struct inode *ubifs_iget(struct super_block *sb, unsigned long inum);
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index d9f9615bfd71..2d09dbeecd58 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -269,8 +269,8 @@ static struct inode *iget_xattr(struct ubifs_info *c, ino_t inum)
269 return ERR_PTR(-EINVAL); 269 return ERR_PTR(-EINVAL);
270} 270}
271 271
272static int __ubifs_setxattr(struct inode *host, const char *name, 272int ubifs_xattr_set(struct inode *host, const char *name, const void *value,
273 const void *value, size_t size, int flags) 273 size_t size, int flags)
274{ 274{
275 struct inode *inode; 275 struct inode *inode;
276 struct ubifs_info *c = host->i_sb->s_fs_info; 276 struct ubifs_info *c = host->i_sb->s_fs_info;
@@ -329,8 +329,8 @@ out_free:
329 return err; 329 return err;
330} 330}
331 331
332static ssize_t __ubifs_getxattr(struct inode *host, const char *name, 332ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf,
333 void *buf, size_t size) 333 size_t size)
334{ 334{
335 struct inode *inode; 335 struct inode *inode;
336 struct ubifs_info *c = host->i_sb->s_fs_info; 336 struct ubifs_info *c = host->i_sb->s_fs_info;
@@ -486,7 +486,7 @@ out_cancel:
486 return err; 486 return err;
487} 487}
488 488
489static int __ubifs_removexattr(struct inode *host, const char *name) 489static int ubifs_xattr_remove(struct inode *host, const char *name)
490{ 490{
491 struct inode *inode; 491 struct inode *inode;
492 struct ubifs_info *c = host->i_sb->s_fs_info; 492 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 } 548 }
549 strcpy(name, XATTR_SECURITY_PREFIX); 549 strcpy(name, XATTR_SECURITY_PREFIX);
550 strcpy(name + XATTR_SECURITY_PREFIX_LEN, xattr->name); 550 strcpy(name + XATTR_SECURITY_PREFIX_LEN, xattr->name);
551 err = __ubifs_setxattr(inode, name, xattr->value, xattr->value_len, 0); 551 err = ubifs_xattr_set(inode, name, xattr->value,
552 xattr->value_len, 0);
552 kfree(name); 553 kfree(name);
553 if (err < 0) 554 if (err < 0)
554 break; 555 break;
@@ -572,7 +573,7 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode,
572 return err; 573 return err;
573} 574}
574 575
575static int ubifs_xattr_get(const struct xattr_handler *handler, 576static int xattr_get(const struct xattr_handler *handler,
576 struct dentry *dentry, struct inode *inode, 577 struct dentry *dentry, struct inode *inode,
577 const char *name, void *buffer, size_t size) 578 const char *name, void *buffer, size_t size)
578{ 579{
@@ -580,10 +581,10 @@ static int ubifs_xattr_get(const struct xattr_handler *handler,
580 inode->i_ino, dentry, size); 581 inode->i_ino, dentry, size);
581 582
582 name = xattr_full_name(handler, name); 583 name = xattr_full_name(handler, name);
583 return __ubifs_getxattr(inode, name, buffer, size); 584 return ubifs_xattr_get(inode, name, buffer, size);
584} 585}
585 586
586static int ubifs_xattr_set(const struct xattr_handler *handler, 587static int xattr_set(const struct xattr_handler *handler,
587 struct dentry *dentry, struct inode *inode, 588 struct dentry *dentry, struct inode *inode,
588 const char *name, const void *value, 589 const char *name, const void *value,
589 size_t size, int flags) 590 size_t size, int flags)
@@ -594,27 +595,27 @@ static int ubifs_xattr_set(const struct xattr_handler *handler,
594 name = xattr_full_name(handler, name); 595 name = xattr_full_name(handler, name);
595 596
596 if (value) 597 if (value)
597 return __ubifs_setxattr(inode, name, value, size, flags); 598 return ubifs_xattr_set(inode, name, value, size, flags);
598 else 599 else
599 return __ubifs_removexattr(inode, name); 600 return ubifs_xattr_remove(inode, name);
600} 601}
601 602
602static const struct xattr_handler ubifs_user_xattr_handler = { 603static const struct xattr_handler ubifs_user_xattr_handler = {
603 .prefix = XATTR_USER_PREFIX, 604 .prefix = XATTR_USER_PREFIX,
604 .get = ubifs_xattr_get, 605 .get = xattr_get,
605 .set = ubifs_xattr_set, 606 .set = xattr_set,
606}; 607};
607 608
608static const struct xattr_handler ubifs_trusted_xattr_handler = { 609static const struct xattr_handler ubifs_trusted_xattr_handler = {
609 .prefix = XATTR_TRUSTED_PREFIX, 610 .prefix = XATTR_TRUSTED_PREFIX,
610 .get = ubifs_xattr_get, 611 .get = xattr_get,
611 .set = ubifs_xattr_set, 612 .set = xattr_set,
612}; 613};
613 614
614static const struct xattr_handler ubifs_security_xattr_handler = { 615static const struct xattr_handler ubifs_security_xattr_handler = {
615 .prefix = XATTR_SECURITY_PREFIX, 616 .prefix = XATTR_SECURITY_PREFIX,
616 .get = ubifs_xattr_get, 617 .get = xattr_get,
617 .set = ubifs_xattr_set, 618 .set = xattr_set,
618}; 619};
619 620
620const struct xattr_handler *ubifs_xattr_handlers[] = { 621const struct xattr_handler *ubifs_xattr_handlers[] = {