1 /*
2  * Copyright (c) 2025 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef SUBSYS_FS_FUSE_FS_ACCESS_BOTTOM_H
8 #define SUBSYS_FS_FUSE_FS_ACCESS_BOTTOM_H
9 
10 #include <stdint.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 #define INVALID_FILE_HANDLE (INT32_MAX)
17 
18 struct ffa_dirent {
19 	bool is_directory;
20 	char *name;
21 	size_t size;
22 };
23 
24 struct ffa_op_callbacks {
25 	int (*stat)(const char *path, struct ffa_dirent *entry);
26 	int (*readmount)(int *mnt_nbr, const char **mnt_name);
27 	int (*readdir_start)(const char *path);
28 	int (*readdir_read_next)(struct ffa_dirent *entry);
29 	void (*readdir_end)(void);
30 	int (*mkdir)(const char *path);
31 	int (*create)(const char *path, uint64_t *fh);
32 	int (*release)(uint64_t fh);
33 	int (*read)(uint64_t fh, char *buf, size_t size, off_t off);
34 	int (*write)(uint64_t fh, const char *buf, size_t size, off_t off);
35 	int (*ftruncate)(uint64_t fh, off_t size);
36 	int (*truncate)(const char *path, off_t size);
37 	int (*unlink)(const char *path);
38 	int (*rmdir)(const char *path);
39 };
40 
41 void ffsa_init_bottom(const char *fuse_mountpoint, struct ffa_op_callbacks *op_cbs);
42 void ffsa_cleanup_bottom(const char *fuse_mountpoint);
43 
44 bool ffa_is_op_pended(void);
45 void ffa_run_pending_op(void);
46 
47 #ifdef __cplusplus
48 }
49 #endif
50 
51 #endif /* SUBSYS_FS_FUSE_FS_ACCESS_BOTTOM_H */
52