xfs
[Top] [All Lists]

Re: [PATCH v18 18/22] richacl: xattr mapping functions

To: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
Subject: Re: [PATCH v18 18/22] richacl: xattr mapping functions
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Fri, 11 Mar 2016 06:17:01 -0800
Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>, "J. Bruce Fields" <bfields@xxxxxxxxxxxx>, linux-nfs@xxxxxxxxxxxxxxx, Theodore Ts'o <tytso@xxxxxxx>, linux-cifs@xxxxxxxxxxxxxxx, linux-api@xxxxxxxxxxxxxxx, Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, Christoph Hellwig <hch@xxxxxxxxxxxxx>, Andreas Dilger <adilger.kernel@xxxxxxxxx>, linux-fsdevel@xxxxxxxxxxxxxxx, Jeff Layton <jlayton@xxxxxxxxxxxxxxx>, linux-ext4@xxxxxxxxxxxxxxx, Anna Schumaker <anna.schumaker@xxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1456733847-17982-19-git-send-email-agruenba@xxxxxxxxxx>
References: <1456733847-17982-1-git-send-email-agruenba@xxxxxxxxxx> <1456733847-17982-19-git-send-email-agruenba@xxxxxxxxxx>
User-agent: Mutt/1.5.24 (2015-08-30)
> +#include <linux/richacl_xattr.h>
> +
> +MODULE_LICENSE("GPL");

what's the point given that the code isn't even modolar?

> +static void
> +fix_xattr_from_user(const char *kname, void *kvalue, size_t size)
> +{
> +     if (strncmp(kname, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
> +             return;
> +     kname += XATTR_SYSTEM_PREFIX_LEN;
> +     if (!strcmp(kname, XATTR_POSIX_ACL_ACCESS) ||
> +         !strcmp(kname, XATTR_POSIX_ACL_DEFAULT))
> +             posix_acl_fix_xattr_from_user(kvalue, size);
> +}
>  
>  /*
>   * Extended attribute SET operations
> @@ -329,9 +339,7 @@ setxattr(struct dentry *d, const char __user *name, const 
> void __user *value,
>                       error = -EFAULT;
>                       goto out;
>               }
> -             if ((strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) == 0) ||
> -                 (strcmp(kname, XATTR_NAME_POSIX_ACL_DEFAULT) == 0))
> -                     posix_acl_fix_xattr_from_user(kvalue, size);
> +             fix_xattr_from_user(kname, kvalue, size);
>       }
>  
>       error = vfs_setxattr(d, kname, kvalue, size, flags);
> @@ -396,6 +404,17 @@ SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, 
> name,
>       return error;
>  }
>  
> +static void
> +fix_xattr_to_user(const char *kname, void *kvalue, size_t size)
> +{
> +     if (strncmp(kname, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
> +             return;
> +     kname += XATTR_SYSTEM_PREFIX_LEN;
> +     if (!strcmp(kname, XATTR_POSIX_ACL_ACCESS) ||
> +         !strcmp(kname, XATTR_POSIX_ACL_DEFAULT))
> +             posix_acl_fix_xattr_to_user(kvalue, size);
> +}
> +
>  /*
>   * Extended attribute GET operations
>   */
> @@ -426,9 +445,7 @@ getxattr(struct dentry *d, const char __user *name, void 
> __user *value,
>  
>       error = vfs_getxattr(d, kname, kvalue, size);
>       if (error > 0) {
> -             if ((strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) == 0) ||
> -                 (strcmp(kname, XATTR_NAME_POSIX_ACL_DEFAULT) == 0))
> -                     posix_acl_fix_xattr_to_user(kvalue, size);
> +             fix_xattr_to_user(kname, kvalue, size);

I don't see how this is related to the rest of the patch.

> +++ b/include/linux/richacl_xattr.h

What's the point in splitting this from the richacl.h header?

Same for the uapi versions.

> +struct richacl_xattr {
> +     unsigned char   a_version;
> +     unsigned char   a_flags;

Explicit __u8 for uapi headers, please.

<Prev in Thread] Current Thread [Next in Thread>