summaryrefslogtreecommitdiff
path: root/src/iou.h
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-11-07 12:34:40 -0800
committerVito Caputo <vcaputo@pengaru.com>2020-11-07 12:34:40 -0800
commit2753df9cffba6805355ec37145280fd5607c7492 (patch)
tree2d00eba9c343be0960a8d6ddd8c4ba454f1a7d0c /src/iou.h
iou: initial commit
This implements a barebones IO-oriented callback scheduler built atop the new kernel io-uring interface via liburing. There's not much going on here. The caller must still use liburing for preparing the SQEs in iou_op_t operations allocated via iou_op_new(), but that's basically all that's needed from liburing.
Diffstat (limited to 'src/iou.h')
-rw-r--r--src/iou.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/iou.h b/src/iou.h
new file mode 100644
index 0000000..0c7c5c2
--- /dev/null
+++ b/src/iou.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2020 - Vito Caputo - <vcaputo@pengaru.com>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 3 as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _IOU_H
+#define _IOU_H
+
+#include <liburing.h>
+
+typedef struct iou_t iou_t;
+
+typedef struct iou_op_t {
+ struct io_uring_sqe *sqe;
+ int result;
+} iou_op_t;
+
+
+iou_t * iou_new(unsigned entries);
+iou_t * iou_free(iou_t *iou);
+iou_op_t * iou_op_new(iou_t *iou);
+void iou_op_queue(iou_t *iou, iou_op_t *op, int (*cb)(void *cb_data), void *cb_data);
+int iou_flush(iou_t *iou);
+int iou_run(iou_t *iou);
+int iou_quit(iou_t *iou);
+int iou_resize(iou_t *iou, unsigned entries);
+
+#endif
© All Rights Reserved