X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=engines%2Ffio-engine-posixaio.c;h=ef4d78ebe8a58c03465eb33cdc58aa7f90b52d7c;hp=2d0fd3114b6469729997721643f8d66e3826451f;hb=5f350952eff89948bfbf1eb6ac4d3d08a9109581;hpb=87dc1ab1b4df7b977f60e3d43533a896e2ee665b;ds=sidebyside diff --git a/engines/fio-engine-posixaio.c b/engines/fio-engine-posixaio.c index 2d0fd311..ef4d78eb 100644 --- a/engines/fio-engine-posixaio.c +++ b/engines/fio-engine-posixaio.c @@ -7,8 +7,11 @@ #include #include #include -#include "fio.h" -#include "os.h" + +#include "../fio.h" +#include "../os.h" + +#ifdef FIO_HAVE_POSIXAIO struct posixaio_data { struct io_u **aio_events; @@ -169,13 +172,15 @@ static int fio_posixaio_init(struct thread_data *td) { struct posixaio_data *pd = malloc(sizeof(*pd)); + memset(pd, 0, sizeof(*pd)); pd->aio_events = malloc(td->iodepth * sizeof(struct io_u *)); + memset(pd->aio_events, 0, td->iodepth * sizeof(struct io_u *)); td->io_ops->data = pd; return 0; } -struct ioengine_ops ioengine = { +static struct ioengine_ops ioengine = { .name = "posixaio", .version = FIO_IOOPS_VERSION, .init = fio_posixaio_init, @@ -186,3 +191,34 @@ struct ioengine_ops ioengine = { .event = fio_posixaio_event, .cleanup = fio_posixaio_cleanup, }; + +#else /* FIO_HAVE_POSIXAIO */ + +/* + * When we have a proper configure system in place, we simply wont build + * and install this io engine. For now install a crippled version that + * just complains and fails to load. + */ +static int fio_posixaio_init(struct thread_data fio_unused *td) +{ + fprintf(stderr, "fio: posixaio not available\n"); + return 1; +} + +static struct ioengine_ops ioengine = { + .name = "posixaio", + .version = FIO_IOOPS_VERSION, + .init = fio_posixaio_init, +}; + +#endif + +static void fio_init fio_posixaio_register(void) +{ + register_ioengine(&ioengine); +} + +static void fio_exit fio_posixaio_unregister(void) +{ + unregister_ioengine(&ioengine); +}