mirror of https://github.com/dswd/zvault
Implemented getxattr in mount (re #1)
This commit is contained in:
parent
580a2d2351
commit
5ab8873407
18
src/mount.rs
18
src/mount.rs
|
@ -541,10 +541,20 @@ impl<'a> fuse::Filesystem for FuseFilesystem<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get an extended attribute
|
/// Get an extended attribute
|
||||||
fn getxattr (&mut self, _req: &fuse::Request, _ino: u64, _name: &OsStr, _size: u32, reply: fuse::ReplyXattr) {
|
fn getxattr (&mut self, _req: &fuse::Request, ino: u64, name: &OsStr, size: u32, reply: fuse::ReplyXattr) {
|
||||||
// #FIXME:30 If arg.size is zero, the size of the value should be sent with fuse_getxattr_out
|
let inode = inode!(self, ino, reply);
|
||||||
// #FIXME:0 If arg.size is non-zero, send the value if it fits, or ERANGE otherwise
|
let inode = inode.borrow();
|
||||||
reply.error(libc::ENOSYS);
|
if let Some(val) = inode.inode.xattrs.get(&name.to_string_lossy() as &str) {
|
||||||
|
if size == 0 {
|
||||||
|
reply.size(val.len() as u32);
|
||||||
|
} else if size >= val.len() as u32 {
|
||||||
|
reply.data(val);
|
||||||
|
} else {
|
||||||
|
reply.error(libc::ERANGE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reply.error(libc::ENODATA);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// List extended attribute names
|
/// List extended attribute names
|
||||||
|
|
Loading…
Reference in New Issue