[PATCH] Add skeleton external io engine
authorJens Axboe <jens.axboe@oracle.com>
Tue, 7 Nov 2006 15:02:11 +0000 (16:02 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 7 Nov 2006 15:02:11 +0000 (16:02 +0100)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
engines/fio-engine-skeleton_external.c [new file with mode: 0644]
ioengines.c

diff --git a/engines/fio-engine-skeleton_external.c b/engines/fio-engine-skeleton_external.c
new file mode 100644 (file)
index 0000000..497baa6
--- /dev/null
@@ -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,
+};
index a71357c67ddce9002b97f5d1afa4749a1e49100d..56a718c6cfea2f9cd26738560d76036d5a8385a1 100644 (file)
@@ -98,6 +98,10 @@ static struct ioengine_ops *dlopen_ioengine(struct thread_data *td,
                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());