From 34cfcdafa994a0a75120e498c51eda08bde5df72 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 3 Nov 2006 14:00:45 +0100 Subject: [PATCH] [PATCH] Make fio build again on "crippled" platforms Some time in the future we want a proper configure setup and only install the supported io engines, for now install limited versions that just complain on initialization. Signed-off-by: Jens Axboe --- engines/fio-engine-libaio.c | 23 +++++++++++++++++++++++ engines/fio-engine-posixaio.c | 23 +++++++++++++++++++++++ engines/fio-engine-sg.c | 23 +++++++++++++++++++++++ engines/fio-engine-splice.c | 23 +++++++++++++++++++++++ fio.h | 1 + init.c | 4 ++++ 6 files changed, 97 insertions(+) diff --git a/engines/fio-engine-libaio.c b/engines/fio-engine-libaio.c index 1848dcc4..c0f280b5 100644 --- a/engines/fio-engine-libaio.c +++ b/engines/fio-engine-libaio.c @@ -10,6 +10,8 @@ #include "fio.h" #include "os.h" +#ifdef FIO_HAVE_LIBAIO + #define ev_to_iou(ev) (struct io_u *) ((unsigned long) (ev)->obj) struct libaio_data { @@ -138,3 +140,24 @@ struct ioengine_ops ioengine = { .event = fio_libaio_event, .cleanup = fio_libaio_cleanup, }; + +#else /* FIO_HAVE_LIBAIO */ + +/* + * 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_libaio_init(struct thread_data fio_unused *td) +{ + fprintf(stderr, "fio: libaio not available\n"); + return 1; +} + +struct ioengine_ops ioengine = { + .name = "libaio", + .version = FIO_IOOPS_VERSION, + .init = fio_libaio_init, +}; + +#endif diff --git a/engines/fio-engine-posixaio.c b/engines/fio-engine-posixaio.c index 2d0fd311..401cd866 100644 --- a/engines/fio-engine-posixaio.c +++ b/engines/fio-engine-posixaio.c @@ -10,6 +10,8 @@ #include "fio.h" #include "os.h" +#ifdef FIO_HAVE_POSIXAIO + struct posixaio_data { struct io_u **aio_events; }; @@ -186,3 +188,24 @@ 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; +} + +struct ioengine_ops ioengine = { + .name = "posixaio", + .version = FIO_IOOPS_VERSION, + .init = fio_posixaio_init, +}; + +#endif diff --git a/engines/fio-engine-sg.c b/engines/fio-engine-sg.c index 112f0278..fafc3269 100644 --- a/engines/fio-engine-sg.c +++ b/engines/fio-engine-sg.c @@ -11,6 +11,8 @@ #include "fio.h" #include "os.h" +#ifdef FIO_HAVE_SGIO + struct sgio_cmd { unsigned char cdb[10]; int nr; @@ -314,3 +316,24 @@ struct ioengine_ops ioengine = { .cleanup = fio_sgio_cleanup, .flags = FIO_SYNCIO | FIO_RAWIO, }; + +#else /* FIO_HAVE_SGIO */ + +/* + * 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_sgio_init(struct thread_data fio_unused *td) +{ + fprintf(stderr, "fio: sgio not available\n"); + return 1; +} + +struct ioengine_ops ioengine = { + .name = "sgio", + .version = FIO_IOOPS_VERSION, + .init = fio_sgio_init, +}; + +#endif diff --git a/engines/fio-engine-splice.c b/engines/fio-engine-splice.c index 192fbd00..3b02fbfd 100644 --- a/engines/fio-engine-splice.c +++ b/engines/fio-engine-splice.c @@ -11,6 +11,8 @@ #include "fio.h" #include "os.h" +#ifdef FIO_HAVE_SPLICE + struct spliceio_data { struct io_u *last_io_u; int pipe[2]; @@ -189,3 +191,24 @@ struct ioengine_ops ioengine = { .cleanup = fio_spliceio_cleanup, .flags = FIO_SYNCIO, }; + +#else /* FIO_HAVE_SPLICE */ + +/* + * 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_spliceio_init(struct thread_data fio_unused *td) +{ + fprintf(stderr, "fio: splice not available\n"); + return 1; +} + +struct ioengine_ops ioengine = { + .name = "splice", + .version = FIO_IOOPS_VERSION, + .init = fio_spliceio_init, +}; + +#endif diff --git a/fio.h b/fio.h index 53e174e1..2e51da3b 100644 --- a/fio.h +++ b/fio.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "list.h" #include "md5.h" diff --git a/init.c b/init.c index 7b2b5121..3c27ea55 100644 --- a/init.c +++ b/init.c @@ -60,8 +60,10 @@ static int str_ioengine_cb(void *, const char *); static int str_mem_cb(void *, const char *); static int str_verify_cb(void *, const char *); static int str_lockmem_cb(void *, unsigned long *); +#ifdef FIO_HAVE_IOPRIO static int str_prio_cb(void *, unsigned int *); static int str_prioclass_cb(void *, unsigned int *); +#endif static int str_exitall_cb(void); static int str_cpumask_cb(void *, unsigned int *); @@ -844,6 +846,7 @@ static int str_lockmem_cb(void fio_unused *data, unsigned long *val) return 0; } +#ifdef FIO_HAVE_IOPRIO static int str_prioclass_cb(void *data, unsigned int *val) { struct thread_data *td = data; @@ -859,6 +862,7 @@ static int str_prio_cb(void *data, unsigned int *val) td->ioprio |= *val; return 0; } +#endif static int str_exitall_cb(void) { -- 2.25.1