#[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_IMPLallocate: 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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.