2022-05-24 21:45:38 +03:00
|
|
|
#ifndef IOU_CORE_H
|
|
|
|
#define IOU_CORE_H
|
|
|
|
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include "io_uring_types.h"
|
|
|
|
|
2022-05-25 00:21:00 +03:00
|
|
|
enum {
|
|
|
|
IOU_OK = 0,
|
|
|
|
IOU_ISSUE_SKIP_COMPLETE = -EIOCBQUEUED,
|
|
|
|
};
|
|
|
|
|
2022-05-25 06:19:47 +03:00
|
|
|
static inline void req_set_fail(struct io_kiocb *req)
|
|
|
|
{
|
|
|
|
req->flags |= REQ_F_FAIL;
|
|
|
|
if (req->flags & REQ_F_CQE_SKIP) {
|
|
|
|
req->flags &= ~REQ_F_CQE_SKIP;
|
|
|
|
req->flags |= REQ_F_SKIP_LINK_CQES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-24 21:45:38 +03:00
|
|
|
static inline void io_req_set_res(struct io_kiocb *req, s32 res, u32 cflags)
|
|
|
|
{
|
|
|
|
req->cqe.res = res;
|
|
|
|
req->cqe.flags = cflags;
|
|
|
|
}
|
|
|
|
|
2022-05-25 06:19:47 +03:00
|
|
|
static inline void io_put_file(struct file *file)
|
|
|
|
{
|
|
|
|
if (file)
|
|
|
|
fput(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct file *io_file_get_normal(struct io_kiocb *req, int fd);
|
|
|
|
struct file *io_file_get_fixed(struct io_kiocb *req, int fd,
|
|
|
|
unsigned issue_flags);
|
|
|
|
|
2022-05-24 21:45:38 +03:00
|
|
|
#endif
|