diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/fuse_common.h | 17 | ||||
-rw-r--r-- | include/fuse_kernel.h | 76 | ||||
-rw-r--r-- | include/fuse_lowlevel.h | 30 |
3 files changed, 121 insertions, 2 deletions
diff --git a/include/fuse_common.h b/include/fuse_common.h index ea4bdb0..3f836d7 100644 --- a/include/fuse_common.h +++ b/include/fuse_common.h @@ -92,6 +92,11 @@ struct fuse_file_info { * same file handle. */ uint64_t fh; + /** Passthrough file handle id. May be filled in by filesystem in + * create and open. It is used to create a passthrough connection + * between FUSE file and lower file system file. */ + uint32_t passthrough_fh; + /** Lock owner id. Available in locking operations and flush */ uint64_t lock_owner; @@ -395,6 +400,18 @@ struct fuse_loop_config { #define FUSE_CAP_EXPLICIT_INVAL_DATA (1 << 25) /** + * Indicates support for passthrough mode access for read/write operations. + * + * If this flag is set in the `capable` field of the `fuse_conn_info` + * structure, then the FUSE kernel module supports redirecting read/write + * operations to the lower file system instead of letting them to be handled + * by the FUSE daemon. + * + * This feature is disabled by default. + */ +#define FUSE_CAP_PASSTHROUGH (1 << 31) + +/** * Ioctl flags * * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h index 018a00a..70278fa 100644 --- a/include/fuse_kernel.h +++ b/include/fuse_kernel.h @@ -301,6 +301,7 @@ struct fuse_file_lock { #define FUSE_CACHE_SYMLINKS (1 << 23) #define FUSE_NO_OPENDIR_SUPPORT (1 << 24) #define FUSE_EXPLICIT_INVAL_DATA (1 << 25) +#define FUSE_PASSTHROUGH (1 << 31) /** * CUSE INIT request/reply flags @@ -423,6 +424,9 @@ enum fuse_opcode { FUSE_LSEEK = 46, FUSE_COPY_FILE_RANGE = 47, + /* Android specific operations */ + FUSE_CANONICAL_PATH = 2016, + /* CUSE specific operations */ CUSE_INIT = 4096 }; @@ -453,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; }; @@ -544,7 +559,7 @@ struct fuse_create_in { struct fuse_open_out { uint64_t fh; uint32_t open_flags; - uint32_t padding; + uint32_t passthrough_fh; }; struct fuse_release_in { @@ -571,6 +586,13 @@ struct fuse_read_in { uint32_t padding; }; +struct fuse_passthrough_out_v0 { + uint32_t fd; + /* For future implementation */ + uint32_t len; + void * vec; +}; + #define FUSE_COMPAT_WRITE_IN_SIZE 24 struct fuse_write_in { @@ -822,7 +844,10 @@ struct fuse_notify_retrieve_in { }; /* Device ioctls: */ -#define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t) +#define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t) +#define FUSE_DEV_IOC_PASSTHROUGH_OPEN_V0 _IOW(229, 1, struct fuse_passthrough_out_v0) +#define FUSE_DEV_IOC_PASSTHROUGH_OPEN_V1 _IOW(229, 127, struct fuse_passthrough_out_v0) +#define FUSE_DEV_IOC_PASSTHROUGH_OPEN_V2 _IOW(229, 126, uint32_t) struct fuse_lseek_in { uint64_t fh; @@ -845,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 d73e9fa..c591f71 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; }; /** @@ -317,6 +321,18 @@ struct fuse_lowlevel_ops { */ void (*readlink) (fuse_req_t req, fuse_ino_t ino); + /** + * Return canonical path for inotify + * + * Valid replies: + * fuse_reply_canonical_path + * fuse_reply_err + * + * @param req request handle + * @param ino the inode number + */ + void (*canonical_path) (fuse_req_t req, fuse_ino_t ino); + /** * Create file node * @@ -1343,6 +1359,20 @@ int fuse_reply_attr(fuse_req_t req, const struct stat *attr, */ int fuse_reply_readlink(fuse_req_t req, const char *link); +int fuse_passthrough_enable(fuse_req_t req, unsigned int fd); + +/** + * Reply with the canonical path for inotify + * + * Possible requests: + * canonical_path + * + * @param req request handle + * @param path to canonicalize + * @return zero for success, -errno for failure to send reply + */ +int fuse_reply_canonical_path(fuse_req_t req, const char *path); + /** * Reply with open parameters * |