Re: [patch-2.4.0-test2]Re: Linux-2.4.0-test2

From: Brandon S. Allbery KF8NH (allbery@kf8nh.apk.net)
Date: Sat Jun 24 2000 - 08:51:42 EST


On 06/24/00 19:24:49 +0100 Tigran Aivazian <tigran@veritas.com> wrote:
+-----
| > They should be fixed to use __attribute__((packed)). Also they
| shouldn't > have any unaligned struct members.
|
| are you 100% sure its needed? So all filesystems should use
| __attribute__((packed)) when they describe on-disk inode/superblock
| layout? none of the existing ones (except, partially, ncpfs) do.
+--->8

De facto, for most if not all Linux-supported architectures, if you put
larger members before smaller members, gcc won't add padding; also, if you
do something like

    u32 a;
    u16 b1;
    u16 b2;
    u32 c;

no padding will be added because b1 and b2 leave the structure aligned
properly.

You can continue to rely on this; or you can use __attribute__((packed))
and be certain that it will work correctly on any future architectures with
"unusual" alignment requirements. (Personally, I don't really expect to
see many of the latter --- but I'm no architecture guru, and for all I know
it may be the wave of the future.)

-- 
brandon s. allbery       os/2,linux,solaris,perl       allbery@kf8nh.apk.net
system administrator   kthkrb,heimdal,gnome,rt,cyrus    allbery@ece.cmu.edu
carnegie mellon / electrical and computer engineering                  kf8nh
    We are Linux. Resistance is an indication that you missed the point.

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



This archive was generated by hypermail 2b29 : Mon Jun 26 2000 - 21:00:04 EST