Changeset 9395

Show
Ignore:
Timestamp:
07/23/12 17:17:51 (11 months ago)
Author:
denton
Message:

Improved functionality and corrected errors.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/client/otherint/JNI/libPVFS2JNI.c

    r9386 r9395  
    2828#include "PVFS2JNI.h" 
    2929 
     30#define JNI_DBG 0 
     31 
    3032void disp(struct stat *abc) 
    3133{ 
     
    6870} 
    6971 
    70 //pvfs_open 
     72/* pvfs_open */ 
    7173JNIEXPORT int JNICALL 
    7274Java_PVFS2JNI_pvfsOpen( 
     
    7880) 
    7981{ 
    80     printf("pvfsOpen\n"); 
    81     fflush(stdout); 
     82    if(JNI_DBG) printf("pvfsOpen\n"); 
    8283    int rc = 0; 
    8384    char cpath[PVFS_PATH_MAX]; 
     
    8687    if((flags & O_CREAT) == O_CREAT) 
    8788    { 
    88         printf("\tO_CREAT detected!\n"); 
     89        if(JNI_DBG) printf("\tO_CREAT detected!\n"); 
    8990        rc = pvfs_open(cpath, flags, mode); 
    9091    } 
    9192    else 
    9293    { 
    93         printf("\tNo O_CREAT detected\n"); 
     94        if(JNI_DBG) printf("\tNo O_CREAT detected\n"); 
    9495        rc = pvfs_open(cpath, flags); 
    9596    } 
     
    9798    { 
    9899        perror("pvfs_open error"); 
    99         fflush(stdout); 
    100         return -1; 
    101     } 
    102     return rc; 
    103 } 
    104 //pvfs_open64 06/08/2012 
     100        rc = -1; 
     101    } 
     102    if(JNI_DBG) fflush(stdout); 
     103    return rc; 
     104} 
     105 
     106/* pvfs_open64 06/08/2012 */ 
    105107JNIEXPORT int JNICALL 
    106108Java_PVFS2JNI_pvfsOpen64 (JNIEnv *env, jobject obj, jstring path, int flags) 
    107109{ 
    108     printf("pvfsOpen64\n"); 
    109     fflush(stdout); 
     110    if(JNI_DBG) printf("pvfsOpen64\n"); 
    110111    int rc = 0; 
    111112    char cpath[PVFS_PATH_MAX]; 
     
    116117    { 
    117118        perror("pvfs_open64 error"); 
    118         fflush(stdout); 
    119         return -1; 
    120     } 
    121     return rc; 
    122 } 
    123  
    124 //pvfs_openat 
     119        rc -1; 
     120    } 
     121    if(JNI_DBG) fflush(stdout); 
     122    return rc; 
     123} 
     124 
     125/* pvfs_openat */ 
    125126JNIEXPORT jint JNICALL 
    126127Java_PVFS2JNI_pvfsOpenat (JNIEnv *env, jobject obj, int dirfd, jstring path, int flags) 
    127128{ 
    128     printf("pvfsOpenat\n"); 
    129     fflush(stdout); 
     129    if(JNI_DBG) printf("pvfsOpenat\n"); 
    130130    int rc = 0; 
    131131    char cpath[PVFS_PATH_MAX]; 
     
    136136    { 
    137137        perror("pvfs_openat error"); 
    138         fflush(stdout); 
    139         return -1; 
    140     } 
    141     return rc; 
    142 } 
    143  
     138        rc = -1; 
     139    } 
     140    if(JNI_DBG) fflush(stdout); 
     141    return rc; 
     142} 
     143 
     144/* pvfs_openat64 */ 
    144145JNIEXPORT jint JNICALL 
    145146Java_PVFS2JNI_pvfsOpenat64 (JNIEnv *env, jobject obj, int dirfd, jstring path, int flags) 
    146147{ 
    147     printf("pvfsOpenat64\n"); 
    148     fflush(stdout); 
     148    if(JNI_DBG) printf("pvfsOpenat64\n"); 
    149149    int rc = 0; 
    150150    char cpath[PVFS_PATH_MAX]; 
     
    155155    { 
    156156        perror("pvfs_openat64 error"); 
    157         fflush(stdout); 
    158         return -1; 
    159     } 
    160     return rc; 
    161 } 
    162  
    163  
    164 //pvfs_creat 
     157        rc = -1; 
     158    } 
     159    if(JNI_DBG) fflush(stdout); 
     160    return rc; 
     161} 
     162 
     163/* pvfs_creat */ 
    165164JNIEXPORT int JNICALL 
    166165Java_PVFS2JNI_pvfsCreat(JNIEnv *env, jobject obj, jstring path, int mode) 
    167166{ 
    168     printf("pvfsCreat\n"); 
    169     fflush(stdout); 
     167    if(JNI_DBG) printf("pvfsCreat\n"); 
    170168    int rc = 0; 
    171169    char cpath[PVFS_PATH_MAX]; 
     
    176174    { 
    177175        perror("pvfs_creat error"); 
    178         fflush(stdout); 
    179         return -1; 
    180     } 
    181     return rc; 
    182 } 
    183  
    184 //pvfs_creat64 
     176        rc = -1; 
     177    } 
     178    if(JNI_DBG) fflush(stdout); 
     179    return rc; 
     180} 
     181 
     182/* pvfs_creat64 */ 
    185183JNIEXPORT int JNICALL 
    186184Java_PVFS2JNI_pvfsCreat64(JNIEnv *env, jobject obj, jstring path, int mode) 
    187185{ 
    188     printf("pvfsCreat64\n"); 
    189     fflush(stdout); 
     186    if(JNI_DBG) printf("pvfsCreat64\n"); 
    190187    int rc = 0; 
    191188    char cpath[PVFS_PATH_MAX]; 
     
    196193    { 
    197194        perror("pvfs_creat error"); 
    198         fflush(stdout); 
    199         return -1; 
    200     } 
    201     return rc; 
    202 } 
    203  
    204 //pvfs_unlink 
     195        rc = -1; 
     196    } 
     197    if(JNI_DBG) fflush(stdout); 
     198    return rc; 
     199} 
     200 
     201/* pvfs_unlink */ 
    205202JNIEXPORT int JNICALL 
    206203Java_PVFS2JNI_pvfsUnlink(JNIEnv *env, jobject obj, jstring path) 
    207204{ 
    208     printf("pvfsUnlink\n"); 
    209     fflush(stdout); 
     205    if(JNI_DBG) printf("pvfsUnlink\n"); 
    210206    int rc = 0; 
    211207    char cpath[PVFS_PATH_MAX]; 
     
    216212    { 
    217213        perror("pvfs_unlink error"); 
    218         fflush(stdout); 
    219         return -1; 
    220     } 
    221     return 0; 
    222 } 
    223  
    224 //pvfs_unlinkat 
    225  
     214        rc = -1; 
     215    } 
     216    if(JNI_DBG) fflush(stdout); 
     217    return rc; 
     218} 
     219 
     220/* pvfs_unlinkat */ 
    226221JNIEXPORT jint JNICALL 
    227222Java_PVFS2JNI_pvfsUnlinkat (JNIEnv *env, jobject obj, int dirfd, jstring path, int flags) 
    228223{ 
    229     printf("pvfsUnlinkat\n"); 
    230     fflush(stdout); 
     224    if(JNI_DBG) printf("pvfsUnlinkat\n"); 
    231225    int rc = 0; 
    232226    char cpath[PVFS_PATH_MAX]; 
     
    237231    { 
    238232        perror("pvfs_unlinkat error"); 
    239         fflush(stdout); 
    240         return -1; 
    241     } 
    242     return 0; 
    243 } 
    244 //pvfs_rename 
     233        rc = -1; 
     234    } 
     235    if(JNI_DBG) fflush(stdout); 
     236    return rc; 
     237} 
     238 
     239/* pvfs_rename */ 
    245240JNIEXPORT int JNICALL 
    246241Java_PVFS2JNI_pvfsRename(JNIEnv *env, 
     
    250245) 
    251246{ 
    252     printf("pvfsRename\n"); 
    253     fflush(stdout); 
     247    if(JNI_DBG) printf("pvfsRename\n"); 
    254248    int rc = 0; 
    255249    char coldpath[PVFS_PATH_MAX]; 
     
    259253    int cnewpath_len = (*env)->GetStringLength(env, newpath); 
    260254    (*env)->GetStringUTFRegion(env, newpath, 0, cnewpath_len, cnewpath); 
    261     //printf("oldpath=%s\tnewpath=%s\n", coldpath, cnewpath); 
    262255    rc = pvfs_rename(coldpath, cnewpath); 
    263256    if(rc < 0) 
    264257    { 
    265258        perror("pvfs_rename error"); 
    266         fflush(stdout); 
    267         return -1; 
    268     } 
    269     return 0; 
    270 } 
    271  
    272 //pvfs_RenameAt 
     259        rc = -1; 
     260    } 
     261    if(JNI_DBG) fflush(stdout); 
     262    return rc; 
     263} 
     264 
     265/* pvfs_RenameAt */ 
    273266JNIEXPORT int JNICALL 
    274267Java_PVFS2JNI_pvfsRenameAt(JNIEnv *env, 
     
    280273) 
    281274{ 
    282     printf("pvfsRenameAt\n"); 
    283     fflush(stdout); 
     275    if(JNI_DBG) printf("pvfsRenameAt\n"); 
    284276    int rc = 0; 
    285277    char coldpath[PVFS_PATH_MAX]; 
     
    289281    int cnewpath_len = (*env)->GetStringLength(env, newpath); 
    290282    (*env)->GetStringUTFRegion(env, newpath, 0, cnewpath_len, cnewpath); 
    291     //printf("oldpath=%s\tnewpath=%s\n", coldpath, cnewpath); 
    292283    rc = pvfs_renameat(olddirfd, coldpath, newdirfd, cnewpath); 
    293284    if(rc < 0) 
    294285    { 
    295286        perror("pvfs_renameat error"); 
    296         fflush(stdout); 
    297         return -1; 
    298     } 
    299     return 0; 
    300 } 
    301  
    302 //pvfs_close 
     287        rc = -1; 
     288    } 
     289    if(JNI_DBG) fflush(stdout); 
     290    return rc; 
     291} 
     292 
     293/* pvfs_close */ 
    303294JNIEXPORT int JNICALL 
    304295Java_PVFS2JNI_pvfsClose(JNIEnv *env, jobject obj, int fd) 
    305296{ 
    306     printf("pvfsClose\n"); 
    307     fflush(stdout); 
     297    if(JNI_DBG) printf("pvfsClose\n"); 
    308298    int rc = 0; 
    309299    rc = pvfs_close(fd); 
     
    311301    { 
    312302        perror("pvfs_close error"); 
    313         fflush(stdout); 
    314         return -1; 
    315     } 
    316     return 0; 
    317 } 
    318  
    319 //pvfs_flush 
     303        rc = -1; 
     304    } 
     305    if(JNI_DBG) fflush(stdout); 
     306    return rc; 
     307} 
     308 
     309/* pvfs_flush */ 
    320310JNIEXPORT int JNICALL 
    321311Java_PVFS2JNI_pvfsFlush(JNIEnv *env, jobject obj, int fd) 
    322312{ 
    323     printf("pvfsFlush\n"); 
    324     fflush(stdout); 
     313    if(JNI_DBG) printf("pvfsFlush\n"); 
    325314    int rc = 0; 
    326315    rc = pvfs_flush(fd); 
     
    328317    { 
    329318        perror("pvfs_close error"); 
    330         fflush(stdout); 
    331         return -1; 
    332     } 
    333     return 0; 
    334 } 
    335  
    336 //pvfs_prdwr64  (INCOMPLETE) 
    337  
    338 JNIEXPORT jint JNICALL 
    339 Java_PVFS2JNI_pvfsPrdwr64 (JNIEnv *env, jobject obj, int fd, jlong buf, jlong count, jlong offset, int which) 
     319        rc = -1; 
     320    } 
     321    if(JNI_DBG) fflush(stdout); 
     322    return rc; 
     323} 
     324 
     325/* pvfs_prdwr64  (INCOMPLETE) */ 
     326JNIEXPORT jint JNICALL 
     327Java_PVFS2JNI_pvfsPrdwr64(JNIEnv *env, jobject obj, int fd, jlong buf, jlong count, jlong offset, int which) 
    340328{ 
    341329    printf("pvfsPrdwr64\n"); 
     
    355343} 
    356344 
    357  
    358  
    359 // pvfs_lseek 
    360  
    361 JNIEXPORT jlong JNICALL 
    362 Java_PVFS2JNI_pvfsLseek (JNIEnv *env, jobject obj, int fd, jlong offset, int whence) 
    363 { 
    364     printf("pvfsLseek\n"); 
    365     fflush(stdout); 
     345/* pvfs_lseek */ 
     346JNIEXPORT jlong JNICALL 
     347Java_PVFS2JNI_pvfsLseek(JNIEnv *env, jobject obj, int fd, jlong offset, int whence) 
     348{ 
     349    if(JNI_DBG) printf("pvfsLseek\n"); 
    366350    off_t offsetc = (off_t) offset; 
    367351    off_t rc = pvfs_lseek(fd, offsetc, whence); 
     
    370354    { 
    371355        perror("pvfs_lseek error"); 
    372         fflush(stdout); 
    373         return -1; 
    374     } 
     356        op = -1; 
     357    } 
     358    if(JNI_DBG) fflush(stdout); 
    375359    return op; 
    376360} 
    377361 
    378 // pvfs_lseek64 
    379  
    380 JNIEXPORT jlong JNICALL 
    381 Java_PVFS2JNI_pvfsLseek64 (JNIEnv *env, jobject obj, int fd, jlong offset, int whence) 
    382 { 
    383     printf("pvfsLseek64\n"); 
    384     fflush(stdout); 
     362/* pvfs_lseek64 */ 
     363JNIEXPORT jlong JNICALL 
     364Java_PVFS2JNI_pvfsLseek64(JNIEnv *env, jobject obj, int fd, jlong offset, int whence) 
     365{ 
     366    if(JNI_DBG) printf("pvfsLseek64\n"); 
    385367    off_t offsetc = (off_t) offset; 
    386368    off_t rc = pvfs_lseek(fd, offsetc, whence); 
    387     if(rc < 0) 
     369    jlong op = (jlong)rc; 
     370    if(op < 0) 
    388371    { 
    389372        perror("pvfs_lseek64 error"); 
    390         fflush(stdout); 
    391         return -1; 
    392     } 
    393     jlong op = (jlong)rc; 
     373        op = -1; 
     374    } 
     375    if(JNI_DBG) fflush(stdout); 
    394376    return op; 
    395377} 
    396378 
    397 // pvfs_truncate 
    398 JNIEXPORT jint JNICALL 
    399 Java_PVFS2JNI_pvfsTruncate (JNIEnv *env, jobject obj, jstring path, jlong length) 
    400 { 
    401     printf("pvfsTruncate\n"); 
    402     fflush(stdout); 
     379/* pvfs_truncate */ 
     380JNIEXPORT jint JNICALL 
     381Java_PVFS2JNI_pvfsTruncate(JNIEnv *env, jobject obj, jstring path, jlong length) 
     382{ 
     383    if(JNI_DBG) printf("pvfsTruncate\n"); 
    403384    char cpath[PVFS_PATH_MAX]; 
    404385    int cpath_len = (*env)->GetStringLength(env, path); 
    405386    (*env)->GetStringUTFRegion(env, path, 0, cpath_len, cpath); 
    406387    off_t clength = (off_t) length; 
    407     int rc = 0; 
    408     rc = pvfs_truncate(cpath, clength); 
     388    int rc = pvfs_truncate(cpath, clength); 
    409389    if(rc < 0) 
    410390    { 
    411391        perror("pvfs_truncate error"); 
    412         fflush(stdout); 
    413         return -1; 
    414     } 
    415     return rc; 
    416 } 
    417  
    418  
    419  
    420 // pvfs_truncate64 
    421 JNIEXPORT jint JNICALL 
    422 Java_PVFS2JNI_pvfsTruncate64 (JNIEnv *env, jobject obj, jstring path, jlong length) 
    423 { 
    424     printf("pvfsTruncate64\n"); 
    425     fflush(stdout); 
     392        rc = -1; 
     393    } 
     394    if(JNI_DBG) fflush(stdout); 
     395    return rc; 
     396} 
     397 
     398/* pvfs_truncate64 */ 
     399JNIEXPORT jint JNICALL 
     400Java_PVFS2JNI_pvfsTruncate64(JNIEnv *env, jobject obj, jstring path, jlong length) 
     401{ 
     402    if(JNI_DBG) printf("pvfsTruncate64\n"); 
    426403    char cpath[PVFS_PATH_MAX]; 
    427404    int cpath_len = (*env)->GetStringLength(env, path); 
     
    433410    { 
    434411        perror("pvfs_truncate64 error"); 
    435         fflush(stdout); 
    436         return -1; 
    437     } 
    438     return rc; 
    439 } 
    440  
    441 //pvfs_fallocate 
    442 JNIEXPORT jint JNICALL 
    443 Java_PVFS2JNI_pvfsFallocate (JNIEnv *env, jobject obj, int fd, jlong offset, jlong length) 
    444 { 
    445     printf("pvfsFallocate\n"); 
    446     fflush(stdout); 
     412        rc = -1; 
     413    } 
     414    if(JNI_DBG) fflush(stdout); 
     415    return rc; 
     416} 
     417 
     418/* pvfs_fallocate */ 
     419JNIEXPORT jint JNICALL 
     420Java_PVFS2JNI_pvfsFallocate(JNIEnv *env, jobject obj, int fd, jlong offset, jlong length) 
     421{ 
     422    if(JNI_DBG) printf("pvfsFallocate\n"); 
    447423    off_t coffset = (off_t) offset; 
    448424    off_t clength = (off_t) length; 
     
    452428    { 
    453429        perror("pvfs_fallocate error"); 
    454         fflush(stdout); 
    455         return -1; 
    456     } 
    457     return rc; 
    458 } 
    459  
    460 //pvfs_ftruncate 
    461 JNIEXPORT jint JNICALL 
    462 Java_PVFS2JNI_pvfsFtruncate (JNIEnv *env, jobject obj, int fd, jlong length) 
    463 { 
    464     printf("pvfsFtruncate\n"); 
    465     fflush(stdout); 
     430        rc = -1; 
     431    } 
     432    if(JNI_DBG) fflush(stdout); 
     433    return rc; 
     434} 
     435 
     436/* pvfs_ftruncate */ 
     437JNIEXPORT jint JNICALL 
     438Java_PVFS2JNI_pvfsFtruncate(JNIEnv *env, jobject obj, int fd, jlong length) 
     439{ 
     440    if(JNI_DBG) printf("pvfsFtruncate\n"); 
    466441    off_t clength = (off_t) length; 
    467442    int rc = 0; 
     
    470445    { 
    471446        perror("pvfs_ftruncate error"); 
    472         fflush(stdout); 
    473         return -1; 
    474     } 
    475     return rc; 
    476 } 
    477  
    478 //pvfs_ftruncate64 
    479  
    480 JNIEXPORT jint JNICALL 
    481 Java_PVFS2JNI_pvfsFtruncate64 (JNIEnv *env, jobject obj, int fd, jlong length) 
    482 { 
    483     printf("pvfsFtruncate64\n"); 
    484     fflush(stdout); 
     447        rc = -1; 
     448    } 
     449    if(JNI_DBG) fflush(stdout); 
     450    return rc; 
     451} 
     452 
     453/* pvfs_ftruncate64 */ 
     454JNIEXPORT jint JNICALL 
     455Java_PVFS2JNI_pvfsFtruncate64(JNIEnv *env, jobject obj, int fd, jlong length) 
     456{ 
     457    if(JNI_DBG) printf("pvfsFtruncate64\n"); 
    485458    off64_t clength = (off64_t) length; 
    486459    int rc = 0; 
     
    489462    { 
    490463        perror("pvfs_ftruncate64 error"); 
    491         fflush(stdout); 
    492         return -1; 
    493     } 
    494     return rc; 
    495 } 
    496  
    497 //pvfs_dup 
    498 JNIEXPORT jint JNICALL 
    499 Java_PVFS2JNI_pvfsDup (JNIEnv *env, jobject obj, int oldfd) 
    500 { 
    501     printf("pvfsDup\n"); 
    502     fflush(stdout); 
     464        rc = -1; 
     465    } 
     466    if(JNI_DBG) fflush(stdout); 
     467    return rc; 
     468} 
     469 
     470/* pvfs_dup */ 
     471JNIEXPORT jint JNICALL 
     472Java_PVFS2JNI_pvfsDup(JNIEnv *env, jobject obj, int oldfd) 
     473{ 
     474    if(JNI_DBG) printf("pvfsDup\n"); 
    503475    int rc = 0; 
    504476    rc = pvfs_dup(oldfd); 
     
    506478    { 
    507479        perror("pvfs_dup error"); 
    508         fflush(stdout); 
    509         return -1; 
    510     } 
    511     return rc; 
    512 } 
    513  
    514 //pvfs_dup2 
    515 JNIEXPORT jint JNICALL 
    516 Java_PVFS2JNI_pvfsDup2 (JNIEnv *env, jobject obj, int oldfd, int newfd) 
    517 { 
    518     printf("pvfsDup2\n"); 
    519     fflush(stdout); 
     480        rc = -1; 
     481    } 
     482    if(JNI_DBG) fflush(stdout); 
     483    return rc; 
     484} 
     485 
     486/* pvfs_dup2 */ 
     487JNIEXPORT jint JNICALL 
     488Java_PVFS2JNI_pvfsDup2(JNIEnv *env, jobject obj, int oldfd, int newfd) 
     489{ 
     490    if(JNI_DBG) printf("pvfsDup2\n"); 
    520491    int rc = 0; 
    521492    rc = pvfs_dup_descriptor(oldfd, newfd); 
     
    523494    { 
    524495        perror("pvfs_dup2 error"); 
    525         fflush(stdout); 
    526         return -1; 
    527     } 
    528     return rc; 
    529 } 
    530  
    531 //pvfs_chown 
    532 JNIEXPORT jint JNICALL 
    533 Java_PVFS2JNI_pvfsChown (JNIEnv *env, jobject obj, jstring path, jlong owner, jlong group) 
    534 { 
    535     printf("pvfsChown\n"); 
    536     fflush(stdout); 
     496        rc = -1; 
     497    } 
     498    if(JNI_DBG) fflush(stdout); 
     499    return rc; 
     500} 
     501 
     502/* pvfs_chown */ 
     503JNIEXPORT jint JNICALL 
     504Java_PVFS2JNI_pvfsChown(JNIEnv *env, jobject obj, jstring path, jlong owner, jlong group) 
     505{ 
     506    if(JNI_DBG) printf("pvfsChown\n"); 
    537507    char cpath[PVFS_PATH_MAX]; 
    538508    int cpath_len = (*env)->GetStringLength(env, path); 
     
    544514    { 
    545515        perror("pvfs_chown error"); 
    546         fflush(stdout); 
    547         return -1; 
    548     } 
    549     return rc; 
    550 } 
    551  
    552 //pvfs_fchown 
    553 JNIEXPORT jint JNICALL 
    554 Java_PVFS2JNI_pvfsFchown (JNIEnv *env, jobject obj, int fd, jlong owner, jlong group) 
    555 { 
    556     printf("pvfsFchown\n"); 
    557     fflush(stdout); 
     516        rc = -1; 
     517    } 
     518    if(JNI_DBG) fflush(stdout); 
     519    return rc; 
     520} 
     521 
     522/* pvfs_fchown */ 
     523JNIEXPORT jint JNICALL 
     524Java_PVFS2JNI_pvfsFchown(JNIEnv *env, jobject obj, int fd, jlong owner, jlong group) 
     525{ 
     526    if(JNI_DBG) printf("pvfsFchown\n"); 
    558527    uid_t cowner = (uid_t) owner; 
    559528    gid_t cgroup = (gid_t) group; 
     
    562531    { 
    563532        perror("pvfs_fchown error"); 
    564         fflush(stdout); 
    565         return -1; 
    566     } 
    567     return rc; 
    568 } 
    569  
    570 //pvfs_fchownat 
    571 JNIEXPORT jint JNICALL 
    572 Java_PVFS2JNI_pvfsFchownat (JNIEnv *env, jobject obj, int fd, jstring path, jlong owner, jlong group, int flag) 
    573 { 
    574     printf("pvfsFchownat\n"); 
    575     fflush(stdout); 
     533        rc = -1; 
     534    } 
     535    if(JNI_DBG) fflush(stdout); 
     536    return rc; 
     537} 
     538 
     539/* pvfs_fchownat */ 
     540JNIEXPORT jint JNICALL 
     541Java_PVFS2JNI_pvfsFchownat(JNIEnv *env, jobject obj, int fd, jstring path, jlong owner, jlong group, int flag) 
     542{ 
     543    if(JNI_DBG) printf("pvfsFchownat\n"); 
    576544    char cpath[PVFS_PATH_MAX]; 
    577545    int cpath_len = (*env)->GetStringLength(env, path); 
     
    583551    { 
    584552        perror("pvfs_fchownat error"); 
    585         fflush(stdout); 
    586         return -1; 
    587     } 
    588     return rc; 
    589 } 
    590  
    591 //pvfs_chmod 
    592 JNIEXPORT jint JNICALL 
    593 Java_PVFS2JNI_pvfsChmod (JNIEnv *env, jobject obj, jstring path, int mode) 
    594 { 
    595     printf("pvfsChmod\n"); 
    596     fflush(stdout); 
     553        rc = -1; 
     554    } 
     555    if(JNI_DBG) fflush(stdout); 
     556    return rc; 
     557} 
     558 
     559/* pvfs_chmod */ 
     560JNIEXPORT jint JNICALL 
     561Java_PVFS2JNI_pvfsChmod(JNIEnv *env, jobject obj, jstring path, int mode) 
     562{ 
     563    if(JNI_DBG) printf("pvfsChmod\n"); 
    597564    char cpath[PVFS_PATH_MAX]; 
    598565    int cpath_len = (*env)->GetStringLength(env, path); 
     
    603570    { 
    604571        perror("pvfs_chmod error"); 
    605         fflush(stdout); 
    606         return -1; 
    607     } 
    608     return rc; 
    609 } 
    610  
    611 //pvfs_fchmod 
    612 JNIEXPORT jint JNICALL 
    613 Java_PVFS2JNI_pvfsFchmod (JNIEnv *env, jobject obj, int fd, int mode) 
    614 { 
    615     printf("pvfsFchmod\n"); 
    616     fflush(stdout); 
     572        rc = -1; 
     573    } 
     574    if(JNI_DBG) fflush(stdout); 
     575    return rc; 
     576} 
     577 
     578/* pvfs_fchmod */ 
     579JNIEXPORT jint JNICALL 
     580Java_PVFS2JNI_pvfsFchmod(JNIEnv *env, jobject obj, int fd, int mode) 
     581{ 
     582    if(JNI_DBG) printf("pvfsFchmod\n"); 
    617583    mode_t cmode = (mode_t) mode; 
    618584    int rc = pvfs_fchmod(fd, cmode); 
     
    620586    { 
    621587        perror("pvfs_fchmod error"); 
    622         fflush(stdout); 
    623         return -1; 
    624     } 
    625     return rc; 
    626 } 
    627  
    628 //pvfs_fchmodat 
     588        rc = -1; 
     589    } 
     590    if(JNI_DBG) fflush(stdout); 
     591    return rc; 
     592} 
     593 
     594/* pvfs_fchmodat */ 
    629595JNIEXPORT jint JNICALL 
    630596Java_PVFS2JNI_pvfsFchmodat (JNIEnv *env, jobject obj, int fd, jstring path, int mode, int flag) 
    631597{ 
    632     printf("pvfsFchmodat\n"); 
    633     fflush(stdout); 
     598    if(JNI_DBG) printf("pvfsFchmodat\n"); 
    634599    char cpath[PVFS_PATH_MAX]; 
    635600    int cpath_len = (*env)->GetStringLength(env, path); 
     
    640605    { 
    641606        perror("pvfs_fchmodat error"); 
    642         fflush(stdout); 
    643         return -1; 
    644     } 
    645     return rc; 
    646 } 
    647  
    648  
    649 //pvfs_mkdir 
     607        rc = -1; 
     608    } 
     609    if(JNI_DBG) fflush(stdout); 
     610    return rc; 
     611} 
     612 
     613/* pvfs_mkdir */ 
    650614JNIEXPORT jint JNICALL 
    651615Java_PVFS2JNI_pvfsMkdir (JNIEnv *env, jobject obj, jstring path, jint mode) 
    652616{ 
    653     printf("pvfsMkdir\n"); 
    654     fflush(stdout); 
     617    if(JNI_DBG) printf("pvfsMkdir\n"); 
    655618    char cpath[PVFS_PATH_MAX]; 
    656619    int cpath_len = (*env)->GetStringLength(env, path); 
     
    662625    { 
    663626        perror("pvfs_mkdir error"); 
    664         fflush(stdout); 
    665         return -1; 
    666     } 
    667     return rc; 
    668 } 
    669  
    670 //pvfs_mkdirat 
     627        rc = -1; 
     628    } 
     629    if(JNI_DBG) fflush(stdout); 
     630    return rc; 
     631} 
     632 
     633/* pvfs_mkdirat */ 
    671634JNIEXPORT jint JNICALL 
    672635Java_PVFS2JNI_pvfsMkdirat (JNIEnv *env, jobject obj, int dirfd, jstring path, jint mode) 
    673636{ 
    674     printf("pvfsMkdirat\n"); 
    675     fflush(stdout); 
     637    if(JNI_DBG) printf("pvfsMkdirat\n"); 
    676638    char cpath[PVFS_PATH_MAX]; 
    677639    int cpath_len = (*env)->GetStringLength(env, path); 
     
    683645    { 
    684646        perror("pvfs_mkdirat error"); 
    685         fflush(stdout); 
    686         return -1; 
    687     } 
    688     return rc; 
    689 } 
    690  
    691 //pvfs_rmdir 
     647        rc = -1; 
     648    } 
     649    if(JNI_DBG) fflush(stdout); 
     650    return rc; 
     651} 
     652 
     653/* pvfs_rmdir */ 
    692654JNIEXPORT jint JNICALL 
    693655Java_PVFS2JNI_pvfsRmdir (JNIEnv *env, jobject obj, jstring path) 
    694656{ 
    695     printf("pvfsRmdir\n"); 
    696     fflush(stdout); 
     657    if(JNI_DBG) printf("pvfsRmdir\n"); 
    697658    char cpath[PVFS_PATH_MAX]; 
    698659    int cpath_len = (*env)->GetStringLength(env, path); 
     
    703664    { 
    704665        perror("pvfs_rmdir error"); 
    705         fflush(stdout); 
    706         return -1; 
    707     } 
    708     return rc; 
    709 } 
    710  
    711 //pvfs_readlink 
     666        rc = -1; 
     667    } 
     668    if(JNI_DBG) fflush(stdout); 
     669    return rc; 
     670} 
     671 
     672/* pvfs_readlink */ 
    712673JNIEXPORT jlong JNICALL 
    713674Java_PVFS2JNI_pvfsReadlink (JNIEnv *env, jobject obj, jstring path, jstring buf, jlong bufsiz) 
    714675{ 
    715     printf("pvfsReadlink\n"); 
    716     fflush(stdout); 
     676    if(JNI_DBG) printf("pvfsReadlink\n"); 
    717677    char cpath[PVFS_PATH_MAX]; 
    718678    int cpath_len = (*env)->GetStringLength(env, path); 
     
    724684    size_t bufsize = (size_t) bufsiz; 
    725685    ssize_t rc = pvfs_readlink(cpath, cbuf, bufsize); 
    726     if(rc < 0) 
     686    jlong op = (jlong) rc; 
     687    if(op < 0) 
    727688    { 
    728689        perror("pvfs_readlink error"); 
    729         fflush(stdout); 
    730         return -1; 
    731     } 
    732     jlong op = (jlong) rc; 
    733     return rc; 
    734 } 
    735  
    736 //pvfs_readlinkat 
     690        op = -1; 
     691    } 
     692    if(JNI_DBG) fflush(stdout); 
     693    return op; 
     694} 
     695 
     696/* pvfs_readlinkat */ 
    737697JNIEXPORT jlong JNICALL 
    738698Java_PVFS2JNI_pvfsReadlinkat (JNIEnv *env, jobject obj, int fd, jstring path, jstring buf, jlong bufsiz) 
    739699{ 
    740     printf("pvfsReadlinkat\n"); 
    741     fflush(stdout); 
     700    if(JNI_DBG) printf("pvfsReadlinkat\n"); 
    742701    char cpath[PVFS_PATH_MAX]; 
    743702    int cpath_len = (*env)->GetStringLength(env, path); 
     
    749708    size_t bufsize = (size_t) bufsiz; 
    750709    ssize_t rc = pvfs_readlinkat(fd, cpath, cbuf, bufsize); 
    751     if(rc < 0) 
     710    jlong op = (jlong) rc; 
     711    if(op < 0) 
    752712    { 
    753713        perror("pvfs_readlinkat error"); 
    754         fflush(stdout); 
    755         return -1; 
    756     } 
    757     jlong op = (jlong) rc; 
    758     return rc; 
    759 } 
    760  
    761 //pvfs_symlink 
     714        op = -1; 
     715    } 
     716    if(JNI_DBG) fflush(stdout); 
     717    return op; 
     718} 
     719 
     720/* pvfs_symlink */ 
    762721JNIEXPORT int JNICALL 
    763722Java_PVFS2JNI_pvfsSymlink(JNIEnv *env, jobject obj, jstring oldpath, jstring newpath) 
    764723{ 
    765     printf("pvfsSymlink\n"); 
    766     fflush(stdout); 
     724    if(JNI_DBG) printf("pvfsSymlink\n"); 
    767725    int rc = 0; 
    768726    char coldpath[PVFS_PATH_MAX]; 
     
    776734    { 
    777735        perror("pvfs_symlink error"); 
    778         fflush(stdout); 
    779         return -1; 
    780     } 
    781     return rc; 
    782 } 
    783  
    784 //pvfs_symlinkat 
     736        rc = -1; 
     737    } 
     738    if(JNI_DBG) fflush(stdout); 
     739    return rc; 
     740} 
     741 
     742/* pvfs_symlinkat */ 
    785743JNIEXPORT int JNICALL 
    786744Java_PVFS2JNI_pvfsSymlinkat(JNIEnv *env, jobject obj, jstring oldpath, int newdirfd, jstring newpath) 
    787745{ 
    788     printf("pvfsSymlinkat\n"); 
    789     fflush(stdout); 
     746    if(JNI_DBG) printf("pvfsSymlinkat\n"); 
    790747    int rc = 0; 
    791748    char coldpath[PVFS_PATH_MAX]; 
     
    799756    { 
    800757        perror("pvfs_symlinkat error"); 
    801         fflush(stdout); 
    802         return -1; 
    803     } 
    804     return rc; 
    805 } 
    806  
    807 //pvfs_link 
     758        rc = -1; 
     759    } 
     760    if(JNI_DBG) fflush(stdout); 
     761    return rc; 
     762} 
     763 
     764/* pvfs_link */ 
    808765JNIEXPORT int JNICALL 
    809766Java_PVFS2JNI_pvfsLink(JNIEnv *env, jobject obj, jstring oldpath, jstring newpath) 
    810767{ 
    811     printf("pvfsLink\n"); 
    812     fflush(stdout); 
     768    if(JNI_DBG) printf("pvfsLink\n"); 
    813769    int rc = 0; 
    814770    char coldpath[PVFS_PATH_MAX]; 
     
    822778    { 
    823779        perror("pvfs_link error"); 
    824         fflush(stdout); 
    825         return -1; 
    826     } 
    827     return rc; 
    828 } 
    829  
    830 //pvfs_linkat 
     780        rc = -1; 
     781    } 
     782    if(JNI_DBG) fflush(stdout); 
     783    return rc; 
     784} 
     785 
     786/* pvfs_linkat */ 
    831787JNIEXPORT int JNICALL 
    832788Java_PVFS2JNI_pvfsLinkat(JNIEnv *env, jobject obj, int olddirfd, jstring oldpath, int newdirfd, jstring newpath, int flags) 
    833789{ 
    834     printf("pvfsLinkat\n"); 
    835     fflush(stdout); 
     790    if(JNI_DBG) printf("pvfsLinkat\n"); 
    836791    int rc = 0; 
    837792    char coldpath[PVFS_PATH_MAX]; 
     
    845800    { 
    846801        perror("pvfs_linkat error"); 
    847         fflush(stdout); 
    848         return -1; 
    849     } 
    850     return rc; 
    851 } 
    852  
    853 //pvfs_access 
     802        rc = -1; 
     803    } 
     804    if(JNI_DBG) fflush(stdout); 
     805    return rc; 
     806} 
     807 
     808/* pvfs_access */ 
    854809JNIEXPORT jint JNICALL 
    855810Java_PVFS2JNI_pvfsAccess (JNIEnv *env, jobject obj, jstring path, int mode) 
    856811{ 
    857     printf("pvfsAccess\n"); 
    858     fflush(stdout); 
     812    if(JNI_DBG) printf("pvfsAccess\n"); 
    859813    char cpath[PVFS_PATH_MAX]; 
    860814    int cpath_len = (*env)->GetStringLength(env, path); 
     
    864818    { 
    865819        perror("pvfs_access error"); 
    866         fflush(stdout); 
    867         return -1; 
    868     } 
    869     return rc; 
    870 } 
    871  
    872  
    873 //pvfs_faccessat 
     820        rc = -1; 
     821    } 
     822    if(JNI_DBG) fflush(stdout); 
     823    return rc; 
     824} 
     825 
     826/* pvfs_faccessat */ 
    874827JNIEXPORT jint JNICALL 
    875828Java_PVFS2JNI_pvfsFaccessat (JNIEnv *env, jobject obj, int fd, jstring path, int mode, int flags) 
    876829{ 
    877     printf("pvfsAccess\n"); 
    878     fflush(stdout); 
     830    if(JNI_DBG) printf("pvfsAccess\n"); 
    879831    char cpath[PVFS_PATH_MAX]; 
    880832    int cpath_len = (*env)->GetStringLength(env, path); 
     
    884836    { 
    885837        perror("pvfs_faccessat error"); 
    886         fflush(stdout); 
    887         return -1; 
    888     } 
    889     return rc; 
    890 } 
    891  
    892 //pvfs_flock 
     838        rc = -1; 
     839    } 
     840    if(JNI_DBG) fflush(stdout); 
     841    return rc; 
     842} 
     843 
     844/* pvfs_flock */ 
    893845JNIEXPORT jint JNICALL 
    894846Java_PVFS2JNI_pvfsFlock (JNIEnv *env, jobject obj, int fd, int op) 
    895847{ 
    896     printf("pvfsFlock\n"); 
    897     fflush(stdout); 
     848    if(JNI_DBG) printf("pvfsFlock\n"); 
    898849    int rc = pvfs_flock(fd, op); 
    899850    if(rc < 0) 
    900851    { 
    901852        perror("pvfs_flock error"); 
    902         fflush(stdout); 
    903         return -1; 
    904     } 
    905     return rc; 
    906 } 
    907  
    908 //pvfs_fcntl 
     853        rc = -1; 
     854    } 
     855    if(JNI_DBG) fflush(stdout); 
     856    return rc; 
     857} 
     858 
     859/* pvfs_fcntl */ 
    909860JNIEXPORT jint JNICALL 
    910861Java_PVFS2JNI_pvfsFcntl  (JNIEnv *env, jobject obj, int fd, int cmd) 
    911862{ 
    912     printf("pvfsFcntl\n"); 
    913     fflush(stdout); 
     863    if(JNI_DBG) printf("pvfsFcntl\n"); 
    914864    int rc = pvfs_fcntl(fd, cmd); 
    915865    if(rc < 0) 
    916866    { 
    917867        perror("pvfs_fcntl error"); 
    918         fflush(stdout); 
    919         return -1; 
    920     } 
    921     return rc; 
    922 } 
    923  
    924 //pvfs_fsync 
     868        rc = -1; 
     869    } 
     870    if(JNI_DBG) fflush(stdout); 
     871    return rc; 
     872} 
     873 
     874/* pvfs_fsync */ 
    925875JNIEXPORT jint JNICALL 
    926876Java_PVFS2JNI_pvfsFsync  (JNIEnv *env, jobject obj, int fd) 
    927877{ 
    928     printf("pvfsFsync\n"); 
    929     fflush(stdout); 
     878    if(JNI_DBG) printf("pvfsFsync\n"); 
    930879    int rc = pvfs_fsync(fd); 
    931880    if(rc < 0) 
     
    933882        perror("pvfs_fsync error"); 
    934883        fflush(stdout); 
    935         return -1; 
    936     } 
    937     return rc; 
    938 } 
    939  
    940 //pvfs_fdatasync 
     884        rc = -1; 
     885    } 
     886    if(JNI_DBG) fflush(stdout); 
     887    return rc; 
     888} 
     889 
     890/* pvfs_fdatasync */ 
    941891JNIEXPORT jint JNICALL 
    942892Java_PVFS2JNI_pvfsFdatasync  (JNIEnv *env, jobject obj, int fd) 
    943893{ 
    944     printf("pvfsFdatasync\n"); 
    945     fflush(stdout); 
     894    if(JNI_DBG) printf("pvfsFdatasync\n"); 
    946895    int rc = pvfs_fdatasync(fd); 
    947896    if(rc < 0) 
    948897    { 
    949898        perror("pvfs_fdatasync error"); 
    950         fflush(stdout); 
    951         return -1; 
    952     } 
    953     return rc; 
    954 } 
    955  
    956 //pvfs_fadvise 
     899        rc = -1; 
     900    } 
     901    if(JNI_DBG) fflush(stdout); 
     902    return rc; 
     903} 
     904 
     905/* pvfs_fadvise */ 
    957906JNIEXPORT jint JNICALL 
    958907Java_PVFS2JNI_pvfsFadvise  (JNIEnv *env, jobject obj, int fd, jlong offset, jlong len, int advice) 
    959908{ 
    960     printf("pvfsFadvise\n"); 
    961     fflush(stdout); 
     909    if(JNI_DBG) printf("pvfsFadvise\n"); 
    962910    off_t coffset = (off_t) offset; 
    963911    off_t clen = (off_t) clen; 
     
    966914    { 
    967915        perror("pvfs_fadvise error"); 
    968         fflush(stdout); 
    969         return -1; 
    970     } 
    971     return rc; 
    972 } 
    973  
    974 //pvfs_fadvise64 
     916        rc = -1; 
     917    } 
     918    if(JNI_DBG) fflush(stdout); 
     919    return rc; 
     920} 
     921 
     922/* pvfs_fadvise64 */ 
    975923JNIEXPORT jint JNICALL 
    976924Java_PVFS2JNI_pvfsFadvise64  (JNIEnv *env, jobject obj, int fd, jlong offset, jlong len, int advice) 
    977925{ 
    978     printf("pvfsFadvise64\n"); 
    979     fflush(stdout); 
     926    if(JNI_DBG) printf("pvfsFadvise64\n"); 
    980927    off_t coffset = (off64_t) offset; 
    981928    off_t clen = (off64_t) clen; 
     
    984931    { 
    985932        perror("pvfs_fadvise64 error"); 
    986         fflush(stdout); 
    987         return -1; 
    988     } 
    989     return rc; 
    990 } 
    991  
    992 //pvfs_mknod 
     933        rc = -1; 
     934    } 
     935    if(JNI_DBG) fflush(stdout); 
     936    return rc; 
     937} 
     938 
     939/* pvfs_mknod */ 
    993940JNIEXPORT jint JNICALL 
    994941Java_PVFS2JNI_pvfsMknod  (JNIEnv *env, jobject obj, jstring path, int mode, int dev) 
    995942{ 
    996     printf("pvfsMknod\n"); 
    997     fflush(stdout); 
     943    if(JNI_DBG) printf("pvfsMknod\n"); 
    998944    char cpath[PVFS_PATH_MAX]; 
    999945    int cpath_len = (*env)->GetStringLength(env, path); 
     
    1005951    { 
    1006952        perror("pvfs_mknod error"); 
    1007         fflush(stdout); 
    1008         return -1; 
    1009     } 
    1010     return rc; 
    1011 } 
    1012  
    1013 //pvfs_mknodat 
     953        rc = -1; 
     954    } 
     955    if(JNI_DBG) fflush(stdout); 
     956    return rc; 
     957} 
     958 
     959/* pvfs_mknodat */ 
    1014960JNIEXPORT jint JNICALL 
    1015961Java_PVFS2JNI_pvfsMknodat (JNIEnv *env, jobject obj, int dirfd, jstring path, int mode, int dev) 
    1016962{ 
    1017     printf("pvfsMknodat\n"); 
    1018     fflush(stdout); 
     963    if(JNI_DBG) printf("pvfsMknodat\n"); 
    1019964    char cpath[PVFS_PATH_MAX]; 
    1020965    int cpath_len = (*env)->GetStringLength(env, path); 
     
    1026971    { 
    1027972        perror("pvfs_mknodat error"); 
    1028         fflush(stdout); 
    1029         return -1; 
    1030     } 
    1031     return rc; 
    1032 } 
    1033  
    1034 //pvfs_chdir 
     973        rc = -1; 
     974    } 
     975    if(JNI_DBG) fflush(stdout); 
     976    return rc; 
     977} 
     978 
     979/* pvfs_chdir */  
    1035980JNIEXPORT jint JNICALL 
    1036981Java_PVFS2JNI_pvfsChdir  (JNIEnv *env, jobject obj, jstring path) 
    1037982{ 
    1038     printf("pvfsChdir\n"); 
    1039     fflush(stdout); 
     983    if(JNI_DBG) printf("pvfsChdir\n"); 
    1040984    char cpath[PVFS_PATH_MAX]; 
    1041985    int cpath_len = (*env)->GetStringLength(env, path); 
     
    1045989    { 
    1046990        perror("pvfs_chdir error"); 
    1047         fflush(stdout); 
    1048         return -1; 
    1049     } 
    1050     return rc; 
    1051 } 
    1052  
    1053 //pvfs_fchdir 
     991        rc = -1; 
     992    } 
     993    if(JNI_DBG) fflush(stdout); 
     994    return rc; 
     995} 
     996 
     997/* pvfs_fchdir */ 
    1054998JNIEXPORT jint JNICALL 
    1055999Java_PVFS2JNI_pvfsFchdir  (JNIEnv *env, jobject obj, int fd) 
    10561000{ 
    1057     printf("pvfsFchdir\n"); 
    1058     fflush(stdout); 
     1001    if(JNI_DBG) printf("pvfsFchdir\n"); 
    10591002    int rc = pvfs_fchdir(fd); 
    10601003    if(rc < 0) 
    10611004    { 
    10621005        perror("pvfs_fchdir error"); 
    1063         fflush(stdout); 
    1064         return -1; 
    1065     } 
    1066     return rc; 
    1067 } 
    1068  
    1069 //pvfs_umask 
     1006        rc = -1; 
     1007    } 
     1008    if(JNI_DBG) fflush(stdout); 
     1009    return rc; 
     1010} 
     1011 
     1012/* pvfs_umask */ 
    10701013JNIEXPORT jint JNICALL 
    10711014Java_PVFS2JNI_pvfsUmask  (JNIEnv *env, jobject obj, int mask) 
    10721015{ 
    1073     printf("pvfsUmask\n"); 
    1074     fflush(stdout); 
     1016    if(JNI_DBG) printf("pvfsUmask\n"); 
    10751017    mode_t cmask = (mode_t) mask; 
    10761018    mode_t rc = pvfs_umask(mask); 
     
    10781020    { 
    10791021        perror("pvfs_umask error"); 
    1080         fflush(stdout); 
    1081         return -1; 
    1082     } 
    1083     return (int)rc; 
     1022        rc = -1; 
     1023    } 
     1024    if(JNI_DBG) fflush(stdout); 
     1025    return (int) rc; 
    10841026} 
    10851027 
     
    10901032    jboolean is_copy; 
    10911033    jbyte * buffer = (*env)->GetByteArrayElements(env, buf, &is_copy); 
    1092     printf("pvfsRead\n"); 
    1093     printf("\tfd = %d\n", fd); 
    1094     printf("\tcount = %lu\n", (uint64_t) count); 
    1095     is_copy == JNI_TRUE ? printf("\tbuf is_copy\n") : printf("\tbuf !is_copy\n"); 
     1034    if(JNI_DBG) 
     1035    { 
     1036        printf("\tfd = %d\n", fd); 
     1037        printf("\tcount = %lu\n", (uint64_t) count); 
     1038        is_copy == JNI_TRUE ? printf("\tbuf is_copy\n") : printf("\tbuf !is_copy\n"); 
     1039    } 
    10961040    if(!buffer) 
    10971041    { 
    10981042        perror("GetByteArrayElements"); 
    10991043        errno = EFAULT; 
    1100         return -1; 
     1044        rc = -1; 
     1045        goto done; 
    11011046    } 
    11021047    rc = pvfs_read(fd, (void *) buffer, (size_t) count); 
     
    11041049    { 
    11051050        perror("jni pvfs_read"); 
     1051        rc = -1; 
     1052        goto done; 
    11061053    } 
    11071054    if(rc > 0) 
    11081055    { 
    1109         printf("\tread %lld bytes\n", (long long int) rc); 
    1110     } 
     1056        if(JNI_DBG) printf("\tread %lld bytes\n", (long long int) rc); 
     1057    } 
     1058done: 
    11111059    /* copy back and free the buffer using 0 */ 
    11121060    (*env)->ReleaseByteArrayElements(env, buf, buffer, 0); 
    1113     fflush(stdout); 
     1061    if(JNI_DBG) fflush(stdout); 
    11141062    fflush(stderr); 
    11151063    return (jlong) rc; 
     
    11221070    jboolean is_copy; 
    11231071    jbyte * buffer = (*env)->GetByteArrayElements(env, buf, &is_copy); 
    1124     printf("pvfsPread\n"); 
    1125     printf("\tfd = %d\n", fd); 
    1126     printf("\tcount = %lu\n", (uint64_t) count); 
    1127     printf("\toffset = %lu\n", (uint64_t) offset); 
    1128     is_copy == JNI_TRUE ? printf("\tbuf is_copy\n") : printf("\tbuf !is_copy\n"); 
     1072    if(JNI_DBG) 
     1073    { 
     1074        printf("pvfsPread\n"); 
     1075        printf("\tfd = %d\n", fd); 
     1076        printf("\tcount = %lu\n", (uint64_t) count); 
     1077        printf("\toffset = %lu\n", (uint64_t) offset); 
     1078        is_copy == JNI_TRUE ? printf("\tbuf is_copy\n") : printf("\tbuf !is_copy\n"); 
     1079    } 
    11291080    if(!buffer) 
    11301081    { 
    11311082        perror("GetByteArrayElements"); 
    11321083        errno = EFAULT; 
    1133         return -1; 
     1084        rc = -1; 
     1085        goto done; 
    11341086    } 
    11351087    rc = pvfs_pread(fd, (void *) buffer, (size_t) count, (off_t) offset); 
     
    11381090        perror("jni pvfs_pread"); 
    11391091    } 
    1140     if(rc > 0) 
    1141     { 
    1142         printf("\tread %lld bytes\n", (long long int) rc); 
    1143     } 
     1092    else 
     1093    { 
     1094        if(JNI_DBG) printf("\tread %lld bytes\n", (long long int) rc); 
     1095    } 
     1096done: 
    11441097    /* copy back and free the buffer using 0 */ 
    11451098    (*env)->ReleaseByteArrayElements(env, buf, buffer, 0); 
    1146     fflush(stdout); 
     1099    if(JNI_DBG) fflush(stdout); 
    11471100    fflush(stderr); 
    11481101    return (jlong) rc; 
     
    11551108    jboolean is_copy; 
    11561109    jbyte * buffer = (*env)->GetByteArrayElements(env, buf, &is_copy); 
    1157     printf("pvfsPread64\n"); 
    1158     printf("\tfd = %d\n", fd); 
    1159     printf("\tcount = %lu\n", (uint64_t) count); 
    1160     printf("\toffset = %lu\n", (uint64_t) offset); 
    1161     is_copy == JNI_TRUE ? printf("\tbuf is_copy\n") : printf("\tbuf !is_copy\n"); 
     1110    if(JNI_DBG) 
     1111    { 
     1112        printf("pvfsPread64\n"); 
     1113        printf("\tfd = %d\n", fd); 
     1114        printf("\tcount = %lu\n", (uint64_t) count); 
     1115        printf("\toffset = %lu\n", (uint64_t) offset); 
     1116        is_copy == JNI_TRUE ? printf("\tbuf is_copy\n") : printf("\tbuf !is_copy\n"); 
     1117    } 
    11621118    if(!buffer) 
    11631119    { 
    11641120        perror("GetByteArrayElements"); 
    11651121        errno = EFAULT; 
    1166         return -1; 
     1122        rc = -1; 
     1123        goto done; 
    11671124    } 
    11681125    rc = pvfs_pread64(fd, (void *) buffer, (size_t) count, (off64_t) offset); 
     
    11711128        perror("jni pvfs_pread64"); 
    11721129    } 
    1173     if(rc > 0) 
     1130    else 
    11741131    { 
    11751132        printf("\tread %lld bytes\n", (long long int) rc); 
    11761133    } 
     1134done: 
    11771135    /* copy back and free the buffer using 0 */ 
    11781136    (*env)->ReleaseByteArrayElements(env, buf, buffer, 0); 
    1179     fflush(stdout); 
     1137    if(JNI_DBG) fflush(stdout); 
    11801138    fflush(stderr); 
    11811139    return (jlong) rc; 
     
    11881146    jboolean is_copy; 
    11891147    jbyte * buffer = (*env)->GetByteArrayElements(env, buf, &is_copy); 
    1190     printf("pvfsWrite\n"); 
    1191     printf("\tfd = %d\n", fd); 
    1192     printf("\tcount = %lu\n", (uint64_t) count); 
    1193     is_copy == JNI_TRUE ? printf("\tbuf is_copy\n") : printf("\tbuf !is_copy\n"); 
     1148    if(JNI_DBG) 
     1149    { 
     1150        printf("pvfsWrite\n"); 
     1151        printf("\tfd = %d\n", fd); 
     1152        printf("\tcount = %lu\n", (uint64_t) count); 
     1153        is_copy == JNI_TRUE ? printf("\tbuf is_copy\n") :  
     1154            printf("\tbuf !is_copy\n"); 
     1155    } 
    11941156    if(!buffer) 
    11951157    { 
    11961158        perror("GetByteArrayElements"); 
    11971159        errno = EFAULT; 
    1198         return -1; 
     1160        rc = -1; 
     1161        goto done; 
    11991162    } 
    12001163    rc = pvfs_write(fd, (void *) buffer, (size_t) count); 
     
    12071170        printf("\twrote %lld bytes\n", (long long int) rc); 
    12081171    } 
    1209     /* free the buffer without copying back the possible changes in buffer using JNI_ABORT */ 
     1172done: 
     1173    /* free the buffer without copying back the possible changes in buffer  
     1174     * using JNI_ABORT  
     1175     */ 
    12101176    (*env)->ReleaseByteArrayElements(env, buf, buffer, JNI_ABORT); 
    1211     fflush(stdout); 
     1177    if(JNI_DBG) fflush(stdout); 
    12121178    fflush(stderr); 
    12131179    return (jlong) rc; 
     
    12201186    jboolean is_copy; 
    12211187    jbyte * buffer = (*env)->GetByteArrayElements(env, buf, &is_copy); 
    1222     printf("pvfsPwrite\n"); 
    1223     printf("\tfd = %d\n", fd); 
    1224     printf("\tcount = %lu\n", (uint64_t) count); 
    1225     printf("\toffset = %lu\n", (uint64_t) offset); 
    1226     is_copy == JNI_TRUE ? printf("\tbuf is_copy\n") : printf("\tbuf !is_copy\n"); 
     1188    if(JNI_DBG) 
     1189    { 
     1190        printf("pvfsPwrite\n"); 
     1191        printf("\tfd = %d\n", fd); 
     1192        printf("\tcount = %lu\n", (uint64_t) count); 
     1193        printf("\toffset = %lu\n", (uint64_t) offset); 
     1194        is_copy == JNI_TRUE ? printf("\tbuf is_copy\n") :  
     1195            printf("\tbuf !is_copy\n"); 
     1196    } 
    12271197    if(!buffer) 
    12281198    { 
    12291199        perror("GetByteArrayElements"); 
    12301200        errno = EFAULT; 
    1231         return -1; 
     1201        rc = -1; 
    12321202    } 
    12331203    rc = pvfs_pwrite(fd, (void *) buffer, (size_t) count, (off_t) offset); 
     
    12361206        perror("jni pvfs_pwrite"); 
    12371207    } 
    1238     if(rc > 0) 
    1239     { 
    1240         printf("\twrote %lld bytes\n", (long long int) rc); 
    1241     } 
    1242     /* free the buffer without copying back the possible changes in buffer using JNI_ABORT */ 
     1208    else 
     1209    { 
     1210        if(JNI_DBG) printf("\twrote %lld bytes\n", (long long int) rc); 
     1211    } 
     1212done: 
     1213    /** free the buffer without copying back the possible changes in buffer 
     1214      * using JNI_ABORT  
     1215      */ 
    12431216    (*env)->ReleaseByteArrayElements(env, buf, buffer, JNI_ABORT); 
    1244     fflush(stdout); 
    1245     fflush(stderr); 
     1217    fflush(stderr); 
     1218    if(JNI_DBG) fflush(stdout); 
    12461219    return (jlong) rc; 
    12471220} 
     
    12531226    jboolean is_copy; 
    12541227    jbyte * buffer = (*env)->GetByteArrayElements(env, buf, &is_copy); 
    1255     printf("pvfsPwrite64\n"); 
    1256     printf("\tfd = %d\n", fd); 
    1257     printf("\tcount = %lu\n", (uint64_t) count); 
    1258     printf("\toffset = %lu\n", (uint64_t) offset); 
    1259     is_copy == JNI_TRUE ? printf("\tbuf is_copy\n") : printf("\tbuf !is_copy\n"); 
     1228    if(JNI_DBG) 
     1229    { 
     1230        printf("pvfsPwrite64\n"); 
     1231        printf("\tfd = %d\n", fd); 
     1232        printf("\tcount = %lu\n", (uint64_t) count); 
     1233        printf("\toffset = %lu\n", (uint64_t) offset); 
     1234        is_copy == JNI_TRUE ? printf("\tbuf is_copy\n") :  
     1235            printf("\tbuf !is_copy\n"); 
     1236    } 
    12601237    if(!buffer) 
    12611238    { 
    12621239        perror("GetByteArrayElements"); 
    12631240        errno = EFAULT; 
    1264         return -1; 
     1241        rc = -1; 
     1242        goto done; 
    12651243    } 
    12661244    rc = pvfs_pwrite64(fd, (void *) buffer, (size_t) count, (off_t) offset); 
     
    12691247        perror("jni pvfs_pwrite64"); 
    12701248    } 
    1271     if(rc > 0) 
    1272     { 
    1273         printf("\twrote %lld bytes\n", (long long int) rc); 
    1274     } 
    1275     /* free the buffer without copying back the possible changes in buffer using JNI_ABORT */ 
     1249    else 
     1250    { 
     1251        if(JNI_DBG) printf("\twrote %lld bytes\n", (long long int) rc); 
     1252    } 
     1253done: 
     1254    /** Free the buffer without copying back the possible changes in buffer  
     1255     * using JNI_ABORT  
     1256     */ 
    12761257    (*env)->ReleaseByteArrayElements(env, buf, buffer, JNI_ABORT); 
    1277     fflush(stdout); 
    1278     fflush(stderr); 
     1258    fflush(stderr); 
     1259    if(JNI_DBG) fflush(stdout); 
    12791260    return (jlong) rc; 
    12801261} 
     
    12941275*/ 
    12951276 
    1296 //pvfs_stat 
     1277/* pvfs_stat */ 
    12971278JNIEXPORT jint JNICALL 
    12981279Java_PVFS2JNI_pvfsStat  (JNIEnv *env, jobject obj, jlong jarg, jstring path) 
    12991280{ 
    1300     printf("pvfsStat\n"); 
     1281    if(JNI_DBG) printf("pvfsStat\n"); 
    13011282    struct stat *arg; 
    13021283    arg = (struct stat *)jarg; 
     
    13081289    { 
    13091290        perror("pvfs_stat error"); 
    1310         fflush(stdout); 
    1311         return -1; 
    1312     } 
    1313     return rc; 
    1314 } 
    1315  
    1316 //pvfs_stat_mask 
     1291        rc = -1; 
     1292    } 
     1293    fflush(stderr); 
     1294    if(JNI_DBG) fflush(stdout); 
     1295    return rc; 
     1296} 
     1297 
     1298/* pvfs_stat_mask */ 
    13171299JNIEXPORT jint JNICALL 
    13181300Java_PVFS2JNI_pvfsStatMask  (JNIEnv *env, jobject obj, jlong jarg, jstring path, jlong mask) 
    13191301{ 
    1320     printf("pvfsStatMask\n"); 
     1302    if(JNI_DBG) printf("pvfsStatMask\n"); 
    13211303    struct stat *arg; 
    13221304    arg = (struct stat *)jarg; 
     
    13291311    { 
    13301312        perror("pvfs_stat_mask error"); 
    1331         fflush(stdout); 
    1332         return -1; 
    1333     } 
    1334     return rc; 
    1335 } 
    1336  
    1337 //pvfs_fstat 
     1313        rc = -1; 
     1314    } 
     1315    fflush(stderr); 
     1316    if(JNI_DBG) fflush(stdout); 
     1317    return rc; 
     1318} 
     1319 
     1320/* pvfs_fstat */ 
    13381321JNIEXPORT jint JNICALL 
    13391322Java_PVFS2JNI_pvfsFstat  (JNIEnv *env, jobject obj, jlong jarg, int fd) 
    13401323{ 
    1341     printf("pvfsFstat\n"); 
     1324    if(JNI_DBG) printf("pvfsFstat\n"); 
    13421325    struct stat *arg; 
    13431326    arg = (struct stat *)jarg; 
     
    13461329    { 
    13471330        perror("pvfs_fstat error"); 
    1348         fflush(stdout); 
    1349         return -1; 
    1350     } 
    1351     return rc; 
    1352 } 
    1353  
    1354  
    1355 //pvfs_fstat_mask 
     1331        rc = -1; 
     1332    } 
     1333    fflush(stderr); 
     1334    if(JNI_DBG) fflush(stdout); 
     1335    return rc; 
     1336} 
     1337 
     1338 
     1339/* pvfs_fstat_mask */ 
    13561340JNIEXPORT jint JNICALL 
    13571341Java_PVFS2JNI_pvfsFstatMask  (JNIEnv *env, jobject obj, jlong jarg, int fd, jlong mask) 
    13581342{ 
    1359     printf("pvfsFstatMask\n"); 
     1343    if(JNI_DBG) printf("pvfsFstatMask\n"); 
    13601344    struct stat *arg; 
    13611345    arg = (struct stat *)jarg; 
     
    13651349    { 
    13661350        perror("pvfs_fstat_mask error"); 
    1367         fflush(stdout); 
    1368         return -1; 
    1369     } 
    1370     return rc; 
    1371 } 
    1372  
    1373 //pvfs_Fstatat 
     1351        rc = -1; 
     1352    } 
     1353    fflush(stderr); 
     1354    if(JNI_DBG) fflush(stdout); 
     1355    return rc; 
     1356} 
     1357 
     1358/* pvfs_Fstatat */ 
    13741359JNIEXPORT jint JNICALL 
    13751360Java_PVFS2JNI_pvfsFstatat  (JNIEnv *env, jobject obj, jlong jarg, int fd, jstring path, int flag) 
    13761361{ 
    1377     printf("pvfFstatat\n"); 
     1362    if(JNI_DBG) printf("pvfFstatat\n"); 
    13781363    struct stat *arg; 
    13791364    arg = (struct stat *)jarg; 
     
    13851370    { 
    13861371        perror("pvfs_fstatat error"); 
    1387         fflush(stdout); 
    1388         return -1; 
    1389     } 
    1390     return rc; 
    1391 } 
    1392  
    1393 //pvfs_lstat 
     1372        rc = -1; 
     1373    } 
     1374    fflush(stderr); 
     1375    if(JNI_DBG) fflush(stdout); 
     1376    return rc; 
     1377} 
     1378 
     1379/* pvfs_lstat */ 
    13941380JNIEXPORT jint JNICALL 
    13951381Java_PVFS2JNI_pvfsLstat  (JNIEnv *env, jobject obj, jlong jarg, jstring path) 
    13961382{ 
    1397     printf("pvfsLstat\n"); 
     1383    if(JNI_DBG) printf("pvfsLstat\n"); 
    13981384    struct stat *arg; 
    13991385    arg = (struct stat *)jarg; 
     
    14051391    { 
    14061392        perror("pvfs_lstat error"); 
    1407         fflush(stdout); 
    1408         return -1; 
    1409     } 
    1410     return rc; 
    1411 } 
    1412  
    1413  
    1414 //pvfs_lstat_mask 
     1393        rc = -1; 
     1394    } 
     1395    fflush(stderr); 
     1396    if(JNI_DBG) fflush(stdout); 
     1397    return rc; 
     1398} 
     1399 
     1400 
     1401/* pvfs_lstat_mask */ 
    14151402JNIEXPORT jint JNICALL 
    14161403Java_PVFS2JNI_pvfsLstatMask  (JNIEnv *env, jobject obj, jlong jarg, jstring path, jlong mask) 
    14171404{ 
    1418     printf("pvfsLstatMask\n"); 
     1405    if(JNI_DBG) printf("pvfsLstatMask\n"); 
    14191406    struct stat *arg; 
    14201407    arg = (struct stat *)jarg; 
     
    14271414    { 
    14281415        perror("pvfs_lstat_mask error"); 
    1429         fflush(stdout); 
    1430         return -1; 
    1431     } 
    1432     return rc; 
    1433 } 
    1434  
    1435 //pvfs_stat64 
     1416        rc = -1; 
     1417    } 
     1418    fflush(stderr); 
     1419    if(JNI_DBG) fflush(stdout); 
     1420    return rc; 
     1421} 
     1422 
     1423/* pvfs_stat64 */ 
    14361424JNIEXPORT jint JNICALL 
    14371425Java_PVFS2JNI_pvfsStat64  (JNIEnv *env, jobject obj, jlong jarg, jstring path) 
    14381426{ 
    1439     printf("pvfsStat64\n"); 
     1427    if(JNI_DBG) printf("pvfsStat64\n"); 
    14401428    struct stat64 *arg; 
    14411429    arg = (struct stat64 *)jarg; 
     
    14471435    { 
    14481436        perror("pvfs_stat64 error"); 
    1449         fflush(stdout); 
    1450         return -1; 
    1451     } 
    1452     return rc; 
    1453 } 
    1454  
    1455  
    1456 //pvfs_Fstat64 
     1437        rc = -1; 
     1438    } 
     1439    fflush(stderr); 
     1440    if(JNI_DBG) fflush(stdout); 
     1441    return rc; 
     1442} 
     1443 
     1444/* pvfs_Fstat64 */ 
    14571445JNIEXPORT jint JNICALL 
    14581446Java_PVFS2JNI_pvfsFstat64  (JNIEnv *env, jobject obj, jlong jarg, int fd) 
    14591447{ 
    1460     printf("pvfsFstat64\n"); 
     1448    if(JNI_DBG) printf("pvfsFstat64\n"); 
    14611449    struct stat64 *arg; 
    14621450    arg = (struct stat64 *)jarg; 
     
    14651453    { 
    14661454        perror("pvfs_fstat64 error"); 
    1467         fflush(stdout); 
    1468         return -1; 
    1469     } 
    1470     return rc; 
    1471 } 
    1472  
    1473  
    1474 //pvfs_Fstatat64 
     1455        rc = -1; 
     1456    } 
     1457    fflush(stderr); 
     1458    if(JNI_DBG) fflush(stdout); 
     1459    return rc; 
     1460} 
     1461 
     1462/* pvfs_Fstatat64 */ 
    14751463JNIEXPORT jint JNICALL 
    14761464Java_PVFS2JNI_pvfsFstatat64  (JNIEnv *env, jobject obj, jlong jarg, int fd, jstring path, int flag) 
    14771465{ 
    1478     printf("pvfsFstatat64\n"); 
     1466    if(JNI_DBG) printf("pvfsFstatat64\n"); 
    14791467    struct stat64 *arg; 
    14801468    arg = (struct stat64 *)jarg; 
     
    14861474    { 
    14871475        perror("pvfs_fstatat64 error"); 
    1488         fflush(stdout); 
    1489         return -1; 
    1490     } 
    1491     return rc; 
    1492 } 
    1493  
    1494  
    1495 //pvfs_lstat64 
     1476        rc = -1; 
     1477    } 
     1478    fflush(stderr); 
     1479    if(JNI_DBG) fflush(stdout); 
     1480    return rc; 
     1481} 
     1482 
     1483/* pvfs_lstat64 */ 
    14961484JNIEXPORT jint JNICALL 
    14971485Java_PVFS2JNI_pvfsLstat64  (JNIEnv *env, jobject obj, jlong jarg, jstring path) 
    14981486{ 
    1499     printf("pvfsLstat64\n"); 
     1487    if(JNI_DBG) printf("pvfsLstat64\n"); 
    15001488    struct stat64 *arg; 
    15011489    arg = (struct stat64 *)jarg; 
     
    15071495    { 
    15081496        perror("pvfs_lstat64 error"); 
    1509         fflush(stdout); 
    1510         return -1; 
    1511     } 
    1512     return rc; 
    1513 } 
    1514 //FILLSTAT64 
     1497        rc = -1; 
     1498    } 
     1499    fflush(stderr); 
     1500    if(JNI_DBG) fflush(stdout); 
     1501    return rc; 
     1502} 
     1503 
     1504/* FILLSTAT64 */ 
    15151505JNIEXPORT jlong JNICALL 
    15161506Java_PVFS2JNI_FillStat64  (JNIEnv *env, jobject obj, jobject x) 
    15171507{ 
    1518     printf("FillStat64\n"); 
    1519     fflush(stdout); 
     1508    if(JNI_DBG) printf("FillStat64\n"); 
     1509    jlong rc = 0; 
    15201510    jfieldID fid1; 
    15211511    jfieldID fid2; 
     
    16111601    } 
    16121602    struct stat64 *cstat64 = (struct stat64 *) malloc(sizeof(struct stat64)); 
     1603    if(!cstat64) 
     1604    { 
     1605        return -1; 
     1606    } 
    16131607    st_dev = (*env)->GetLongField(env, x, fid1); 
    16141608    dev_t cst_dev = (dev_t) st_dev; 
     
    16501644    time_t cst_ctime = (time_t) st_ctim; 
    16511645    cstat64->st_ctime = cst_ctime; 
     1646    /* TODO: this looks incorrect */ 
    16521647    long lp = (long)cstat64; 
    16531648    free(cstat64); 
     1649    if(JNI_DBG) fflush(stdout); 
    16541650    return lp; 
    16551651} 
    16561652 
    1657  
    1658 //FILLSTAT 
     1653/* FILLSTAT */ 
    16591654JNIEXPORT jlong JNICALL 
    16601655Java_PVFS2JNI_FillStat  (JNIEnv *env, jobject obj, jobject x) 
    16611656{ 
    1662     printf("FillStat\n"); 
    1663     fflush(stdout); 
     1657    if(JNI_DBG) printf("FillStat\n"); 
    16641658    jfieldID fid1; 
    16651659    jfieldID fid2; 
     
    17551749    } 
    17561750    struct stat *cstat = (struct stat *)malloc(sizeof(struct stat)); 
     1751    if(!cstat) 
     1752    { 
     1753        perror("malloc failure"); 
     1754        goto done; 
     1755    } 
    17571756    st_dev = (*env)->GetLongField(env, x, fid1); 
    17581757    dev_t cst_dev = (dev_t) st_dev; 
     
    17941793    time_t cst_ctime = (time_t) st_ctim; 
    17951794    cstat->st_ctime = cst_ctime; 
     1795    /* TODO: this looks incorrect */ 
    17961796    long lp = (long)cstat; 
    1797     free(cstat); 
     1797done: 
     1798    if(cstat) 
     1799    { 
     1800        free(cstat); 
     1801    } 
     1802    fflush(stderr); 
     1803    if(JNI_DBG) fflush(stdout); 
    17981804    return lp; 
    17991805} 
     
    18051811    arg = (struct stat64 *)jarg; 
    18061812    disp64(arg); 
    1807     //printf("=======DISPLAY========\n"); 
    1808     //printf("The st_dev is: %ld\n", arg->st_dev); 
     1813    /* 
     1814    printf("=======DISPLAY========\n"); 
     1815    printf("The st_dev is: %ld\n", arg->st_dev); 
     1816    */ 
    18091817} 
    18101818 
     
    18121820Java_PVFS2JNI_UseStat  (JNIEnv *env, jobject obj, jlong jarg) 
    18131821{ 
    1814     struct stat xyz; 
    18151822    struct stat *arg; 
    18161823    arg = (struct stat *)jarg; 
    18171824    disp(arg); 
    1818     //printf("=======DISPLAY========\n"); 
    1819     //printf("The st_dev is: %ld\n", arg->st_dev); 
    1820 } 
    1821  
     1825    /* 
     1826    printf("=======DISPLAY========\n"); 
     1827    printf("The st_dev is: %ld\n", arg->st_dev); 
     1828    */ 
     1829} 
    18221830 
    18231831JNIEXPORT jlong JNICALL 
    18241832Java_PVFS2JNI_FillDirent  (JNIEnv *env, jobject obj, jobject x) 
    18251833{ 
    1826     printf("FillDirent\n"); 
    1827     fflush(stdout); 
     1834    if(JNI_DBG) printf("FillDirent\n"); 
     1835    long lp = 0; 
     1836    struct dirent *cdirent = 0; 
    18281837    jfieldID fid1; 
    18291838    jfieldID fid2; 
     
    18401849    if (fid1 == NULL) 
    18411850    { 
    1842         return; 
     1851        lp = -1; 
     1852        goto done; 
    18431853    } 
    18441854    fid2 = (*env)->GetFieldID(env, cls1, "d_off", "J"); 
    18451855    if (fid2 == NULL) 
    18461856    { 
    1847         return; 
     1857        lp = -1; 
     1858        goto done; 
    18481859    } 
    18491860    fid3 = (*env)->GetFieldID(env, cls1, "d_reclen", "I"); 
    18501861    if (fid3 == NULL) 
    18511862    { 
    1852         return; 
     1863        lp = -1; 
     1864        goto done; 
    18531865    } 
    18541866    fid4 = (*env)->GetFieldID(env, cls1, "d_type", "Ljava/lang/String;"); 
    18551867    if (fid4 == NULL) 
    18561868    { 
    1857         return; 
     1869        lp = -1; 
     1870        goto done; 
    18581871    } 
    18591872    fid5 = (*env)->GetFieldID(env, cls1, "d_name", "Ljava/lang/String;"); 
    18601873    if (fid5 == NULL) 
    18611874    { 
    1862         return; 
     1875        lp = -1; 
     1876        goto done; 
    18631877    } 
    18641878    const char* strdtype; 
    18651879    const char* strdname; 
    1866     struct dirent *cdirent = (struct dirent *)malloc(sizeof(struct dirent)); 
     1880    cdirent = (struct dirent *) malloc(sizeof(struct dirent)); 
     1881    if(!cdirent) 
     1882    { 
     1883        lp = -1; 
     1884        perror("malloc failed"); 
     1885        goto done; 
     1886    } 
    18671887    d_ino = (*env)->GetLongField(env, x, fid1); 
    18681888    __ino_t cd_ino = (__ino_t) d_ino; 
     
    18761896    d_type = (*env)->GetObjectField(env, x, fid4); 
    18771897    strdtype = (*env)->GetStringUTFChars(env, d_type, NULL); 
    1878     if (strdtype == NULL) 
    1879     { 
    1880         return; /* out of memory */ 
    1881     } 
    1882     if((strlen(strdtype)) != 1) 
    1883     { 
     1898    if (!strdtype) 
     1899    { 
     1900        lp = -1; /* out of memory */ 
     1901        perror("GetStringUTFChars failed"); 
     1902        goto done; 
     1903    } 
     1904    if(strlen(strdtype) != 1) 
     1905    { 
     1906        lp = -1; 
    18841907        perror("d_type is of type char, hence length cannot exceed 1\n"); 
    1885         fflush(stdout); 
    1886         return; 
     1908        goto done; 
    18871909    } 
    18881910    else 
     
    18911913        strcpy(dtypearr, strdtype); 
    18921914        char cd_type = dtypearr[0]; 
    1893         //printf("The d_type is: %c \n", cd_type); 
    1894         //fflush(stdout); 
     1915        if(JNI_DBG) printf("The d_type is: %c \n", cd_type); 
    18951916        cdirent->d_type = cd_type; 
    18961917    } 
    1897     //char cstrdtype = &(strdtype); 
    1898     //printf("The d_type is: %s \n", chartest); 
     1918    /* 
     1919    char cstrdtype = &(strdtype); 
     1920    printf("The d_type is: %s \n", chartest); 
     1921    */ 
    18991922    (*env)->ReleaseStringUTFChars(env, d_type, strdtype); 
    19001923    d_name = (*env)->GetObjectField(env, x, fid5); 
     
    19021925    if (strdname == NULL) 
    19031926    { 
    1904         return; /* out of memory */ 
     1927        lp = -1; 
     1928        perror("GetStringUTFChars failed"); 
     1929        goto done; 
    19051930    } 
    19061931    if((strlen(strdname)) > 256) 
    19071932    { 
     1933        lp = -1; 
    19081934        perror("Length of strdname cannot exceed 250\n"); 
    1909         fflush(stdout); 
    1910         return; 
     1935        goto done; 
    19111936    } 
    19121937    else 
     
    19171942    } 
    19181943    (*env)->ReleaseStringUTFChars(env, d_name, strdname); 
    1919     long lp = (long)cdirent; 
    1920     free(cdirent); 
     1944    lp = (long)cdirent; 
     1945done: 
     1946    if(cdirent) 
     1947    { 
     1948        free(cdirent); 
     1949    } 
     1950    fflush(stderr); 
     1951    if(JNI_DBG) fflush(stdout); 
    19211952    return lp; 
    19221953} 
     1954 
    19231955void dispdirent(struct dirent *abc) 
    19241956{ 
    1925     printf("=======DISPLAY========\n"); 
    1926     printf("The d_ino is: %d\n", (int) abc->d_ino); 
    1927     printf("The d_off is: %d\n", (int) abc->d_off); 
    1928     printf("The d_reclen is: %d\n", abc->d_reclen); 
    1929     printf("The d_type is: %c \n", abc->d_type); 
    1930     printf("The d_name is: %s \n", abc->d_name); 
    1931     fflush(stdout); 
    1932 } 
     1957    if(JNI_DBG) 
     1958    { 
     1959        printf("=======DISPLAY========\n"); 
     1960        printf("The d_ino is: %d\n", (int) abc->d_ino); 
     1961        printf("The d_off is: %d\n", (int) abc->d_off); 
     1962        printf("The d_reclen is: %d\n", abc->d_reclen); 
     1963        printf("The d_type is: %c \n", abc->d_type); 
     1964        printf("The d_name is: %s \n", abc->d_name); 
     1965        fflush(stdout); 
     1966    } 
     1967} 
     1968 
    19331969JNIEXPORT jlong JNICALL 
    19341970Java_PVFS2JNI_UseDirent  (JNIEnv *env, jobject obj, jlong jarg) 
    19351971{ 
    1936     struct dirent xyz; 
    19371972    struct dirent *arg; 
    19381973    arg = (struct dirent *)jarg; 
    19391974    dispdirent(arg); 
    1940     //printf("=======DISPLAY========\n"); 
    1941     //printf("The st_dev is: %ld\n", arg->st_dev); 
    1942 } 
    1943  
    1944 //FILL DIRENT 
     1975    /* 
     1976    printf("=======DISPLAY========\n"); 
     1977    printf("The st_dev is: %ld\n", arg->st_dev); 
     1978    */ 
     1979} 
     1980 
     1981/*  FILL DIRENT */ 
    19451982JNIEXPORT jlong JNICALL 
    19461983Java_PVFS2JNI_FillDirent64(JNIEnv *env, jobject obj, jobject x) 
    19471984{ 
    1948     printf("FillDirent64\n"); 
    1949     fflush(stdout); 
     1985    if(JNI_DBG) printf("FillDirent64\n"); 
     1986    long lp = 0; 
     1987    struct dirent64 *cdirent64 = NULL; 
     1988    const char* strdtype = NULL; 
     1989    const char* strdname = NULL; 
    19501990    jfieldID fid1; 
    19511991    jfieldID fid2; 
     
    19622002    if (fid1 == NULL) 
    19632003    { 
    1964         return; 
     2004        lp = -1; 
     2005        goto done; 
    19652006    } 
    19662007    fid2 = (*env)->GetFieldID(env, cls1, "d_off", "J"); 
    19672008    if (fid2 == NULL) 
    19682009    { 
    1969         return; 
     2010        lp = -1; 
     2011        goto done; 
    19702012    } 
    19712013    fid3 = (*env)->GetFieldID(env, cls1, "d_reclen", "I"); 
    19722014    if (fid3 == NULL) 
    19732015    { 
    1974         return; 
     2016        lp = -1; 
     2017        goto done; 
    19752018    } 
    19762019    fid4 = (*env)->GetFieldID(env, cls1, "d_type", "Ljava/lang/String;"); 
    19772020    if (fid4 == NULL) 
    19782021    { 
    1979         return; 
     2022        lp = -1; 
     2023        goto done; 
    19802024    } 
    19812025    fid5 = (*env)->GetFieldID(env, cls1, "d_name", "Ljava/lang/String;"); 
    19822026    if (fid5 == NULL) 
    19832027    { 
    1984         return; 
    1985     } 
    1986     const char* strdtype; 
    1987     const char* strdname; 
    1988     struct dirent64 *cdirent64 = (struct dirent64 *)malloc(sizeof(struct dirent64)); 
     2028        lp = -1; 
     2029        goto done; 
     2030    } 
     2031    cdirent64 = (struct dirent64 *) malloc(sizeof(struct dirent64)); 
    19892032    d_ino = (*env)->GetLongField(env, x, fid1); 
    19902033    __ino64_t cd_ino = (__ino64_t) d_ino; 
     
    20002043    if (strdtype == NULL) 
    20012044    { 
    2002         return; /* out of memory */ 
    2003     } 
    2004     if((strlen(strdtype)) != 1) 
    2005     { 
     2045        lp = -1; 
     2046        perror("GetStringUTFChars failed"); 
     2047        goto done; 
     2048    } 
     2049    if(strlen(strdtype) != 1) 
     2050    { 
     2051        lp = -1; 
    20062052        perror("d_type is of type char, hence length cannot exceed 1\n"); 
    2007         fflush(stdout); 
    2008         return; 
     2053        goto done; 
    20092054    } 
    20102055    else 
     
    20132058        strcpy(dtypearr, strdtype); 
    20142059        char cd_type = dtypearr[0]; 
    2015         //printf("The d_type is: %c \n", cd_type); 
    2016         //fflush(stdout); 
     2060        /* 
     2061        printf("The d_type is: %c \n", cd_type); 
     2062        fflush(stdout); 
     2063        */ 
    20172064        cdirent64->d_type = cd_type; 
    20182065    } 
    2019     //char cstrdtype = &(strdtype); 
    2020     //printf("The d_type is: %s \n", chartest); 
     2066    /* 
     2067    char cstrdtype = &(strdtype); 
     2068    printf("The d_type is: %s \n", chartest); 
     2069    */ 
    20212070    (*env)->ReleaseStringUTFChars(env, d_type, strdtype); 
    20222071    d_name = (*env)->GetObjectField(env, x, fid5); 
     
    20242073    if (strdname == NULL) 
    20252074    { 
    2026         return; /* out of memory */ 
    2027     } 
    2028     if((strlen(strdname)) > 257) 
    2029     { 
     2075        lp = -1; 
     2076        perror("GetStringUTFChars failed"); 
     2077        goto done; 
     2078    } 
     2079    if(strlen(strdname) > 257) 
     2080    { 
     2081        lp = -1; 
    20302082        perror("Length of strdname cannot exceed 250\n"); 
    2031         fflush(stdout); 
    2032         return; 
     2083        goto done; 
    20332084    } 
    20342085    else 
     
    20392090    } 
    20402091    (*env)->ReleaseStringUTFChars(env, d_name, strdname); 
    2041     long lp = (long)cdirent64; 
    2042     free(cdirent64); 
     2092    lp = (long)cdirent64; 
     2093done: 
     2094    if(cdirent64) 
     2095    { 
     2096        free(cdirent64); 
     2097    } 
     2098    if(JNI_DBG) fflush(stdout); 
    20432099    return lp; 
    20442100} 
     
    20462102void dispdirent64(struct dirent64 *abc) 
    20472103{ 
    2048     printf("=======DISPLAY========\n"); 
    2049     printf("The d_ino is: %d\n", (int) abc->d_ino); 
    2050     printf("The d_off is: %d\n", (int) abc->d_off); 
    2051     printf("The d_reclen is: %d\n", abc->d_reclen); 
    2052     printf("The d_type is: %c \n", abc->d_type); 
    2053     printf("The d_name is: %s \n", abc->d_name); 
    2054     fflush(stdout); 
    2055 } 
     2104    if(JNI_DBG) 
     2105    { 
     2106        printf("=======DISPLAY========\n"); 
     2107        printf("The d_ino is: %d\n", (int) abc->d_ino); 
     2108        printf("The d_off is: %d\n", (int) abc->d_off); 
     2109        printf("The d_reclen is: %d\n", abc->d_reclen); 
     2110        printf("The d_type is: %c \n", abc->d_type); 
     2111        printf("The d_name is: %s \n", abc->d_name); 
     2112        fflush(stdout); 
     2113    } 
     2114} 
     2115 
    20562116JNIEXPORT jlong JNICALL 
    20572117Java_PVFS2JNI_UseDirent64  (JNIEnv *env, jobject obj, jlong jarg) 
    20582118{ 
    2059     struct dirent64 xyz; 
    20602119    struct dirent64 *arg; 
    20612120    arg = (struct dirent64 *)jarg; 
    20622121    dispdirent64(arg); 
    2063     //printf("=======DISPLAY========\n"); 
    2064     //printf("The st_dev is: %ld\n", arg->st_dev); 
    2065 } 
    2066  
    2067  
    2068 //FILL STATFS 
     2122    /* 
     2123    printf("=======DISPLAY========\n"); 
     2124    printf("The st_dev is: %ld\n", arg->st_dev); 
     2125    */ 
     2126} 
     2127 
     2128/* FILL STATFS */ 
    20692129JNIEXPORT jlong JNICALL 
    20702130Java_PVFS2JNI_FillStatfs  (JNIEnv *env, jobject obj, jobject x, jlong jarg) 
    20712131{ 
    2072     printf("FillStatfs\n"); 
    2073     fflush(stdout); 
     2132    if(JNI_DBG) printf("FillStatfs\n"); 
     2133    long lp = 0; 
     2134    struct statfs *cstatfs = NULL; 
    20742135    jfieldID fid1; 
    20752136    jfieldID fid2; 
     
    20992160    if (fid1 == NULL) 
    21002161    { 
    2101         return; 
     2162        lp = -1; 
     2163        goto done; 
    21022164    } 
    21032165    fid2 = (*env)->GetFieldID(env, cls1, "f_bsize", "J"); 
    21042166    if (fid2 == NULL) 
    21052167    { 
    2106         return; 
     2168        lp = -1; 
     2169        goto done; 
    21072170    } 
    21082171    fid3 = (*env)->GetFieldID(env, cls1, "f_blocks", "J"); 
    21092172    if (fid3 == NULL) 
    21102173    { 
    2111         return; 
     2174        lp = -1; 
     2175        goto done; 
    21122176    } 
    21132177    fid4 = (*env)->GetFieldID(env, cls1, "f_bfree", "J"); 
    21142178    if (fid4 == NULL) 
    21152179    { 
    2116         return; 
     2180        lp = -1; 
     2181        goto done; 
    21172182    } 
    21182183    fid5 = (*env)->GetFieldID(env, cls1, "f_bavail", "J"); 
    21192184    if (fid5 == NULL) 
    21202185    { 
    2121         return; 
     2186        lp = -1; 
     2187        goto done; 
    21222188    } 
    21232189    fid6 = (*env)->GetFieldID(env, cls1, "f_files", "J"); 
    21242190    if (fid6 == NULL) 
    21252191    { 
    2126         return; 
     2192        lp = -1; 
     2193        goto done; 
    21272194    } 
    21282195    fid7 = (*env)->GetFieldID(env, cls1, "f_ffree", "J"); 
    21292196    if (fid7 == NULL) 
    21302197    { 
    2131         return; 
     2198        lp = -1; 
     2199        goto done; 
    21322200    } 
    21332201    fid9 = (*env)->GetFieldID(env, cls1, "f_namelen", "J"); 
    21342202    if (fid9 == NULL) 
    21352203    { 
    2136         return; 
     2204        lp = -1; 
     2205        goto done; 
    21372206    } 
    21382207    fid10 = (*env)->GetFieldID(env, cls1, "f_frsize", "J"); 
    21392208    if (fid10 == NULL) 
    21402209    { 
    2141         return; 
     2210        lp = -1; 
     2211        goto done; 
    21422212    } 
    21432213    fid11 = (*env)->GetFieldID(env, cls1, "f_spare", "[J"); 
    21442214    if (fid11 == NULL) 
    21452215    { 
    2146         return; 
     2216        lp = -1; 
     2217        goto done; 
    21472218    } 
    21482219    fid12 = (*env)->GetFieldID(env, cls1, "f_flags", "J"); 
    21492220    if (fid12 == NULL) 
    21502221    { 
    2151         return; 
    2152     } 
    2153     /* __SWORD_TYPE* tmp; 
     2222        lp = -1; 
     2223        goto done; 
     2224    } 
     2225    /* 
     2226    __SWORD_TYPE* tmp; 
    21542227    tmp = (__SWORD_TYPE *) malloc( 5 * sizeof(__SWORD_TYPE) ); 
    21552228    tmp[0]=10; 
    21562229    tmp[1]=20; 
    2157     printf("tmp=%ld\n",tmp[0]);*/ 
    2158     struct statfs *cstatfs = (struct statfs *)malloc(sizeof(struct statfs) + 1); 
    2159     //long int *(cstatfs->f_spare[0]) = tmp[0]; 
    2160     /*long int i= 10; 
     2230    printf("tmp=%ld\n",tmp[0]); 
     2231    */ 
     2232    cstatfs = (struct statfs *)malloc(sizeof(struct statfs) + 1); 
     2233    /* 
     2234    long int i= 10; 
     2235    long int *(cstatfs->f_spare[0]) = tmp[0]; 
    21612236    cstatfs->f_spare[4]=10; 
    21622237    printf("f_spare[4]=%d\n",cstatfs->f_spare[4]); 
     
    21922267    __SWORD_TYPE cf_flags = (__SWORD_TYPE) f_flags; 
    21932268    cstatfs->f_flags = cf_flags; 
    2194     //buf=(*env)->GetLongArrayElements(env,x,fid11); 
    2195     //printf("ARRAY:%ld",buf[0]; 
     2269    /* 
     2270    buf=(*env)->GetLongArrayElements(env,x,fid11); 
     2271    printf("ARRAY:%ld",buf[0]; 
     2272    */ 
    21962273    jlong buf[5]; 
    21972274    jlongArray ar; 
     
    22052282        cbuf[ival] = buf[ival]; 
    22062283    } 
    2207     //printf("cbuf=%ld",cbuf[4]); 
     2284    /* printf("cbuf=%ld",cbuf[4]); */ 
    22082285    for(jval = 0; jval <= 4; jval++) 
    22092286    { 
    22102287        cstatfs->f_spare[jval] = cbuf[jval]; 
    22112288    } 
    2212     //cstatfs->f_spare[4] = 10; 
     2289    /* cstatfs->f_spare[4] = 10; */ 
    22132290    fsid_t *arg; 
    22142291    arg = (fsid_t *)jarg; 
    22152292    cstatfs->f_fsid.__val[0] = arg->__val[0]; 
    22162293    cstatfs->f_fsid.__val[1] = arg->__val[1]; 
    2217     //printf("cstatfs.fsid1=%d\n",cstatfs->f_fsid.__val[0]); 
    2218     //printf("cstatfs.fsid2=%d\n",cstatfs->f_fsid.__val[1]); 
     2294    /* 
     2295    printf("cstatfs.fsid1=%d\n",cstatfs->f_fsid.__val[0]); 
     2296    printf("cstatfs.fsid2=%d\n",cstatfs->f_fsid.__val[1]); 
     2297    */ 
     2298    /* TODO: this looks incorrect */ 
     2299    lp = (long)cstatfs; 
     2300done: 
     2301    free(cstatfs); 
    22192302    fflush(stdout); 
    2220     long lp = (long)cstatfs; 
    22212303    return lp; 
     2304 
    22222305} 
    22232306 
    22242307void dispstatfs(struct statfs *abc) 
    22252308{ 
    2226     printf("=======DISPLAY========\n"); 
    2227     printf("The f_type is: %ld\n", abc->f_type); 
    2228     printf("The f_bsize is: %ld\n", abc->f_bsize); 
    2229     printf("The f_blocks is: %lu\n", (long unsigned int) abc->f_blocks); 
    2230     printf("The f_bfree is: %lu \n", (long unsigned int) abc->f_bfree); 
    2231     printf("The f_bavail is: %lu \n", (long unsigned int) abc->f_bavail); 
    2232     printf("The f_files is: %lu \n", (long unsigned int) abc->f_files); 
    2233     printf("The f_ffree is: %lu \n", (long unsigned int) abc->f_ffree); 
    2234     //printf("The f_fsid is: %d \n", abc->f_fsid); 
    2235     printf("The f_namelen is: %ld \n", abc->f_namelen); 
    2236     printf("The f_frsize is: %ld \n", abc->f_frsize); 
    2237     printf("The f_flags is: %ld \n", abc->f_flags); 
    2238     int i; 
    2239     for(i = 0; i <= 4; i++) 
    2240     { 
    2241         printf("F_SPARE %d = %ld\n", i, abc->f_spare[i]); 
    2242     } 
    2243     for(i = 0; i <= 1; i++) 
    2244     { 
    2245         printf("F_FSID %d = %d\n", i, abc->f_fsid.__val[i]); 
    2246     } 
    2247     printf("=======DISPLAY========\n"); 
    2248     fflush(stdout); 
    2249     free(abc); 
     2309    if(JNI_DBG) 
     2310    { 
     2311        printf("=======DISPLAY========\n"); 
     2312        printf("The f_type is: %ld\n", abc->f_type); 
     2313        printf("The f_bsize is: %ld\n", abc->f_bsize); 
     2314        printf("The f_blocks is: %lu\n", (long unsigned int) abc->f_blocks); 
     2315        printf("The f_bfree is: %lu \n", (long unsigned int) abc->f_bfree); 
     2316        printf("The f_bavail is: %lu \n", (long unsigned int) abc->f_bavail); 
     2317        printf("The f_files is: %lu \n", (long unsigned int) abc->f_files); 
     2318        printf("The f_ffree is: %lu \n", (long unsigned int) abc->f_ffree); 
     2319        /* printf("The f_fsid is: %d \n", abc->f_fsid); */ 
     2320        printf("The f_namelen is: %ld \n", abc->f_namelen); 
     2321        printf("The f_frsize is: %ld \n", abc->f_frsize); 
     2322        printf("The f_flags is: %ld \n", abc->f_flags); 
     2323        int i; 
     2324        for(i = 0; i <= 4; i++) 
     2325        { 
     2326            printf("F_SPARE %d = %ld\n", i, abc->f_spare[i]); 
     2327        } 
     2328        for(i = 0; i <= 1; i++) 
     2329        { 
     2330            printf("F_FSID %d = %d\n", i, abc->f_fsid.__val[i]); 
     2331        } 
     2332        printf("=======DISPLAY========\n"); 
     2333        fflush(stdout); 
     2334    } 
    22502335} 
    22512336 
     
    22532338Java_PVFS2JNI_UseStatfs  (JNIEnv *env, jobject obj, jlong jarg) 
    22542339{ 
    2255     struct statfs xyz; 
    22562340    struct statfs *arg; 
    22572341    arg = (struct statfs *)jarg; 
     
    22622346Java_PVFS2JNI_FillFsid  (JNIEnv *env, jobject obj, jobject x) 
    22632347{ 
    2264     printf("FillFsid\n"); 
    2265     fflush(stdout); 
     2348    if(JNI_DBG) printf("FillFsid\n"); 
     2349    long lp = 0; 
     2350    fsid_t *cfsid_t = 0; 
    22662351    jfieldID fid1; 
    22672352    jclass cls1 = (*env)->FindClass(env, "PVFS2JNI$Fsid"); 
     
    22692354    if (fid1 == NULL) 
    22702355    { 
    2271         return; 
    2272     } 
    2273     fsid_t *cfsid_t = (fsid_t *)malloc(sizeof(fsid_t)); 
     2356        lp = -1; 
     2357        goto done; 
     2358    } 
     2359    cfsid_t = (fsid_t *) malloc(sizeof(fsid_t)); 
     2360    if(!cfsid_t) 
     2361    { 
     2362        perror("malloc failed"); 
     2363        lp = -1; 
     2364        goto done; 
     2365    } 
    22742366    jint buf[2]; 
    22752367    jintArray ar; 
     
    22832375        cbuf[ival] = buf[ival]; 
    22842376    } 
    2285     //printf("cbuf=%ld",cbuf[4]); 
     2377    /* printf("cbuf=%ld",cbuf[4]); */ 
    22862378    for(jval = 0; jval <= 1; jval++) 
    22872379    { 
     
    22902382    for(jval = 0; jval <= 1; jval++) 
    22912383    { 
    2292         printf("arr[%d]=%d\n", jval, cfsid_t->__val[jval]); 
    2293     } 
    2294     long lp = (long)cfsid_t; 
     2384        if(JNI_DBG) printf("arr[%d]=%d\n", jval, cfsid_t->__val[jval]); 
     2385    } 
     2386    lp = (long)cfsid_t; 
     2387done: 
     2388    if(cfsid_t) 
     2389    { 
     2390        free(cfsid_t); 
     2391    } 
     2392    fflush(stderr); 
     2393    if(JNI_DBG) fflush(stdout); 
    22952394    return lp; 
    22962395} 
     
    22982397void dispfsid(fsid_t *abc) 
    22992398{ 
    2300     printf("=======DISPLAY========\n"); 
    2301     int i; 
    2302     for(i = 0; i <= 1; i++) 
    2303     { 
    2304         printf("Array element %d = %d\n", i, abc->__val[i]); 
    2305     } 
    2306     printf("=======DISPLAY========\n"); 
    2307     fflush(stdout); 
    2308 } 
     2399    if(JNI_DBG) 
     2400    { 
     2401        printf("=======DISPLAY========\n"); 
     2402        int i; 
     2403        for(i = 0; i <= 1; i++) 
     2404        { 
     2405            printf("Array element %d = %d\n", i, abc->__val[i]); 
     2406        } 
     2407        printf("=======DISPLAY========\n"); 
     2408        fflush(stdout); 
     2409    } 
     2410} 
     2411 
    23092412JNIEXPORT jlong JNICALL 
    23102413Java_PVFS2JNI_UseFsid  (JNIEnv *env, jobject obj, jlong jarg) 
    23112414{ 
    2312     fsid_t xyz; 
    23132415    fsid_t *arg; 
    23142416    arg = (fsid_t *)jarg; 
     
    23192421Java_PVFS2JNI_FillUtimbuf  (JNIEnv *env, jobject obj, jobject x) 
    23202422{ 
    2321     printf("FillUtimbuf\n"); 
    2322     fflush(stdout); 
     2423    if(JNI_DBG) printf("FillUtimbuf\n"); 
     2424    struct utimbuf *cutimbuf = 0; 
     2425    long lp = 0; 
    23232426    jfieldID fid1; 
    23242427    jfieldID fid2; 
     
    23292432    if (fid1 == NULL) 
    23302433    { 
    2331         return; 
     2434        lp = -1; 
     2435        goto done; 
    23322436    } 
    23332437    fid2 = (*env)->GetFieldID(env, cls1, "modtime", "J"); 
    23342438    if (fid2 == NULL) 
    23352439    { 
    2336         return; 
    2337     } 
    2338     struct utimbuf *cutimbuf = (struct utimbuf *)malloc(sizeof(struct utimbuf)); 
     2440        lp = -1; 
     2441        goto done; 
     2442    } 
     2443    cutimbuf = (struct utimbuf *)malloc(sizeof(struct utimbuf)); 
     2444    if(!cutimbuf) 
     2445    { 
     2446        perror("malloc failed"); 
     2447        lp = -1; 
     2448        goto done; 
     2449    } 
    23392450    actime = (*env)->GetLongField(env, x, fid1); 
    23402451    long cactime = (long) actime; 
     
    23432454    long cmodtime = (long) modtime; 
    23442455    cutimbuf->modtime = cmodtime; 
    2345     printf("ACTIME=:%ld\n", cutimbuf->actime); 
    2346     printf("MODTIME=:%ld\n", cutimbuf->modtime); 
    2347     fflush(stdout); 
    2348     long lp = (long)cutimbuf; 
     2456    if(JNI_DBG) 
     2457    { 
     2458        printf("ACTIME=:%ld\n", cutimbuf->actime); 
     2459        printf("MODTIME=:%ld\n", cutimbuf->modtime); 
     2460    } 
     2461    lp = (long)cutimbuf; 
     2462done: 
     2463    if(cutimbuf) 
     2464    { 
     2465        free(cutimbuf); 
     2466    } 
     2467    fflush(stderr); 
     2468    if(JNI_DBG) fflush(stdout); 
    23492469    return lp; 
    23502470} 
     
    23522472void disputimbuf(struct utimbuf *abc) 
    23532473{ 
    2354     printf("=======DISPLAY========\n"); 
    2355     printf("ACTIME=:%ld\n", abc->actime); 
    2356     printf("MODTIME=:%ld\n", abc->modtime); 
    2357     printf("=======DISPLAY========\n"); 
    2358     fflush(stdout); 
    2359     free(abc); 
     2474    if(JNI_DBG) 
     2475    { 
     2476        printf("=======DISPLAY========\n"); 
     2477        printf("ACTIME=:%ld\n", abc->actime); 
     2478        printf("MODTIME=:%ld\n", abc->modtime); 
     2479        printf("=======DISPLAY========\n"); 
     2480        fflush(stdout); 
     2481    } 
    23602482} 
    23612483 
     
    23632485Java_PVFS2JNI_UseUtimbuf  (JNIEnv *env, jobject obj, jlong jarg) 
    23642486{ 
    2365     struct utimbuf xyz; 
    23662487    struct utimbuf *arg; 
    23672488    arg = (struct utimbuf *)jarg; 
     
    23722493Java_PVFS2JNI_FillTimeval  (JNIEnv *env, jobject obj, jobject x) 
    23732494{ 
    2374     printf("FillTimeval\n"); 
    2375     fflush(stdout); 
     2495    if(JNI_DBG) printf("FillTimeval\n"); 
     2496    struct timeval *ctimeval = NULL; 
     2497    long lp = 0; 
    23762498    jfieldID fid1; 
    23772499    jfieldID fid2; 
     
    23822504    if (fid1 == NULL) 
    23832505    { 
    2384         return; 
     2506        lp = -1; 
     2507        goto done; 
    23852508    } 
    23862509    fid2 = (*env)->GetFieldID(env, cls1, "tv_usec", "J"); 
    23872510    if (fid2 == NULL) 
    23882511    { 
    2389         return; 
    2390     } 
    2391     struct timeval *ctimeval = (struct timeval *)malloc(sizeof(struct timeval)); 
     2512        lp = -1; 
     2513        goto done; 
     2514    } 
     2515    ctimeval = (struct timeval *)malloc(sizeof(struct timeval)); 
     2516    if(!ctimeval) 
     2517    { 
     2518        perror("malloc failed"); 
     2519        lp = -1; 
     2520        goto done; 
     2521    } 
    23922522    tv_sec = (*env)->GetLongField(env, x, fid1); 
    23932523    __time_t ctv_sec = (__time_t) tv_sec; 
     
    23962526    __suseconds_t ctv_usec = (__suseconds_t) tv_usec; 
    23972527    ctimeval->tv_usec = ctv_usec; 
    2398     printf("TV_SEC=:%ld\n", ctimeval->tv_sec); 
    2399     printf("TV_USEC=:%ld\n", ctimeval->tv_usec); 
    2400     fflush(stdout); 
    2401     long lp = (long)ctimeval; 
     2528    if(JNI_DBG) 
     2529    { 
     2530        printf("TV_SEC=:%ld\n", ctimeval->tv_sec); 
     2531        printf("TV_USEC=:%ld\n", ctimeval->tv_usec); 
     2532    } 
     2533    lp = (long) ctimeval; 
     2534done: 
     2535    if(ctimeval) 
     2536    { 
     2537        free(ctimeval); 
     2538    } 
     2539    fflush(stderr); 
     2540    if(JNI_DBG) fflush(stdout); 
    24022541    return lp; 
    24032542} 
     
    24052544void disptimeval(struct timeval abc[2]) 
    24062545{ 
    2407     printf("=======DISPLAY========\n"); 
    2408     printf("++STRUCT  1++\n"); 
    2409     printf("ACTIME=:%ld\n", abc[0].tv_sec); 
    2410     printf("MODTIME=:%ld\n", abc[0].tv_usec); 
    2411     printf("++STRUCT  2++\n"); 
    2412     printf("ACTIME=:%ld\n", abc[1].tv_sec); 
    2413     printf("MODTIME=:%ld\n", abc[1].tv_usec); 
    2414     printf("=======DISPLAY========\n"); 
    2415     fflush(stdout); 
    2416     //free(abc); 
     2546    if(JNI_DBG) 
     2547    { 
     2548        printf("=======DISPLAY========\n"); 
     2549        printf("++STRUCT  1++\n"); 
     2550        printf("ACTIME=:%ld\n", abc[0].tv_sec); 
     2551        printf("MODTIME=:%ld\n", abc[0].tv_usec); 
     2552        printf("++STRUCT  2++\n"); 
     2553        printf("ACTIME=:%ld\n", abc[1].tv_sec); 
     2554        printf("MODTIME=:%ld\n", abc[1].tv_usec); 
     2555        printf("=======DISPLAY========\n"); 
     2556        fflush(stdout); 
     2557    } 
    24172558} 
    24182559 
     
    24302571    abc[1].tv_usec = arg2->tv_usec; 
    24312572    disptimeval(abc); 
    2432     /*printf("++STRUCT  1++\n"); 
     2573    /* 
     2574    printf("++STRUCT  1++\n"); 
    24332575    printf("ACTIME=:%ld\n", abc[0].tv_sec); 
    24342576    printf("MODTIME=:%ld\n", abc[0].tv_usec); 
    24352577    printf("++STRUCT  2++\n"); 
    24362578    printf("ACTIME=:%ld\n", abc[1].tv_sec); 
    2437     printf("MODTIME=:%ld\n", abc[1].tv_usec);*/ 
    2438 } 
    2439  
    2440 //pvfs_readdir 
     2579    printf("MODTIME=:%ld\n", abc[1].tv_usec); 
     2580    */ 
     2581} 
     2582 
     2583/* pvfs_readdir */ 
    24412584JNIEXPORT jint JNICALL 
    24422585Java_PVFS2JNI_pvfsReaddir  (JNIEnv *env, jobject obj, jlong jarg, int fd, int count) 
    24432586{ 
    2444     printf("pvfsReaddir\n"); 
     2587    if(JNI_DBG) printf("pvfsReaddir\n"); 
     2588    int rc = 0; 
    24452589    struct dirent *arg; 
    24462590    arg = (struct dirent *)jarg; 
    24472591    unsigned int cfd = (unsigned int) fd; 
    24482592    unsigned int ccount = (unsigned int) count; 
    2449     int rc = pvfs_readdir(cfd, arg, ccount); 
     2593    rc = pvfs_readdir(cfd, arg, ccount); 
    24502594    if(rc < 0) 
    24512595    { 
    24522596        perror("pvfs_readdir error"); 
    2453         fflush(stdout); 
    2454         return -1; 
    2455     } 
    2456     return rc; 
    2457 } 
    2458  
    2459  
    2460 //pvfs_getdents 
     2597        rc = -1; 
     2598    } 
     2599    fflush(stderr); 
     2600    if(JNI_DBG) fflush(stdout); 
     2601    return rc; 
     2602} 
     2603 
     2604 
     2605/* pvfs_getdents */ 
    24612606JNIEXPORT jint JNICALL 
    24622607Java_PVFS2JNI_pvfsGetdents  (JNIEnv *env, jobject obj, jlong jarg, int fd, int size) 
    24632608{ 
    2464     printf("pvfsGetdents\n"); 
     2609    if(JNI_DBG) printf("pvfsGetdents\n"); 
     2610    int rc = 0; 
    24652611    struct dirent *arg; 
    24662612    arg = (struct dirent *)jarg; 
    24672613    unsigned int cfd = (unsigned int) fd; 
    24682614    unsigned int csize = (unsigned int) size; 
    2469     int rc = pvfs_getdents(cfd, arg, csize); 
     2615    rc = pvfs_getdents(cfd, arg, csize); 
    24702616    if(rc < 0) 
    24712617    { 
    24722618        perror("pvfs_getdents error"); 
    2473         fflush(stdout); 
    2474         return -1; 
    2475     } 
    2476     return rc; 
    2477 } 
    2478  
    2479 //pvfs_getdents64 
     2619        rc = -1; 
     2620    } 
     2621    fflush(stderr); 
     2622    if(JNI_DBG) fflush(stdout); 
     2623    return rc; 
     2624} 
     2625 
     2626/* pvfs_getdents64 */ 
    24802627JNIEXPORT jint JNICALL 
    24812628Java_PVFS2JNI_pvfsGetdents64  (JNIEnv *env, jobject obj, jlong jarg, int fd, int size) 
    24822629{ 
    2483     printf("pvfsGetdents64\n"); 
     2630    if(JNI_DBG) printf("pvfsGetdents64\n"); 
     2631    int rc = 0; 
    24842632    struct dirent64 *arg; 
    24852633    arg = (struct dirent64 *)jarg; 
    24862634    unsigned int cfd = (unsigned int) fd; 
    24872635    unsigned int csize = (unsigned int) size; 
    2488     int rc = pvfs_getdents64(cfd, arg, csize); 
     2636    rc = pvfs_getdents64(cfd, arg, csize); 
    24892637    if(rc < 0) 
    24902638    { 
    24912639        perror("pvfs_getdents64 error"); 
    2492         fflush(stdout); 
    2493         return -1; 
    2494     } 
    2495     return rc; 
    2496 } 
    2497  
    2498 //pvfs_futimesat 
     2640        rc = -1; 
     2641    } 
     2642    fflush(stderr); 
     2643    if(JNI_DBG) fflush(stdout); 
     2644    return rc; 
     2645} 
     2646 
     2647/* pvfs_futimesat */ 
    24992648JNIEXPORT jint JNICALL 
    25002649Java_PVFS2JNI_Futimesat  (JNIEnv *env, jobject obj, jlong jarg1, jlong jarg2, int dirfd, jstring path) 
    25012650{ 
     2651    if(JNI_DBG) printf("pvfsFutimesat\n"); 
     2652    int rc = 0; 
    25022653    struct timeval *arg1; 
    25032654    struct timeval *arg2; 
     
    25122663    int cpath_len = (*env)->GetStringLength(env, path); 
    25132664    (*env)->GetStringUTFRegion(env, path, 0, cpath_len, cpath); 
    2514     int rc = pvfs_futimesat(dirfd, cpath, abc); 
     2665    rc = pvfs_futimesat(dirfd, cpath, abc); 
    25152666    if(rc < 0) 
    25162667    { 
    25172668        perror("pvfs_futimesat error"); 
    2518         fflush(stdout); 
    2519         return -1; 
    2520     } 
    2521     return rc; 
    2522 } 
    2523  
    2524 //pvfs_utimes 
     2669        rc = -1; 
     2670    } 
     2671    fflush(stderr); 
     2672    if(JNI_DBG) fflush(stdout); 
     2673    return rc; 
     2674} 
     2675 
     2676/* pvfs_utimes */ 
    25252677JNIEXPORT jint JNICALL 
    25262678Java_PVFS2JNI_Utimes  (JNIEnv *env, jobject obj, jlong jarg1, jlong jarg2, jstring path) 
    25272679{ 
     2680    if(JNI_DBG) printf("pvfs_Utimes\n"); 
     2681    int rc = 0; 
    25282682    struct timeval *arg1; 
    25292683    struct timeval *arg2; 
     
    25382692    int cpath_len = (*env)->GetStringLength(env, path); 
    25392693    (*env)->GetStringUTFRegion(env, path, 0, cpath_len, cpath); 
    2540     int rc = pvfs_utimes(cpath, abc); 
     2694    rc = pvfs_utimes(cpath, abc); 
    25412695    if(rc < 0) 
    25422696    { 
    25432697        perror("pvfs_utimes error"); 
    2544         fflush(stdout); 
    2545         return -1; 
    2546     } 
    2547     return rc; 
    2548 } 
    2549  
    2550 //pvfs_futimes 
     2698        rc = -1; 
     2699    } 
     2700    fflush(stderr); 
     2701    if(JNI_DBG) fflush(stdout); 
     2702    return rc; 
     2703} 
     2704 
     2705/* pvfs_futimes */ 
    25512706JNIEXPORT jint JNICALL 
    25522707Java_PVFS2JNI_Futimes  (JNIEnv *env, jobject obj, jlong jarg1, jlong jarg2, int fd) 
    25532708{ 
     2709    if(JNI_DBG) printf("pvfs_futimes\n"); 
     2710    int rc = 0; 
    25542711    struct timeval *arg1; 
    25552712    struct timeval *arg2; 
     
    25612718    abc[1].tv_sec = arg2->tv_sec; 
    25622719    abc[1].tv_usec = arg2->tv_usec; 
    2563     int rc = pvfs_futimes(fd, abc); 
     2720    rc = pvfs_futimes(fd, abc); 
    25642721    if(rc < 0) 
    25652722    { 
    25662723        perror("pvfs_futimes error"); 
    2567         fflush(stdout); 
    2568         return -1; 
    2569     } 
    2570     return rc; 
    2571 } 
    2572  
    2573  
    2574 //pvfs_utime 
     2724        rc = -1; 
     2725    } 
     2726    fflush(stderr); 
     2727    if(JNI_DBG) fflush(stdout); 
     2728    return rc; 
     2729} 
     2730 
     2731/* pvfs_utime */ 
    25752732JNIEXPORT jint JNICALL 
    25762733Java_PVFS2JNI_pvfsUtime  (JNIEnv *env, jobject obj, jlong jarg, jstring path) 
    25772734{ 
    2578     printf("pvfsUtime\n"); 
     2735    if(JNI_DBG) printf("pvfsUtime\n"); 
     2736    int rc = 0; 
    25792737    struct utimbuf *arg; 
    25802738    arg = (struct utimbuf *)jarg; 
     
    25822740    int cpath_len = (*env)->GetStringLength(env, path); 
    25832741    (*env)->GetStringUTFRegion(env, path, 0, cpath_len, cpath); 
    2584     int rc = pvfs_utime(cpath, arg); 
     2742    rc = pvfs_utime(cpath, arg); 
    25852743    if(rc < 0) 
    25862744    { 
    25872745        perror("pvfs_utime error"); 
    2588         fflush(stdout); 
    2589         return -1; 
    2590     } 
    2591     return rc; 
    2592 } 
    2593  
    2594 //pvfs_listxattr 
     2746        rc = -1; 
     2747    } 
     2748    fflush(stderr); 
     2749    if(JNI_DBG) fflush(stdout); 
     2750    return rc; 
     2751} 
     2752 
     2753/* pvfs_listxattr */ 
    25952754JNIEXPORT jlong JNICALL 
    25962755Java_PVFS2JNI_pvfsListxattr (JNIEnv *env, jobject obj, jstring path, jstring list, jlong size) 
    25972756{ 
    2598     printf("pvfsListxattr\n"); 
     2757    if(JNI_DBG) printf("pvfsListxattr\n"); 
     2758    long rc = 0; 
    25992759    char cpath[PVFS_PATH_MAX]; 
    26002760    int cpath_len = (*env)->GetStringLength(env, path); 
     
    26042764    (*env)->GetStringUTFRegion(env, list, 0, clist_len, clist); 
    26052765    size_t csize = (size_t) size; 
    2606     long rc = pvfs_listxattr(cpath, clist, csize); 
     2766    rc = pvfs_listxattr(cpath, clist, csize); 
    26072767    if(rc < 0) 
    26082768    { 
    26092769        perror("pvfs_listxattr error"); 
    2610         fflush(stdout); 
    2611         return rc; 
    2612     } 
    2613     return rc; 
    2614 } 
    2615  
    2616 //pvfs_llistxattr 
     2770        rc = -1; 
     2771    } 
     2772    fflush(stderr); 
     2773    if(JNI_DBG) fflush(stdout); 
     2774    return rc; 
     2775} 
     2776 
     2777/* pvfs_llistxattr */ 
    26172778JNIEXPORT jlong JNICALL 
    26182779Java_PVFS2JNI_pvfsLlistxattr (JNIEnv *env, jobject obj, jstring path, jstring list, jlong size) 
    26192780{ 
    2620     printf("pvfsLlistxattr\n"); 
     2781    if(JNI_DBG) printf("pvfsLlistxattr\n"); 
     2782    long rc = 0; 
    26212783    char cpath[PVFS_PATH_MAX]; 
    26222784    int cpath_len = (*env)->GetStringLength(env, path); 
     
    26262788    (*env)->GetStringUTFRegion(env, list, 0, clist_len, clist); 
    26272789    size_t csize = (size_t) size; 
    2628     long rc = pvfs_llistxattr(cpath, clist, csize); 
     2790    rc = pvfs_llistxattr(cpath, clist, csize); 
    26292791    if(rc < 0) 
    26302792    { 
    26312793        perror("pvfs_llistxattr error"); 
    2632         fflush(stdout); 
    2633         return rc; 
    2634     } 
    2635     return rc; 
    2636 } 
    2637  
    2638 //pvfs_flistxattr 
     2794        rc = -1; 
     2795    } 
     2796    fflush(stderr); 
     2797    if(JNI_DBG) fflush(stdout); 
     2798    return rc; 
     2799} 
     2800 
     2801/* pvfs_flistxattr */ 
    26392802JNIEXPORT jlong JNICALL 
    26402803Java_PVFS2JNI_pvfsFlistxattr (JNIEnv *env, jobject obj, int fd, jstring list, jlong size) 
    26412804{ 
    2642     printf("pvfsFlistxattr\n"); 
     2805    if(JNI_DBG) printf("pvfsFlistxattr\n"); 
     2806    long rc = 0; 
    26432807    char clist[PVFS_MAX_XATTR_LISTLEN]; 
    26442808    int clist_len = (*env)->GetStringLength(env, list); 
    26452809    (*env)->GetStringUTFRegion(env, list, 0, clist_len, clist); 
    26462810    size_t csize = (size_t) size; 
    2647     long rc = pvfs_flistxattr(fd, clist, csize); 
     2811    rc = pvfs_flistxattr(fd, clist, csize); 
    26482812    if(rc < 0) 
    26492813    { 
    26502814        perror("pvfs_flistxattr error"); 
    2651         fflush(stdout); 
    2652         return rc; 
    2653     } 
    2654     return rc; 
    2655 } 
    2656  
    2657 //pvfs_removexattr 
     2815        rc = -1; 
     2816    } 
     2817    fflush(stderr); 
     2818    if(JNI_DBG) fflush(stdout); 
     2819    return rc; 
     2820} 
     2821 
     2822/* pvfs_removexattr */ 
    26582823JNIEXPORT jint JNICALL 
    26592824Java_PVFS2JNI_pvfsRemovexattr(JNIEnv *env, jobject obj, jstring path, jstring name) 
    26602825{ 
    2661     printf("pvfsRemovexattr\n"); 
     2826    if(JNI_DBG) printf("pvfsRemovexattr\n"); 
     2827    int rc = 0; 
    26622828    char cpath[PVFS_PATH_MAX]; 
    26632829    int cpath_len = (*env)->GetStringLength(env, path); 
     
    26662832    int cname_len = (*env)->GetStringLength(env, name); 
    26672833    (*env)->GetStringUTFRegion(env, name, 0, cname_len, cname); 
    2668     int rc = pvfs_removexattr(cpath, cname); 
     2834    rc = pvfs_removexattr(cpath, cname); 
    26692835    if(rc < 0) 
    26702836    { 
    26712837        perror("pvfs_removexattr error"); 
    2672         fflush(stdout); 
    2673         return rc; 
    2674     } 
    2675     return rc; 
    2676 } 
    2677  
    2678 //pvfs_lremovexattr 
     2838        rc = -1; 
     2839    } 
     2840    fflush(stderr); 
     2841    if(JNI_DBG) fflush(stderr); 
     2842    return rc; 
     2843} 
     2844 
     2845/* pvfs_lremovexattr */ 
    26792846JNIEXPORT jint JNICALL 
    26802847Java_PVFS2JNI_pvfsLremovexattr(JNIEnv *env, jobject obj, jstring path, jstring name) 
    26812848{ 
    2682     printf("pvfsLremovexattr\n"); 
     2849    if(JNI_DBG) printf("pvfsLremovexattr\n"); 
     2850    int rc = 0; 
    26832851    char cpath[PVFS_PATH_MAX]; 
    26842852    int cpath_len = (*env)->GetStringLength(env, path); 
     
    26872855    int cname_len = (*env)->GetStringLength(env, name); 
    26882856    (*env)->GetStringUTFRegion(env, name, 0, cname_len, cname); 
    2689     int rc = pvfs_lremovexattr(cpath, cname); 
     2857    rc = pvfs_lremovexattr(cpath, cname); 
    26902858    if(rc < 0) 
    26912859    { 
    26922860        perror("pvfs_Lremovexattr error"); 
    2693         fflush(stdout); 
    2694         return rc; 
    2695     } 
    2696     return rc; 
    2697 } 
    2698  
    2699 //pvfs_fremovexattr 
     2861        rc = -1; 
     2862    } 
     2863    fflush(stderr); 
     2864    if(JNI_DBG) fflush(stdout); 
     2865    return rc; 
     2866} 
     2867 
     2868/* pvfs_fremovexattr */ 
    27002869JNIEXPORT jint JNICALL 
    27012870Java_PVFS2JNI_pvfsFremovexattr(JNIEnv *env, jobject obj, int fd, jstring name) 
    27022871{ 
    2703     printf("pvfsFremovexattr\n"); 
     2872    if(JNI_DBG) printf("pvfsFremovexattr\n"); 
     2873    int rc = 0; 
    27042874    char cname[PVFS_NAME_MAX]; 
    27052875    int cname_len = (*env)->GetStringLength(env, name); 
    27062876    (*env)->GetStringUTFRegion(env, name, 0, cname_len, cname); 
    2707     int rc = pvfs_fremovexattr(fd, cname); 
     2877    rc = pvfs_fremovexattr(fd, cname); 
    27082878    if(rc < 0) 
    27092879    { 
    27102880        perror("pvfs_fremovexattr error"); 
    2711         fflush(stdout); 
    2712         return rc; 
    2713     } 
    2714     return rc; 
    2715 } 
    2716  
    2717 //pvfs_getumask 
     2881        rc = -1; 
     2882    } 
     2883    fflush(stderr); 
     2884    if(JNI_DBG) fflush(stdout); 
     2885    return rc; 
     2886} 
     2887 
     2888/* pvfs_getumask */ 
    27182889JNIEXPORT jlong JNICALL 
    27192890Java_PVFS2JNI_pvfsGetumask(JNIEnv *env, jobject obj) 
    27202891{ 
    2721     printf("pvfsGetumask\n"); 
     2892    if(JNI_DBG) 
     2893    { 
     2894         printf("pvfsGetumask\n"); 
     2895         fflush(stdout); 
     2896    } 
    27222897    mode_t rc = pvfs_getumask(); 
    27232898    long ret = (long) rc; 
     
    27252900} 
    27262901 
    2727 //pvfs_getdtablesize 
     2902/* pvfs_getdtablesize */ 
    27282903JNIEXPORT jint JNICALL 
    27292904Java_PVFS2JNI_pvfsGetdtablesize(JNIEnv *env, jobject obj) 
    27302905{ 
    2731     printf("pvfsGetdtablesize\n"); 
     2906    if(JNI_DBG) 
     2907    { 
     2908        printf("pvfsGetdtablesize\n"); 
     2909        fflush(stdout); 
     2910    } 
    27322911    int rc = pvfs_getdtablesize(); 
    27332912    return rc; 
    27342913} 
    27352914 
    2736 //pvfs_sync 
     2915/* pvfs_sync */ 
    27372916JNIEXPORT void JNICALL 
    27382917Java_PVFS2JNI_pvfsSync(JNIEnv *env, jobject obj) 
    27392918{ 
    2740     printf("pvfsSync\n"); 
     2919    if(JNI_DBG) 
     2920    { 
     2921        printf("pvfsSync\n"); 
     2922        fflush(stdout); 
     2923    } 
    27412924    pvfs_sync(); 
    27422925    return; 
    27432926} 
    27442927 
    2745 //FILL STATFS64 
     2928/* FILL STATFS64 */ 
    27462929JNIEXPORT jlong JNICALL 
    27472930Java_PVFS2JNI_FillStatfs64  (JNIEnv *env, jobject obj, jobject x, jlong jarg) 
    27482931{ 
    2749     printf("FillStatfs64\n"); 
    2750     fflush(stdout); 
     2932    if(JNI_DBG) printf("FillStatfs64\n"); 
     2933    long lp = 0; 
     2934    struct statfs64 *cstatfs64 = 0; 
    27512935    jfieldID fid1; 
    27522936    jfieldID fid2; 
     
    27762960    if (fid1 == NULL) 
    27772961    { 
    2778         return; 
     2962        lp = -1; 
     2963        goto done; 
    27792964    } 
    27802965    fid2 = (*env)->GetFieldID(env, cls1, "f_bsize", "J"); 
    27812966    if (fid2 == NULL) 
    27822967    { 
    2783         return; 
     2968        lp = -1; 
     2969        goto done; 
    27842970    } 
    27852971    fid3 = (*env)->GetFieldID(env, cls1, "f_blocks", "J"); 
    27862972    if (fid3 == NULL) 
    27872973    { 
    2788         return; 
     2974        lp = -1; 
     2975        goto done; 
    27892976    } 
    27902977    fid4 = (*env)->GetFieldID(env, cls1, "f_bfree", "J"); 
    27912978    if (fid4 == NULL) 
    27922979    { 
    2793         return; 
     2980        lp = -1; 
     2981        goto done; 
    27942982    } 
    27952983    fid5 = (*env)->GetFieldID(env, cls1, "f_bavail", "J"); 
    27962984    if (fid5 == NULL) 
    27972985    { 
    2798         return; 
     2986        lp = -1; 
     2987        goto done; 
    27992988    } 
    28002989    fid6 = (*env)->GetFieldID(env, cls1, "f_files", "J"); 
    28012990    if (fid6 == NULL) 
    28022991    { 
    2803         return; 
     2992        lp = -1; 
     2993        goto done; 
    28042994    } 
    28052995    fid7 = (*env)->GetFieldID(env, cls1, "f_ffree", "J"); 
    28062996    if (fid7 == NULL) 
    28072997    { 
    2808         return; 
     2998        lp = -1; 
     2999        goto done; 
    28093000    } 
    28103001    fid9 = (*env)->GetFieldID(env, cls1, "f_namelen", "J"); 
    28113002    if (fid9 == NULL) 
    28123003    { 
    2813         return; 
     3004        lp = -1; 
     3005        goto done; 
    28143006    } 
    28153007    fid10 = (*env)->GetFieldID(env, cls1, "f_frsize", "J"); 
    28163008    if (fid10 == NULL) 
    28173009    { 
    2818         return; 
     3010        lp = -1; 
     3011        goto done; 
    28193012    } 
    28203013    fid11 = (*env)->GetFieldID(env, cls1, "f_spare", "[J"); 
    28213014    if (fid11 == NULL) 
    28223015    { 
    2823         return; 
     3016        lp = -1; 
     3017        goto done; 
    28243018    } 
    28253019    fid12 = (*env)->GetFieldID(env, cls1, "f_flags", "J"); 
    28263020    if (fid12 == NULL) 
    28273021    { 
    2828         return; 
    2829     } 
    2830     /* __SWORD_TYPE* tmp; 
     3022        lp = -1; 
     3023        goto done; 
     3024    } 
     3025    /* 
     3026     __SWORD_TYPE* tmp; 
    28313027    tmp = (__SWORD_TYPE *) malloc( 5 * sizeof(__SWORD_TYPE) ); 
    28323028    tmp[0]=10; 
    28333029    tmp[1]=20; 
    2834     printf("tmp=%ld\n",tmp[0]);*/ 
    2835     struct statfs64 *cstatfs64 = (struct statfs64 *) malloc( 
    2836         sizeof(struct statfs64) + 1); 
    2837     //long int *(cstatfs->f_spare[0]) = tmp[0]; 
    2838     /*long int i= 10; 
     3030    printf("tmp=%ld\n",tmp[0]); 
     3031    */ 
     3032    cstatfs64 = (struct statfs64 *) malloc(sizeof(struct statfs64) + 1); 
     3033    if(!cstatfs64) 
     3034    { 
     3035        perror("malloc failed"); 
     3036        lp = -1; 
     3037        goto done; 
     3038    } 
     3039    /* 
     3040    long int *(cstatfs->f_spare[0]) = tmp[0]; 
     3041    long int i= 10; 
    28393042    cstatfs->f_spare[4]=10; 
    28403043    printf("f_spare[4]=%d\n",cstatfs->f_spare[4]); 
     
    28703073    __SWORD_TYPE cf_flags = (__SWORD_TYPE) f_flags; 
    28713074    cstatfs64->f_flags = cf_flags; 
    2872     //buf=(*env)->GetLongArrayElements(env,x,fid11); 
    2873     //printf("ARRAY:%ld",buf[0]; 
     3075    /* 
     3076    buf=(*env)->GetLongArrayElements(env,x,fid11); 
     3077    printf("ARRAY:%ld",buf[0]; 
     3078    */ 
    28743079    jlong buf[5]; 
    28753080    jlongArray ar; 
     
    28833088        cbuf[ival] = buf[ival]; 
    28843089    } 
    2885     //printf("cbuf=%ld",cbuf[4]); 
     3090    /*i printf("cbuf=%ld",cbuf[4]); */ 
    28863091    for(jval = 0; jval <= 4; jval++) 
    28873092    { 
    28883093        cstatfs64->f_spare[jval] = cbuf[jval]; 
    28893094    } 
    2890     //cstatfs->f_spare[4] = 10; 
     3095    /* cstatfs->f_spare[4] = 10; */ 
    28913096    fsid_t *arg; 
    28923097    arg = (fsid_t *)jarg; 
    28933098    cstatfs64->f_fsid.__val[0] = arg->__val[0]; 
    28943099    cstatfs64->f_fsid.__val[1] = arg->__val[1]; 
    2895     //printf("cstatfs.fsid1=%d\n",cstatfs->f_fsid.__val[0]); 
    2896     //printf("cstatfs.fsid2=%d\n",cstatfs->f_fsid.__val[1]); 
    2897     fflush(stdout); 
    2898     long lp = (long)cstatfs64; 
     3100    /* 
     3101    printf("cstatfs.fsid1=%d\n",cstatfs->f_fsid.__val[0]); 
     3102    printf("cstatfs.fsid2=%d\n",cstatfs->f_fsid.__val[1]); 
     3103    */ 
     3104    lp = (long)cstatfs64; 
     3105done: 
     3106    if(cstatfs64) 
     3107    { 
     3108        free(cstatfs64); 
     3109    } 
     3110    fflush(stderr); 
     3111    if(JNI_DBG) fflush(stdout); 
    28993112    return lp; 
    29003113} 
    29013114 
    2902 //DISPSTATFS64 
     3115/* DISPSTATFS64 */ 
    29033116void dispstatfs64(struct statfs64 *abc) 
    29043117{ 
    2905     printf("=======DISPLAY========\n"); 
    2906     printf("The f_type is: %ld\n", (long int) abc->f_type); 
    2907     printf("The f_bsize is: %ld\n", (long int) abc->f_bsize); 
    2908     printf("The f_blocks is: %lu\n", abc->f_blocks); 
    2909     printf("The f_bfree is: %lu\n", abc->f_bfree); 
    2910     printf("The f_bavail is: %lu\n", abc->f_bavail); 
    2911     printf("The f_files is: %lu\n", abc->f_files); 
    2912     printf("The f_ffree is: %lu\n", abc->f_ffree); 
    2913     //printf("The f_fsid is: %lu\n", abc->f_fsid); 
    2914     printf("The f_namelen is: %lu\n", abc->f_namelen); 
    2915     printf("The f_frsize is: %lu\n", abc->f_frsize); 
    2916     printf("The f_flags is: %ld \n", abc->f_flags); 
    2917     int i; 
    2918     for(i = 0; i <= 4; i++) 
    2919     { 
    2920         printf("F_SPARE %d = %ld\n", i, abc->f_spare[i]); 
    2921     } 
    2922     for(i = 0; i <= 1; i++) 
    2923     { 
    2924         printf("F_FSID %d = %d\n", i, abc->f_fsid.__val[i]); 
    2925     } 
    2926     printf("=======DISPLAY========\n"); 
    2927     fflush(stdout); 
    2928     free(abc); 
    2929 } 
    2930  
    2931 //UseStatfs64 
     3118    if(JNI_DBG) 
     3119    { 
     3120        printf("=======DISPLAY========\n"); 
     3121        printf("The f_type is: %ld\n", (long int) abc->f_type); 
     3122        printf("The f_bsize is: %ld\n", (long int) abc->f_bsize); 
     3123        printf("The f_blocks is: %lu\n", abc->f_blocks); 
     3124        printf("The f_bfree is: %lu\n", abc->f_bfree); 
     3125        printf("The f_bavail is: %lu\n", abc->f_bavail); 
     3126        printf("The f_files is: %lu\n", abc->f_files); 
     3127        printf("The f_ffree is: %lu\n", abc->f_ffree); 
     3128        /* printf("The f_fsid is: %lu\n", abc->f_fsid); */ 
     3129        printf("The f_namelen is: %lu\n", abc->f_namelen); 
     3130        printf("The f_frsize is: %lu\n", abc->f_frsize); 
     3131        printf("The f_flags is: %ld \n", abc->f_flags); 
     3132        int i; 
     3133        for(i = 0; i <= 4; i++) 
     3134        { 
     3135            printf("F_SPARE %d = %ld\n", i, abc->f_spare[i]); 
     3136        } 
     3137        for(i = 0; i <= 1; i++) 
     3138        { 
     3139            printf("F_FSID %d = %d\n", i, abc->f_fsid.__val[i]); 
     3140        } 
     3141        printf("=======DISPLAY========\n"); 
     3142        fflush(stdout); 
     3143    } 
     3144} 
     3145 
     3146/* UseStatfs64 */ 
    29323147JNIEXPORT jlong JNICALL 
    29333148Java_PVFS2JNI_UseStatfs64  (JNIEnv *env, jobject obj, jlong jarg) 
    29343149{ 
    2935     struct statfs64 xyz; 
    29363150    struct statfs64 *arg; 
    29373151    arg = (struct statfs64 *)jarg; 
     
    29393153} 
    29403154 
    2941 //FILL STATVFS 
     3155/* FILL STATVFS */ 
    29423156JNIEXPORT jlong JNICALL 
    29433157Java_PVFS2JNI_FillStatvfs  (JNIEnv *env, jobject obj, jobject x) 
    29443158{ 
    2945     printf("FillStatvfs\n"); 
    2946     fflush(stdout); 
     3159    if(JNI_DBG) printf("FillStatvfs\n"); 
     3160    long lp = 0; 
     3161    struct statvfs *cstatvfs = 0; 
    29473162    jfieldID fid2; 
    29483163    jfieldID fid3; 
     
    29713186    if (fid2 == NULL) 
    29723187    { 
    2973         return; 
     3188        lp = -1; 
     3189        goto done; 
    29743190    } 
    29753191    fid3 = (*env)->GetFieldID(env, cls1, "f_blocks", "J"); 
    29763192    if (fid3 == NULL) 
    29773193    { 
    2978         return; 
     3194        lp = -1; 
     3195        goto done; 
    29793196    } 
    29803197    fid4 = (*env)->GetFieldID(env, cls1, "f_bfree", "J"); 
    29813198    if (fid4 == NULL) 
    29823199    { 
    2983         return; 
     3200        lp = -1; 
     3201        goto done; 
    29843202    } 
    29853203    fid5 = (*env)->GetFieldID(env, cls1, "f_bavail", "J"); 
    29863204    if (fid5 == NULL) 
    29873205    { 
    2988         return; 
     3206        lp = -1; 
     3207        goto done; 
    29893208    } 
    29903209    fid6 = (*env)->GetFieldID(env, cls1, "f_files", "J"); 
    29913210    if (fid6 == NULL) 
    29923211    { 
    2993         return; 
     3212        lp = -1; 
     3213        goto done; 
    29943214    } 
    29953215    fid7 = (*env)->GetFieldID(env, cls1, "f_ffree", "J"); 
    29963216    if (fid7 == NULL) 
    29973217    { 
    2998         return; 
     3218        lp = -1; 
     3219        goto done; 
    29993220    } 
    30003221    fid9 = (*env)->GetFieldID(env, cls1, "f_namemax", "J"); 
    30013222    if (fid9 == NULL) 
    30023223    { 
    3003         return; 
     3224        lp = -1; 
     3225        goto done; 
    30043226    } 
    30053227    fid10 = (*env)->GetFieldID(env, cls1, "f_frsize", "J"); 
    30063228    if (fid10 == NULL) 
    30073229    { 
    3008         return; 
     3230        lp = -1; 
     3231        goto done; 
    30093232    } 
    30103233    fid12 = (*env)->GetFieldID(env, cls1, "f_flag", "J"); 
    30113234    if (fid12 == NULL) 
    30123235    { 
    3013         return; 
     3236        lp = -1; 
     3237        goto done; 
    30143238    } 
    30153239    fid13 = (*env)->GetFieldID(env, cls1, "f_favail", "J"); 
    30163240    if (fid13 == NULL) 
    30173241    { 
    3018         return; 
     3242        lp = -1; 
     3243        goto done; 
    30193244    } 
    30203245    fid14 = (*env)->GetFieldID(env, cls1, "f_fsid", "J"); 
    30213246    if (fid14 == NULL) 
    30223247    { 
    3023         return; 
    3024     } 
    3025     /* __SWORD_TYPE* tmp; 
     3248        lp = -1; 
     3249        goto done; 
     3250    } 
     3251    /* 
     3252    __SWORD_TYPE* tmp; 
    30263253    tmp = (__SWORD_TYPE *) malloc( 5 * sizeof(__SWORD_TYPE) ); 
    30273254    tmp[0]=10; 
    30283255    tmp[1]=20; 
    3029     printf("tmp=%ld\n",tmp[0]);*/ 
    3030     struct statvfs *cstatvfs = (struct statvfs *)malloc(sizeof(struct statvfs)); 
    3031     //long int *(cstatfs->f_spare[0]) = tmp[0]; 
    3032     /*long int i= 10; 
     3256    printf("tmp=%ld\n",tmp[0]); 
     3257    */ 
     3258    cstatvfs = (struct statvfs *)malloc(sizeof(struct statvfs)); 
     3259    if(!cstatvfs) 
     3260    { 
     3261        perror("malloc failed"); 
     3262        lp = -1; 
     3263        goto done; 
     3264    } 
     3265    /* 
     3266    long int i= 10; 
     3267    long int *(cstatfs->f_spare[0]) = tmp[0]; 
    30333268    cstatfs->f_spare[4]=10; 
    30343269    printf("f_spare[4]=%d\n",cstatfs->f_spare[4]); 
     
    30673302    unsigned long cf_fsid = (unsigned long) f_fsid; 
    30683303    cstatvfs->f_fsid = cf_fsid; 
    3069     fflush(stdout); 
    3070     long lp = (long)cstatvfs; 
     3304    lp = (long)cstatvfs; 
     3305done: 
     3306    if(cstatvfs) 
     3307    { 
     3308        free(cstatvfs); 
     3309    } 
     3310    fflush(stderr); 
     3311    if(JNI_DBG) fflush(stdout); 
    30713312    return lp; 
    30723313} 
     
    30743315void dispstatvfs(struct statvfs *abc) 
    30753316{ 
    3076     printf("=======DISPLAY========\n"); 
    3077     printf("The f_bsize is: %lu\n", abc->f_bsize); 
    3078     printf("The f_blocks is: %lu\n", abc->f_blocks); 
    3079     printf("The f_bfree is: %lu\n", abc->f_bfree); 
    3080     printf("The f_bavail is: %lu\n", abc->f_bavail); 
    3081     printf("The f_files is: %lu\n", abc->f_files); 
    3082     printf("The f_ffree is: %lu\n", abc->f_ffree); 
    3083     printf("The f_fsid is: %lu\n", abc->f_fsid); 
    3084     printf("The f_namemax is: %lu\n", abc->f_namemax); 
    3085     printf("The f_frsize is: %lu\n", abc->f_frsize); 
    3086     printf("The f_flag is: %lu\n", abc->f_flag); 
    3087     printf("The f_favail is: %lu\n", abc->f_favail); 
    3088     printf("=======DISPLAY========\n"); 
    3089     fflush(stdout); 
    3090     free(abc); 
     3317    if(JNI_DBG) 
     3318    { 
     3319        printf("=======DISPLAY========\n"); 
     3320        printf("The f_bsize is: %lu\n", abc->f_bsize); 
     3321        printf("The f_blocks is: %lu\n", abc->f_blocks); 
     3322        printf("The f_bfree is: %lu\n", abc->f_bfree); 
     3323        printf("The f_bavail is: %lu\n", abc->f_bavail); 
     3324        printf("The f_files is: %lu\n", abc->f_files); 
     3325        printf("The f_ffree is: %lu\n", abc->f_ffree); 
     3326        printf("The f_fsid is: %lu\n", abc->f_fsid); 
     3327        printf("The f_namemax is: %lu\n", abc->f_namemax); 
     3328        printf("The f_frsize is: %lu\n", abc->f_frsize); 
     3329        printf("The f_flag is: %lu\n", abc->f_flag); 
     3330        printf("The f_favail is: %lu\n", abc->f_favail); 
     3331        printf("=======DISPLAY========\n"); 
     3332        fflush(stdout); 
     3333    } 
    30913334} 
    30923335 
     
    30993342} 
    31003343 
    3101 //pvfs_statfs 
     3344/* pvfs_statfs */ 
    31023345JNIEXPORT jint JNICALL 
    31033346Java_PVFS2JNI_pvfsStatfs  (JNIEnv *env, jobject obj, jlong jarg, jstring path) 
    31043347{ 
    3105     printf("pvfsStatfs\n"); 
     3348    if(JNI_DBG) printf("pvfsStatfs\n"); 
     3349    int rc = 0; 
    31063350    struct statfs *arg; 
    31073351    arg = (struct statfs *)jarg; 
     
    31093353    int cpath_len = (*env)->GetStringLength(env, path); 
    31103354    (*env)->GetStringUTFRegion(env, path, 0, cpath_len, cpath); 
    3111     int rc = pvfs_statfs(cpath, arg); 
     3355    rc = pvfs_statfs(cpath, arg); 
    31123356    if(rc < 0) 
    31133357    { 
    31143358        perror("pvfs_statfs error"); 
    3115         fflush(stdout); 
    3116         return -1; 
    3117     } 
    3118     return rc; 
    3119 } 
    3120  
    3121 //pvfs_fstatfs 
     3359        rc = -1; 
     3360    } 
     3361    fflush(stderr); 
     3362    if(JNI_DBG) fflush(stdout); 
     3363    return rc; 
     3364} 
     3365 
     3366/* pvfs_fstatfs */ 
    31223367JNIEXPORT jint JNICALL 
    31233368Java_PVFS2JNI_pvfsFstatfs(JNIEnv *env, jobject obj, jlong jarg, int fd) 
    31243369{ 
    3125     printf("pvfsFstatfs\n"); 
     3370    if(JNI_DBG) printf("pvfsFstatfs\n"); 
     3371    int rc = 0; 
    31263372    struct statfs *arg; 
    31273373    arg = (struct statfs *)jarg; 
    3128     int rc = pvfs_fstatfs(fd, arg); 
     3374    rc = pvfs_fstatfs(fd, arg); 
    31293375    if(rc < 0) 
    31303376    { 
    31313377        perror("pvfs_fstatfs error"); 
    3132         fflush(stdout); 
    3133         return -1; 
    3134     } 
    3135     return rc; 
    3136 } 
    3137  
    3138 //pvfs_statfs64 
     3378        rc = -1; 
     3379    } 
     3380    fflush(stderr); 
     3381    if(JNI_DBG) fflush(stdout); 
     3382    return rc; 
     3383} 
     3384 
     3385/* pvfs_statfs64 */ 
    31393386JNIEXPORT jint JNICALL 
    31403387Java_PVFS2JNI_pvfsStatfs64  (JNIEnv *env, jobject obj, jlong jarg, jstring path) 
    31413388{ 
    3142     printf("pvfsStatfs64\n"); 
     3389    if(JNI_DBG) printf("pvfsStatfs64\n"); 
     3390    int rc = 0; 
    31433391    struct statfs64 *arg; 
    31443392    arg = (struct statfs64 *)jarg; 
     
    31463394    int cpath_len = (*env)->GetStringLength(env, path); 
    31473395    (*env)->GetStringUTFRegion(env, path, 0, cpath_len, cpath); 
    3148     int rc = pvfs_statfs64(cpath, arg); 
     3396    rc = pvfs_statfs64(cpath, arg); 
    31493397    if(rc < 0) 
    31503398    { 
    31513399        perror("pvfs_statfs64 error"); 
    3152         fflush(stdout); 
    3153         return -1; 
    3154     } 
    3155     return rc; 
    3156 } 
    3157  
    3158 //pvfs_fstatfs64 
     3400        rc = -1; 
     3401    } 
     3402    fflush(stderr); 
     3403    if(JNI_DBG) fflush(stdout); 
     3404    return rc; 
     3405} 
     3406 
     3407/* pvfs_fstatfs64 */ 
    31593408JNIEXPORT jint JNICALL 
    31603409Java_PVFS2JNI_pvfsFstatfs64(JNIEnv *env, jobject obj, jlong jarg, int fd) 
    31613410{ 
    3162     printf("pvfsFstatfs64\n"); 
     3411    if(JNI_DBG) printf("pvfsFstatfs64\n"); 
     3412    int rc = 0; 
    31633413    struct statfs64 *arg; 
    31643414    arg = (struct statfs64 *)jarg; 
    3165     int rc = pvfs_fstatfs64(fd, arg); 
     3415    rc = pvfs_fstatfs64(fd, arg); 
    31663416    if(rc < 0) 
    31673417    { 
    31683418        perror("pvfs_fstatfs64 error"); 
    3169         fflush(stdout); 
    3170         return -1; 
    3171     } 
    3172     return rc; 
    3173 } 
    3174  
    3175 //pvfs_statvfs 
     3419        rc = -1; 
     3420    } 
     3421    fflush(stderr); 
     3422    if(JNI_DBG) fflush(stdout); 
     3423    return rc; 
     3424} 
     3425 
     3426/* pvfs_statvfs */ 
    31763427JNIEXPORT jint JNICALL 
    31773428Java_PVFS2JNI_pvfsStatvfs  (JNIEnv *env, jobject obj, jlong jarg, jstring path) 
    31783429{ 
    3179     printf("pvfsStatvfs\n"); 
     3430    if(JNI_DBG) printf("pvfsStatvfs\n"); 
     3431    int rc = 0; 
    31803432    struct statvfs *arg; 
    31813433    arg = (struct statvfs *)jarg; 
     
    31833435    int cpath_len = (*env)->GetStringLength(env, path); 
    31843436    (*env)->GetStringUTFRegion(env, path, 0, cpath_len, cpath); 
    3185     int rc = pvfs_statvfs(cpath, arg); 
     3437    rc = pvfs_statvfs(cpath, arg); 
    31863438    if(rc < 0) 
    31873439    { 
    31883440        perror("pvfs_statvfs error"); 
    3189         fflush(stdout); 
    3190         return -1; 
    3191     } 
    3192     return rc; 
    3193 } 
    3194  
    3195 //pvfs_fstatvfs 
     3441        rc = -1; 
     3442    } 
     3443    fflush(stderr); 
     3444    if(JNI_DBG) fflush(stdout); 
     3445    return rc; 
     3446} 
     3447 
     3448/* pvfs_fstatvfs */ 
    31963449JNIEXPORT jint JNICALL 
    31973450Java_PVFS2JNI_pvfsFstatvfs(JNIEnv *env, jobject obj, jlong jarg, int fd) 
    31983451{ 
    3199     printf("pvfsFstatvfs\n"); 
     3452    if(JNI_DBG) printf("pvfsFstatvfs\n"); 
     3453    int rc = 0; 
    32003454    struct statvfs *arg; 
    32013455    arg = (struct statvfs *)jarg; 
    3202     int rc = pvfs_fstatvfs(fd, arg); 
     3456    rc = pvfs_fstatvfs(fd, arg); 
    32033457    if(rc < 0) 
    32043458    { 
    32053459        perror("pvfs_fstatvfs error"); 
    3206         fflush(stdout); 
    3207         return -1; 
    3208     } 
    3209     return rc; 
    3210 } 
     3460        rc = -1; 
     3461    } 
     3462    fflush(stderr); 
     3463    if(JNI_DBG) fflush(stdout); 
     3464    return rc; 
     3465}