mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Important, Memory padding in kernel using 1byte
@ 2001-11-19  8:59 David Chow
  2001-11-19  9:56 ` Alan Cox
  2001-11-19 11:32 ` Anton Altaparmakov
  0 siblings, 2 replies; 3+ messages in thread
From: David Chow @ 2001-11-19  8:59 UTC (permalink / raw)
  To: linux-kernel

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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Important, Memory padding in kernel using 1byte
  2001-11-19  8:59 Important, Memory padding in kernel using 1byte David Chow
@ 2001-11-19  9:56 ` Alan Cox
  2001-11-19 11:32 ` Anton Altaparmakov
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Cox @ 2001-11-19  9:56 UTC (permalink / raw)
  To: David Chow; +Cc: linux-kernel

> 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Important, Memory padding in kernel using 1byte
  2001-11-19  8:59 Important, Memory padding in kernel using 1byte David Chow
  2001-11-19  9:56 ` Alan Cox
@ 2001-11-19 11:32 ` Anton Altaparmakov
  1 sibling, 0 replies; 3+ messages in thread
From: Anton Altaparmakov @ 2001-11-19 11:32 UTC (permalink / raw)
  To: David Chow; +Cc: linux-kernel

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/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-11-19 11:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-19  8:59 Important, Memory padding in kernel using 1byte David Chow
2001-11-19  9:56 ` Alan Cox
2001-11-19 11:32 ` Anton Altaparmakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®