aboutsummaryrefslogtreecommitdiffstats
path: root/lib/fuse_uring_i.h
blob: c1da73ad78f9728c8b9780d4bc2d4760b24f6bdb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 * FUSE: Filesystem in Userspace
 * Copyright (C) 2025       Bernd Schubert <bschubert@ddn.com>
 * This program can be distributed under the terms of the GNU LGPLv2.
 * See the file LGPL2.txt
 */

#ifndef FUSE_URING_I_H_
#define FUSE_URING_I_H_

#include "fuse_config.h"
#include "fuse_lowlevel.h"
#include "fuse_kernel.h"

#ifndef HAVE_URING
#include "util.h"
#endif

#include <errno.h> // IWYU pragma: keep

/* io-uring defaults */
#define SESSION_DEF_URING_ENABLE (0)
#define SESSION_DEF_URING_Q_DEPTH (8)

void fuse_session_process_uring_cqe(struct fuse_session *se,
				    struct fuse_req *req,
				    struct fuse_in_header *in, void *in_header,
				    void *in_payload, size_t payload_len);

#ifdef HAVE_URING

struct fuse_in_header;

int fuse_uring_start(struct fuse_session *se);
void fuse_uring_wake_ring_threads(struct fuse_session *se);
int fuse_uring_stop(struct fuse_session *se);
int send_reply_uring(fuse_req_t req, int error, const void *arg,
		     size_t argsize);

int fuse_reply_data_uring(fuse_req_t req, struct fuse_bufvec *bufv,
			  enum fuse_buf_copy_flags flags);
int fuse_send_msg_uring(fuse_req_t req, struct iovec *iov, int count);

#else // HAVE_URING

static inline int fuse_uring_start(struct fuse_session *se FUSE_VAR_UNUSED)
{
	return -ENOTSUP;
}

static inline void
fuse_uring_wake_ring_threads(struct fuse_session *se FUSE_VAR_UNUSED)
{
}

static inline int fuse_uring_stop(struct fuse_session *se FUSE_VAR_UNUSED)
{
	return -ENOTSUP;
}

static inline int send_reply_uring(fuse_req_t req FUSE_VAR_UNUSED,
				   int error FUSE_VAR_UNUSED,
				   const void *arg FUSE_VAR_UNUSED,
				   size_t argsize FUSE_VAR_UNUSED)
{
	return -ENOTSUP;
}

static inline int
fuse_reply_data_uring(fuse_req_t req FUSE_VAR_UNUSED,
		      struct fuse_bufvec *bufv FUSE_VAR_UNUSED,
		      enum fuse_buf_copy_flags flags FUSE_VAR_UNUSED)
{
	return -ENOTSUP;
}

static inline int fuse_send_msg_uring(fuse_req_t req FUSE_VAR_UNUSED,
				      struct iovec *iov FUSE_VAR_UNUSED,
				      int count FUSE_VAR_UNUSED)
{
	return -ENOTSUP;
}

#endif // HAVE_URING

#endif // FUSE_URING_I_H_