Re: Important, Memory padding in kernel using 1byte

From: Anton Altaparmakov (aia21@cam.ac.uk)
Date: Mon Nov 19 2001 - 06:32:38 EST


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/

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



This archive was generated by hypermail 2b29 : Fri Nov 23 2001 - 21:00:19 EST