aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-02 11:30:43 -0700
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-02 13:56:40 -0700
commit5698ee09cf7a8495da70659ffae1eaec9f57db27 (patch)
tree798a58a4f49d7f82e3f948463daad4405173483e /include
parentf164e9b8ca319dd1279384ff495b5fa91e778d9e (diff)
Turn struct fuse_chan into an implementation detail
The only struct fuse_chan that's accessible to the user application is the "master" channel that is returned by fuse_mount and stored in struct fuse_session. When using the multi-threaded main loop with the "clone_fd" option, each worker thread gets its own struct fuse_chan. However, none of these are available to the user application, nor do they hold references to struct fuse_session (the pointer is always null). Therefore, any presence of struct fuse_chan can be removed without loss of functionality by relying on struct fuse_session instead. This reduces the number of API functions and removes a potential source of confusion (since the new API no longer looks as if it might be possible to add multiple channels to one session, or to share one channel between multiple sessions). Fixes issue #17.
Diffstat (limited to 'include')
-rw-r--r--include/fuse.h43
-rw-r--r--include/fuse_common.h1
-rw-r--r--include/fuse_lowlevel.h99
3 files changed, 34 insertions, 109 deletions
diff --git a/include/fuse.h b/include/fuse.h
index 948442c..c3fea2d 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -640,55 +640,44 @@ struct fuse_context {
/**
* Create a new FUSE filesystem.
*
- * Known parameters in `args` are removed. If there are any unknown
- * arguments, an error is printed to stderr and the function returns
+ * Known arguments are defined in `struct fuse_opt fuse_lib_opts[]`,
+ * `struct fuse_opt fuse_mount_opts[]`, and `struct fuse_opt
+ * fuse_ll_opts[]`. If there are any unknown arguments, an error
+ * message will be printed to stderr and the function will return
* NULL.
*
* If the --help or --version parameters are specified, the function
* prints the requested information to stdout and returns NULL.
*
- * @param ch the communication channel
* @param args argument vector
* @param op the filesystem operations
* @param op_size the size of the fuse_operations structure
* @param user_data user data supplied in the context during the init() method
* @return the created FUSE handle
*/
-struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args,
- const struct fuse_operations *op, size_t op_size,
- void *user_data);
+struct fuse *fuse_new(struct fuse_args *args, const struct fuse_operations *op,
+ size_t op_size, void *user_data);
/**
- * Create a FUSE mountpoint
- *
- * Returns a control file descriptor suitable for passing to
- * fuse_new(). Unknown parameters in `args` are passed through
- * unchanged. Known parameters (with the exception of --help and
- * --version) are removed from `args`.
- *
- * If the --help or --version parameters are specified, the function
- * prints the requested information to stdout and returns a valid
- * pointer. However, it does not actually perform the mount.
+ * Mount a FUSE file system.
*
* @param mountpoint the mount point path
- * @param args argument vector
- * @return the communication channel on success, NULL on failure
- */
-struct fuse_chan *fuse_mount(const char *mountpoint, struct fuse_args *args);
+ * @param f the FUSE handle
+ *
+ * @return 0 on success, -1 on failure.
+ **/
+int fuse_mount(struct fuse *f, const char *mountpoint);
/**
- * Umount a FUSE mountpoint
+ * Unmount a FUSE file system.
*
- * @param mountpoint the mount point path
- * @param ch the communication channel
- */
-void fuse_unmount(const char *mountpoint, struct fuse_chan *ch);
+ * @param f the FUSE handle
+ **/
+void fuse_unmount(struct fuse *f);
/**
* Destroy the FUSE handle.
*
- * The communication channel attached to the handle is also destroyed.
- *
* NOTE: This function does not unmount the filesystem. If this is
* needed, call fuse_unmount() before calling this function.
*
diff --git a/include/fuse_common.h b/include/fuse_common.h
index bab2a5b..f39dab3 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -206,7 +206,6 @@ struct fuse_conn_info {
};
struct fuse_session;
-struct fuse_chan;
struct fuse_pollhandle;
/**
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
index 9656c98..f0f0e0b 100644
--- a/include/fuse_lowlevel.h
+++ b/include/fuse_lowlevel.h
@@ -56,14 +56,6 @@ typedef struct fuse_req *fuse_req_t;
*/
struct fuse_session;
-/**
- * Channel
- *
- * A communication channel, providing hooks for sending and receiving
- * messages
- */
-struct fuse_chan;
-
/** Directory entry parameters supplied to fuse_reply_entry() */
struct fuse_entry_param {
/** Unique inode number
@@ -1573,30 +1565,15 @@ int fuse_req_interrupted(fuse_req_t req);
* ----------------------------------------------------------- */
/**
- * Create a FUSE mountpoint
- *
- * Returns a control file descriptor suitable for passing to
- * fuse_new(). Unknown parameters in `args` are passed through
- * unchanged. Known parameters (with the exception of --help and
- * --version) are removed from `args`.
+ * Create a low level session.
*
- * If the --help or --version parameters are specified, the function
- * prints the requested information to stdout and returns a valid
- * pointer. However, it does not actually perform the mount.
- *
- * @param mountpoint the mount point path
- * @param args argument vector
- * @return the communication channel on success, NULL on failure
- */
-struct fuse_chan *fuse_session_mount(const char *mountpoint,
- struct fuse_args *args);
-
-/**
- * Create a low level session
+ * Returns a session structure suitable for passing to
+ * fuse_session_mount() and fuse_session_loop().
*
- * Known parameters in `args` are removed. If there are any unknown
- * arguments, an error is printed to stderr and the function returns
- * NULL.
+ * Known arguments are defined in `struct fuse_opt fuse_ll_opts[]` and
+ * `struct fuse_opt fuse_mount_opts[]`. If there are any unknown
+ * arguments, an error message will be printed to stderr and the
+ * function will return NULL.
*
* If the --help or --version parameters are specified, the function
* prints the requsted information to stdout and returns NULL.
@@ -1616,14 +1593,14 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
size_t op_size, void *userdata);
/**
- * Assign a channel to a session
+ * Mount a FUSE file system.
*
- * If a session is destroyed, the assigned channel is also destroyed
+ * @param mountpoint the mount point path
+ * @param se session object
*
- * @param se the session
- * @param ch the channel
- */
-void fuse_session_add_chan(struct fuse_session *se, struct fuse_chan *ch);
+ * @return 0 on success, -1 on failure.
+ **/
+int fuse_session_mount(struct fuse_session *se, const char *mountpoint);
/**
* Enter a single threaded, blocking event loop.
@@ -1672,13 +1649,11 @@ void fuse_session_reset(struct fuse_session *se);
int fuse_session_exited(struct fuse_session *se);
/**
- * Remove the channel from a session
+ * Unmount the file system
*
- * If the channel is not assigned to a session, then this is a no-op
- *
- * @param ch the channel to remove
+ * @param se the session
*/
-void fuse_session_remove_chan(struct fuse_chan *ch);
+void fuse_session_unmount(struct fuse_session *se);
/**
* Destroy a session
@@ -1687,15 +1662,6 @@ void fuse_session_remove_chan(struct fuse_chan *ch);
*/
void fuse_session_destroy(struct fuse_session *se);
-/**
- * Umount a FUSE mountpoint
- *
- * @param mountpoint the mount point path
- * @param ch the communication channel
- */
-void fuse_session_unmount(const char *mountpoint, struct fuse_chan *ch);
-
-
/* ----------------------------------------------------------- *
* Request processing (for custom event loops) *
* ----------------------------------------------------------- */
@@ -1710,7 +1676,7 @@ void fuse_session_unmount(const char *mountpoint, struct fuse_chan *ch);
* @param ch channel on which the request was received
*/
void fuse_session_process_buf(struct fuse_session *se,
- const struct fuse_buf *buf, struct fuse_chan *ch);
+ const struct fuse_buf *buf);
/**
* Receive a raw request supplied in a generic buffer
@@ -1723,36 +1689,7 @@ void fuse_session_process_buf(struct fuse_session *se,
* @param ch the channel
* @return the actual size of the raw request, or -errno on error
*/
-int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf,
- struct fuse_chan *ch);
-
-/* ----------------------------------------------------------- *
- * Channel interface *
- * ----------------------------------------------------------- */
-
-/**
- * Return channel assigned to the session
- *
- * @param se the session
- * @return the channel
- */
-struct fuse_chan *fuse_session_chan(struct fuse_session *se);
-
-
-/**
- * Obtain counted reference to the channel
- *
- * @param ch the channel
- * @return the channel
- */
-struct fuse_chan *fuse_chan_get(struct fuse_chan *ch);
-
-/**
- * Drop counted reference to a channel
- *
- * @param ch the channel
- */
-void fuse_chan_put(struct fuse_chan *ch);
+int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf);
#ifdef __cplusplus
}