]> git.proxmox.com Git - mirror_qemu.git/blob - tools/virtiofsd/fuse_i.h
45995f32462ade7cd1fbb7807e86376e3957d4d0
[mirror_qemu.git] / tools / virtiofsd / 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 #ifndef FUSE_I_H
10 #define FUSE_I_H
11
12 #define FUSE_USE_VERSION 31
13 #include "fuse.h"
14 #include "fuse_lowlevel.h"
15
16 struct fv_VuDev;
17 struct fv_QueueInfo;
18
19 struct fuse_req {
20 struct fuse_session *se;
21 uint64_t unique;
22 int ctr;
23 pthread_mutex_t lock;
24 struct fuse_ctx ctx;
25 struct fuse_chan *ch;
26 int interrupted;
27 unsigned int ioctl_64bit:1;
28 union {
29 struct {
30 uint64_t unique;
31 } i;
32 struct {
33 fuse_interrupt_func_t func;
34 void *data;
35 } ni;
36 } u;
37 struct fuse_req *next;
38 struct fuse_req *prev;
39 };
40
41 struct fuse_notify_req {
42 uint64_t unique;
43 void (*reply)(struct fuse_notify_req *, fuse_req_t, fuse_ino_t,
44 const void *, const struct fuse_buf *);
45 struct fuse_notify_req *next;
46 struct fuse_notify_req *prev;
47 };
48
49 struct fuse_session {
50 char *mountpoint;
51 volatile int exited;
52 int fd;
53 int debug;
54 int deny_others;
55 struct fuse_lowlevel_ops op;
56 int got_init;
57 struct cuse_data *cuse_data;
58 void *userdata;
59 uid_t owner;
60 struct fuse_conn_info conn;
61 struct fuse_req list;
62 struct fuse_req interrupts;
63 pthread_mutex_t lock;
64 int got_destroy;
65 int broken_splice_nonblock;
66 uint64_t notify_ctr;
67 struct fuse_notify_req notify_list;
68 size_t bufsize;
69 int error;
70 char *vu_socket_path;
71 int vu_listen_fd;
72 int vu_socketfd;
73 struct fv_VuDev *virtio_dev;
74 };
75
76 struct fuse_chan {
77 pthread_mutex_t lock;
78 int ctr;
79 int fd;
80 struct fv_QueueInfo *qi;
81 };
82
83 /**
84 * Filesystem module
85 *
86 * Filesystem modules are registered with the FUSE_REGISTER_MODULE()
87 * macro.
88 *
89 */
90 struct fuse_module {
91 char *name;
92 fuse_module_factory_t factory;
93 struct fuse_module *next;
94 struct fusemod_so *so;
95 int ctr;
96 };
97
98 int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
99 int count);
100 void fuse_free_req(fuse_req_t req);
101
102 void fuse_session_process_buf_int(struct fuse_session *se,
103 const struct fuse_buf *buf,
104 struct fuse_chan *ch);
105
106
107 #define FUSE_MAX_MAX_PAGES 256
108 #define FUSE_DEFAULT_MAX_PAGES_PER_REQ 32
109
110 /* room needed in buffer to accommodate header */
111 #define FUSE_BUFFER_HEADER_SIZE 0x1000
112
113 #endif