diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-12-25 04:05:54 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-12-25 05:13:02 +0900 |
| commit | 7bfbd5981025282007f09225e22e895523d7a7bf (patch) | |
| tree | 14e4ea7475ab63c8fa22845d287a307fb029c110 /cmd/sharefs/fuse-helper.h | |
| parent | ea815a59e85a5acad8e22e98a16cdc6de1323824 (diff) | |
cmd/sharefs: implement shared filesystem
This is for passing files between applications, similar to android /sdcard.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd/sharefs/fuse-helper.h')
| -rw-r--r-- | cmd/sharefs/fuse-helper.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/cmd/sharefs/fuse-helper.h b/cmd/sharefs/fuse-helper.h new file mode 100644 index 00000000..fdcd1d5e --- /dev/null +++ b/cmd/sharefs/fuse-helper.h @@ -0,0 +1,29 @@ +#define FUSE_USE_VERSION FUSE_MAKE_VERSION(3, 4) +#include <fuse.h> +#include <fuse_lowlevel.h> /* for fuse_cmdline_help */ + +#if (FUSE_VERSION < FUSE_MAKE_VERSION(3, 4)) +#error This package requires libfuse >= v3.4 +#endif + +/* sharefs_private is populated by sharefs_init and contains process-wide context */ +struct sharefs_private { + int dirfd; /* source dirfd opened during sharefs_init */ +}; + +int sharefs_getattr(const char *pathname, struct stat *statbuf, struct fuse_file_info *fi); +int sharefs_readlink(const char *pathname, char *buf, size_t bufsiz); +int sharefs_readdir(const char *pathname, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi, enum fuse_readdir_flags flags); +int sharefs_mkdir(const char *pathname, mode_t mode); +int sharefs_unlink(const char *pathname); +int sharefs_rmdir(const char *pathname); +int sharefs_rename(const char *oldpath, const char *newpath, unsigned int flags); +int sharefs_truncate(const char *pathname, off_t length, struct fuse_file_info *fi); +int sharefs_utimens(const char *pathname, const struct timespec times[2], struct fuse_file_info *fi); +int sharefs_create(const char *pathname, mode_t mode, struct fuse_file_info *fi); +int sharefs_open(const char *pathname, struct fuse_file_info *fi); +int sharefs_read(const char *pathname, char *buf, size_t count, off_t offset, struct fuse_file_info *fi); +int sharefs_write(const char *pathname, const char *buf, size_t count, off_t offset, struct fuse_file_info *fi); +int sharefs_statfs(const char *pathname, struct statvfs *statbuf); +int sharefs_release(const char *pathname, struct fuse_file_info *fi); +int sharefs_fsync(const char *pathname, int datasync, struct fuse_file_info *fi); |
