diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-01-04 06:49:48 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-01-04 06:49:52 -0600 |
| commit | 70baa472b2bee69f205cc1aada304d597b858005 (patch) | |
| tree | 7a0b1a0381b68fe0e091b87d00634ff13568bf6d /src/fuse/ops/entry.rs | |
| parent | 1955ec118a32d3fa174496abe5442c82c609273a (diff) | |
Move crate::fuse::* to the top-level
Diffstat (limited to 'src/fuse/ops/entry.rs')
| -rw-r--r-- | src/fuse/ops/entry.rs | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/src/fuse/ops/entry.rs b/src/fuse/ops/entry.rs deleted file mode 100644 index 9475a61..0000000 --- a/src/fuse/ops/entry.rs +++ /dev/null @@ -1,80 +0,0 @@ -use crate::{proto, Ino}; -use crate::fuse::{io::Stat, private_trait::Sealed, Done, Operation, Reply, Request}; - -pub enum Forget {} -pub enum Getattr {} - -impl Sealed for Forget {} -impl Sealed for Getattr {} - -impl<'o> Operation<'o> for Forget { - type RequestBody = proto::OpcodeSelect< - (&'o proto::BatchForgetIn, &'o [proto::ForgetOne]), - &'o proto::ForgetIn, - { proto::Opcode::BatchForget as u32 }, - >; - - type ReplyTail = (); -} - -impl<'o> Operation<'o> for Getattr { - type RequestBody = &'o proto::GetattrIn; - type ReplyTail = (); -} - -impl<'o> Request<'o, Forget> { - pub fn forget_list(&self) -> impl '_ + Iterator<Item = (Ino, u64)> { - use proto::OpcodeSelect::*; - - enum List<'a> { - Single(Option<(Ino, u64)>), - Batch(std::slice::Iter<'a, proto::ForgetOne>), - } - - impl Iterator for List<'_> { - type Item = (Ino, u64); - - fn next(&mut self) -> Option<Self::Item> { - match self { - List::Single(single) => single.take(), - List::Batch(batch) => { - let forget = batch.next()?; - Some((Ino(forget.ino), forget.nlookup)) - } - } - } - } - - match self.body { - Match((_, slice)) => List::Batch(slice.iter()), - Alt(single) => List::Single(Some((self.ino(), single.nlookup))), - } - } -} - -impl<'o> Reply<'o, Forget> { - pub fn ok(self) -> Done<'o> { - // No reply for forget requests - Done::new() - } -} - -impl<'o> Request<'o, Getattr> { - pub fn handle(&self) -> u64 { - self.body.fh - } -} - -impl<'o> Reply<'o, Getattr> { - pub fn known(self, inode: &impl Stat) -> Done<'o> { - let (attrs, ttl) = inode.attrs(); - let attrs = attrs.finish(inode); - - self.single(&proto::AttrOut { - attr_valid: ttl.seconds, - attr_valid_nsec: ttl.nanoseconds, - dummy: Default::default(), - attr: attrs, - }) - } -} |
