Skip to main content

fs_create_disk

Function fs_create_disk 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn fs_create_disk( path: *const c_char, total_blocks: u64, block_size: u32, create_new: i32, master_key: *const u8, master_key_len: usize, ) -> *mut FsHandle
Expand description

Create a filesystem handle backed by a file on disk.

path: null-terminated path to the image file. total_blocks: number of blocks. Pass 0 to infer from file size. block_size: block size in bytes. Pass 0 to use the default (65536). create_new: if nonzero, create a new file (fails if it already exists). if zero, open an existing file. master_key: pointer to the master encryption key bytes. master_key_len: length of master_key in bytes (should be 32).

Returns a pointer to an opaque handle, or null on failure.

ยงSafety

  • path must be a valid null-terminated C string.
  • master_key must point to master_key_len valid bytes.