Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
loopback_disk.h File Reference

Go to the source code of this file.

Data Structures

struct  loopback_disk_access
 Context object for an active loopback disk device. More...
 

Functions

int loopback_disk_access_register (struct loopback_disk_access *ctx, const char *file_path, const char *disk_access_name)
 Register a loopback disk device.
 
int loopback_disk_access_unregister (struct loopback_disk_access *ctx)
 Unregister a previously registered loopback disk device.
 

Function Documentation

◆ loopback_disk_access_register()

int loopback_disk_access_register ( struct loopback_disk_access * ctx,
const char * file_path,
const char * disk_access_name )

Register a loopback disk device.

Registers a new loopback disk deviced backed by a file at the specified path.

All parameters (ctx, file_path and disk_access_name) must point to data that will remain valid until the disk access is unregistered. This is trivially true for file_path and disk_access_name if they are string literals, but care must be taken for ctx, as well as for file_path and disk_access_name if they are constructed dynamically.

Parameters
ctxPreallocated context structure
file_pathPath to backing file
disk_access_nameName of the created disk access (for disk_access_*() functions)
Return values
0on success;
<0negative errno code, depending on file system of the backing file.

◆ loopback_disk_access_unregister()

int loopback_disk_access_unregister ( struct loopback_disk_access * ctx)

Unregister a previously registered loopback disk device.

Cleans up resources used by the disk access.

Parameters
ctxContext structure previously passed to a successful invocation of loopback_disk_access_register()
Return values
0on success;
<0negative errno code, depending on file system of the backing file.