aboutsummaryrefslogtreecommitdiff
path: root/kernel/fuse_i.h
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <miklos@szeredi.hu>2004-06-19 22:42:38 +0000
committerGravatar Miklos Szeredi <miklos@szeredi.hu>2004-06-19 22:42:38 +0000
commit7eafccef7f5788e54efa5318d9f5af13a0cbd291 (patch)
tree0b813ada0adf19ae9971f15c347de85b34a69de6 /kernel/fuse_i.h
parent152f29edc452f36210c1a8e0e0d648ac08fbf1bc (diff)
pre-allocate request structures
Diffstat (limited to 'kernel/fuse_i.h')
-rw-r--r--kernel/fuse_i.h164
1 files changed, 95 insertions, 69 deletions
diff --git a/kernel/fuse_i.h b/kernel/fuse_i.h
index d5943a9..f9daa7e 100644
--- a/kernel/fuse_i.h
+++ b/kernel/fuse_i.h
@@ -62,60 +62,6 @@ permission checking is done in the kernel */
than for small. */
#define FUSE_LARGE_READ (1 << 3)
-/**
- * A Fuse connection.
- *
- * This structure is created, when the client device is opened, and is
- * destroyed, when the client device is closed _and_ the filesystem is
- * unmounted.
- */
-struct fuse_conn {
- /** The superblock of the mounted filesystem */
- struct super_block *sb;
-
- /** The opened client device */
- struct file *file;
-
- /** The user id for this mount */
- uid_t uid;
-
- /** The fuse mount flags for this mount */
- unsigned int flags;
-
- /** Readers of the connection are waiting on this */
- wait_queue_head_t waitq;
-
- /** The list of pending requests */
- struct list_head pending;
-
- /** The list of requests being processed */
- struct list_head processing;
-
- /** Controls the maximum number of outstanding requests */
- struct semaphore outstanding;
-
- /** The next unique request id */
- int reqctr;
-
- /** Is fsync not implemented by fs? */
- unsigned int no_fsync : 1;
-
- /** Is flush not implemented by fs? */
- unsigned int no_flush : 1;
-
- /** Is setxattr not implemented by fs? */
- unsigned int no_setxattr : 1;
-
- /** Is getxattr not implemented by fs? */
- unsigned int no_getxattr : 1;
-
- /** Is listxattr not implemented by fs? */
- unsigned int no_listxattr : 1;
-
- /** Is removexattr not implemented by fs? */
- unsigned int no_removexattr : 1;
-};
-
/** One input argument of a request */
struct fuse_in_arg {
unsigned int size;
@@ -143,12 +89,10 @@ struct fuse_out {
struct fuse_out_arg args[3];
};
-#define FUSE_IN_INIT { {0, 0, 0, current->fsuid, current->fsgid}, 0}
-#define FUSE_OUT_INIT { {0, 0}, 0, 0}
-
struct fuse_req;
-typedef void (*fuse_reqend_t)(struct fuse_conn *, struct fuse_in *,
- struct fuse_out *, void *data);
+struct fuse_conn;
+
+typedef void (*fuse_reqend_t)(struct fuse_conn *, struct fuse_req *);
/**
* A request to the client
@@ -170,13 +114,13 @@ struct fuse_req {
unsigned int sent:1;
/* The request is finished */
- unsigned int finished:1;
+ unsigned int finished;
/** The request input */
- struct fuse_in *in;
+ struct fuse_in in;
/** The request output */
- struct fuse_out *out;
+ struct fuse_out out;
/** Used to wake up the task waiting for completion of request*/
wait_queue_head_t waitq;
@@ -186,6 +130,70 @@ struct fuse_req {
/** User data */
void *data;
+
+ /** Data for asynchronous requests */
+ union {
+ struct fuse_write_in write_in;
+ struct fuse_open_in open_in;
+ struct fuse_forget_in forget_in;
+ } misc;
+};
+
+/**
+ * A Fuse connection.
+ *
+ * This structure is created, when the client device is opened, and is
+ * destroyed, when the client device is closed _and_ the filesystem is
+ * unmounted.
+ */
+struct fuse_conn {
+ /** The superblock of the mounted filesystem */
+ struct super_block *sb;
+
+ /** The opened client device */
+ struct file *file;
+
+ /** The user id for this mount */
+ uid_t uid;
+
+ /** The fuse mount flags for this mount */
+ unsigned int flags;
+
+ /** Readers of the connection are waiting on this */
+ wait_queue_head_t waitq;
+
+ /** The list of pending requests */
+ struct list_head pending;
+
+ /** The list of requests being processed */
+ struct list_head processing;
+
+ /** Controls the maximum number of outstanding requests */
+ struct semaphore unused_sem;
+
+ /** The list of unused requests */
+ struct list_head unused_list;
+
+ /** The next unique request id */
+ int reqctr;
+
+ /** Is fsync not implemented by fs? */
+ unsigned int no_fsync : 1;
+
+ /** Is flush not implemented by fs? */
+ unsigned int no_flush : 1;
+
+ /** Is setxattr not implemented by fs? */
+ unsigned int no_setxattr : 1;
+
+ /** Is getxattr not implemented by fs? */
+ unsigned int no_getxattr : 1;
+
+ /** Is listxattr not implemented by fs? */
+ unsigned int no_listxattr : 1;
+
+ /** Is removexattr not implemented by fs? */
+ unsigned int no_removexattr : 1;
};
struct fuse_getdir_out_i {
@@ -251,24 +259,42 @@ int fuse_fs_init(void);
*/
void fuse_fs_cleanup(void);
+
+/**
+ * Reserve a request
+ */
+struct fuse_req *fuse_get_request(struct fuse_conn *fc);
+
+/**
+ * Reserve a request, non-iterruptable
+ */
+struct fuse_req *fuse_get_request_nonint(struct fuse_conn *fc);
+
+/**
+ * Reserve a request, non-blocking
+ */
+struct fuse_req *fuse_get_request_nonblock(struct fuse_conn *fc);
+
+/**
+ * Free a request
+ */
+void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req);
+
/**
* Send a request
- *
*/
-void request_send(struct fuse_conn *fc, struct fuse_in *in,
- struct fuse_out *out);
+void request_send(struct fuse_conn *fc, struct fuse_req *req);
/**
* Send a request for which a reply is not expected
*/
-int request_send_noreply(struct fuse_conn *fc, struct fuse_in *in);
-
+void request_send_noreply(struct fuse_conn *fc, struct fuse_req *req);
/**
* Send a synchronous request without blocking
*/
-int request_send_nonblock(struct fuse_conn *fc, struct fuse_in *in,
- struct fuse_out *out, fuse_reqend_t end, void *data);
+void request_send_nonblock(struct fuse_conn *fc, struct fuse_req *req,
+ fuse_reqend_t end, void *data);
/**
* Get the attributes of a file