Merge commit '81fd23e2b3ccf71c807e671444e8accaba98ca53' of https://git.pengutronix...
[linux-2.6-microblaze.git] / include / linux / io_uring.h
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_cancel(struct files_struct *files);
11 void __io_uring_free(struct task_struct *tsk);
12
13 static inline void io_uring_files_cancel(struct files_struct *files)
14 {
15         if (current->io_uring)
16                 __io_uring_cancel(files);
17 }
18 static inline void io_uring_task_cancel(void)
19 {
20         return io_uring_files_cancel(NULL);
21 }
22 static inline void io_uring_free(struct task_struct *tsk)
23 {
24         if (tsk->io_uring)
25                 __io_uring_free(tsk);
26 }
27 #else
28 static inline struct sock *io_uring_get_socket(struct file *file)
29 {
30         return NULL;
31 }
32 static inline void io_uring_task_cancel(void)
33 {
34 }
35 static inline void io_uring_files_cancel(struct files_struct *files)
36 {
37 }
38 static inline void io_uring_free(struct task_struct *tsk)
39 {
40 }
41 #endif
42
43 #endif