forked from HDFGroup/hdf5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathH5CX.c
3362 lines (2783 loc) · 127 KB
/
H5CX.c
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
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* 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 LICENSE file, which can be found at the root of the source code *
* distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* [email protected]. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Purpose:
* Keep a set of "psuedo-global" information for an API call. This
* general corresponds to the DXPL for the call, along with cached
* information from them.
*/
/****************/
/* Module Setup */
/****************/
#include "H5CXmodule.h" /* This source code file is part of the H5CX module */
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
/****************/
/* Local Macros */
/****************/
#ifdef H5_HAVE_THREADSAFE_API
/*
* The per-thread API context.
*
* In order for this macro to work, H5CX_get_my_context() must be preceded
* by "H5CX_node_t **ctx =".
*/
#define H5CX_get_my_context() H5TS_get_api_ctx_ptr()
#else /* H5_HAVE_THREADSAFE_API */
/*
* The current API context.
*/
#define H5CX_get_my_context() (&H5CX_head_g)
#endif /* H5_HAVE_THREADSAFE_API */
/* Common macro for the retrieving the pointer to a property list */
#define H5CX_RETRIEVE_PLIST(PL, FAILVAL) \
/* Check if the property list is already available */ \
if (NULL == (*head)->ctx.PL) \
/* Get the property list pointer */ \
if (H5_UNLIKELY(NULL == \
((*head)->ctx.PL = (H5P_genplist_t *)H5I_object((*head)->ctx.H5_GLUE(PL, _id))))) \
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, (FAILVAL), "can't get property list");
/* Common macro for the duplicated code to retrieve properties from a property list */
#define H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
{ \
\
/* Check for default property list */ \
if ((*head)->ctx.H5_GLUE(PL, _id) == (DEF_PL)) \
H5MM_memcpy(&(*head)->ctx.PROP_FIELD, &H5_GLUE3(H5CX_def_, PL, _cache).PROP_FIELD, \
sizeof(H5_GLUE3(H5CX_def_, PL, _cache).PROP_FIELD)); \
else { \
/* Retrieve the property list */ \
H5CX_RETRIEVE_PLIST(PL, FAIL) \
\
/* Get the property */ \
if (H5_UNLIKELY(H5P_get((*head)->ctx.PL, (PROP_NAME), &(*head)->ctx.PROP_FIELD) < 0)) \
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't retrieve value from API context"); \
} /* end else */ \
\
/* Mark the field as valid */ \
(*head)->ctx.H5_GLUE(PROP_FIELD, _valid) = true; \
}
/* Macro for the duplicated code to retrieve a value from a plist if the context value is invalid */
#define H5CX_RETRIEVE_PROP_VALID(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
/* Check if the value has been retrieved already */ \
if (!(*head)->ctx.H5_GLUE(PROP_FIELD, _valid)) \
H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD)
/* Macro for the duplicated code to retrieve a value from a plist if the context value is invalid, or the
* library has previously modified the context value for return */
#define H5CX_RETRIEVE_PROP_VALID_SET(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
/* Check if the value has been retrieved already */ \
if (!((*head)->ctx.H5_GLUE(PROP_FIELD, _valid) || (*head)->ctx.H5_GLUE(PROP_FIELD, _set))) \
H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD)
#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_INSTRUMENTED_LIBRARY)
/* Macro for the duplicated code to set a context field that may not exist as a property */
#define H5CX_TEST_SET_PROP(PROP_NAME, PROP_FIELD) \
{ \
htri_t check_prop = 0; /* Whether the property exists in the API context's DXPL */ \
\
/* Check if property exists in DXPL */ \
if (!(*head)->ctx.H5_GLUE(PROP_FIELD, _set)) { \
/* Retrieve the dataset transfer property list */ \
H5CX_RETRIEVE_PLIST(dxpl, FAIL) \
\
if (H5_UNLIKELY((check_prop = H5P_exist_plist((*head)->ctx.dxpl, PROP_NAME)) < 0)) \
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "error checking for property"); \
} /* end if */ \
\
/* If property was already set or exists (for first set), update it */ \
if ((*head)->ctx.H5_GLUE(PROP_FIELD, _set) || check_prop > 0) { \
/* Cache the value for later, marking it to set in DXPL when context popped */ \
(*head)->ctx.PROP_FIELD = PROP_FIELD; \
(*head)->ctx.H5_GLUE(PROP_FIELD, _set) = true; \
} /* end if */ \
}
#endif /* defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_INSTRUMENTED_LIBRARY) */
/* Macro for the duplicated code to test and set properties for a property list from the context */
#define H5CX_SET_PROP(PROP_NAME, PROP_FIELD) \
if ((*head)->ctx.H5_GLUE(PROP_FIELD, _set)) { \
/* Retrieve the dataset transfer property list */ \
H5CX_RETRIEVE_PLIST(dxpl, FAIL) \
\
/* Set the property */ \
if (H5_UNLIKELY(H5P_set((*head)->ctx.dxpl, PROP_NAME, &(*head)->ctx.PROP_FIELD) < 0)) \
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, FAIL, "error setting data xfer property"); \
} /* end if */
/******************/
/* Local Typedefs */
/******************/
/* Typedef for cached default dataset transfer property list information */
/* This is initialized to the values in the default DXPL during package
* initialization and then remains constant for the rest of the library's
* operation. When a field in H5CX_t is retrieved from an API context that
* uses a default DXPL, this value is copied instead of spending time looking
* up the property in the DXPL.
*/
typedef struct H5CX_dxpl_cache_t {
size_t max_temp_buf; /* Maximum temporary buffer size (H5D_XFER_MAX_TEMP_BUF_NAME) */
void *tconv_buf; /* Temporary conversion buffer (H5D_XFER_TCONV_BUF_NAME) */
void *bkgr_buf; /* Background conversion buffer (H5D_XFER_BKGR_BUF_NAME) */
H5T_bkg_t bkgr_buf_type; /* Background buffer type (H5D_XFER_BKGR_BUF_NAME) */
double btree_split_ratio[3]; /* B-tree split ratios (H5D_XFER_BTREE_SPLIT_RATIO_NAME) */
size_t vec_size; /* Size of hyperslab vector (H5D_XFER_HYPER_VECTOR_SIZE_NAME) */
#ifdef H5_HAVE_PARALLEL
H5FD_mpio_xfer_t io_xfer_mode; /* Parallel transfer mode for this request (H5D_XFER_IO_XFER_MODE_NAME) */
H5FD_mpio_collective_opt_t mpio_coll_opt; /* Parallel transfer with independent IO or collective IO with
this mode (H5D_XFER_MPIO_COLLECTIVE_OPT_NAME) */
uint32_t mpio_local_no_coll_cause; /* Local reason for breaking collective I/O
(H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME) */
uint32_t mpio_global_no_coll_cause; /* Global reason for breaking collective I/O
(H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME) */
H5FD_mpio_chunk_opt_t
mpio_chunk_opt_mode; /* Collective chunk option (H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME) */
unsigned mpio_chunk_opt_num; /* Collective chunk threshold (H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME) */
unsigned mpio_chunk_opt_ratio; /* Collective chunk ratio (H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME) */
#endif /* H5_HAVE_PARALLEL */
H5Z_EDC_t err_detect; /* Error detection info (H5D_XFER_EDC_NAME) */
H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */
H5Z_data_xform_t *data_transform; /* Data transform info (H5D_XFER_XFORM_NAME) */
H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */
H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */
H5D_selection_io_mode_t selection_io_mode; /* Selection I/O mode (H5D_XFER_SELECTION_IO_MODE_NAME) */
uint32_t no_selection_io_cause; /* Reasons for not performing selection I/O
(H5D_XFER_NO_SELECTION_IO_CAUSE_NAME) */
uint32_t actual_selection_io_mode; /* Actual selection I/O mode
(H5D_XFER_ACTUAL_SELECTION_IO_MODE_NAME) */
bool modify_write_buf; /* Whether the library can modify write buffers */
} H5CX_dxpl_cache_t;
/* Typedef for cached default link creation property list information */
/* (Same as the cached DXPL struct, above, except for the default LCPL) */
typedef struct H5CX_lcpl_cache_t {
H5T_cset_t encoding; /* Link name character encoding */
unsigned intermediate_group; /* Whether to create intermediate groups */
} H5CX_lcpl_cache_t;
/* Typedef for cached default link access property list information */
/* (Same as the cached DXPL struct, above, except for the default LAPL) */
typedef struct H5CX_lapl_cache_t {
size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
} H5CX_lapl_cache_t;
/* Typedef for cached default dataset creation property list information */
/* (Same as the cached DXPL struct, above, except for the default DCPL) */
typedef struct H5CX_dcpl_cache_t {
bool do_min_dset_ohdr; /* Whether to minimize dataset object header */
uint8_t ohdr_flags; /* Object header flags */
} H5CX_dcpl_cache_t;
/* Typedef for cached default dataset access property list information */
/* (Same as the cached DXPL struct, above, except for the default DXPL) */
typedef struct H5CX_dapl_cache_t {
const char *extfile_prefix; /* Prefix for external file */
const char *vds_prefix; /* Prefix for VDS */
} H5CX_dapl_cache_t;
/* Typedef for cached default file access property list information */
/* (Same as the cached DXPL struct, above, except for the default DCPL) */
typedef struct H5CX_fapl_cache_t {
H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds() */
H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds */
} H5CX_fapl_cache_t;
/********************/
/* Local Prototypes */
/********************/
/*********************/
/* Package Variables */
/*********************/
/* Package initialization variable */
bool H5_PKG_INIT_VAR = false;
/*******************/
/* Local Variables */
/*******************/
#ifndef H5_HAVE_THREADSAFE_API
static H5CX_node_t *H5CX_head_g = NULL; /* Pointer to head of context stack */
#endif /* H5_HAVE_THREADSAFE_API */
/* Define a "default" dataset transfer property list cache structure to use for default DXPLs */
static H5CX_dxpl_cache_t H5CX_def_dxpl_cache;
/* Define a "default" link creation property list cache structure to use for default LCPLs */
static H5CX_lcpl_cache_t H5CX_def_lcpl_cache;
/* Define a "default" link access property list cache structure to use for default LAPLs */
static H5CX_lapl_cache_t H5CX_def_lapl_cache;
/* Define a "default" dataset creation property list cache structure to use for default DCPLs */
static H5CX_dcpl_cache_t H5CX_def_dcpl_cache;
/* Define a "default" dataset access property list cache structure to use for default DAPLs */
static H5CX_dapl_cache_t H5CX_def_dapl_cache;
/* Define a "default" file access property list cache structure to use for default FAPLs */
static H5CX_fapl_cache_t H5CX_def_fapl_cache;
/* Declare a static free list to manage H5CX_state_t structs */
H5FL_DEFINE_STATIC(H5CX_state_t);
/*--------------------------------------------------------------------------
NAME
H5CX__init_package -- Initialize interface-specific information
USAGE
herr_t H5CX__init_package()
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
Initializes any interface-specific data or routines.
--------------------------------------------------------------------------*/
herr_t
H5CX__init_package(void)
{
H5P_genplist_t *dx_plist; /* Data transfer property list */
H5P_genplist_t *lc_plist; /* Link creation property list */
H5P_genplist_t *la_plist; /* Link access property list */
H5P_genplist_t *dc_plist; /* Dataset creation property list */
H5P_genplist_t *da_plist; /* Dataset access property list */
H5P_genplist_t *fa_plist; /* File access property list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Reset the "default DXPL cache" information */
memset(&H5CX_def_dxpl_cache, 0, sizeof(H5CX_dxpl_cache_t));
/* Get the default DXPL cache information */
/* Get the default dataset transfer property list */
if (NULL == (dx_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset transfer property list");
/* Get B-tree split ratios */
if (H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &H5CX_def_dxpl_cache.btree_split_ratio) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios");
/* Get maximum temporary buffer size value */
if (H5P_get(dx_plist, H5D_XFER_MAX_TEMP_BUF_NAME, &H5CX_def_dxpl_cache.max_temp_buf) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve maximum temporary buffer size");
/* Get temporary buffer pointer */
if (H5P_get(dx_plist, H5D_XFER_TCONV_BUF_NAME, &H5CX_def_dxpl_cache.tconv_buf) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve temporary buffer pointer");
/* Get background buffer pointer */
if (H5P_get(dx_plist, H5D_XFER_BKGR_BUF_NAME, &H5CX_def_dxpl_cache.bkgr_buf) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve background buffer pointer");
/* Get background buffer type */
if (H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &H5CX_def_dxpl_cache.bkgr_buf_type) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve background buffer type");
/* Get I/O vector size */
if (H5P_get(dx_plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &H5CX_def_dxpl_cache.vec_size) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve I/O vector size");
#ifdef H5_HAVE_PARALLEL
/* Collect Parallel I/O information for possible later use */
if (H5P_get(dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &H5CX_def_dxpl_cache.io_xfer_mode) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method");
if (H5P_get(dx_plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &H5CX_def_dxpl_cache.mpio_coll_opt) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve collective transfer option");
if (H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, &H5CX_def_dxpl_cache.mpio_chunk_opt_mode) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve chunk optimization option");
if (H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, &H5CX_def_dxpl_cache.mpio_chunk_opt_num) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve chunk optimization threshold");
if (H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, &H5CX_def_dxpl_cache.mpio_chunk_opt_ratio) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve chunk optimization ratio");
/* Get the local & global reasons for breaking collective I/O values */
if (H5P_get(dx_plist, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME,
&H5CX_def_dxpl_cache.mpio_local_no_coll_cause) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve local cause for breaking collective I/O");
if (H5P_get(dx_plist, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME,
&H5CX_def_dxpl_cache.mpio_global_no_coll_cause) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL,
"Can't retrieve global cause for breaking collective I/O");
#endif /* H5_HAVE_PARALLEL */
/* Get error detection properties */
if (H5P_get(dx_plist, H5D_XFER_EDC_NAME, &H5CX_def_dxpl_cache.err_detect) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve error detection info");
/* Get filter callback function */
if (H5P_get(dx_plist, H5D_XFER_FILTER_CB_NAME, &H5CX_def_dxpl_cache.filter_cb) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve filter callback function");
/* Look at the data transform property */
/* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need
* to copy it and free this in the H5CX terminate routine. -QAK)
*/
if (H5P_peek(dx_plist, H5D_XFER_XFORM_NAME, &H5CX_def_dxpl_cache.data_transform) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve data transform info");
/* Get VL datatype alloc info */
if (H5P_get(dx_plist, H5D_XFER_VLEN_ALLOC_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.alloc_func) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info");
if (H5P_get(dx_plist, H5D_XFER_VLEN_ALLOC_INFO_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.alloc_info) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info");
if (H5P_get(dx_plist, H5D_XFER_VLEN_FREE_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.free_func) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info");
if (H5P_get(dx_plist, H5D_XFER_VLEN_FREE_INFO_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.free_info) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info");
/* Get datatype conversion struct */
if (H5P_get(dx_plist, H5D_XFER_CONV_CB_NAME, &H5CX_def_dxpl_cache.dt_conv_cb) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve datatype conversion exception callback");
/* Get the selection I/O mode */
if (H5P_get(dx_plist, H5D_XFER_SELECTION_IO_MODE_NAME, &H5CX_def_dxpl_cache.selection_io_mode) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve selection I/O mode");
/* Get the local & global reasons for breaking selection I/O values */
if (H5P_get(dx_plist, H5D_XFER_NO_SELECTION_IO_CAUSE_NAME, &H5CX_def_dxpl_cache.no_selection_io_cause) <
0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve cause for no selection I/O");
/* Get the actual selection I/O mode */
if (H5P_get(dx_plist, H5D_XFER_ACTUAL_SELECTION_IO_MODE_NAME,
&H5CX_def_dxpl_cache.actual_selection_io_mode) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve actual selection I/O mode");
/* Get the modify write buffer property */
if (H5P_get(dx_plist, H5D_XFER_MODIFY_WRITE_BUF_NAME, &H5CX_def_dxpl_cache.modify_write_buf) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve modify write buffer property");
/* Reset the "default LCPL cache" information */
memset(&H5CX_def_lcpl_cache, 0, sizeof(H5CX_lcpl_cache_t));
/* Get the default LCPL cache information */
/* Get the default link creation property list */
if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(H5P_LINK_CREATE_DEFAULT)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a link creation property list");
/* Get link name character encoding */
if (H5P_get(lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &H5CX_def_lcpl_cache.encoding) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve link name encoding");
/* Get flag whether to create intermediate groups */
if (H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &H5CX_def_lcpl_cache.intermediate_group) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve intermediate group creation flag");
/* Reset the "default LAPL cache" information */
memset(&H5CX_def_lapl_cache, 0, sizeof(H5CX_lapl_cache_t));
/* Get the default LAPL cache information */
/* Get the default link access property list */
if (NULL == (la_plist = (H5P_genplist_t *)H5I_object(H5P_LINK_ACCESS_DEFAULT)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a link access property list");
/* Get number of soft / UD links to traverse */
if (H5P_get(la_plist, H5L_ACS_NLINKS_NAME, &H5CX_def_lapl_cache.nlinks) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve number of soft / UD links to traverse");
/* Reset the "default DCPL cache" information */
memset(&H5CX_def_dcpl_cache, 0, sizeof(H5CX_dcpl_cache_t));
/* Get the default DCPL cache information */
/* Get the default dataset creation property list */
if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_CREATE_DEFAULT)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list");
/* Get flag to indicate whether to minimize dataset object header */
if (H5P_get(dc_plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &H5CX_def_dcpl_cache.do_min_dset_ohdr) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag");
/* Get object header flags */
if (H5P_get(dc_plist, H5O_CRT_OHDR_FLAGS_NAME, &H5CX_def_dcpl_cache.ohdr_flags) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve object header flags");
/* Reset the "default DAPL cache" information */
memset(&H5CX_def_dapl_cache, 0, sizeof(H5CX_dapl_cache_t));
/* Get the default DAPL cache information */
/* Get the default dataset access property list */
if (NULL == (da_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_ACCESS_DEFAULT)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list");
/* Get the prefix for the external file */
if (H5P_peek(da_plist, H5D_ACS_EFILE_PREFIX_NAME, &H5CX_def_dapl_cache.extfile_prefix) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for external file");
/* Get the prefix for the VDS file */
if (H5P_peek(da_plist, H5D_ACS_VDS_PREFIX_NAME, &H5CX_def_dapl_cache.vds_prefix) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for VDS");
/* Reset the "default FAPL cache" information */
memset(&H5CX_def_fapl_cache, 0, sizeof(H5CX_fapl_cache_t));
/* Get the default FAPL cache information */
/* Get the default file access property list */
if (NULL == (fa_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list");
/* Get low_bound */
if (H5P_get(fa_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &H5CX_def_fapl_cache.low_bound) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag");
if (H5P_get(fa_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &H5CX_def_fapl_cache.high_bound) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag");
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX__init_package() */
/*-------------------------------------------------------------------------
* Function: H5CX_term_package
*
* Purpose: Terminate this interface.
*
* Return: Success: Positive if anything was done that might
* affect other interfaces; zero otherwise.
* Failure: Negative.
*
*-------------------------------------------------------------------------
*/
int
H5CX_term_package(void)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
if (H5_PKG_INIT_VAR) {
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
/* Get the pointer to the head of the API context, for this thread */
head = H5CX_get_my_context();
assert(head);
/* Reset head of context list */
*head = NULL;
H5_PKG_INIT_VAR = false;
} /* end if */
FUNC_LEAVE_NOAPI(0)
} /* end H5CX_term_package() */
/*-------------------------------------------------------------------------
* Function: H5CX_pushed
*
* Purpose: Returns whether or not an API context has been pushed.
*
* Return: true/false
*
*-------------------------------------------------------------------------
*/
bool
H5CX_pushed(void)
{
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
bool is_pushed = false; /* Flag to indicate context is pushed */
FUNC_ENTER_NOAPI_NOINIT_NOERR
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
assert(head);
/* Set return value */
is_pushed = (*head != NULL);
FUNC_LEAVE_NOAPI(is_pushed)
}
/*-------------------------------------------------------------------------
* Function: H5CX_push
*
* Purpose: Pushes a context for an API call.
*
* Return: Non-negative on success / Negative on failure
*
*-------------------------------------------------------------------------
*/
herr_t
H5CX_push(H5CX_node_t *cnode)
{
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
assert(cnode);
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
assert(head);
/* Set non-zero context info */
cnode->ctx.dxpl_id = H5P_DATASET_XFER_DEFAULT;
cnode->ctx.dcpl_id = H5P_DATASET_CREATE_DEFAULT;
cnode->ctx.dapl_id = H5P_DATASET_ACCESS_DEFAULT;
cnode->ctx.lcpl_id = H5P_LINK_CREATE_DEFAULT;
cnode->ctx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
cnode->ctx.fapl_id = H5P_FILE_ACCESS_DEFAULT;
cnode->ctx.tag = H5AC__INVALID_TAG;
cnode->ctx.ring = H5AC_RING_USER;
#ifdef H5_HAVE_PARALLEL
cnode->ctx.btype = MPI_BYTE;
cnode->ctx.ftype = MPI_BYTE;
#endif
/* Push context node onto stack */
cnode->next = *head;
*head = cnode;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_push() */
/*-------------------------------------------------------------------------
* Function: H5CX_retrieve_state
*
* Purpose: Retrieve the state of an API context, for later resumption.
*
* Note: This routine _only_ tracks the state of API context information
* set before the VOL callback is invoked, not values that are
* set internal to the library. It's main purpose is to provide
* API context state to VOL connectors.
*
* Return: Non-negative on success / Negative on failure
*
*-------------------------------------------------------------------------
*/
herr_t
H5CX_retrieve_state(H5CX_state_t **api_state)
{
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
assert(head && *head);
assert(api_state);
/* Allocate & clear API context state */
if (NULL == (*api_state = H5FL_CALLOC(H5CX_state_t)))
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "unable to allocate new API context state");
/* Check for non-default DCPL */
if (H5P_DATASET_CREATE_DEFAULT != (*head)->ctx.dcpl_id) {
/* Retrieve the DCPL property list */
H5CX_RETRIEVE_PLIST(dcpl, FAIL)
/* Copy the DCPL ID */
if (((*api_state)->dcpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.dcpl, false)) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list");
} /* end if */
else
(*api_state)->dcpl_id = H5P_DATASET_CREATE_DEFAULT;
/* Check for non-default DXPL */
if (H5P_DATASET_XFER_DEFAULT != (*head)->ctx.dxpl_id) {
/* Retrieve the DXPL property list */
H5CX_RETRIEVE_PLIST(dxpl, FAIL)
/* Copy the DXPL ID */
if (((*api_state)->dxpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.dxpl, false)) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list");
} /* end if */
else
(*api_state)->dxpl_id = H5P_DATASET_XFER_DEFAULT;
/* Check for non-default LAPL */
if (H5P_LINK_ACCESS_DEFAULT != (*head)->ctx.lapl_id) {
/* Retrieve the LAPL property list */
H5CX_RETRIEVE_PLIST(lapl, FAIL)
/* Copy the LAPL ID */
if (((*api_state)->lapl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.lapl, false)) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list");
} /* end if */
else
(*api_state)->lapl_id = H5P_LINK_ACCESS_DEFAULT;
/* Check for non-default LCPL */
if (H5P_LINK_CREATE_DEFAULT != (*head)->ctx.lcpl_id) {
/* Retrieve the LCPL property list */
H5CX_RETRIEVE_PLIST(lcpl, FAIL)
/* Copy the LCPL ID */
if (((*api_state)->lcpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.lcpl, false)) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list");
} /* end if */
else
(*api_state)->lcpl_id = H5P_LINK_CREATE_DEFAULT;
/* Keep a reference to the current VOL wrapping context */
(*api_state)->vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx;
if (NULL != (*api_state)->vol_wrap_ctx) {
assert((*head)->ctx.vol_wrap_ctx_valid);
if (H5VL_inc_vol_wrapper((*api_state)->vol_wrap_ctx) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTINC, FAIL, "can't increment refcount on VOL wrapping context");
} /* end if */
/* Keep a copy of the VOL connector property, if there is one */
if ((*head)->ctx.vol_connector_prop_valid && (*head)->ctx.vol_connector_prop.connector) {
/* Get the connector property */
H5MM_memcpy(&(*api_state)->vol_connector_prop, &(*head)->ctx.vol_connector_prop,
sizeof(H5VL_connector_prop_t));
/* Check for actual VOL connector property */
if ((*api_state)->vol_connector_prop.connector) {
/* Copy connector info, if it exists */
if ((*api_state)->vol_connector_prop.connector_info) {
void *new_connector_info = NULL; /* Copy of connector info */
/* Allocate and copy connector info */
if (H5VL_copy_connector_info((*api_state)->vol_connector_prop.connector, &new_connector_info,
(*api_state)->vol_connector_prop.connector_info) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "connector info copy failed");
(*api_state)->vol_connector_prop.connector_info = new_connector_info;
} /* end if */
/* Increment the refcount on the connector */
if (H5VL_conn_inc_rc((*api_state)->vol_connector_prop.connector) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTINC, FAIL, "incrementing VOL connector refcount failed");
} /* end if */
} /* end if */
#ifdef H5_HAVE_PARALLEL
/* Save parallel I/O settings */
(*api_state)->coll_metadata_read = (*head)->ctx.coll_metadata_read;
#endif /* H5_HAVE_PARALLEL */
done:
/* Cleanup on error */
if (ret_value < 0) {
if (*api_state) {
/* Release the (possibly partially allocated) API state struct */
if (H5CX_free_state(*api_state) < 0)
HDONE_ERROR(H5E_CONTEXT, H5E_CANTRELEASE, FAIL, "unable to release API state");
*api_state = NULL;
} /* end if */
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_retrieve_state() */
/*-------------------------------------------------------------------------
* Function: H5CX_restore_state
*
* Purpose: Restore an API context, from a previously retrieved state.
*
* Note: This routine _only_ resets the state of API context information
* set before the VOL callback is invoked, not values that are
* set internal to the library. It's main purpose is to restore
* API context state from VOL connectors.
*
* Return: Non-negative on success / Negative on failure
*
*-------------------------------------------------------------------------
*/
herr_t
H5CX_restore_state(const H5CX_state_t *api_state)
{
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
assert(head && *head);
assert(api_state);
/* Restore the DCPL info */
(*head)->ctx.dcpl_id = api_state->dcpl_id;
(*head)->ctx.dcpl = NULL;
/* Restore the DXPL info */
(*head)->ctx.dxpl_id = api_state->dxpl_id;
(*head)->ctx.dxpl = NULL;
/* Restore the LAPL info */
(*head)->ctx.lapl_id = api_state->lapl_id;
(*head)->ctx.lapl = NULL;
/* Restore the LCPL info */
(*head)->ctx.lcpl_id = api_state->lcpl_id;
(*head)->ctx.lcpl = NULL;
/* Restore the VOL wrapper context */
(*head)->ctx.vol_wrap_ctx = api_state->vol_wrap_ctx;
if (NULL != (*head)->ctx.vol_wrap_ctx)
(*head)->ctx.vol_wrap_ctx_valid = true;
/* Restore the VOL connector info */
if (api_state->vol_connector_prop.connector) {
H5MM_memcpy(&(*head)->ctx.vol_connector_prop, &api_state->vol_connector_prop,
sizeof(H5VL_connector_prop_t));
(*head)->ctx.vol_connector_prop_valid = true;
} /* end if */
#ifdef H5_HAVE_PARALLEL
/* Restore parallel I/O settings */
(*head)->ctx.coll_metadata_read = api_state->coll_metadata_read;
#endif /* H5_HAVE_PARALLEL */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5CX_restore_state() */
/*-------------------------------------------------------------------------
* Function: H5CX_free_state
*
* Purpose: Free a previously retrieved API context state
*
* Return: Non-negative on success / Negative on failure
*
*-------------------------------------------------------------------------
*/
herr_t
H5CX_free_state(H5CX_state_t *api_state)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
assert(api_state);
/* Release the DCPL */
if (0 != api_state->dcpl_id && H5P_DATASET_CREATE_DEFAULT != api_state->dcpl_id)
if (H5I_dec_ref(api_state->dcpl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DCPL");
/* Release the DXPL */
if (0 != api_state->dxpl_id && H5P_DATASET_XFER_DEFAULT != api_state->dxpl_id)
if (H5I_dec_ref(api_state->dxpl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DXPL");
/* Release the LAPL */
if (0 != api_state->lapl_id && H5P_LINK_ACCESS_DEFAULT != api_state->lapl_id)
if (H5I_dec_ref(api_state->lapl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LAPL");
/* Release the LCPL */
if (0 != api_state->lcpl_id && H5P_LINK_CREATE_DEFAULT != api_state->lcpl_id)
if (H5I_dec_ref(api_state->lcpl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LCPL");
/* Release the VOL wrapper context */
if (api_state->vol_wrap_ctx)
if (H5VL_dec_vol_wrapper(api_state->vol_wrap_ctx) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on VOL wrapping context");
/* Release the VOL connector property, if it was set */
if (api_state->vol_connector_prop.connector) {
/* Clean up any VOL connector info */
if (api_state->vol_connector_prop.connector_info)
if (H5VL_free_connector_info(api_state->vol_connector_prop.connector,
api_state->vol_connector_prop.connector_info) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTRELEASE, FAIL,
"unable to release VOL connector info object");
/* Decrement connector refcount */
if (H5VL_conn_dec_rc(api_state->vol_connector_prop.connector) < 0)
HDONE_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't close VOL connector");
} /* end if */
/* Free the state */
api_state = H5FL_FREE(H5CX_state_t, api_state);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_free_state() */
/*-------------------------------------------------------------------------
* Function: H5CX_is_def_dxpl
*
* Purpose: Checks if the API context is using the library's default DXPL
*
* Return: true / false (can't fail)
*
*-------------------------------------------------------------------------
*/
bool
H5CX_is_def_dxpl(void)
{
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
bool is_def_dxpl = false; /* Flag to indicate DXPL is default */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
assert(head && *head);
/* Set return value */
is_def_dxpl = ((*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT);
FUNC_LEAVE_NOAPI(is_def_dxpl)
} /* end H5CX_is_def_dxpl() */
/*-------------------------------------------------------------------------
* Function: H5CX_set_dxpl
*
* Purpose: Sets the DXPL for the current API call context.
*
* Return: <none>
*
*-------------------------------------------------------------------------
*/
void
H5CX_set_dxpl(hid_t dxpl_id)
{
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
assert(head && *head);
/* Set the API context's DXPL to a new value */
(*head)->ctx.dxpl_id = dxpl_id;
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_dxpl() */
/*-------------------------------------------------------------------------
* Function: H5CX_set_dcpl
*
* Purpose: Sets the DCPL for the current API call context.
*
* Return: <none>
*
*-------------------------------------------------------------------------
*/
void
H5CX_set_dcpl(hid_t dcpl_id)
{
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
assert(head && *head);
/* Set the API context's DCPL to a new value */
(*head)->ctx.dcpl_id = dcpl_id;
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_dcpl() */
/*-------------------------------------------------------------------------
* Function: H5CX_set_libver_bounds
*
* Purpose: Sets the low/high bounds according to "f" for the current API call context.
* When "f" is NULL, the low/high bounds are set to latest format.
*
* Return: Non-negative on success / Negative on failure
*
*-------------------------------------------------------------------------
*/
herr_t
H5CX_set_libver_bounds(H5F_t *f)
{
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
assert(head && *head);
/* Set the API context value */
(*head)->ctx.low_bound = (f == NULL) ? H5F_LIBVER_LATEST : H5F_LOW_BOUND(f);
(*head)->ctx.high_bound = (f == NULL) ? H5F_LIBVER_LATEST : H5F_HIGH_BOUND(f);
/* Mark the values as valid */
(*head)->ctx.low_bound_valid = true;
(*head)->ctx.high_bound_valid = true;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_set_libver_bounds() */
/*-------------------------------------------------------------------------
* Function: H5CX_set_lcpl
*
* Purpose: Sets the LCPL for the current API call context.
*
* Return: <none>
*
*-------------------------------------------------------------------------
*/
void
H5CX_set_lcpl(hid_t lcpl_id)
{
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
assert(head && *head);
/* Set the API context's LCPL to a new value */
(*head)->ctx.lcpl_id = lcpl_id;
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_lcpl() */
/*-------------------------------------------------------------------------
* Function: H5CX_set_lapl
*
* Purpose: Sets the LAPL for the current API call context.
*
* Return: <none>
*
*-------------------------------------------------------------------------
*/
void
H5CX_set_lapl(hid_t lapl_id)
{
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
assert(head && *head);
/* Set the API context's LAPL to a new value */
(*head)->ctx.lapl_id = lapl_id;
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_lapl() */
/*-------------------------------------------------------------------------
* Function: H5CX_set_apl
*
* Purpose: Validaties an access property list, and sanity checking &
* setting up collective operations.
*
* Return: Non-negative on success / Negative on failure
*
*-------------------------------------------------------------------------
*/
herr_t