blob: fa3715606d809760224888d1b82a1f9aec3112ae [file] [log] [blame]
bigbiff bigbiff9c754052013-01-09 09:09:08 -05001/*
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"
bigbiff bigbiff9c754052013-01-09 09:09:08 -050011
12struct fuse_chan;
13struct fuse_ll;
14
15struct fuse_session {
16 struct fuse_session_ops op;
17
Dees_Troye34c1332013-02-06 19:13:00 +000018 int (*receive_buf)(struct fuse_session *se, struct fuse_buf *buf,
19 struct fuse_chan **chp);
20
21 void (*process_buf)(void *data, const struct fuse_buf *buf,
22 struct fuse_chan *ch);
23
bigbiff bigbiff9c754052013-01-09 09:09:08 -050024 void *data;
25
26 volatile int exited;
27
28 struct fuse_chan *ch;
29};
30
31struct 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;
Dees_Troye34c1332013-02-06 19:13:00 +000039 unsigned int ioctl_64bit : 1;
bigbiff bigbiff9c754052013-01-09 09:09:08 -050040 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;
51};
52
Dees_Troye34c1332013-02-06 19:13:00 +000053struct 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;
59};
60
bigbiff bigbiff9c754052013-01-09 09:09:08 -050061struct fuse_ll {
62 int debug;
63 int allow_root;
64 int atomic_o_trunc;
Dees_Troye34c1332013-02-06 19:13:00 +000065 int no_remote_posix_lock;
66 int no_remote_flock;
bigbiff bigbiff9c754052013-01-09 09:09:08 -050067 int big_writes;
Dees_Troye34c1332013-02-06 19:13:00 +000068 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;
bigbiff bigbiff9c754052013-01-09 09:09:08 -050074 struct fuse_lowlevel_ops op;
75 int got_init;
76 struct cuse_data *cuse_data;
77 void *userdata;
78 uid_t owner;
79 struct fuse_conn_info conn;
80 struct fuse_req list;
81 struct fuse_req interrupts;
82 pthread_mutex_t lock;
83 int got_destroy;
Dees_Troye34c1332013-02-06 19:13:00 +000084 pthread_key_t pipe_key;
85 int broken_splice_nonblock;
86 uint64_t notify_ctr;
87 struct fuse_notify_req notify_list;
bigbiff bigbiff9c754052013-01-09 09:09:08 -050088};
89
90struct fuse_cmd {
91 char *buf;
92 size_t buflen;
93 struct fuse_chan *ch;
94};
95
96struct fuse *fuse_new_common(struct fuse_chan *ch, struct fuse_args *args,
97 const struct fuse_operations *op,
98 size_t op_size, void *user_data, int compat);
99
100int fuse_sync_compat_args(struct fuse_args *args);
101
102struct fuse_chan *fuse_kern_chan_new(int fd);
103
104struct fuse_session *fuse_lowlevel_new_common(struct fuse_args *args,
105 const struct fuse_lowlevel_ops *op,
106 size_t op_size, void *userdata);
107
108void fuse_kern_unmount_compat22(const char *mountpoint);
Matt Mower523a0592015-12-13 11:31:00 -0600109int fuse_chan_clearfd(struct fuse_chan *ch);
110
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500111void fuse_kern_unmount(const char *mountpoint, int fd);
112int fuse_kern_mount(const char *mountpoint, struct fuse_args *args);
113
114int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
115 int count);
116void fuse_free_req(fuse_req_t req);
117
118
119struct fuse *fuse_setup_common(int argc, char *argv[],
120 const struct fuse_operations *op,
121 size_t op_size,
122 char **mountpoint,
123 int *multithreaded,
124 int *fd,
125 void *user_data,
126 int compat);
127
128void cuse_lowlevel_init(fuse_req_t req, fuse_ino_t nodeide, const void *inarg);
Dees_Troye34c1332013-02-06 19:13:00 +0000129
130int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg);