A few fixes for 32-bit compiles
[fio.git] / engines / binject.c
index 65894c2ef7847462c36baeeb2baf7593672e4067..f7e56eb2ed0207bc7169a3259e4c2edb758fad5b 100644 (file)
@@ -12,6 +12,8 @@
 #include <assert.h>
 #include <string.h>
 #include <sys/poll.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #include "../fio.h"
 
@@ -144,7 +146,7 @@ static int fio_binject_getevents(struct thread_data *td, unsigned int min,
                for (i = 0; i < events; i++) {
                        struct b_user_cmd *buc = (struct b_user_cmd *) buf + i;
 
-                       bd->events[ev_index] = (struct io_u *) buc->usr_ptr;
+                       bd->events[ev_index] = (struct io_u *) (unsigned long) buc->usr_ptr;
                        ev_index++;
                }
        }
@@ -191,7 +193,10 @@ static int fio_binject_prep(struct thread_data *td, struct io_u *io_u)
                buc->type = B_TYPE_READ;
        } else if (io_u->ddir == DDIR_WRITE) {
                binject_buc_init(bd, io_u);
-               buc->type = B_TYPE_WRITE;
+               if (io_u->flags & IO_U_F_BARRIER)
+                       buc->type = B_TYPE_WRITEBARRIER;
+               else
+                       buc->type = B_TYPE_WRITE;
        } else if (io_u->ddir == DDIR_TRIM) {
                binject_buc_init(bd, io_u);
                buc->type = B_TYPE_DISCARD;
@@ -407,7 +412,7 @@ static struct ioengine_ops ioengine = {
        .open_file      = fio_binject_open_file,
        .close_file     = fio_binject_close_file,
        .get_file_size  = generic_get_file_size,
-       .flags          = FIO_RAWIO,
+       .flags          = FIO_RAWIO | FIO_BARRIER,
 };
 
 #else /* FIO_HAVE_BINJECT */