aboutsummaryrefslogtreecommitdiff
path: root/lib/fuse_i.h
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <mszeredi@suse.cz>2013-06-21 13:35:30 +0200
committerGravatar Miklos Szeredi <mszeredi@suse.cz>2013-06-21 13:35:30 +0200
commitf0dcdad3a608e1f946b3cb2cb87b98f79d56b60e (patch)
treec989fd9a8f573d1084bbde8fc0d38d8a358eda29 /lib/fuse_i.h
parentb13051ae4179a0fa7b7febda8cf9cece12a73119 (diff)
libfuse: clean up fuse_chan
Clean up fuse_chan related interfaces. Remove the following from the lowlevel library API: struct fuse_chan_ops; fuse_chan_new(); fuse_chan_session(); fuse_chan_recv(); fuse_chan_send();
Diffstat (limited to 'lib/fuse_i.h')
-rw-r--r--lib/fuse_i.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/lib/fuse_i.h b/lib/fuse_i.h
index c205fa8..245e175 100644
--- a/lib/fuse_i.h
+++ b/lib/fuse_i.h
@@ -12,6 +12,44 @@
struct fuse_chan;
struct fuse_ll;
+/**
+ * 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);
+};
+
struct fuse_session {
int (*receive_buf)(struct fuse_session *se, struct fuse_buf *buf,
struct fuse_chan **chp);
@@ -111,6 +149,50 @@ struct fuse_session *fuse_session_new(void *data);
*/
void *fuse_session_data(struct fuse_session *se);
+/**
+ * Create a new channel
+ *
+ * @param op channel operations
+ * @param fd file descriptor of the channel
+ * @param bufsize the minimal receive buffer size
+ * @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);
+
+/**
+ * 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);
+
+/**
+ * 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);
+
+/**
+ * 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);
void fuse_kern_unmount(const char *mountpoint, int fd);
int fuse_kern_mount(const char *mountpoint, struct fuse_args *args);