Skip to main content

WriteRequest

Struct WriteRequest 

Source
#[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: u64

Inode number of the file to write.

§offset: u64

Byte offset in the file to start writing.

§data_len: u16

Number of data bytes starting at offset 18.

Implementations§

Source§

impl WriteRequest

Source

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).

Source

pub fn parse_prefix(payload: &[u8]) -> Option<Self>

Parse the fixed prefix of a WRITE request payload. Returns None if the prefix is truncated.

Source

pub fn data<'a>(&self, payload: &'a [u8]) -> Option<&'a [u8]>

Return the inline data following the prefix, bounded by data_len.

Source

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

Source§

fn clone(&self) -> WriteRequest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for WriteRequest

Source§

impl Debug for WriteRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.