]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
xfs: convert attr to use unsigned names
authorDave Chinner <david@fromorbit.com>
Tue, 19 Jan 2010 23:47:48 +0000 (10:47 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 19 Jan 2010 23:47:48 +0000 (10:47 +1100)
To be consistent with the directory code, the attr code should use
unsigned names. Convert the names from the vfs at the highest level
to unsigned, and ænsure they are consistenly used as unsigned down
to disk.

Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
12 files changed:
fs/xfs/linux-2.6/xfs_acl.c
fs/xfs/linux-2.6/xfs_ioctl.c
fs/xfs/linux-2.6/xfs_ioctl.h
fs/xfs/linux-2.6/xfs_ioctl32.c
fs/xfs/linux-2.6/xfs_iops.c
fs/xfs/linux-2.6/xfs_xattr.c
fs/xfs/xfs_acl.h
fs/xfs/xfs_attr.c
fs/xfs/xfs_attr.h
fs/xfs/xfs_attr_leaf.c
fs/xfs/xfs_attr_sf.h
fs/xfs/xfs_vnodeops.h

index 883ca5ab8af572f4daa961e3e0fb1a6777bd3a3c..bf85bbe4a9aedd8b43ac57829024fc94095ac91f 100644 (file)
@@ -106,7 +106,7 @@ xfs_get_acl(struct inode *inode, int type)
        struct posix_acl *acl;
        struct xfs_acl *xfs_acl;
        int len = sizeof(struct xfs_acl);
-       char *ea_name;
+       unsigned char *ea_name;
        int error;
 
        acl = get_cached_acl(inode, type);
@@ -133,7 +133,8 @@ xfs_get_acl(struct inode *inode, int type)
        if (!xfs_acl)
                return ERR_PTR(-ENOMEM);
 
-       error = -xfs_attr_get(ip, ea_name, (char *)xfs_acl, &len, ATTR_ROOT);
+       error = -xfs_attr_get(ip, ea_name, (unsigned char *)xfs_acl,
+                                                       &len, ATTR_ROOT);
        if (error) {
                /*
                 * If the attribute doesn't exist make sure we have a negative
@@ -162,7 +163,7 @@ STATIC int
 xfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
 {
        struct xfs_inode *ip = XFS_I(inode);
-       char *ea_name;
+       unsigned char *ea_name;
        int error;
 
        if (S_ISLNK(inode->i_mode))
@@ -194,7 +195,7 @@ xfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
                        (sizeof(struct xfs_acl_entry) *
                         (XFS_ACL_MAX_ENTRIES - acl->a_count));
 
-               error = -xfs_attr_set(ip, ea_name, (char *)xfs_acl,
+               error = -xfs_attr_set(ip, ea_name, (unsigned char *)xfs_acl,
                                len, ATTR_ROOT);
 
                kfree(xfs_acl);
@@ -262,7 +263,7 @@ xfs_set_mode(struct inode *inode, mode_t mode)
 }
 
 static int
-xfs_acl_exists(struct inode *inode, char *name)
+xfs_acl_exists(struct inode *inode, unsigned char *name)
 {
        int len = sizeof(struct xfs_acl);
 
index a034cf62443702283af914a073239a1ee530a8da..3906e85abfdceddcf155dd8c4abd7e8916473c12 100644 (file)
@@ -447,12 +447,12 @@ xfs_attrlist_by_handle(
 int
 xfs_attrmulti_attr_get(
        struct inode            *inode,
-       char                    *name,
-       char                    __user *ubuf,
+       unsigned char           *name,
+       unsigned char           __user *ubuf,
        __uint32_t              *len,
        __uint32_t              flags)
 {
-       char                    *kbuf;
+       unsigned char           *kbuf;
        int                     error = EFAULT;
 
        if (*len > XATTR_SIZE_MAX)
@@ -476,12 +476,12 @@ xfs_attrmulti_attr_get(
 int
 xfs_attrmulti_attr_set(
        struct inode            *inode,
-       char                    *name,
-       const char              __user *ubuf,
+       unsigned char           *name,
+       const unsigned char     __user *ubuf,
        __uint32_t              len,
        __uint32_t              flags)
 {
-       char                    *kbuf;
+       unsigned char           *kbuf;
        int                     error = EFAULT;
 
        if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
@@ -501,7 +501,7 @@ xfs_attrmulti_attr_set(
 int
 xfs_attrmulti_attr_remove(
        struct inode            *inode,
-       char                    *name,
+       unsigned char           *name,
        __uint32_t              flags)
 {
        if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
@@ -519,7 +519,7 @@ xfs_attrmulti_by_handle(
        xfs_fsop_attrmulti_handlereq_t am_hreq;
        struct dentry           *dentry;
        unsigned int            i, size;
-       char                    *attr_name;
+       unsigned char           *attr_name;
 
        if (!capable(CAP_SYS_ADMIN))
                return -XFS_ERROR(EPERM);
@@ -547,7 +547,7 @@ xfs_attrmulti_by_handle(
 
        error = 0;
        for (i = 0; i < am_hreq.opcount; i++) {
-               ops[i].am_error = strncpy_from_user(attr_name,
+               ops[i].am_error = strncpy_from_user((char *)attr_name,
                                ops[i].am_attrname, MAXNAMELEN);
                if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN)
                        error = -ERANGE;
index 7bd7c6afc1ebd0c44ac6836109f4559f54593d62..d56173b34a2a55662575f79a4ba5426662b647c9 100644 (file)
@@ -45,23 +45,23 @@ xfs_readlink_by_handle(
 extern int
 xfs_attrmulti_attr_get(
        struct inode            *inode,
-       char                    *name,
-       char                    __user *ubuf,
+       unsigned char           *name,
+       unsigned char           __user *ubuf,
        __uint32_t              *len,
        __uint32_t              flags);
 
 extern int
-       xfs_attrmulti_attr_set(
+xfs_attrmulti_attr_set(
        struct inode            *inode,
-       char                    *name,
-       const char              __user *ubuf,
+       unsigned char           *name,
+       const unsigned char     __user *ubuf,
        __uint32_t              len,
        __uint32_t              flags);
 
 extern int
 xfs_attrmulti_attr_remove(
        struct inode            *inode,
-       char                    *name,
+       unsigned char           *name,
        __uint32_t              flags);
 
 extern struct dentry *
index be1527b1670ccbb36e2dc1c963133efa75975405..0bf6d61f0528510249fe0de99b5ec3053744b83f 100644 (file)
@@ -411,7 +411,7 @@ xfs_compat_attrmulti_by_handle(
        compat_xfs_fsop_attrmulti_handlereq_t   am_hreq;
        struct dentry                           *dentry;
        unsigned int                            i, size;
-       char                                    *attr_name;
+       unsigned char                           *attr_name;
 
        if (!capable(CAP_SYS_ADMIN))
                return -XFS_ERROR(EPERM);
@@ -440,7 +440,7 @@ xfs_compat_attrmulti_by_handle(
 
        error = 0;
        for (i = 0; i < am_hreq.opcount; i++) {
-               ops[i].am_error = strncpy_from_user(attr_name,
+               ops[i].am_error = strncpy_from_user((char *)attr_name,
                                compat_ptr(ops[i].am_attrname),
                                MAXNAMELEN);
                if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN)
index 225946012d0b3d2015e72a81d62a751ac0a1df84..e8566bbf0f00ffeb2154bee1b351cdcf402c4985 100644 (file)
@@ -140,10 +140,10 @@ xfs_init_security(
        struct xfs_inode *ip = XFS_I(inode);
        size_t          length;
        void            *value;
-       char            *name;
+       unsigned char   *name;
        int             error;
 
-       error = security_inode_init_security(inode, dir, &name,
+       error = security_inode_init_security(inode, dir, (char **)&name,
                                             &value, &length);
        if (error) {
                if (error == -EOPNOTSUPP)
index 0b1878857fc3cb56ca31e7dbe27a901a2243dfce..fa01b9daba6b0b66ad12450d185840da66374b69 100644 (file)
@@ -45,7 +45,7 @@ xfs_xattr_get(struct dentry *dentry, const char *name,
                value = NULL;
        }
 
-       error = -xfs_attr_get(ip, name, value, &asize, xflags);
+       error = -xfs_attr_get(ip, (unsigned char *)name, value, &asize, xflags);
        if (error)
                return error;
        return asize;
@@ -67,8 +67,9 @@ xfs_xattr_set(struct dentry *dentry, const char *name, const void *value,
                xflags |= ATTR_REPLACE;
 
        if (!value)
-               return -xfs_attr_remove(ip, name, xflags);
-       return -xfs_attr_set(ip, name, (void *)value, size, xflags);
+               return -xfs_attr_remove(ip, (unsigned char *)name, xflags);
+       return -xfs_attr_set(ip, (unsigned char *)name,
+                               (void *)value, size, xflags);
 }
 
 static struct xattr_handler xfs_xattr_user_handler = {
@@ -124,8 +125,13 @@ static const char *xfs_xattr_prefix(int flags)
 }
 
 static int
-xfs_xattr_put_listent(struct xfs_attr_list_context *context, int flags,
-               char *name, int namelen, int valuelen, char *value)
+xfs_xattr_put_listent(
+       struct xfs_attr_list_context *context,
+       int             flags,
+       unsigned char   *name,
+       int             namelen,
+       int             valuelen,
+       unsigned char   *value)
 {
        unsigned int prefix_len = xfs_xattr_prefix_len(flags);
        char *offset;
@@ -148,7 +154,7 @@ xfs_xattr_put_listent(struct xfs_attr_list_context *context, int flags,
        offset = (char *)context->alist + context->count;
        strncpy(offset, xfs_xattr_prefix(flags), prefix_len);
        offset += prefix_len;
-       strncpy(offset, name, namelen);                 /* real name */
+       strncpy(offset, (char *)name, namelen);                 /* real name */
        offset += namelen;
        *offset = '\0';
        context->count += prefix_len + namelen + 1;
@@ -156,8 +162,13 @@ xfs_xattr_put_listent(struct xfs_attr_list_context *context, int flags,
 }
 
 static int
-xfs_xattr_put_listent_sizes(struct xfs_attr_list_context *context, int flags,
-               char *name, int namelen, int valuelen, char *value)
+xfs_xattr_put_listent_sizes(
+       struct xfs_attr_list_context *context,
+       int             flags,
+       unsigned char   *name,
+       int             namelen,
+       int             valuelen,
+       unsigned char   *value)
 {
        context->count += xfs_xattr_prefix_len(flags) + namelen + 1;
        return 0;
index 00fd357c3e46104aeb7349d69931b9c58d2fa8f9..d13eeba2c8f8a725821a145d8843eb4efa21a787 100644 (file)
@@ -36,8 +36,8 @@ struct xfs_acl {
 };
 
 /* On-disk XFS extended attribute names */
-#define SGI_ACL_FILE           "SGI_ACL_FILE"
-#define SGI_ACL_DEFAULT                "SGI_ACL_DEFAULT"
+#define SGI_ACL_FILE           (unsigned char *)"SGI_ACL_FILE"
+#define SGI_ACL_DEFAULT                (unsigned char *)"SGI_ACL_DEFAULT"
 #define SGI_ACL_FILE_SIZE      (sizeof(SGI_ACL_FILE)-1)
 #define SGI_ACL_DEFAULT_SIZE   (sizeof(SGI_ACL_DEFAULT)-1)
 
index 9d11ebad43b6c517d5a6a48a7d51c328b5008177..f7b426a1b6ee5c45be5d799964e8487313209877 100644 (file)
@@ -93,12 +93,12 @@ STATIC int xfs_attr_rmtval_remove(xfs_da_args_t *args);
 STATIC int
 xfs_attr_name_to_xname(
        struct xfs_name *xname,
-       const char      *aname)
+       const unsigned char *aname)
 {
        if (!aname)
                return EINVAL;
        xname->name = aname;
-       xname->len = strlen(aname);
+       xname->len = strlen((char *)aname);
        if (xname->len >= MAXNAMELEN)
                return EFAULT;          /* match IRIX behaviour */
 
@@ -124,7 +124,7 @@ STATIC int
 xfs_attr_get_int(
        struct xfs_inode        *ip,
        struct xfs_name         *name,
-       char                    *value,
+       unsigned char           *value,
        int                     *valuelenp,
        int                     flags)
 {
@@ -171,8 +171,8 @@ xfs_attr_get_int(
 int
 xfs_attr_get(
        xfs_inode_t     *ip,
-       const char      *name,
-       char            *value,
+       const unsigned char *name,
+       unsigned char   *value,
        int             *valuelenp,
        int             flags)
 {
@@ -235,8 +235,12 @@ xfs_attr_calc_size(
 }
 
 STATIC int
-xfs_attr_set_int(xfs_inode_t *dp, struct xfs_name *name,
-               char *value, int valuelen, int flags)
+xfs_attr_set_int(
+       struct xfs_inode *dp,
+       struct xfs_name *name,
+       unsigned char   *value,
+       int             valuelen,
+       int             flags)
 {
        xfs_da_args_t   args;
        xfs_fsblock_t   firstblock;
@@ -452,8 +456,8 @@ out:
 int
 xfs_attr_set(
        xfs_inode_t     *dp,
-       const char      *name,
-       char            *value,
+       const unsigned char *name,
+       unsigned char   *value,
        int             valuelen,
        int             flags)
 {
@@ -600,7 +604,7 @@ out:
 int
 xfs_attr_remove(
        xfs_inode_t     *dp,
-       const char      *name,
+       const unsigned char *name,
        int             flags)
 {
        int             error;
@@ -669,9 +673,13 @@ xfs_attr_list_int(xfs_attr_list_context_t *context)
  */
 /*ARGSUSED*/
 STATIC int
-xfs_attr_put_listent(xfs_attr_list_context_t *context, int flags,
-                    char *name, int namelen,
-                    int valuelen, char *value)
+xfs_attr_put_listent(
+       xfs_attr_list_context_t *context,
+       int             flags,
+       unsigned char   *name,
+       int             namelen,
+       int             valuelen,
+       unsigned char   *value)
 {
        struct attrlist *alist = (struct attrlist *)context->alist;
        attrlist_ent_t *aep;
@@ -1980,7 +1988,7 @@ xfs_attr_rmtval_get(xfs_da_args_t *args)
        xfs_bmbt_irec_t map[ATTR_RMTVALUE_MAPSIZE];
        xfs_mount_t *mp;
        xfs_daddr_t dblkno;
-       xfs_caddr_t dst;
+       void *dst;
        xfs_buf_t *bp;
        int nmap, error, tmp, valuelen, blkcnt, i;
        xfs_dablk_t lblkno;
@@ -2039,7 +2047,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
        xfs_inode_t *dp;
        xfs_bmbt_irec_t map;
        xfs_daddr_t dblkno;
-       xfs_caddr_t src;
+       void *src;
        xfs_buf_t *bp;
        xfs_dablk_t lblkno;
        int blkcnt, valuelen, nmap, error, tmp, committed;
index 9c3a243729140e7710c7af10320245eae110c04b..e920d68ef509548fc8c48e091ce42c57b5682d35 100644 (file)
@@ -113,7 +113,7 @@ typedef struct attrlist_cursor_kern {
 
 
 typedef int (*put_listent_func_t)(struct xfs_attr_list_context *, int,
-                                     char *, int, int, char *);
+                             unsigned char *, int, int, unsigned char *);
 
 typedef struct xfs_attr_list_context {
        struct xfs_inode                *dp;            /* inode */
index baf41b5af756fdd4da628b45f64ad805e913cba0..52519a201849dafa6640fed38272f2827125ab7b 100644 (file)
@@ -521,11 +521,11 @@ xfs_attr_shortform_to_leaf(xfs_da_args_t *args)
 
        sfe = &sf->list[0];
        for (i = 0; i < sf->hdr.count; i++) {
-               nargs.name = (char *)sfe->nameval;
+               nargs.name = sfe->nameval;
                nargs.namelen = sfe->namelen;
-               nargs.value = (char *)&sfe->nameval[nargs.namelen];
+               nargs.value = &sfe->nameval[nargs.namelen];
                nargs.valuelen = sfe->valuelen;
-               nargs.hashval = xfs_da_hashname((char *)sfe->nameval,
+               nargs.hashval = xfs_da_hashname(sfe->nameval,
                                                sfe->namelen);
                nargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(sfe->flags);
                error = xfs_attr_leaf_lookup_int(bp, &nargs); /* set a->index */
@@ -612,10 +612,10 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
                for (i = 0, sfe = &sf->list[0]; i < sf->hdr.count; i++) {
                        error = context->put_listent(context,
                                           sfe->flags,
-                                          (char *)sfe->nameval,
+                                          sfe->nameval,
                                           (int)sfe->namelen,
                                           (int)sfe->valuelen,
-                                          (char*)&sfe->nameval[sfe->namelen]);
+                                          &sfe->nameval[sfe->namelen]);
 
                        /*
                         * Either search callback finished early or
@@ -659,8 +659,8 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
                }
 
                sbp->entno = i;
-               sbp->hash = xfs_da_hashname((char *)sfe->nameval, sfe->namelen);
-               sbp->name = (char *)sfe->nameval;
+               sbp->hash = xfs_da_hashname(sfe->nameval, sfe->namelen);
+               sbp->name = sfe->nameval;
                sbp->namelen = sfe->namelen;
                /* These are bytes, and both on-disk, don't endian-flip */
                sbp->valuelen = sfe->valuelen;
@@ -818,9 +818,9 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff)
                        continue;
                ASSERT(entry->flags & XFS_ATTR_LOCAL);
                name_loc = xfs_attr_leaf_name_local(leaf, i);
-               nargs.name = (char *)name_loc->nameval;
+               nargs.name = name_loc->nameval;
                nargs.namelen = name_loc->namelen;
-               nargs.value = (char *)&name_loc->nameval[nargs.namelen];
+               nargs.value = &name_loc->nameval[nargs.namelen];
                nargs.valuelen = be16_to_cpu(name_loc->valuelen);
                nargs.hashval = be32_to_cpu(entry->hashval);
                nargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(entry->flags);
@@ -2370,10 +2370,10 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context)
 
                        retval = context->put_listent(context,
                                                entry->flags,
-                                               (char *)name_loc->nameval,
+                                               name_loc->nameval,
                                                (int)name_loc->namelen,
                                                be16_to_cpu(name_loc->valuelen),
-                                               (char *)&name_loc->nameval[name_loc->namelen]);
+                                               &name_loc->nameval[name_loc->namelen]);
                        if (retval)
                                return retval;
                } else {
@@ -2397,15 +2397,15 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context)
                                        return retval;
                                retval = context->put_listent(context,
                                                entry->flags,
-                                               (char *)name_rmt->name,
+                                               name_rmt->name,
                                                (int)name_rmt->namelen,
                                                valuelen,
-                                               (char*)args.value);
+                                               args.value);
                                kmem_free(args.value);
                        } else {
                                retval = context->put_listent(context,
                                                entry->flags,
-                                               (char *)name_rmt->name,
+                                               name_rmt->name,
                                                (int)name_rmt->namelen,
                                                valuelen,
                                                NULL);
index 76ab7b0cbb3adac0c0d7e42eac9c364e913e382b..919756e3ba53591a9132849a6dc7c57771f1aebb 100644 (file)
@@ -52,7 +52,7 @@ typedef struct xfs_attr_sf_sort {
        __uint8_t       valuelen;       /* length of value */
        __uint8_t       flags;          /* flags bits (see xfs_attr_leaf.h) */
        xfs_dahash_t    hash;           /* this entry's hash value */
-       char            *name;          /* name value, pointer into buffer */
+       unsigned char   *name;          /* name value, pointer into buffer */
 } xfs_attr_sf_sort_t;
 
 #define XFS_ATTR_SF_ENTSIZE_BYNAME(nlen,vlen)  /* space name/value uses */ \
index 167a467403a59f0c4327bb0a23cbb369e0e9d7af..774f40729ca13ea25e17a057a1b25606d7109ca0 100644 (file)
@@ -43,11 +43,11 @@ int xfs_change_file_space(struct xfs_inode *ip, int cmd,
 int xfs_rename(struct xfs_inode *src_dp, struct xfs_name *src_name,
                struct xfs_inode *src_ip, struct xfs_inode *target_dp,
                struct xfs_name *target_name, struct xfs_inode *target_ip);
-int xfs_attr_get(struct xfs_inode *ip, const char *name, char *value,
-               int *valuelenp, int flags);
-int xfs_attr_set(struct xfs_inode *dp, const char *name, char *value,
-               int valuelen, int flags);
-int xfs_attr_remove(struct xfs_inode *dp, const char *name, int flags);
+int xfs_attr_get(struct xfs_inode *ip, const unsigned char *name,
+               unsigned char *value, int *valuelenp, int flags);
+int xfs_attr_set(struct xfs_inode *dp, const unsigned char *name,
+               unsigned char *value, int valuelen, int flags);
+int xfs_attr_remove(struct xfs_inode *dp, const unsigned char *name, int flags);
 int xfs_attr_list(struct xfs_inode *dp, char *buffer, int bufsize,
                int flags, struct attrlist_cursor_kern *cursor);
 ssize_t xfs_read(struct xfs_inode *ip, struct kiocb *iocb,