Loading...
Searching...
No Matches

RIOT integration of xipfs. More...

Detailed Description

RIOT integration of xipfs.

Files

file  xipfs_fs.h
 xipfs integration with vfs
 

Data Structures

struct  vfs_xipfs_mount_s
 xipfs descriptor for vfs integration. More...
 

Macros

#define XIPFS_PARTITION_CORE(id, path, data, data_bytesize)
 Define an XiPFS mountpoint along with its associated metadata.
 
#define XIPFS_NEW_PARTITION(id, path, num)
 Allocate a new contiguous space aligned to a page in the non-volatile addressable memory of the MCU to serve as a partition for an xipfs file system.
 
#define XIPFS_START_PARTITION_INCLUSION(id)
 Define the beginning of an included XiPFS mount point.
 
#define XIPFS_END_PARTITION_INCLUSION(id, path, data, data_bytesize)
 Define the end of an included XiPFS mount point.
 

Typedefs

typedef struct vfs_xipfs_mount_s vfs_xipfs_mount_t
 xipfs descriptor for vfs integration.
 

Functions

int xipfs_construct_from_flashpage (mtd_flashpage_t *flashpage, const char *path, mutex_t *execution_mutex, mutex_t *mutex, vfs_xipfs_mount_t *vfs_xipfs_mount)
 vfs_xipfs_mount_t constructor from a mtd_flashpage_t.
 
int xipfs_extended_driver_new_file (const char *full_path, uint32_t size, uint32_t exec)
 Executable or regular new file.
 
int xipfs_extended_driver_execv (const char *full_path, char *const argv[])
 Executes an executable file with arguments.
 

Variables

const vfs_file_system_t xipfs_file_system
 The xipfs vfs driver.
 

Macro Definition Documentation

◆ XIPFS_END_PARTITION_INCLUSION

#define XIPFS_END_PARTITION_INCLUSION ( id,
path,
data,
data_bytesize )
Value:
XIPFS_PARTITION_CORE(id, path, data, data_bytesize)
#define XIPFS_PARTITION_CORE(id, path, data, data_bytesize)
Define an XiPFS mountpoint along with its associated metadata.
Definition xipfs_fs.h:47

Define the end of an included XiPFS mount point.

Parameters
[in]idIdentifier name for the mount point used by functions that manipulate xipfs file systems.
[in]pathThe mount point of the file system in the VFS tree.
[in]dataPointer to the start of the mount point in Flash memory.
[in]data_bytesizeSize of the mount point in Flash memory.
Remarks
This macro should be used together with XIPFS_START_PARTITION_INCLUSION to define a mount point inclusion.

Definition at line 105 of file xipfs_fs.h.

◆ XIPFS_NEW_PARTITION

#define XIPFS_NEW_PARTITION ( id,
path,
num )
Value:
FLASH_WRITABLE_INIT(xipfs_part_##id, num); \
XIPFS_PARTITION_CORE(id, path, xipfs_part_##id, num * XIPFS_NVM_PAGE_SIZE)
#define FLASH_WRITABLE_INIT(name, size)
Define an array in flash memory.
Definition flashpage.h:169

Allocate a new contiguous space aligned to a page in the non-volatile addressable memory of the MCU to serve as a partition for an xipfs file system.

Parameters
[in]idIdentifier name for the mount point used by functions that manipulate xipfs file systems.
[in]pathThe mount point of the file system in the VFS tree.
[in]numThe total number of pages allocated for the partition.

Definition at line 73 of file xipfs_fs.h.

◆ XIPFS_PARTITION_CORE

#define XIPFS_PARTITION_CORE ( id,
path,
data,
data_bytesize )
Value:
static mutex_t execution_mutex_##id = MUTEX_INIT; \
static mutex_t mutex_##id = MUTEX_INIT; \
static vfs_xipfs_mount_t id = { \
.vfs_mp = { \
.mount_point = path, \
}, \
.magic = XIPFS_MAGIC, \
.mount_path = path, \
.page_num = data_bytesize / XIPFS_NVM_PAGE_SIZE, \
.page_addr = (void *)data, \
.execution_mutex = &execution_mutex_##id, \
.mutex = &mutex_##id \
}
#define MUTEX_INIT
Static initializer for mutex_t.
Definition mutex.h:114
const vfs_file_system_t xipfs_file_system
The xipfs vfs driver.
struct vfs_xipfs_mount_s vfs_xipfs_mount_t
xipfs descriptor for vfs integration.
Mutex structure.
Definition mutex.h:36

Define an XiPFS mountpoint along with its associated metadata.

Parameters
[in]idIdentifier name for the mount point used by functions that manipulate xipfs file systems
[in]pathThe mount point of the file system in the VFS tree
[in]dataPointer to the start of the mount point in Flash memory.
[in]data_bytesizeSize of the mount point in Flash memory.
Warning
data_bytesize must be an integral multiple of XIPFS_NVM_PAGE_SIZE.
See also
XIPFS_NEW_PARTITION
XIPFS_START_PARTITION_INCLUSION / XIPFS_END_PARTITION_INCLUSION

Definition at line 47 of file xipfs_fs.h.

◆ XIPFS_START_PARTITION_INCLUSION

#define XIPFS_START_PARTITION_INCLUSION ( id)
Value:
__attribute__((aligned(XIPFS_NVM_PAGE_SIZE))) \
__attribute__((section(".rodata.xipfs." #id)))

Define the beginning of an included XiPFS mount point.

Parameters
[in]idIdentifier name for the mount point used by functions that manipulate xipfs file systems
Remarks
This macro should be used together with XIPFS_END_PARTITION_INCLUSION to define a mount point inclusion.
Warning
Contrary to most other macros, please take care NOT to end this one with a semicolon character ';'.

Definition at line 89 of file xipfs_fs.h.

Typedef Documentation

◆ vfs_xipfs_mount_t

xipfs descriptor for vfs integration.

execution_mutex is taken by:

  • xipfs_extended_driver_execv,
  • xipfs_extended_driver_safe_execv,
  • deletion operations.

mutex is taken by all operations except from:

  • xipfs_extended_driver_execv
  • xipfs_extended_driver_safe_execv.

This two mutexes scheme:

  • allows to call xipfs operation from within a code run by xipfs_extended_driver_execv,
  • prevents from deleting files or directories when operations are performed on them.

Function Documentation

◆ xipfs_construct_from_flashpage()

int xipfs_construct_from_flashpage ( mtd_flashpage_t * flashpage,
const char * path,
mutex_t * execution_mutex,
mutex_t * mutex,
vfs_xipfs_mount_t * vfs_xipfs_mount )

vfs_xipfs_mount_t constructor from a mtd_flashpage_t.

This function constructs an xipfs mount point from a mtd_flashpage_t such as mtd_flash_aux_slot. It allows to use XIPFS with the RIOT AUX slot mechanism.

Parameters
[in]flashpageA valid mtd_flashpage_t pointer such as &mtd_flash_aux_slot.
[in]pathA valid mounting point path.
[in]execution_mutexA valid mutex pointer used for execution and deletions operations.
[in]mutexA valid mutex pointer used by all operations except from execution.
[in,out]vfs_xipfs_mountA valid vfs xipfs mount point pointer.
Return values
-EINVALwhen one of the parameters is NULL or when path is an empty string.
0on success.
Note
Both mutexes will be initialized by this function.

◆ xipfs_extended_driver_execv()

int xipfs_extended_driver_execv ( const char * full_path,
char *const argv[] )

Executes an executable file with arguments.

Parameters
[in]full_pathA full path such as /nvme0p0/my_executable_file.
[in]argvExecutable arguments. Cannot be NULL, argv[0] contains the executable filename.
Return values
<0on errors.
>=0on success.

◆ xipfs_extended_driver_new_file()

int xipfs_extended_driver_new_file ( const char * full_path,
uint32_t size,
uint32_t exec )

Executable or regular new file.

Allows to create a regular or executable new file within XiPFS.

Parameters
[in]full_pathA full path such as /nvme0p0/my_new_file
[in]sizeThe file size in bytes.
[in]exec0 for regular files, 1 for executable files.
Return values
<0on errors.
0on success.