pub unsafe extern "C" fn esp_vfs_register_fs(
base_path: *const u8,
vfs: *const esp_vfs_fs_ops_t,
flags: i32,
ctx: *mut c_void,
) -> i32Expand description
Register a virtual filesystem for given path prefix.
@param base_path file path prefix associated with the filesystem. Must be a zero-terminated C string, may be empty. If not empty, must be up to ESP_VFS_PATH_MAX characters long, and at least 2 characters long. Name must start with a “/” and must not end with “/”. For example, “/data” or “/dev/spi” are valid. These VFSes would then be called to handle file paths such as “/data/myfile.txt” or “/dev/spi/0”. In the special case of an empty base_path, a “fallback” VFS is registered. Such VFS will handle paths which are not matched by any other registered VFS. @param vfs Pointer to esp_vfs_fs_ops_t, a structure which maps syscalls to the filesystem driver functions. VFS component does not assume ownership of this struct, but see flags for more info
@param flags Set of binary flags controlling how the registered FS should be treated
- ESP_VFS_FLAG_STATIC - if this flag is specified VFS assumes the provided esp_vfs_fs_ops_t and all its subcomponents are statically allocated,
if it is not enabled a deep copy of the provided struct will be created, which will be managed by the VFS component
- ESP_VFS_FLAG_CONTEXT_PTR - If set, the VFS will use the context-aware versions of the filesystem operation functions (suffixed with _p) in esp_vfs_fs_ops_t and its subcomponents.
The ctx parameter will be passed as the context argument when these functions are invoked.
@param ctx Context pointer for fs operation functions, see the ESP_VFS_FLAG_CONTEXT_PTR.
Should be NULL if not used.
@return ESP_OK if successful, ESP_ERR_NO_MEM if too many FSes are registered.