diff --git a/CHANGELOG.md b/CHANGELOG.md index f19446b..61e0fc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ This project follows [semantic versioning](http://semver.org). ### UNRELEASED * [added] Added `copy` subcommand +* [added] Added support for xattrs in fuse mount * [modified] Also documenting common flags in subcommands * [modified] Using repository aliases (**conversion needed**) diff --git a/src/mount.rs b/src/mount.rs index 3769db3..1883797 100644 --- a/src/mount.rs +++ b/src/mount.rs @@ -558,10 +558,21 @@ impl<'a> fuse::Filesystem for FuseFilesystem<'a> { } /// List extended attribute names - fn listxattr (&mut self, _req: &fuse::Request, _ino: u64, _size: u32, reply: fuse::ReplyXattr) { - // #FIXME:20 If arg.size is zero, the size of the attribute list should be sent with fuse_getxattr_out - // #FIXME:10 If arg.size is non-zero, send the attribute list if it fits, or ERANGE otherwise - reply.error(libc::ENOSYS); + fn listxattr (&mut self, _req: &fuse::Request, ino: u64, size: u32, reply: fuse::ReplyXattr) { + let inode = inode!(self, ino, reply); + let inode = inode.borrow(); + let mut names_str = String::new(); + for name in inode.inode.xattrs.keys() { + names_str.push_str(name); + names_str.push('\0'); + } + if size == 0 { + return reply.size(names_str.len() as u32); + } + if size < names_str.len() as u32 { + return reply.error(libc::ERANGE); + } + reply.data(names_str.as_bytes()); } /// Remove an extended attribute