+/*
+ * If logging output to a file, stderr should go to both stderr and f_err
+ */
+#define log_err(args...) do { \
+ fprintf(f_err, ##args); \
+ if (f_err != stderr) \
+ fprintf(stderr, ##args); \
+ } while (0)
+
+struct ioengine_ops {
+ 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 (*getevents)(struct thread_data *, int, 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 (*sync)(struct thread_data *, struct fio_file *);
+ void *data;
+ void *dlhandle;
+};
+
+#define FIO_IOOPS_VERSION 2
+
+extern struct ioengine_ops *load_ioengine(struct thread_data *, char *);
+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 for_each_td(td, i) \
+ for ((i) = 0, (td) = &threads[0]; (i) < (int) thread_number; (i)++, (td)++)
+#define for_each_file(td, f, i) \
+ for ((i) = 0, (f) = &(td)->files[0]; (i) < (int) (td)->nr_files; (i)++, (f)++)
+