+
+#else
+
+#ifdef FIO_EXTERNAL_ENGINE
+
+struct NullData {
+ NullData(struct thread_data *td)
+ {
+ null_init(td, &impl_);
+ }
+
+ ~NullData()
+ {
+ null_cleanup(impl_);
+ }
+
+ static NullData *get(struct thread_data *td)
+ {
+ return reinterpret_cast<NullData *>(td->io_ops_data);
+ }
+
+ io_u *fio_null_event(struct thread_data *, int event)
+ {
+ return null_event(impl_, event);
+ }
+
+ int fio_null_getevents(struct thread_data *, unsigned int min_events,
+ unsigned int max, const struct timespec *t)
+ {
+ return null_getevents(impl_, min_events, max, t);
+ }
+
+ int fio_null_commit(struct thread_data *td)
+ {
+ return null_commit(td, impl_);
+ }
+
+ int fio_null_queue(struct thread_data *td, struct io_u *io_u)
+ {
+ return null_queue(td, impl_, io_u);
+ }
+
+ int fio_null_open(struct thread_data *, struct fio_file *f)
+ {
+ return null_open(impl_, f);
+ }
+
+ struct null_data *impl_;
+};
+
+extern "C" {
+
+static struct io_u *fio_null_event(struct thread_data *td, int event)
+{
+ return NullData::get(td)->fio_null_event(td, event);
+}
+
+static int fio_null_getevents(struct thread_data *td, unsigned int min_events,
+ unsigned int max, const struct timespec *t)
+{
+ return NullData::get(td)->fio_null_getevents(td, min_events, max, t);
+}
+
+static int fio_null_commit(struct thread_data *td)
+{
+ return NullData::get(td)->fio_null_commit(td);
+}
+
+static int fio_null_queue(struct thread_data *td, struct io_u *io_u)
+{
+ return NullData::get(td)->fio_null_queue(td, io_u);
+}
+
+static int fio_null_open(struct thread_data *td, struct fio_file *f)
+{
+ return NullData::get(td)->fio_null_open(td, f);
+}
+
+static int fio_null_init(struct thread_data *td)
+{
+ td->io_ops_data = new NullData(td);
+ return 0;
+}
+
+static void fio_null_cleanup(struct thread_data *td)
+{
+ delete NullData::get(td);
+}
+
+static struct ioengine_ops ioengine;
+void get_ioengine(struct ioengine_ops **ioengine_ptr)
+{
+ *ioengine_ptr = &ioengine;
+
+ ioengine.name = "cpp_null";
+ ioengine.version = FIO_IOOPS_VERSION;
+ ioengine.queue = fio_null_queue;
+ ioengine.commit = fio_null_commit;
+ ioengine.getevents = fio_null_getevents;
+ ioengine.event = fio_null_event;
+ ioengine.init = fio_null_init;
+ ioengine.cleanup = fio_null_cleanup;
+ ioengine.open_file = fio_null_open;
+ ioengine.flags = FIO_DISKLESSIO | FIO_FAKEIO;
+}
+}
+#endif /* FIO_EXTERNAL_ENGINE */
+
+#endif /* __cplusplus */