xfs: clean up pointer sign differences
cover xfs: clean up pointer sign differences
This patch series cleans up all the pointer sign warnings when they are turned back on in the XFS build. These are the kernel equivalents of the libxfs changes I posted a last week. On Christoph's suggestion, I've made the changes for the kernel code so that we can fix the libxfs warnings simply by resyncing the userspce code with the kernel code.
Hence this makes all of the directory and attribute names and values unsigned chars and uses that consistently within XFS. The on disk formats are all unsigned, but the VFS is a mix of signed and unsigned interfaces.
The series converts all the names and values at the highest level to unsigned so the rest of the code doesn't need to juggle different signedness. It cleans up all the places where we have cast pointers, makes all functions take unsigned strings and so on.
Finally, it turns on the pointer sign warnings again (which are actually turned off globally in the build) so that we don't reintroduce new problems due to a lack of warnings being produced by the compiler.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/8 xfs: directory names are unsigned
Convert the struct xfs_name to use unsigned chars for the name strings to match both what is stored on disk (__uint8_t) and what the VFS expects (unsigned char).
--- fs/xfs/xfs_types.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/xfs/xfs_types.h +2 -2
@@ -151,8 +151,8 @@ typedef enum { } xfs_btnum_t;struct xfs_name { -const char *name; -int len; +const unsigned char *name; +int len; };#endif /* __XFS_TYPES_H__ */
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 1/8] xfs: directory names are unsigned
Quoted 3 lines · Dave Chinner
Convert the struct
xfs_nameto use unsigned chars for the name strings to match both what is stored on disk (__uint8_t) and what the VFS expects (unsigned char).
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/8 xfs: convert DM ops to use unsigned char names
In reply to Dave Chinnerdmops uses a signed char for it's namespace event. To be consistent with the rest of the code, convert them to unsigned char for the namespace string.
--- fs/xfs/xfs_mount.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
fs/xfs/xfs_mount.h +2 -1
@@ -78,7 +78,8 @@ typedef int (*xfs_send_destroy_t)(struct xfs_inode *, dm_right_t);typedef int (*xfs_send_namesp_t )(dm_eventtype_t ,struct xfs_mount *,struct xfs_inode *,dm_right_t ,struct xfs_inode *,dm_right_t , -const char *,const char *,mode_t ,int ,int ); +const unsigned char *,const unsigned char *, +mode_t ,int ,int );typedef int (*xfs_send_mount_t )(struct xfs_mount *,dm_right_t ,char *,char *); typedef void (*xfs_send_unmount_t)(struct xfs_mount *, struct xfs_inode *,
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 2/8] xfs: convert DM ops to use unsigned char names
Quoted 3 lines · Dave Chinner
dmops uses a signed char for it's namespace event. To be consistent with the rest of the code, convert them to unsigned char for the namespace string.
Looks good,
possibly we should just get rid of the dm hooks now that they've been dead for years..
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/8 xfs: convert dirnameops to unsigned char names
In reply to Dave ChinnerTo be consistent across the codebase, convert the dirnameops to pass the directory names by unsigned char strings.
--- fs/xfs/xfs_da_btree.c | 4 ++-- fs/xfs/xfs_da_btree.h | 5 +++-- fs/xfs/xfs_dir2.c | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-)
fs/xfs/xfs_da_btree.c +2 -2
@@ -1534,8 +1534,8 @@ xfs_da_hashname(const __uint8_t *name, int namelen)enum xfs_dacmp xfs_da_compname (struct xfs_da_args *args, -const char *name, -int len) +const unsigned char *name, +int len) {return (args->namelen == len &&memcmp (args->name, name, len) ==0 ) ?XFS_CMP_EXACT :XFS_CMP_DIFFERENT ;
fs/xfs/xfs_da_btree.h +3 -2
@@ -209,7 +209,8 @@ typedef struct xfs_da_state {*/ struct xfs_nameops {xfs_dahash_t (*hashname)(struct xfs_name *); -enum xfs_dacmp (*compname)(struct xfs_da_args *,const char *,int ); +enum xfs_dacmp (*compname)(struct xfs_da_args *, +const unsigned char *,int ); };
@@ -260,7 +261,7 @@ int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,uint xfs_da_hashname (const __uint8_t *name_string,int name_length);enum xfs_dacmp xfs_da_compname (struct xfs_da_args *args, -const char *name,int len); +const unsigned char *name,int len);xfs_da_state_t *xfs_da_state_alloc (void );
fs/xfs/xfs_dir2.c +2 -2
@@ -66,8 +66,8 @@ xfs_ascii_ci_hashname( STATIC enum xfs_dacmpxfs_ascii_ci_compname (struct xfs_da_args *args, -const char *name, -int len) +const unsigned char *name, +int len) {enum xfs_dacmp result;int i;
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 3/8] xfs: convert dirnameops to unsigned char names
Quoted 4 lines · Dave Chinner
To be consistent across the codebase, convert the dirnameops to pass the directory names by unsigned char strings.
Signed-off-by Dave Chinner <[email protected]>
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 4/8 xfs: make xfs_dir_cilookup_result use unsigned char
In reply to Dave ChinnerFor consistency with the result of the code.
--- fs/xfs/xfs_dir2.c | 2 +- fs/xfs/xfs_dir2.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
fs/xfs/xfs_dir2.c +1 -1
@@ -247,7 +247,7 @@ xfs_dir_createname(int xfs_dir_cilookup_result (struct xfs_da_args *args, -const char *name, +const unsigned char *name,int len) {if (args->cmpresult ==XFS_CMP_DIFFERENT )
fs/xfs/xfs_dir2.h +2 -2
@@ -100,7 +100,7 @@ extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp,extern int xfs_dir2_shrink_inode (struct xfs_da_args *args,xfs_dir2_db_t db,struct xfs_dabuf *bp); -extern int xfs_dir_cilookup_result (struct xfs_da_args *args,const char *name, -int len); +extern int xfs_dir_cilookup_result (struct xfs_da_args *args, +const unsigned char *name,int len);#endif /* __XFS_DIR2_H__ */
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 4/8] xfs: make xfs_dir_cilookup_result use unsigned char
Quoted 13 lines · Dave Chinner
For consistency with the result of the code.
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/xfs_dir2.c | 2 +- fs/xfs/xfs_dir2.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)fs/xfs/xfs_dir2.c +0
-0
fs/xfs/xfs_dir2.c xfs_dir_createname( · line 252
Quoted 7 lines
fs/xfs/xfs_dir2.c +1
-1@@ -247,7 +247,7 @@ xfs_dir_createname(int xfs_dir_cilookup_result (struct xfs_da_args *args, -const char *name, +const unsigned char *name,int len) {
Given that the value we copy things into is unsigned anyway this looks correct,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 5/8 xfs: xfs_buf_iomove() doesn't care about signedness
In reply to Dave Chinnerxfs_buf_iomove() uses xfs_caddr_t as it's parameter types, but it doesn't care about the signedness of the variables as it is just copying the data. Change the prototype to use void * so that we don't get sign warnings at call sites.
--- fs/xfs/linux-2.6/xfs_buf.c | 2 +- fs/xfs/linux-2.6/xfs_buf.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/xfs/linux-2.6/xfs_buf.c +1 -1
@@ -1443,7 +1443,7 @@ xfs_buf_iomove(xfs_buf_t *bp,/* buffer to process */ size_t boff, /* starting buffer offset */ size_t bsize, /* length to copy */ - caddr_t data, /* data address */ + void *data, /* data address */ xfs_buf_rw_t mode) /* read/write/zero flag */ { size_t bend, cpoff, csize;
fs/xfs/linux-2.6/xfs_buf.h +1 -1
@@ -243,7 +243,7 @@ extern void xfs_buf_ioend(xfs_buf_t *, int);extern void xfs_buf_ioerror (xfs_buf_t *,int );extern int xfs_buf_iorequest (xfs_buf_t *);extern int xfs_buf_iowait (xfs_buf_t *); -extern void xfs_buf_iomove (xfs_buf_t *,size_t ,size_t ,xfs_caddr_t , +extern void xfs_buf_iomove (xfs_buf_t *,size_t ,size_t ,void *,xfs_buf_rw_t );static inline int xfs_buf_iostrategy (xfs_buf_t *bp)
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 5/8] xfs: xfs_buf_iomove() doesn't care about signedness
Quoted 4 lines · Dave Chinner
xfs_buf_iomove()usesxfs_caddr_tas it's parameter types, but it doesn't care about the signedness of the variables as it is just copying the data. Change the prototype to use void * so that we don't get sign warnings at call sites.
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 6/8 xfs: convert attr to use unsigned names
In reply to Dave ChinnerTo 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.
--- fs/xfs/linux-2.6/xfs_acl.c | 11 ++++++----- fs/xfs/linux-2.6/xfs_ioctl.c | 18 +++++++++--------- fs/xfs/linux-2.6/xfs_ioctl.h | 12 ++++++------ fs/xfs/linux-2.6/xfs_ioctl32.c | 4 ++-- fs/xfs/linux-2.6/xfs_iops.c | 4 ++-- fs/xfs/linux-2.6/xfs_xattr.c | 27 +++++++++++++++++++-------- fs/xfs/xfs_acl.h | 4 ++-- fs/xfs/xfs_attr.c | 38 +++++++++++++++++++++++--------------- fs/xfs/xfs_attr.h | 2 +- fs/xfs/xfs_attr_leaf.c | 28 ++++++++++++++-------------- fs/xfs/xfs_attr_sf.h | 2 +- fs/xfs/xfs_vnodeops.h | 10 +++++----- 12 files changed, 90 insertions(+), 70 deletions(-)
fs/xfs/linux-2.6/xfs_acl.c +6 -5
@@ -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 );
fs/xfs/linux-2.6/xfs_ioctl.c +9 -9
@@ -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 ;
fs/xfs/linux-2.6/xfs_ioctl.h +6 -6
@@ -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 *
fs/xfs/linux-2.6/xfs_ioctl32.c +2 -2
@@ -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 )
fs/xfs/linux-2.6/xfs_iops.c +2 -2
@@ -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 )
fs/xfs/linux-2.6/xfs_xattr.c +19 -8
@@ -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 ;
fs/xfs/xfs_acl.h +2 -2
@@ -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)
fs/xfs/xfs_attr.c +23 -15
@@ -93,12 +93,12 @@ STATIC int xfs_attr_rmtval_remove(xfs_da_args_t *args); STATIC intxfs_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 intxfs_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;
fs/xfs/xfs_attr.h +1 -1
@@ -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 */
fs/xfs/xfs_attr_leaf.c +14 -14
@@ -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 );
fs/xfs/xfs_attr_sf.h +1 -1
@@ -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 */ \
fs/xfs/xfs_vnodeops.h +5 -5
@@ -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,
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 6/8] xfs: convert attr to use unsigned names
fs/xfs/linux-2.6/xfs_acl.c
Quoted 22 lines · Dave Chinner
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 <[email protected]>--- fs/xfs/linux-2.6/xfs_acl.c | 11 ++++++----- fs/xfs/linux-2.6/xfs_ioctl.c | 18 +++++++++--------- fs/xfs/linux-2.6/xfs_ioctl.h | 12 ++++++------ fs/xfs/linux-2.6/xfs_ioctl32.c | 4 ++-- fs/xfs/linux-2.6/xfs_iops.c | 4 ++-- fs/xfs/linux-2.6/xfs_xattr.c | 27 +++++++++++++++++++-------- fs/xfs/xfs_acl.h | 4 ++-- fs/xfs/xfs_attr.c | 38 +++++++++++++++++++++++--------------- fs/xfs/xfs_attr.h | 2 +- fs/xfs/xfs_attr_leaf.c | 28 ++++++++++++++-------------- fs/xfs/xfs_attr_sf.h | 2 +- fs/xfs/xfs_vnodeops.h | 10 +++++----- 12 files changed, 90 insertions(+), 70 deletions(-)fs/xfs/linux-2.6/xfs_acl.c +0
-0
It's a bit unfortunate that the highlevel xattr code gets char froms the VFS, but better convert them at the highest level and keep the lower ones clean, so:
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 7/8 xfs: clean up sign warnings in dir2 code
In reply to Dave ChinnerWe are now consistently using unsigned char strings for names so fix up the remaining warnings in the dir2 code to complete the cleanup.
--- fs/xfs/xfs_dir2.c | 2 +- fs/xfs/xfs_dir2_block.c | 9 +++++---- fs/xfs/xfs_dir2_leaf.c | 2 +- fs/xfs/xfs_dir2_sf.c | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-)
fs/xfs/xfs_dir2.c +1 -1
@@ -44,7 +44,7 @@#include "xfs_vnodeops.h" #include "xfs_trace.h" -struct xfs_name xfs_name_dotdot = {".." ,2 }; +struct xfs_name xfs_name_dotdot = { (unsigned char *)".." ,2 };/* * ASCII case-insensitive (ie. A-Z) support for directories that was
fs/xfs/xfs_dir2_block.c +5 -4
@@ -57,8 +57,8 @@ static xfs_dahash_t xfs_dir_hash_dot, xfs_dir_hash_dotdot;void xfs_dir_startup (void ) { - xfs_dir_hash_dot =xfs_da_hashname ("." ,1 ); - xfs_dir_hash_dotdot =xfs_da_hashname (".." ,2 ); + xfs_dir_hash_dot =xfs_da_hashname ((unsigned char *)"." ,1 ); + xfs_dir_hash_dotdot =xfs_da_hashname ((unsigned char *)".." ,2 ); }/*
@@ -513,8 +513,9 @@ xfs_dir2_block_getdents(/* * If it didn't fit, set the final offset to here & return. */ -if (filldir (dirent, dep->name, dep->namelen, cook &0x7fffffff , -be64_to_cpu (dep->inumber),DT_UNKNOWN )) { +if (filldir (dirent, (char *)dep->name, dep->namelen, + cook &0x7fffffff ,be64_to_cpu (dep->inumber), +DT_UNKNOWN )) { *offset = cook &0x7fffffff ;xfs_da_brelse (NULL , bp);return 0 ;
fs/xfs/xfs_dir2_leaf.c +1 -1
@@ -1081,7 +1081,7 @@ xfs_dir2_leaf_getdents( dep = (xfs_dir2_data_entry_t *)ptr; length =xfs_dir2_data_entsize (dep->namelen); -if (filldir (dirent, dep->name, dep->namelen, +if (filldir (dirent, (char *)dep->name, dep->namelen,xfs_dir2_byte_to_dataptr (mp, curoff) &0x7fffffff ,be64_to_cpu (dep->inumber),DT_UNKNOWN ))break ;
fs/xfs/xfs_dir2_sf.c +1 -1
@@ -782,7 +782,7 @@ xfs_dir2_sf_getdents( } ino =xfs_dir2_sf_get_inumber (sfp,xfs_dir2_sf_inumberp (sfep)); -if (filldir (dirent, sfep->name, sfep->namelen, +if (filldir (dirent, (char *)sfep->name, sfep->namelen, off &0x7fffffff , ino,DT_UNKNOWN )) { *offset = off &0x7fffffff ;return 0 ;
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 7/8] xfs: clean up sign warnings in dir2 code
Quoted 3 lines · Dave Chinner
We are now consistently using unsigned char strings for names so fix up the remaining warnings in the dir2 code to complete the cleanup.
The cast in the initializers looks a bit ugly, but I don't know a better way either.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 8/8 xfs: make compile warn about char sign mismatches again
In reply to Dave ChinnerThe -fno-unsigned-char directive has no effect anymore as the XFs build is clean. However, the kernel build hides pointer sign differences so turn that back on so that we can clean up all the mismatches prior to a userspace code resync.
--- fs/xfs/Makefile | 2 +- fs/xfs/xfs_vnodeops.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-)
fs/xfs/Makefile +1 -1
@@ -16,7 +16,7 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -EXTRA_CFLAGS += -I$(src) -I$(src)/linux-2.6 -funsigned-char +EXTRA_CFLAGS += -I$(src) -I$(src)/linux-2.6 -Wpointer-sign XFS_LINUX := linux-2.6
fs/xfs/xfs_vnodeops.c +4 -2
@@ -2199,7 +2199,8 @@ xfs_symlink(if (DM_EVENT_ENABLED (dp,DM_EVENT_SYMLINK )) { error =XFS_SEND_NAMESP (mp,DM_EVENT_SYMLINK , dp,DM_RIGHT_NULL ,NULL ,DM_RIGHT_NULL , - link_name->name, target_path,0 ,0 ,0 ); + link_name->name, + (unsigned char *)target_path,0 ,0 ,0 );if (error)return error; }
@@ -2395,7 +2396,8 @@ std_return: dp,DM_RIGHT_NULL , error ?NULL : ip,DM_RIGHT_NULL , link_name->name, - target_path, 0, error, 0); + (unsigned char *)target_path, + 0, error, 0); }if (!error)
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 8/8] xfs: make compile warn about char sign mismatches again
Quoted 4 lines · Dave Chinner
The -fno-unsigned-char directive has no effect anymore as the XFs build is clean. However, the kernel build hides pointer sign differences so turn that back on so that we can clean up all the mismatches prior to a userspace code resync.
Not so happy about turning the warning on so we have local compiler warning differences from the rest of the kernel again, but it's not that bad, so
Quoted 14 lines
index 6f26875..9f7c001 100644
fs/xfs/xfs_vnodeops.c +2
-1@@ -2199,7 +2199,8 @@ xfs_symlink(if (DM_EVENT_ENABLED (dp,DM_EVENT_SYMLINK )) { error =XFS_SEND_NAMESP (mp,DM_EVENT_SYMLINK , dp,DM_RIGHT_NULL ,NULL ,DM_RIGHT_NULL , - link_name->name, target_path,0 ,0 ,0 ); + link_name->name, + (unsigned char *)target_path,0 ,0 ,0 );if (error)return error; }
fs/xfs/xfs_vnodeops.c std_return: · line 2400
Quoted 6 lines
fs/xfs/xfs_vnodeops.c +2
-1@@ -2395,7 +2396,8 @@ std_return: dp,DM_RIGHT_NULL , error ?NULL : ip,DM_RIGHT_NULL , link_name->name, - target_path, 0, error, 0); + (unsigned char *)target_path, + 0, error, 0);
These changes are nowhere mentioned in the changelog. And they probably belong into the patch changing the dmapi events to take unsigned chars.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 8/8] xfs: make compile warn about char sign mismatches again
Quoted 28 lines · Christoph Hellwig
Quoted 4 lines · Dave Chinner
The -fno-unsigned-char directive has no effect anymore as the XFs build is clean. However, the kernel build hides pointer sign differences so turn that back on so that we can clean up all the mismatches prior to a userspace code resync.
Not so happy about turning the warning on so we have local compiler warning differences from the rest of the kernel again, but it's not that bad, so
Reviewed-by Christoph Hellwig <[email protected]>Quoted 15 lines
index 6f26875..9f7c001 100644
fs/xfs/xfs_vnodeops.c +2
-1@@ -2199,7 +2199,8 @@ xfs_symlink(if (DM_EVENT_ENABLED (dp,DM_EVENT_SYMLINK )) { error =XFS_SEND_NAMESP (mp,DM_EVENT_SYMLINK , dp,DM_RIGHT_NULL ,NULL ,DM_RIGHT_NULL , - link_name->name, target_path,0 ,0 ,0 ); + link_name->name, + (unsigned char *)target_path,0 ,0 ,0 );if (error)return error; }@@ -2395,7 +2396,8 @@ std_return: dp, DM_RIGHT_NULL,
Quoted 8 lines
fs/xfs/xfs_vnodeops.c std_return: · line 2400
Quoted 5 lines
fs/xfs/xfs_vnodeops.c +2
-1error ?NULL : ip,DM_RIGHT_NULL , link_name->name, - target_path, 0, error, 0); + (unsigned char *)target_path, + 0, error, 0);These changes are nowhere mentioned in the changelog. And they probably belong into the patch changing the dmapi events to take unsigned chars.
I though I fixed that. Oh well, I'll fix it up again....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs