aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/aio.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/aio.h')
-rw-r--r--include/linux/aio.h70
1 files changed, 1 insertions, 69 deletions
diff --git a/include/linux/aio.h b/include/linux/aio.h
index d9c92daa3944..9eb42dbc5582 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -1,86 +1,23 @@
1#ifndef __LINUX__AIO_H 1#ifndef __LINUX__AIO_H
2#define __LINUX__AIO_H 2#define __LINUX__AIO_H
3 3
4#include <linux/list.h>
5#include <linux/workqueue.h>
6#include <linux/aio_abi.h> 4#include <linux/aio_abi.h>
7#include <linux/uio.h>
8#include <linux/rcupdate.h>
9
10#include <linux/atomic.h>
11 5
12struct kioctx; 6struct kioctx;
13struct kiocb; 7struct kiocb;
8struct mm_struct;
14 9
15#define KIOCB_KEY 0 10#define KIOCB_KEY 0
16 11
17/*
18 * We use ki_cancel == KIOCB_CANCELLED to indicate that a kiocb has been either
19 * cancelled or completed (this makes a certain amount of sense because
20 * successful cancellation - io_cancel() - does deliver the completion to
21 * userspace).
22 *
23 * And since most things don't implement kiocb cancellation and we'd really like
24 * kiocb completion to be lockless when possible, we use ki_cancel to
25 * synchronize cancellation and completion - we only set it to KIOCB_CANCELLED
26 * with xchg() or cmpxchg(), see batch_complete_aio() and kiocb_cancel().
27 */
28#define KIOCB_CANCELLED ((void *) (~0ULL))
29
30typedef int (kiocb_cancel_fn)(struct kiocb *); 12typedef int (kiocb_cancel_fn)(struct kiocb *);
31 13
32struct kiocb {
33 struct file *ki_filp;
34 struct kioctx *ki_ctx; /* NULL for sync ops */
35 kiocb_cancel_fn *ki_cancel;
36 void *private;
37
38 union {
39 void __user *user;
40 struct task_struct *tsk;
41 } ki_obj;
42
43 __u64 ki_user_data; /* user's data for completion */
44 loff_t ki_pos;
45 size_t ki_nbytes; /* copy of iocb->aio_nbytes */
46
47 struct list_head ki_list; /* the aio core uses this
48 * for cancellation */
49
50 /*
51 * If the aio_resfd field of the userspace iocb is not zero,
52 * this is the underlying eventfd context to deliver events to.
53 */
54 struct eventfd_ctx *ki_eventfd;
55};
56
57static inline bool is_sync_kiocb(struct kiocb *kiocb)
58{
59 return kiocb->ki_ctx == NULL;
60}
61
62static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
63{
64 *kiocb = (struct kiocb) {
65 .ki_ctx = NULL,
66 .ki_filp = filp,
67 .ki_obj.tsk = current,
68 };
69}
70
71/* prototypes */ 14/* prototypes */
72#ifdef CONFIG_AIO 15#ifdef CONFIG_AIO
73extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb);
74extern void aio_complete(struct kiocb *iocb, long res, long res2);
75struct mm_struct;
76extern void exit_aio(struct mm_struct *mm); 16extern void exit_aio(struct mm_struct *mm);
77extern long do_io_submit(aio_context_t ctx_id, long nr, 17extern long do_io_submit(aio_context_t ctx_id, long nr,
78 struct iocb __user *__user *iocbpp, bool compat); 18 struct iocb __user *__user *iocbpp, bool compat);
79void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel); 19void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel);
80#else 20#else
81static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; }
82static inline void aio_complete(struct kiocb *iocb, long res, long res2) { }
83struct mm_struct;
84static inline void exit_aio(struct mm_struct *mm) { } 21static inline void exit_aio(struct mm_struct *mm) { }
85static inline long do_io_submit(aio_context_t ctx_id, long nr, 22static inline long do_io_submit(aio_context_t ctx_id, long nr,
86 struct iocb __user * __user *iocbpp, 23 struct iocb __user * __user *iocbpp,
@@ -89,11 +26,6 @@ static inline void kiocb_set_cancel_fn(struct kiocb *req,
89 kiocb_cancel_fn *cancel) { } 26 kiocb_cancel_fn *cancel) { }
90#endif /* CONFIG_AIO */ 27#endif /* CONFIG_AIO */
91 28
92static inline struct kiocb *list_kiocb(struct list_head *h)
93{
94 return list_entry(h, struct kiocb, ki_list);
95}
96
97/* for sysctl: */ 29/* for sysctl: */
98extern unsigned long aio_nr; 30extern unsigned long aio_nr;
99extern unsigned long aio_max_nr; 31extern unsigned long aio_max_nr;