Purpose of using __be16 inside a data structure?

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

 



Hi all,

Please tell me the difference between using unsigned short and __be16
to declear a variable in a data structure.
For example, in include/net/inet_sock.h, struct inet_sock is decleared as

struct inet_sock {
        __be16                  inet_dport;
};

not

struct inet_sock {
        unsigned short                  inet_dport;
};

I think it has something to do with endianness. But I see that both
__le16 and __be16 are unsigned short when using gcc with -E option for
little-endian and big-endian platform. Can someone give me more
information?

* little-endian
typedef unsigned short __u16;
typedef __u16 __le16;
typedef __u16 __be16;

* big-endian
typedef unsigned short __u16;
typedef __u16 __le16;
typedef __u16 __be16;

Regards,
GC

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[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