Struct IWFS_FSM

Source
#[repr(C)]
pub struct IWFS_FSM {
Show 22 fields pub impl_: *mut IWFS_FSM_IMPL, pub allocate: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, len: off_t, oaddr: *mut off_t, olen: *mut off_t, opts: iwfs_fsm_aflags) -> iwrc>, pub reallocate: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, nlen: off_t, oaddr: *mut off_t, olen: *mut off_t, opts: iwfs_fsm_aflags) -> iwrc>, pub deallocate: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, addr: off_t, len: off_t) -> iwrc>, pub check_allocation_status: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, addr: off_t, len: off_t, allocated: bool) -> iwrc>, pub writehdr: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, buf: *const c_void, siz: off_t) -> iwrc>, pub readhdr: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, buf: *mut c_void, siz: off_t) -> iwrc>, pub clear: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, clrflags: iwfs_fsm_clrfalgs) -> iwrc>, pub ensure_size: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, size: off_t) -> iwrc>, pub add_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, maxlen: size_t, opts: iwfs_ext_mmap_opts_t) -> iwrc>, pub remap_all: Option<unsafe extern "C" fn(f: *mut IWFS_FSM) -> iwrc>, pub acquire_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, mm: *mut *mut u8, sp: *mut size_t) -> iwrc>, pub probe_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, mm: *mut *mut u8, sp: *mut size_t) -> iwrc>, pub release_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_FSM) -> iwrc>, pub remove_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t) -> iwrc>, pub sync_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, flags: iwfs_sync_flags) -> iwrc>, pub write: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, buf: *const c_void, siz: size_t, sp: *mut size_t) -> iwrc>, pub read: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, buf: *mut c_void, siz: size_t, sp: *mut size_t) -> iwrc>, pub close: Option<unsafe extern "C" fn(f: *mut IWFS_FSM) -> iwrc>, pub sync: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, flags: iwfs_sync_flags) -> iwrc>, pub state: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, state: *mut IWFS_FSM_STATE) -> iwrc>, pub extfile: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, ext: *mut *mut IWFS_EXT) -> iwrc>,
}
Expand description

@brief Auto-expandable file with support of reader/writer address space locking and free space blocks management using bitmaps.

Fields§

§impl_: *mut IWFS_FSM_IMPL§allocate: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, len: off_t, oaddr: *mut off_t, olen: *mut off_t, opts: iwfs_fsm_aflags) -> iwrc>

@brief Allocate a continuous address space within a file with length greater or equal to the desired @a len bytes.

Offset and length allocated area will be block size aligned.

@param f IWFS_FSM file. @param len Desired length of an allocated area in bytes. @param [in,out] oaddr Placeholder for the address of an allocated area. Value of @a oaddr passed to this function used as hint in order to allocate area located closely to the specified @a oaddr value. @param [out] olen Actual length of an allocated area in bytes. @param opts Allocation options bitmask flag @ref iwfs_fsm_aflags @return 0 on success or error code.

§reallocate: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, nlen: off_t, oaddr: *mut off_t, olen: *mut off_t, opts: iwfs_fsm_aflags) -> iwrc>

@brief Reallocate and adjust a size of an allocated block.

If the given @a nlen value lesser than actual length of segment @a olen in that case segment will be truncated.

@param f IWFS_FSM file. @param nlen Desired length of segment in bytes. @param oaddr [in,out] Address of an allocated segment. Placeholder for new address of reallocated segment. @param olen [in,out] Length of an allocated segment. Placeholder for length of reallocated segment. @param opts Allocation options bitmask flag @ref iwfs_fsm_aflags @return 0 on success or error code.

§deallocate: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, addr: off_t, len: off_t) -> iwrc>

@brief Free a previously allocated area. @param addr Address space offset in bytes it must be block size aligned. @param len Length of area to release. @return 0 on success or error code.

§check_allocation_status: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, addr: off_t, len: off_t, allocated: bool) -> iwrc>

@brief Check allocation status of region specified by @a addr and @a len @return 0 on success or error code.

§writehdr: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, buf: *const c_void, siz: off_t) -> iwrc>

@brief Write a data to the custom file header.

A custom file header size specified in IWFS_FSM_OPTS::hdrlen options on file creation.

@param off Offset position relative to custom header start offset. @param buf Data buffer to write @param siz Number of bytes of @a buf to write into header. @return 0 on success or error code.

§readhdr: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, buf: *mut c_void, siz: off_t) -> iwrc>

@brief Read a data from the custom file header.

A custom file header size specified in IWFS_FSM_OPTS::hdrlen options on file creation.

@param off Offset position relative to custom header start offset. @param [out] buf Data buffer to read into @param Number of bytes to read

§clear: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, clrflags: iwfs_fsm_clrfalgs) -> iwrc>

@brief Cleanup all allocated data blocks and reset the file to the initial empty state.

@param clrflags @return 0 on success or error code.

§ensure_size: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, size: off_t) -> iwrc>

@see IWFS_EXT::ensure_size

§add_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, maxlen: size_t, opts: iwfs_ext_mmap_opts_t) -> iwrc>

@see IWFS_EXT::add_mmap

§remap_all: Option<unsafe extern "C" fn(f: *mut IWFS_FSM) -> iwrc>

@see IWFS_EXT::remap_all

§acquire_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, mm: *mut *mut u8, sp: *mut size_t) -> iwrc>

@brief Get a pointer to the registered mmap area starting at off.

WARNING: Internal read lock will be acquired and must be released by subsequent release_mmap() call after all activity with mmaped region has finished.

@see IWFS_FSM::add_mmap @see IWFS_EXT::acquire_mmap

§probe_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, mm: *mut *mut u8, sp: *mut size_t) -> iwrc>

@brief Retrieve mmaped region by its offset @a off

§release_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_FSM) -> iwrc>

@brief Release the lock acquired by successfull call of acquire_mmap()

§remove_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t) -> iwrc>

@see IWFS_EXT::remove_mmap

§sync_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, flags: iwfs_sync_flags) -> iwrc>

@see IWFS_EXT::sync_mmap

§write: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, buf: *const c_void, siz: size_t, sp: *mut size_t) -> iwrc>

@see IWFS_FILE::write

§read: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, off: off_t, buf: *mut c_void, siz: size_t, sp: *mut size_t) -> iwrc>

@see IWFS_FILE::read

§close: Option<unsafe extern "C" fn(f: *mut IWFS_FSM) -> iwrc>

@see IWFS_FILE::close

§sync: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, flags: iwfs_sync_flags) -> iwrc>

@see IWFS_FILE::sync

§state: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, state: *mut IWFS_FSM_STATE) -> iwrc>

@see IWFS_FILE::state

§extfile: Option<unsafe extern "C" fn(f: *mut IWFS_FSM, ext: *mut *mut IWFS_EXT) -> iwrc>

get access to the underlying iwextfile instance

Trait Implementations§

Source§

impl Clone for IWFS_FSM

Source§

fn clone(&self) -> IWFS_FSM

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for IWFS_FSM

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Copy for IWFS_FSM

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
Source§

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

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.

Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.