>>>>> "Russell" == Russell King <- ARM Linux Admin <[EMAIL PROTECTED]>> writes:

 Russell> Nicholas Clark writes:
 >> prev = sizeof(struct NodeDescriptor);
 >> 
 >> which is 16. :-)

 Russell> Try adding __attribute__((packed)) to the structure.

 >> Or is the whole scheme used by hfs ANSIly flawed, and for true
 >> portability it can only use one contiguous char array, as
 >> structures can be padded between any members?

FWIW, ARM isn't the only platform that does this, though it's probably 
the only Linux-supporting one.  I tripped over this some years ago on
the Intel i960.

On "packed" -- a drawback of using that is that it forces GCC to make
worst case alignment assumptions (i.e., none at all) so everything
turns into strings of byte loads and shifts...  Sometimes you need to
tell the compiler not to use its favorite alignment, but that it's ok
to assume 2 byte alignment.  For example, if you have nothing smaller
than a 16 bit integer that might be useful.  If so, you can say:

        __attribute__((packed,aligned (2)))

Note that you need the "packed" to say "assume less than standard
alignment".  If you omit it then "aligned" will only *increase*
alignment, not decrease it as you'd want in this example.

        paul


unsubscribe: body of `unsubscribe linux-arm' to [EMAIL PROTECTED]
++        Please use [EMAIL PROTECTED] for           ++
++                        kernel-related discussions.                      ++

Reply via email to