Advertisement
Guest User

Untitled

a guest
Oct 27th, 2011
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. diff --git a/src/client/hadoop/CephFSInterface.cc b/src/client/hadoop/CephFSInterface.cc
  2. index b8a6a3b..3b330fc 100644
  3. --- a/src/client/hadoop/CephFSInterface.cc
  4. +++ b/src/client/hadoop/CephFSInterface.cc
  5. @@ -411,6 +411,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_apache_hadoop_fs_ceph_CephTalker_ceph_1g
  6. if (r==-ERANGE) { //expand the buffer
  7. delete [] buf;
  8. buflen *= 2;
  9. + fprintf(stderr, "new buflen: %d\n", buflen);
  10. buf = new char[buflen];
  11. continue;
  12. }
  13. @@ -741,10 +742,18 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephTalker_ceph_1statfs
  14. * Returns: an int containing the number of times replicated.
  15. */
  16. JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephTalker_ceph_1replication
  17. -(JNIEnv *env, jobject obj, jint fh)
  18. +(JNIEnv *env, jobject obj, jstring j_path)
  19. {
  20. - struct ceph_mount_info *cmount = get_ceph_mount_t(env, obj);
  21. - int replication = ceph_get_file_replication(cmount, (int)fh);
  22. + //get c-string of path, send off to libceph, release c-string, return
  23. + const char *c_path = env->GetStringUTFChars(j_path, 0);
  24. + if (c_path == NULL)
  25. + return -ENOMEM;
  26. + ceph_mount_info *cmount = get_ceph_mount_t(env, obj);
  27. + int fh = 0;
  28. + fh = ceph_open(cmount, c_path, O_RDONLY, 0);
  29. + int replication = ceph_get_file_replication(cmount, fh);
  30. + ceph_close(cmount, fh);
  31. + env->ReleaseStringUTFChars(j_path, c_path);
  32. return replication;
  33. }
  34.  
  35. diff --git a/src/client/hadoop/org_apache_hadoop_fs_ceph_CephTalker.h b/src/client/hadoop/org_apache_hadoop_fs_ceph_CephTalker.h
  36. index e1051a7..5585454 100644
  37. --- a/src/client/hadoop/org_apache_hadoop_fs_ceph_CephTalker.h
  38. +++ b/src/client/hadoop/org_apache_hadoop_fs_ceph_CephTalker.h
  39. @@ -170,10 +170,10 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephTalker_ceph_1statfs
  40. /*
  41. * Class: org_apache_hadoop_fs_ceph_CephTalker
  42. * Method: ceph_replication
  43. - * Signature: (I)I
  44. + * Signature: (Ljava/lang/String;)I
  45. */
  46. JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephTalker_ceph_1replication
  47. - (JNIEnv *, jobject, jint);
  48. + (JNIEnv *, jobject, jstring);
  49.  
  50. /*
  51. * Class: org_apache_hadoop_fs_ceph_CephTalker
  52.  
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement