linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ocfs2: char is not always signed
@ 2010-11-18  4:20 Milton Miller
  2010-11-18  5:40 ` Tao Ma
  2010-11-18 23:43 ` Joel Becker
  0 siblings, 2 replies; 3+ messages in thread
From: Milton Miller @ 2010-11-18  4:20 UTC (permalink / raw)
  To: Tao Ma, Joel Becker, ocfs2-devel
  Cc: Mark Fasheh, linux-kernel, Goldwyn Rodrigues

Commit 1c66b360fe262 (Change some lock status member in ocfs2_lock_res
to char.)  states that these fields need to be signed due to comparision
to -1, but only changed the type from unsigned char to char.   However, it
is a compiler option if char is a signed or unsigned type.  Change these
fields to signed char so the code will work with all compilers.

Signed-off-by: Milton Miller <miltonm@bga.com>
---
I did not look for other fields that might be char.  PowerPC compilers
default to unsigned char, and aparently arm does as well from a quick
google search, to name two examples.

diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 1efea36..70dd3b1 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -159,9 +159,9 @@ struct ocfs2_lock_res {
 	char                     l_name[OCFS2_LOCK_ID_MAX_LEN];
 	unsigned int             l_ro_holders;
 	unsigned int             l_ex_holders;
-	char			 l_level;
-	char			 l_requested;
-	char			 l_blocking;
+	signed char		 l_level;
+	signed char		 l_requested;
+	signed char		 l_blocking;
 
 	/* Data packed - type enum ocfs2_lock_type */
 	unsigned char            l_type;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: ocfs2: char is not always signed
  2010-11-18  4:20 ocfs2: char is not always signed Milton Miller
@ 2010-11-18  5:40 ` Tao Ma
  2010-11-18 23:43 ` Joel Becker
  1 sibling, 0 replies; 3+ messages in thread
From: Tao Ma @ 2010-11-18  5:40 UTC (permalink / raw)
  To: Milton Miller
  Cc: Joel Becker, ocfs2-devel, Mark Fasheh, linux-kernel, Goldwyn Rodrigues



2010-11-18 12:20, Milton Miller wrote:
> Commit 1c66b360fe262 (Change some lock status member in ocfs2_lock_res
> to char.)  states that these fields need to be signed due to comparision
> to -1, but only changed the type from unsigned char to char.   However, it
> is a compiler option if char is a signed or unsigned type.  Change these
> fields to signed char so the code will work with all compilers.
>
> Signed-off-by: Milton Miller<miltonm@bga.com>
oh, sorry I don't know this. Thanks.
Acked-by: Tao Ma <tao.ma@oracle.com>
> ---
> I did not look for other fields that might be char.  PowerPC compilers
> default to unsigned char, and aparently arm does as well from a quick
> google search, to name two examples.
>
> diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
> index 1efea36..70dd3b1 100644
> --- a/fs/ocfs2/ocfs2.h
> +++ b/fs/ocfs2/ocfs2.h
> @@ -159,9 +159,9 @@ struct ocfs2_lock_res {
>   	char                     l_name[OCFS2_LOCK_ID_MAX_LEN];
>   	unsigned int             l_ro_holders;
>   	unsigned int             l_ex_holders;
> -	char			 l_level;
> -	char			 l_requested;
> -	char			 l_blocking;
> +	signed char		 l_level;
> +	signed char		 l_requested;
> +	signed char		 l_blocking;
>
>   	/* Data packed - type enum ocfs2_lock_type */
>   	unsigned char            l_type;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ocfs2: char is not always signed
  2010-11-18  4:20 ocfs2: char is not always signed Milton Miller
  2010-11-18  5:40 ` Tao Ma
@ 2010-11-18 23:43 ` Joel Becker
  1 sibling, 0 replies; 3+ messages in thread
From: Joel Becker @ 2010-11-18 23:43 UTC (permalink / raw)
  To: Milton Miller
  Cc: Tao Ma, ocfs2-devel, Mark Fasheh, linux-kernel, Goldwyn Rodrigues

On Wed, Nov 17, 2010 at 10:20:11PM -0600, Milton Miller wrote:
> Commit 1c66b360fe262 (Change some lock status member in ocfs2_lock_res
> to char.)  states that these fields need to be signed due to comparision
> to -1, but only changed the type from unsigned char to char.   However, it
> is a compiler option if char is a signed or unsigned type.  Change these
> fields to signed char so the code will work with all compilers.
> 
> Signed-off-by: Milton Miller <miltonm@bga.com>

	This patch is now in the fixes branch of ocfs2.git.

Joel

-- 

"This is the end, beautiful friend.
 This is the end, my only friend the end
 Of our elaborate plans, the end
 Of everything that stands, the end
 No safety or surprise, the end
 I'll never look into your eyes again."

Joel Becker
Senior Development Manager
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-18 23:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-18  4:20 ocfs2: char is not always signed Milton Miller
2010-11-18  5:40 ` Tao Ma
2010-11-18 23:43 ` Joel Becker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).