public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Ian Kent <raven@themaw.net>
Cc: Thomas Meyer <thomas@m3y3r.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	dhowells@redhat.com
Subject: Re: [PATCH] Force same size of struct autofs_v5_packet on x86 and x86_64
Date: Mon, 19 Sep 2011 07:10:59 +0100	[thread overview]
Message-ID: <20110919061059.GJ2203@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1316404368.3206.21.camel@perseus.themaw.net>

On Mon, Sep 19, 2011 at 11:52:48AM +0800, Ian Kent wrote:

> > btw. where are the padding bytes are added? how to tell gcc to display
> > this?
> 
> It's also been a long time since I looked into this so I don't remember
> the processor alignment details.
> 
> Not sure if there is a compiler option that would report this, sorry,
> anyone else?

Padding is added in the very end.  The thing is, it's not a misaligned
field per se; they all have a natural alignment in there.  It's that
__u64 ino has alignment 8 on amd64 and alignment 4 on i386.  So the alignment
requirements for the entire structure are different - on amd64 the address
of the entire thing must be a multiple of 8 and on i386 it can be any multiple
of 4.  IOW, on i386 you can just put them one after another in e.g. an array
(the size without any padding is 300 bytes) and on amd64 you need 4 bytes
of padding added between them.  I.e. sizeof needs to go up by 4, with the
padding added in the end.

  reply	other threads:[~2011-09-19  6:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-16 10:06 [PATCH] Force same size of struct autofs_v5_packet on x86 and x86_64 Thomas Meyer
2011-09-16 10:19 ` Al Viro
2011-09-16 10:38   ` Ian Kent
2011-09-18  8:01     ` Thomas Meyer
2011-09-19  3:52       ` Ian Kent
2011-09-19  6:10         ` Al Viro [this message]
2011-09-19  9:30           ` Thomas Meyer
2011-09-19 15:27             ` Al Viro
2011-09-20  3:07             ` Ian Kent

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=20110919061059.GJ2203@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raven@themaw.net \
    --cc=thomas@m3y3r.de \
    /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