diff --git a/src/lib.rs b/src/lib.rs index 36d4498..4c1374a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,7 +22,7 @@ use time::Timespec; pub use kernel::FUSE_ROOT_ID; pub use kernel::consts; pub use reply::{Reply, ReplyEmpty, ReplyData, ReplyEntry, ReplyAttr, ReplyOpen}; -pub use reply::{ReplyWrite, ReplyStatfs, ReplyCreate, ReplyLock, ReplyBmap, ReplyDirectory}; +pub use reply::{ReplyWrite, ReplyStatfs, ReplyCreate, ReplyLock, ReplyBmap, ReplyDirectory, ReplyIoctl}; pub use reply::ReplyXattr; #[cfg(target_os = "macos")] pub use reply::ReplyXTimes; @@ -349,6 +349,16 @@ pub trait Filesystem { reply.error(ENOSYS); } + /// control device + fn ioctl(&mut self, _req: &Request, _ino: u64, _fh: u64, _flags: u32, _cmd: u32, _arg: u64, _in_size: u32, _out_size: u32, _blocksize: u32, _idx: u64, reply: ReplyIoctl) { + reply.error(ENOSYS); + } + + /// Preallocate or deallocate space to a file + fn fallocate(&mut self, _req: &Request, _ino: u64, _fh: u64, _offset: i64, _length: i64, _mode: i32, reply: ReplyEmpty) { + reply.error(ENOSYS); + } + /// macOS only: Rename the volume. Set fuse_init_out.flags during init to /// FUSE_VOL_RENAME to enable #[cfg(target_os = "macos")] diff --git a/src/reply.rs b/src/reply.rs index 78eacd4..d30c2c2 100644 --- a/src/reply.rs +++ b/src/reply.rs @@ -528,6 +528,28 @@ impl ReplyBmap { } } +pub struct ReplyIoctl { + reply: ReplyRaw<()>, +} + +impl Reply for ReplyIoctl { + fn new(unique: u64, sender: S) -> ReplyIoctl { + ReplyIoctl { reply: Reply::new(unique, sender) } + } +} + +impl ReplyIoctl { + //// Reply to a request with the iovec + //pub fn iovec(mut self, data: &[u8]) { + // self.reply.send(0, &[data]); + //} + + /// Reply to a request with the given error code + pub fn error(self, err: c_int) { + self.reply.error(err); + } +} + /// /// Directory reply /// diff --git a/src/request.rs b/src/request.rs index 11c519a..1453992 100644 --- a/src/request.rs +++ b/src/request.rs @@ -385,19 +385,29 @@ impl<'a> Request<'a> { se.filesystem.bmap(self, self.header.nodeid, arg.blocksize, arg.block, self.reply()); }, FUSE_IOCTL => { - unimplemented!() + let arg: &fuse_ioctl_in = data.fetch(); + self.reply::().error(ENOSYS); + //debug!("IOCTL({}) ino {:#018x}, fh {}, flags {}, cmd {}, in_size {}, out_size {}", self.header.unique, self.header.nodeid, arg.fh, arg.flags, arg.cmd, arg.in_size, arg.out_size); + //se.filesystem.ioctl(self, self.header.nodeid, arg.fh, arg.flags, arg.cmd, arg.in_size, arg.out_size, self.reply()); }, FUSE_POLL => { - unimplemented!() + let arg: &fuse_poll_in = data.fetch(); + //debug!("IOCTL({}) ino {:#018x}, fh {}, flags {}, in_size {}, out_size {}", self.header.unique, self.header.nodeid, arg.fh, arg.in_size, arg.out_size); + //se.filesystem.poll(self, self.header.nodeid, arg.fh, arg.flags, arg.in_size, arg.out_size, self.reply()); + self.reply::().error(ENOSYS); }, FUSE_NOTIFY_REPLY => { - unimplemented!() + let arg: &fuse_notify_retrieve_in = data.fetch(); + self.reply::().error(ENOSYS); }, FUSE_BATCH_FORGET => { - unimplemented!() + let arg: &fuse_batch_forget_in = data.fetch(); + self.reply::().error(ENOSYS); }, FUSE_FALLOCATE => { - unimplemented!() + let arg: &fuse_fallocate_in = data.fetch(); + debug!("FALLOCATE({}) ino {:#018x}, fh {}, offset {}, length {}, mode {}", self.header.unique, self.header.nodeid, arg.fh, arg.offset, arg.length, arg.mode); + se.filesystem.fallocate(self, self.header.nodeid, arg.fh, arg.offset, arg.length, arg.mode, self.reply()); }, #[cfg(target_os = "macos")] FUSE_SETVOLNAME => { @@ -419,7 +429,8 @@ impl<'a> Request<'a> { se.filesystem.getxtimes(self, self.header.nodeid, self.reply()); }, CUSE_INIT => { - unimplemented!() + let arg: &cuse_init_in = data.fetch(); + self.reply::().error(ENOSYS); }, } }