/**
* 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
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
*
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
+ * @return the channel
*/
-struct fuse_chan *fuse_session_next_chan(struct fuse_session *se,
- struct fuse_chan *ch);
+struct fuse_chan *fuse_session_chan(struct fuse_session *se);
/**
* Process a raw request
int res = 0;
struct timespec now;
time_t next_clean;
- struct fuse_chan *ch = fuse_session_next_chan(se, NULL);
+ struct fuse_chan *ch = fuse_session_chan(se);
size_t bufsize = fuse_chan_bufsize(ch);
char *buf = (char *) malloc(bufsize);
struct pollfd fds = {
int fuse_session_loop(struct fuse_session *se)
{
int res = 0;
- struct fuse_chan *ch = fuse_session_next_chan(se, NULL);
+ struct fuse_chan *ch = fuse_session_chan(se);
size_t bufsize = fuse_chan_bufsize(ch);
char *buf = (char *) malloc(bufsize);
if (!buf) {
memset(&mt, 0, sizeof(struct fuse_mt));
mt.se = se;
- mt.prevch = fuse_session_next_chan(se, NULL);
+ mt.prevch = fuse_session_chan(se);
mt.error = 0;
mt.numworker = 0;
mt.numavail = 0;
}
}
-struct fuse_chan *fuse_session_next_chan(struct fuse_session *se,
- struct fuse_chan *ch)
+struct fuse_chan *fuse_session_chan(struct fuse_session *se)
{
- assert(ch == NULL || ch == se->ch);
- if (ch == NULL)
- return se->ch;
- else
- return NULL;
+ return se->ch;
}
void fuse_session_process(struct fuse_session *se, const char *buf, size_t len,
fuse_session_loop;
fuse_session_loop_mt;
fuse_session_new;
- fuse_session_next_chan;
+ fuse_session_chan;
fuse_session_process;
fuse_session_reset;
fuse_opt_parse;
static void fuse_teardown(struct fuse *fuse, char *mountpoint)
{
struct fuse_session *se = fuse_get_session(fuse);
- struct fuse_chan *ch = fuse_session_next_chan(se, NULL);
+ struct fuse_chan *ch = fuse_session_chan(se);
fuse_remove_signal_handlers(se);
fuse_unmount(mountpoint, ch);
fuse_destroy(fuse);