-struct PMEMblkpool_s;
-typedef struct PMEMblkpool_s PMEMblkpool;
-
-static PMEMblkpool *(*pmemblk_create) (const char *, size_t, size_t, mode_t);
-static PMEMblkpool *(*pmemblk_open) (const char *, size_t);
-static void (*pmemblk_close) (PMEMblkpool *);
-static size_t(*pmemblk_nblock) (PMEMblkpool *);
-static size_t(*pmemblk_bsize) (PMEMblkpool *);
-static int (*pmemblk_read) (PMEMblkpool *, void *, off_t);
-static int (*pmemblk_write) (PMEMblkpool *, const void *, off_t);
-
-int load_libpmemblk(const char *path)
-{
- void *dl;
-
- if (!path)
- path = "libpmemblk.so";
-
- dl = dlopen(path, RTLD_NOW | RTLD_NODELETE);
- if (!dl)
- goto errorout;
-
- pmemblk_create = dlsym(dl, "pmemblk_create");
- if (!pmemblk_create)
- goto errorout;
- pmemblk_open = dlsym(dl, "pmemblk_open");
- if (!pmemblk_open)
- goto errorout;
- pmemblk_close = dlsym(dl, "pmemblk_close");
- if (!pmemblk_close)
- goto errorout;
- pmemblk_nblock = dlsym(dl, "pmemblk_nblock");
- if (!pmemblk_nblock)
- goto errorout;
- pmemblk_bsize = dlsym(dl, "pmemblk_bsize");
- if (!pmemblk_bsize)
- goto errorout;
- pmemblk_read = dlsym(dl, "pmemblk_read");
- if (!pmemblk_read)
- goto errorout;
- pmemblk_write = dlsym(dl, "pmemblk_write");
- if (!pmemblk_write)
- goto errorout;
-
- return 0;
-
-errorout:
- log_err("fio: unable to load libpmemblk: %s\n", dlerror());
- if (dl)
- dlclose(dl);
-
- return -1;
-}
-