Hello David,
At 20:18 26/07/2001, hi...@de... wrote:
>I need to write a utility to read only the used clusters on an NTFS
>partition from linux. (Image Backup Utility) Your library looked like
>a great starting off point, unfortunatly, I can't get it to compile on
>any of my Linux Boxes. There is something very odd going on in the src
>with ATTR_REC and ATTR_RECORD that I don't understand, the end result
>being that I get errors during compile related to the structure not
>having certain members. The members are there, but they're nested
>inside another structure with no name. I admit, the meanings of
>__attribute__ and (__packed__) are lost one me. I tried to get earlier
>versions of the library to compile, but still no luck. I'd really
>apreciate it if someone would tell me the secret I need to compile these
>libraries. Btw, I'm not subscribed to the mailing list, so please send
>any responces to my e-mail address.
Your compiler is too old... You need gcc 2.96 to compile the code because
we use unnamed structures and unions, a very useful C extension introduced
with gcc 2.96. I have been told gcc 3.x works fine, too (and it should).
The __attribute__ (__packed__) means gcc cannot align the structure members
to anything. I.e. if we have a "char" followed by an "int", gcc normally
will leave 3 unused bytes between the "char" and "int" in order to have the
"int" aligned to 32-bits boundary. With the packed attribute gcc will never
do that and will happily create unaligned structure members. This is of
course necessary as the structures defined the NTFS on disk layout which
exactly as we define it, we can't have gcc moving around things or they
would be wrong...
HTH,
Anton
--
"Nothing succeeds like success." - Alexandre Dumas
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Linux NTFS Maintainer / WWW: http://linux-ntfs.sf.net/
ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/
|