bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 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 | #include <pthread.h> |
| 12 | |
| 13 | struct fuse_chan; |
| 14 | struct fuse_ll; |
| 15 | |
| 16 | struct 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 | |
| 26 | struct 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 | |
| 47 | struct 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 | |
| 65 | struct fuse_cmd { |
| 66 | char *buf; |
| 67 | size_t buflen; |
| 68 | struct fuse_chan *ch; |
| 69 | }; |
| 70 | |
| 71 | struct 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 | |
| 75 | int fuse_sync_compat_args(struct fuse_args *args); |
| 76 | |
| 77 | struct fuse_chan *fuse_kern_chan_new(int fd); |
| 78 | |
| 79 | struct 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 | |
| 83 | void fuse_kern_unmount_compat22(const char *mountpoint); |
| 84 | void fuse_kern_unmount(const char *mountpoint, int fd); |
| 85 | int fuse_kern_mount(const char *mountpoint, struct fuse_args *args); |
| 86 | |
| 87 | int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov, |
| 88 | int count); |
| 89 | void fuse_free_req(fuse_req_t req); |
| 90 | |
| 91 | |
| 92 | struct 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 | |
| 101 | void cuse_lowlevel_init(fuse_req_t req, fuse_ino_t nodeide, const void *inarg); |