[PATCH] syslet engine: use pread instead lseek+read
[fio.git] / fio.h
diff --git a/fio.h b/fio.h
index ddf66945d1b0e4cbbf84e6d5be7f830a73a93cfe..2d30324cb973df5dc9c21f520f46e9ce5faee08c 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -18,6 +18,8 @@
 #include "arch.h"
 #include "os.h"
 
+#include "syslet.h"
+
 enum fio_ddir {
        DDIR_READ = 0,
        DDIR_WRITE,
@@ -61,10 +63,17 @@ struct io_piece {
        struct list_head list;
        struct fio_file *file;
        unsigned long long offset;
-       unsigned int len;
+       unsigned long len;
        enum fio_ddir ddir;
 };
 
+#ifdef FIO_HAVE_SYSLET
+struct syslet_req {
+       struct syslet_uatom atom;
+       long ret;
+};
+#endif
+
 /*
  * The io unit
  */
@@ -78,6 +87,9 @@ struct io_u {
 #endif
 #ifdef FIO_HAVE_SGIO
                struct sg_io_hdr hdr;
+#endif
+#ifdef FIO_HAVE_SYSLET
+               struct syslet_req req;
 #endif
        };
        struct timeval start_time;
@@ -87,7 +99,7 @@ struct io_u {
         * Allocated/set buffer and length
         */
        void *buf;
-       unsigned int buflen;
+       unsigned long buflen;
        unsigned long long offset;
 
        /*
@@ -95,7 +107,7 @@ struct io_u {
         * partial transfers / residual data counts
         */
        void *xfer_buf;
-       unsigned int xfer_buflen;
+       unsigned long xfer_buflen;
 
        unsigned int resid;
        unsigned int error;
@@ -182,7 +194,7 @@ struct fio_file {
         */
        union {
                unsigned long file_data;
-               int fd;
+               long fd;
        };
        char *file_name;
        void *mmap;
@@ -670,4 +682,14 @@ extern void close_ioengine(struct thread_data *);
 #define for_each_file(td, f, i)        \
        for ((i) = 0, (f) = &(td)->files[0]; (i) < (int) (td)->nr_files; (i)++, (f)++)
 
+#define fio_assert(td, cond)   do {    \
+       if (!(cond)) {                  \
+               int *__foo = NULL;      \
+               fprintf(stderr, "file:%s:%d, assert %s failed\n", __FILE__, __LINE__, #cond);   \
+               (td)->runstate = TD_EXITED;     \
+               (td)->error = EFAULT;           \
+               *__foo = 0;                     \
+       }       \
+} while (0)
+
 #endif