From 2753df9cffba6805355ec37145280fd5607c7492 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 7 Nov 2020 12:34:40 -0800 Subject: 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. --- src/iou.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/iou.h (limited to 'src/iou.h') 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 - + * + * 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 . + */ + +#ifndef _IOU_H +#define _IOU_H + +#include + +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 -- cgit v1.2.3