Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.
On Wednesday 17 June 2009 07:55:24 Nick Liebmann wrote: > Hi Philip, > > Just a little follow-up on this, with some additional ideas. > > It strikes me that the new put/get unaligned macros defined in > unaligned.h, may not be preserving the endianness of the data being > copied. The equivalent calls in kernelspace, do not use a memcpy or > similar, they use byte access, and bit shifting. I could not find any > userland equivalents however, that always 'do the right thing' based on > the platform. > The macros/inline functions in the kernel are ways more complex. * They know the endianess of the box any ways, therefore they can base they can base the decision which macro to expand on that fact. * Although very hard to read, their stuff never takes the address of a value. i.e. will get completely optimised away by the compiler. What I created for drbdsetup is endian agnostic, but takes the address of the value. -> will not be optimised that nicely. > > Another issue that I wondered about is that if DRBD is sending this data > across the wire (peer to peer), it may be communicating between machines > of different architectures (big-endian <-> little-endian), such that > DRBD should 'standardize' on the endianess of these data structures, to > enable this. That is in the code since the early beginning. DRBD uses big endian (the network byte order) in all its packets. -Phil -- : Dipl-Ing Philipp Reisner : LINBIT | Your Way to High Availability : Tel: +43-1-8178292-50, Fax: +43-1-8178292-82 : http://www.linbit.com DRBD(R) and LINBIT(R) are registered trademarks of LINBIT, Austria.