diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/Makefile.am | 9 | ||||
-rw-r--r-- | include/fuse.h | 10 | ||||
-rw-r--r-- | include/fuse_common.h | 3 | ||||
-rw-r--r-- | include/fuse_lowlevel.h | 79 |
4 files changed, 79 insertions, 22 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index ee8a83c..8c33be5 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,6 +1,13 @@ ## Process this file with automake to produce Makefile.in fuseincludedir=$(includedir)/fuse -fuseinclude_HEADERS = fuse.h fuse_compat.h fuse_common.h fuse_lowlevel.h + +fuseinclude_HEADERS = \ + fuse.h \ + fuse_compat.h \ + fuse_common.h \ + fuse_lowlevel.h + include_HEADERS = old/fuse.h + noinst_HEADERS = fuse_kernel.h diff --git a/include/fuse.h b/include/fuse.h index ca96084..ca3797f 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -34,6 +34,12 @@ extern "C" { /** Handle for a FUSE filesystem */ struct fuse; +/** Structure containing a raw command */ +struct fuse_cmd; + +/** The lowlevel FUSE session */ +struct fuse_session; + /** Function to add an entry in a readdir() operation * * @param buf the buffer passed to the readdir() operation @@ -504,8 +510,8 @@ int fuse_exited(struct fuse *f); /** Set function which can be used to get the current context */ void fuse_set_getcontext_func(struct fuse_context *(*func)(void)); -/** Returns the lowlevel FUSE object */ -struct fuse_ll *fuse_get_lowlevel(struct fuse *f); +/** Returns the lowlevel FUSE session */ +struct fuse_session *fuse_get_session(struct fuse *f); /* ----------------------------------------------------------- * * Compatibility stuff * diff --git a/include/fuse_common.h b/include/fuse_common.h index 648d6e4..2af3ce9 100644 --- a/include/fuse_common.h +++ b/include/fuse_common.h @@ -53,7 +53,4 @@ struct fuse_file_info { unsigned int keep_cache : 1; }; -/** Structure containing a raw command */ -struct fuse_cmd; - #endif /* _FUSE_COMMON_H_ */ diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index 8b18959..4c1af83 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -19,6 +19,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <sys/statfs.h> +#include <sys/uio.h> #ifdef __cplusplus extern "C" { @@ -29,7 +30,9 @@ extern "C" { typedef unsigned long fuse_ino_t; typedef struct fuse_req *fuse_req_t; -struct fuse_ll; + +struct fuse_session; +struct fuse_chan; struct fuse_entry_param { fuse_ino_t ino; @@ -69,8 +72,8 @@ struct fuse_ctx { /* ------------------------------------------ */ -struct fuse_ll_operations { - void* (*init) (void *); +struct fuse_lowlevel_ops { + void (*init) (void *); void (*destroy)(void *); void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name); @@ -174,29 +177,73 @@ const struct fuse_ctx *fuse_req_ctx(fuse_req_t req); /* ------------------------------------------ */ -typedef void (*fuse_ll_processor_t)(struct fuse_ll *, struct fuse_cmd *, void *); +int fuse_lowlevel_is_lib_option(const char *opt); + +struct fuse_session *fuse_lowlevel_new(const char *opts, + const struct fuse_lowlevel_ops *op, + size_t op_size, void *userdata); + +struct fuse_chan *fuse_kern_chan_new(int fd); + +/* ------------------------------------------ */ + +struct fuse_session_ops { + void (*process) (void *data, const char *buf, size_t len, + struct fuse_chan *ch); + + void (*destroy) (void *data); +}; + +struct fuse_session *fuse_session_new(struct fuse_session_ops *op, void *data); + +void fuse_session_add_chan(struct fuse_session *se, struct fuse_chan *ch); + +struct fuse_chan *fuse_session_next_chan(struct fuse_session *se, + struct fuse_chan *ch); + +void fuse_session_process(struct fuse_session *se, const char *buf, size_t len, + struct fuse_chan *ch); -struct fuse_ll *fuse_ll_new(int fd, const char *opts, - const struct fuse_ll_operations *op, - size_t op_size, void *userdata); +void fuse_session_destroy(struct fuse_session *se); -void fuse_ll_destroy(struct fuse_ll *f); +void fuse_session_exit(struct fuse_session *se); + +void fuse_session_reset(struct fuse_session *se); + +int fuse_session_exited(struct fuse_session *se); + +int fuse_session_loop(struct fuse_session *se); + +int fuse_session_loop_mt(struct fuse_session *se); + +/* ------------------------------------------ */ + +struct fuse_chan_ops { + int (*receive)(struct fuse_chan *ch, char *buf, size_t size); + + int (*send)(struct fuse_chan *ch, const struct iovec iov[], + size_t count); + + void (*destroy)(struct fuse_chan *ch); +}; -int fuse_ll_is_lib_option(const char *opt); +struct fuse_chan *fuse_chan_new(struct fuse_chan_ops *op, int fd, + size_t bufsize, void *data); -int fuse_ll_loop(struct fuse_ll *f); +int fuse_chan_fd(struct fuse_chan *ch); -void fuse_ll_exit(struct fuse_ll *f); +size_t fuse_chan_bufsize(struct fuse_chan *ch); -int fuse_ll_exited(struct fuse_ll* f); +void *fuse_chan_data(struct fuse_chan *ch); -struct fuse_cmd *fuse_ll_read_cmd(struct fuse_ll *f); +struct fuse_session *fuse_chan_session(struct fuse_chan *ch); -void fuse_ll_process_cmd(struct fuse_ll *f, struct fuse_cmd *cmd); +int fuse_chan_receive(struct fuse_chan *ch, char *buf, size_t size); -int fuse_ll_loop_mt(struct fuse_ll *f); +int fuse_chan_send(struct fuse_chan *ch, const struct iovec iov[], + size_t count); -int fuse_ll_loop_mt_proc(struct fuse_ll *f, fuse_ll_processor_t proc, void *data); +void fuse_chan_destroy(struct fuse_chan *ch); /* ------------------------------------------ */ |