Struct IWFS_EXT

Source
#[repr(C)]
pub struct IWFS_EXT {
Show 21 fields pub impl_: *mut IWFS_EXT_IMPL, pub ensure_size: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, off: off_t) -> iwrc>, pub truncate: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, off: off_t) -> iwrc>, pub truncate_unsafe: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, off: off_t) -> iwrc>, pub add_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, off: off_t, len: size_t, opts: iwfs_ext_mmap_opts_t) -> iwrc>, pub add_mmap_unsafe: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, off: off_t, len: size_t, opts: iwfs_ext_mmap_opts_t) -> iwrc>, pub acquire_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, off: off_t, mm: *mut *mut u8, sp: *mut size_t) -> iwrc>, pub probe_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, off: off_t, mm: *mut *mut u8, sp: *mut size_t) -> iwrc>, pub probe_mmap_unsafe: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, off: off_t, mm: *mut *mut u8, sp: *mut size_t) -> iwrc>, pub release_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_EXT) -> iwrc>, pub remove_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, off: off_t) -> iwrc>, pub remove_mmap_unsafe: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, off: off_t) -> iwrc>, pub sync_mmap: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, off: off_t, flags: iwfs_sync_flags) -> iwrc>, pub sync_mmap_unsafe: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, off: off_t, flags: iwfs_sync_flags) -> iwrc>, pub remap_all: Option<unsafe extern "C" fn(f: *mut IWFS_EXT) -> iwrc>, pub write: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, 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_EXT, 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_EXT) -> iwrc>, pub sync: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, flags: iwfs_sync_flags) -> iwrc>, pub state: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, state: *mut IWFS_EXT_STATE) -> iwrc>, pub copy: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, off: off_t, siz: size_t, noff: off_t) -> iwrc>,
}
Expand description

@brief Auto-expandable file.

Fields§

§impl_: *mut IWFS_EXT_IMPL§ensure_size: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, off: off_t) -> iwrc>

@brief Ensures that a file’s physical address space contains a given offset @a off

Various algorithms can be used for new space allocation, see the features section for further explanation.

@param f IWFS_EXT @param off File offset what have to be within physically allocated file address space. @return 0 on success or error code.

@see off_t iw_exfile_szpolicy_fibo(off_t nsize, off_t csize, struct IWFS_EXT *f, void **ctx) @see off_t iw_exfile_szpolicy_mul(off_t nsize, off_t csize, struct IWFS_EXT *f, void **ctx)

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

@brief Set the end of this file to the specified offset @a off exactly.

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

@brief Register an address space specified by @a off and @a len as memory mmaped region within this file.

It is not required for this region be physically represented in the file’s address space. As soon as this region will be used for reading/writing it will be mmaped and direct mmaped memory access will be used for IO in this area.

For example: @code {.c} f.add_mmap(&f, 10, 20); f.read(&f, 5, buf, 10, sp); // read [5-15) bytes // [5-10) bytes will be read using system pread // [10-15) bytes will be retrieved by direct memcpy from mmapped region @endcode

Pointer to this region can be retrieved by IWFS_EXT::acquire_mmap

@param f IWFS_EXT @param off Offset of mmaped region @param len Length of mmaped region @return 0 on success or error code.

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

@brief Retrieve mmaped region by its offset @a off and keep file as read locked.

If region was not mmaped previously with IWFS_EXT::add_mmap the IWFS_ERROR_NOT_MMAPED error code will be returned.

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

@param f IWFS_EXT @param off Region start offset @param [out] mm Pointer assigned to start of mmaped region of NULL if error occurred. @param [out] sp Length of region @return 0 on success or error code.

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

@brief Retrieve mmaped region by its offset @a off

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

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

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

@brief Unmap mmaped region identified by @a off

The IWFS_ERROR_NOT_MMAPED will returned if region was not previously mapped with IWFS_EXT::add_mmap

@param f IWFS_EXT @param off Region start offset @return 0 on success or error code.

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

@brief Synchronize a file with a mmaped region identified by @a off offset.

The IWFS_ERROR_NOT_MMAPED will returned if region was not previously mapped with IWFS_EXT::add_mmap

@param f IWFS_EXT @param off Region start offset @param flags Sync flags. @return 0 on success or error code.

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

@brief Remap all mmaped regions.

@param f IWFS_EXT

§write: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, 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_EXT, 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_EXT) -> iwrc>

@see IWFS_FILE::close

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

@see IWFS_FILE::sync

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

@see IWFS_FILE::state

§copy: Option<unsafe extern "C" fn(f: *mut IWFS_EXT, off: off_t, siz: size_t, noff: off_t) -> iwrc>

@see IWFS_FILE::copy

Trait Implementations§

Source§

impl Clone for IWFS_EXT

Source§

fn clone(&self) -> IWFS_EXT

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_EXT

Source§

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

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

impl Copy for IWFS_EXT

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.