libfuse
fuse_i.h
1 /*
2  FUSE: Filesystem in Userspace
3  Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
4 
5  This program can be distributed under the terms of the GNU LGPLv2.
6  See the file COPYING.LIB
7 */
8 
9 #include "fuse.h"
10 #include "fuse_lowlevel.h"
11 
12 struct mount_opts;
13 
14 struct fuse_req {
15  struct fuse_session *se;
16  uint64_t unique;
17  int ctr;
18  pthread_mutex_t lock;
19  struct fuse_ctx ctx;
20  struct fuse_chan *ch;
21  int interrupted;
22  unsigned int ioctl_64bit : 1;
23  union {
24  struct {
25  uint64_t unique;
26  } i;
27  struct {
29  void *data;
30  } ni;
31  } u;
32  struct fuse_req *next;
33  struct fuse_req *prev;
34 };
35 
36 struct fuse_notify_req {
37  uint64_t unique;
38  void (*reply)(struct fuse_notify_req *, fuse_req_t, fuse_ino_t,
39  const void *, const struct fuse_buf *);
40  struct fuse_notify_req *next;
41  struct fuse_notify_req *prev;
42 };
43 
44 struct fuse_session {
45  char *mountpoint;
46  volatile int exited;
47  int fd;
48  struct mount_opts *mo;
49  int debug;
50  int deny_others;
51  struct fuse_lowlevel_ops op;
52  int got_init;
53  struct cuse_data *cuse_data;
54  void *userdata;
55  uid_t owner;
56  struct fuse_conn_info conn;
57  struct fuse_req list;
58  struct fuse_req interrupts;
59  pthread_mutex_t lock;
60  int got_destroy;
61  pthread_key_t pipe_key;
62  int broken_splice_nonblock;
63  uint64_t notify_ctr;
64  struct fuse_notify_req notify_list;
65  size_t bufsize;
66  int error;
67 };
68 
69 struct fuse_chan {
70  pthread_mutex_t lock;
71  int ctr;
72  int fd;
73 };
74 
82 struct fuse_module {
83  char *name;
84  fuse_module_factory_t factory;
85  struct fuse_module *next;
86  struct fusemod_so *so;
87  int ctr;
88 };
89 
98 #if FUSE_USE_VERSION >= FUSE_MAKE_VERSION(3, 12)
99 struct fuse_loop_config
100 {
101  /* verififier that a correct struct was was passed. This is especially
102  * needed, as versions below (3, 12) were using a public struct
103  * (now called fuse_loop_config_v1), which was hard to extend with
104  * additional parameters, without risking that file system implementations
105  * would not have noticed and might either pass uninitialized members
106  * or even too small structs.
107  * fuse_loop_config_v1 has clone_fd at this offset, which should be either 0
108  * or 1. v2 or even higher version just need to set a value here
109  * which not conflicting and very unlikely as having been set by
110  * file system implementation.
111  */
112  int version_id;
113 
118  int clone_fd;
131 
137  unsigned int max_threads;
138 };
139 #endif
140 
141 /* ----------------------------------------------------------- *
142  * Channel interface (when using -o clone_fd) *
143  * ----------------------------------------------------------- */
144 
151 struct fuse_chan *fuse_chan_get(struct fuse_chan *ch);
152 
158 void fuse_chan_put(struct fuse_chan *ch);
159 
160 struct mount_opts *parse_mount_opts(struct fuse_args *args);
161 void destroy_mount_opts(struct mount_opts *mo);
162 void fuse_mount_version(void);
163 unsigned get_max_read(struct mount_opts *o);
164 void fuse_kern_unmount(const char *mountpoint, int fd);
165 int fuse_kern_mount(const char *mountpoint, struct mount_opts *mo);
166 
167 int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
168  int count);
169 void fuse_free_req(fuse_req_t req);
170 
171 void cuse_lowlevel_init(fuse_req_t req, fuse_ino_t nodeide, const void *inarg);
172 
173 int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg);
174 
175 int fuse_session_receive_buf_int(struct fuse_session *se, struct fuse_buf *buf,
176  struct fuse_chan *ch);
177 void fuse_session_process_buf_int(struct fuse_session *se,
178  const struct fuse_buf *buf, struct fuse_chan *ch);
179 
180 struct fuse *fuse_new_31(struct fuse_args *args, const struct fuse_operations *op,
181  size_t op_size, void *private_data);
182 int fuse_loop_mt_312(struct fuse *f, struct fuse_loop_config *config);
183 int fuse_session_loop_mt_312(struct fuse_session *se, struct fuse_loop_config *config);
184 
190 int fuse_loop_cfg_verify(struct fuse_loop_config *config);
191 
192 
193 #define FUSE_MAX_MAX_PAGES 256
194 #define FUSE_DEFAULT_MAX_PAGES_PER_REQ 32
195 
196 /* room needed in buffer to accommodate header */
197 #define FUSE_BUFFER_HEADER_SIZE 0x1000
198 
struct fuse_fs *(* fuse_module_factory_t)(struct fuse_args *args, struct fuse_fs *fs[])
Definition: fuse.h:1258
void(* fuse_interrupt_func_t)(fuse_req_t req, void *data)
struct fuse_req * fuse_req_t
Definition: fuse_lowlevel.h:49
uint64_t fuse_ino_t
Definition: fuse_lowlevel.h:46
unsigned int max_threads
Definition: fuse_i.h:137
int max_idle_threads
Definition: fuse_i.h:130