diff options
author | Noah Watkins <noahwatkins@gmail.com> | 2012-11-20 22:07:00 +0100 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-11-26 20:15:47 +0100 |
commit | 1f8c32347b6eba3ab2ab61c12f3b02f3431e10fc (patch) | |
tree | cf5e57f40af7f1eb43092780a19b8efb6cc0f623 /src/java/native | |
parent | client: add ceph_open_layout interface (diff) | |
download | ceph-1f8c32347b6eba3ab2ab61c12f3b02f3431e10fc.tar.xz ceph-1f8c32347b6eba3ab2ab61c12f3b02f3431e10fc.zip |
java: add ceph_open_layout interface
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Diffstat (limited to 'src/java/native')
-rw-r--r-- | src/java/native/libcephfs_jni.cc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/java/native/libcephfs_jni.cc b/src/java/native/libcephfs_jni.cc index b8fdd01e1cc..775812f189f 100644 --- a/src/java/native/libcephfs_jni.cc +++ b/src/java/native/libcephfs_jni.cc @@ -1404,6 +1404,58 @@ JNIEXPORT jint JNICALL Java_com_ceph_fs_CephMount_native_1ceph_1open /* * Class: com_ceph_fs_CephMount + * Method: native_ceph_open_layout + * Signature: (JLjava/lang/String;IIIIILjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_com_ceph_fs_CephMount_native_1ceph_1open_1layout + (JNIEnv *env, jclass clz, jlong j_mntp, jstring j_path, jint j_flags, jint j_mode, + jint stripe_unit, jint stripe_count, jint object_size, jstring j_data_pool) +{ + struct ceph_mount_info *cmount = get_ceph_mount(j_mntp); + CephContext *cct = ceph_get_mount_context(cmount); + const char *c_path, *c_data_pool = NULL; + int ret, flags = fixup_open_flags(j_flags); + + CHECK_ARG_NULL(j_path, "@path is null", -1); + CHECK_MOUNTED(cmount, -1); + + c_path = env->GetStringUTFChars(j_path, NULL); + if (!c_path) { + cephThrowInternal(env, "Failed to pin memory"); + return -1; + } + + if (j_data_pool) { + c_data_pool = env->GetStringUTFChars(j_data_pool, NULL); + if (!c_data_pool) { + env->ReleaseStringUTFChars(j_path, c_path); + cephThrowInternal(env, "Failed to pin memory"); + return -1; + } + } + + ldout(cct, 10) << "jni: open_layout: path " << c_path << " flags " << flags + << " mode " << (int)j_mode << " stripe_unit " << stripe_unit + << " stripe_count " << stripe_count << " object_size " << object_size + << " data_pool " << (c_data_pool ? c_data_pool : "<NULL>") << dendl; + + ret = ceph_open_layout(cmount, c_path, flags, (int)j_mode, + (int)stripe_unit, (int)stripe_count, (int)object_size, c_data_pool); + + ldout(cct, 10) << "jni: open_layout: exit ret " << ret << dendl; + + env->ReleaseStringUTFChars(j_path, c_path); + if (j_data_pool) + env->ReleaseStringUTFChars(j_data_pool, c_data_pool); + + if (ret < 0) + handle_error(env, ret); + + return ret; +} + +/* + * Class: com_ceph_fs_CephMount * Method: native_ceph_close * Signature: (JI)I */ |