diff options
| author | Alejandro Soto <alejandro@34project.org> | 2021-12-28 22:01:37 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2021-12-28 22:01:37 -0600 |
| commit | 982b2d03231b3e5abfb94445b1dec981000ffb17 (patch) | |
| tree | 1399424bf73af43e5f58ed293e5a2fe8cdb03073 | |
| parent | 61325f2daae42cb349e6f7612c6c6bb88c3f942d (diff) | |
Rename TimeToLive as Ttl
| -rw-r--r-- | examples/ext2.rs | 12 | ||||
| -rw-r--r-- | src/fuse/io.rs | 6 | ||||
| -rw-r--r-- | src/fuse/ops.rs | 10 | ||||
| -rw-r--r-- | src/lib.rs | 10 |
4 files changed, 19 insertions, 19 deletions
diff --git a/examples/ext2.rs b/examples/ext2.rs index 4c55a64..4d074e9 100644 --- a/examples/ext2.rs +++ b/examples/ext2.rs @@ -35,7 +35,7 @@ use blown_fuse::{ mount::{mount_sync, Options}, ops::{Getattr, Init, Lookup, Readdir, Readlink, Statfs}, session::{Dispatch, Start}, - Done, FuseResult, Ino, Op, TimeToLive, + Done, FuseResult, Ino, Op, Ttl, }; use bytemuck::{cast_slice, from_bytes, try_from_bytes}; @@ -175,7 +175,7 @@ impl Ext2 { inode, name, offset: position, - ttl: TimeToLive::MAX, + ttl: Ttl::MAX, }; break Ok(Some((entry, position))); @@ -372,9 +372,9 @@ impl Ext2 { let (reply, inode) = reply.fallible(result)?; if let Some(inode) = inode { - reply.found(inode, TimeToLive::MAX) + reply.found(inode, Ttl::MAX) } else { - reply.not_found(TimeToLive::MAX) + reply.not_found(Ttl::MAX) } } @@ -455,7 +455,7 @@ impl Known for Resolved { } } - fn attrs(&self) -> (Attrs, TimeToLive) { + fn attrs(&self) -> (Attrs, Ttl) { let inode = self.inode; let (access, modify, create) = { let time = |seconds: u32| (UNIX_EPOCH + Duration::from_secs(seconds.into())).into(); @@ -475,7 +475,7 @@ impl Known for Resolved { .times(access, modify, create) .links(inode.i_links_count.into()); - (attrs, TimeToLive::MAX) + (attrs, Ttl::MAX) } fn unveil(self) {} diff --git a/src/fuse/io.rs b/src/fuse/io.rs index 823eb76..e3938d6 100644 --- a/src/fuse/io.rs +++ b/src/fuse/io.rs @@ -7,7 +7,7 @@ use std::{ ops::{ControlFlow, FromResidual, Try}, }; -use crate::{proto, FuseResult, Ino, TimeToLive, Timestamp}; +use crate::{proto, FuseResult, Ino, Ttl, Timestamp}; use super::{Done, Operation, Reply, Request}; @@ -26,7 +26,7 @@ pub enum Interruptible<'o, O: Operation<'o>, T> { pub trait Known { fn ino(&self) -> Ino; fn inode_type(&self) -> EntryType; - fn attrs(&self) -> (Attrs, TimeToLive); + fn attrs(&self) -> (Attrs, Ttl); fn unveil(self); } @@ -37,7 +37,7 @@ pub struct Entry<N, K> { pub offset: u64, pub name: N, pub inode: K, - pub ttl: TimeToLive, + pub ttl: Ttl, } pub struct FsInfo(proto::StatfsOut); diff --git a/src/fuse/ops.rs b/src/fuse/ops.rs index 4a526e0..d9e7167 100644 --- a/src/fuse/ops.rs +++ b/src/fuse/ops.rs @@ -8,7 +8,7 @@ use std::{ use crate::{ proto, util::{page_size, OutputChain}, - Errno, Ino, TimeToLive, + Errno, Ino, Ttl, }; use super::{ @@ -60,7 +60,7 @@ op! { impl Reply { /// The requested entry was found. The FUSE client will become aware of the found inode if /// it wasn't before. This result may be cached by the client for up to the given TTL. - pub fn found(self, entry: impl Known, ttl: TimeToLive) -> Done<'o> { + pub fn found(self, entry: impl Known, ttl: Ttl) -> Done<'o> { let (attrs, attrs_ttl) = entry.attrs(); let attrs = attrs.finish(&entry); @@ -72,7 +72,7 @@ op! { /// The requested entry was not found in this directory. The FUSE clint may include this /// response in negative cache for up to the given TTL. - pub fn not_found(self, ttl: TimeToLive) -> Done<'o> { + pub fn not_found(self, ttl: Ttl) -> Done<'o> { self.single(&make_entry((Ino::NULL, ttl), (Zeroable::zeroed(), Default::default()))) } @@ -361,8 +361,8 @@ fn c_to_os(string: &CStr) -> &OsStr { } fn make_entry( - (Ino(ino), entry_ttl): (Ino, TimeToLive), - (attrs, attr_ttl): (proto::Attrs, TimeToLive), + (Ino(ino), entry_ttl): (Ino, Ttl), + (attrs, attr_ttl): (proto::Attrs, Ttl), ) -> proto::EntryOut { proto::EntryOut { nodeid: ino, @@ -33,7 +33,7 @@ pub use nix::errno::Errno; pub use util::{FuseError, FuseResult}; #[derive(Copy, Clone, Default, Eq, PartialEq)] -pub struct TimeToLive { +pub struct Ttl { seconds: u64, nanoseconds: u32, } @@ -72,15 +72,15 @@ impl std::fmt::Display for Ino { } } -impl TimeToLive { - pub const MAX: Self = TimeToLive { +impl Ttl { + pub const MAX: Self = Ttl { seconds: u64::MAX, nanoseconds: u32::MAX, }; - pub fn new(seconds: u64, nanoseconds: u32) -> TimeToLive { + pub fn new(seconds: u64, nanoseconds: u32) -> Ttl { assert!(nanoseconds < 1_000_000_000); - TimeToLive { + Ttl { seconds, nanoseconds, } |
