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
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
* Created: H5Pfcpl.c
* January 6 1998
* Robb Matzke <matzke@llnl.gov>
*
* Purpose: File creation property list class routines
*
*-------------------------------------------------------------------------
*/
/****************/
/* Module Setup */
/****************/
#include "H5Pmodule.h" /* This source code file is part of the H5P module */
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Bprivate.h" /* B-tree subclass names */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
#include "H5SMprivate.h" /* Shared object header messages */
#include "H5Ppkg.h" /* Property lists */
/****************/
/* Local Macros */
/****************/
/* ========= File Creation properties ============ */
/* Definitions for the size of the file user block in bytes */
#define H5F_CRT_USER_BLOCK_SIZE sizeof(hsize_t)
#define H5F_CRT_USER_BLOCK_DEF 0
#define H5F_CRT_USER_BLOCK_ENC H5P__encode_hsize_t
#define H5F_CRT_USER_BLOCK_DEC H5P__decode_hsize_t
/* Definitions for the 1/2 rank for symbol table leaf nodes */
#define H5F_CRT_SYM_LEAF_SIZE sizeof(unsigned)
#define H5F_CRT_SYM_LEAF_ENC H5P__encode_unsigned
#define H5F_CRT_SYM_LEAF_DEC H5P__decode_unsigned
/* Definitions for the 1/2 rank for btree internal nodes */
#define H5F_CRT_BTREE_RANK_SIZE sizeof(unsigned[H5B_NUM_BTREE_ID])
#define H5F_CRT_BTREE_RANK_DEF {HDF5_BTREE_SNODE_IK_DEF,HDF5_BTREE_CHUNK_IK_DEF}
#define H5F_CRT_BTREE_RANK_ENC H5P__fcrt_btree_rank_enc
#define H5F_CRT_BTREE_RANK_DEC H5P__fcrt_btree_rank_dec
/* Definitions for byte number in an address */
#define H5F_CRT_ADDR_BYTE_NUM_SIZE sizeof(uint8_t)
#define H5F_CRT_ADDR_BYTE_NUM_DEF H5F_OBJ_ADDR_SIZE
#define H5F_CRT_ADDR_BYTE_NUM_ENC H5P__encode_uint8_t
#define H5F_CRT_ADDR_BYTE_NUM_DEC H5P__decode_uint8_t
/* Definitions for byte number for object size */
#define H5F_CRT_OBJ_BYTE_NUM_SIZE sizeof(uint8_t)
#define H5F_CRT_OBJ_BYTE_NUM_DEF H5F_OBJ_SIZE_SIZE
#define H5F_CRT_OBJ_BYTE_NUM_ENC H5P__encode_uint8_t
#define H5F_CRT_OBJ_BYTE_NUM_DEC H5P__decode_uint8_t
/* Definitions for version number of the superblock */
#define H5F_CRT_SUPER_VERS_SIZE sizeof(unsigned)
#define H5F_CRT_SUPER_VERS_DEF HDF5_SUPERBLOCK_VERSION_DEF
/* Definitions for shared object header messages */
#define H5F_CRT_SHMSG_NINDEXES_SIZE sizeof(unsigned)
#define H5F_CRT_SHMSG_NINDEXES_DEF (0)
#define H5F_CRT_SHMSG_NINDEXES_ENC H5P__encode_unsigned
#define H5F_CRT_SHMSG_NINDEXES_DEC H5P__decode_unsigned
#define H5F_CRT_SHMSG_INDEX_TYPES_SIZE sizeof(unsigned[H5O_SHMESG_MAX_NINDEXES])
#define H5F_CRT_SHMSG_INDEX_TYPES_DEF {0,0,0,0,0,0}
#define H5F_CRT_SHMSG_INDEX_TYPES_ENC H5P__fcrt_shmsg_index_types_enc
#define H5F_CRT_SHMSG_INDEX_TYPES_DEC H5P__fcrt_shmsg_index_types_dec
#define H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE sizeof(unsigned[H5O_SHMESG_MAX_NINDEXES])
#define H5F_CRT_SHMSG_INDEX_MINSIZE_DEF {250,250,250,250,250,250}
#define H5F_CRT_SHMSG_INDEX_MINSIZE_ENC H5P__fcrt_shmsg_index_minsize_enc
#define H5F_CRT_SHMSG_INDEX_MINSIZE_DEC H5P__fcrt_shmsg_index_minsize_dec
/* Definitions for shared object header list/btree phase change cutoffs */
#define H5F_CRT_SHMSG_LIST_MAX_SIZE sizeof(unsigned)
#define H5F_CRT_SHMSG_LIST_MAX_DEF (50)
#define H5F_CRT_SHMSG_LIST_MAX_ENC H5P__encode_unsigned
#define H5F_CRT_SHMSG_LIST_MAX_DEC H5P__decode_unsigned
#define H5F_CRT_SHMSG_BTREE_MIN_SIZE sizeof(unsigned)
#define H5F_CRT_SHMSG_BTREE_MIN_DEF (40)
#define H5F_CRT_SHMSG_BTREE_MIN_ENC H5P__encode_unsigned
#define H5F_CRT_SHMSG_BTREE_MIN_DEC H5P__decode_unsigned
/* Definitions for file space handling strategy */
#define H5F_CRT_FILE_SPACE_STRATEGY_SIZE sizeof(H5F_fspace_strategy_t)
#define H5F_CRT_FILE_SPACE_STRATEGY_DEF H5F_FILE_SPACE_STRATEGY_DEF
#define H5F_CRT_FILE_SPACE_STRATEGY_ENC H5P__fcrt_fspace_strategy_enc
#define H5F_CRT_FILE_SPACE_STRATEGY_DEC H5P__fcrt_fspace_strategy_dec
#define H5F_CRT_FREE_SPACE_PERSIST_SIZE sizeof(hbool_t)
#define H5F_CRT_FREE_SPACE_PERSIST_DEF H5F_FREE_SPACE_PERSIST_DEF
#define H5F_CRT_FREE_SPACE_PERSIST_ENC H5P__encode_hbool_t
#define H5F_CRT_FREE_SPACE_PERSIST_DEC H5P__decode_hbool_t
#define H5F_CRT_FREE_SPACE_THRESHOLD_SIZE sizeof(hsize_t)
#define H5F_CRT_FREE_SPACE_THRESHOLD_DEF H5F_FREE_SPACE_THRESHOLD_DEF
#define H5F_CRT_FREE_SPACE_THRESHOLD_ENC H5P__encode_hsize_t
#define H5F_CRT_FREE_SPACE_THRESHOLD_DEC H5P__decode_hsize_t
/* Definitions for file space page size in support of level-2 page caching */
#define H5F_CRT_FILE_SPACE_PAGE_SIZE_SIZE sizeof(hsize_t)
#define H5F_CRT_FILE_SPACE_PAGE_SIZE_DEF H5F_FILE_SPACE_PAGE_SIZE_DEF
#define H5F_CRT_FILE_SPACE_PAGE_SIZE_ENC H5P__encode_hsize_t
#define H5F_CRT_FILE_SPACE_PAGE_SIZE_DEC H5P__decode_hsize_t
/******************/
/* Local Typedefs */
/******************/
/********************/
/* Package Typedefs */
/********************/
/********************/
/* Local Prototypes */
/********************/
/* Property class callbacks */
static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass);
/* property callbacks */
static herr_t H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size, void *udata);
static herr_t H5P__fcrt_btree_rank_dec(const void **_pp, void *value);
static herr_t H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size, void *udata);
static herr_t H5P__fcrt_shmsg_index_types_dec(const void **_pp, void *value);
static herr_t H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size, void *udata);
static herr_t H5P__fcrt_shmsg_index_minsize_dec(const void **_pp, void *value);
static herr_t H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size, void *udata);
static herr_t H5P__fcrt_fspace_strategy_dec(const void **_pp, void *_value);
/*********************/
/* Package Variables */
/*********************/
/* File creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_FCRT[1] = {{
"file create", /* Class name for debugging */
H5P_TYPE_FILE_CREATE, /* Class type */
&H5P_CLS_GROUP_CREATE_g, /* Parent class */
&H5P_CLS_FILE_CREATE_g, /* Pointer to class */
&H5P_CLS_FILE_CREATE_ID_g, /* Pointer to class ID */
&H5P_LST_FILE_CREATE_ID_g, /* Pointer to default property list ID */
H5P_fcrt_reg_prop, /* Default property registration routine */
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
NULL, /* Class copy callback info */
NULL, /* Class close callback */
NULL /* Class close callback info */
}};
/*****************************/
/* Library Private Variables */
/*****************************/
/*******************/
/* Local Variables */
/*******************/
/* Property value defaults */
static const hsize_t H5F_def_userblock_size_g = H5F_CRT_USER_BLOCK_DEF; /* Default userblock size */
static const unsigned H5F_def_sym_leaf_k_g = H5F_CRT_SYM_LEAF_DEF; /* Default size for symbol table leaf nodes */
static const unsigned H5F_def_btree_k_g[H5B_NUM_BTREE_ID] = H5F_CRT_BTREE_RANK_DEF; /* Default 'K' values for B-trees in file */
static const uint8_t H5F_def_sizeof_addr_g = H5F_CRT_ADDR_BYTE_NUM_DEF; /* Default size of addresses in the file */
static const uint8_t H5F_def_sizeof_size_g = H5F_CRT_OBJ_BYTE_NUM_DEF; /* Default size of sizes in the file */
static const unsigned H5F_def_superblock_ver_g = H5F_CRT_SUPER_VERS_DEF; /* Default superblock version # */
static const unsigned H5F_def_num_sohm_indexes_g = H5F_CRT_SHMSG_NINDEXES_DEF;
static const unsigned H5F_def_sohm_index_flags_g[H5O_SHMESG_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_TYPES_DEF;
static const unsigned H5F_def_sohm_index_minsizes_g[H5O_SHMESG_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_MINSIZE_DEF;
static const unsigned H5F_def_sohm_list_max_g = H5F_CRT_SHMSG_LIST_MAX_DEF;
static const unsigned H5F_def_sohm_btree_min_g = H5F_CRT_SHMSG_BTREE_MIN_DEF;
static const H5F_fspace_strategy_t H5F_def_file_space_strategy_g = H5F_CRT_FILE_SPACE_STRATEGY_DEF;
static const hbool_t H5F_def_free_space_persist_g = H5F_CRT_FREE_SPACE_PERSIST_DEF;
static const hsize_t H5F_def_free_space_threshold_g = H5F_CRT_FREE_SPACE_THRESHOLD_DEF;
static const hsize_t H5F_def_file_space_page_size_g = H5F_CRT_FILE_SPACE_PAGE_SIZE_DEF;
/*-------------------------------------------------------------------------
* Function: H5P_fcrt_reg_prop
*
* Purpose: Register the file creation property list class's properties
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* October 31, 2006
*-------------------------------------------------------------------------
*/
static herr_t
H5P_fcrt_reg_prop(H5P_genclass_t *pclass)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Register the user block size */
if(H5P_register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &H5F_def_userblock_size_g,
NULL, NULL, NULL, H5F_CRT_USER_BLOCK_ENC, H5F_CRT_USER_BLOCK_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 1/2 rank for symbol table leaf nodes */
if(H5P_register_real(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &H5F_def_sym_leaf_k_g,
NULL, NULL, NULL, H5F_CRT_SYM_LEAF_ENC, H5F_CRT_SYM_LEAF_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 1/2 rank for btree internal nodes */
if(H5P_register_real(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, H5F_def_btree_k_g,
NULL, NULL, NULL, H5F_CRT_BTREE_RANK_ENC, H5F_CRT_BTREE_RANK_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the byte number for an address */
if(H5P_register_real(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &H5F_def_sizeof_addr_g,
NULL, NULL, NULL, H5F_CRT_ADDR_BYTE_NUM_ENC, H5F_CRT_ADDR_BYTE_NUM_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the byte number for object size */
if(H5P_register_real(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &H5F_def_sizeof_size_g,
NULL, NULL, NULL, H5F_CRT_OBJ_BYTE_NUM_ENC, H5F_CRT_OBJ_BYTE_NUM_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the superblock version number */
/* (Note: this property should not have an encode/decode callback -QAK) */
if(H5P_register_real(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &H5F_def_superblock_ver_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the shared OH message information */
if(H5P_register_real(pclass, H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &H5F_def_num_sohm_indexes_g,
NULL, NULL, NULL, H5F_CRT_SHMSG_NINDEXES_ENC, H5F_CRT_SHMSG_NINDEXES_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
if(H5P_register_real(pclass, H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &H5F_def_sohm_index_flags_g,
NULL, NULL, NULL, H5F_CRT_SHMSG_INDEX_TYPES_ENC, H5F_CRT_SHMSG_INDEX_TYPES_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
if(H5P_register_real(pclass, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &H5F_def_sohm_index_minsizes_g,
NULL, NULL, NULL, H5F_CRT_SHMSG_INDEX_MINSIZE_ENC, H5F_CRT_SHMSG_INDEX_MINSIZE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the shared OH cutoff size information */
if(H5P_register_real(pclass, H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &H5F_def_sohm_list_max_g,
NULL, NULL, NULL, H5F_CRT_SHMSG_LIST_MAX_ENC, H5F_CRT_SHMSG_LIST_MAX_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
if(H5P_register_real(pclass, H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &H5F_def_sohm_btree_min_g,
NULL, NULL, NULL, H5F_CRT_SHMSG_BTREE_MIN_ENC, H5F_CRT_SHMSG_BTREE_MIN_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file space handling strategy */
if(H5P_register_real(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &H5F_def_file_space_strategy_g,
NULL, NULL, NULL, H5F_CRT_FILE_SPACE_STRATEGY_ENC, H5F_CRT_FILE_SPACE_STRATEGY_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the free-space persist flag */
if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_PERSIST_NAME, H5F_CRT_FREE_SPACE_PERSIST_SIZE, &H5F_def_free_space_persist_g,
NULL, NULL, NULL, H5F_CRT_FREE_SPACE_PERSIST_ENC, H5F_CRT_FREE_SPACE_PERSIST_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the free space section threshold */
if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &H5F_def_free_space_threshold_g,
NULL, NULL, NULL, H5F_CRT_FREE_SPACE_THRESHOLD_ENC, H5F_CRT_FREE_SPACE_THRESHOLD_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file space page size */
if(H5P_register_real(pclass, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, H5F_CRT_FILE_SPACE_PAGE_SIZE_SIZE, &H5F_def_file_space_page_size_g,
NULL, NULL, NULL, H5F_CRT_FILE_SPACE_PAGE_SIZE_ENC, H5F_CRT_FILE_SPACE_PAGE_SIZE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_fcrt_reg_prop() */
/*-------------------------------------------------------------------------
* Function: H5Pset_userblock
*
* Purpose: Sets the userblock size field of a file creation property
* list.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Tuesday, January 6, 1998
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_userblock(hid_t plist_id, hsize_t size)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ih", plist_id, size);
/* Sanity check non-zero userblock sizes */
if(size > 0) {
/* Check that the userblock size is >=512 */
if(size < 512)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "userblock size is non-zero and less than 512")
/* Check that the userblock size is a power of two */
if(!POWER_OF_TWO(size))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "userblock size is non-zero and not a power of two")
} /* end if */
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set value */
if(H5P_set(plist, H5F_CRT_USER_BLOCK_NAME, &size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set user block")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_userblock() */
/*-------------------------------------------------------------------------
* Function: H5Pget_userblock
*
* Purpose: Queries the size of a user block in a file creation property
* list.
*
* Return: Success: Non-negative, size returned through SIZE argument.
*
* Failure: Negative
*
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
* Modifications:
*
* Raymond Lu, Oct 14, 2001
* Changed to the new generic property list.
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_userblock(hid_t plist_id, hsize_t *size)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", plist_id, size);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
/* Get value */
if (size)
if(H5P_get(plist, H5F_CRT_USER_BLOCK_NAME, size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,"can't get user block");
done:
FUNC_LEAVE_API(ret_value)
}
/*-------------------------------------------------------------------------
* Function: H5Pset_sizes
*
* Purpose: Sets file size-of addresses and sizes. PLIST_ID should be a
* file creation property list. A value of zero causes the
* property to not change.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Tuesday, January 6, 1998
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "izz", plist_id, sizeof_addr, sizeof_size);
/* Check arguments */
if(sizeof_addr) {
if(sizeof_addr != 2 && sizeof_addr != 4 && sizeof_addr != 8 && sizeof_addr != 16)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file haddr_t size is not valid")
} /* end if */
if(sizeof_size) {
if(sizeof_size != 2 && sizeof_size != 4 && sizeof_size != 8 && sizeof_size != 16)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file size_t size is not valid")
} /* end if */
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set value */
if(sizeof_addr) {
uint8_t tmp_sizeof_addr = (uint8_t)sizeof_addr;
if(H5P_set(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &tmp_sizeof_addr) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for an address")
} /* end if */
if(sizeof_size) {
uint8_t tmp_sizeof_size = (uint8_t)sizeof_size;
if(H5P_set(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &tmp_sizeof_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for object ")
} /* end if */
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_sizes() */
/*-------------------------------------------------------------------------
* Function: H5Pget_sizes
*
* Purpose: Returns the size of address and size quantities stored in a
* file according to a file creation property list. Either (or
* even both) SIZEOF_ADDR and SIZEOF_SIZE may be null pointers.
*
* Return: Success: Non-negative, sizes returned through arguments.
* Failure: Negative
*
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr, size_t *sizeof_size)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*z*z", plist_id, sizeof_addr, sizeof_size);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get values */
if(sizeof_addr) {
uint8_t tmp_sizeof_addr;
if(H5P_get(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &tmp_sizeof_addr) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for an address")
*sizeof_addr = tmp_sizeof_addr;
} /* end if */
if(sizeof_size) {
uint8_t tmp_sizeof_size;
if(H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &tmp_sizeof_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for object ")
*sizeof_size = tmp_sizeof_size;
} /* end if */
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_sizes() */
/*-------------------------------------------------------------------------
* Function: H5Pset_sym_k
*
* Purpose: IK is one half the rank of a tree that stores a symbol
* table for a group. Internal nodes of the symbol table are on
* average 75% full. That is, the average rank of the tree is
* 1.5 times the value of IK.
*
* LK is one half of the number of symbols that can be stored in
* a symbol table node. A symbol table node is the leaf of a
* symbol table tree which is used to store a group. When
* symbols are inserted randomly into a group, the group's
* symbol table nodes are 75% full on average. That is, they
* contain 1.5 times the number of symbols specified by LK.
*
* Either (or even both) of IK and LK can be zero in which case
* that value is left unchanged.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Tuesday, January 6, 1998
*
* Modifications:
*
* Raymond Lu, Oct 14, 2001
* Changed to the new generic property list.
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_sym_k(hid_t plist_id, unsigned ik, unsigned lk)
{
unsigned btree_k[H5B_NUM_BTREE_ID];
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iIuIu", plist_id, ik, lk);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
/* Set values */
if (ik > 0) {
if((ik * 2) >= HDF5_BTREE_IK_MAX_ENTRIES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "istore IK value exceeds maximum B-tree entries");
if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree internal nodes");
btree_k[H5B_SNODE_ID] = ik;
if(H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree nodes");
}
if (lk > 0)
if(H5P_set(plist, H5F_CRT_SYM_LEAF_NAME, &lk) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for symbol table leaf nodes");
done:
FUNC_LEAVE_API(ret_value)
}
/*-------------------------------------------------------------------------
* Function: H5Pget_sym_k
*
* Purpose: Retrieves the symbol table B-tree 1/2 rank (IK) and the
* symbol table leaf node 1/2 size (LK). See H5Pset_sym_k() for
* details. Either (or even both) IK and LK may be null
* pointers.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
* Modifications:
*
* Raymond Lu
* Changed to the new generic property list.
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out */ , unsigned *lk /*out */ )
{
unsigned btree_k[H5B_NUM_BTREE_ID];
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ixx", plist_id, ik, lk);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
/* Get values */
if (ik) {
if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree nodes");
*ik = btree_k[H5B_SNODE_ID];
}
if (lk)
if(H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, lk) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for symbol table leaf nodes");
done:
FUNC_LEAVE_API(ret_value)
}
/*-------------------------------------------------------------------------
* Function: H5Pset_istore_k
*
* Purpose: IK is one half the rank of a tree that stores chunked raw
* data. On average, such a tree will be 75% full, or have an
* average rank of 1.5 times the value of IK.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Tuesday, January 6, 1998
*
* Modifications:
*
* Raymond Lu, Oct 14, 2001
* Changed to the new generic property list.
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_istore_k(hid_t plist_id, unsigned ik)
{
unsigned btree_k[H5B_NUM_BTREE_ID];
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iIu", plist_id, ik);
/* Check arguments */
if (ik == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "istore IK value must be positive");
if((ik * 2) >= HDF5_BTREE_IK_MAX_ENTRIES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "istore IK value exceeds maximum B-tree entries");
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
/* Set value */
if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree internal nodes");
btree_k[H5B_CHUNK_ID] = ik;
if(H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree internal nodes");
done:
FUNC_LEAVE_API(ret_value)
}
/*-------------------------------------------------------------------------
* Function: H5Pget_istore_k
*
* Purpose: Queries the 1/2 rank of an indexed storage B-tree. See
* H5Pset_istore_k() for details. The argument IK may be the
* null pointer.
*
* Return: Success: Non-negative, size returned through IK
*
* Failure: Negative
*
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
* Modifications:
*
* Raymond Lu, Oct 14, 2001
* Changed to the new generic property list.
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out */ )
{
unsigned btree_k[H5B_NUM_BTREE_ID];
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", plist_id, ik);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
/* Get value */
if(ik) {
if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree internal nodes");
*ik = btree_k[H5B_CHUNK_ID];
} /* end if */
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_istore_k() */
/*-------------------------------------------------------------------------
* Function: H5P__fcrt_btree_rank_enc
*
* Purpose: Callback routine which is called whenever the index storage
* btree in file creation property list is encoded.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Mohamad Chaarawi
* August 7, 2012
*
*-------------------------------------------------------------------------
*/
static herr_t
H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata)
{
const unsigned *btree_k = (const unsigned *)value; /* Create local alias for values */
uint8_t **pp = (uint8_t **)_pp;
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(btree_k);
HDassert(size);
if(NULL != *pp) {
unsigned u; /* Local index variable */
/* Encode the size of an unsigned*/
*(*pp)++ = (uint8_t)sizeof(unsigned);
/* Encode all the btree */
for(u = 0 ; u < H5B_NUM_BTREE_ID; u++) {
/* Encode the left split value */
H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)btree_k)
btree_k++;
} /* end for */
} /* end if */
/* Size of type flags values */
*size += 1 + (H5B_NUM_BTREE_ID * sizeof(unsigned));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__fcrt_btree_rank_enc() */
/*-------------------------------------------------------------------------
* Function: H5P__fcrt_btree_rank_dec
*
* Purpose: Callback routine which is called whenever the index storage
* btree in file creation property list is decoded.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Mohamad Chaarawi
* August 7, 2012
*
*-------------------------------------------------------------------------
*/
static herr_t
H5P__fcrt_btree_rank_dec(const void **_pp, void *_value)
{
unsigned *btree_k = (unsigned *)_value;
const uint8_t **pp = (const uint8_t **)_pp;
unsigned enc_size; /* Size of encoded property */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(pp);
HDassert(*pp);
HDassert(btree_k);
/* Decode the size */
enc_size = *(*pp)++;
if(enc_size != sizeof(unsigned))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded")
/* Decode all the type flags */
for(u = 0 ; u < H5B_NUM_BTREE_ID; u++)
H5_DECODE_UNSIGNED(*pp, btree_k[u])
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__fcrt_btree_rank_dec() */
/*-------------------------------------------------------------------------
* Function: H5Pset_shared_mesg_nindexes
*
* Purpose: Set the number of Shared Object Header Message (SOHM)
* indexes specified in this property list. If this is
* zero then shared object header messages are disabled
* for this file.
*
* These indexes can then be configured with
* H5Pset_shared_mesg_index. H5Pset_shared_mesg_phase_chage
* also controls settings for all indexes.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: James Laird
* Monday, October 9, 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_shared_mesg_nindexes(hid_t plist_id, unsigned nindexes)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iIu", plist_id, nindexes);
/* Check argument */
if (nindexes > H5O_SHMESG_MAX_NINDEXES)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "number of indexes is greater than H5O_SHMESG_MAX_NINDEXES");
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
if(H5P_set(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set number of indexes");
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_shared_mesg_nindexes() */
/*-------------------------------------------------------------------------
* Function: H5Pget_shared_mesg_nindexes
*
* Purpose: Get the number of Shared Object Header Message (SOHM)
* indexes specified in this property list.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: James Laird
* Monday, October 9, 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_shared_mesg_nindexes(hid_t plist_id, unsigned *nindexes)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*Iu", plist_id, nindexes);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
if(H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, nindexes) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes");
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_shared_mesg_nindexes() */
/*-------------------------------------------------------------------------
* Function: H5Pset_shared_mesg_index
*
* Purpose: Configure a given shared message index. Sets the types of
* message that should be stored in this index and the minimum
* size of a message in the index.
*
* INDEX_NUM is zero-indexed (in a file with three indexes,
* they are numbered 0, 1, and 2).
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: James Laird
* Wednesday, April 5, 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_flags, unsigned min_mesg_size)
{
H5P_genplist_t *plist; /* Property list pointer */
unsigned nindexes; /* Number of SOHM indexes */
unsigned type_flags[H5O_SHMESG_MAX_NINDEXES]; /* Array of mesg_type_flags*/
unsigned minsizes[H5O_SHMESG_MAX_NINDEXES]; /* Array of min_mesg_sizes*/
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iIuIuIu", plist_id, index_num, mesg_type_flags, min_mesg_size);
/* Check arguments */
if(mesg_type_flags > H5O_SHMESG_ALL_FLAG)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "unrecognized flags in mesg_type_flags")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Read the current number of indexes */
if(H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes")
/* Range check */
if(index_num >= nindexes)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index_num is too large; no such index");
/* Get arrays of type flags and message sizes */
if(H5P_get(plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, type_flags) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current index type flags")
if(H5P_get(plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, minsizes) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current min sizes")
/* Set values in arrays */
type_flags[index_num] = mesg_type_flags;
minsizes[index_num] = min_mesg_size;
/* Write arrays back to plist */
if(H5P_set(plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, type_flags) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set index type flags")
if(H5P_set(plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, minsizes) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set min mesg sizes")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_shared_mesg_index() */
/*-------------------------------------------------------------------------
* Function: H5Pget_shared_mesg_index
*
* Purpose: Get information about a given shared message index. Gets
* the types of message that are stored in the index and the
* minimum size of a message in the index.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: James Laird
* Wednesday, April 5, 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type_flags, unsigned *min_mesg_size)
{
H5P_genplist_t *plist; /* Property list pointer */
unsigned nindexes; /* Number of SOHM indexes */
unsigned type_flags[H5O_SHMESG_MAX_NINDEXES]; /* Array of mesg_type_flags*/
unsigned minsizes[H5O_SHMESG_MAX_NINDEXES]; /* Array of min_mesg_sizes*/
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iIu*Iu*Iu", plist_id, index_num, mesg_type_flags,
min_mesg_size);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Read the current number of indexes */
if(H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes")
if(index_num >= nindexes)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index_num is greater than number of indexes in property list")
/* Get arrays of type flags and message sizes */
if(H5P_get(plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, type_flags) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current index type flags")
if(H5P_get(plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, minsizes) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current min sizes")
/* Get values from arrays */
if(mesg_type_flags)
*mesg_type_flags = type_flags[index_num];
if(min_mesg_size)
*min_mesg_size = minsizes[index_num];
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_shared_mesg_index() */
/*-------------------------------------------------------------------------
* Function: H5P__fcrt_shmsg_index_types_enc
*
* Purpose: Callback routine which is called whenever the shared
* message indec types in file creation property list
* is encoded.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Mohamad Chaarawi
* August 7, 2012
*
*-------------------------------------------------------------------------
*/
static herr_t
H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata)
{
const unsigned *type_flags = (const unsigned *)value; /* Create local alias for values */
uint8_t **pp = (uint8_t **)_pp;
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(type_flags);
HDassert(size);
if(NULL != *pp) {
unsigned u; /* Local index variable */
/* Encode the size of a double*/
*(*pp)++ = (uint8_t)sizeof(unsigned);
/* Encode all the type flags */
for(u = 0; u < H5O_SHMESG_MAX_NINDEXES; u++) {
/* Encode the left split value */
H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)type_flags)
type_flags++;
} /* end for */
} /* end if */
/* Size of type flags values */
*size += 1 + (H5O_SHMESG_MAX_NINDEXES * sizeof(unsigned));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__fcrt_shmsg_index_types_enc() */
/*-------------------------------------------------------------------------
* Function: H5P__fcrt_shmsg_index_types_dec
*
* Purpose: Callback routine which is called whenever the shared
* message indec types in file creation property list
* is decoded.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Mohamad Chaarawi
* August 7, 2012
*
*-------------------------------------------------------------------------
*/
static herr_t
H5P__fcrt_shmsg_index_types_dec(const void **_pp, void *_value)
{
unsigned *type_flags = (unsigned *)_value;
const uint8_t **pp = (const uint8_t **)_pp;
unsigned enc_size; /* Size of encoded property */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(pp);
HDassert(*pp);
HDassert(type_flags);
/* Decode the size */
enc_size = *(*pp)++;
if(enc_size != sizeof(unsigned))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded")
/* Decode all the type flags */
for(u = 0; u < H5O_SHMESG_MAX_NINDEXES; u++)
H5_DECODE_UNSIGNED(*pp, type_flags[u])
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__fcrt_shmsg_index_types_dec() */
/*-------------------------------------------------------------------------
* Function: H5P__fcrt_shmsg_index_minsize_enc
*
* Purpose: Callback routine which is called whenever the shared
* message index minsize in file creation property list
* is encoded.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Mohamad Chaarawi
* August 7, 2012
*
*-------------------------------------------------------------------------
*/
static herr_t
H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata)
{
const unsigned *minsizes = (const unsigned *)value; /* Create local alias for values */
uint8_t **pp = (uint8_t **)_pp;
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(minsizes);
HDassert(size);
if(NULL != *pp) {
unsigned u; /* Local index variable */
/* Encode the size of a double*/
*(*pp)++ = (uint8_t)sizeof(unsigned);
/* Encode all the minsize values */
for(u = 0 ; u < H5O_SHMESG_MAX_NINDEXES; u++) {
/* Encode the left split value */
H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)minsizes)
minsizes++;
} /* end for */
} /* end if */
/* Size of type flags values */
*size += 1 + (H5O_SHMESG_MAX_NINDEXES * sizeof(unsigned));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__fcrt_shmsg_index_minsize_enc() */
/*-------------------------------------------------------------------------
* Function: H5P__fcrt_shmsg_index_minsize_dec
*
* Purpose: Callback routine which is called whenever the shared
* message indec minsize in file creation property list
* is decoded.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Mohamad Chaarawi
* August 7, 2012
*
*-------------------------------------------------------------------------
*/
static herr_t
H5P__fcrt_shmsg_index_minsize_dec(const void **_pp, void *_value)
{
unsigned *minsizes = (unsigned *)_value;
const uint8_t **pp = (const uint8_t **)_pp;
unsigned enc_size; /* Size of encoded property */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(pp);
HDassert(*pp);
HDassert(minsizes);
/* Decode the size */
enc_size = *(*pp)++;
if(enc_size != sizeof(unsigned))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded")
/* Decode all the minsize values */
for(u = 0 ; u < H5O_SHMESG_MAX_NINDEXES; u++)
H5_DECODE_UNSIGNED(*pp, minsizes[u])
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__fcrt_shmsg_index_minsize_dec() */
/*-------------------------------------------------------------------------
* Function: H5Pset_shared_mesg_phase_change
*
* Purpose: Sets the cutoff values for indexes storing shared object
* header messages in this file. If more than max_list
* messages are in an index, that index will become a B-tree.
* Likewise, a B-tree index containing fewer than min_btree
* messages will be converted to a list.
*
* If the max_list is zero then SOHM indexes in this file will
* never be lists but will be created as B-trees.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: James Laird
* Wednesday, April 5, 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_btree)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iIuIu", plist_id, max_list, min_btree);
/* Check that values are sensible. The min_btree value must be no greater
* than the max list plus one.
*
* Range check to make certain they will fit into encoded form.
*/
if(max_list + 1 < min_btree)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "minimum B-tree value is greater than maximum list value")
if(max_list > H5O_SHMESG_MAX_LIST_SIZE)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max list value is larger than H5O_SHMESG_MAX_LIST_SIZE")
if(min_btree > H5O_SHMESG_MAX_LIST_SIZE)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "min btree value is larger than H5O_SHMESG_MAX_LIST_SIZE")
/* Avoid the strange case where max_list == 0 and min_btree == 1, so deleting the
* last message in a B-tree makes it become an empty list.
*/
if(max_list == 0)
min_btree = 0;
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
if(H5P_set(plist, H5F_CRT_SHMSG_LIST_MAX_NAME, &max_list) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set list maximum in property list");
if(H5P_set(plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, &min_btree) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set B-tree minimum in property list");
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_shared_mesg_phase_change() */
/*-------------------------------------------------------------------------
* Function: H5Pget_shared_mesg_phase_change
*
* Purpose: Gets the maximum size of a SOHM list index before it becomes
* a B-tree.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: James Laird
* Wednesday, April 5, 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list, unsigned *min_btree)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*Iu*Iu", plist_id, max_list, min_btree);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
/* Get value(s) */
if(max_list)
if(H5P_get(plist, H5F_CRT_SHMSG_LIST_MAX_NAME, max_list) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get list maximum");
if(min_btree)
if(H5P_get(plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, min_btree) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get SOHM information");
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_shared_mesg_phase_change() */
/*-------------------------------------------------------------------------
* Function: H5Pset_file_space_strategy
*
* Purpose: Sets the "strategy" that the library employs in managing file space
* Sets the "persist" value as to persist free-space or not
* Sets the "threshold" value that the free space manager(s) will use to track free space sections.
* Ignore "persist" and "threshold" for strategies that do not use free-space managers
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; June 10, 2009
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iFfbh", plist_id, strategy, persist, threshold);
/* Check arguments */
if(strategy >= H5F_FSPACE_STRATEGY_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid strategy")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set value(s), if non-zero */
if(H5P_set(plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, &strategy) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file space strategy")
/* Ignore persist and threshold settings for strategies that do not use FSM */
if(strategy == H5F_FSPACE_STRATEGY_FSM_AGGR || strategy == H5F_FSPACE_STRATEGY_PAGE) {
if(H5P_set(plist, H5F_CRT_FREE_SPACE_PERSIST_NAME, &persist) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set free-space persisting status")
if(H5P_set(plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, &threshold) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set free-space threshold")
} /* end if */
done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_file_space_strategy() */
/*-------------------------------------------------------------------------
* Function: H5Pget_file_space_strategy
*
* Purpose: Retrieves the strategy, persist, and threshold that the library
* uses in managing file space.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; June 10, 2009
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t *strategy, hbool_t *persist, hsize_t *threshold)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*Ff*b*h", plist_id, strategy, persist, threshold);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get value(s) */
if(strategy)
if(H5P_get(plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, strategy) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file space strategy")
if(persist)
if(H5P_get(plist, H5F_CRT_FREE_SPACE_PERSIST_NAME, persist) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get free-space persisting status")
if(threshold)
if(H5P_get(plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, threshold) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get free-space threshold")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_file_space_strategy() */
/*-------------------------------------------------------------------------
* Function: H5P__fcrt_fspace_strategy_enc
*
* Purpose: Callback routine which is called whenever the free-space
* strategy property in the file creation property list
* is encoded.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* Friday, December 27, 2013
*
*-------------------------------------------------------------------------
*/
static herr_t
H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata)
{
const H5F_fspace_strategy_t *strategy = (const H5F_fspace_strategy_t *)value; /* Create local alias for values */
uint8_t **pp = (uint8_t **)_pp;
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(strategy);
HDassert(size);
if(NULL != *pp)
/* Encode free-space strategy */
*(*pp)++ = (uint8_t)*strategy;
/* Size of free-space strategy */
(*size)++;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__fcrt_fspace_strategy_enc() */
/*-------------------------------------------------------------------------
* Function: H5P__fcrt_fspace_strategy_dec
*
* Purpose: Callback routine which is called whenever the free-space
* strategy property in the file creation property list
* is decoded.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* Friday, December 27, 2013
*
*-------------------------------------------------------------------------
*/
static herr_t
H5P__fcrt_fspace_strategy_dec(const void **_pp, void *_value)
{
H5F_fspace_strategy_t *strategy = (H5F_fspace_strategy_t *)_value; /* Free-space strategy */
const uint8_t **pp = (const uint8_t **)_pp;
FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(pp);
HDassert(*pp);
HDassert(strategy);
/* Decode free-space strategy */
*strategy = (H5F_fspace_strategy_t)*(*pp)++;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__fcrt_fspace_strategy_dec() */
/*-------------------------------------------------------------------------
* Function: H5Pset_file_space_page_size
*
* Purpose: Sets the file space page size for paged aggregation.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; August 2012
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_file_space_page_size(hid_t plist_id, hsize_t fsp_size)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ih", plist_id, fsp_size);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
if(fsp_size < H5F_FILE_SPACE_PAGE_SIZE_MIN)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "cannot set file space page size to less than 512")
if(fsp_size > H5F_FILE_SPACE_PAGE_SIZE_MAX)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "cannot set file space page size to more than 1GB")
/* Set the value*/
if(H5P_set(plist, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, &fsp_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set file space page size")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_file_space_page_size() */
/*-------------------------------------------------------------------------
* Function: H5Pget_file_space_page_size
*
* Purpose: Retrieves the file space page size for aggregating small metadata
* or raw data in the parameter "fsp_size".
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; August 2012
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_file_space_page_size(hid_t plist_id, hsize_t *fsp_size)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", plist_id, fsp_size);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get value */
if(fsp_size)
if(H5P_get(plist, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, fsp_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file space page size")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_file_space_page_size() */
|