* Signature: (Ljava/lang/String;Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
- (JNIEnv * env, jobject obj, jstring j_debug_level, jstring j_mon_addr)
+ (JNIEnv *env, jobject obj, jstring j_debug_level, jstring j_mon_addr)
{
dout(3) << "CephFSInterface: Initializing Ceph client:" << dendl;
- const char* c_debug_level = env->GetStringUTFChars(j_debug_level, 0);
+ const char *c_debug_level = env->GetStringUTFChars(j_debug_level, 0);
if (c_debug_level == NULL) return false; //out of memory!
- const char* c_mon_addr = env->GetStringUTFChars(j_mon_addr, 0);
+ const char *c_mon_addr = env->GetStringUTFChars(j_mon_addr, 0);
if(c_mon_addr == NULL) {
env->ReleaseStringUTFChars(j_debug_level, c_debug_level);
return false;
{
dout(10) << "CephFSInterface: In setcwd" << dendl;
- const char* c_path = env->GetStringUTFChars(j_path, 0);
+ const char *c_path = env->GetStringUTFChars(j_path, 0);
if(c_path == NULL ) return false;
jboolean success = (0 <= ceph_chdir(c_path)) ? JNI_TRUE : JNI_FALSE;
env->ReleaseStringUTFChars(j_path, c_path);
{
dout(10) << "CephFSInterface: In rmdir" << dendl;
- const char* c_path = env->GetStringUTFChars(j_path, 0);
+ const char *c_path = env->GetStringUTFChars(j_path, 0);
if(c_path == NULL ) return false;
jboolean success = (0 == ceph_rmdir(c_path)) ? JNI_TRUE : JNI_FALSE;
env->ReleaseStringUTFChars(j_path, c_path);
* Creates a directory with full permissions.
*/
JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1mkdir
- (JNIEnv * env, jobject, jstring j_path)
+ (JNIEnv *env, jobject, jstring j_path)
{
dout(10) << "CephFSInterface: In mkdir" << dendl;
- const char* c_path = env->GetStringUTFChars(j_path, 0);
+ const char *c_path = env->GetStringUTFChars(j_path, 0);
if (c_path == NULL) return false;
jboolean success = (0 == ceph_mkdir(c_path, 0xFF)) ? JNI_TRUE : JNI_FALSE;
env->ReleaseStringUTFChars(j_path, c_path);
* Unlinks a path.
*/
JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1unlink
- (JNIEnv * env, jobject, jstring j_path)
+ (JNIEnv *env, jobject, jstring j_path)
{
- const char* c_path = env->GetStringUTFChars(j_path, 0);
+ const char *c_path = env->GetStringUTFChars(j_path, 0);
if (c_path == NULL) return false;
dout(10) << "CephFSInterface: In unlink for path " << c_path << ":" << dendl;
int result = ceph_unlink(c_path);
(JNIEnv *env, jobject, jstring j_from, jstring j_to)
{
dout(10) << "CephFSInterface: In rename" << dendl;
- const char* c_from = env->GetStringUTFChars(j_from, 0);
+ const char *c_from = env->GetStringUTFChars(j_from, 0);
if (c_from == NULL) return false;
- const char* c_to = env->GetStringUTFChars(j_to, 0);
+ const char *c_to = env->GetStringUTFChars(j_to, 0);
if (c_to == NULL) {
env->ReleaseStringUTFChars(j_from, c_from);
return false;
struct stat stbuf;
- const char* c_path = env->GetStringUTFChars(j_path, 0);
+ const char *c_path = env->GetStringUTFChars(j_path, 0);
if (c_path == NULL) return false;
dout(10) << "Attempting lstat with file " << c_path << ":" << dendl;
int result = ceph_lstat(c_path, &stbuf);
jint result;
- const char* c_path = env->GetStringUTFChars(j_path, 0);
+ const char *c_path = env->GetStringUTFChars(j_path, 0);
if (c_path == NULL) return -ENOMEM;
// we need to open the file to retrieve the stripe size
dout(10) << "CephFSInterface: getblocksize: opening file" << dendl;
struct stat stbuf;
- const char* c_path = env->GetStringUTFChars(j_path, 0);
+ const char *c_path = env->GetStringUTFChars(j_path, 0);
if (c_path == NULL) return false;
int result = ceph_lstat(c_path, &stbuf);
env->ReleaseStringUTFChars(j_path, c_path);
struct stat stbuf;
- const char* c_path = env->GetStringUTFChars(j_path, 0);
+ const char *c_path = env->GetStringUTFChars(j_path, 0);
if (c_path == NULL) return false;
int result = ceph_lstat(c_path, &stbuf);
env->ReleaseStringUTFChars(j_path, c_path);
* Returns a Java array of Strings with the directory contents
*/
JNIEXPORT jobjectArray JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1getdir
-(JNIEnv *env, jobject obj, jstring j_path) {
-
+(JNIEnv *env, jobject obj, jstring j_path)
+{
dout(10) << "In getdir" << dendl;
// get the directory listing
list<string> contents;
- const char* c_path = env->GetStringUTFChars(j_path, 0);
+ const char *c_path = env->GetStringUTFChars(j_path, 0);
if (c_path == NULL) return NULL;
DIR *dirp;
ceph_opendir(c_path, &dirp);
* Create the specified directory and any required intermediate ones.
*/
JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1mkdirs
-(JNIEnv *env, jobject, jstring j_path, jint mode) {
+(JNIEnv *env, jobject, jstring j_path, jint mode)
+{
dout(10) << "In Hadoop mk_dirs" << dendl;
//get c-style string and make the call, clean up the string...
jint result;
- const char* c_path = env->GetStringUTFChars(j_path, 0);
+ const char *c_path = env->GetStringUTFChars(j_path, 0);
if (c_path == NULL) return -ENOMEM;
result = ceph_mkdirs(c_path, mode);
env->ReleaseStringUTFChars(j_path, c_path);
* Open a file for writing
*/
JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1open_1for_1append
-(JNIEnv *env, jobject obj, jstring j_path){
+(JNIEnv *env, jobject obj, jstring j_path)
+{
dout(10) << "In hadoop open_for_append" << dendl;
jint result;
jint result;
// open as read-only: flag = O_RDONLY
- const char* c_path = env->GetStringUTFChars(j_path, 0);
+ const char *c_path = env->GetStringUTFChars(j_path, 0);
if (c_path == NULL) return -ENOMEM;
result = ceph_open(c_path, O_RDONLY);
env->ReleaseStringUTFChars(j_path, c_path);
jint result;
- const char* c_path = env->GetStringUTFChars(j_path, 0);
+ const char *c_path = env->GetStringUTFChars(j_path, 0);
if (c_path == NULL) return -ENOMEM;
result = ceph_open(c_path, O_WRONLY|O_CREAT|O_TRUNC, mode);
env->ReleaseStringUTFChars(j_path, c_path);
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1close
-(JNIEnv * env, jobject ojb, jint fh) {
+(JNIEnv *env, jobject ojb, jint fh)
+{
dout(10) << "In CephFileSystem::ceph_close" << dendl;
return ceph_close(fh);
* Signature: (Ljava/lang/String;I)Z
*/
JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1setPermission
-(JNIEnv *env, jobject obj, jstring j_path, jint j_new_mode) {
- const char* c_path = env->GetStringUTFChars(j_path, 0);
+(JNIEnv *env, jobject obj, jstring j_path, jint j_new_mode)
+{
+ const char *c_path = env->GetStringUTFChars(j_path, 0);
if (c_path == NULL) return false;
int result = ceph_chmod(c_path, j_new_mode);
env->ReleaseStringUTFChars(j_path, c_path);
* Signature: (Ljava/lang/String;Lorg/apache/hadoop/fs/ceph/CephFileSystem/Stat;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1stat
-(JNIEnv * env, jobject obj, jstring j_path, jobject j_stat) {
+(JNIEnv *env, jobject obj, jstring j_path, jobject j_stat)
+{
//setup variables
struct stat_precise st;
- const char* c_path = env->GetStringUTFChars(j_path, 0);
+ const char *c_path = env->GetStringUTFChars(j_path, 0);
if (c_path == NULL) return false;
jclass cls = env->GetObjectClass(j_stat);
* Signature: (Ljava/lang/String;Lorg/apache/hadoop/fs/ceph/CephFileSystem/CephStat;)I
*/
JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1statfs
-(JNIEnv * env, jobject obj, jstring j_path, jobject j_cephstat)
+(JNIEnv *env, jobject obj, jstring j_path, jobject j_cephstat)
{
//setup variables
struct statvfs stbuf;
* Signature: (Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1replication
-(JNIEnv *env, jobject obj, jstring j_path) {
+(JNIEnv *env, jobject obj, jstring j_path)
+{
//get c-string of path, send off to libceph, release c-string, return
- const char* c_path = env->GetStringUTFChars(j_path, 0);
+ const char *c_path = env->GetStringUTFChars(j_path, 0);
if (c_path == NULL) return -ENOMEM;
int replication = ceph_get_file_replication(c_path);
env->ReleaseStringUTFChars(j_path, c_path);
* Signature: (IJ)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1hosts
-(JNIEnv * env, jobject obj, jint j_fh, jlong j_offset) {
+(JNIEnv *env, jobject obj, jint j_fh, jlong j_offset)
+{
//get the address
char *address = new char[IP_ADDR_LENGTH];
int r = ceph_get_file_stripe_address(j_fh, j_offset, address, IP_ADDR_LENGTH);
* Signature: (Ljava/lang/String;JJ)I
*/
JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1setTimes
-(JNIEnv * env, jobject obj, jstring j_path, jlong mtime, jlong atime) {
+(JNIEnv *env, jobject obj, jstring j_path, jlong mtime, jlong atime)
+{
const char *c_path = env->GetStringUTFChars(j_path, 0);
if(c_path == NULL) return -ENOMEM;
jint result;
// Step 1: get a pointer to the buffer.
- jbyte* j_buffer_ptr = env->GetByteArrayElements(j_buffer, NULL);
+ jbyte *j_buffer_ptr = env->GetByteArrayElements(j_buffer, NULL);
if (j_buffer_ptr == NULL) return -ENOMEM;
- char* c_buffer = (char*) j_buffer_ptr;
+ char *c_buffer = (char*) j_buffer_ptr;
// Step 2: pointer arithmetic to start in the right buffer position
c_buffer += (int)buffer_offset;
jint result;
// Step 1: get a pointer to the buffer.
- jbyte* j_buffer_ptr = env->GetByteArrayElements(j_buffer, NULL);
+ jbyte *j_buffer_ptr = env->GetByteArrayElements(j_buffer, NULL);
if (j_buffer_ptr == NULL) return -ENOMEM;
- char* c_buffer = (char*) j_buffer_ptr;
+ char *c_buffer = (char*) j_buffer_ptr;
// Step 2: pointer arithmetic to start in the right buffer position
c_buffer += (int)buffer_offset;