#[repr(C, packed(1))]pub struct WriteRequest {
pub ino: u64,
pub offset: u64,
pub data_len: u16,
}Expand description
Write request with variable-length inline data.
Wire layout:
ino @ 0..8, offset @ 8..16, data_len @ 16..18, data @ 18...
§Wire-compatibility note
Same as OpenRequest: a raw u16 length prefix, not an
InlineBlobHeader. Earlier documentation wrongly claimed an
InlineBlobHeader + pad at 16..24 with data at 24; no component ever
encoded that format.
Fields§
§ino: u64Inode number of the file to write.
offset: u64Byte offset in the file to start writing.
data_len: u16Number of data bytes starting at offset 18.
Implementations§
Source§impl WriteRequest
impl WriteRequest
Sourcepub const DATA_OFFSET: usize = 18
pub const DATA_OFFSET: usize = 18
Byte offset at which the inline data starts.
NOTE: packed(1) so size matches the wire prefix exactly.
Read fields by copy only (see OpenRequest).
Sourcepub fn parse_prefix(payload: &[u8]) -> Option<WriteRequest>
pub fn parse_prefix(payload: &[u8]) -> Option<WriteRequest>
Parse the fixed prefix of a WRITE request payload.
Returns None if the prefix is truncated.
Sourcepub fn data<'a>(&self, payload: &'a [u8]) -> Option<&'a [u8]>
pub fn data<'a>(&self, payload: &'a [u8]) -> Option<&'a [u8]>
Return the inline data following the prefix, bounded by data_len.
Sourcepub fn encode(
msg_type: u32,
ino: u64,
offset: u64,
data: &[u8],
) -> Option<(IpcMessage, usize)>
pub fn encode( msg_type: u32, ino: u64, offset: u64, data: &[u8], ) -> Option<(IpcMessage, usize)>
Encode a WRITE request into a fresh IpcMessage.
Returns None if data exceeds IpcMessage::WRITE_INLINE_CAPACITY
: chunking is the caller’s policy, this helper never truncates.
Otherwise returns the message and the packed length (== data.len()).
Trait Implementations§
Source§impl Clone for WriteRequest
impl Clone for WriteRequest
Source§fn clone(&self) -> WriteRequest
fn clone(&self) -> WriteRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more