+extern int __must_check td_io_init(struct thread_data *);
+extern int __must_check td_io_prep(struct thread_data *, struct io_u *);
+extern int __must_check td_io_queue(struct thread_data *, struct io_u *);
+extern int __must_check td_io_sync(struct thread_data *, struct fio_file *);
+extern int __must_check td_io_getevents(struct thread_data *, unsigned int, unsigned int, struct timespec *);
+extern int __must_check td_io_commit(struct thread_data *);
+extern int __must_check td_io_open_file(struct thread_data *, struct fio_file *);
+extern int td_io_close_file(struct thread_data *, struct fio_file *);
+
+/*
+ * blktrace support
+ */
+#ifdef FIO_HAVE_BLKTRACE
+extern int is_blktrace(const char *);
+extern int load_blktrace(struct thread_data *, const char *);
+#endif
+
+struct ioengine_ops {
+ struct list_head list;
+ char name[16];
+ int version;
+ int flags;
+ int (*setup)(struct thread_data *);
+ int (*init)(struct thread_data *);
+ int (*prep)(struct thread_data *, struct io_u *);
+ int (*queue)(struct thread_data *, struct io_u *);
+ int (*commit)(struct thread_data *);
+ int (*getevents)(struct thread_data *, unsigned int, unsigned int, struct timespec *);
+ struct io_u *(*event)(struct thread_data *, int);
+ int (*cancel)(struct thread_data *, struct io_u *);
+ void (*cleanup)(struct thread_data *);
+ int (*open_file)(struct thread_data *, struct fio_file *);
+ int (*close_file)(struct thread_data *, struct fio_file *);
+ void *data;
+ void *dlhandle;
+};
+
+#define FIO_IOOPS_VERSION 9
+
+extern struct ioengine_ops *load_ioengine(struct thread_data *, const char *);
+extern void register_ioengine(struct ioengine_ops *);
+extern void unregister_ioengine(struct ioengine_ops *);
+extern void close_ioengine(struct thread_data *);
+
+/*
+ * Mark unused variables passed to ops functions as unused, to silence gcc
+ */
+#define fio_unused __attribute((__unused__))
+#define fio_init __attribute__((constructor))
+#define fio_exit __attribute__((destructor))
+
+#define for_each_td(td, i) \
+ for ((i) = 0, (td) = &threads[0]; (i) < (int) thread_number; (i)++, (td)++)
+#define for_each_file(td, f, i) \
+ if ((td)->files_index) \
+ for ((i) = 0, (f) = (td)->files[0]; \
+ (i) < (td)->o.nr_files && ((f) = (td)->files[i]) != NULL; \
+ (i)++)
+
+#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)
+
+static inline void fio_file_reset(struct fio_file *f)