|
@@ -120,16 +120,19 @@ public class NativeIO {
|
|
|
public String getMessage() {
|
|
|
String msg;
|
|
|
switch (stateCode) {
|
|
|
+ // -1 represents UNSUPPORTED.
|
|
|
case -1:
|
|
|
- msg = "The native code is built without PMDK support.";
|
|
|
+ msg = "The native code was built without PMDK support.";
|
|
|
break;
|
|
|
+ // 1 represents PMDK_LIB_NOT_FOUND.
|
|
|
case 1:
|
|
|
- msg = "The native code is built with PMDK support, but PMDK libs " +
|
|
|
- "are NOT found in execution environment or failed to be loaded.";
|
|
|
+ msg = "The native code was built with PMDK support, but PMDK libs " +
|
|
|
+ "were NOT found in execution environment or failed to be loaded.";
|
|
|
break;
|
|
|
+ // 0 represents SUPPORTED.
|
|
|
case 0:
|
|
|
- msg = "The native code is built with PMDK support, and PMDK libs " +
|
|
|
- "are loaded successfully.";
|
|
|
+ msg = "The native code was built with PMDK support, and PMDK libs " +
|
|
|
+ "were loaded successfully.";
|
|
|
break;
|
|
|
default:
|
|
|
msg = "The state code: " + stateCode + " is unrecognized!";
|
|
@@ -140,7 +143,7 @@ public class NativeIO {
|
|
|
|
|
|
// Denotes the state of supporting PMDK. The value is set by JNI.
|
|
|
private static SupportState pmdkSupportState =
|
|
|
- SupportState.PMDK_LIB_NOT_FOUND;
|
|
|
+ SupportState.UNSUPPORTED;
|
|
|
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(NativeIO.class);
|
|
|
|
|
@@ -177,6 +180,14 @@ public class NativeIO {
|
|
|
LOG.error("The state code: " + stateCode + " is unrecognized!");
|
|
|
}
|
|
|
|
|
|
+ public static String getPmdkSupportStateMessage() {
|
|
|
+ if (getPmdkLibPath() != null) {
|
|
|
+ return pmdkSupportState.getMessage() +
|
|
|
+ " The pmdk lib path: " + getPmdkLibPath();
|
|
|
+ }
|
|
|
+ return pmdkSupportState.getMessage();
|
|
|
+ }
|
|
|
+
|
|
|
public static boolean isPmdkAvailable() {
|
|
|
LOG.info(pmdkSupportState.getMessage());
|
|
|
return pmdkSupportState == SupportState.SUPPORTED;
|
|
@@ -242,8 +253,13 @@ public class NativeIO {
|
|
|
NativeIO.POSIX.pmemSync(region.getAddress(), region.getLength());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public static String getPmdkLibPath() {
|
|
|
+ return POSIX.getPmdkLibPath();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ private static native String getPmdkLibPath();
|
|
|
private static native boolean isPmemCheck(long address, long length);
|
|
|
private static native PmemMappedRegion pmemCreateMapFile(String path,
|
|
|
long length);
|