[PATCH] Final FreeBSD compile fixups
authorJens Axboe <axboe@suse.de>
Wed, 7 Jun 2006 12:17:08 +0000 (14:17 +0200)
committerJens Axboe <axboe@suse.de>
Wed, 7 Jun 2006 12:17:08 +0000 (14:17 +0200)
It actually builds now!

Makefile.FreeBSD
init.c
ioengines.c
list.h
os-freebsd.h
stat.c

index a2232890d24eea3374e6042717abfe57426a3ad6..ce7b05663b64333b627826a1cb6c2cbe646287da 100644 (file)
@@ -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 1bd79e276b2a91bebe1e156e388e1f7f1ef23bb3..2c6c8204213ffd6030633aeddd52a9e80d3bd559 100644 (file)
--- 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);
index 7b1c1bd3a3360e9feadd4def4eb8c90bd83111aa..b086b60c9d3e156c4c9781b6e3f868577285f37b 100644 (file)
 #include <errno.h>
 #include <assert.h>
 #include <time.h>
+#include <string.h>
 #include <sys/mman.h>
 #include <sys/poll.h>
 #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 cedbafaae022de9267bcfd02296410a0b42c3465..2e0a7ad7eae671a3b0d20706dc9d741f549ab4eb 100644 (file)
--- 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)
index b56ba8026f2263db3cdb1ab34b0d3ce97a0a6708..41672d4e10231b3be0a8d3be4e92aa8c45478fe1 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef FIO_OS_FREEBSD_H
 #define FIO_OS_FREEBSD_H
 
+#include <sys/sysctl.h>
+
 #undef FIO_HAVE_LIBAIO
 #define FIO_HAVE_POSIXAIO
 #undef FIO_HAVE_FADVISE
diff --git a/stat.c b/stat.c
index 60d5260058b134506eee5aba2d5a22593ae44f7c..a540304c6b1d928fc05deea96096c0ace01b91b3 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -2,6 +2,7 @@
 #include <string.h>
 #include <sys/time.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <dirent.h>
 #include <libgen.h>
 #include <math.h>
@@ -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)
 {