Hi! On 08:41 Sun 14 Aug , ?????? wrote: > 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; > }; This is mostly to avoid confusion about where byte order conversation has to be done. When reading "unsigned short" you would normally expect the variable to contain host byte order. -Michi -- programing a layer 3+4 network protocol for mesh networks see http://michaelblizek.twilightparadox.com _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies