xipfs_fs.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2024 Université de Lille
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
20 #ifndef FS_XIPFS_FS_H
21 #define FS_XIPFS_FS_H
22 
23 #include "vfs.h"
24 #include "mtd_flashpage.h"
25 #include "mutex.h"
26 #include "include/xipfs.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
47 #define XIPFS_NEW_PARTITION(id, path, num) \
48  FLASH_WRITABLE_INIT(xipfs_part_##id, num); \
49  static mutex_t execution_mutex_##id = MUTEX_INIT; \
50  static mutex_t mutex_##id = MUTEX_INIT; \
51  static vfs_xipfs_mount_t id = { \
52  .vfs_mp = { \
53  .fs = &xipfs_file_system, \
54  .mount_point = path, \
55  }, \
56  .magic = XIPFS_MAGIC, \
57  .mount_path = path, \
58  .page_num = num, \
59  .page_addr = (void *)xipfs_part_##id, \
60  .execution_mutex = &execution_mutex_##id, \
61  .mutex = &mutex_##id \
62  }
63 
74 typedef struct vfs_xipfs_mount_s {
76  unsigned magic;
77  const char *mount_path;
78  size_t page_num;
79  void *page_addr;
83 
86 
104 int xipfs_construct_from_flashpage(mtd_flashpage_t *flashpage, const char *path,
105  mutex_t *execution_mutex, mutex_t *mutex,
106  vfs_xipfs_mount_t *vfs_xipfs_mount);
107 
108 /* Extended driver handling executables */
109 
124 int xipfs_extended_driver_new_file(const char *full_path, uint32_t size, uint32_t exec);
125 
136 int xipfs_extended_driver_execv(const char *full_path, char *const argv[]);
137 
138 #ifdef __cplusplus
139 }
140 #endif
141 
142 #endif /* FS_XIPFS_FS_H */
int xipfs_extended_driver_execv(const char *full_path, char *const argv[])
Executes an executable file with arguments.
const vfs_file_system_t xipfs_file_system
The xipfs vfs driver.
int xipfs_extended_driver_new_file(const char *full_path, uint32_t size, uint32_t exec)
Executable or regular new file.
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.
struct vfs_xipfs_mount_s vfs_xipfs_mount_t
xipfs descriptor for vfs integration
Interface definition for the flashpage memory driver.
Mutex for thread synchronization.
MTD flashpage descriptor.
Definition: mtd_flashpage.h:74
Mutex structure.
Definition: mutex.h:36
A file system driver.
Definition: vfs.h:386
A mounted file system.
Definition: vfs.h:396
xipfs descriptor for vfs integration
Definition: xipfs_fs.h:74
size_t page_num
number of flash page
Definition: xipfs_fs.h:78
mutex_t * mutex
For regular and deletion operations.
Definition: xipfs_fs.h:81
mutex_t * execution_mutex
For execution and deletion operations.
Definition: xipfs_fs.h:80
const char * mount_path
mount point path
Definition: xipfs_fs.h:77
unsigned magic
xipfs magic number
Definition: xipfs_fs.h:76
vfs_mount_t vfs_mp
VFS mount point
Definition: xipfs_fs.h:75
void * page_addr
first flash page address
Definition: xipfs_fs.h:79