2005-04-17 06:20:36 +08:00
|
|
|
#ifndef __LINUX__AIO_H
|
|
|
|
#define __LINUX__AIO_H
|
|
|
|
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/workqueue.h>
|
|
|
|
#include <linux/aio_abi.h>
|
2006-10-01 14:28:46 +08:00
|
|
|
#include <linux/uio.h>
|
2008-12-09 15:11:22 +08:00
|
|
|
#include <linux/rcupdate.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-07-27 07:09:06 +08:00
|
|
|
#include <linux/atomic.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
struct kioctx;
|
2013-05-08 07:18:49 +08:00
|
|
|
struct kiocb;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-05-08 07:19:10 +08:00
|
|
|
#define KIOCB_KEY 0
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-05-14 05:45:08 +08:00
|
|
|
typedef int (kiocb_cancel_fn)(struct kiocb *);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2015-02-02 21:49:06 +08:00
|
|
|
#define IOCB_EVENTFD (1 << 0)
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
struct kiocb {
|
|
|
|
struct file *ki_filp;
|
|
|
|
loff_t ki_pos;
|
2015-02-02 21:49:06 +08:00
|
|
|
void (*ki_complete)(struct kiocb *iocb, long ret, long ret2);
|
|
|
|
void *private;
|
|
|
|
int ki_flags;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2012-07-31 05:42:56 +08:00
|
|
|
static inline bool is_sync_kiocb(struct kiocb *kiocb)
|
|
|
|
{
|
2015-02-02 21:49:06 +08:00
|
|
|
return kiocb->ki_complete == NULL;
|
2012-07-31 05:42:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
|
|
|
|
{
|
|
|
|
*kiocb = (struct kiocb) {
|
|
|
|
.ki_filp = filp,
|
|
|
|
};
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* prototypes */
|
2008-10-16 13:05:12 +08:00
|
|
|
#ifdef CONFIG_AIO
|
2005-04-17 06:20:36 +08:00
|
|
|
struct mm_struct;
|
2008-02-14 07:03:15 +08:00
|
|
|
extern void exit_aio(struct mm_struct *mm);
|
2010-05-27 05:44:26 +08:00
|
|
|
extern long do_io_submit(aio_context_t ctx_id, long nr,
|
|
|
|
struct iocb __user *__user *iocbpp, bool compat);
|
2013-05-08 07:18:49 +08:00
|
|
|
void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel);
|
2008-10-16 13:05:12 +08:00
|
|
|
#else
|
|
|
|
struct mm_struct;
|
|
|
|
static inline void exit_aio(struct mm_struct *mm) { }
|
2010-05-27 05:44:26 +08:00
|
|
|
static inline long do_io_submit(aio_context_t ctx_id, long nr,
|
|
|
|
struct iocb __user * __user *iocbpp,
|
|
|
|
bool compat) { return 0; }
|
2013-05-08 07:18:49 +08:00
|
|
|
static inline void kiocb_set_cancel_fn(struct kiocb *req,
|
|
|
|
kiocb_cancel_fn *cancel) { }
|
2008-10-16 13:05:12 +08:00
|
|
|
#endif /* CONFIG_AIO */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* for sysctl: */
|
2005-11-07 16:59:31 +08:00
|
|
|
extern unsigned long aio_nr;
|
|
|
|
extern unsigned long aio_max_nr;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#endif /* __LINUX__AIO_H */
|