[Ksummit-discuss] [TECH TOPIC] How to encourage driver authors to annotate integer endianness properly

David Woodhouse dwmw2 at infradead.org
Wed Oct 25 13:11:48 UTC 2017


On Wed, 2017-10-25 at 14:40 +0200, Alexey Dobriyan wrote:
> On 10/25/17, Bart Van Assche <Bart.VanAssche at wdc.com> wrote:
> > 
> > I think we need a way to encourage driver authors
> > to pay attention to endianness annotations,
> typedef struct {
>         uint32_t _;
> } __le32;

I actually did that in JFFS2 years ago; before sparse could do it. It
was very useful.

I'd really like to have proper compiler support for big-endian and
little-endian integers too. We're half-way there now with
__builtin_bswap32() et al, and compilers can optimise things properly
(instead of the opaque inline asm we had before I cleaned that up).

But being able to just mark a given integer storage as big- or little-
endian and have all loads and stores *automatically* do the right thing
would be extremely useful in many cases.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4938 bytes
Desc: not available
URL: <http://lists.linuxfoundation.org/pipermail/ksummit-discuss/attachments/20171025/fcd1ed53/attachment.bin>


More information about the Ksummit-discuss mailing list