Re: Should I be concerned about the XATTR_SHOWCOMPRESSION option?
Re: Should I be concerned about the XATTR_SHOWCOMPRESSION option?
- Subject: Re: Should I be concerned about the XATTR_SHOWCOMPRESSION option?
- From: Chris Suter <email@hidden>
- Date: Thu, 23 Feb 2012 22:27:40 +1100
Hi James,
On Wed, Feb 22, 2012 at 10:16 AM, James Bucanek <email@hidden> wrote:
> This question is in the context of a backup application, so I'm concerned
> with backing up and restoring extended attributes on a filesystem.
>
> Should I be concerned with the XATTR_SHOWCOMPRESSION option to the
> listxattrs() and getxattr() functions?
Yes. They are used for compressed files. Compressed files in HFS+ use
an extended attribute to store some basic information, and if they are
small enough, they contain the actual compressed data. If they are
larger, the actual compressed data is stored in the resource fork.
If you pretend compressed files don't exist your backups and restores
will be uncompressed, although it will work fine otherwise.
To correctly handle compressed files, you basically need to use
XATTR_SHOWCOMPRESSION to copy the resource fork and the extended
attribute, and then you must set the UF_COMPRESSED flag as the last
thing you do.
I did see some draft documentation from DTS about it. I don't know
whether it got published, but you could try contacting them if you get
stuck.
I don't know why your program isn't working; I didn't look at it in
detail. Most of your system files will be compressed (/bin/bash is one
example). You can easily see whether a file is compressed from the
command line by typing:
stat -f %Xf <path-of-file>
If bit 0x20 is set, it's compressed.
I believe copyfile will correctly copy files with compression and
that's open source so have a look at the code and there is, of course,
the kernel code. You might even consider using copyfile but beware of
bugs—I know it had some in the past but they might have been fixed by
now.
Kind regards,
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden