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_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. More...
 

Typedefs

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

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. More...
 
int xipfs_extended_driver_new_file (const char *full_path, uint32_t size, uint32_t exec)
 Executable or regular new file. More...
 
int xipfs_extended_driver_execv (const char *full_path, char *const argv[])
 Executes an executable file with arguments. More...
 

Variables

const vfs_file_system_t xipfs_file_system
 The xipfs vfs driver.
 

Macro Definition Documentation

◆ XIPFS_NEW_PARTITION

#define XIPFS_NEW_PARTITION (   id,
  path,
  num 
)
Value:
FLASH_WRITABLE_INIT(xipfs_part_##id, num); \
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 = num, \
.page_addr = (void *)xipfs_part_##id, \
.execution_mutex = &execution_mutex_##id, \
.mutex = &mutex_##id \
}
#define MUTEX_INIT
Static initializer for mutex_t.
Definition: mutex.h:117
#define FLASH_WRITABLE_INIT(name, size)
Define an array in flash memory.
Definition: flashpage.h:172
const vfs_file_system_t xipfs_file_system
The xipfs vfs driver.
Mutex structure.
Definition: mutex.h:39
const vfs_file_system_t * fs
The file system driver for the mount point.
Definition: vfs.h:401
xipfs descriptor for vfs integration
Definition: xipfs_fs.h:77
vfs_mount_t vfs_mp
VFS mount point
Definition: xipfs_fs.h:78

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
idIdentifier name for the mount point used by functions that manipulate xipfs file systems
pathThe mount point of the file system in the VFS tree
numThe total number of pages allocated for the partition

Definition at line 50 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 and by deletion operations. mutex is taken by all operations except from xipfs_extended_driver_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
flashpageA valid mtd_flashpage_t pointer such as &mtd_flash_aux_slot.
pathA valid mounting point path.
execution_mutexA valid mutex pointer used for execution and deletions operations.
mutexA valid mutex pointer used by all operations except from execution.
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
full_pathA full path such as /dev/nvme0p0/my_executable_file
argvExecutable arguments. Cannot be NULL, argv[0] contains the executable filename.
Return values
Lessthan 0 on 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
full_pathA full path such as /dev/nvme0p0/my_new_file
sizeThe file size in bytes.
exec0 for regular files, 1 for executable files.
Return values
Lessthan 0 on errors.
0on success.