pub struct Stat {
pub qtype: u8,
pub version: u32,
pub path: u64,
pub size: u64,
pub name: String,
pub mtime: u64,
}Expand description
File metadata.
§Qid soundness invariant — SECURITY
In 9P, a file’s qid is its identity: two files are the same file if
and only if their qids are equal. A qid is the triple {qtype, version, path}. Historically this struct carried only qtype, flattening the qid
and destroying the identity signal — every file looked like the same file
to any qid-keyed consumer.
version and path are now threaded end-to-end so the surface is sound,
but the values are not yet a strong identity:
- Synthetic mounts set
version = 1constant andpath = fnv64(path), which is non-cryptographic and changes on rename. - Registry-backed mounts set
path = inode(rename-stable but subject to inode reuse) andversion = ctime(truncated).
Convention: path == 0 means “unknown / not provided” (e.g. non-Unix
registry fallback, or a mount that has no meaningful file identity). It is
NOT a valid identity and must not be treated as one.
No server authz, cache key, or dedup logic may key on qid (version or
path) as a sound identity until #387 lands a content-CID-derived qid with
an AFS-style data-version uniquifier. Treat the qid fields here as an
advisory identity hint only. Authz must continue to key on the verified
Subject plus path resolution, never on qid.
Fields§
§qtype: u8§version: u32Qid version (data-version). Advisory hint only — see type-level invariant.
path: u64Qid path (file identity). 0 means unknown. Advisory hint only — see type-level invariant.
size: u64§name: String§mtime: u64Implementations§
Source§impl Stat
impl Stat
Sourcepub fn unknown_qid(qtype: u8, size: u64, name: String, mtime: u64) -> Self
pub fn unknown_qid(qtype: u8, size: u64, name: String, mtime: u64) -> Self
Construct a Stat with version = 0, path = 0 (qid unknown).
Use this for mounts that have no meaningful file identity (e.g. purely
synthetic test mounts). The result carries qtype/size/name/mtime and
signals via path == 0 that the qid is not a usable identity.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stat
impl RefUnwindSafe for Stat
impl Send for Stat
impl Sync for Stat
impl Unpin for Stat
impl UnsafeUnpin for Stat
impl UnwindSafe for Stat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more