public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 1/9] xfsprogs: fix sign warnings in libxfs
Date: Sun, 17 Jan 2010 07:10:53 -0500	[thread overview]
Message-ID: <20100117121053.GA21901@infradead.org> (raw)
In-Reply-To: <1263463752-5052-2-git-send-email-david@fromorbit.com>

On Thu, Jan 14, 2010 at 09:09:04PM +1100, Dave Chinner wrote:
> The directory naming is a mix of char and uchar_t and the compiler
> warns wheter they cross over. Cast the pointers according to the
> destination requirements as it doesn't seem to matter to avoid
> the warnings.

I think this makes sense, but it should really go into the kernel
code first - we currently paper over the warnings there by using
-funsigned-char for all XFS code which we might be able to remove
with those changes.

>  
>  struct xfs_name {
> -	const char	*name;
> +	const uchar_t	*name;
>  	int		len;

Maye use on of the standard types (unsigned char / u8 / uint8_t)
instead of the weird xfs-specific uchar_t, which in fact is already
gone in the kernel?

> @@ -1545,7 +1545,7 @@ xfs_attr_rmtval_get(xfs_da_args_t *args)
>  	ASSERT(!(args->flags & ATTR_KERNOVAL));
>  
>  	mp = args->dp->i_mount;
> -	dst = args->value;
> +	dst = (xfs_caddr_t)args->value;
>  	valuelen = args->valuelen;
>  	lblkno = args->rmtblkno;
>  	while (valuelen > 0) {
> @@ -1601,7 +1601,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
>  
>  	dp = args->dp;
>  	mp = dp->i_mount;
> -	src = args->value;
> +	src = (xfs_caddr_t)args->value;

If we make xfs_buf_iomove take a void * we can just pass on the
unsignedness in those two places.

> diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c
> index f8f926f..d535752 100644
> --- a/libxfs/xfs_attr_leaf.c
> +++ b/libxfs/xfs_attr_leaf.c
> @@ -476,11 +476,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 = (uchar_t *)sfe->nameval;
>  		nargs.namelen = sfe->namelen;
> -		nargs.value = (char *)&sfe->nameval[nargs.namelen];
> +		nargs.value = (uchar_t *)&sfe->nameval[nargs.namelen];
>  		nargs.valuelen = sfe->valuelen;
> -		nargs.hashval = xfs_da_hashname((char *)sfe->nameval,
> +		nargs.hashval = xfs_da_hashname((uchar_t *)sfe->nameval,
>  						sfe->namelen);

Both the leaf and sf nameval fields already are __u8/__uint8_t aka
unsigned char, so I can't see why can't see why any casts are needed
here and in the later hunks dealing with namevals.

> @@ -489,7 +489,7 @@ xfs_dir2_block_lookup(
>  	 * Fill in inode number, CI name if appropriate, release the block.
>  	 */
>  	args->inumber = be64_to_cpu(dep->inumber);
> -	error = xfs_dir_cilookup_result(args, dep->name, dep->namelen);
> +	error = xfs_dir_cilookup_result(args, (char *)dep->name, dep->namelen);

xfs_dir_cilookup_result always gets unsigned char names now, so I'd move
the conversion into it.

>  	xfs_da_brelse(args->trans, bp);
>  	return XFS_ERROR(error);
>  }
> @@ -576,7 +576,7 @@ xfs_dir2_block_lookup_int(
>  		 * and buffer. If it's the first case-insensitive match, store
>  		 * the index and buffer and continue looking for an exact match.
>  		 */
> -		cmp = mp->m_dirnameops->compname(args, dep->name, dep->namelen);
> +		cmp = mp->m_dirnameops->compname(args, (char *)dep->name, dep->namelen);

Also here, ->compname appears to always get unsigned names.

> -		if (xfs_da_compname(args, sfep->name, sfep->namelen) ==
> +		if (xfs_da_compname(args, (char *)sfep->name, sfep->namelen) ==
>  								XFS_CMP_EXACT) {
>  			ASSERT(xfs_dir2_sf_get_inumber(sfp,
>  						xfs_dir2_sf_inumberp(sfep)) ==
> @@ -928,8 +929,8 @@ xfs_dir2_sf_replace(
>  		for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp);
>  				i < sfp->hdr.count;
>  				i++, sfep = xfs_dir2_sf_nextentry(sfp, sfep)) {
> -			if (xfs_da_compname(args, sfep->name, sfep->namelen) ==
> -								XFS_CMP_EXACT) {
> +			if (xfs_da_compname(args, (char *)sfep->name,
> +					sfep->namelen) == XFS_CMP_EXACT) {

Same seems to apply for direct calls to xfs_da_compname.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2010-01-17 12:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-14 10:09 [PATCH 0/9] xfsprogs: fix build warnings V2 Dave Chinner
2010-01-14 10:09 ` [PATCH 1/9] xfsprogs: fix sign warnings in libxfs Dave Chinner
2010-01-17 12:10   ` Christoph Hellwig [this message]
2010-01-14 10:09 ` [PATCH 2/9] xfsprogs: Fix miscellaneous " Dave Chinner
2010-01-17 11:53   ` Christoph Hellwig
2010-01-14 10:09 ` [PATCH 3/9] xfsprogs: fix missing error check in xfs_rtfree_range " Dave Chinner
2010-01-17 11:52   ` Christoph Hellwig
2010-01-14 10:09 ` [PATCH 4/9] xfsprogs: fix warning in adfs superblock probe Dave Chinner
2010-01-17 12:11   ` Christoph Hellwig
2010-01-14 10:09 ` [PATCH 5/9] xfsprogs: fix some trivial warnings in xfs_db Dave Chinner
2010-01-17 12:12   ` Christoph Hellwig
2010-01-14 10:09 ` [PATCH 6/9] xfsprogs: fix trivial warnings in xfs_fsr Dave Chinner
2010-01-17 11:51   ` Christoph Hellwig
2010-01-14 10:09 ` [PATCH 7/9] xfsprogs: fix print format warnings in xfs_io Dave Chinner
2010-01-17 11:51   ` Christoph Hellwig
2010-01-14 10:09 ` [PATCH 8/9] xfsprogs: fix sign warning in mkfs directory code Dave Chinner
2010-01-17 12:13   ` Christoph Hellwig
2010-01-14 10:09 ` [PATCH 9/9] xfsprogs: fix build warnings in repair Dave Chinner
2010-01-15  7:09   ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100117121053.GA21901@infradead.org \
    --to=hch@infradead.org \
    --cc=david@fromorbit.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox