libfuse: clean up fuse_session
[fuse.git] / lib / fuse_i.h
blobc205fa8cde051c771b2bfc72b659c1213089c9e7
1 /*
2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
5 This program can be distributed under the terms of the GNU LGPLv2.
6 See the file COPYING.LIB
7 */
9 #include "fuse.h"
10 #include "fuse_lowlevel.h"
12 struct fuse_chan;
13 struct fuse_ll;
15 struct fuse_session {
16 int (*receive_buf)(struct fuse_session *se, struct fuse_buf *buf,
17 struct fuse_chan **chp);
19 void (*process_buf)(void *data, const struct fuse_buf *buf,
20 struct fuse_chan *ch);
22 void (*destroy) (void *data);
24 void *data;
26 volatile int exited;
28 struct fuse_chan *ch;
31 struct fuse_req {
32 struct fuse_ll *f;
33 uint64_t unique;
34 int ctr;
35 pthread_mutex_t lock;
36 struct fuse_ctx ctx;
37 struct fuse_chan *ch;
38 int interrupted;
39 unsigned int ioctl_64bit : 1;
40 union {
41 struct {
42 uint64_t unique;
43 } i;
44 struct {
45 fuse_interrupt_func_t func;
46 void *data;
47 } ni;
48 } u;
49 struct fuse_req *next;
50 struct fuse_req *prev;
53 struct fuse_notify_req {
54 uint64_t unique;
55 void (*reply)(struct fuse_notify_req *, fuse_req_t, fuse_ino_t,
56 const void *, const struct fuse_buf *);
57 struct fuse_notify_req *next;
58 struct fuse_notify_req *prev;
61 struct fuse_ll {
62 int debug;
63 int allow_root;
64 int atomic_o_trunc;
65 int no_remote_posix_lock;
66 int no_remote_flock;
67 int big_writes;
68 int splice_write;
69 int splice_move;
70 int splice_read;
71 int no_splice_write;
72 int no_splice_move;
73 int no_splice_read;
74 int auto_inval_data;
75 int no_auto_inval_data;
76 int no_readdirplus;
77 int no_readdirplus_auto;
78 struct fuse_lowlevel_ops op;
79 int got_init;
80 struct cuse_data *cuse_data;
81 void *userdata;
82 uid_t owner;
83 struct fuse_conn_info conn;
84 struct fuse_req list;
85 struct fuse_req interrupts;
86 pthread_mutex_t lock;
87 int got_destroy;
88 pthread_key_t pipe_key;
89 int broken_splice_nonblock;
90 uint64_t notify_ctr;
91 struct fuse_notify_req notify_list;
94 struct fuse_chan *fuse_kern_chan_new(int fd);
96 int fuse_chan_clearfd(struct fuse_chan *ch);
98 /**
99 * Create a new session
101 * @param data user data
102 * @return new session object, or NULL on failure
104 struct fuse_session *fuse_session_new(void *data);
107 * Get the user data provided to the session
109 * @param se the session
110 * @return the user data
112 void *fuse_session_data(struct fuse_session *se);
115 void fuse_kern_unmount(const char *mountpoint, int fd);
116 int fuse_kern_mount(const char *mountpoint, struct fuse_args *args);
118 int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
119 int count);
120 void fuse_free_req(fuse_req_t req);
122 void cuse_lowlevel_init(fuse_req_t req, fuse_ino_t nodeide, const void *inarg);
124 int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg);