From: Jens Axboe Date: Tue, 7 Nov 2006 15:02:11 +0000 (+0100) Subject: [PATCH] Add skeleton external io engine X-Git-Tag: fio-1.10~31 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=da51c0505c753f64ad5f65808377b8f67b445828;hp=5f350952eff89948bfbf1eb6ac4d3d08a9109581 [PATCH] Add skeleton external io engine Signed-off-by: Jens Axboe --- 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());