Merge tag 'folio-5.18c' of git://git.infradead.org/users/willy/pagecache
[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(bool cancel_all);
11 void __io_uring_free(struct task_struct *tsk);
12 void io_uring_unreg_ringfd(void);
13
14 static inline void io_uring_files_cancel(void)
15 {
16         if (current->io_uring) {
17                 io_uring_unreg_ringfd();
18                 __io_uring_cancel(false);
19         }
20 }
21 static inline void io_uring_task_cancel(void)
22 {
23         if (current->io_uring)
24                 __io_uring_cancel(true);
25 }
26 static inline void io_uring_free(struct task_struct *tsk)
27 {
28         if (tsk->io_uring)
29                 __io_uring_free(tsk);
30 }
31 #else
32 static inline struct sock *io_uring_get_socket(struct file *file)
33 {
34         return NULL;
35 }
36 static inline void io_uring_task_cancel(void)
37 {
38 }
39 static inline void io_uring_files_cancel(void)
40 {
41 }
42 static inline void io_uring_free(struct task_struct *tsk)
43 {
44 }
45 #endif
46
47 #endif