From b34648eddbd8f76cb0e87083ef44d73124535c4a Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Thu, 23 Jul 2009 11:07:48 -0700 Subject: [PATCH] Hadoop: Compiles now. Stupid macros. --- src/client/hadoop/CephFSInterface.cc | 7 ++++--- src/client/hadoop/CephFSInterface.h | 4 ++-- src/client/hadoop/ceph/CephFileSystem.java | 9 +++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/client/hadoop/CephFSInterface.cc b/src/client/hadoop/CephFSInterface.cc index 703db00734915..24b47215c1522 100644 --- a/src/client/hadoop/CephFSInterface.cc +++ b/src/client/hadoop/CephFSInterface.cc @@ -14,10 +14,10 @@ using namespace std; /* * Class: org_apache_hadoop_fs_ceph_CephFileSystem * Method: ceph_initializeClient - * Signature: ()J + * Signature: ()Z * Initializes a ceph client. */ -JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient +JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient (JNIEnv *env, jobject, jstring j_mon_host) { dout(3) << "CephFSInterface: Initializing Ceph client:" << dendl; @@ -31,6 +31,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1init ceph_initialize(argc, argv); ceph_mount(); + return true; } @@ -273,7 +274,7 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1e struct stat stbuf; const char* c_path = env->GetStringUTFChars(j_path, 0); - dout(10) << "Attempting lstat with file " << c_path << ":" ; + dout(10) << "Attempting lstat with file " << c_path << ":" << dendl; int result = ceph_lstat(c_path, &stbuf); dout(10) << "result is " << result << dendl; env->ReleaseStringUTFChars(j_path, c_path); diff --git a/src/client/hadoop/CephFSInterface.h b/src/client/hadoop/CephFSInterface.h index 84c03c09cfbd9..daa6a82bc05b2 100644 --- a/src/client/hadoop/CephFSInterface.h +++ b/src/client/hadoop/CephFSInterface.h @@ -18,9 +18,9 @@ extern "C" { /* * Class: org_apache_hadoop_fs_ceph_CephFileSystem * Method: ceph_initializeClient - * Signature: ()J + * Signature: ()Z */ -JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient +JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient (JNIEnv *, jobject); /* diff --git a/src/client/hadoop/ceph/CephFileSystem.java b/src/client/hadoop/ceph/CephFileSystem.java index 8ac56537ecfa5..f2023636339a2 100644 --- a/src/client/hadoop/ceph/CephFileSystem.java +++ b/src/client/hadoop/ceph/CephFileSystem.java @@ -55,7 +55,7 @@ public class CephFileSystem extends FileSystem { * include wrapper functions to automatically add the parameter. */ - private native long ceph_initializeClient(); + private native boolean ceph_initializeClient(); private native boolean ceph_copyFromLocalFile(String localPath, String cephPath); private native boolean ceph_copyToLocalFile(String cephPath, String localPath); private native String ceph_getcwd(); @@ -100,9 +100,10 @@ public class CephFileSystem extends FileSystem { this.localFs = get(URI.create("file:///"), conf); // Initializes the client - this.clientPointer = ceph_initializeClient(); - System.out.println("Initialized client with pointer " + clientPointer - + ". Setting cwd to /"); + if (!ceph_initializeClient()) { + throw new IOException("Ceph initialization failed!"); + } + System.out.println("Initialized client. Setting cwd to /"); ceph_setcwd("/"); // DEBUG // attempt to do three exists operations on root -- 2.39.5