Loading...
Searching...
No Matches
xipfs_fs.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024 Université de Lille
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
22
23#ifndef FS_XIPFS_FS_H
24#define FS_XIPFS_FS_H
25
26#include "vfs.h"
27#include "mtd_flashpage.h"
28#include "mutex.h"
29#include "include/xipfs.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
50#define XIPFS_NEW_PARTITION(id, path, num) \
51 FLASH_WRITABLE_INIT(xipfs_part_##id, num); \
52 static mutex_t execution_mutex_##id = MUTEX_INIT; \
53 static mutex_t mutex_##id = MUTEX_INIT; \
54 static vfs_xipfs_mount_t id = { \
55 .vfs_mp = { \
56 .fs = &xipfs_file_system, \
57 .mount_point = path, \
58 }, \
59 .magic = XIPFS_MAGIC, \
60 .mount_path = path, \
61 .page_num = num, \
62 .page_addr = (void *)xipfs_part_##id, \
63 .execution_mutex = &execution_mutex_##id, \
64 .mutex = &mutex_##id \
65 }
66
86
89
107int xipfs_construct_from_flashpage(mtd_flashpage_t *flashpage, const char *path,
108 mutex_t *execution_mutex, mutex_t *mutex,
109 vfs_xipfs_mount_t *vfs_xipfs_mount);
110
111/* Extended driver handling executables */
112
127int xipfs_extended_driver_new_file(const char *full_path, uint32_t size, uint32_t exec);
128
139int xipfs_extended_driver_execv(const char *full_path, char *const argv[]);
140
141#ifdef __cplusplus
142}
143#endif
144
145#endif /* FS_XIPFS_FS_H */
struct vfs_mount_struct vfs_mount_t
struct vfs_mount_struct typedef
Definition vfs.h:374
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.
Mutex structure.
Definition mutex.h:39
A file system driver.
Definition vfs.h:389
xipfs descriptor for vfs integration
Definition xipfs_fs.h:77
size_t page_num
number of flash page
Definition xipfs_fs.h:81
mutex_t * mutex
For regular and deletion operations.
Definition xipfs_fs.h:84
mutex_t * execution_mutex
For execution and deletion operations.
Definition xipfs_fs.h:83
const char * mount_path
mount point path
Definition xipfs_fs.h:80
unsigned magic
xipfs magic number
Definition xipfs_fs.h:79
vfs_mount_t vfs_mp
VFS mount point.
Definition xipfs_fs.h:78
void * page_addr
first flash page address
Definition xipfs_fs.h:82