From a9e5a698f9c052d102711e539c87a9b9f6d0c233 Mon Sep 17 00:00:00 2001 From: edef Date: Fri, 15 Apr 2022 21:41:25 +0000 Subject: ripple/fossil/mount: move writing methods into their own section Change-Id: Ia5b63f3be625c738c58a915bc46114cac7acc0a5 --- ripple/fossil/src/bin/mount.rs | 332 +++++++++++++++++++++-------------------- 1 file changed, 167 insertions(+), 165 deletions(-) (limited to 'ripple') diff --git a/ripple/fossil/src/bin/mount.rs b/ripple/fossil/src/bin/mount.rs index f37c7db..e6971a2 100644 --- a/ripple/fossil/src/bin/mount.rs +++ b/ripple/fossil/src/bin/mount.rs @@ -159,27 +159,6 @@ impl fuser::Filesystem for Filesystem { } } - fn setattr( - &mut self, - _req: &fuser::Request<'_>, - _ino: u64, - _mode: Option, - _uid: Option, - _gid: Option, - _size: Option, - _atime: Option, - _mtime: Option, - _ctime: Option, - _fh: Option, - _crtime: Option, - _chgtime: Option, - _bkuptime: Option, - _flags: Option, - reply: fuser::ReplyAttr, - ) { - reply.error(EROFS); - } - fn readlink(&mut self, _req: &fuser::Request<'_>, ino: u64, reply: fuser::ReplyData) { match self.find(ino) { Some(memtree::Node::Link { target }) => reply.data(target.as_bytes()), @@ -188,86 +167,6 @@ impl fuser::Filesystem for Filesystem { } } - fn mknod( - &mut self, - _req: &fuser::Request<'_>, - _parent: u64, - _name: &std::ffi::OsStr, - _mode: u32, - _umask: u32, - _rdev: u32, - reply: fuser::ReplyEntry, - ) { - reply.error(EROFS); - } - - fn mkdir( - &mut self, - _req: &fuser::Request<'_>, - _parent: u64, - _name: &std::ffi::OsStr, - _mode: u32, - _umask: u32, - reply: fuser::ReplyEntry, - ) { - reply.error(EROFS); - } - - fn unlink( - &mut self, - _req: &fuser::Request<'_>, - _parent: u64, - _name: &std::ffi::OsStr, - reply: fuser::ReplyEmpty, - ) { - reply.error(EROFS); - } - - fn rmdir( - &mut self, - _req: &fuser::Request<'_>, - _parent: u64, - _name: &std::ffi::OsStr, - reply: fuser::ReplyEmpty, - ) { - reply.error(EROFS); - } - - fn symlink( - &mut self, - _req: &fuser::Request<'_>, - _parent: u64, - _name: &std::ffi::OsStr, - _link: &std::path::Path, - reply: fuser::ReplyEntry, - ) { - reply.error(EROFS); - } - - fn rename( - &mut self, - _req: &fuser::Request<'_>, - _parent: u64, - _name: &std::ffi::OsStr, - _newparent: u64, - _newname: &std::ffi::OsStr, - _flags: u32, - reply: fuser::ReplyEmpty, - ) { - reply.error(EROFS); - } - - fn link( - &mut self, - _req: &fuser::Request<'_>, - _ino: u64, - _newparent: u64, - _newname: &std::ffi::OsStr, - reply: fuser::ReplyEntry, - ) { - reply.error(EROFS); - } - fn open(&mut self, _req: &fuser::Request<'_>, _ino: u64, _flags: i32, reply: fuser::ReplyOpen) { reply.opened(0, 0); } @@ -300,21 +199,6 @@ impl fuser::Filesystem for Filesystem { } } - fn write( - &mut self, - _req: &fuser::Request<'_>, - _ino: u64, - _fh: u64, - _offset: i64, - _data: &[u8], - _write_flags: u32, - _flags: i32, - _lock_owner: Option, - reply: fuser::ReplyWrite, - ) { - reply.error(EROFS); - } - fn flush( &mut self, _req: &fuser::Request<'_>, @@ -456,19 +340,6 @@ impl fuser::Filesystem for Filesystem { reply.statfs(0, 0, 0, 0, 0, 512, 255, 0); } - fn setxattr( - &mut self, - _req: &fuser::Request<'_>, - _ino: u64, - _name: &std::ffi::OsStr, - _value: &[u8], - _flags: i32, - _position: u32, - reply: fuser::ReplyEmpty, - ) { - reply.error(EROFS); - } - fn getxattr( &mut self, _req: &fuser::Request<'_>, @@ -490,34 +361,11 @@ impl fuser::Filesystem for Filesystem { reply.error(ENOSYS); } - fn removexattr( - &mut self, - _req: &fuser::Request<'_>, - _ino: u64, - _name: &std::ffi::OsStr, - reply: fuser::ReplyEmpty, - ) { - reply.error(EROFS); - } - fn access(&mut self, _req: &fuser::Request<'_>, ino: u64, mask: i32, reply: fuser::ReplyEmpty) { debug!("[Not Implemented] access(ino: {:#x?}, mask: {})", ino, mask); reply.error(ENOSYS); } - fn create( - &mut self, - _req: &fuser::Request<'_>, - _parent: u64, - _name: &std::ffi::OsStr, - _mode: u32, - _umask: u32, - _flags: i32, - reply: fuser::ReplyCreate, - ) { - reply.error(EROFS); - } - fn getlk( &mut self, _req: &fuser::Request<'_>, @@ -574,19 +422,6 @@ impl fuser::Filesystem for Filesystem { reply.error(ENOSYS); } - fn fallocate( - &mut self, - _req: &fuser::Request<'_>, - _ino: u64, - _fh: u64, - _offset: i64, - _length: i64, - _mode: i32, - reply: fuser::ReplyEmpty, - ) { - reply.error(EROFS); - } - fn lseek( &mut self, _req: &fuser::Request<'_>, @@ -603,6 +438,173 @@ impl fuser::Filesystem for Filesystem { reply.error(ENOSYS); } + // read-write methods + + fn setattr( + &mut self, + _req: &fuser::Request<'_>, + _ino: u64, + _mode: Option, + _uid: Option, + _gid: Option, + _size: Option, + _atime: Option, + _mtime: Option, + _ctime: Option, + _fh: Option, + _crtime: Option, + _chgtime: Option, + _bkuptime: Option, + _flags: Option, + reply: fuser::ReplyAttr, + ) { + reply.error(EROFS); + } + + fn mknod( + &mut self, + _req: &fuser::Request<'_>, + _parent: u64, + _name: &std::ffi::OsStr, + _mode: u32, + _umask: u32, + _rdev: u32, + reply: fuser::ReplyEntry, + ) { + reply.error(EROFS); + } + + fn mkdir( + &mut self, + _req: &fuser::Request<'_>, + _parent: u64, + _name: &std::ffi::OsStr, + _mode: u32, + _umask: u32, + reply: fuser::ReplyEntry, + ) { + reply.error(EROFS); + } + + fn unlink( + &mut self, + _req: &fuser::Request<'_>, + _parent: u64, + _name: &std::ffi::OsStr, + reply: fuser::ReplyEmpty, + ) { + reply.error(EROFS); + } + + fn rmdir( + &mut self, + _req: &fuser::Request<'_>, + _parent: u64, + _name: &std::ffi::OsStr, + reply: fuser::ReplyEmpty, + ) { + reply.error(EROFS); + } + + fn symlink( + &mut self, + _req: &fuser::Request<'_>, + _parent: u64, + _name: &std::ffi::OsStr, + _link: &std::path::Path, + reply: fuser::ReplyEntry, + ) { + reply.error(EROFS); + } + + fn rename( + &mut self, + _req: &fuser::Request<'_>, + _parent: u64, + _name: &std::ffi::OsStr, + _newparent: u64, + _newname: &std::ffi::OsStr, + _flags: u32, + reply: fuser::ReplyEmpty, + ) { + reply.error(EROFS); + } + + fn link( + &mut self, + _req: &fuser::Request<'_>, + _ino: u64, + _newparent: u64, + _newname: &std::ffi::OsStr, + reply: fuser::ReplyEntry, + ) { + reply.error(EROFS); + } + + fn write( + &mut self, + _req: &fuser::Request<'_>, + _ino: u64, + _fh: u64, + _offset: i64, + _data: &[u8], + _write_flags: u32, + _flags: i32, + _lock_owner: Option, + reply: fuser::ReplyWrite, + ) { + reply.error(EROFS); + } + + fn setxattr( + &mut self, + _req: &fuser::Request<'_>, + _ino: u64, + _name: &std::ffi::OsStr, + _value: &[u8], + _flags: i32, + _position: u32, + reply: fuser::ReplyEmpty, + ) { + reply.error(EROFS); + } + + fn removexattr( + &mut self, + _req: &fuser::Request<'_>, + _ino: u64, + _name: &std::ffi::OsStr, + reply: fuser::ReplyEmpty, + ) { + reply.error(EROFS); + } + + fn create( + &mut self, + _req: &fuser::Request<'_>, + _parent: u64, + _name: &std::ffi::OsStr, + _mode: u32, + _umask: u32, + _flags: i32, + reply: fuser::ReplyCreate, + ) { + reply.error(EROFS); + } + + fn fallocate( + &mut self, + _req: &fuser::Request<'_>, + _ino: u64, + _fh: u64, + _offset: i64, + _length: i64, + _mode: i32, + reply: fuser::ReplyEmpty, + ) { + reply.error(EROFS); + } + fn copy_file_range( &mut self, _req: &fuser::Request<'_>, -- cgit 1.4.1