Expand description
Typed repr(C) payload structs for fixed-size IPC messages.
Each struct derives zerocopy’s FromBytes + IntoBytes + Immutable,
enabling safe zero-cost cast to/from IpcMessage payloads via
[encode_fixed] / [decode_fixed].
This module also defines the shared VFS scheme opcodes (OPCODE_*) used
as msg_type values on the wire: scheme servers must import them from
here instead of redeclaring local copies.
§Conventions
- Fixed-size structs are kept ≤ 48 bytes by convention : well under
IpcMessage::PAYLOAD_CAPACITY(240) : so they can be embedded in messages that also carry an inline blob. - Variable-length path/data fields use an
InlineBlobHeaderprefix and may exploit the full 240-byte payload capacity. status == 0means success; non-zero is an errno-compatible error code.- Padding fields are named
_pador_reservedand must be zero.
§Wire format
Messages are sent through IPC ports or channels as raw bytes.
The msg_type field in the IpcMessage header identifies the operation.
The payload field contains the struct-specific data.
§Example
ⓘ
use strat9_abi::ipc_payload::{OpenRequest, OpenReply, OPCODE_OPEN};
// Encode an open request with path "/tmp/test"
let msg = OpenRequest::encode(OPCODE_OPEN, 0x02, "/tmp/test").unwrap();
// A server parses the request...
let (flags, path) = OpenRequest::parse(&msg.payload).unwrap();
assert_eq!(path, "/tmp/test");
// ...and builds a typed reply, which the client parses back.
let reply = OpenReply {
status: 0,
file_id: 42,
size: 1024,
file_flags: 0x01,
};Macros§
Structs§
- Close
Request - Close request.
- Create
Reply - Create reply.
- Create
Request - Create request (file or directory).
- Lseek
Reply - Lseek reply.
- Lseek
Request - Lseek request.
- Open
Reply - Open reply.
- Open
Request - Open request.
- Read
Reply - Read reply prefix (variable-length data follows at offset 8).
- Read
Request - Read request.
- Stat
Request - Stat request.
- Status
Reply - Minimal reply carrying only a status code.
- TcpConnect
Reply - TCP connect reply.
- TcpConnect
Request - TCP connect request.
- Write
Reply - Write reply.
- Write
Request - Write request with variable-length inline data.
Constants§
- OPCODE_
CLOSE - Wire
msg_typefor a close request. - OPCODE_
CREATE_ DIR - Wire
msg_typefor a create-directory request. - OPCODE_
CREATE_ FILE - Wire
msg_typefor a create-file request. - OPCODE_
OPEN - Wire
msg_typefor an open request. - OPCODE_
READ - Wire
msg_typefor a read request. - OPCODE_
READDIR - Wire
msg_typefor a readdir request. - OPCODE_
UNLINK - Wire
msg_typefor an unlink request. - OPCODE_
WRITE - Wire
msg_typefor a write request.