diff options
author | Alessio Balsini <balsini@google.com> | 2021-10-27 21:11:25 +0100 |
---|---|---|
committer | Paul Lawrence <paullawrence@google.com> | 2021-11-16 19:47:04 +0000 |
commit | 7e5a12d6de30f111d8eff8c669c9b6ed074fa583 (patch) | |
tree | 0cab7dc8faceb97b5ac2ffa27ef996ec5a9118af /include | |
parent | 7a5210792c659ac565d1853d21eb1b6f00f2094d (diff) | |
download | libfuse-7e5a12d6de30f111d8eff8c669c9b6ed074fa583.tar.gz |
Support fuse-bpf
Add struct fuse_args
Introduce bpf_arg in fuse_reply_entry
Currently, the opcode filters are zeroed to preserve the libfuse
compatibility.
Bug: 202785178
Test: Along with other changes, file
/sys/fs/bpf/prog_fuse_media_fuse_media
appears.
Signed-off-by: Alessio Balsini <balsini@google.com>
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I38cd80d702813f4e2b45d69af2ca451fca0984c6
Diffstat (limited to 'include')
-rw-r--r-- | include/fuse_kernel.h | 58 | ||||
-rw-r--r-- | include/fuse_lowlevel.h | 4 |
2 files changed, 62 insertions, 0 deletions
diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h index bd8794e..2c8e141 100644 --- a/include/fuse_kernel.h +++ b/include/fuse_kernel.h @@ -457,6 +457,17 @@ struct fuse_entry_out { struct fuse_attr attr; }; +#define FUSE_ACTION_KEEP 0 +#define FUSE_ACTION_REMOVE 1 +#define FUSE_ACTION_REPLACE 2 + +struct fuse_entry_bpf_out { + uint64_t backing_action; + uint64_t backing_fd; + uint64_t bpf_action; + uint64_t bpf_fd; +}; + struct fuse_forget_in { uint64_t nlookup; }; @@ -859,4 +870,51 @@ struct fuse_copy_file_range_in { uint64_t flags; }; +/** Export fuse_args only for bpf */ +#ifdef __KERNEL__ +struct fuse_mount; + +/** One input argument of a request */ +struct fuse_in_arg { + unsigned size; + const void *value; +}; + +/** One output argument of a request */ +struct fuse_arg { + unsigned size; + void *value; +}; + +struct fuse_args { + uint64_t nodeid; + uint32_t opcode; + unsigned short in_numargs; + unsigned short out_numargs; + int force:1; + int noreply:1; + int nocreds:1; + int in_pages:1; + int out_pages:1; + int out_argvar:1; + int page_zeroing:1; + int page_replace:1; + int may_block:1; + struct fuse_in_arg in_args[5]; + struct fuse_arg out_args[3]; + void (*end)(struct fuse_mount *fm, struct fuse_args *args, int error); + + /* Path used for completing d_canonical_path */ + struct path *canonical_path; +}; +#endif + +#define FUSE_BPF_USER_FILTER 1 +#define FUSE_BPF_BACKING 2 +#define FUSE_BPF_POST_FILTER 4 + +#define FUSE_OPCODE_FILTER 0x0ffff +#define FUSE_PREFILTER 0x10000 +#define FUSE_POSTFILTER 0x20000 + #endif /* _LINUX_FUSE_H */ diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index e916112..d203157 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -98,6 +98,10 @@ struct fuse_entry_param { that come through the kernel, this should be set to a very large value. */ double entry_timeout; + uint64_t backing_action; + uint64_t backing_fd; + uint64_t bpf_action; + uint64_t bpf_fd; }; /** |