mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Altaparmakov <aia21@cam.ac.uk>
To: David Chow <davidchow@rcn.com.hk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Important, Memory padding in kernel using 1byte
Date: Mon, 19 Nov 2001 11:32:38 +0000	[thread overview]
Message-ID: <5.1.0.14.2.20011119112724.0508e6b0@pop.cus.cam.ac.uk> (raw)
In-Reply-To: <1006160395.1198.0.camel@star9.planet.rcn.com.hk>

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/


      parent reply	other threads:[~2001-11-19 11:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-19  8:59 David Chow
2001-11-19  9:56 ` Alan Cox
2001-11-19 11:32 ` Anton Altaparmakov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5.1.0.14.2.20011119112724.0508e6b0@pop.cus.cam.ac.uk \
    --to=aia21@cam.ac.uk \
    --cc=davidchow@rcn.com.hk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®