xref: /linux-6.15/include/linux/io_uring.h (revision ef04d4ff)
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 
8 #if defined(CONFIG_IO_URING)
9 struct sock *io_uring_get_socket(struct file *file);
10 void __io_uring_task_cancel(void);
11 void __io_uring_files_cancel(struct files_struct *files);
12 void __io_uring_free(struct task_struct *tsk);
13 
14 static inline void io_uring_task_cancel(void)
15 {
16 	if (current->io_uring)
17 		__io_uring_task_cancel();
18 }
19 static inline void io_uring_files_cancel(struct files_struct *files)
20 {
21 	if (current->io_uring)
22 		__io_uring_files_cancel(files);
23 }
24 static inline void io_uring_free(struct task_struct *tsk)
25 {
26 	if (tsk->io_uring)
27 		__io_uring_free(tsk);
28 }
29 #else
30 static inline struct sock *io_uring_get_socket(struct file *file)
31 {
32 	return NULL;
33 }
34 static inline void io_uring_task_cancel(void)
35 {
36 }
37 static inline void io_uring_files_cancel(struct files_struct *files)
38 {
39 }
40 static inline void io_uring_free(struct task_struct *tsk)
41 {
42 }
43 #endif
44 
45 #endif
46