diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c74b4867..56648c20 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,6 +3,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) add_subdirectory(gitversion) add_subdirectory(cpp-utils) add_subdirectory(fspp) +add_subdirectory(jni) add_subdirectory(parallelaccessstore) add_subdirectory(blockstore) add_subdirectory(blobstore) diff --git a/src/fspp/fuse/CMakeLists.txt b/src/fspp/fuse/CMakeLists.txt index 29f72a4b..bc832e89 100644 --- a/src/fspp/fuse/CMakeLists.txt +++ b/src/fspp/fuse/CMakeLists.txt @@ -4,7 +4,6 @@ set(SOURCES ../impl/FilesystemImpl.cpp ../impl/Profiler.cpp ../fuse/Fuse.cpp - jni.cpp ) add_library(${PROJECT_NAME} STATIC ${SOURCES}) diff --git a/src/jni/CMakeLists.txt b/src/jni/CMakeLists.txt new file mode 100644 index 00000000..22b6e39c --- /dev/null +++ b/src/jni/CMakeLists.txt @@ -0,0 +1,12 @@ +project (libcryfs-jni) + +add_library(${PROJECT_NAME} STATIC libcryfs-jni.cpp) + +target_link_libraries(${PROJECT_NAME} PUBLIC fspp-fuse) + +target_enable_style_warnings(${PROJECT_NAME}) +target_activate_cpp14(${PROJECT_NAME}) + +set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER include/libcryfs-jni.h) +target_include_directories(${PROJECT_NAME} PUBLIC include) + diff --git a/src/jni/include/libcryfs-jni.h b/src/jni/include/libcryfs-jni.h new file mode 100644 index 00000000..c1acdad4 --- /dev/null +++ b/src/jni/include/libcryfs-jni.h @@ -0,0 +1,17 @@ +#include + +jlong cryfs_init(JNIEnv* env, jstring jbaseDir, jstring jlocalSateDir, jbyteArray jpassword, jboolean createBaseDir, jstring jcipher); +jlong cryfs_create(JNIEnv* env, jlong fusePtr, jstring jpath, mode_t mode); +jlong cryfs_open(JNIEnv* env, jlong fusePtr, jstring jpath, jint flags); +jint cryfs_read(JNIEnv* env, jlong fusePtr, jlong fileHandle, jbyteArray jbuffer, jlong offset); +jint cryfs_write(JNIEnv* env, jlong fusePtr, jlong fileHandle, jlong offset, jbyteArray jbuffer, jint size); +jint cryfs_truncate(JNIEnv* env, jlong fusePtr, jstring jpath, jlong size); +jint cryfs_unlink(JNIEnv* env, jlong fusePtr, jstring jpath); +jint cryfs_release(jlong fusePtr, jlong fileHandle); +jlong cryfs_readdir(JNIEnv* env, jlong fusePtr, jstring jpath ,void* data, int(void*, const char*, const struct stat*)); +jint cryfs_mkdir(JNIEnv* env, jlong fusePtr, jstring jpath, mode_t mode); +jint cryfs_rmdir(JNIEnv* env, jlong fusePtr, jstring jpath); +jint cryfs_getattr(JNIEnv* env, jlong fusePtr, jstring jpath, struct stat* stat); +jint cryfs_rename(JNIEnv* env, jlong fusePtr, jstring jsrcPath, jstring jdstPath); +void cryfs_destroy(jlong fusePtr); +jboolean cryfs_is_closed(jlong fusePtr); diff --git a/src/fspp/fuse/jni.cpp b/src/jni/libcryfs-jni.cpp similarity index 99% rename from src/fspp/fuse/jni.cpp rename to src/jni/libcryfs-jni.cpp index 3214036e..c8264600 100644 --- a/src/fspp/fuse/jni.cpp +++ b/src/jni/libcryfs-jni.cpp @@ -1,6 +1,6 @@ #include #include -#include "Fuse.h" +#include using std::unique_ptr; using std::make_unique;