Message ID | 20051030064842.GA5933@gondor.apana.org.au |
---|---|
State | New, archived |
Headers | show |
Series |
|
Related | show |
On Sun, 30 Oct 2005, Herbert Xu wrote: > > Of course userspace won't see them since they're protected by > #ifdef __KERNEL__. > > Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> This won't work, I think. sparse basically always creates a _new_type_ for a bitwise typedef, so when you do typedef u16 __bitwise le16; typedef u16 __bitwise be16; ... your new "le16" will be _different_ from the old __le16, and you can't use it with "cpu_to_le16()" and other things. I think that typedef __le16 le16; should do what you want, but you should check. Linus - 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/
On Sun, Oct 30, 2005 at 11:36:46AM -0800, Linus Torvalds wrote: > > I think that > > typedef __le16 le16; > > should do what you want, but you should check. Good point. I've just checked and your suggestion definitely works. I've also changed the ifdef around __be64/__le64 so that they always exist in the kernel. So here it is again: [PATCH] Add be*/le* types without underscores I've seen a number of patches that have started to use the __le*/__be* types within the kernel. Nice as they are, the underscores are really a bit of an eye sore. Since there seems to be no name conflict within the kernel, why don't we use them without the underscores like just as we do with types like u32? Here is a patch to do just that. I've verified that there are no conflicts by grepping the current git tree and then building it with the patch. Of course userspace won't see them since they're protected by #ifdef __KERNEL__. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Thanks,
diff --git a/fs/ntfs/types.h b/fs/ntfs/types.h --- a/fs/ntfs/types.h +++ b/fs/ntfs/types.h @@ -25,9 +25,6 @@ #include <linux/types.h> -typedef __le16 le16; -typedef __le32 le32; -typedef __le64 le64; typedef __u16 __bitwise sle16; typedef __u32 __bitwise sle32; typedef __u64 __bitwise sle64; diff --git a/include/linux/types.h b/include/linux/types.h --- a/include/linux/types.h +++ b/include/linux/types.h @@ -171,6 +171,13 @@ typedef __u64 __bitwise __be64; #endif #ifdef __KERNEL__ +typedef u16 __bitwise le16; +typedef u16 __bitwise be16; +typedef u32 __bitwise le32; +typedef u32 __bitwise be32; +typedef u64 __bitwise le64; +typedef u64 __bitwise be64; + typedef unsigned __bitwise__ gfp_t; #endif
Hi: I've seen a number of patches that have started to use the __le*/__be* types within the kernel. Nice as they are, the underscores are really a bit of an eye sore. Since there seems to be no name conflict within the kernel, why don't we use them without the underscores like just as we do with types like u32? Here is a patch to do just that. I've verified that there are no conflicts by grepping the current git tree and then building it with the patch. Of course userspace won't see them since they're protected by #ifdef __KERNEL__. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Cheers,