diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/fuse_lowlevel.h | 198 |
1 files changed, 9 insertions, 189 deletions
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index ada5ce8..6075b03 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -1578,61 +1578,8 @@ struct fuse_session *fuse_lowlevel_new(struct fuse_args *args, * ----------------------------------------------------------- */ /** - * Session operations - * - * This is used in session creation - */ -struct fuse_session_ops { - /** - * Hook to process a request (mandatory) - * - * @param data user data passed to fuse_session_new() - * @param buf buffer containing the raw request - * @param len request length - * @param ch channel on which the request was received - */ - void (*process) (void *data, const char *buf, size_t len, - struct fuse_chan *ch); - - /** - * Hook for session exit and reset (optional) - * - * @param data user data passed to fuse_session_new() - * @param val exited status (1 - exited, 0 - not exited) - */ - void (*exit) (void *data, int val); - - /** - * Hook for querying the current exited status (optional) - * - * @param data user data passed to fuse_session_new() - * @return 1 if exited, 0 if not exited - */ - int (*exited) (void *data); - - /** - * Hook for cleaning up the channel on destroy (optional) - * - * @param data user data passed to fuse_session_new() - */ - void (*destroy) (void *data); -}; - -/** - * Create a new session - * - * @param op session operations - * @param data user data - * @return new session object, or NULL on failure - */ -struct fuse_session *fuse_session_new(struct fuse_session_ops *op, void *data); - -/** * Assign a channel to a session * - * Note: currently only a single channel may be assigned. This may - * change in the future - * * If a session is destroyed, the assigned channel is also destroyed * * @param se the session @@ -1641,7 +1588,7 @@ 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); /** - * Remove a channel from a session + * Remove the channel from a session * * If the channel is not assigned to a session, then this is a no-op * @@ -1650,35 +1597,17 @@ void fuse_session_add_chan(struct fuse_session *se, struct fuse_chan *ch); void fuse_session_remove_chan(struct fuse_chan *ch); /** - * Iterate over the channels assigned to a session - * - * The iterating function needs to start with a NULL channel, and - * after that needs to pass the previously returned channel to the - * function. + * Return channel assigned to the session * * @param se the session - * @param ch the previous channel, or NULL - * @return the next channel, or NULL if no more channels exist - */ -struct fuse_chan *fuse_session_next_chan(struct fuse_session *se, - struct fuse_chan *ch); - -/** - * Process a raw request - * - * @param se the session - * @param buf buffer containing the raw request - * @param len request length - * @param ch channel on which the request was received + * @return the channel */ -void fuse_session_process(struct fuse_session *se, const char *buf, size_t len, - struct fuse_chan *ch); +struct fuse_chan *fuse_session_chan(struct fuse_session *se); /** * Process a raw request supplied in a generic buffer * - * This is a more generic version of fuse_session_process(). The - * fuse_buf may contain a memory buffer or a pipe file descriptor. + * The fuse_buf may contain a memory buffer or a pipe file descriptor. * * @param se the session * @param buf the fuse_buf containing the request @@ -1690,17 +1619,16 @@ void fuse_session_process_buf(struct fuse_session *se, /** * Receive a raw request supplied in a generic buffer * - * This is a more generic version of fuse_chan_recv(). The fuse_buf - * supplied to this function contains a suitably allocated memory + * The fuse_buf supplied to this function contains a suitably allocated memory * buffer. This may be overwritten with a file descriptor buffer. * * @param se the session * @param buf the fuse_buf to store the request in - * @param chp pointer to the channel + * @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 **chp); + struct fuse_chan *ch); /** * Destroy a session @@ -1734,17 +1662,9 @@ void fuse_session_reset(struct fuse_session *se); int fuse_session_exited(struct fuse_session *se); /** - * Get the user data provided to the session - * - * @param se the session - * @return the user data - */ -void *fuse_session_data(struct fuse_session *se); - -/** * Enter a single threaded, blocking event loop. * - * Using POSIX signals this event loop can be exited but the session + * Using POSIX signals this event loop can be exited but the session * needs to be configued by issuing: * fuse_set_signal_handlers() first. * @@ -1766,56 +1686,6 @@ int fuse_session_loop_mt(struct fuse_session *se); * ----------------------------------------------------------- */ /** - * Channel operations - * - * This is used in channel creation - */ -struct fuse_chan_ops { - /** - * Hook for receiving a raw request - * - * @param ch pointer to the channel - * @param buf the buffer to store the request in - * @param size the size of the buffer - * @return the actual size of the raw request, or -1 on error - */ - int (*receive)(struct fuse_chan **chp, char *buf, size_t size); - - /** - * Hook for sending a raw reply - * - * A return value of -ENOENT means, that the request was - * interrupted, and the reply was discarded - * - * @param ch the channel - * @param iov vector of blocks - * @param count the number of blocks in vector - * @return zero on success, -errno on failure - */ - int (*send)(struct fuse_chan *ch, const struct iovec iov[], - size_t count); - - /** - * Destroy the channel - * - * @param ch the channel - */ - void (*destroy)(struct fuse_chan *ch); -}; - -/** - * Create a new channel - * - * @param op channel operations - * @param fd file descriptor of the channel - * @param bufsize the minimal receive buffer size - * @param data user data - * @return the new channel object, or NULL on failure - */ -struct fuse_chan *fuse_chan_new(struct fuse_chan_ops *op, int fd, - size_t bufsize, void *data); - -/** * Query the file descriptor of the channel * * @param ch the channel @@ -1824,56 +1694,6 @@ struct fuse_chan *fuse_chan_new(struct fuse_chan_ops *op, int fd, int fuse_chan_fd(struct fuse_chan *ch); /** - * Query the minimal receive buffer size - * - * @param ch the channel - * @return the buffer size passed to fuse_chan_new() - */ -size_t fuse_chan_bufsize(struct fuse_chan *ch); - -/** - * Query the user data - * - * @param ch the channel - * @return the user data passed to fuse_chan_new() - */ -void *fuse_chan_data(struct fuse_chan *ch); - -/** - * Query the session to which this channel is assigned - * - * @param ch the channel - * @return the session, or NULL if the channel is not assigned - */ -struct fuse_session *fuse_chan_session(struct fuse_chan *ch); - -/** - * Receive a raw request - * - * A return value of -ENODEV means, that the filesystem was unmounted - * - * @param ch pointer to the channel - * @param buf the buffer to store the request in - * @param size the size of the buffer - * @return the actual size of the raw request, or -errno on error - */ -int fuse_chan_recv(struct fuse_chan **ch, char *buf, size_t size); - -/** - * Send a raw reply - * - * A return value of -ENOENT means, that the request was - * interrupted, and the reply was discarded - * - * @param ch the channel - * @param iov vector of blocks - * @param count the number of blocks in vector - * @return zero on success, -errno on failure - */ -int fuse_chan_send(struct fuse_chan *ch, const struct iovec iov[], - size_t count); - -/** * Destroy a channel * * @param ch the channel |