diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-01-05 07:18:52 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-01-05 07:18:52 -0600 |
| commit | ce320da58d2917789815bc4dafe15a9b47a9df65 (patch) | |
| tree | b2a0f1a4a57b05ce9c216d6cb3ebbc5304af7bcb /examples | |
| parent | 92121f5db1ccec523c1b7eb0a817f757b5ef899a (diff) | |
Implement Unlink
Diffstat (limited to '')
| -rw-r--r-- | examples/passthrough.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/passthrough.rs b/examples/passthrough.rs index 7b8236b..0e0f2c9 100644 --- a/examples/passthrough.rs +++ b/examples/passthrough.rs @@ -145,6 +145,13 @@ impl Passthrough { reply.known(New(&mut self.known, Inode::new(path, metadata)), Ttl::MAX) } + async fn unlink<'o>(&mut self, (request, reply): Op<'o, ops::Unlink>) -> Done<'o> { + let (reply, inode) = reply.and_then(self.known(request.ino()))?; + let (reply, ()) = reply.and_then(fs::remove_file(inode.path.join(request.name())).await)?; + + reply.ok() + } + async fn rmdir<'o>(&mut self, (request, reply): Op<'o, ops::Rmdir>) -> Done<'o> { let (reply, inode) = reply.and_then(self.known(request.ino()))?; @@ -359,6 +366,7 @@ async fn main_loop(session: Start, mut fs: Passthrough) -> FuseResult<()> { Getattr(getattr) => fs.getattr(getattr.op()?), Readlink(readlink) => fs.readlink(readlink.op()?).await, Mkdir(mkdir) => fs.mkdir(mkdir.op()?).await, + Unlink(unlink) => fs.unlink(unlink.op()?).await, Rmdir(rmdir) => fs.rmdir(rmdir.op()?).await, Open(open) => fs.open(open.op()?).await, Read(read) => fs.read(read.op()?).await, |
