Re: [Patch 04/18] include/linux/logfs.h

From: Arnd Bergmann
Date: Wed Jun 06 2007 - 08:42:59 EST


On Wednesday 06 June 2007, David Woodhouse wrote:
> And if I had something like this (which is admittedly contrived, but
> hardware people _do_ do stupid things to us):
>    { uint32_t, uint8_t, uint16_t, uint8_t, uint32_t, uint32_t }
>
> With the 'packed' attribute the compiler would assume arbitrary
> alignment of all the 32-bit integers. But in reality it's only necessary
> for the uint16_t in the middle. A 'nopadding' attribute would deal with
> that correctly.

I would argue that a newly invented 'nopadding' attribute should reject
such a structure as invalid, because it should not let members be
unaligned. Unfortunately, this also gets tricky if you consider

struct {
uint32_t a;
uint64_t b;
uint32_t c;
};

which does have an unaligned member by default in i386, but not on
any modern platform.

Arnd <><
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/