Merge tag 'trivial-branch-for-7.1-pull-request' of https://gitlab.com/laurent_vivier...
[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_lowlevel.h"
14
15 struct fv_VuDev;
16 struct fv_QueueInfo;
17
18 struct fuse_security_context {
19 const char *name;
20 uint32_t ctxlen;
21 const void *ctx;
22 };
23
24 struct fuse_req {
25 struct fuse_session *se;
26 uint64_t unique;
27 int ctr;
28 pthread_mutex_t lock;
29 struct fuse_ctx ctx;
30 struct fuse_chan *ch;
31 int interrupted;
32 unsigned int ioctl_64bit:1;
33 union {
34 struct {
35 uint64_t unique;
36 } i;
37 struct {
38 fuse_interrupt_func_t func;
39 void *data;
40 } ni;
41 } u;
42 struct fuse_req *next;
43 struct fuse_req *prev;
44 struct fuse_security_context secctx;
45 };
46
47 struct fuse_notify_req {
48 uint64_t unique;
49 void (*reply)(struct fuse_notify_req *, fuse_req_t, fuse_ino_t,
50 const void *, const struct fuse_buf *);
51 struct fuse_notify_req *next;
52 struct fuse_notify_req *prev;
53 };
54
55 struct fuse_session {
56 char *mountpoint;
57 volatile int exited;
58 int fd;
59 int debug;
60 int deny_others;
61 struct fuse_lowlevel_ops op;
62 int got_init;
63 struct cuse_data *cuse_data;
64 void *userdata;
65 uid_t owner;
66 struct fuse_conn_info conn;
67 struct fuse_req list;
68 struct fuse_req interrupts;
69 pthread_mutex_t lock;
70 pthread_rwlock_t init_rwlock;
71 int got_destroy;
72 int broken_splice_nonblock;
73 uint64_t notify_ctr;
74 struct fuse_notify_req notify_list;
75 size_t bufsize;
76 int error;
77 char *vu_socket_path;
78 char *vu_socket_group;
79 int vu_listen_fd;
80 int vu_socketfd;
81 struct fv_VuDev *virtio_dev;
82 int thread_pool_size;
83 };
84
85 struct fuse_chan {
86 pthread_mutex_t lock;
87 int ctr;
88 int fd;
89 struct fv_QueueInfo *qi;
90 };
91
92 int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
93 int count);
94 void fuse_free_req(fuse_req_t req);
95
96 void fuse_session_process_buf_int(struct fuse_session *se,
97 struct fuse_bufvec *bufv,
98 struct fuse_chan *ch);
99
100
101 #define FUSE_MAX_MAX_PAGES 256
102 #define FUSE_DEFAULT_MAX_PAGES_PER_REQ 32
103
104 /* room needed in buffer to accommodate header */
105 #define FUSE_BUFFER_HEADER_SIZE 0x1000
106
107 #endif