summaryrefslogtreecommitdiffstats
path: root/fs/posix_acl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/posix_acl.c')
-rw-r--r--fs/posix_acl.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 2fdca614ded3..4adde1e2cbec 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -762,8 +762,9 @@ posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl,
762EXPORT_SYMBOL (posix_acl_to_xattr); 762EXPORT_SYMBOL (posix_acl_to_xattr);
763 763
764static int 764static int
765posix_acl_xattr_get(struct dentry *dentry, const char *name, 765posix_acl_xattr_get(const struct xattr_handler *handler,
766 void *value, size_t size, int type) 766 struct dentry *dentry, const char *name,
767 void *value, size_t size)
767{ 768{
768 struct posix_acl *acl; 769 struct posix_acl *acl;
769 int error; 770 int error;
@@ -775,7 +776,7 @@ posix_acl_xattr_get(struct dentry *dentry, const char *name,
775 if (d_is_symlink(dentry)) 776 if (d_is_symlink(dentry))
776 return -EOPNOTSUPP; 777 return -EOPNOTSUPP;
777 778
778 acl = get_acl(d_backing_inode(dentry), type); 779 acl = get_acl(d_backing_inode(dentry), handler->flags);
779 if (IS_ERR(acl)) 780 if (IS_ERR(acl))
780 return PTR_ERR(acl); 781 return PTR_ERR(acl);
781 if (acl == NULL) 782 if (acl == NULL)
@@ -788,8 +789,9 @@ posix_acl_xattr_get(struct dentry *dentry, const char *name,
788} 789}
789 790
790static int 791static int
791posix_acl_xattr_set(struct dentry *dentry, const char *name, 792posix_acl_xattr_set(const struct xattr_handler *handler,
792 const void *value, size_t size, int flags, int type) 793 struct dentry *dentry, const char *name,
794 const void *value, size_t size, int flags)
793{ 795{
794 struct inode *inode = d_backing_inode(dentry); 796 struct inode *inode = d_backing_inode(dentry);
795 struct posix_acl *acl = NULL; 797 struct posix_acl *acl = NULL;
@@ -802,7 +804,7 @@ posix_acl_xattr_set(struct dentry *dentry, const char *name,
802 if (!inode->i_op->set_acl) 804 if (!inode->i_op->set_acl)
803 return -EOPNOTSUPP; 805 return -EOPNOTSUPP;
804 806
805 if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode)) 807 if (handler->flags == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode))
806 return value ? -EACCES : 0; 808 return value ? -EACCES : 0;
807 if (!inode_owner_or_capable(inode)) 809 if (!inode_owner_or_capable(inode))
808 return -EPERM; 810 return -EPERM;
@@ -819,27 +821,23 @@ posix_acl_xattr_set(struct dentry *dentry, const char *name,
819 } 821 }
820 } 822 }
821 823
822 ret = inode->i_op->set_acl(inode, acl, type); 824 ret = inode->i_op->set_acl(inode, acl, handler->flags);
823out: 825out:
824 posix_acl_release(acl); 826 posix_acl_release(acl);
825 return ret; 827 return ret;
826} 828}
827 829
828static size_t 830static size_t
829posix_acl_xattr_list(struct dentry *dentry, char *list, size_t list_size, 831posix_acl_xattr_list(const struct xattr_handler *handler,
830 const char *name, size_t name_len, int type) 832 struct dentry *dentry, char *list, size_t list_size,
833 const char *name, size_t name_len)
831{ 834{
832 const char *xname; 835 const char *xname = handler->prefix;
833 size_t size; 836 size_t size;
834 837
835 if (!IS_POSIXACL(d_backing_inode(dentry))) 838 if (!IS_POSIXACL(d_backing_inode(dentry)))
836 return 0; 839 return 0;
837 840
838 if (type == ACL_TYPE_ACCESS)
839 xname = POSIX_ACL_XATTR_ACCESS;
840 else
841 xname = POSIX_ACL_XATTR_DEFAULT;
842
843 size = strlen(xname) + 1; 841 size = strlen(xname) + 1;
844 if (list && size <= list_size) 842 if (list && size <= list_size)
845 memcpy(list, xname, size); 843 memcpy(list, xname, size);