Skip to main content

fs_create_device

Function fs_create_device 

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

Create a filesystem handle backed by a raw block device (e.g. /dev/xvdf).

path: null-terminated path to the block device. total_blocks: number of blocks. Pass 0 to infer from the device size. block_size: block size in bytes. Pass 0 to use the default (65536). initialize: if nonzero, fill the device with random data first (slow on large devices). If zero, open the device as-is. 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.