Tizen 2.1 base
[framework/base/fuse.git] / lib / 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 fuse_chan;
13 struct fuse_ll;
14
15 struct fuse_session {
16         struct fuse_session_ops op;
17
18         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
24         void *data;
25
26         volatile int exited;
27
28         struct fuse_chan *ch;
29 };
30
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;
51 };
52
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;
59 };
60
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         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;
84         pthread_key_t pipe_key;
85         int broken_splice_nonblock;
86         uint64_t notify_ctr;
87         struct fuse_notify_req notify_list;
88 };
89
90 struct fuse_cmd {
91         char *buf;
92         size_t buflen;
93         struct fuse_chan *ch;
94 };
95
96 struct 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
100 int fuse_sync_compat_args(struct fuse_args *args);
101
102 struct fuse_chan *fuse_kern_chan_new(int fd);
103
104 struct 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
108 void fuse_kern_unmount_compat22(const char *mountpoint);
109 void fuse_kern_unmount(const char *mountpoint, int fd);
110 int fuse_kern_mount(const char *mountpoint, struct fuse_args *args);
111
112 int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
113                                int count);
114 void fuse_free_req(fuse_req_t req);
115
116
117 struct fuse *fuse_setup_common(int argc, char *argv[],
118                                const struct fuse_operations *op,
119                                size_t op_size,
120                                char **mountpoint,
121                                int *multithreaded,
122                                int *fd,
123                                void *user_data,
124                                int compat);
125
126 void cuse_lowlevel_init(fuse_req_t req, fuse_ino_t nodeide, const void *inarg);
127
128 int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg);