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
12struct mount_opts;
13
14struct 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
36struct 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
44struct fuse_session {
45 char *mountpoint;
46 volatile int exited;
47 int fd;
48 struct fuse_custom_io *io;
49 struct mount_opts *mo;
50 int debug;
51 int deny_others;
52 struct fuse_lowlevel_ops op;
53 int got_init;
54 struct cuse_data *cuse_data;
55 void *userdata;
56 uid_t owner;
57 struct fuse_conn_info conn;
58 struct fuse_req list;
59 struct fuse_req interrupts;
60 pthread_mutex_t lock;
61 int got_destroy;
62 pthread_key_t pipe_key;
63 int broken_splice_nonblock;
64 uint64_t notify_ctr;
65 struct fuse_notify_req notify_list;
66 size_t bufsize;
67 int error;
68};
69
70struct fuse_chan {
71 pthread_mutex_t lock;
72 int ctr;
73 int fd;
74};
75
84 char *name;
86 struct fuse_module *next;
87 struct fusemod_so *so;
88 int ctr;
89};
90
99#if FUSE_USE_VERSION >= FUSE_MAKE_VERSION(3, 12)
100struct fuse_loop_config
101{
102 /* verififier that a correct struct was was passed. This is especially
103 * needed, as versions below (3, 12) were using a public struct
104 * (now called fuse_loop_config_v1), which was hard to extend with
105 * additional parameters, without risking that file system implementations
106 * would not have noticed and might either pass uninitialized members
107 * or even too small structs.
108 * fuse_loop_config_v1 has clone_fd at this offset, which should be either 0
109 * or 1. v2 or even higher version just need to set a value here
110 * which not conflicting and very unlikely as having been set by
111 * file system implementation.
112 */
113 int version_id;
114
119 int clone_fd;
132
138 unsigned int max_threads;
139};
140#endif
141
142/* ----------------------------------------------------------- *
143 * Channel interface (when using -o clone_fd) *
144 * ----------------------------------------------------------- */
145
152struct fuse_chan *fuse_chan_get(struct fuse_chan *ch);
153
159void fuse_chan_put(struct fuse_chan *ch);
160
161struct mount_opts *parse_mount_opts(struct fuse_args *args);
162void destroy_mount_opts(struct mount_opts *mo);
163void fuse_mount_version(void);
164unsigned get_max_read(struct mount_opts *o);
165void fuse_kern_unmount(const char *mountpoint, int fd);
166int fuse_kern_mount(const char *mountpoint, struct mount_opts *mo);
167
168int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
169 int count);
170void fuse_free_req(fuse_req_t req);
171
172void cuse_lowlevel_init(fuse_req_t req, fuse_ino_t nodeide, const void *inarg);
173
174int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg);
175
176int fuse_session_receive_buf_int(struct fuse_session *se, struct fuse_buf *buf,
177 struct fuse_chan *ch);
178void fuse_session_process_buf_int(struct fuse_session *se,
179 const struct fuse_buf *buf, struct fuse_chan *ch);
180
181struct fuse *fuse_new_31(struct fuse_args *args, const struct fuse_operations *op,
182 size_t op_size, void *private_data);
183int fuse_loop_mt_312(struct fuse *f, struct fuse_loop_config *config);
184int fuse_session_loop_mt_312(struct fuse_session *se, struct fuse_loop_config *config);
185
191int fuse_loop_cfg_verify(struct fuse_loop_config *config);
192
193
194#define FUSE_MAX_MAX_PAGES 256
195#define FUSE_DEFAULT_MAX_PAGES_PER_REQ 32
196
197/* room needed in buffer to accommodate header */
198#define FUSE_BUFFER_HEADER_SIZE 0x1000
199
struct fuse_fs *(* fuse_module_factory_t)(struct fuse_args *args, struct fuse_fs *fs[])
Definition: fuse.h:1308
struct fuse * fuse_new_31(struct fuse_args *args, const struct fuse_operations *op, size_t op_size, void *private_data)
Definition: fuse.c:4882
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:138
int max_idle_threads
Definition: fuse_i.h:131