At 14:02 24/06/2000, Alan Cox wrote:
> > >To fix this, I followed (almost) the same technique as inodes_stat in
> > >fs/inode.c, i.e. gathered variables in a structure called files_stat.
> > >
> > >Tested under 2.3.99-pre10-3 (aka 2.4.0-test1)
> >
> > Now, tested under 2.4.0-test2.
>
>I havent submitted that to Linus. As someone pointed out the guarantee is
>not true for a struct either..
I thought there is a way of guaranteeing that members of a struct come
straight one after the other even if this means not aligning the data (if
alignment is set to higher than byte that is).
I am not familiar enough with gcc but with the visual c compiler you can
achieve this by issuing a pragma pack directive before declaration (not
before the definition - has no effect) of the structure and then a second
pragma pack to restore the old packing value. Usage is like this:
// Save old alignment value and set the new value to 1 byte alignment.
// This could of course be a higher alignment value...
#pragma pack(push, old_pack_val_1, 1)
// do the struct/union definition here
// Now restore the old alignment value.
#pragma pack(pop, old_pack_val_1)
Maybe this can be done in gcc, too? Possibly with a different syntax?
>If anything you need to use an array.
On the other hand, this might be the easier solution...
Just my 2p.
Anton
--"Education is what remains after one has forgotten everything he learned in school." - Albert Einstein
-- Anton Altaparmakov Voice: 01223-333541(lab) / 07712-632205(mobile) Christ's College eMail: AntonA@bigfoot.com Cambridge CB2 3BU ICQ: 8561279 United Kingdom WWW: http://www-stu.christs.cam.ac.uk/~aia21/
- 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