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