Clean JNI library

This commit is contained in:
Matéo Duparc 2022-06-25 18:45:37 +02:00
parent f03d39433c
commit 267fb40fe7
Signed by: hardcoresushi
GPG Key ID: AFE384344A45E13A
5 changed files with 31 additions and 2 deletions

View File

@ -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)

View File

@ -4,7 +4,6 @@ set(SOURCES
../impl/FilesystemImpl.cpp
../impl/Profiler.cpp
../fuse/Fuse.cpp
jni.cpp
)
add_library(${PROJECT_NAME} STATIC ${SOURCES})

12
src/jni/CMakeLists.txt Normal file
View File

@ -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)

View File

@ -0,0 +1,17 @@
#include <jni.h>
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);

View File

@ -1,6 +1,6 @@
#include <jni.h>
#include <cryfs-cli/Cli.h>
#include "Fuse.h"
#include <fspp/fuse/Fuse.h>
using std::unique_ptr;
using std::make_unique;