1 #ifndef __LUNAIX_BLKIO_H
2 #define __LUNAIX_BLKIO_H
4 #include <lunaix/buffer.h>
5 #include <lunaix/ds/llist.h>
6 #include <lunaix/types.h>
8 #define BLKIO_WRITE 0x1
9 #define BLKIO_ERROR 0x2
12 #define BLKIO_BUSY 0x4
13 #define BLKIO_PENDING 0x8
14 #define BLKIO_FOC 0x10
16 #define BLKIO_SCHED_IDEL 0x1
20 typedef void (*blkio_cb)(struct blkio_req*);
21 typedef void (*req_handler)(struct blkio_req*);
25 struct llist_header reqs;
26 struct blkio_context* io_ctx;
37 struct llist_header queue;
43 req_handler handle_one;
53 * @brief Vectorized read request
60 * @return struct blkio_req*
63 blkio_vrd(struct vecbuf* vbuf,
70 * @brief Vectorized write request
77 * @return struct blkio_req*
80 blkio_vwr(struct vecbuf* vbuf,
87 blkio_free_req(struct blkio_req* req);
90 * @brief Commit an IO request to scheduler.
96 blkio_commit(struct blkio_context* ctx, struct blkio_req* req);
99 * @brief Schedule an IO request to be handled.
104 blkio_schedule(struct blkio_context* ctx);
107 * @brief Notify the scheduler when request is completed, either successful or
114 blkio_complete(struct blkio_req* req);
117 * @brief Create a new block IO scheduling context
119 * @param handler Handler to handle request
120 * @return struct blkio_context*
122 struct blkio_context*
123 blkio_newctx(req_handler handler);
125 #endif /* __LUNAIX_BLKIO_H */