blob: 6285c952e445fef45eb71296223e7b2d84766f38 [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"
11#include <pthread.h>
12
13struct fuse_chan;
14struct fuse_ll;
15
16struct fuse_session {
17 struct fuse_session_ops op;
18
19 void *data;
20
21 volatile int exited;
22
23 struct fuse_chan *ch;
24};
25
26struct fuse_req {
27 struct fuse_ll *f;
28 uint64_t unique;
29 int ctr;
30 pthread_mutex_t lock;
31 struct fuse_ctx ctx;
32 struct fuse_chan *ch;
33 int interrupted;
34 union {
35 struct {
36 uint64_t unique;
37 } i;
38 struct {
39 fuse_interrupt_func_t func;
40 void *data;
41 } ni;
42 } u;
43 struct fuse_req *next;
44 struct fuse_req *prev;
45};
46
47struct fuse_ll {
48 int debug;
49 int allow_root;
50 int atomic_o_trunc;
51 int no_remote_lock;
52 int big_writes;
53 struct fuse_lowlevel_ops op;
54 int got_init;
55 struct cuse_data *cuse_data;
56 void *userdata;
57 uid_t owner;
58 struct fuse_conn_info conn;
59 struct fuse_req list;
60 struct fuse_req interrupts;
61 pthread_mutex_t lock;
62 int got_destroy;
63};
64
65struct fuse_cmd {
66 char *buf;
67 size_t buflen;
68 struct fuse_chan *ch;
69};
70
71struct fuse *fuse_new_common(struct fuse_chan *ch, struct fuse_args *args,
72 const struct fuse_operations *op,
73 size_t op_size, void *user_data, int compat);
74
75int fuse_sync_compat_args(struct fuse_args *args);
76
77struct fuse_chan *fuse_kern_chan_new(int fd);
78
79struct fuse_session *fuse_lowlevel_new_common(struct fuse_args *args,
80 const struct fuse_lowlevel_ops *op,
81 size_t op_size, void *userdata);
82
83void fuse_kern_unmount_compat22(const char *mountpoint);
84void fuse_kern_unmount(const char *mountpoint, int fd);
85int fuse_kern_mount(const char *mountpoint, struct fuse_args *args);
86
87int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
88 int count);
89void fuse_free_req(fuse_req_t req);
90
91
92struct fuse *fuse_setup_common(int argc, char *argv[],
93 const struct fuse_operations *op,
94 size_t op_size,
95 char **mountpoint,
96 int *multithreaded,
97 int *fd,
98 void *user_data,
99 int compat);
100
101void cuse_lowlevel_init(fuse_req_t req, fuse_ino_t nodeide, const void *inarg);