Split the fuse FS driver into 2 parts: A top built in the embedded side, with the embedded libC, and a bottom built in the runner side with the host libC. The error returns are converted to match the host libC. Also, before the host FUSE thread, which is asynchronous to Zephyr was calling directly into the Zephyr filesystem code, which resulted quite often if catastrophic failures or corruption of the Zephyr state. This is now fixed by having the FUSE thread queue requests to a Zephyr thread, which will be handled in the embedded side in a coherent way. This adds a slightly noticeable overhead, but the performance is still acceptable. Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
52 lines
1.3 KiB
C
52 lines
1.3 KiB
C
/*
|
|
* Copyright (c) 2025 Nordic Semiconductor ASA
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef SUBSYS_FS_FUSE_FS_ACCESS_BOTTOM_H
|
|
#define SUBSYS_FS_FUSE_FS_ACCESS_BOTTOM_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define INVALID_FILE_HANDLE (INT32_MAX)
|
|
|
|
struct ffa_dirent {
|
|
bool is_directory;
|
|
char *name;
|
|
size_t size;
|
|
};
|
|
|
|
struct ffa_op_callbacks {
|
|
int (*stat)(const char *path, struct ffa_dirent *entry);
|
|
int (*readmount)(int *mnt_nbr, const char **mnt_name);
|
|
int (*readdir_start)(const char *path);
|
|
int (*readdir_read_next)(struct ffa_dirent *entry);
|
|
void (*readdir_end)(void);
|
|
int (*mkdir)(const char *path);
|
|
int (*create)(const char *path, uint64_t *fh);
|
|
int (*release)(uint64_t fh);
|
|
int (*read)(uint64_t fh, char *buf, size_t size, off_t off);
|
|
int (*write)(uint64_t fh, const char *buf, size_t size, off_t off);
|
|
int (*ftruncate)(uint64_t fh, off_t size);
|
|
int (*truncate)(const char *path, off_t size);
|
|
int (*unlink)(const char *path);
|
|
int (*rmdir)(const char *path);
|
|
};
|
|
|
|
void ffsa_init_bottom(const char *fuse_mountpoint, struct ffa_op_callbacks *op_cbs);
|
|
void ffsa_cleanup_bottom(const char *fuse_mountpoint);
|
|
|
|
bool ffa_is_op_pended(void);
|
|
void ffa_run_pending_op(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* SUBSYS_FS_FUSE_FS_ACCESS_BOTTOM_H */
|