at commit 709ba1c5

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef _LINUX_IO_URING_H
3 #define _LINUX_IO_URING_H
4
5 #include <linux/sched.h>
6 #include <linux/xarray.h>
7 #include <uapi/linux/io_uring.h>
8
9 #if defined(CONFIG_IO_URING)
10 void __io_uring_cancel(bool cancel_all);
11 void __io_uring_free(struct task_struct *tsk);
12 void io_uring_unreg_ringfd(void);
13 const char *io_uring_get_opcode(u8 opcode);
14 bool io_is_uring_fops(struct file *file);
15 int __io_uring_fork(struct task_struct *tsk);
16
17 static inline void io_uring_files_cancel(void)
18 {
19 if (current->io_uring)
20 __io_uring_cancel(false);
21 }
22 static inline void io_uring_task_cancel(void)
23 {
24 if (current->io_uring)
25 __io_uring_cancel(true);
26 }
27 static inline void io_uring_free(struct task_struct *tsk)
28 {
29 if (tsk->io_uring || tsk->io_uring_restrict)
30 __io_uring_free(tsk);
31 }
32 static inline int io_uring_fork(struct task_struct *tsk)
33 {
34 if (tsk->io_uring_restrict)
35 return __io_uring_fork(tsk);
36
37 return 0;
38 }
39 #else
40 static inline void io_uring_task_cancel(void)
41 {
42 }
43 static inline void io_uring_files_cancel(void)
44 {
45 }
46 static inline void io_uring_free(struct task_struct *tsk)
47 {
48 }
49 static inline const char *io_uring_get_opcode(u8 opcode)
50 {
51 return "";
52 }
53 static inline bool io_is_uring_fops(struct file *file)
54 {
55 return false;
56 }
57 static inline int io_uring_fork(struct task_struct *tsk)
58 {
59 return 0;
60 }
61 #endif
62
63 #endif