Dear all
I notice using gcc compiling the kernel has the padding default set to
32-bit (4 bytes) on IA32's. This cause lots of trouble when doing file
system developments where a couple of data structures are not multiple
of 4 bytes. This cause lots of errors, I think this should be notified
to all developers when trying to deal with data structures not are
multiple of 4 bytes. Is it worth while to compile the kernel with the
padding set to 1 byte or will it cause any trouble? I know most of the
compiled programs or even modules are default to use the 32bit padding.
Please give advice.
regards,
David Chow
> 32-bit (4 bytes) on IA32's. This cause lots of trouble when doing file
> system developments where a couple of data structures are not multiple
> of 4 bytes. This cause lots of errors, I think this should be notified
Its up to the fs developer to handle such data structures. You should also
be aware that misaligned references may fault and crash the kernel in some
cases on non x86 platforms
At 08:59 19/11/01, David Chow wrote:
>I notice using gcc compiling the kernel has the padding default set to
>32-bit (4 bytes) on IA32's. This cause lots of trouble when doing file
>system developments where a couple of data structures are not multiple
>of 4 bytes. This cause lots of errors, I think this should be notified
>to all developers when trying to deal with data structures not are
>multiple of 4 bytes. Is it worth while to compile the kernel with the
>padding set to 1 byte or will it cause any trouble? I know most of the
>compiled programs or even modules are default to use the 32bit padding.
>Please give advice.
That's what __attribute__ ((__packed__)) is for. All places in the kernel
requiring that specific structure/union members are not padded should use
this to tell gcc so.
And there is __attribute__ ((aligned (size))); where size is the minimum
alignment.
Have a look at "info gcc" sometime under C extensions , "Type attributes"...
Anton
--
"I've not lost my mind. It's backed up on tape somewhere." - Unknown
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Linux NTFS Maintainer / WWW: http://linux-ntfs.sf.net/
ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/