posix acls: Remove duplicate xattr name definitions
authorAndreas Gruenbacher <agruenba@redhat.com>
Wed, 2 Dec 2015 13:44:35 +0000 (14:44 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 7 Dec 2015 02:25:17 +0000 (21:25 -0500)
Remove POSIX_ACL_XATTR_{ACCESS,DEFAULT} and GFS2_POSIX_ACL_{ACCESS,DEFAULT}
and replace them with the definitions in <include/uapi/linux/xattr.h>.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 files changed:
drivers/staging/lustre/lustre/llite/xattr.c
fs/9p/acl.c
fs/btrfs/acl.c
fs/btrfs/inode.c
fs/ceph/acl.c
fs/cifs/xattr.c
fs/gfs2/acl.c
fs/gfs2/acl.h
fs/hfsplus/posix_acl.c
fs/jfs/acl.c
fs/nfs/nfs3acl.c
fs/posix_acl.c
fs/reiserfs/xattr_acl.c
fs/xfs/xfs_xattr.c
include/linux/posix_acl_xattr.h

index 4b7eb33f7d0172d8f8c716c309e98b7fdce19b1a..660b8ac37ae0c62fa2f66a38f2c0733774382144 100644 (file)
 static
 int get_xattr_type(const char *name)
 {
-       if (!strcmp(name, POSIX_ACL_XATTR_ACCESS))
+       if (!strcmp(name, XATTR_NAME_POSIX_ACL_ACCESS))
                return XATTR_ACL_ACCESS_T;
 
-       if (!strcmp(name, POSIX_ACL_XATTR_DEFAULT))
+       if (!strcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT))
                return XATTR_ACL_DEFAULT_T;
 
        if (!strncmp(name, XATTR_USER_PREFIX,
index a7e28890f5efb4ec8729fc9de4f09e16d4fb91bd..6ff30b14bc768c444633a18490b8d273045ceb98 100644 (file)
@@ -67,8 +67,8 @@ int v9fs_get_acl(struct inode *inode, struct p9_fid *fid)
                return 0;
        }
        /* get the default/access acl values and cache them */
-       dacl = __v9fs_get_acl(fid, POSIX_ACL_XATTR_DEFAULT);
-       pacl = __v9fs_get_acl(fid, POSIX_ACL_XATTR_ACCESS);
+       dacl = __v9fs_get_acl(fid, XATTR_NAME_POSIX_ACL_DEFAULT);
+       pacl = __v9fs_get_acl(fid, XATTR_NAME_POSIX_ACL_ACCESS);
 
        if (!IS_ERR(dacl) && !IS_ERR(pacl)) {
                set_cached_acl(inode, ACL_TYPE_DEFAULT, dacl);
@@ -133,10 +133,10 @@ static int v9fs_set_acl(struct p9_fid *fid, int type, struct posix_acl *acl)
                goto err_free_out;
        switch (type) {
        case ACL_TYPE_ACCESS:
-               name = POSIX_ACL_XATTR_ACCESS;
+               name = XATTR_NAME_POSIX_ACL_ACCESS;
                break;
        case ACL_TYPE_DEFAULT:
-               name = POSIX_ACL_XATTR_DEFAULT;
+               name = XATTR_NAME_POSIX_ACL_DEFAULT;
                break;
        default:
                BUG();
@@ -328,14 +328,14 @@ err_out:
 }
 
 const struct xattr_handler v9fs_xattr_acl_access_handler = {
-       .prefix = POSIX_ACL_XATTR_ACCESS,
+       .prefix = XATTR_NAME_POSIX_ACL_ACCESS,
        .flags  = ACL_TYPE_ACCESS,
        .get    = v9fs_xattr_get_acl,
        .set    = v9fs_xattr_set_acl,
 };
 
 const struct xattr_handler v9fs_xattr_acl_default_handler = {
-       .prefix = POSIX_ACL_XATTR_DEFAULT,
+       .prefix = XATTR_NAME_POSIX_ACL_DEFAULT,
        .flags  = ACL_TYPE_DEFAULT,
        .get    = v9fs_xattr_get_acl,
        .set    = v9fs_xattr_set_acl,
index 9a0124a95851014c9000ed7822dc5fad0a2f6995..f89db0c21b51edaadda1d1544425010d89e92ae2 100644 (file)
@@ -37,10 +37,10 @@ struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
 
        switch (type) {
        case ACL_TYPE_ACCESS:
-               name = POSIX_ACL_XATTR_ACCESS;
+               name = XATTR_NAME_POSIX_ACL_ACCESS;
                break;
        case ACL_TYPE_DEFAULT:
-               name = POSIX_ACL_XATTR_DEFAULT;
+               name = XATTR_NAME_POSIX_ACL_DEFAULT;
                break;
        default:
                BUG();
@@ -81,7 +81,7 @@ static int __btrfs_set_acl(struct btrfs_trans_handle *trans,
 
        switch (type) {
        case ACL_TYPE_ACCESS:
-               name = POSIX_ACL_XATTR_ACCESS;
+               name = XATTR_NAME_POSIX_ACL_ACCESS;
                if (acl) {
                        ret = posix_acl_equiv_mode(acl, &inode->i_mode);
                        if (ret < 0)
@@ -94,7 +94,7 @@ static int __btrfs_set_acl(struct btrfs_trans_handle *trans,
        case ACL_TYPE_DEFAULT:
                if (!S_ISDIR(inode->i_mode))
                        return acl ? -EINVAL : 0;
-               name = POSIX_ACL_XATTR_DEFAULT;
+               name = XATTR_NAME_POSIX_ACL_DEFAULT;
                break;
        default:
                return -EINVAL;
index a70c5790f8f5908f08f606d097fe33e6966af36b..d540fd70f6c6074342b73e642382642ac5e10a59 100644 (file)
@@ -3550,10 +3550,10 @@ static noinline int acls_after_inode_item(struct extent_buffer *leaf,
        int scanned = 0;
 
        if (!xattr_access) {
-               xattr_access = btrfs_name_hash(POSIX_ACL_XATTR_ACCESS,
-                                       strlen(POSIX_ACL_XATTR_ACCESS));
-               xattr_default = btrfs_name_hash(POSIX_ACL_XATTR_DEFAULT,
-                                       strlen(POSIX_ACL_XATTR_DEFAULT));
+               xattr_access = btrfs_name_hash(XATTR_NAME_POSIX_ACL_ACCESS,
+                                       strlen(XATTR_NAME_POSIX_ACL_ACCESS));
+               xattr_default = btrfs_name_hash(XATTR_NAME_POSIX_ACL_DEFAULT,
+                                       strlen(XATTR_NAME_POSIX_ACL_DEFAULT));
        }
 
        slot++;
index 8f84646f10e9560ade100c1dafa180768f1d76de..f19708487e2f74c80e55b14ecbadb07bf79b73a9 100644 (file)
@@ -49,10 +49,10 @@ struct posix_acl *ceph_get_acl(struct inode *inode, int type)
 
        switch (type) {
        case ACL_TYPE_ACCESS:
-               name = POSIX_ACL_XATTR_ACCESS;
+               name = XATTR_NAME_POSIX_ACL_ACCESS;
                break;
        case ACL_TYPE_DEFAULT:
-               name = POSIX_ACL_XATTR_DEFAULT;
+               name = XATTR_NAME_POSIX_ACL_DEFAULT;
                break;
        default:
                BUG();
@@ -92,7 +92,7 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type)
 
        switch (type) {
        case ACL_TYPE_ACCESS:
-               name = POSIX_ACL_XATTR_ACCESS;
+               name = XATTR_NAME_POSIX_ACL_ACCESS;
                if (acl) {
                        ret = posix_acl_equiv_mode(acl, &new_mode);
                        if (ret < 0)
@@ -106,7 +106,7 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type)
                        ret = acl ? -EINVAL : 0;
                        goto out;
                }
-               name = POSIX_ACL_XATTR_DEFAULT;
+               name = XATTR_NAME_POSIX_ACL_DEFAULT;
                break;
        default:
                ret = -EINVAL;
@@ -202,11 +202,11 @@ int ceph_pre_init_acls(struct inode *dir, umode_t *mode,
        ceph_pagelist_encode_32(pagelist, acl && default_acl ? 2 : 1);
 
        if (acl) {
-               size_t len = strlen(POSIX_ACL_XATTR_ACCESS);
+               size_t len = strlen(XATTR_NAME_POSIX_ACL_ACCESS);
                err = ceph_pagelist_reserve(pagelist, len + val_size1 + 8);
                if (err)
                        goto out_err;
-               ceph_pagelist_encode_string(pagelist, POSIX_ACL_XATTR_ACCESS,
+               ceph_pagelist_encode_string(pagelist, XATTR_NAME_POSIX_ACL_ACCESS,
                                            len);
                err = posix_acl_to_xattr(&init_user_ns, acl,
                                         tmp_buf, val_size1);
@@ -216,12 +216,12 @@ int ceph_pre_init_acls(struct inode *dir, umode_t *mode,
                ceph_pagelist_append(pagelist, tmp_buf, val_size1);
        }
        if (default_acl) {
-               size_t len = strlen(POSIX_ACL_XATTR_DEFAULT);
+               size_t len = strlen(XATTR_NAME_POSIX_ACL_DEFAULT);
                err = ceph_pagelist_reserve(pagelist, len + val_size2 + 8);
                if (err)
                        goto out_err;
                err = ceph_pagelist_encode_string(pagelist,
-                                                 POSIX_ACL_XATTR_DEFAULT, len);
+                                                 XATTR_NAME_POSIX_ACL_DEFAULT, len);
                err = posix_acl_to_xattr(&init_user_ns, default_acl,
                                         tmp_buf, val_size2);
                if (err < 0)
index ff9e1f8b16a4872158c05f688a9761a9a7a8781d..f5dc2f0df4ad6f13b52e26ac8bd0bf12c5370ed8 100644 (file)
@@ -190,8 +190,8 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
 #endif /* CONFIG_CIFS_ACL */
        } else {
                int temp;
-               temp = strncmp(ea_name, POSIX_ACL_XATTR_ACCESS,
-                       strlen(POSIX_ACL_XATTR_ACCESS));
+               temp = strncmp(ea_name, XATTR_NAME_POSIX_ACL_ACCESS,
+                       strlen(XATTR_NAME_POSIX_ACL_ACCESS));
                if (temp == 0) {
 #ifdef CONFIG_CIFS_POSIX
                        if (sb->s_flags & MS_POSIXACL)
@@ -203,8 +203,8 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
 #else
                        cifs_dbg(FYI, "set POSIX ACL not supported\n");
 #endif
-               } else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT,
-                                  strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) {
+               } else if (strncmp(ea_name, XATTR_NAME_POSIX_ACL_DEFAULT,
+                                  strlen(XATTR_NAME_POSIX_ACL_DEFAULT)) == 0) {
 #ifdef CONFIG_CIFS_POSIX
                        if (sb->s_flags & MS_POSIXACL)
                                rc = CIFSSMBSetPosixACL(xid, pTcon, full_path,
@@ -292,8 +292,8 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
                        rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon,
                                full_path, ea_name, ea_value, buf_size,
                                cifs_sb->local_nls, cifs_remap(cifs_sb));
-       } else if (strncmp(ea_name, POSIX_ACL_XATTR_ACCESS,
-                         strlen(POSIX_ACL_XATTR_ACCESS)) == 0) {
+       } else if (strncmp(ea_name, XATTR_NAME_POSIX_ACL_ACCESS,
+                         strlen(XATTR_NAME_POSIX_ACL_ACCESS)) == 0) {
 #ifdef CONFIG_CIFS_POSIX
                if (sb->s_flags & MS_POSIXACL)
                        rc = CIFSSMBGetPosixACL(xid, pTcon, full_path,
@@ -303,8 +303,8 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
 #else
                cifs_dbg(FYI, "Query POSIX ACL not supported yet\n");
 #endif /* CONFIG_CIFS_POSIX */
-       } else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT,
-                         strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) {
+       } else if (strncmp(ea_name, XATTR_NAME_POSIX_ACL_DEFAULT,
+                         strlen(XATTR_NAME_POSIX_ACL_DEFAULT)) == 0) {
 #ifdef CONFIG_CIFS_POSIX
                if (sb->s_flags & MS_POSIXACL)
                        rc = CIFSSMBGetPosixACL(xid, pTcon, full_path,
index 1be3b061c05c921f60ddfebcce809875fe8de662..791932617d1a39972aee07a87ed35e8597e6b7bd 100644 (file)
@@ -31,9 +31,9 @@ static const char *gfs2_acl_name(int type)
 {
        switch (type) {
        case ACL_TYPE_ACCESS:
-               return GFS2_POSIX_ACL_ACCESS;
+               return XATTR_POSIX_ACL_ACCESS;
        case ACL_TYPE_DEFAULT:
-               return GFS2_POSIX_ACL_DEFAULT;
+               return XATTR_POSIX_ACL_DEFAULT;
        }
        return NULL;
 }
index 2d65ec4cd4bef60b87c0291c9ef84ce3abcf65a2..3af4f407a483e53bf3f5fae9df334204758bb39a 100644 (file)
@@ -12,8 +12,6 @@
 
 #include "incore.h"
 
-#define GFS2_POSIX_ACL_ACCESS          "posix_acl_access"
-#define GFS2_POSIX_ACL_DEFAULT         "posix_acl_default"
 #define GFS2_ACL_MAX_ENTRIES(sdp) ((300 << (sdp)->sd_sb.sb_bsize_shift) >> 12)
 
 extern struct posix_acl *gfs2_get_acl(struct inode *inode, int type);
index df0c9af68d05ef0df5a127d53562677bc8a2d882..afb33eda6d7dbae7ea5dab4d19b1edc401db151a 100644 (file)
@@ -21,10 +21,10 @@ struct posix_acl *hfsplus_get_posix_acl(struct inode *inode, int type)
 
        switch (type) {
        case ACL_TYPE_ACCESS:
-               xattr_name = POSIX_ACL_XATTR_ACCESS;
+               xattr_name = XATTR_NAME_POSIX_ACL_ACCESS;
                break;
        case ACL_TYPE_DEFAULT:
-               xattr_name = POSIX_ACL_XATTR_DEFAULT;
+               xattr_name = XATTR_NAME_POSIX_ACL_DEFAULT;
                break;
        default:
                return ERR_PTR(-EINVAL);
@@ -66,7 +66,7 @@ int hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl,
 
        switch (type) {
        case ACL_TYPE_ACCESS:
-               xattr_name = POSIX_ACL_XATTR_ACCESS;
+               xattr_name = XATTR_NAME_POSIX_ACL_ACCESS;
                if (acl) {
                        err = posix_acl_equiv_mode(acl, &inode->i_mode);
                        if (err < 0)
@@ -76,7 +76,7 @@ int hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl,
                break;
 
        case ACL_TYPE_DEFAULT:
-               xattr_name = POSIX_ACL_XATTR_DEFAULT;
+               xattr_name = XATTR_NAME_POSIX_ACL_DEFAULT;
                if (!S_ISDIR(inode->i_mode))
                        return acl ? -EACCES : 0;
                break;
index 0c8ca830b113e62246d3f2629846958bdee32775..49456853e9de230822b4cb97b407c565525d2ffe 100644 (file)
@@ -40,10 +40,10 @@ struct posix_acl *jfs_get_acl(struct inode *inode, int type)
 
        switch(type) {
                case ACL_TYPE_ACCESS:
-                       ea_name = POSIX_ACL_XATTR_ACCESS;
+                       ea_name = XATTR_NAME_POSIX_ACL_ACCESS;
                        break;
                case ACL_TYPE_DEFAULT:
-                       ea_name = POSIX_ACL_XATTR_DEFAULT;
+                       ea_name = XATTR_NAME_POSIX_ACL_DEFAULT;
                        break;
                default:
                        return ERR_PTR(-EINVAL);
@@ -82,7 +82,7 @@ static int __jfs_set_acl(tid_t tid, struct inode *inode, int type,
 
        switch (type) {
        case ACL_TYPE_ACCESS:
-               ea_name = POSIX_ACL_XATTR_ACCESS;
+               ea_name = XATTR_NAME_POSIX_ACL_ACCESS;
                if (acl) {
                        rc = posix_acl_equiv_mode(acl, &inode->i_mode);
                        if (rc < 0)
@@ -94,7 +94,7 @@ static int __jfs_set_acl(tid_t tid, struct inode *inode, int type,
                }
                break;
        case ACL_TYPE_DEFAULT:
-               ea_name = POSIX_ACL_XATTR_DEFAULT;
+               ea_name = XATTR_NAME_POSIX_ACL_DEFAULT;
                break;
        default:
                return -EINVAL;
index 1ebe2fc7cda2778edfb968da2c8f079dd2870431..17c0fa1eccfaad22710fe6e938dc4904cc5b8cdf 100644 (file)
@@ -284,12 +284,12 @@ nfs3_listxattr(struct dentry *dentry, char *data, size_t size)
        int error;
 
        error = nfs3_list_one_acl(inode, ACL_TYPE_ACCESS,
-                       POSIX_ACL_XATTR_ACCESS, data, size, &result);
+                       XATTR_NAME_POSIX_ACL_ACCESS, data, size, &result);
        if (error)
                return error;
 
        error = nfs3_list_one_acl(inode, ACL_TYPE_DEFAULT,
-                       POSIX_ACL_XATTR_DEFAULT, data, size, &result);
+                       XATTR_NAME_POSIX_ACL_DEFAULT, data, size, &result);
        if (error)
                return error;
        return result;
index 4adde1e2cbece693ebab67527a555e3a33e6fbfa..571465d6df58d802a1de6e136d69ace47c89af05 100644 (file)
@@ -845,7 +845,7 @@ posix_acl_xattr_list(const struct xattr_handler *handler,
 }
 
 const struct xattr_handler posix_acl_access_xattr_handler = {
-       .prefix = POSIX_ACL_XATTR_ACCESS,
+       .prefix = XATTR_NAME_POSIX_ACL_ACCESS,
        .flags = ACL_TYPE_ACCESS,
        .list = posix_acl_xattr_list,
        .get = posix_acl_xattr_get,
@@ -854,7 +854,7 @@ const struct xattr_handler posix_acl_access_xattr_handler = {
 EXPORT_SYMBOL_GPL(posix_acl_access_xattr_handler);
 
 const struct xattr_handler posix_acl_default_xattr_handler = {
-       .prefix = POSIX_ACL_XATTR_DEFAULT,
+       .prefix = XATTR_NAME_POSIX_ACL_DEFAULT,
        .flags = ACL_TYPE_DEFAULT,
        .list = posix_acl_xattr_list,
        .get = posix_acl_xattr_get,
index 4b34b9dc03dda9fffd8da5d3ab7221bd9ab139b7..558a16beaacb994749e74cf74acf869f611a1064 100644 (file)
@@ -186,10 +186,10 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
 
        switch (type) {
        case ACL_TYPE_ACCESS:
-               name = POSIX_ACL_XATTR_ACCESS;
+               name = XATTR_NAME_POSIX_ACL_ACCESS;
                break;
        case ACL_TYPE_DEFAULT:
-               name = POSIX_ACL_XATTR_DEFAULT;
+               name = XATTR_NAME_POSIX_ACL_DEFAULT;
                break;
        default:
                BUG();
@@ -244,7 +244,7 @@ __reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode,
 
        switch (type) {
        case ACL_TYPE_ACCESS:
-               name = POSIX_ACL_XATTR_ACCESS;
+               name = XATTR_NAME_POSIX_ACL_ACCESS;
                if (acl) {
                        error = posix_acl_equiv_mode(acl, &inode->i_mode);
                        if (error < 0)
@@ -256,7 +256,7 @@ __reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode,
                }
                break;
        case ACL_TYPE_DEFAULT:
-               name = POSIX_ACL_XATTR_DEFAULT;
+               name = XATTR_NAME_POSIX_ACL_DEFAULT;
                if (!S_ISDIR(inode->i_mode))
                        return acl ? -EACCES : 0;
                break;
index 839b35ca21c69320c736ac636ef681b1362402ce..7288795718c91e729a4af0bbbe41356a2aba44d6 100644 (file)
@@ -253,16 +253,16 @@ xfs_vn_listxattr(struct dentry *dentry, char *data, size_t size)
         * Then add the two synthetic ACL attributes.
         */
        if (posix_acl_access_exists(inode)) {
-               error = list_one_attr(POSIX_ACL_XATTR_ACCESS,
-                               strlen(POSIX_ACL_XATTR_ACCESS) + 1,
+               error = list_one_attr(XATTR_NAME_POSIX_ACL_ACCESS,
+                               strlen(XATTR_NAME_POSIX_ACL_ACCESS) + 1,
                                data, size, &context.count);
                if (error)
                        return error;
        }
 
        if (posix_acl_default_exists(inode)) {
-               error = list_one_attr(POSIX_ACL_XATTR_DEFAULT,
-                               strlen(POSIX_ACL_XATTR_DEFAULT) + 1,
+               error = list_one_attr(XATTR_NAME_POSIX_ACL_DEFAULT,
+                               strlen(XATTR_NAME_POSIX_ACL_DEFAULT) + 1,
                                data, size, &context.count);
                if (error)
                        return error;
index 6f14ee2958220b03afcb8c41a8fc2cdcad9ea940..e5e8ec40278dd7f463d59298ce45eb3a86e99b16 100644 (file)
@@ -9,16 +9,12 @@
 #ifndef _POSIX_ACL_XATTR_H
 #define _POSIX_ACL_XATTR_H
 
+#include <uapi/linux/xattr.h>
 #include <linux/posix_acl.h>
 
-/* Extended attribute names */
-#define POSIX_ACL_XATTR_ACCESS "system.posix_acl_access"
-#define POSIX_ACL_XATTR_DEFAULT        "system.posix_acl_default"
-
 /* Supported ACL a_version fields */
 #define POSIX_ACL_XATTR_VERSION        0x0002
 
-
 /* An undefined entry e_id value */
 #define ACL_UNDEFINED_ID       (-1)