Full readonly check
[fio.git] / engines / sync.c
index ad02e09464f1935de33dc4a726ecef4edc3a8db8..597ee0127a39d1a5d30f0609d366b3fb5d9230e7 100644 (file)
@@ -1,5 +1,8 @@
 /*
- * regular read/write sync io engine
+ * sync engine
+ *
+ * IO engine that does regular read(2)/write(2) with lseek(2) to transfer
+ * data.
  *
  */
 #include <stdio.h>
@@ -9,7 +12,6 @@
 #include <assert.h>
 
 #include "../fio.h"
-#include "../os.h"
 
 static int fio_syncio_prep(struct thread_data *td, struct io_u *io_u)
 {
@@ -33,6 +35,8 @@ static int fio_syncio_queue(struct thread_data *td, struct io_u *io_u)
        struct fio_file *f = io_u->file;
        int ret;
 
+       fio_ro_check(td, io_u);
+
        if (io_u->ddir == DDIR_READ)
                ret = read(f->fd, io_u->xfer_buf, io_u->xfer_buflen);
        else if (io_u->ddir == DDIR_WRITE)
@@ -60,6 +64,8 @@ static struct ioengine_ops ioengine = {
        .version        = FIO_IOOPS_VERSION,
        .prep           = fio_syncio_prep,
        .queue          = fio_syncio_queue,
+       .open_file      = generic_open_file,
+       .close_file     = generic_close_file,
        .flags          = FIO_SYNCIO,
 };