From 5c4e1dbc4ec6ee963220c5f4e64a04cd6130dc81 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 7 Jun 2006 14:17:08 +0200 Subject: [PATCH] [PATCH] Final FreeBSD compile fixups It actually builds now! --- Makefile.FreeBSD | 4 +++- init.c | 3 ++- ioengines.c | 21 +++++++++++---------- list.h | 3 --- os-freebsd.h | 2 ++ stat.c | 3 ++- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Makefile.FreeBSD b/Makefile.FreeBSD index a2232890..ce7b0566 100644 --- a/Makefile.FreeBSD +++ b/Makefile.FreeBSD @@ -3,10 +3,12 @@ CFLAGS = -Wall -O2 -g -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 PROGS = fio SCRIPTS = fio_generate_plots +OBJS = fio.o ioengines.o init.o stat.o log.o time.o md5.o crc32.o + all: depend $(PROGS) $(SCRIPTS) fio: fio.o ioengines.o init.o stat.o log.o time.o md5.o crc32.o - $(CC) $(CFLAGS) -o $@ $(filter %.o,$^) -lpthread -laio -lm -lrt + $(CC) $(CFLAGS) -o $@ $(OBJS) -lpthread -lm clean: -rm -f *.o .depend cscope.out $(PROGS) diff --git a/init.c b/init.c index 1bd79e27..2c6c8204 100644 --- a/init.c +++ b/init.c @@ -667,10 +667,11 @@ int parse_jobs_ini(char *file) fprintf(stderr, "io priorities not available\n"); ret = 1; break; -#endif +#else td->ioprio |= prioclass << IOPRIO_CLASS_SHIFT; fgetpos(f, &off); continue; +#endif } if (!check_int(p, "direct", &td->odirect)) { fgetpos(f, &off); diff --git a/ioengines.c b/ioengines.c index 7b1c1bd3..b086b60c 100644 --- a/ioengines.c +++ b/ioengines.c @@ -15,20 +15,12 @@ #include #include #include +#include #include #include #include "fio.h" #include "os.h" -#ifdef FIO_HAVE_LIBAIO - -#define ev_to_iou(ev) (struct io_u *) ((unsigned long) (ev)->obj) - -static int fio_io_sync(struct thread_data *td) -{ - return fsync(td->fd); -} - static int fill_timespec(struct timespec *ts) { #ifdef _POSIX_TIMERS @@ -60,6 +52,15 @@ static unsigned long long ts_utime_since_now(struct timespec *t) return sec + nsec; } +static int fio_io_sync(struct thread_data *td) +{ + return fsync(td->fd); +} + +#ifdef FIO_HAVE_LIBAIO + +#define ev_to_iou(ev) (struct io_u *) ((unsigned long) (ev)->obj) + struct libaio_data { io_context_t aio_ctx; struct io_event *aio_events; @@ -374,7 +375,7 @@ static int fio_syncio_queue(struct thread_data *td, struct io_u *io_u) if ((unsigned int) ret != io_u->buflen) { if (ret > 0) { io_u->resid = io_u->buflen - ret; - io_u->error = ENODATA; + io_u->error = EIO; } else io_u->error = errno; } diff --git a/list.h b/list.h index cedbafaa..2e0a7ad7 100644 --- a/list.h +++ b/list.h @@ -28,9 +28,6 @@ struct list_head { #define LIST_HEAD_INIT(name) { &(name), &(name) } -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) - #define INIT_LIST_HEAD(ptr) do { \ (ptr)->next = (ptr); (ptr)->prev = (ptr); \ } while (0) diff --git a/os-freebsd.h b/os-freebsd.h index b56ba802..41672d4e 100644 --- a/os-freebsd.h +++ b/os-freebsd.h @@ -1,6 +1,8 @@ #ifndef FIO_OS_FREEBSD_H #define FIO_OS_FREEBSD_H +#include + #undef FIO_HAVE_LIBAIO #define FIO_HAVE_POSIXAIO #undef FIO_HAVE_FADVISE diff --git a/stat.c b/stat.c index 60d52600..a540304c 100644 --- a/stat.c +++ b/stat.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -9,7 +10,7 @@ #include "fio.h" static struct itimerval itimer; -static LIST_HEAD(disk_list); +static struct list_head disk_list = LIST_HEAD_INIT(disk_list); static int get_io_ticks(struct disk_util *du, struct disk_util_stat *dus) { -- 2.25.1