Re: u32 vs. __u32 (and what is __attribute__((bitwise) ?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/19/07, Shakthi Kannan <shakthimaan@xxxxxxxxx> wrote:
Hi,

On 1/19/07, Ramagudi Naziir <naziirr@xxxxxxxxx> wrote:
> Is there a difference between u32 to __u32 ?
> (I didn't see any in the source).

__u32 is usually used to refer to variables that interact with user-space.

/* 9 * __xx is ok: it doesn't pollute the POSIX namespace. Use these
in the 10 * header files exported to user space 11 */

http://lxr.linux.no/source/include/asm-i386/types.h#L20

> and what are __le16 and __be16 ?

unsigned short for little endian and big-endian formats.

In other words, use __le32 or __be32 if you care about the endianness
and it is the same on all platforms, for example if you are reading
filesystem blocks from disk.  This way you can make sure that you
didn't miss any le32_to_cpu() calls by checking with the sparse tool
(this is where bitwise comes in).

Otherwise, use u32 or __u32, the latter alone if exported to user space.

Bob

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux