[PATCH] Allow io engine to do the file setup
[fio.git] / ioengines.c
index 723f310d6e1bcb8d28a2e6f637212dcfa489f5f8..82b7ec3f6f25957832e2f56fc2de83829a519aeb 100644 (file)
@@ -31,15 +31,26 @@ struct ioengine_ops *load_ioengine(struct thread_data *td, char *name)
        if (!strncmp(engine, "linuxaio", 8) || !strncmp(engine, "aio", 3))
                strcpy(engine, "libaio");
 
-       sprintf(engine_lib, "/usr/local/lib/fio/fio-engine-%s.o", engine);
+       sprintf(engine_lib, "%s/lib/fio/fio-engine-%s.o", fio_inst_prefix, engine);
        dlerror();
        dlhandle = dlopen(engine_lib, RTLD_LAZY);
-       if (!dlhandle)
-               printf("bla: %s\n", dlerror());
+       if (!dlhandle) {
+               td_vmsg(td, -1, dlerror());
+               return NULL;
+       }
 
        ops = dlsym(dlhandle, "ioengine");
-       if (!ops)
-               printf("get ops failed\n");
+       if (!ops) {
+               td_vmsg(td, -1, dlerror());
+               dlclose(dlhandle);
+               return NULL;
+       }
+
+       if (ops->version != FIO_IOOPS_VERSION) {
+               log_err("bad ioops version %d (want %d)\n", ops->version, FIO_IOOPS_VERSION);
+               dlclose(dlhandle);
+               return NULL;
+       }
 
        ops->dlhandle = dlhandle;
        return ops;