#1 Extended attribute (xattr) support

open
nobody
None
5
2009-10-28
2009-10-28
Anonymous
No

Adds:
.setxattr
.getxattr
.listxattr
.removexattr

This is the raw patch from the quick implementation I've made. Of note:

- the bulk of the code is in a separate file, xattr.c; this makes no attempt to separate queries from the top level. It should be relatively easy to #ifdef the code out.
- it adds a few "#include"s to log.h and query.h to support loading those from a file which hasn't already "#include"d everything
- schema.sql should probably be loaded and re-dumped by whoever dumped it last time, as the 5.1 format used would add unnecessary noise to the commit - all I actually did was add one table.
- some commented out log statements; possibly excessive logging compared to the rest of the project
- adds a dependancy to the inode-delete routine which might be syntactically invalid on older mysql? This is to effectively simulate foreign key ON DELETE CASCADE behaviour, as extended attributes must go in a separate table but logically should be removed when the main attributes (mode, etc.) go.
- it would make sense for someone who groks conventional limits on name and value length to tweak the schema, as I couldn't find it firmly documented anywhere, but the existing limits should be fine
- would return EIO for an excessively large name or value (as it would fail at the db level); possibly this should be ERANGE

This tests fine with setfattr and getfattr -d --match=.*

Discussion

  • xattr support (raw patch, warrants cleanup); main contents: xattr.c

     
    Attachments
  • Also of note: I didn't get around to documenting the functions, but they are consistent with setxattr(2), getxattr(2) removexattr(2) and listxattr(2).