[PATCH] Add skeleton external io engine
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/engines/fio-engine-skeleton_external.c b/engines/fio-engine-skeleton_external.c
new file mode 100644
index 0000000..497baa6
--- /dev/null
+++ b/engines/fio-engine-skeleton_external.c
@@ -0,0 +1,37 @@
+/*
+ * Skeleton for a sample external io engine
+ *
+ * Should be compiled with:
+ *
+ * gcc -Wall -O2 -g -shared -rdynamic -fPIC -o engine.o engine.c
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <assert.h>
+
+#include "../fio.h"
+#include "../os.h"
+
+/*
+ * The core of the module is identical to the ones included with fio,
+ * read those. You cannot use register_ioengine() and unregister_ioengine()
+ * for external modules, they should be gotten through dlsym()
+ */
+
+/*
+ * Note that the structure is exported, so that fio can get it via
+ * dlsym(..., "ioengine");
+ */
+struct ioengine_ops ioengine = {
+ .name = "engine_name",
+ .version = FIO_IOOPS_VERSION,
+ .init = fio_skeleton_init,
+ .prep = fio_skeleton_prep,
+ .queue = fio_skeleton_queue,
+ .getevents = fio_skeleton_getevents,
+ .event = fio_skeleton_event,
+ .cleanup = fio_skeleton_cleanup,
+};
diff --git a/ioengines.c b/ioengines.c
index a71357c..56a718c 100644
--- a/ioengines.c
+++ b/ioengines.c
@@ -98,6 +98,10 @@
return NULL;
}
+ /*
+ * Unlike the included modules, external engines should have a
+ * non-static ioengine structure that we can reference.
+ */
ops = dlsym(dlhandle, "ioengine");
if (!ops) {
td_vmsg(td, -1, dlerror());