blob: 1240828208abc2a985e9b75de6bcc04efddb2ad8 [file] [log] [blame]
Dr. David Alan Gilbertee46c782019-11-28 12:22:49 +00001/*
Dr. David Alan Gilbert73878632019-12-09 19:53:47 +00002 * 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 */
Dr. David Alan Gilbertee46c782019-11-28 12:22:49 +00008
Dr. David Alan Gilbertd14bf582018-06-07 20:11:14 +01009#ifndef FUSE_I_H
10#define FUSE_I_H
11
Dr. David Alan Gilbert09863eb2019-02-08 11:48:42 +000012#define FUSE_USE_VERSION 31
Dr. David Alan Gilbertee46c782019-11-28 12:22:49 +000013#include "fuse_lowlevel.h"
14
Dr. David Alan Gilbertf6f35732018-06-08 19:59:20 +010015struct fv_VuDev;
Dr. David Alan Gilbertb509e122018-06-14 19:52:23 +010016struct fv_QueueInfo;
Dr. David Alan Gilbertf6f35732018-06-08 19:59:20 +010017
Dr. David Alan Gilbertee46c782019-11-28 12:22:49 +000018struct fuse_req {
Dr. David Alan Gilbert73878632019-12-09 19:53:47 +000019 struct fuse_session *se;
20 uint64_t unique;
21 int ctr;
22 pthread_mutex_t lock;
23 struct fuse_ctx ctx;
24 struct fuse_chan *ch;
25 int interrupted;
26 unsigned int ioctl_64bit:1;
27 union {
28 struct {
29 uint64_t unique;
30 } i;
31 struct {
32 fuse_interrupt_func_t func;
33 void *data;
34 } ni;
35 } u;
36 struct fuse_req *next;
37 struct fuse_req *prev;
Dr. David Alan Gilbertee46c782019-11-28 12:22:49 +000038};
39
40struct fuse_notify_req {
Dr. David Alan Gilbert73878632019-12-09 19:53:47 +000041 uint64_t unique;
42 void (*reply)(struct fuse_notify_req *, fuse_req_t, fuse_ino_t,
43 const void *, const struct fuse_buf *);
44 struct fuse_notify_req *next;
45 struct fuse_notify_req *prev;
Dr. David Alan Gilbertee46c782019-11-28 12:22:49 +000046};
47
48struct fuse_session {
Dr. David Alan Gilbert73878632019-12-09 19:53:47 +000049 char *mountpoint;
50 volatile int exited;
51 int fd;
52 int debug;
53 int deny_others;
54 struct fuse_lowlevel_ops op;
55 int got_init;
56 struct cuse_data *cuse_data;
57 void *userdata;
58 uid_t owner;
59 struct fuse_conn_info conn;
60 struct fuse_req list;
61 struct fuse_req interrupts;
62 pthread_mutex_t lock;
Stefan Hajnoczicdc497c2019-08-01 17:54:07 +010063 pthread_rwlock_t init_rwlock;
Dr. David Alan Gilbert73878632019-12-09 19:53:47 +000064 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;
Dr. David Alan Gilbert205de002018-06-07 17:22:33 +010070 char *vu_socket_path;
Stefan Hajnoczicee8e352019-06-25 17:18:00 +010071 int vu_listen_fd;
Dr. David Alan Gilbertf6f35732018-06-08 19:59:20 +010072 int vu_socketfd;
73 struct fv_VuDev *virtio_dev;
Stefan Hajnoczi951b3122019-08-01 17:54:09 +010074 int thread_pool_size;
Dr. David Alan Gilbertee46c782019-11-28 12:22:49 +000075};
76
77struct fuse_chan {
Dr. David Alan Gilbert73878632019-12-09 19:53:47 +000078 pthread_mutex_t lock;
79 int ctr;
80 int fd;
Dr. David Alan Gilbertb509e122018-06-14 19:52:23 +010081 struct fv_QueueInfo *qi;
Dr. David Alan Gilbertee46c782019-11-28 12:22:49 +000082};
83
Dr. David Alan Gilbertee46c782019-11-28 12:22:49 +000084int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
Dr. David Alan Gilbert73878632019-12-09 19:53:47 +000085 int count);
Dr. David Alan Gilbertee46c782019-11-28 12:22:49 +000086void fuse_free_req(fuse_req_t req);
87
Dr. David Alan Gilbertee46c782019-11-28 12:22:49 +000088void fuse_session_process_buf_int(struct fuse_session *se,
Dr. David Alan Gilbert469f9d22019-01-04 18:23:00 +000089 struct fuse_bufvec *bufv,
Dr. David Alan Gilbert73878632019-12-09 19:53:47 +000090 struct fuse_chan *ch);
Dr. David Alan Gilbertee46c782019-11-28 12:22:49 +000091
Dr. David Alan Gilbertee46c782019-11-28 12:22:49 +000092
93#define FUSE_MAX_MAX_PAGES 256
94#define FUSE_DEFAULT_MAX_PAGES_PER_REQ 32
95
96/* room needed in buffer to accommodate header */
97#define FUSE_BUFFER_HEADER_SIZE 0x1000
Dr. David Alan Gilbertd14bf582018-06-07 20:11:14 +010098
99#endif