pub struct FileHandle(pub u64);Expand description
A newtype for file handles
This corresponds to a single file description in a client program. These
are generated by the filesystem implementation in replies to Open,
OpenDir and Create requests. It’s used as a correlation id across
Read, Write, FSync, IoCtl, Poll, FAllocate, ReadDir,
FSyncDir, GetLk, SetLk, SetLkW, ReadDirPlus, Lseek and
CopyFileRange requests.
A filesystem implementation may store arbitrary data as the FileHandle, as
long as it fits into 64-bits and doesn’t need to change for over the lifetime
of the FileHandle. Typically this might consist of an index into an array
of FileHandles that the filesystem implementation maintains.
Filesystems may instead implement stateless file I/O and use 0 as the
FileHandle - although this makes it impossible to correctly implement
resumable ReadDir in the presence of mutable directories (see OpenDir).
§Lifecycle
A FileHandle is owned by one or more file-descriptors (or memory
mappings) in the client program. Multiple file descriptors can point to
the same FileHandle, just as a single INode can have multiple
FileHandles open at one time. Every time a single file-descriptor is
closed a Flush request is made. This gives filesystem implementations
an opportunity to return an error message from that close() call. After
all the file-descriptors are closed that own a given FileHandle the
Release/ReleaseDir request will be made. This is an opportunity for
the filesystem implementation to free any internal per-FileHandle data
structures it has allocated.
Tuple Fields§
§0: u64Trait Implementations§
Source§impl Clone for FileHandle
impl Clone for FileHandle
Source§fn clone(&self) -> FileHandle
fn clone(&self) -> FileHandle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more