From da51c0505c753f64ad5f65808377b8f67b445828 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 7 Nov 2006 16:02:11 +0100 Subject: [PATCH] [PATCH] Add skeleton external io engine Signed-off-by: Jens Axboe --- engines/fio-engine-skeleton_external.c | 37 ++++++++++++++++++++++++++ ioengines.c | 4 +++ 2 files changed, 41 insertions(+) create mode 100644 engines/fio-engine-skeleton_external.c diff --git a/engines/fio-engine-skeleton_external.c b/engines/fio-engine-skeleton_external.c new file mode 100644 index 00000000..497baa6c --- /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 +#include +#include +#include +#include + +#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 a71357c6..56a718c6 100644 --- a/ioengines.c +++ b/ioengines.c @@ -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()); -- 2.25.1