Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public String getMessage() {
}
}

// Denotes the state of supporting PMDK. The value is set by JNI.
// Denotes the state of supporting PMDK. The actual value is set via JNI.
private static SupportState pmdkSupportState =
SupportState.UNSUPPORTED;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@
#endif

PmdkLibLoader * pmdkLoader;
// 1 represents loaded. Otherwise, not loaded.
int pmdkLoaded;

/**
* pmdk_load.c
* Utility of loading the libpmem library and the required functions.
* Building of this codes won't rely on any libpmem source codes, but running
* into this will rely on successfully loading of the dynamic library.
*
*/

static const char* load_functions() {
Expand All @@ -56,6 +57,10 @@ static const char* load_functions() {
return NULL;
}

/**
* It should be idempotent to call this function for checking
* whether PMDK lib is successfully loaded.
*/
void load_pmdk_lib(char* err, size_t err_len) {
const char* errMsg;
const char* library = NULL;
Expand All @@ -67,10 +72,13 @@ void load_pmdk_lib(char* err, size_t err_len) {

err[0] = '\0';

if (pmdkLoader != NULL) {
if (pmdkLoaded == 1) {
return;
}
pmdkLoader = calloc(1, sizeof(PmdkLibLoader));

if (pmdkLoader == NULL) {
pmdkLoader = calloc(1, sizeof(PmdkLibLoader));
}

// Load PMDK library
#ifdef UNIX
Expand Down Expand Up @@ -103,4 +111,5 @@ void load_pmdk_lib(char* err, size_t err_len) {
}

pmdkLoader->libname = strdup(library);
pmdkLoaded = 1;
}