From 808d7b000bd02d8238ba7b0f1d6800428de661ef Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Tue, 28 Dec 2021 22:04:10 -0600 Subject: Add Ttl::NULL --- src/fuse/io.rs | 2 +- src/fuse/ops.rs | 2 +- src/lib.rs | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/fuse/io.rs b/src/fuse/io.rs index e3938d6..47df045 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, Ttl, Timestamp}; +use crate::{proto, FuseResult, Ino, Timestamp, Ttl}; use super::{Done, Operation, Reply, Request}; diff --git a/src/fuse/ops.rs b/src/fuse/ops.rs index d9e7167..1a5a578 100644 --- a/src/fuse/ops.rs +++ b/src/fuse/ops.rs @@ -73,7 +73,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: Ttl) -> Done<'o> { - self.single(&make_entry((Ino::NULL, ttl), (Zeroable::zeroed(), Default::default()))) + self.single(&make_entry((Ino::NULL, ttl), (Zeroable::zeroed(), Ttl::NULL))) } /// The requested entry was not found in this directory, but unlike [`Reply::not_found()`] diff --git a/src/lib.rs b/src/lib.rs index 3117fee..a1c8ea0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,7 +32,7 @@ pub use nix::errno::Errno; pub use util::{FuseError, FuseResult}; -#[derive(Copy, Clone, Default, Eq, PartialEq)] +#[derive(Copy, Clone, Eq, PartialEq)] pub struct Ttl { seconds: u64, nanoseconds: u32, @@ -73,6 +73,11 @@ impl std::fmt::Display for Ino { } impl Ttl { + pub const NULL: Self = Ttl { + seconds: 0, + nanoseconds: 0, + }; + pub const MAX: Self = Ttl { seconds: u64::MAX, nanoseconds: u32::MAX, -- cgit v1.2.3