Skip to main content

Crate ninep_proto

Crate ninep_proto 

Source
Expand description

9P2000.L wire protocol with owned and allocation-free codecs.

Shared by the ZeroFS 9P server and the ninep-client crate so both sides speak the exact same messages. Includes the ZeroFS-private Trebind/Rrebind reconnect extension.

All supported messages use slice_codec. It encodes into caller-owned buffers and decodes borrowed views without allocating. The owned API uses Bytes storage, so decoded strings and payloads share the received frame. With default features disabled, the codec requires only core. The owned feature adds the userspace API in no_std + alloc environments.

Re-exports§

pub use slice_codec::CodecError;
pub use slice_codec::LockType;
pub use crate::slice_codec::lock_range_end;

Modules§

message_type
9P2000.L and ZeroFS-private message identifiers.
retry
Mutation retry timings shared by 9P clients and servers.
slice_codec
Allocation-free 9P codec shared by the server, userspace, and kernel clients.

Structs§

DirEntry
DirEntryPlus
MutationEnvelope
Idempotency and HA-origin fields carried by a ZeroFS mutation.
P9Message
An owned 9P frame.
Qid
A ZeroFS inode identity.
Rattach
Rclunk
Rfallocate
Rflush
Rfsync
Rgetattr
Attributes for a fid, with the mask of fields the server answered.
Rgetlineage
Durability lineage and the active HA writer epoch.
Rgetlock
Rlcreate
Rlcreateattr
Post-operation stat of a created and opened regular file.
Rlerror
A failed request’s Linux errno.
Rlink
Rlinkattr
Rlock
Outcome of a lock request, as the raw wire byte. Map it with LockStatus::from_wire.
Rlopen
Standard open reply layout, also used on the wire by private Rlopenat.
Rlopenat
Rlopenatread
Rmkdir
Rmkdirattr
Rmknod
Rmknodattr
Rread
Rreaddir
Rreaddirattr
Rreadlink
Rrebind
Identity of a fid rebound by inode id.
Rrename
Rrenameat
Rsetattr
Rsetattrattr
Rstatfs
Remote filesystem capacity and limits.
Rsymlink
Rsymlinkattr
Runlinkat
Rversion
Rwalk
Rwalkgetattr
Rwrite
Bytes accepted by a write.
Rxattrwalk
Stat
Attributes returned by ZeroFS.
Tattach
Tclunk
Tfallocate
ZeroFS-private atomic fallocate request.
Tflush
Tfsync
Tfsyncdur
Durability-verified fsync carrying the oldest unverified lineage token. datasync contains P9_FSYNC_* flags; without P9_FSYNC_INODE the barrier is filesystem-wide. Token zero denotes no pending mutation in that scope. A lineage mismatch returns ESTALE.
Tgetattr
Tgetlineage
Queries the connection’s durability lineage and writer epoch.
Tgetlock
Tlcreate
Tlcreateattr
Tlink
Tlock
Tlopen
Tlopenat
Tlopenatread
Tmkdir
Tmknod
Tread
Treaddir
Treaddirattr
Treadlink
Trebind
Trename
Trenameat
Tsetattr
Tstatfs
Tsymlink
Tunlinkat
Tversion
Twalk
Twalkgetattr
Twrite
Txattrwalk
WireBytes
A variable-length byte field whose length is carried by its enclosing message.
WireString
A length-prefixed 9P string using caller-selected byte storage.

Enums§

FallocateKind
Supported semantic operation encoded by the Linux fallocate mode bits.
LockStatus
Outcome of a Tlock request.
Message

Constants§

FALLOC_FL_KEEP_SIZE
FALLOC_FL_PUNCH_HOLE
FALLOC_FL_ZERO_RANGE
GETATTR_ALL
NOFID
P9_CHANNEL_SIZE
P9_COUNT_FIELD_LEN
P9_DEBUG_BUFFER_SIZE
P9_ENOTLEADER
P9_ENOTLEADER_CLEAN
P9_EOPIDSTALE
P9_FSYNC_DATASYNC
Standard data-only durability request bit. ZeroFS currently performs the same full durability barrier whether this compatibility bit is set or not.
P9_FSYNC_INODE
Tfsyncdur.datasync limits the verified barrier to the inode named by its fid. Without this flag the barrier is filesystem-wide, preserving compatibility with clients that predate scoped verified fsync.
P9_FSYNC_KNOWN_FLAGS
P9_HEADER_SIZE
P9_IOHDRSZ
P9_LOCK_FLAGS_BLOCK
P9_MAX_GROUPS
P9_MAX_MSIZE
P9_MAX_NAME_LEN
P9_MIN_MESSAGE_SIZE
P9_NOBODY_UID
P9_OP_ENVELOPE_LEN
P9_OP_FLAGS_LEN
P9_OP_FLAG_RETRY
P9_OP_ID_LEN
P9_OP_KNOWN_FLAGS
P9_OP_ORIGIN_EPOCH_LEN
P9_READDIR_BATCH_SIZE
P9_REBIND_CREDENTIAL_GROUPS_INCOMPLETE
High bit of the credential group-count byte. The sender supplied the primary gid, could not encode the complete supplementary-group list, and already performed the caller’s group DAC check locally.
P9_REBIND_CREDENTIAL_HEADER_SIZE
P9_REBIND_CREDENTIAL_MAX_SIZE
P9_REBIND_CREDENTIAL_SENTINEL
P9_REBIND_CREDENTIAL_VERSION
P9_REBIND_KNOWN_FLAGS
P9_REBIND_OPENED
P9_REBIND_REPLAY
P9_RLOPENATREAD_HDR
P9_SIZE_FIELD_LEN
P9_TAG_FIELD_LEN
P9_TWRITE_HDR
P9_TYPE_FIELD_LEN
QID_TYPE_DIR
QID_TYPE_FILE
QID_TYPE_SYMLINK
R_FALLOCATE
SETATTR_ATIME
SETATTR_ATIME_ACCESS
ZeroFS extension: persist an atime selected by the server for a successful VFS access without treating it as an explicit metadata change.
SETATTR_ATIME_SET
SETATTR_CTIME
Accepted and ignored: every mutation stamps ctime from the server clock, and the Linux 9p client sets this bit alongside mode, owner and size changes.
SETATTR_GID
SETATTR_KNOWN
SETATTR_MODE
SETATTR_MTIME
SETATTR_MTIME_SET
SETATTR_SIZE
SETATTR_UID
T_FALLOCATE
T_LCREATE
T_LCREATEATTR
T_LINK
T_LINKATTR
T_MKDIR
T_MKDIRATTR
T_MKNOD
T_MKNODATTR
T_RENAME
T_RENAMEAT
T_SETATTR
T_SETATTRATTR
T_SYMLINK
T_SYMLINKATTR
T_UNLINKAT
T_WRITE
VERSION_9P2000L
VERSION_9P2000L_ZEROFS

Traits§

ByteStorage
Storage backing a variable-length wire field.

Functions§

classify_fallocate_mode
Parse the exact fallocate mode combinations supported by ZeroFS.
subtract_lock_range
Remove one range from another, returning the surviving left and right fragments as (start, length) pairs. A zero length extends to EOF.

Type Aliases§

P9Bytes
P9String
Userspace string backed by shared frame storage.