From: "Gavin Lambert" <gavinl@compacsort.com>
To: "'David Woodhouse'" <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
Subject: RE: MTD pointer alignment
Date: Tue, 5 Dec 2006 10:11:32 +1300 [thread overview]
Message-ID: <038001c717e8$c9c98ff0$4800a8c0@gavinlpc> (raw)
In-Reply-To: <1165239426.5253.11.camel@pmac.infradead.org>
Quoth David Woodhouse [dwmw2@infradead.org]:
> That's news to me. If we don't always align to sizeof(int)
> and have appropriate (i.e. three bytes) padding after the
> initial 'char' field, then surely the 'int' fields are
> sometimes going to be misaligned?
>
> What platform is this? Precisely how is it padded/aligned?
The int fields do get their natural alignment (ie. three bytes padding
after the initial char). But that initial char (and the structure as a
whole) is not necessarily aligned on a four-byte boundary.
This is on Coldfire, using m68k-elf-gcc 3.4.4.
Test case for making it go wrong was embedding it in a structure similar
to this:
struct some_device
{
u8 a_byte_field;
struct mtd_info mtd;
struct device dev;
};
The compiler inserted one single byte of padding between the byte field
and the MTD structure, making the structure aligned on a 2-byte
boundary, not a 4-byte one.
However I've now looked at the latest MTD sources (in 2.6.18) and it
looks like this issue may be moot, since file->private_data is now
pointing at some other structure rather than pointing directly at the
mtd_info. I didn't check where you're keeping your OTP mode info now,
but as long as you're not hijacking bits then it shouldn't be a problem
:)
prev parent reply other threads:[~2006-12-04 21:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-29 0:09 MTD pointer alignment Gavin Lambert
2006-12-01 8:18 ` Artem Bityutskiy
2006-12-03 21:43 ` Gavin Lambert
2006-12-04 13:37 ` David Woodhouse
2006-12-04 21:11 ` Gavin Lambert [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='038001c717e8$c9c98ff0$4800a8c0@gavinlpc' \
--to=gavinl@compacsort.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.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