Extended Attributes Support for APR
A portable extended attributes implementation for APR.
This interface is designed to allow adding a property provider to mod_dav_fs that uses extended attributes instead of a db per file (TwistedDAV on Mac OS X uses extended attributes for this reason) - although it is a general purpose extended attribute interface.
Extended attributes could also be used for setting mime-types on files (mod_mime_xattr uses the native Linux API so this could be ported to use portable extended attributes and work on more platforms). Another use case would be setting file listing 'description' attributes and modifying mod_autoindex to use these instead of .htaccess directives.
The API proposal currently addresses:
- setting, getting, listing and removing of 'user' extended attributes
- on a file or directory specified by a path name
- on an already open apr_file_t*
- on an already open apr_dir_t*
It does not address:
- system namespaces on platforms with more than one attribute namespace
- (only the user namespace is accessible on platforms with multiple attribute namespaces, new flags could potentially be added to access platform specific system namespaces)
The sample implementation is working for Linux, Mac OS X, FreeBSD 6 and Solaris 10:
- Linux implementations uses f(get|set|list|remove)xattr
- Mac OS X implementation uses f(get|set|list|remove)xattr (different args to linux)
- FreeBSD implementation uses extattr_(get|set|list|delete)_fd
- Solaris implementation uses subfiles (openat, unlinkat)
Not implemented:
- Windows - should be able to use named :streams (similar to Solaris)
- OS/2 - it has extended attributes but that's all I know.
- Irix/HPUX/AIX/OS390/netware/... - unknown? do they have them?
Headers, build infrastructure and test cases:
http://privsep.org/patches/2.3.0-dev/xattr-patches/apr-xattr-headers.patch
http://privsep.org/patches/2.3.0-dev/xattr-patches/apr-xattr-build.patch
http://privsep.org/patches/2.3.0-dev/xattr-patches/apr-xattr-tests.patch
Mac OS X, FreeBSD, Linux and Solaris implementations plus ENOTIMPL stubs for unsupported platforms
All-in-one patch (should cleanly to apr trunk):
apxattr - Utility to view/modify extended attributes on files