summaryrefslogtreecommitdiff
path: root/src/fuse/fs.rs
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2021-12-27 00:44:23 -0600
committerAlejandro Soto <alejandro@34project.org>2021-12-28 19:43:44 -0600
commita3212a0ba07da7bdae9e17637fbc237e2ae01c08 (patch)
tree00be583beba0f321ebeea3af21582ce927943b44 /src/fuse/fs.rs
parent311b2a40213aa48131a189f99dc4258d354c0c78 (diff)
Redesign the API around a user-provided main loop
This is basically a full library rewrite.
Diffstat (limited to '')
-rw-r--r--src/fuse/fs.rs78
1 files changed, 0 insertions, 78 deletions
diff --git a/src/fuse/fs.rs b/src/fuse/fs.rs
deleted file mode 100644
index 0c39ea7..0000000
--- a/src/fuse/fs.rs
+++ /dev/null
@@ -1,78 +0,0 @@
-use crate::{Ino, TimeToLive};
-use async_trait::async_trait;
-use std::{num::NonZeroUsize, ops::Deref, sync::Arc};
-
-use super::{
- io::{Attrs, EntryType},
- ops::*,
- Done, Op, Reply,
-};
-
-#[async_trait]
-pub trait Fuse: Sized + Send + Sync + 'static {
- type Inode: Inode<Fuse = Self> + ?Sized;
- type Farc: Deref<Target = Self::Inode> + Clone + Send + Sync = Arc<Self::Inode>;
-
- async fn init<'o>(&self, reply: Reply<'o, Self, Init>) -> Done<'o>;
-
- async fn statfs<'o>(&self, (_, reply, _): Op<'o, Self, Statfs>) -> Done<'o> {
- reply.not_implemented()
- }
-
- fn request_buffers(&self) -> NonZeroUsize {
- NonZeroUsize::new(16).unwrap()
- }
-
- fn request_buffer_pages(&self) -> NonZeroUsize {
- NonZeroUsize::new(4).unwrap()
- }
-}
-
-#[async_trait]
-pub trait Inode: Send + Sync {
- type Fuse: Fuse<Inode = Self>;
-
- fn ino(self: &FarcTo<Self>) -> Ino;
- fn attrs(self: &FarcTo<Self>) -> (Attrs, TimeToLive);
- fn inode_type(self: &FarcTo<Self>) -> EntryType;
-
- fn direct_io(self: &FarcTo<Self>) -> bool {
- false
- }
-
- fn access<'o>(self: &FarcTo<Self>, (_, reply, _): Op<'o, Self::Fuse, Access>) -> Done<'o> {
- reply.not_implemented()
- }
-
- async fn lookup<'o>(self: FarcTo<Self>, (_, reply, _): Op<'o, Self::Fuse, Lookup>) -> Done<'o> {
- reply.not_implemented()
- }
-
- async fn readlink<'o>(
- self: FarcTo<Self>,
- (_, reply, _): Op<'o, Self::Fuse, Readlink>,
- ) -> Done<'o> {
- reply.not_implemented()
- }
-
- async fn open<'o>(self: FarcTo<Self>, (_, reply, _): Op<'o, Self::Fuse, Open>) -> Done<'o> {
- // Calling not_implemented() here would ignore direct_io() and similar flags
- reply.ok()
- }
-
- async fn opendir<'o>(
- self: FarcTo<Self>,
- (_, reply, _): Op<'o, Self::Fuse, Opendir>,
- ) -> Done<'o> {
- reply.not_implemented()
- }
-
- async fn readdir<'o>(
- self: FarcTo<Self>,
- (_, reply, _): Op<'o, Self::Fuse, Readdir>,
- ) -> Done<'o> {
- reply.not_implemented()
- }
-}
-
-pub type FarcTo<I> = <<I as Inode>::Fuse as Fuse>::Farc;