2020-09-13 19:09:39 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#ifndef _LINUX_IO_URING_H
|
|
|
|
#define _LINUX_IO_URING_H
|
|
|
|
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/xarray.h>
|
2020-10-14 16:48:51 +00:00
|
|
|
|
|
|
|
struct io_identity {
|
|
|
|
struct files_struct *files;
|
|
|
|
struct mm_struct *mm;
|
|
|
|
#ifdef CONFIG_BLK_CGROUP
|
|
|
|
struct cgroup_subsys_state *blkcg_css;
|
|
|
|
#endif
|
|
|
|
const struct cred *creds;
|
|
|
|
struct nsproxy *nsproxy;
|
|
|
|
struct fs_struct *fs;
|
|
|
|
unsigned long fsize;
|
2020-10-15 19:46:44 +00:00
|
|
|
#ifdef CONFIG_AUDIT
|
|
|
|
kuid_t loginuid;
|
|
|
|
unsigned int sessionid;
|
|
|
|
#endif
|
2020-10-15 14:46:24 +00:00
|
|
|
refcount_t count;
|
2020-10-14 16:48:51 +00:00
|
|
|
};
|
2020-09-13 19:09:39 +00:00
|
|
|
|
|
|
|
struct io_uring_task {
|
|
|
|
/* submission side */
|
|
|
|
struct xarray xa;
|
|
|
|
struct wait_queue_head wait;
|
|
|
|
struct file *last;
|
2020-10-15 22:24:45 +00:00
|
|
|
struct percpu_counter inflight;
|
2020-10-15 23:38:03 +00:00
|
|
|
struct io_identity __identity;
|
|
|
|
struct io_identity *identity;
|
2020-10-30 15:37:30 +00:00
|
|
|
atomic_t in_idle;
|
|
|
|
bool sqpoll;
|
2020-09-13 19:09:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#if defined(CONFIG_IO_URING)
|
2020-09-19 02:41:00 +00:00
|
|
|
struct sock *io_uring_get_socket(struct file *file);
|
2020-09-13 19:09:39 +00:00
|
|
|
void __io_uring_task_cancel(void);
|
|
|
|
void __io_uring_files_cancel(struct files_struct *files);
|
|
|
|
void __io_uring_free(struct task_struct *tsk);
|
|
|
|
|
|
|
|
static inline void io_uring_task_cancel(void)
|
|
|
|
{
|
|
|
|
if (current->io_uring && !xa_empty(¤t->io_uring->xa))
|
|
|
|
__io_uring_task_cancel();
|
|
|
|
}
|
|
|
|
static inline void io_uring_files_cancel(struct files_struct *files)
|
|
|
|
{
|
|
|
|
if (current->io_uring && !xa_empty(¤t->io_uring->xa))
|
|
|
|
__io_uring_files_cancel(files);
|
|
|
|
}
|
|
|
|
static inline void io_uring_free(struct task_struct *tsk)
|
|
|
|
{
|
|
|
|
if (tsk->io_uring)
|
|
|
|
__io_uring_free(tsk);
|
|
|
|
}
|
|
|
|
#else
|
2020-09-19 02:41:00 +00:00
|
|
|
static inline struct sock *io_uring_get_socket(struct file *file)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2020-09-13 19:09:39 +00:00
|
|
|
static inline void io_uring_task_cancel(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void io_uring_files_cancel(struct files_struct *files)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void io_uring_free(struct task_struct *tsk)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|