summaryrefslogtreecommitdiffstats
path: root/java/src/jni/h5pFAPLImp.c
blob: aec65817ea65ac4b4384a54575f7b335f9b21c97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by The HDF Group.                                               *
 * Copyright by the Board of Trustees of the University of Illinois.         *
 * All rights reserved.                                                      *
 *                                                                           *
 * This file is part of HDF5.  The full HDF5 copyright notice, including     *
 * terms governing use, modification, and redistribution, is contained in    *
 * the COPYING file, which can be found at the root of the source code       *
 * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.  *
 * If you do not have access to either file, you may request a copy from     *
 * help@hdfgroup.org.                                                        *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*
 *  For details of the HDF libraries, see the HDF Documentation at:
 *    http://hdfgroup.org/HDF5/doc/
 *
 */

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include <stdlib.h>
#include "hdf5.h"
#include "h5jni.h"
#include "h5util.h"
#include "h5pFAPLImp.h"

/*
 * Pointer to the JNI's Virtual Machine; used for callback functions.
 */
/* extern JavaVM *jvm; */

/*
 * TODO: H5Pset_driver
 */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_driver
 * Signature: (J)J
 */
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1driver
    (JNIEnv *env, jclass clss, jlong plist)
{
    hid_t retVal = H5I_INVALID_HID;

    UNUSED(clss);

    if ((retVal = H5Pget_driver((hid_t) plist)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1driver */

/*
 * TODO: H5Pget_driver_info
 */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_fclose_degree
 * Signature: (JI)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree
    (JNIEnv *env, jclass clss, jlong plist, jint fc_degree)
{
    herr_t retVal = FAIL;

    UNUSED(clss);

    if ((retVal = H5Pset_fclose_degree((hid_t)plist, (H5F_close_degree_t)fc_degree)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_fclose_degree
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree
    (JNIEnv *env, jclass clss, jlong plist)
{
    H5F_close_degree_t degree = H5F_CLOSE_DEFAULT;

    UNUSED(clss);

    if (H5Pget_fclose_degree((hid_t)plist, &degree) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jint)degree;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_fapl_core
 * Signature: (JJZ)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core
    (JNIEnv *env, jclass clss, jlong fapl_id, jlong increment, jboolean backing_store)
{
    herr_t retVal = FAIL;

    UNUSED(clss);

    if ((retVal = H5Pset_fapl_core((hid_t)fapl_id, (size_t)increment, (hbool_t)backing_store)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_fapl_core
 * Signature: (J[J[Z)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core
    (JNIEnv *env, jclass clss, jlong fapl_id, jlongArray increment, jbooleanArray backing_store)
{
    jboolean  isCopy;
    jboolean *backArray = NULL;
    jlong    *incArray = NULL;
    herr_t    status = FAIL;

    UNUSED(clss);

    if (NULL == increment)
        H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_fapl_core: increment is NULL");
    if (NULL == backing_store)
        H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_fapl_core: backing_store is NULL");

    PIN_LONG_ARRAY(ENVONLY, increment, incArray, &isCopy, "H5Pget_fapl_core: incArray not pinned");
    PIN_BOOL_ARRAY(ENVONLY, backing_store, backArray, &isCopy, "H5Pget_fapl_core: backArray not pinned");

    {
        /* Direct cast (size_t *)variable fails on 32-bit environment */
        long long inc_temp = *incArray;
        size_t    inc_t = (size_t) inc_temp;

        if ((status = H5Pget_fapl_core((hid_t)fapl_id, &inc_t, (hbool_t *)backArray)) < 0)
            H5_LIBRARY_ERROR(ENVONLY);

        *incArray = (jlong)inc_t;
    }

done:
    if (backArray)
        UNPIN_BOOL_ARRAY(ENVONLY, backing_store, backArray, (status < 0) ? JNI_ABORT : 0);
    if (incArray)
        UNPIN_LONG_ARRAY(ENVONLY, increment, incArray, (status < 0) ? JNI_ABORT : 0);

    return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core */

/*
 * TODO: H5Pset_core_write_tracking
 */

/*
 * TODO: H5Pget_core_write_tracking
 */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_fapl_direct
 * Signature: (JJJJ)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct
    (JNIEnv *env, jclass clss, jlong fapl_id, jlong alignment,
        jlong block_size, jlong cbuf_size)
{
    herr_t retVal = FAIL;

    UNUSED(clss);

#ifdef H5_HAVE_DIRECT
    if ((retVal = H5Pset_fapl_direct((hid_t)fapl_id, (size_t)alignment, (size_t)block_size, (size_t)cbuf_size)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
#else
    UNUSED(env);
    UNUSED(fapl_id);
    UNUSED(alignment);
    UNUSED(block_size);
    UNUSED(cbuf_size);
#endif

    return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_fapl_direct
 * Signature: (J[J)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct
    (JNIEnv *env, jclass clss, jlong fapl_id, jlongArray info)
{
#ifdef H5_HAVE_DIRECT
    jboolean  isCopy;
    jlong    *theArray = NULL;
    size_t    alignment = 0;
    size_t    block_size = 0;
    size_t    cbuf_size = 0;
    jsize     arrLen;
#endif
    herr_t    retVal = FAIL;

    UNUSED(clss);

#ifdef H5_HAVE_DIRECT
    if (NULL == info)
        H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_fapl_direct: info input array is NULL");

    if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, info)) < 0) {
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
        H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_fapl_direct: info array length < 0");
    }
    if (arrLen < 3)
        H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_fapl_direct: info input array < 3");

    PIN_LONG_ARRAY(ENVONLY, info, theArray, &isCopy, "H5Pget_fapl_direct: info not pinned");

    if ((retVal = H5Pget_fapl_direct((hid_t)fapl_id, &alignment, &block_size, &cbuf_size)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

    theArray[0] = (jlong)alignment;
    theArray[1] = (jlong)block_size;
    theArray[2] = (jlong)cbuf_size;

done:
    if (theArray)
        UNPIN_LONG_ARRAY(ENVONLY, info, theArray, (retVal < 0) ? JNI_ABORT : 0);
#else
    UNUSED(env);
    UNUSED(fapl_id);
    UNUSED(info);
#endif

    return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_fapl_family
 * Signature: (JJJ)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family
    (JNIEnv *env, jclass clss, jlong plist, jlong memb_size, jlong memb_plist)
{
    long   ms = (long)memb_size;
    herr_t retVal = FAIL;

    UNUSED(clss);

    if ((retVal = H5Pset_fapl_family((hid_t)plist, (hsize_t)ms, (hid_t)memb_plist)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_fapl_family
 * Signature: (J[J[J)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family
    (JNIEnv *env, jclass clss, jlong tid, jlongArray memb_size, jlongArray memb_plist)
{
    jboolean  isCopy;
    hsize_t  *sa = NULL;
    size_t    i;
    jlong    *sizeArray = NULL;
    jlong    *plistArray = NULL;
    jsize     rank;
    herr_t    status = FAIL;

    UNUSED(clss);

    if (NULL == memb_size)
        H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_family: memb_size is NULL");
    if (NULL == memb_plist)
        H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_family: memb_plist is NULL");

    PIN_LONG_ARRAY(ENVONLY, memb_size, sizeArray, &isCopy, "H5Pget_family: sizeArray not pinned");

    if ((rank = ENVPTR->GetArrayLength(ENVONLY, memb_size)) < 0) {
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
        H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_family: memb_size array length < 0");
    }

    if (NULL == (sa = (hsize_t *) HDmalloc((size_t) rank * sizeof(hsize_t))))
        H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_family: memory allocation failed");

    PIN_LONG_ARRAY(ENVONLY, memb_plist, plistArray, &isCopy, "H5Pget_family: plistArray not pinned");

    if ((status = H5Pget_fapl_family((hid_t)tid, sa, (hid_t *)plistArray)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

    for (i = 0; i < (size_t) rank; i++)
        sizeArray[i] = (jlong)sa[i];

done:
    if (plistArray)
        UNPIN_LONG_ARRAY(ENVONLY, memb_plist, plistArray, (status < 0) ? JNI_ABORT : 0);
    if (sa)
        HDfree(sa);
    if (sizeArray)
        UNPIN_LONG_ARRAY(ENVONLY, memb_size, sizeArray, (status < 0) ? JNI_ABORT : 0);

    return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_family_offset
 * Signature: (JJ)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1family_1offset
    (JNIEnv *env, jclass clss, jlong fapl_id, jlong offset)
{
    herr_t retVal = FAIL;

    UNUSED(clss);

    if ((retVal = H5Pset_family_offset((hid_t)fapl_id, (hsize_t)offset)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1family_1offset */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_family_offset
 * Signature: (J)J
 */
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1family_1offset
    (JNIEnv *env, jclass clss, jlong fapl_id)
{
    hsize_t offset = 0;
    herr_t  retVal = FAIL;

    UNUSED(clss);

    if ((retVal = H5Pget_family_offset((hid_t)fapl_id, &offset)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jlong)offset;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1family_1offset */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_fapl_log
 * Signature: (JLjava/lang/String;JJ)V
 */
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log
    (JNIEnv *env, jclass clss, jlong fapl_id, jstring logfile, jlong flags, jlong buf_size)
{
    const char *pLogfile = NULL;
    herr_t      retVal = FAIL;

    UNUSED(clss);

    PIN_JAVA_STRING(ENVONLY, logfile, pLogfile, NULL, "H5Pset_fapl_log: log file name not pinned");

    if ((retVal = H5Pset_fapl_log((hid_t)fapl_id, pLogfile, (unsigned long long)flags, (size_t)buf_size)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    if (pLogfile)
        UNPIN_JAVA_STRING(ENVONLY, logfile, pLogfile);
} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log */

/*
 * TODO: H5Pset_fapl_mpio
 */

/*
 * TODO: H5Pget_fapl_mpio
 */

/*
 * TODO: H5Pset_fapl_mpiposix
 */

/*
 * TODO: H5Pget_fapl_mpiposix
 */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_fapl_multi
 * Signature: (J[I[J[Ljava/lang/String;[JZ)V
 */
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
    (JNIEnv *env, jclass clss, jlong tid, jintArray memb_map,
        jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr, jboolean relax)
{
    const char * const *mName = NULL;
    jboolean            isCopy;
    jboolean            bb;
    jobject             o;
    jstring             rstring;
    jclass              Sjc;
    size_t              i;
    jlong              *thefaplArray = NULL;
    jlong              *theaddrArray = NULL;
    jint               *themapArray = NULL;
    char               *member_name[H5FD_MEM_NTYPES];
    herr_t              status = FAIL;

    UNUSED(clss);

    HDmemset(member_name, 0, H5FD_MEM_NTYPES * sizeof(char *));

    if (memb_map)
        PIN_INT_ARRAY(ENVONLY, memb_map, themapArray, &isCopy, "H5Pset_fapl_multi: memb_map not pinned");
    if (memb_fapl)
        PIN_LONG_ARRAY(ENVONLY, memb_fapl, thefaplArray, &isCopy, "H5Pset_fapl_multi: memb_fapl not pinned");
    if (memb_addr)
        PIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, &isCopy, "H5Pset_fapl_multi: memb_addr not pinned");

    if (memb_name) {
        jstring obj;

        for (i = 0; i < H5FD_MEM_NTYPES; i++) {
            const char *utf8 = NULL;
            size_t      str_len;

            if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray) memb_name, (jsize) i))) {
                CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

                /*
                 * If the string object was NULL, skip it.
                 */
                member_name[i] = NULL;
                continue;
            }

            /*
             * length = ENVPTR->GetStringUTFLength(ENVONLY, obj);
             * CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
             */

            PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5Pset_fapl_multi: string not pinned");

            str_len = HDstrlen(utf8);

            if (NULL == (member_name[i] = (char *) HDmalloc(str_len + 1)))
                H5_JNI_FATAL_ERROR(ENVONLY, "H5Pset_fapl_multi: memory allocation failed");

            HDstrncpy(member_name[i], utf8, str_len + 1);

            UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
            utf8 = NULL;

            ENVPTR->DeleteLocalRef(ENVONLY, obj);
        }

        mName = (const char * const *)member_name;
    }

    if ((status = H5Pset_fapl_multi((hid_t)tid, (const H5FD_mem_t *)themapArray, (const hid_t *)thefaplArray,
            mName, (const haddr_t *)theaddrArray, (hbool_t)relax)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

    if (memb_name && mName) {
        if (NULL == (Sjc = ENVPTR->FindClass(ENVONLY, "java/lang/String")))
            CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

        for (i = 0; i < H5FD_MEM_NTYPES; i++) {
            if (NULL == (rstring = ENVPTR->NewStringUTF(ENVONLY, member_name[i]))) {
                CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
                H5_JNI_FATAL_ERROR(ENVONLY, "H5Pset_fapl_multi: out of memory - unable to construct string from UTF characters");
            }

            if (NULL == (o = ENVPTR->GetObjectArrayElement(ENVONLY, memb_name, (jsize) i))) {
                CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

                /*
                 * If the string object was NULL, skip it.
                 */
                ENVPTR->DeleteLocalRef(ENVONLY, rstring);
                continue;
            }

            if (JNI_TRUE == (bb = ENVPTR->IsInstanceOf(ENVONLY, o, Sjc))) {
                ENVPTR->SetObjectArrayElement(ENVONLY, memb_name, (jsize) i, (jobject)rstring);
                CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
            }

            ENVPTR->DeleteLocalRef(ENVONLY, o);
            ENVPTR->DeleteLocalRef(ENVONLY, rstring);

            HDfree(member_name[i]);
            member_name[i] = NULL;
        }
    }

done:
    h5str_array_free(member_name, H5FD_MEM_NTYPES);
    if (theaddrArray)
        UNPIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, (status < 0) ? JNI_ABORT : 0);
    if (thefaplArray)
        UNPIN_LONG_ARRAY(ENVONLY, memb_fapl, thefaplArray, (status < 0) ? JNI_ABORT : 0);
    if (themapArray)
        UNPIN_INT_ARRAY(ENVONLY, memb_map, themapArray, (status < 0) ? JNI_ABORT : 0);
} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_fapl_multi
 * Signature: (J[I[J[Ljava/lang/String;[J)Z
 */
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi
    (JNIEnv *env, jclass clss, jlong tid, jintArray memb_map,
        jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr)
{
    jboolean   isCopy;
    jstring    str;
    herr_t     status = FAIL;
    size_t     i;
    jlong     *thefaplArray = NULL;
    jlong     *theaddrArray = NULL;
    jint      *themapArray = NULL;
    char     **mName = NULL;
    int        relax = 0;
    int        retVal = 0;

    UNUSED(clss);

    if (memb_map)
        PIN_INT_ARRAY(ENVONLY, memb_map, themapArray, &isCopy, "H5Pget_fapl_multi: memb_map not pinned");
    if (memb_fapl)
        PIN_LONG_ARRAY(ENVONLY, memb_fapl, thefaplArray, &isCopy, "H5Pget_fapl_multi: memb_fapl not pinned");
    if (memb_addr)
        PIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, &isCopy, "H5Pget_fapl_multi: memb_addr not pinned");
    if (memb_name)
        if (NULL == (mName = (char **) HDcalloc(H5FD_MEM_NTYPES, sizeof(*mName))))
            H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_multi: memory allocation failed");

    if ((status = H5Pget_fapl_multi((hid_t)tid, (H5FD_mem_t *)themapArray, (hid_t *)thefaplArray,
            mName, (haddr_t *)theaddrArray, (hbool_t *)&relax)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

    if (memb_name && mName) {
        for (i = 0; i < H5FD_MEM_NTYPES; i++) {
            if (mName[i]) {
                if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, mName[i]))) {
                    CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
                    H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_multi: out of memory - unable to construct string from UTF characters");
                }

                ENVPTR->SetObjectArrayElement(ENVONLY, memb_name, (jsize) i, (jobject)str);
                CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

                ENVPTR->DeleteLocalRef(ENVONLY, str);
            }
        }
    }

    retVal = (relax != 0);

done:
    h5str_array_free(mName, H5FD_MEM_NTYPES);
    if (theaddrArray)
        UNPIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, (status < 0) ? JNI_ABORT : 0);
    if (thefaplArray)
        UNPIN_LONG_ARRAY(ENVONLY, memb_fapl, thefaplArray, (status < 0) ? JNI_ABORT : 0);
    if (themapArray)
        UNPIN_INT_ARRAY(ENVONLY, memb_map, themapArray, (status < 0) ? JNI_ABORT : 0);

    return (jboolean)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi */

/*
 * TODO: H5Pset_multi_type
 */

/*
 * TODO: H5Pget_multi_type
 */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_fapl_split
 * Signature: (JLjava/lang/String;JLjava/lang/String;J)V
 */
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split
    (JNIEnv *env, jclass clss, jlong fapl_id, jstring metaext, jlong meta_pl_id, jstring rawext, jlong raw_pl_id)
{
    const char *mstr = NULL;
    const char *rstr = NULL;
    herr_t      retVal = FAIL;

    UNUSED(clss);

    PIN_JAVA_STRING(ENVONLY, metaext, mstr, NULL, "H5Pset_fapl_split: metaext not pinned");
    PIN_JAVA_STRING(ENVONLY, rawext, rstr, NULL, "H5Pset_fapl_split: rawext not pinned");

    if ((retVal = H5Pset_fapl_split((hid_t)fapl_id, mstr, (hid_t)meta_pl_id, rstr, (hid_t)raw_pl_id)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    if (rstr)
        UNPIN_JAVA_STRING(ENVONLY, rawext, rstr);
    if (mstr)
        UNPIN_JAVA_STRING(ENVONLY, metaext, mstr);
} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_fapl_sec2
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2
    (JNIEnv *env, jclass clss, jlong fapl_id)
{
    herr_t retVal = FAIL;

    UNUSED(clss);

    if ((retVal = H5Pset_fapl_sec2((hid_t) fapl_id)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2 */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_fapl_stdio
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio
    (JNIEnv *env, jclass clss, jlong fapl_id)
{
    herr_t retVal = FAIL;

    UNUSED(clss);

    if ((retVal = H5Pset_fapl_stdio((hid_t) fapl_id)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_fapl_windows
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows
    (JNIEnv *env, jclass clss, jlong fapl_id)
{
    herr_t retVal = FAIL;

    UNUSED(clss);

#ifdef H5_HAVE_WINDOWS
    if ((retVal = H5Pset_fapl_windows((hid_t) fapl_id)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
#else
    UNUSED(env);
    UNUSED(fapl_id);
#endif
    return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows */

/*
 * TODO: H5Pset_file_image
 */

/*
 * TODO: H5Pget_file_image
 */

/*
 * TODO: H5Pset_file_image_callbacks
 */

/*
 * TODO: H5Pget_file_image_callbacks
 */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_meta_block_size
 * Signature: (JJ)V
 */
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size
    (JNIEnv *env, jclass clss, jlong plist, jlong size)
{
    long sz = (long)size;

    UNUSED(clss);

    if (H5Pset_meta_block_size((hid_t)plist, (hsize_t)sz) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_meta_block_size
 * Signature: (J)J
 */
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size
    (JNIEnv *env, jclass clss, jlong plist)
{
    hsize_t s = 0;

    UNUSED(clss);

    if (H5Pget_meta_block_size((hid_t)plist, &s) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jlong)s;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size */

/*
 * TODO: H5Pset_page_buffer_size
 */

/*
 * TODO: H5Pget_page_buffer_size
 */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_sieve_buf_size
 * Signature: (JJ)V
 */
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size
    (JNIEnv *env, jclass clss, jlong plist, jlong size)
{
    size_t sz = (size_t)size;

    UNUSED(clss);

    if (H5Pset_sieve_buf_size((hid_t)plist, (size_t)sz) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_sieve_buf_size
 * Signature: (J)J
 */
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size
    (JNIEnv *env, jclass clss, jlong plist)
{
    size_t s = 0;

    UNUSED(clss);

    if (H5Pget_sieve_buf_size((hid_t)plist, &s) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jlong)s;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_alignment
 * Signature: (JJJ)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1alignment
    (JNIEnv *env, jclass clss, jlong plist, jlong threshold, jlong alignment)
{
    long   thr = (long)threshold;
    long   align = (long)alignment;
    herr_t retVal = FAIL;

    UNUSED(clss);

    if ((retVal = H5Pset_alignment((hid_t)plist, (hsize_t)thr, (hsize_t)align)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1alignment */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_alignment
 * Signature: (J[J)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1alignment
    (JNIEnv *env, jclass clss, jlong plist, jlongArray alignment)
{
    jboolean  isCopy;
    hsize_t   t = 0;
    hsize_t   a = 0;
    jsize     arrLen;
    jlong    *theArray = NULL;
    herr_t    status = FAIL;

    UNUSED(clss);

    if (NULL == alignment)
        H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_alignment: input alignment is NULL");

    if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, alignment)) < 0) {
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
        H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_alignment: alignment array length < 0");
    }
    if (arrLen < 2)
        H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_alignment: alignment input array < 2");

    PIN_LONG_ARRAY(ENVONLY, alignment, theArray, &isCopy, "H5Pget_alignment: input array not pinned");

    if ((status = H5Pget_alignment((hid_t)plist, &t, &a)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

    theArray[0] = (jlong)t;
    theArray[1] = (jlong)a;

done:
    if (theArray)
        UNPIN_LONG_ARRAY(ENVONLY, alignment, theArray, (status < 0) ? JNI_ABORT : 0);

    return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1alignment */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_cache
 * Signature: (JIJJD)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1cache
    (JNIEnv *env, jclass clss, jlong plist, jint mdc_nelmts, jlong rdcc_nelmts,
  jlong rdcc_nbytes, jdouble rdcc_w0)
{
    herr_t retVal = FAIL;

    UNUSED(clss);

    if ((retVal = H5Pset_cache((hid_t)plist, (int)mdc_nelmts, (size_t)rdcc_nelmts,
            (size_t)rdcc_nbytes, (double) rdcc_w0)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1cache */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_cache
 * Signature: (J[I[J[J[D)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1cache
    (JNIEnv *env, jclass clss, jlong plist, jintArray mdc_nelmts,
        jlongArray rdcc_nelmts, jlongArray rdcc_nbytes, jdoubleArray rdcc_w0)
{
    jboolean  isCopy;
    jdouble  *w0Array = NULL;
    jlong    *rdcc_nelmtsArray = NULL;
    jlong    *nbytesArray = NULL;
    herr_t    status = FAIL;

    UNUSED(clss);
    UNUSED(mdc_nelmts);

    if (NULL != rdcc_w0)
        PIN_DOUBLE_ARRAY(ENVONLY, rdcc_w0, w0Array, &isCopy, "H5Pget_cache: rdcc_w0 array not pinned");
    if (NULL != rdcc_nelmts)
        PIN_LONG_ARRAY(ENVONLY, rdcc_nelmts, rdcc_nelmtsArray, &isCopy, "H5Pget_cache: rdcc_nelmts array not pinned");
    if (NULL != rdcc_nbytes)
        PIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, &isCopy, "H5Pget_cache: nbytesArray array not pinned");

    {
        /* direct cast (size_t *)variable fails on 32-bit environment */
        long long rdcc_nelmts_temp = *rdcc_nelmtsArray;
        long long nbytes_temp = *nbytesArray;
        size_t    rdcc_nelmts_t = (size_t) rdcc_nelmts_temp;
        size_t    nbytes_t = (size_t) nbytes_temp;

        if ((status = H5Pget_cache((hid_t)plist, (int *)NULL, &rdcc_nelmts_t,
                &nbytes_t, (double *)w0Array)) < 0)
            H5_LIBRARY_ERROR(ENVONLY);

        *rdcc_nelmtsArray = (jlong)rdcc_nelmts_t;
        *nbytesArray = (jlong)nbytes_t;
    } /* end direct cast special */

done:
    if (nbytesArray)
        UNPIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, (status < 0) ? JNI_ABORT : 0);
    if (rdcc_nelmtsArray)
        UNPIN_LONG_ARRAY(ENVONLY, rdcc_nelmts, rdcc_nelmtsArray, (status < 0) ? JNI_ABORT : 0);
    if (w0Array)
        UNPIN_DOUBLE_ARRAY(ENVONLY, rdcc_w0, w0Array, (status < 0) ? JNI_ABORT : 0);

    return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1cache */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_elink_file_cache_size
 * Signature: (JI)V
 */
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size
    (JNIEnv *env, jclass clss, jlong plist, jint size)
{
    unsigned sz = (unsigned)size;

    UNUSED(clss);

    if (H5Pset_elink_file_cache_size((hid_t)plist, (unsigned)sz) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_elink_file_cache_size
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size
    (JNIEnv *env, jclass clss, jlong plist)
{
    unsigned s = 0;

    UNUSED(clss);

    if (H5Pget_elink_file_cache_size((hid_t)plist, &s) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jint)s;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_evict_on_close
 * Signature: (JZ)V
 */
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close
    (JNIEnv *env, jclass clss, jlong fapl_id, jboolean evict_on_close)
{
    hbool_t evict_on_close_val = FALSE;
    herr_t  retVal = FAIL;

    UNUSED(clss);

    evict_on_close_val = (evict_on_close == JNI_TRUE) ? TRUE : FALSE;

    if ((retVal = H5Pset_evict_on_close((hid_t)fapl_id, (hbool_t)evict_on_close_val)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_evict_on_close
 * Signature: (J)Z
 */
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close
    (JNIEnv *env, jclass clss, jlong fapl_id)
{
    hbool_t  evict_on_close_val = FALSE;
    jboolean bval = JNI_FALSE;

    UNUSED(clss);

    if (H5Pget_evict_on_close((hid_t)fapl_id, (hbool_t *)&evict_on_close_val) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

    bval = (evict_on_close_val == TRUE) ? JNI_TRUE : JNI_FALSE;

done:
    return bval;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_metadata_read_attempts
 * Signature: (JJ)V
 */
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts
    (JNIEnv *env, jclass clss, jlong plist_id, jlong attempts)
{
    UNUSED(clss);

    if (attempts <= 0)
        H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_metadata_read_attempts: attempts <= 0");

    if (H5Pset_metadata_read_attempts((hid_t)plist_id, (unsigned)attempts) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_metadata_read_attempts
 * Signature: (J)J
 */
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts
    (JNIEnv *env, jclass clss, jlong plist_id)
{
    unsigned attempts = 0;

    UNUSED(clss);

    if (H5Pget_metadata_read_attempts((hid_t)plist_id, &attempts) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jlong) attempts;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_mdc_config
 * Signature: (JLhdf/hdf5lib/structs/H5AC_cache_config_t;)V
 */
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
    (JNIEnv *env, jclass clss, jlong plist, jobject cache_config)
{
    H5AC_cache_config_t  cacheinfo;
    const char          *str = NULL;
    jfieldID             fid;
    jstring              j_str;
    jclass               cls;
    jint                 flash_incr_mode;
    jint                 incr_mode;
    jint                 decr_mode;
    herr_t               status = FAIL;

    UNUSED(clss);

    HDmemset(&cacheinfo, 0, sizeof(H5AC_cache_config_t));

    if (NULL == (cls = ENVPTR->GetObjectClass(ENVONLY, cache_config)))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "version", "I")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.version = ENVPTR->GetIntField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "rpt_fcn_enabled", "Z")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.rpt_fcn_enabled = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "open_trace_file", "Z")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.open_trace_file = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "close_trace_file", "Z")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.close_trace_file = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "trace_file_name", "Ljava/lang/String;")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, cache_config, fid)))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_mdc_config: cache_config not pinned");

    HDstrncpy(cacheinfo.trace_file_name, str, H5AC__MAX_TRACE_FILE_NAME_LEN + 1);

    UNPIN_JAVA_STRING(ENVONLY, j_str, str);
    str = NULL;

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "evictions_enabled", "Z")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.evictions_enabled = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "set_initial_size", "Z")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.set_initial_size = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "initial_size", "J")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.initial_size = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "min_clean_fraction", "D")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.min_clean_fraction = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "max_size", "J")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.max_size = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "min_size", "J")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.min_size = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "epoch_length", "J")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.epoch_length = (long int)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "incr_mode", "I")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    incr_mode = ENVPTR->GetIntField(ENVONLY, cache_config, fid); /*(enum H5C_cache_incr_mode) */
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
    cacheinfo.incr_mode = (enum H5C_cache_incr_mode) incr_mode;

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "lower_hr_threshold", "D")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.lower_hr_threshold = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "increment", "D")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.increment = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "apply_max_increment", "Z")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.apply_max_increment = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "max_increment", "J")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.max_increment = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "flash_incr_mode", "I")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    flash_incr_mode = ENVPTR->GetIntField(ENVONLY, cache_config, fid); /*(enum H5C_cache_flash_incr_mode) */
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
    cacheinfo.flash_incr_mode = (enum H5C_cache_flash_incr_mode) flash_incr_mode;

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "flash_multiple", "D")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.flash_multiple = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "flash_threshold", "D")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.flash_threshold = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "decr_mode", "I")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    decr_mode = ENVPTR->GetIntField(ENVONLY, cache_config, fid); /*(enum H5C_cache_decr_mode) */
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
    cacheinfo.decr_mode = (enum H5C_cache_decr_mode) decr_mode;

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "upper_hr_threshold", "D")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.upper_hr_threshold = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "decrement", "D")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.decrement = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "apply_max_decrement", "Z")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.apply_max_decrement = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "max_decrement", "J")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.max_decrement = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "epochs_before_eviction", "I")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.epochs_before_eviction = ENVPTR->GetIntField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "apply_empty_reserve", "Z")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.apply_empty_reserve = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "empty_reserve", "D")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.empty_reserve = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "dirty_bytes_threshold", "J")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.dirty_bytes_threshold = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "metadata_write_strategy", "I")))
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    cacheinfo.metadata_write_strategy = ENVPTR->GetIntField(ENVONLY, cache_config, fid);
    CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

    if ((status = H5Pset_mdc_config((hid_t)plist, &cacheinfo)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    if (str)
        UNPIN_JAVA_STRING(ENVONLY, j_str, str);
} /* end Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_mdc_config
 * Signature: (J)Lhdf/hdf5lib/structs/H5AC_cache_config_t;
 */
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config
    (JNIEnv *env, jclass clss, jlong plist)
{
    H5AC_cache_config_t cacheinfo;
    jstring             j_str = NULL;
    jvalue              args[30];
    herr_t              status = FAIL;
    jobject             ret_obj = NULL;

    UNUSED(clss);

    HDmemset(&cacheinfo, 0, sizeof(H5AC_cache_config_t));
    cacheinfo.version = H5AC__CURR_CACHE_CONFIG_VERSION;

    if ((status = H5Pget_mdc_config((hid_t)plist, &cacheinfo)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

    args[0].i = cacheinfo.version;
    args[1].z = cacheinfo.rpt_fcn_enabled;
    args[2].z = cacheinfo.open_trace_file;
    args[3].z = cacheinfo.close_trace_file;

    if (NULL != cacheinfo.trace_file_name) {
        if (NULL == (j_str = ENVPTR->NewStringUTF(ENVONLY, cacheinfo.trace_file_name))) {
            CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
            H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_mdc_config: out of memory - unable to construct string from UTF characters");
        }
    }

    args[4].l = j_str;
    args[5].z = cacheinfo.evictions_enabled;
    args[6].z = cacheinfo.set_initial_size;
    args[7].j = (jlong)cacheinfo.initial_size;
    args[8].d = cacheinfo.min_clean_fraction;
    args[9].j = (jlong)cacheinfo.max_size;
    args[10].j = (jlong)cacheinfo.min_size;
    args[11].j = cacheinfo.epoch_length;
    args[12].i = cacheinfo.incr_mode;
    args[13].d = cacheinfo.lower_hr_threshold;
    args[14].d = cacheinfo.increment;
    args[15].z = cacheinfo.apply_max_increment;
    args[16].j = (jlong)cacheinfo.max_increment;
    args[17].i = cacheinfo.flash_incr_mode;
    args[18].d = cacheinfo.flash_multiple;
    args[19].d = cacheinfo.flash_threshold;
    args[20].i = cacheinfo.decr_mode;
    args[21].d = cacheinfo.upper_hr_threshold;
    args[22].d = cacheinfo.decrement;
    args[23].z = cacheinfo.apply_max_decrement;
    args[24].j = (jlong)cacheinfo.max_decrement;
    args[25].i = cacheinfo.epochs_before_eviction;
    args[26].z = cacheinfo.apply_empty_reserve;
    args[27].d = cacheinfo.empty_reserve;
    args[28].j = (jlong)cacheinfo.dirty_bytes_threshold;
    args[29].i = cacheinfo.metadata_write_strategy;

    CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5AC_cache_config_t", "(IZZZLjava/lang/String;ZZJDJJJIDDZJIDDIDDZJIZDJI)V", args, ret_obj);

done:
    return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config */

/*
 * TODO: H5Pset_mdc_image_config
 */

/*
 * TODO: H5Pget_mdc_image_config
 */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_mdc_log_options
 * Signature: (JZLjava/lang/String;Z)V
 */
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options
    (JNIEnv *env, jclass clss, jlong fapl_id, jboolean is_enabled, jstring location, jboolean start_on_access)
{
    const char *locStr = NULL;
    herr_t      retVal = FAIL;

    UNUSED(clss);

    PIN_JAVA_STRING(ENVONLY, location, locStr, NULL, "H5Pset_mdc_log_options: location string not pinned");

    if ((retVal = H5Pset_mdc_log_options((hid_t)fapl_id, (hbool_t)is_enabled, locStr, (hbool_t)start_on_access)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    if (locStr)
        UNPIN_JAVA_STRING(ENVONLY, location, locStr);
} /* end Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_mdc_log_options
 * Signature: (J[Z)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
    (JNIEnv *env, jclass clss, jlong fapl_id, jbooleanArray mdc_log_options)
{
    jboolean   isCopy;
    jboolean  *mdc_log_options_ptr = NULL;
    hbool_t    is_enabled;
    hbool_t    start_on_access;
    ssize_t    status = -1;
    size_t     location_size;
    jsize      arrLen;
    char      *lname = NULL;
    jstring    str = NULL;

    UNUSED(clss);

    if (NULL == mdc_log_options)
        H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_mdc_log_options: mdc_log_options is NULL");

    if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, mdc_log_options)) < 0) {
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
        H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_mdc_log_options: mdc_log_options array length < 0");
    }
    if (arrLen < 2)
        H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_mdc_log_options: length of mdc_log_options < 2");

    PIN_BOOL_ARRAY(ENVONLY, mdc_log_options, mdc_log_options_ptr, &isCopy, "H5Pget_mdc_log_options: mdc_log_options array not pinned");

    /* get the length of the filename */
    if (H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, NULL, &location_size, &start_on_access) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

    if (!location_size)
        H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_mdc_log_options: location_size is 0");

    location_size++; /* add extra space for the null terminator */
    if (NULL == (lname = (char *) HDmalloc(sizeof(char) * location_size)))
        H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_mdc_log_options: memory allocation failed");

    if ((status = H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, lname, &location_size, &start_on_access)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);
    lname[location_size - 1] = '\0';

    if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, lname))) {
        CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
        H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_mdc_log_options: out of memory - unable to construct string from UTF characters");
    }

    mdc_log_options_ptr[0] = (jboolean)is_enabled;
    mdc_log_options_ptr[1] = (jboolean)start_on_access;

done:
    if (lname)
        HDfree(lname);
    if (mdc_log_options_ptr)
        UNPIN_BOOL_ARRAY(ENVONLY, mdc_log_options, mdc_log_options_ptr, (status < 0) ? JNI_ABORT : 0);

    return (jstring)str;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options */

/*
 * TODO: H5Pset_all_coll_metadata_ops
 */

/*
 * TODO: H5Pget_all_coll_metadata_ops
 */

/*
 * TODO: H5Pset_coll_metadata_write
 */

/*
 * TODO: H5Pget_coll_metadata_write
 */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_gc_references
 * Signature: (JZ)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1gc_1references
    (JNIEnv *env, jclass clss, jlong fapl_id, jboolean gc_ref)
{
    unsigned gc_ref_val = 0;
    herr_t   retVal = FAIL;

    UNUSED(clss);

    gc_ref_val = (gc_ref == JNI_TRUE) ? 1 : 0;

    if ((retVal = H5Pset_gc_references((hid_t)fapl_id, gc_ref_val)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1gc_1references */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_gc_references
 * Signature: (J)Z
 */
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1gc_1references
    (JNIEnv *env, jclass clss, jlong fapl_id)
{
    unsigned gc_ref_val = 0;
    jboolean bval = JNI_FALSE;

    UNUSED(clss);

    if (H5Pget_gc_references((hid_t)fapl_id, (unsigned *)&gc_ref_val) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

    bval = (gc_ref_val == 1) ? JNI_TRUE : JNI_FALSE;

done:
    return bval;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1gc_1references */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_small_data_block_size
 * Signature: (JJ)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size
    (JNIEnv *env, jclass clss, jlong plist, jlong size)
{
    long   sz = (long)size;
    herr_t retVal = FAIL;

    UNUSED(clss);

    if ((retVal = H5Pset_small_data_block_size((hid_t)plist, (hsize_t)sz)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_small_data_block_size
 * Signature: (J)J
 */
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size
    (JNIEnv *env, jclass clss, jlong plist)
{
    hsize_t s = 0;

    UNUSED(clss);

    if (H5Pget_small_data_block_size((hid_t)plist, &s) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jlong)s;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pset_libver_bounds
 * Signature: (JII)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds
    (JNIEnv *env, jclass clss, jlong fapl_id, jint low, jint high)
{
    herr_t retVal = FAIL;

    UNUSED(clss);

    if ((retVal = H5Pset_libver_bounds((hid_t)fapl_id, (H5F_libver_t)low, (H5F_libver_t)high)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds */

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Pget_libver_bounds
 * Signature: (J[I)I
 */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds
    (JNIEnv *env, jclass clss, jlong fapl_id, jintArray libver)
{
    jboolean  isCopy;
    jint     *theArray = NULL;
    herr_t    retVal = FAIL;

    UNUSED(clss);

    if (NULL == libver)
        H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_libver_bounds: libversion bounds is NULL");

    PIN_INT_ARRAY(ENVONLY, libver, theArray, &isCopy, "H5Pget_libver_bounds: input not pinned");

    if ((retVal = H5Pget_libver_bounds((hid_t)fapl_id, (H5F_libver_t *)&(theArray[0]), (H5F_libver_t *)&(theArray[1]))) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

done:
    if (theArray)
        UNPIN_INT_ARRAY(ENVONLY, libver, theArray, (retVal < 0) ? JNI_ABORT : 0);

    return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds */

/*
 * TODO: H5Pset_object_flush_cb
 */

/*
 * TODO: H5Pget_object_flush_cb
 */

#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */