[Box Backup-dev] Extended attributes on FreeBSD 5/6

Martin Ebourne boxbackup-dev@fluffy.co.uk
Tue, 14 Feb 2006 13:08:51 +0000


On Tue, 2006-02-14 at 09:08 +0000, James O'Gorman wrote:
> OK - just so I do understand, when you say ACLs are "supported on Linux
> due to their xattr based implementation", does that mean that on Linux
> if a file has an ACL, that will be backed up and restored as well? Quite
> nifty if so..

Yes. xattrs are just arbitrary metadata about files, stored in key=value
pairs, where key is ascii and value is anything.

Most systems with xattrs implement acls on top of them because it's a
perfect place to store the data without having yet another special kind
of metadata storage.

The good news is that FreeBSD also stores acls in xattr:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/fs-acl.html

> Here's the extattr manpages:
> http://www.freebsd.org/cgi/man.cgi?query=extattr&apropos=0&sektion=3&manpath=FreeBSD+6.0-RELEASE&format=html
> http://www.freebsd.org/cgi/man.cgi?query=extattr&apropos=0&sektion=9&manpath=FreeBSD+6.0-RELEASE&format=html

The bad news is that although the behaviour of these extattr calls is
broadly similar to the more common listattr/getattr API, they have one
major difference. Most systems use namespaces to partition xattrs, most
do it by prepending the namespace name and a dot before the xattr name.
eg system.acl or user.somekey. FreeBSD separates namespaces out from the
key name and translates them to numbers. This probably makes it
sufficiently different that it would be better to have its own
implementation rather than shoehorn it in with the current one and a
preprocessor hack.

A more troubling issue is that I cannot see a way to get a list of valid
namespaces, which is a serious issue for a backup program.

Cheers,

Martin.