Refactor allocation of API context (#4942)

Since each API context is local to a thread, use the stack to
store the context instead of allocating & releasing it each time.
This improves performance (slightly), reduces alloc/free calls,
and eliminates the H5FL package from the push & pop operations,
which helps simplify threadsafe operation.

One effect of this change is that the H5VLstart_lib_state /
H5VLfinish_lib_state API routines for pass through connector
authors now require a parameter that can be used to store
the library's context. It was probably a mistake to assume
that these two routines would not do this previously, so this
is essentially a bug fix for them.

Some other minor things:

 * Added API context push+pop operations to cache tests
  (I'm not actually certain why this was working before) and
  a few other places
* Cleaned up a bunch of warnings in test code (calloc args, mainly)
* Made header file inclusions more standard in some source files
This commit is contained in:
Quincey Koziol 2024-10-24 12:09:22 -05:00 committed by GitHub
parent 2c58357b8f
commit 97e1ed4fc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
58 changed files with 1354 additions and 954 deletions

View File

@ -121,6 +121,10 @@ New Features
Library:
--------
- The H5VLstart_lib_state / H5VLfinish_lib_state API routines for pass-
through connector authors now require a parameter that can be used to
store the library's context.
- Removed H5FDperform_init API routine. Virtual File Driver (VFD)
developers who wish to provide an ID for their driver should create
a routine specific to their individual implementation.

View File

@ -304,9 +304,10 @@ H5_term_library(void)
size_t at = 0;
char loop[1024];
H5E_auto2_t func;
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
/* Acquire the API lock */
H5CANCEL_DECL
FUNC_ENTER_API_VARS
H5_API_LOCK
/* Don't do anything if the library is already closed */
@ -317,7 +318,7 @@ H5_term_library(void)
H5_TERM_GLOBAL = true;
/* Push the API context without checking for errors */
H5CX_push_special();
H5CX_push(&api_ctx);
/* Check if we should display error output */
(void)H5Eget_auto2(H5E_DEFAULT, &func, NULL);

View File

@ -105,9 +105,10 @@ done:
herr_t
H5A__get_shared_rc_test(hid_t attr_id, hsize_t *ref_count)
{
H5A_t *attr; /* Attribute object for ID */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
H5A_t *attr; /* Attribute object for ID */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@ -116,7 +117,7 @@ H5A__get_shared_rc_test(hid_t attr_id, hsize_t *ref_count)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute");
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;

View File

@ -60,41 +60,43 @@
/* Check if the property list is already available */ \
if (NULL == (*head)->ctx.PL) \
/* Get the property list pointer */ \
if (NULL == ((*head)->ctx.PL = (H5P_genplist_t *)H5I_object((*head)->ctx.H5_GLUE(PL, _id)))) \
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 (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 */ \
/* 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) \
\
/* Mark the field as valid */ \
(*head)->ctx.H5_GLUE(PROP_FIELD, _valid) = true;
/* 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) \
} /* end if */
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) \
} /* end if */
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 */
@ -107,7 +109,7 @@
/* Retrieve the dataset transfer property list */ \
H5CX_RETRIEVE_PLIST(dxpl, FAIL) \
\
if ((check_prop = H5P_exist_plist((*head)->ctx.dxpl, PROP_NAME)) < 0) \
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 */ \
\
@ -124,247 +126,17 @@
#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, NULL) \
H5CX_RETRIEVE_PLIST(dxpl, FAIL) \
\
/* Set the property */ \
if (H5P_set((*head)->ctx.dxpl, PROP_NAME, &(*head)->ctx.PROP_FIELD) < 0) \
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, NULL, "error setting data xfer 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 context about each API call, as it proceeds */
/* Fields in this struct are of several types:
* - The DXPL & LAPL ID are either library default ones (from the API context
* initialization) or passed in from the application via an API call
* parameter. The corresponding H5P_genplist_t* is just the underlying
* property list struct for the ID, to optimize retrieving properties
* from the list multiple times.
*
* - Internal fields, used and set only within the library, for managing the
* operation under way. These do not correspond to properties in the
* DXPL or LAPL and can have any name.
*
* - Cached fields, which are not returned to the application, for managing
* the operation under way. These correspond to properties in the DXPL
* or LAPL, and are retrieved either from the (global) cache for a
* default property list, or from the corresponding property in the
* application's (non-default) property list. Getting / setting these
* properties within the library does _not_ affect the application's
* property list. Note that the naming of these fields, <foo> and
* <foo>_valid, is important for the H5CX_RETRIEVE_PROP_VALID
* macro to work properly.
*
* - "Return-only" properties that are returned to the application, mainly
* for sending out "introspection" information ("Why did collective I/O
* get broken for this operation?", "Which filters are set on the chunk I
* just directly read in?", etc) Setting these fields will cause the
* corresponding property in the property list to be set when the API
* context is popped, when returning from the API routine. Note that the
* naming of these fields, <foo> and <foo>_set, is important for the
* H5CX_TEST_SET_PROP and H5CX_SET_PROP macros to work properly.
*
* - "Return-and-read" properties that are returned to the application to send out introspection information,
* but are also queried by the library internally. If the context value has been 'set' by an accessor,
* all future queries will return the stored value from the context, to avoid later queries overwriting
* that stored value with the value from the property list.
*
* These properties have both a 'valid' and 'set' flag. <foo>_valid is true if the field has ever been
* populated from its underlying property list. <foo>_set flag is true if this field has ever been set on
* the context for application introspection. The naming of these fields is important for the
* H5CX_RETRIEVE_PROP_VALID_SET macro to work properly.
*
* If a field has been set on the context but never read internally, <foo>_valid will be false
* despite the context containing a meaningful cached value.
*/
typedef struct H5CX_t {
/* DXPL */
hid_t dxpl_id; /* DXPL ID for API operation */
H5P_genplist_t *dxpl; /* Dataset Transfer Property List */
/* LCPL */
hid_t lcpl_id; /* LCPL ID for API operation */
H5P_genplist_t *lcpl; /* Link Creation Property List */
/* LAPL */
hid_t lapl_id; /* LAPL ID for API operation */
H5P_genplist_t *lapl; /* Link Access Property List */
/* DCPL */
hid_t dcpl_id; /* DCPL ID for API operation */
H5P_genplist_t *dcpl; /* Dataset Creation Property List */
/* DAPL */
hid_t dapl_id; /* DAPL ID for API operation */
H5P_genplist_t *dapl; /* Dataset Access Property List */
/* FAPL */
hid_t fapl_id; /* FAPL ID for API operation */
H5P_genplist_t *fapl; /* File Access Property List */
/* Internal: Object tagging info */
haddr_t tag; /* Current object's tag (ohdr chunk #0 address) */
/* Internal: Metadata cache info */
H5AC_ring_t ring; /* Current metadata cache ring for entries */
#ifdef H5_HAVE_PARALLEL
/* Internal: Parallel I/O settings */
bool coll_metadata_read; /* Whether to use collective I/O for metadata read */
MPI_Datatype btype; /* MPI datatype for buffer, when using collective I/O */
MPI_Datatype ftype; /* MPI datatype for file, when using collective I/O */
bool mpi_file_flushing; /* Whether an MPI-opened file is being flushed */
bool rank0_bcast; /* Whether a dataset meets read-with-rank0-and-bcast requirements */
#endif /* H5_HAVE_PARALLEL */
/* Cached DXPL properties */
size_t max_temp_buf; /* Maximum temporary buffer size (H5D_XFER_MAX_TEMP_BUF_NAME) .*/
bool max_temp_buf_valid; /* Whether maximum temporary buffer size is valid */
void *tconv_buf; /* Temporary conversion buffer (H5D_XFER_TCONV_BUF_NAME) */
bool tconv_buf_valid; /* Whether temporary conversion buffer is valid */
void *bkgr_buf; /* Background conversion buffer (H5D_XFER_BKGR_BUF_NAME) */
bool bkgr_buf_valid; /* Whether background conversion buffer is valid */
H5T_bkg_t bkgr_buf_type; /* Background buffer type (H5D_XFER_BKGR_BUF_TYPE_NAME) */
bool bkgr_buf_type_valid; /* Whether background buffer type is valid */
double btree_split_ratio[3]; /* B-tree split ratios (H5D_XFER_BTREE_SPLIT_RATIO_NAME) */
bool btree_split_ratio_valid; /* Whether B-tree split ratios are valid */
size_t vec_size; /* Size of hyperslab vector (H5D_XFER_HYPER_VECTOR_SIZE_NAME) */
bool vec_size_valid; /* Whether hyperslab vector is valid */
#ifdef H5_HAVE_PARALLEL
H5FD_mpio_xfer_t io_xfer_mode; /* Parallel transfer mode for this request (H5D_XFER_IO_XFER_MODE_NAME) */
bool io_xfer_mode_valid; /* Whether parallel transfer mode is valid */
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) */
bool mpio_coll_opt_valid; /* Whether parallel transfer option is valid */
H5FD_mpio_chunk_opt_t
mpio_chunk_opt_mode; /* Collective chunk option (H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME) */
bool mpio_chunk_opt_mode_valid; /* Whether collective chunk option is valid */
unsigned mpio_chunk_opt_num; /* Collective chunk threshold (H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME) */
bool mpio_chunk_opt_num_valid; /* Whether collective chunk threshold is valid */
unsigned mpio_chunk_opt_ratio; /* Collective chunk ratio (H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME) */
bool mpio_chunk_opt_ratio_valid; /* Whether collective chunk ratio is valid */
#endif /* H5_HAVE_PARALLEL */
H5Z_EDC_t err_detect; /* Error detection info (H5D_XFER_EDC_NAME) */
bool err_detect_valid; /* Whether error detection info is valid */
H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */
bool filter_cb_valid; /* Whether filter callback function is valid */
H5Z_data_xform_t *data_transform; /* Data transform info (H5D_XFER_XFORM_NAME) */
bool data_transform_valid; /* Whether data transform info is valid */
H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */
bool vl_alloc_info_valid; /* Whether VL datatype alloc info is valid */
H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */
bool dt_conv_cb_valid; /* Whether datatype conversion struct is valid */
H5D_selection_io_mode_t selection_io_mode; /* Selection I/O mode (H5D_XFER_SELECTION_IO_MODE_NAME) */
bool selection_io_mode_valid; /* Whether selection I/O mode is valid */
bool modify_write_buf; /* Whether the library can modify write buffers (H5D_XFER_MODIFY_WRITE_BUF_NAME)*/
bool modify_write_buf_valid; /* Whether the modify_write_buf field is valid */
/* Return-only DXPL properties to return to application */
#ifdef H5_HAVE_PARALLEL
H5D_mpio_actual_chunk_opt_mode_t mpio_actual_chunk_opt; /* Chunk optimization mode used for parallel I/O
(H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME) */
bool mpio_actual_chunk_opt_set; /* Whether chunk optimization mode used for parallel I/O is set */
H5D_mpio_actual_io_mode_t
mpio_actual_io_mode; /* Actual I/O mode used for parallel I/O (H5D_MPIO_ACTUAL_IO_MODE_NAME) */
bool mpio_actual_io_mode_set; /* Whether actual I/O mode used for parallel I/O is set */
uint32_t mpio_local_no_coll_cause; /* Local reason for breaking collective I/O
(H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME) */
bool mpio_local_no_coll_cause_set; /* Whether local reason for breaking collective I/O is set */
bool mpio_local_no_coll_cause_valid; /* Whether local reason for breaking collective I/O is valid */
uint32_t mpio_global_no_coll_cause; /* Global reason for breaking collective I/O
(H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME) */
bool mpio_global_no_coll_cause_set; /* Whether global reason for breaking collective I/O is set */
bool mpio_global_no_coll_cause_valid; /* Whether global reason for breaking collective I/O is valid */
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
int mpio_coll_chunk_link_hard; /* Instrumented "collective chunk link hard" value
(H5D_XFER_COLL_CHUNK_LINK_HARD_NAME) */
bool mpio_coll_chunk_link_hard_set; /* Whether instrumented "collective chunk link hard" value is set */
int mpio_coll_chunk_multi_hard; /* Instrumented "collective chunk multi hard" value
(H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME) */
bool mpio_coll_chunk_multi_hard_set; /* Whether instrumented "collective chunk multi hard" value is set */
int mpio_coll_chunk_link_num_true; /* Instrumented "collective chunk link num true" value
(H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME) */
bool mpio_coll_chunk_link_num_true_set; /* Whether instrumented "collective chunk link num true" value
is set */
int mpio_coll_chunk_link_num_false; /* Instrumented "collective chunk link num false" value
(H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME) */
bool mpio_coll_chunk_link_num_false_set; /* Whether instrumented "collective chunk link num false"
value is set */
int mpio_coll_chunk_multi_ratio_coll; /* Instrumented "collective chunk multi ratio coll" value
(H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME) */
bool mpio_coll_chunk_multi_ratio_coll_set; /* Whether instrumented "collective chunk multi ratio coll"
value is set */
int mpio_coll_chunk_multi_ratio_ind; /* Instrumented "collective chunk multi ratio ind" value
(H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME) */
bool mpio_coll_chunk_multi_ratio_ind_set; /* Whether instrumented "collective chunk multi ratio ind"
value is set */
bool mpio_coll_rank0_bcast; /* Instrumented "collective rank 0 broadcast" value
(H5D_XFER_COLL_RANK0_BCAST_NAME) */
bool mpio_coll_rank0_bcast_set; /* Whether instrumented "collective rank 0 broadcast" value is set */
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
uint32_t no_selection_io_cause; /* Reason for not performing selection I/O
(H5D_XFER_NO_SELECTION_IO_CAUSE_NAME) */
bool no_selection_io_cause_set; /* Whether reason for not performing selection I/O is set */
bool no_selection_io_cause_valid; /* Whether reason for not performing selection I/O is valid */
uint32_t actual_selection_io_mode; /* Actual selection I/O mode used
(H5D_XFER_ACTUAL_SELECTION_IO_MODE_NAME) */
bool actual_selection_io_mode_set; /* Whether actual selection I/O mode is set */
bool actual_selection_io_mode_valid; /* Whether actual selection I/O mode is valid */
/* Cached LCPL properties */
H5T_cset_t encoding; /* Link name character encoding (H5P_STRCRT_CHAR_ENCODING_NAME) */
bool encoding_valid; /* Whether link name character encoding is valid */
unsigned intermediate_group; /* Whether to create intermediate groups (H5L_CRT_INTERMEDIATE_GROUP_NAME) */
bool intermediate_group_valid; /* Whether create intermediate group flag is valid */
/* Cached LAPL properties */
size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
bool nlinks_valid; /* Whether number of soft / UD links to traverse is valid */
/* Cached DCPL properties */
bool do_min_dset_ohdr; /* Whether to minimize dataset object header (H5D_CRT_MIN_DSET_HDR_SIZE_NAME) */
bool do_min_dset_ohdr_valid; /* Whether minimize dataset object header flag is valid */
uint8_t ohdr_flags; /* Object header flags (H5O_CRT_OHDR_FLAGS_NAME) */
bool ohdr_flags_valid; /* Whether the object headers flags are valid */
/* Cached DAPL properties */
const char *extfile_prefix; /* Prefix for external file (H5D_ACS_EFILE_PREFIX_NAME) */
bool extfile_prefix_valid; /* Whether the prefix for external file is valid */
const char *vds_prefix; /* Prefix for VDS (H5D_ACS_VDS_PREFIX_NAME) */
bool vds_prefix_valid; /* Whether the prefix for VDS is valid */
/* Cached FAPL properties */
H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds()
(H5F_ACS_LIBVER_LOW_BOUND_NAME) */
bool low_bound_valid; /* Whether low_bound property is valid */
H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds
(H5F_ACS_LIBVER_HIGH_BOUND_NAME) */
bool high_bound_valid; /* Whether high_bound property is valid */
/* Cached VOL settings */
H5VL_connector_prop_t vol_connector_prop; /* Property for VOL connector ID & info
This is treated as an independent field with
no relation to the property H5F_ACS_VOL_CONN_NAME stored on the FAPL */
bool vol_connector_prop_valid; /* Whether property for VOL connector ID & info is valid */
void *vol_wrap_ctx; /* VOL connector's "wrap context" for creating IDs */
bool vol_wrap_ctx_valid; /* Whether VOL connector's "wrap context" for creating IDs is valid */
} H5CX_t;
/* Typedef for nodes on the API context stack */
/* Each entry into the library through an API routine invokes H5CX_push()
* in a FUNC_ENTER_API* macro, which pushes an H5CX_node_t on the API
* context [thread-local] stack, after initializing it with default values
* in H5CX__push_common().
*/
typedef struct H5CX_node_t {
H5CX_t ctx; /* Context for current API call */
struct H5CX_node_t *next; /* Pointer to previous context, on stack */
} H5CX_node_t;
/* 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
@ -442,8 +214,6 @@ typedef struct H5CX_fapl_cache_t {
/********************/
/* Local Prototypes */
/********************/
static void H5CX__push_common(H5CX_node_t *cnode);
static H5CX_node_t *H5CX__pop_common(bool update_dxpl_props);
/*********************/
/* Package Variables */
@ -478,9 +248,6 @@ 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_node_t structs */
H5FL_DEFINE_STATIC(H5CX_node_t);
/* Declare a static free list to manage H5CX_state_t structs */
H5FL_DEFINE_STATIC(H5CX_state_t);
@ -711,19 +478,14 @@ H5CX_term_package(void)
FUNC_ENTER_NOAPI_NOINIT_NOERR
if (H5_PKG_INIT_VAR) {
H5CX_node_t *cnode; /* Context node */
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
/* Pop the top context node from the stack */
/* (Can't check for errors, as rest of library is shut down) */
cnode = H5CX__pop_common(false);
/* Get the pointer to the head of the API context, for this thread */
head = H5CX_get_my_context();
assert(head);
/* Free the context node */
/* (Allocated with malloc() in H5CX_push_special() ) */
free(cnode);
#ifndef H5_HAVE_THREADSAFE
H5CX_head_g = NULL;
#endif /* H5_HAVE_THREADSAFE */
/* Reset head of context list */
*head = NULL;
H5_PKG_INIT_VAR = false;
} /* end if */
@ -758,20 +520,21 @@ H5CX_pushed(void)
}
/*-------------------------------------------------------------------------
* Function: H5CX__push_common
* Function: H5CX_push
*
* Purpose: Internal routine to push a context for an API call.
* Purpose: Pushes a context for an API call.
*
* Return: Non-negative on success / Negative on failure
*
*-------------------------------------------------------------------------
*/
static void
H5CX__push_common(H5CX_node_t *cnode)
herr_t
H5CX_push(H5CX_node_t *cnode)
{
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_NOERR
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
assert(cnode);
@ -797,65 +560,10 @@ H5CX__push_common(H5CX_node_t *cnode)
cnode->next = *head;
*head = cnode;
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX__push_common() */
/*-------------------------------------------------------------------------
* Function: H5CX_push
*
* Purpose: Pushes a context for an API call.
*
* Return: Non-negative on success / Negative on failure
*
*-------------------------------------------------------------------------
*/
herr_t
H5CX_push(void)
{
H5CX_node_t *cnode = NULL; /* Context node */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Allocate & clear API context node */
if (NULL == (cnode = H5FL_CALLOC(H5CX_node_t)))
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "unable to allocate new struct");
/* Set context info */
H5CX__push_common(cnode);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_push() */
/*-------------------------------------------------------------------------
* Function: H5CX_push_special
*
* Purpose: Pushes a context for an API call, without using library routines.
*
* Note: This should only be called in special circumstances, like H5close.
*
* Return: <none>
*
*-------------------------------------------------------------------------
*/
void
H5CX_push_special(void)
{
H5CX_node_t *cnode = NULL; /* Context node */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Allocate & clear API context node, without using library API routines */
cnode = (H5CX_node_t *)calloc(1, sizeof(H5CX_node_t));
assert(cnode);
/* Set context info */
H5CX__push_common(cnode);
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_push_special() */
/*-------------------------------------------------------------------------
* Function: H5CX_retrieve_state
*
@ -3596,21 +3304,21 @@ done:
} /* End H5CX_get_ohdr_flags() */
/*-------------------------------------------------------------------------
* Function: H5CX__pop_common
* Function: H5CX_pop
*
* Purpose: Common code for popping the context for an API call.
* Purpose: Pops the context for an API call.
*
* Return: Non-negative on success / Negative on failure
*
*-------------------------------------------------------------------------
*/
static H5CX_node_t *
H5CX__pop_common(bool update_dxpl_props)
herr_t
H5CX_pop(bool update_dxpl_props)
{
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
H5CX_node_t *ret_value = NULL; /* Return value */
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
@ -3647,36 +3355,7 @@ H5CX__pop_common(bool update_dxpl_props)
} /* end if */
/* Pop the top context node from the stack */
ret_value = (*head);
(*head) = (*head)->next;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX__pop_common() */
/*-------------------------------------------------------------------------
* Function: H5CX_pop
*
* Purpose: Pops the context for an API call.
*
* Return: Non-negative on success / Negative on failure
*
*-------------------------------------------------------------------------
*/
herr_t
H5CX_pop(bool update_dxpl_props)
{
H5CX_node_t *cnode; /* Context node */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Perform common operations and get top context from stack */
if (NULL == (cnode = H5CX__pop_common(update_dxpl_props)))
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "error getting API context node");
/* Free the context node */
cnode = H5FL_FREE(H5CX_node_t, cnode);
(*head) = (*head)->next;
done:
FUNC_LEAVE_NOAPI(ret_value)

View File

@ -22,6 +22,9 @@
#ifdef H5_HAVE_PARALLEL
#include "H5FDprivate.h" /* File drivers */
#endif /* H5_HAVE_PARALLEL */
#include "H5Pprivate.h" /* Property lists */
#include "H5Tprivate.h" /* Datatypes */
#include "H5Tconv.h" /* Datatype conversions */
#include "H5Zprivate.h" /* Data filters */
/**************************/
@ -47,6 +50,235 @@ typedef struct H5CX_state_t {
#endif /* H5_HAVE_PARALLEL */
} H5CX_state_t;
/* Typedef for context about each API call, as it proceeds */
/* Fields in this struct are of several types:
* - The DXPL & LAPL ID are either library default ones (from the API context
* initialization) or passed in from the application via an API call
* parameter. The corresponding H5P_genplist_t* is just the underlying
* property list struct for the ID, to optimize retrieving properties
* from the list multiple times.
*
* - Internal fields, used and set only within the library, for managing the
* operation under way. These do not correspond to properties in the
* DXPL or LAPL and can have any name.
*
* - Cached fields, which are not returned to the application, for managing
* the operation under way. These correspond to properties in the DXPL
* or LAPL, and are retrieved either from the (global) cache for a
* default property list, or from the corresponding property in the
* application's (non-default) property list. Getting / setting these
* properties within the library does _not_ affect the application's
* property list. Note that the naming of these fields, <foo> and
* <foo>_valid, is important for the H5CX_RETRIEVE_PROP_VALID
* macro to work properly.
*
* - "Return-only" properties that are returned to the application, mainly
* for sending out "introspection" information ("Why did collective I/O
* get broken for this operation?", "Which filters are set on the chunk I
* just directly read in?", etc) Setting these fields will cause the
* corresponding property in the property list to be set when the API
* context is popped, when returning from the API routine. Note that the
* naming of these fields, <foo> and <foo>_set, is important for the
* H5CX_TEST_SET_PROP and H5CX_SET_PROP macros to work properly.
*
* - "Return-and-read" properties that are returned to the application to send out introspection information,
* but are also queried by the library internally. If the context value has been 'set' by an accessor,
* all future queries will return the stored value from the context, to avoid later queries overwriting
* that stored value with the value from the property list.
*
* These properties have both a 'valid' and 'set' flag. <foo>_valid is true if the field has ever been
* populated from its underlying property list. <foo>_set flag is true if this field has ever been set on
* the context for application introspection. The naming of these fields is important for the
* H5CX_RETRIEVE_PROP_VALID_SET macro to work properly.
*
* If a field has been set on the context but never read internally, <foo>_valid will be false
* despite the context containing a meaningful cached value.
*/
typedef struct H5CX_t {
/* DXPL */
hid_t dxpl_id; /* DXPL ID for API operation */
H5P_genplist_t *dxpl; /* Dataset Transfer Property List */
/* LCPL */
hid_t lcpl_id; /* LCPL ID for API operation */
H5P_genplist_t *lcpl; /* Link Creation Property List */
/* LAPL */
hid_t lapl_id; /* LAPL ID for API operation */
H5P_genplist_t *lapl; /* Link Access Property List */
/* DCPL */
hid_t dcpl_id; /* DCPL ID for API operation */
H5P_genplist_t *dcpl; /* Dataset Creation Property List */
/* DAPL */
hid_t dapl_id; /* DAPL ID for API operation */
H5P_genplist_t *dapl; /* Dataset Access Property List */
/* FAPL */
hid_t fapl_id; /* FAPL ID for API operation */
H5P_genplist_t *fapl; /* File Access Property List */
/* Internal: Object tagging info */
haddr_t tag; /* Current object's tag (ohdr chunk #0 address) */
/* Internal: Metadata cache info */
H5AC_ring_t ring; /* Current metadata cache ring for entries */
#ifdef H5_HAVE_PARALLEL
/* Internal: Parallel I/O settings */
bool coll_metadata_read; /* Whether to use collective I/O for metadata read */
MPI_Datatype btype; /* MPI datatype for buffer, when using collective I/O */
MPI_Datatype ftype; /* MPI datatype for file, when using collective I/O */
bool mpi_file_flushing; /* Whether an MPI-opened file is being flushed */
bool rank0_bcast; /* Whether a dataset meets read-with-rank0-and-bcast requirements */
#endif /* H5_HAVE_PARALLEL */
/* Cached DXPL properties */
size_t max_temp_buf; /* Maximum temporary buffer size (H5D_XFER_MAX_TEMP_BUF_NAME) .*/
bool max_temp_buf_valid; /* Whether maximum temporary buffer size is valid */
void *tconv_buf; /* Temporary conversion buffer (H5D_XFER_TCONV_BUF_NAME) */
bool tconv_buf_valid; /* Whether temporary conversion buffer is valid */
void *bkgr_buf; /* Background conversion buffer (H5D_XFER_BKGR_BUF_NAME) */
bool bkgr_buf_valid; /* Whether background conversion buffer is valid */
H5T_bkg_t bkgr_buf_type; /* Background buffer type (H5D_XFER_BKGR_BUF_TYPE_NAME) */
bool bkgr_buf_type_valid; /* Whether background buffer type is valid */
double btree_split_ratio[3]; /* B-tree split ratios (H5D_XFER_BTREE_SPLIT_RATIO_NAME) */
bool btree_split_ratio_valid; /* Whether B-tree split ratios are valid */
size_t vec_size; /* Size of hyperslab vector (H5D_XFER_HYPER_VECTOR_SIZE_NAME) */
bool vec_size_valid; /* Whether hyperslab vector is valid */
#ifdef H5_HAVE_PARALLEL
H5FD_mpio_xfer_t io_xfer_mode; /* Parallel transfer mode for this request (H5D_XFER_IO_XFER_MODE_NAME) */
bool io_xfer_mode_valid; /* Whether parallel transfer mode is valid */
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) */
bool mpio_coll_opt_valid; /* Whether parallel transfer option is valid */
H5FD_mpio_chunk_opt_t
mpio_chunk_opt_mode; /* Collective chunk option (H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME) */
bool mpio_chunk_opt_mode_valid; /* Whether collective chunk option is valid */
unsigned mpio_chunk_opt_num; /* Collective chunk threshold (H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME) */
bool mpio_chunk_opt_num_valid; /* Whether collective chunk threshold is valid */
unsigned mpio_chunk_opt_ratio; /* Collective chunk ratio (H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME) */
bool mpio_chunk_opt_ratio_valid; /* Whether collective chunk ratio is valid */
#endif /* H5_HAVE_PARALLEL */
H5Z_EDC_t err_detect; /* Error detection info (H5D_XFER_EDC_NAME) */
bool err_detect_valid; /* Whether error detection info is valid */
H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */
bool filter_cb_valid; /* Whether filter callback function is valid */
H5Z_data_xform_t *data_transform; /* Data transform info (H5D_XFER_XFORM_NAME) */
bool data_transform_valid; /* Whether data transform info is valid */
H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */
bool vl_alloc_info_valid; /* Whether VL datatype alloc info is valid */
H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */
bool dt_conv_cb_valid; /* Whether datatype conversion struct is valid */
H5D_selection_io_mode_t selection_io_mode; /* Selection I/O mode (H5D_XFER_SELECTION_IO_MODE_NAME) */
bool selection_io_mode_valid; /* Whether selection I/O mode is valid */
bool modify_write_buf; /* Whether the library can modify write buffers (H5D_XFER_MODIFY_WRITE_BUF_NAME)*/
bool modify_write_buf_valid; /* Whether the modify_write_buf field is valid */
/* Return-only DXPL properties to return to application */
#ifdef H5_HAVE_PARALLEL
H5D_mpio_actual_chunk_opt_mode_t mpio_actual_chunk_opt; /* Chunk optimization mode used for parallel I/O
(H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME) */
bool mpio_actual_chunk_opt_set; /* Whether chunk optimization mode used for parallel I/O is set */
H5D_mpio_actual_io_mode_t
mpio_actual_io_mode; /* Actual I/O mode used for parallel I/O (H5D_MPIO_ACTUAL_IO_MODE_NAME) */
bool mpio_actual_io_mode_set; /* Whether actual I/O mode used for parallel I/O is set */
uint32_t mpio_local_no_coll_cause; /* Local reason for breaking collective I/O
(H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME) */
bool mpio_local_no_coll_cause_set; /* Whether local reason for breaking collective I/O is set */
bool mpio_local_no_coll_cause_valid; /* Whether local reason for breaking collective I/O is valid */
uint32_t mpio_global_no_coll_cause; /* Global reason for breaking collective I/O
(H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME) */
bool mpio_global_no_coll_cause_set; /* Whether global reason for breaking collective I/O is set */
bool mpio_global_no_coll_cause_valid; /* Whether global reason for breaking collective I/O is valid */
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
int mpio_coll_chunk_link_hard; /* Instrumented "collective chunk link hard" value
(H5D_XFER_COLL_CHUNK_LINK_HARD_NAME) */
bool mpio_coll_chunk_link_hard_set; /* Whether instrumented "collective chunk link hard" value is set */
int mpio_coll_chunk_multi_hard; /* Instrumented "collective chunk multi hard" value
(H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME) */
bool mpio_coll_chunk_multi_hard_set; /* Whether instrumented "collective chunk multi hard" value is set */
int mpio_coll_chunk_link_num_true; /* Instrumented "collective chunk link num true" value
(H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME) */
bool mpio_coll_chunk_link_num_true_set; /* Whether instrumented "collective chunk link num true" value
is set */
int mpio_coll_chunk_link_num_false; /* Instrumented "collective chunk link num false" value
(H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME) */
bool mpio_coll_chunk_link_num_false_set; /* Whether instrumented "collective chunk link num false"
value is set */
int mpio_coll_chunk_multi_ratio_coll; /* Instrumented "collective chunk multi ratio coll" value
(H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME) */
bool mpio_coll_chunk_multi_ratio_coll_set; /* Whether instrumented "collective chunk multi ratio coll"
value is set */
int mpio_coll_chunk_multi_ratio_ind; /* Instrumented "collective chunk multi ratio ind" value
(H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME) */
bool mpio_coll_chunk_multi_ratio_ind_set; /* Whether instrumented "collective chunk multi ratio ind"
value is set */
bool mpio_coll_rank0_bcast; /* Instrumented "collective rank 0 broadcast" value
(H5D_XFER_COLL_RANK0_BCAST_NAME) */
bool mpio_coll_rank0_bcast_set; /* Whether instrumented "collective rank 0 broadcast" value is set */
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
uint32_t no_selection_io_cause; /* Reason for not performing selection I/O
(H5D_XFER_NO_SELECTION_IO_CAUSE_NAME) */
bool no_selection_io_cause_set; /* Whether reason for not performing selection I/O is set */
bool no_selection_io_cause_valid; /* Whether reason for not performing selection I/O is valid */
uint32_t actual_selection_io_mode; /* Actual selection I/O mode used
(H5D_XFER_ACTUAL_SELECTION_IO_MODE_NAME) */
bool actual_selection_io_mode_set; /* Whether actual selection I/O mode is set */
bool actual_selection_io_mode_valid; /* Whether actual selection I/O mode is valid */
/* Cached LCPL properties */
H5T_cset_t encoding; /* Link name character encoding (H5P_STRCRT_CHAR_ENCODING_NAME) */
bool encoding_valid; /* Whether link name character encoding is valid */
unsigned intermediate_group; /* Whether to create intermediate groups (H5L_CRT_INTERMEDIATE_GROUP_NAME) */
bool intermediate_group_valid; /* Whether create intermediate group flag is valid */
/* Cached LAPL properties */
size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
bool nlinks_valid; /* Whether number of soft / UD links to traverse is valid */
/* Cached DCPL properties */
bool do_min_dset_ohdr; /* Whether to minimize dataset object header (H5D_CRT_MIN_DSET_HDR_SIZE_NAME) */
bool do_min_dset_ohdr_valid; /* Whether minimize dataset object header flag is valid */
uint8_t ohdr_flags; /* Object header flags (H5O_CRT_OHDR_FLAGS_NAME) */
bool ohdr_flags_valid; /* Whether the object headers flags are valid */
/* Cached DAPL properties */
const char *extfile_prefix; /* Prefix for external file (H5D_ACS_EFILE_PREFIX_NAME) */
bool extfile_prefix_valid; /* Whether the prefix for external file is valid */
const char *vds_prefix; /* Prefix for VDS (H5D_ACS_VDS_PREFIX_NAME) */
bool vds_prefix_valid; /* Whether the prefix for VDS is valid */
/* Cached FAPL properties */
H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds()
(H5F_ACS_LIBVER_LOW_BOUND_NAME) */
bool low_bound_valid; /* Whether low_bound property is valid */
H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds
(H5F_ACS_LIBVER_HIGH_BOUND_NAME) */
bool high_bound_valid; /* Whether high_bound property is valid */
/* Cached VOL settings */
H5VL_connector_prop_t vol_connector_prop; /* Property for VOL connector ID & info
This is treated as an independent field with
no relation to the property H5F_ACS_VOL_CONN_NAME stored on the FAPL */
bool vol_connector_prop_valid; /* Whether property for VOL connector ID & info is valid */
void *vol_wrap_ctx; /* VOL connector's "wrap context" for creating IDs */
bool vol_wrap_ctx_valid; /* Whether VOL connector's "wrap context" for creating IDs is valid */
} H5CX_t;
/* Typedef for nodes on the API context stack */
/* Each entry into the library through an API routine invokes H5CX_push()
* in a FUNC_ENTER_API* macro, which pushes an H5CX_node_t on the API
* context [thread-local] stack, after initializing it with default values.
*/
typedef struct H5CX_node_t {
H5CX_t ctx; /* Context for current API call */
struct H5CX_node_t *next; /* Pointer to previous context, on stack */
} H5CX_node_t;
/*****************************/
/* Library-private Variables */
/*****************************/
@ -56,13 +288,10 @@ typedef struct H5CX_state_t {
/***************************************/
/* Library private routines */
#ifndef H5private_H
H5_DLL herr_t H5CX_push(void);
H5_DLL herr_t H5CX_push(H5CX_node_t *cnode);
H5_DLL herr_t H5CX_pop(bool update_dxpl_props);
#endif /* H5private_H */
H5_DLL bool H5CX_pushed(void);
H5_DLL void H5CX_push_special(void);
H5_DLL bool H5CX_is_def_dxpl(void);
H5_DLL bool H5CX_pushed(void);
H5_DLL bool H5CX_is_def_dxpl(void);
/* API context state routines */
H5_DLL herr_t H5CX_retrieve_state(H5CX_state_t **api_state);

View File

@ -125,7 +125,7 @@ H5_DLL htri_t H5FD_is_driver_registered_by_name(const char *driver_name,
H5_DLL htri_t H5FD_is_driver_registered_by_value(H5FD_class_value_t driver_value, hid_t *registered_id);
H5_DLL hid_t H5FD_get_driver_id_by_name(const char *name, bool is_api);
H5_DLL hid_t H5FD_get_driver_id_by_value(H5FD_class_value_t value, bool is_api);
H5_DLL herr_t H5FD_open(bool try, H5FD_t **file, const char *name, unsigned flags, hid_t fapl_id,
H5_DLL herr_t H5FD_open(bool attempt, H5FD_t **file, const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr);
H5_DLL herr_t H5FD_close(H5FD_t *file);
H5_DLL int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2);

View File

@ -493,7 +493,7 @@ typedef enum H5F_prefix_open_t {
/* Private functions */
H5_DLL herr_t H5F_init(void);
H5_DLL herr_t H5F_open(bool try, H5F_t **file, const char *name, unsigned flags, hid_t fcpl_id,
H5_DLL herr_t H5F_open(bool attempt, H5F_t **file, const char *name, unsigned flags, hid_t fcpl_id,
hid_t fapl_id);
H5_DLL herr_t H5F_try_close(H5F_t *f, bool *was_closed /*out*/);
H5_DLL hid_t H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, bool app_ref);
@ -657,9 +657,9 @@ H5_DLL herr_t H5F_shared_get_mpi_file_sync_required(const H5F_shared_t *f_sh,
H5_DLL herr_t H5F_efc_close(H5F_t *parent, H5F_t *file);
/* File prefix routines */
H5_DLL herr_t H5F_prefix_open_file(bool try, H5F_t **file, H5F_t *primary_file, H5F_prefix_open_t prefix_type,
const char *prop_prefix, const char *file_name, unsigned file_intent,
hid_t fapl_id);
H5_DLL herr_t H5F_prefix_open_file(bool attempt, H5F_t **file, H5F_t *primary_file,
H5F_prefix_open_t prefix_type, const char *prop_prefix,
const char *file_name, unsigned file_intent, hid_t fapl_id);
/* Global heap CWFS routines */
H5_DLL herr_t H5F_cwfs_add(H5F_t *f, struct H5HG_heap_t *heap);

View File

@ -82,9 +82,10 @@
herr_t
H5F__get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, size_t *mesg_count)
{
H5F_t *file; /* File info */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
H5F_t *file; /* File info */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@ -93,7 +94,7 @@ H5F__get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, size_t *mesg_coun
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file");
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;
@ -123,9 +124,10 @@ done:
herr_t
H5F__check_cached_stab_test(hid_t file_id)
{
H5F_t *file; /* File info */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
H5F_t *file; /* File info */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@ -134,7 +136,7 @@ H5F__check_cached_stab_test(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file");
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;

View File

@ -83,11 +83,12 @@
htri_t
H5G__is_empty_test(hid_t gid)
{
H5G_t *grp = NULL; /* Pointer to group */
htri_t msg_exists = false; /* Indicate that a header message is present */
htri_t linfo_exists = false; /* Indicate that the 'link info' message is present */
bool api_ctx_pushed = false; /* Whether API context pushed */
htri_t ret_value = true; /* Return value */
H5G_t *grp = NULL; /* Pointer to group */
htri_t msg_exists = false; /* Indicate that a header message is present */
htri_t linfo_exists = false; /* Indicate that the 'link info' message is present */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
htri_t ret_value = true; /* Return value */
FUNC_ENTER_PACKAGE
@ -96,7 +97,7 @@ H5G__is_empty_test(hid_t gid)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group");
/* Set API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;
@ -203,10 +204,11 @@ done:
htri_t
H5G__has_links_test(hid_t gid, unsigned *nmsgs)
{
H5G_t *grp = NULL; /* Pointer to group */
htri_t msg_exists = 0; /* Indicate that a header message is present */
bool api_ctx_pushed = false; /* Whether API context pushed */
htri_t ret_value = true; /* Return value */
H5G_t *grp = NULL; /* Pointer to group */
htri_t msg_exists = 0; /* Indicate that a header message is present */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
htri_t ret_value = true; /* Return value */
FUNC_ENTER_PACKAGE
@ -215,7 +217,7 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group");
/* Set API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;
@ -269,10 +271,11 @@ done:
htri_t
H5G__has_stab_test(hid_t gid)
{
H5G_t *grp = NULL; /* Pointer to group */
htri_t msg_exists = 0; /* Indicate that a header message is present */
bool api_ctx_pushed = false; /* Whether API context pushed */
htri_t ret_value = true; /* Return value */
H5G_t *grp = NULL; /* Pointer to group */
htri_t msg_exists = 0; /* Indicate that a header message is present */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
htri_t ret_value = true; /* Return value */
FUNC_ENTER_PACKAGE
@ -281,7 +284,7 @@ H5G__has_stab_test(hid_t gid)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group");
/* Set API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;
@ -327,10 +330,11 @@ done:
htri_t
H5G__is_new_dense_test(hid_t gid)
{
H5G_t *grp = NULL; /* Pointer to group */
htri_t msg_exists = 0; /* Indicate that a header message is present */
bool api_ctx_pushed = false; /* Whether API context pushed */
htri_t ret_value = true; /* Return value */
H5G_t *grp = NULL; /* Pointer to group */
htri_t msg_exists = 0; /* Indicate that a header message is present */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
htri_t ret_value = true; /* Return value */
FUNC_ENTER_PACKAGE
@ -339,7 +343,7 @@ H5G__is_new_dense_test(hid_t gid)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group");
/* Set API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;
@ -403,12 +407,13 @@ done:
herr_t
H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count)
{
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */
H5O_linfo_t linfo; /* Link info message */
H5G_t *grp = NULL; /* Pointer to group */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */
H5O_linfo_t linfo; /* Link info message */
H5G_t *grp = NULL; /* Pointer to group */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@ -417,7 +422,7 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group");
/* Set API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;
@ -494,10 +499,11 @@ done:
herr_t
H5G__lheap_size_test(hid_t gid, size_t *lheap_size)
{
H5G_t *grp = NULL; /* Pointer to group */
H5O_stab_t stab; /* Symbol table message */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
H5G_t *grp = NULL; /* Pointer to group */
H5O_stab_t stab; /* Symbol table message */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@ -506,7 +512,7 @@ H5G__lheap_size_test(hid_t gid, size_t *lheap_size)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group");
/* Set API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;
@ -550,10 +556,11 @@ done:
herr_t
H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsigned *obj_hidden)
{
void *obj_ptr; /* Pointer to object for ID */
const H5G_name_t *obj_path; /* Pointer to group hier. path for obj */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
void *obj_ptr; /* Pointer to object for ID */
const H5G_name_t *obj_path; /* Pointer to group hier. path for obj */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@ -566,7 +573,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get object for ID");
/* Set API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;

View File

@ -63,17 +63,18 @@
ssize_t
H5I__get_name_test(hid_t id, char *name /*out*/, size_t size, bool *cached)
{
H5VL_object_t *vol_obj; /* Object of id */
H5G_loc_t loc; /* Object location */
bool api_ctx_pushed = false; /* Whether API context pushed */
bool vol_wrapper_set = false; /* Whether the VOL object wrapping context was set up */
size_t name_len = 0; /* Length of name */
ssize_t ret_value = -1; /* Return value */
H5VL_object_t *vol_obj; /* Object of id */
H5G_loc_t loc; /* Object location */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
bool vol_wrapper_set = false; /* Whether the VOL object wrapping context was set up */
size_t name_len = 0; /* Length of name */
ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_PACKAGE
/* Set API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set API context");
api_ctx_pushed = true;

View File

@ -82,11 +82,12 @@
htri_t
H5O__is_attr_dense_test(hid_t oid)
{
H5O_t *oh = NULL; /* Object header */
H5O_ainfo_t ainfo; /* Attribute information for object */
H5O_loc_t *loc; /* Pointer to object's location */
bool api_ctx_pushed = false; /* Whether API context pushed */
htri_t ret_value = FAIL; /* Return value */
H5O_t *oh = NULL; /* Object header */
H5O_ainfo_t ainfo; /* Attribute information for object */
H5O_loc_t *loc; /* Pointer to object's location */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
@ -95,7 +96,7 @@ H5O__is_attr_dense_test(hid_t oid)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found");
/* Set API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;
@ -151,14 +152,15 @@ done:
htri_t
H5O__is_attr_empty_test(hid_t oid)
{
H5O_t *oh = NULL; /* Object header */
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
H5O_ainfo_t ainfo; /* Attribute information for object */
htri_t ainfo_exists = false; /* Whether the attribute info exists in the file */
H5O_loc_t *loc; /* Pointer to object's location */
hsize_t nattrs; /* Number of attributes */
bool api_ctx_pushed = false; /* Whether API context pushed */
htri_t ret_value = FAIL; /* Return value */
H5O_t *oh = NULL; /* Object header */
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
H5O_ainfo_t ainfo; /* Attribute information for object */
htri_t ainfo_exists = false; /* Whether the attribute info exists in the file */
H5O_loc_t *loc; /* Pointer to object's location */
hsize_t nattrs; /* Number of attributes */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
@ -167,7 +169,7 @@ H5O__is_attr_empty_test(hid_t oid)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found");
/* Set API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;
@ -254,13 +256,14 @@ done:
herr_t
H5O__num_attrs_test(hid_t oid, hsize_t *nattrs)
{
H5O_t *oh = NULL; /* Object header */
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
H5O_ainfo_t ainfo; /* Attribute information for object */
H5O_loc_t *loc; /* Pointer to object's location */
hsize_t obj_nattrs; /* Number of attributes */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
H5O_t *oh = NULL; /* Object header */
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
H5O_ainfo_t ainfo; /* Attribute information for object */
H5O_loc_t *loc; /* Pointer to object's location */
hsize_t obj_nattrs; /* Number of attributes */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@ -269,7 +272,7 @@ H5O__num_attrs_test(hid_t oid, hsize_t *nattrs)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found");
/* Set API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;
@ -353,13 +356,14 @@ done:
herr_t
H5O__attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
{
H5O_t *oh = NULL; /* Object header */
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */
H5O_ainfo_t ainfo; /* Attribute information for object */
H5O_loc_t *loc; /* Pointer to object's location */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
H5O_t *oh = NULL; /* Object header */
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */
H5O_ainfo_t ainfo; /* Attribute information for object */
H5O_loc_t *loc; /* Pointer to object's location */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@ -368,7 +372,7 @@ H5O__attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found");
/* Set API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;
@ -624,12 +628,13 @@ done:
herr_t
H5O__msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num)
{
H5O_t *oh = NULL; /* Object header */
H5O_loc_t *loc; /* Pointer to object's location */
H5O_mesg_t *idx_msg; /* Pointer to message */
unsigned idx; /* Index of message */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
H5O_t *oh = NULL; /* Object header */
H5O_loc_t *loc; /* Pointer to object's location */
H5O_mesg_t *idx_msg; /* Pointer to message */
unsigned idx; /* Index of message */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@ -638,7 +643,7 @@ H5O__msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found");
/* Set API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;
@ -691,12 +696,13 @@ done:
herr_t
H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type)
{
H5O_t *oh = NULL; /* Object header */
H5O_loc_t *loc; /* Pointer to object's location */
H5O_mesg_t *curr_msg; /* Pointer to current message */
unsigned idx; /* Index of message */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
H5O_t *oh = NULL; /* Object header */
H5O_loc_t *loc; /* Pointer to object's location */
H5O_mesg_t *curr_msg; /* Pointer to current message */
unsigned idx; /* Index of message */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@ -705,7 +711,7 @@ H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found");
/* Set API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context");
api_ctx_pushed = true;

View File

@ -54,7 +54,7 @@
#ifdef H5_HAVE_C11_THREADS
#define H5TS_mutex_lock(mutex) ((H5_UNLIKELY(mtx_lock(mutex) != thrd_success)) ? FAIL : SUCCEED)
#define H5TS_mutex_lock(mutex) (H5_UNLIKELY(mtx_lock(mutex) != thrd_success) ? FAIL : SUCCEED)
#define H5TS_mutex_unlock(mutex) (H5_UNLIKELY(mtx_unlock(mutex) != thrd_success) ? FAIL : SUCCEED)
#else
@ -94,8 +94,8 @@ H5TS_mutex_unlock(H5TS_mutex_t *mutex)
} /* end H5TS_mutex_unlock() */
#else
#define H5TS_mutex_lock(mutex) (H5_UNLIKELY(pthread_mutex_lock(mutex)) ? FAIL : SUCCEED)
#define H5TS_mutex_unlock(mutex) (H5_UNLIKELY(pthread_mutex_unlock(mutex)) ? FAIL : SUCCEED)
#define H5TS_mutex_lock(mutex) (H5_UNLIKELY(0 != pthread_mutex_lock(mutex)) ? FAIL : SUCCEED)
#define H5TS_mutex_unlock(mutex) (H5_UNLIKELY(0 != pthread_mutex_unlock(mutex)) ? FAIL : SUCCEED)
#endif
#endif

View File

@ -300,11 +300,13 @@ H5_DLL herr_t H5TS_mutex_destroy(H5TS_mutex_t *mutex);
/* R/W locks */
H5_DLL herr_t H5TS_rwlock_init(H5TS_rwlock_t *lock);
/* R/W lock & unlock calls are defined in H5TSrwlock.h */
#if !defined(__cplusplus)
static inline herr_t H5TS_rwlock_rdlock(H5TS_rwlock_t *lock);
static inline herr_t H5TS_rwlock_rdunlock(H5TS_rwlock_t *lock);
static inline herr_t H5TS_rwlock_wrlock(H5TS_rwlock_t *lock);
static inline herr_t H5TS_rwlock_wrunlock(H5TS_rwlock_t *lock);
H5_DLL herr_t H5TS_rwlock_destroy(H5TS_rwlock_t *lock);
#endif
H5_DLL herr_t H5TS_rwlock_destroy(H5TS_rwlock_t *lock);
/* Condition variable operations */
H5_DLL herr_t H5TS_cond_init(H5TS_cond_t *cond);
@ -325,11 +327,13 @@ H5_DLL void H5TS_thread_yield(void);
/* Thread pools */
H5_DLL herr_t H5TS_pool_create(H5TS_pool_t **pool, unsigned num_threads);
/* Thread pool add task call is defined in H5TSpool.h */
#if !defined(__cplusplus)
static inline herr_t H5TS_pool_add_task(H5TS_pool_t *pool, H5TS_thread_start_func_t func, void *ctx);
H5_DLL herr_t H5TS_pool_destroy(H5TS_pool_t *pool);
#endif
H5_DLL herr_t H5TS_pool_destroy(H5TS_pool_t *pool);
/* Emulated C11 atomics */
#if !(defined(H5_HAVE_STDATOMIC_H) && !defined(__cplusplus))
#if !defined(H5_HAVE_STDATOMIC_H) && !defined(__cplusplus)
/* atomic_int */
H5_DLL void H5TS_atomic_init_int(H5TS_atomic_int_t *obj, int desired);
/* Atomic 'int' load, store, etc. calls are defined in H5TSatomic.h */
@ -360,26 +364,32 @@ H5_DLL void H5TS_atomic_destroy_voidp(H5TS_atomic_voidp_t *obj);
/* Barrier related function declarations */
H5_DLL herr_t H5TS_barrier_init(H5TS_barrier_t *barrier, unsigned count);
/* Barrier wait call is defined in H5TSbarrier.h */
#if !defined(__cplusplus)
static inline herr_t H5TS_barrier_wait(H5TS_barrier_t *barrier);
H5_DLL herr_t H5TS_barrier_destroy(H5TS_barrier_t *barrier);
#endif /* H5_HAVE_PTHREAD_BARRIER */
H5_DLL herr_t H5TS_barrier_destroy(H5TS_barrier_t *barrier);
H5_DLL herr_t H5TS_semaphore_init(H5TS_semaphore_t *sem, unsigned initial_count);
/* Semaphore signal & wait calls are defined in H5TSsemaphore.h */
#if !defined(__cplusplus)
static inline herr_t H5TS_semaphore_signal(H5TS_semaphore_t *sem);
static inline herr_t H5TS_semaphore_wait(H5TS_semaphore_t *sem);
H5_DLL herr_t H5TS_semaphore_destroy(H5TS_semaphore_t *sem);
#endif
H5_DLL herr_t H5TS_semaphore_destroy(H5TS_semaphore_t *sem);
/* Headers with inlined routines */
#include "H5TScond.h"
#include "H5TSmutex.h"
#include "H5TSkey.h"
#if !(defined(H5_HAVE_STDATOMIC_H) && !defined(__cplusplus))
#if !defined(__cplusplus)
#if !defined(H5_HAVE_STDATOMIC_H)
#include "H5TSatomic.h"
#endif /* H5_HAVE_STDATOMIC_H */
#include "H5TSbarrier.h"
#include "H5TSrwlock.h"
#include "H5TSsemaphore.h"
#include "H5TSpool.h"
#endif
#endif /* H5_HAVE_THREADS */

View File

@ -22,9 +22,10 @@
/***********/
/* Headers */
/***********/
#include "H5Eprivate.h"
#include "H5Iprivate.h"
#include "H5Tconv.h"
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5Tconv.h" /* Datatype conversions */
#include "H5Tconv_array.h"
/******************/

View File

@ -22,8 +22,9 @@
/***********/
/* Headers */
/***********/
#include "H5Eprivate.h"
#include "H5Tconv.h"
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Tconv.h" /* Datatype conversions */
#include "H5Tconv_bitfield.h"
/*-------------------------------------------------------------------------

View File

@ -22,9 +22,10 @@
/***********/
/* Headers */
/***********/
#include "H5Eprivate.h"
#include "H5Iprivate.h"
#include "H5Tconv.h"
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5Tconv.h" /* Datatype conversions */
#include "H5Tconv_compound.h"
/******************/

View File

@ -22,8 +22,9 @@
/***********/
/* Headers */
/***********/
#include "H5Eprivate.h"
#include "H5Tconv.h"
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Tconv.h" /* Datatype conversions */
#include "H5Tconv_enum.h"
/******************/

View File

@ -22,7 +22,8 @@
/***********/
/* Headers */
/***********/
#include "H5Tconv.h"
#include "H5private.h" /* Generic Functions */
#include "H5Tconv.h" /* Datatype conversions */
#include "H5Tconv_macros.h"
#include "H5Tconv_float.h"

View File

@ -22,7 +22,8 @@
/***********/
/* Headers */
/***********/
#include "H5Tconv.h"
#include "H5private.h" /* Generic Functions */
#include "H5Tconv.h" /* Datatype conversions */
#include "H5Tconv_macros.h"
#include "H5Tconv_integer.h"

View File

@ -23,10 +23,11 @@
/***********/
/* Headers */
/***********/
#include "H5Eprivate.h"
#include "H5FLprivate.h"
#include "H5Rpkg.h"
#include "H5Tconv.h"
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Rpkg.h" /* References */
#include "H5Tconv.h" /* Datatype conversions */
#include "H5Tconv_reference.h"
/*******************/

View File

@ -22,8 +22,9 @@
/***********/
/* Headers */
/***********/
#include "H5Eprivate.h"
#include "H5Tconv.h"
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Tconv.h" /* Datatype conversions */
#include "H5Tconv_string.h"
/*-------------------------------------------------------------------------

View File

@ -22,10 +22,11 @@
/***********/
/* Headers */
/***********/
#include "H5CXprivate.h"
#include "H5Eprivate.h"
#include "H5Iprivate.h"
#include "H5Tconv.h"
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5Tconv.h" /* Datatype conversions */
#include "H5Tconv_vlen.h"
/****************/

View File

@ -771,26 +771,36 @@ done:
/*---------------------------------------------------------------------------
* Function: H5VLstart_lib_state
*
* Purpose: Opens a new internal state for the HDF5 library.
* Purpose: Opens a new internal context for the HDF5 library. The context
* returned (via the OUT parameter) must be passed to
* H5VLfinish_lib_state to conclude the library's context and
* release resources.
*
* Note: This routine is _only_ for HDF5 VOL connector authors! It is
* _not_ part of the public API for HDF5 application developers.
*
* Return: Success: Non-negative
* Failure: Negative
* Note: Should probably rename this to 'H5VLopen_lib_context' or
* similar.
*
* Return: Success: Non-negative, *context set
* Failure: Negative, *context unset
*
*---------------------------------------------------------------------------
*/
herr_t
H5VLstart_lib_state(void)
H5VLstart_lib_state(void **context)
{
herr_t ret_value = SUCCEED; /* Return value */
/* Must use this, to avoid modifying the API context stack in FUNC_ENTER */
FUNC_ENTER_API_NOINIT
/* Check args */
if (NULL == context)
HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid context pointer");
/* Start a new library state */
if (H5VL_start_lib_state() < 0)
if (H5VL_start_lib_state(context) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't start new library state");
done:
@ -843,21 +853,28 @@ done:
* H5VLstart_lib_state. It can be called before / after /
* independently of H5VLfree_lib_state.
*
* Note: Should probably rename this to 'H5VLclose_lib_context' or
* similar.
*
* Return: Success: Non-negative
* Failure: Negative
*
*---------------------------------------------------------------------------
*/
herr_t
H5VLfinish_lib_state(void)
H5VLfinish_lib_state(void *context)
{
herr_t ret_value = SUCCEED; /* Return value */
/* Must use this, to avoid modifying the API context stack in FUNC_ENTER */
FUNC_ENTER_API_NOINIT
/* Check args */
if (NULL == context)
HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid context pointer");
/* Reset the library state */
if (H5VL_finish_lib_state() < 0)
if (H5VL_finish_lib_state(context) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset library state");
done:

View File

@ -80,11 +80,13 @@ H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connect
* can't be retrieved.
*
*/
H5_DLL hid_t H5VLwrap_register(void *obj, H5I_type_t type);
H5_DLL hid_t H5VLwrap_register(void *obj, H5I_type_t type);
/* Library context and state routines */
H5_DLL herr_t H5VLretrieve_lib_state(void **state);
H5_DLL herr_t H5VLstart_lib_state(void);
H5_DLL herr_t H5VLstart_lib_state(void **context);
H5_DLL herr_t H5VLrestore_lib_state(const void *state);
H5_DLL herr_t H5VLfinish_lib_state(void);
H5_DLL herr_t H5VLfinish_lib_state(void *context);
H5_DLL herr_t H5VLfree_lib_state(void *state);
/* Pass-through callbacks */

View File

@ -2062,25 +2062,41 @@ done:
*
* Purpose: Opens a new internal state for the HDF5 library.
*
* Note: Currently just pushes a new API context state, but could be
* Note: Currently just pushes a new API context, but could be
* expanded in the future.
*
* Return: SUCCEED / FAIL
* Return: Success: Non-negative, *context set
* Failure: Negative, *context unset
*
*-------------------------------------------------------------------------
*/
herr_t
H5VL_start_lib_state(void)
H5VL_start_lib_state(void **context)
{
herr_t ret_value = SUCCEED; /* Return value */
H5CX_node_t *cnode = NULL; /* API context */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
assert(context);
/* Allocate & clear a new API context */
if (NULL == (cnode = H5MM_calloc(sizeof(H5CX_node_t))))
HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate library context");
/* Push a new API context on the stack */
if (H5CX_push() < 0)
if (H5CX_push(cnode) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't push API context");
/* Set output parameter */
*context = cnode;
done:
if (ret_value < 0)
if (cnode)
H5MM_xfree(cnode);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_start_lib_state() */
@ -2132,16 +2148,22 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5VL_finish_lib_state(void)
H5VL_finish_lib_state(void *context)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
assert(context);
/* Pop the API context off the stack */
if (H5CX_pop(false) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't pop API context");
/* Release library context */
H5MM_xfree(context);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_finish_lib_state() */

View File

@ -134,9 +134,9 @@ H5_DLL void H5VL_obj_reset_data(H5VL_object_t *vol_obj);
/* Library state functions */
H5_DLL herr_t H5VL_retrieve_lib_state(void **state);
H5_DLL herr_t H5VL_start_lib_state(void);
H5_DLL herr_t H5VL_start_lib_state(void **context);
H5_DLL herr_t H5VL_restore_lib_state(const void *state);
H5_DLL herr_t H5VL_finish_lib_state(void);
H5_DLL herr_t H5VL_finish_lib_state(void *context);
H5_DLL herr_t H5VL_free_lib_state(void *state);
/* ID registration functions */

View File

@ -78,7 +78,7 @@ H5_DLL herr_t H5Z_modify(const struct H5O_pline_t *pline, H5Z_filter_t filter, u
H5_DLL herr_t H5Z_pipeline(const struct H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*in,out*/,
H5Z_EDC_t edc_read, H5Z_cb_t cb_struct, size_t *nbytes /*in,out*/,
size_t *buf_size /*in,out*/, void **buf /*in,out*/);
H5_DLL herr_t H5Z_find(bool try, H5Z_filter_t id, H5Z_class2_t **cls);
H5_DLL herr_t H5Z_find(bool attempt, H5Z_filter_t id, H5Z_class2_t **cls);
H5_DLL herr_t H5Z_can_apply(hid_t dcpl_id, hid_t type_id);
H5_DLL herr_t H5Z_set_local(hid_t dcpl_id, hid_t type_id);
H5_DLL herr_t H5Z_can_apply_direct(const struct H5O_pline_t *pline);

View File

@ -501,6 +501,18 @@
#define LOCK_UN 0x08
#endif /* H5_HAVE_FLOCK */
/* Private typedefs */
/* Union for const/non-const pointer for use by functions that manipulate
* pointers but do not write to their targets or return pointers to const
* specified locations. Also used for I/O functions that work for read and
* write - these functions are expected to never write to these locations in the
* write case. This helps us avoid compiler warnings. */
typedef union {
void *vp;
const void *cvp;
} H5_flexible_const_ptr_t;
/* If necessary, create a typedef for library usage of the
* _Float16 type to avoid issues when compiling the library
* with the -pedantic flag or similar where we get warnings
@ -1124,10 +1136,7 @@ extern char H5_lib_vers_info_g[];
#define H5_PACKAGE_INIT(pkg_init, err)
#endif /* H5_MY_PKG */
/* Forward declaration of H5CXpush() / H5CXpop() */
/* (Including H5CXprivate.h creates bad circular dependencies - QAK, 3/18/2018) */
H5_DLL herr_t H5CX_push(void);
H5_DLL herr_t H5CX_pop(bool update_dxpl_props);
#include "H5CXprivate.h" /* API Contexts */
#ifndef NDEBUG
#define FUNC_ENTER_CHECK_NAME(asrt) \
@ -1174,7 +1183,7 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props);
#define FUNC_ENTER_API_PUSH(err) \
/* Push the API context */ \
if (H5_UNLIKELY(H5CX_push() < 0)) \
if (H5_UNLIKELY(H5CX_push(&api_ctx) < 0)) \
HGOTO_ERROR(H5E_FUNC, H5E_CANTSET, err, "can't set API context"); \
else \
api_ctx_pushed = true;
@ -1183,7 +1192,8 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props);
#define FUNC_ENTER_API(err) \
{ \
{ \
bool api_ctx_pushed = false; \
H5CX_node_t api_ctx = {{0}, NULL}; \
bool api_ctx_pushed = false; \
\
FUNC_ENTER_API_COMMON \
FUNC_ENTER_API_INIT(err); \
@ -1199,7 +1209,8 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props);
#define FUNC_ENTER_API_NOCLEAR(err) \
{ \
{ \
bool api_ctx_pushed = false; \
H5CX_node_t api_ctx = {{0}, NULL}; \
bool api_ctx_pushed = false; \
\
FUNC_ENTER_API_COMMON \
FUNC_ENTER_API_INIT(err); \
@ -1247,9 +1258,7 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props);
{ \
{ \
{ \
FUNC_ENTER_API_VARS \
FUNC_ENTER_COMMON(H5_IS_API(__func__)); \
H5_API_LOCK \
FUNC_ENTER_API_COMMON \
FUNC_ENTER_API_INIT(err); \
{
@ -1508,18 +1517,6 @@ H5_PKG_DECLARE_FUNC(H5_MY_PKG_INIT, H5_MY_PKG)
#define HDcompile_assert(e) do { typedef struct { unsigned int b: (e); } x; } while(0)
*/
/* Private typedefs */
/* Union for const/non-const pointer for use by functions that manipulate
* pointers but do not write to their targets or return pointers to const
* specified locations. Also used for I/O functions that work for read and
* write - these functions are expected to never write to these locations in the
* write case. This helps us avoid compiler warnings. */
typedef union {
void *vp;
const void *cvp;
} H5_flexible_const_ptr_t;
/* File-independent encode/decode routines */
#include "H5encode.h"

View File

@ -80,12 +80,13 @@ void accum_printf(const H5F_t *f);
int
main(void)
{
unsigned nerrors = 0; /* track errors */
bool api_ctx_pushed = false; /* Whether API context pushed */
hid_t fid = H5I_INVALID_HID;
hid_t fapl = H5I_INVALID_HID; /* File access property list */
char filename[1024];
H5F_t *f = NULL; /* File for all tests */
unsigned nerrors = 0; /* track errors */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
hid_t fid = H5I_INVALID_HID;
hid_t fapl = H5I_INVALID_HID; /* File access property list */
char filename[1024];
H5F_t *f = NULL; /* File for all tests */
/* Test Setup */
puts("Testing the metadata accumulator");
@ -101,7 +102,7 @@ main(void)
FAIL_STACK_ERROR;
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;
@ -2058,7 +2059,8 @@ test_swmr_write_big(bool newest_format)
uint8_t wbuf[1024]; /* Buffer for reading & writing */
unsigned u; /* Local index variable */
bool process_success = false;
bool api_ctx_pushed = false; /* Whether API context pushed */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
if (newest_format)
TESTING("SWMR write of large metadata: with latest format");
@ -2110,7 +2112,7 @@ test_swmr_write_big(bool newest_format)
FAIL_STACK_ERROR;
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;

View File

@ -45,10 +45,11 @@ main(void)
hid_t fapl = H5I_INVALID_HID; /* file access property list ID */
H5F_t *f = NULL; /* File pointer */
char filename[1024];
unsigned u; /* Local index variable */
uint8_t rbuf[1024]; /* Buffer for reading */
uint8_t buf[1024]; /* Buffer for holding the expected data */
bool api_ctx_pushed = false; /* Whether API context pushed */
unsigned u; /* Local index variable */
uint8_t rbuf[1024]; /* Buffer for reading */
uint8_t buf[1024]; /* Buffer for holding the expected data */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
/* Testing setup */
h5_test_init();
@ -75,7 +76,7 @@ main(void)
FAIL_STACK_ERROR;
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;

View File

@ -9916,8 +9916,9 @@ main(void)
unsigned nerrors = 0; /* Cumulative error count */
unsigned reopen; /* Whether to reopen B-tree during tests */
const char *driver_name;
bool api_ctx_pushed = false; /* Whether API context pushed */
int localTestExpress; /* localized TestExpress */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
int localTestExpress; /* localized TestExpress */
driver_name = h5_get_test_driver_name();
@ -9937,7 +9938,7 @@ main(void)
init_cparam(&cparam, &cparam2);
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,7 @@
#define H5F_FRIEND /*suppress error about including H5Fpkg */
/* Include library header files */
#include "H5private.h"
#include "H5ACprivate.h"
#include "H5MFprivate.h"
#include "H5Cpkg.h"

View File

@ -16,12 +16,12 @@
#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
#include "H5Fpkg.h"
#include "h5test.h"
#include "cache_common.h"
#include "H5CXprivate.h" /* API Contexts */
#include "H5Fpkg.h"
#include "H5HLprivate.h"
#include "H5VLnative_private.h" /* Native VOL connector */
@ -4353,13 +4353,14 @@ check_invalid_tag_application(void)
{
#ifdef H5C_DO_TAGGING_SANITY_CHECKS
/* Variables */
H5F_t *f = NULL;
hid_t fid = H5I_INVALID_HID;
haddr_t addr;
H5HL_t *lheap = NULL;
hid_t fapl = H5I_INVALID_HID; /* File access prop list */
bool api_ctx_pushed = false; /* Whether API context pushed */
#endif /* H5C_DO_TAGGING_SANITY_CHECKS */
H5F_t *f = NULL;
hid_t fid = H5I_INVALID_HID;
haddr_t addr;
H5HL_t *lheap = NULL;
hid_t fapl = H5I_INVALID_HID; /* File access prop list */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
#endif /* H5C_DO_TAGGING_SANITY_CHECKS */
/* Testing Macro */
TESTING("failure on invalid tag application");
@ -4377,7 +4378,7 @@ check_invalid_tag_application(void)
TEST_ERROR;
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
TEST_ERROR;
api_ctx_pushed = true;

View File

@ -36,9 +36,9 @@
*/
#define H5D_FRIEND
#define H5D_TESTING /* to use H5D__ functions */
#include "H5Dpkg.h"
#include "h5test.h"
#include "H5Dpkg.h"
#ifdef H5_HAVE_FILTER_DEFLATE
#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER)
#define H5_ZLIB_HEADER "zlib.h"

View File

@ -13,12 +13,12 @@
/* See H5private.h for how to include headers */
#undef NDEBUG
#define H5T_FRIEND /*suppress error about including H5Tpkg */
#include "H5Tpkg.h" /*to turn off hardware conversions*/
#include "H5Tconv_compound.h"
#include "H5Iprivate.h"
#define H5T_FRIEND /*suppress error about including H5Tpkg */
#include "h5test.h"
#include "H5Iprivate.h"
#include "H5Tpkg.h" /*to turn off hardware conversions*/
#include "H5Tconv_compound.h"
static const char *FILENAME[] = {"cmpd_dset", "src_subset", "dst_subset", "select_cmpd_dset", NULL};

View File

@ -2845,6 +2845,7 @@ test_missing_filter(hid_t file)
size_t i, j; /* Local index variables */
herr_t ret; /* Generic return value */
const char *testfile = H5_get_srcdir_filename(FILE_DEFLATE_NAME); /* Corrected test file name */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
TESTING("dataset access with missing filter");
@ -2859,7 +2860,7 @@ test_missing_filter(hid_t file)
} /* end if */
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;

View File

@ -2297,6 +2297,7 @@ main(void)
earray_iter_type_t curr_iter; /* Current iteration type being worked on */
hid_t fapl = H5I_INVALID_HID; /* File access property list for data files */
unsigned nerrors = 0; /* Cumulative error count */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
/* Reset library */
@ -2307,7 +2308,7 @@ main(void)
h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g));
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;

View File

@ -2635,11 +2635,12 @@ error:
int
main(void)
{
unsigned nerrors = 0; /* track errors */
H5P_genplist_t *plist; /* Property list pointer for FAPL */
H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
bool api_ctx_pushed = false; /* Whether API context pushed */
int i; /* iterator */
unsigned nerrors = 0; /* track errors */
H5P_genplist_t *plist; /* Property list pointer for FAPL */
H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
int i; /* iterator */
/* Test Setup */
puts("Testing the external file cache");
@ -2662,7 +2663,7 @@ main(void)
h5_fixname(FILENAME[5], fapl_id, filename[5], PATH_MAX);
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;

View File

@ -1628,6 +1628,7 @@ main(void)
farray_iter_type_t curr_iter; /* Current iteration type being worked on */
hid_t fapl = H5I_INVALID_HID; /* File access property list for data files */
unsigned nerrors = 0; /* Cumulative error count */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
/* Reset library */
@ -1638,7 +1639,7 @@ main(void)
h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g));
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;

View File

@ -15958,8 +15958,9 @@ main(void)
unsigned nerrors = 0; /* Cumulative error count */
unsigned num_pb_fs = 1; /* The number of settings to test for page buffering and file space handling */
const char *driver_name; /* Environment variable */
bool contig_addr_vfd; /* Whether VFD used has a contiguous address space */
bool api_ctx_pushed = false; /* Whether API context pushed */
bool contig_addr_vfd; /* Whether VFD used has a contiguous address space */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
int test_express;
/* Don't run this test using certain file drivers */
@ -15999,7 +16000,7 @@ main(void)
init_large_cparam(&large_cparam);
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;

View File

@ -2874,9 +2874,10 @@ error:
int
main(void)
{
hid_t fapl = H5I_INVALID_HID; /* File access property list for data files */
unsigned nerrors = 0; /* Cumulative error count */
bool api_ctx_pushed = false; /* Whether API context pushed */
hid_t fapl = H5I_INVALID_HID; /* File access property list for data files */
unsigned nerrors = 0; /* Cumulative error count */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
h5_test_init();
@ -2886,7 +2887,7 @@ main(void)
} /* end if */
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;

View File

@ -557,16 +557,17 @@ error:
int
main(void)
{
int nerrors = 0;
hid_t fapl_id = H5I_INVALID_HID;
bool api_ctx_pushed = false; /* Whether API context pushed */
int nerrors = 0;
hid_t fapl_id = H5I_INVALID_HID;
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
h5_test_init();
if ((fapl_id = h5_fileaccess()) < 0)
goto error;
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;

View File

@ -41,17 +41,18 @@ static const char *FILENAME[] = {"lheap", NULL};
int
main(void)
{
hid_t fapl = H5P_DEFAULT; /* file access properties */
hid_t file = H5I_INVALID_HID; /* hdf5 file */
H5F_t *f = NULL; /* hdf5 file pointer */
char filename[1024]; /* file name */
haddr_t heap_addr; /* local heap address */
H5HL_t *heap = NULL; /* local heap */
size_t obj[NOBJS]; /* offsets within the heap */
int i, j; /* miscellaneous counters */
char buf[1024]; /* the value to store */
const char *s; /* value to read */
bool api_ctx_pushed = false; /* Whether API context pushed */
hid_t fapl = H5P_DEFAULT; /* file access properties */
hid_t file = H5I_INVALID_HID; /* hdf5 file */
H5F_t *f = NULL; /* hdf5 file pointer */
char filename[1024]; /* file name */
haddr_t heap_addr; /* local heap address */
H5HL_t *heap = NULL; /* local heap */
size_t obj[NOBJS]; /* offsets within the heap */
int i, j; /* miscellaneous counters */
char buf[1024]; /* the value to store */
const char *s; /* value to read */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
bool driver_is_default_compatible;
/* Reset library */
@ -59,7 +60,7 @@ main(void)
fapl = h5_fileaccess();
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;

View File

@ -9126,12 +9126,13 @@ error:
int
main(void)
{
hid_t fapl = H5I_INVALID_HID; /* File access property list for data files */
hid_t new_fapl = H5I_INVALID_HID; /* File access property list for alignment & aggr setting */
unsigned nerrors = 0; /* Cumulative error count */
test_type_t curr_test; /* Current test being worked on */
const char *driver_name; /* File Driver value from environment */
bool api_ctx_pushed = false; /* Whether API context pushed */
hid_t fapl = H5I_INVALID_HID; /* File access property list for data files */
hid_t new_fapl = H5I_INVALID_HID; /* File access property list for alignment & aggr setting */
unsigned nerrors = 0; /* Cumulative error count */
test_type_t curr_test; /* Current test being worked on */
const char *driver_name; /* File Driver value from environment */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
/* Get the VFD to use */
driver_name = h5_get_test_driver_name();
@ -9141,7 +9142,7 @@ main(void)
fapl = h5_fileaccess();
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;

View File

@ -335,9 +335,9 @@ test_compound_dtype2(hid_t file)
TESTING("nested compound datatype");
/* Allocate space for the points & check arrays */
if (NULL == (points = (s1 *)malloc(sizeof(s1) * DIM0 * DIM1)))
if (NULL == (points = malloc(sizeof(s1) * DIM0 * DIM1)))
TEST_ERROR;
if (NULL == (check = (s1 *)calloc(sizeof(s1), DIM0 * DIM1)))
if (NULL == (check = calloc(DIM0 * DIM1, sizeof(s1))))
TEST_ERROR;
/* Initialize the dataset */
@ -535,7 +535,7 @@ test_compound_dtype2(hid_t file)
* Cray */
if (NULL == (tmp = malloc(DIM0 * DIM1 * H5Tget_size(native_type))))
TEST_ERROR;
if (NULL == (bkg = calloc(sizeof(s1), DIM0 * DIM1)))
if (NULL == (bkg = calloc(DIM0 * DIM1, sizeof(s1))))
TEST_ERROR;
if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
@ -648,9 +648,9 @@ test_compound_dtype(hid_t file)
TESTING("compound datatype");
/* Allocate space for the points & check arrays */
if (NULL == (points = (s1 *)malloc(sizeof(s1) * DIM0 * DIM1)))
if (NULL == (points = malloc(sizeof(s1) * DIM0 * DIM1)))
TEST_ERROR;
if (NULL == (check = (s1 *)calloc(sizeof(s1), DIM0 * DIM1)))
if (NULL == (check = calloc(DIM0 * DIM1, sizeof(s1))))
TEST_ERROR;
/* Initialize the dataset */
@ -754,7 +754,7 @@ test_compound_dtype(hid_t file)
* Cray */
if (NULL == (tmp = malloc(DIM0 * DIM1 * H5Tget_size(native_type))))
TEST_ERROR;
if (NULL == (bkg = calloc(sizeof(s1), DIM0 * DIM1)))
if (NULL == (bkg = calloc(DIM0 * DIM1, sizeof(s1))))
TEST_ERROR;
if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
@ -856,9 +856,9 @@ test_compound_dtype3(hid_t file)
TESTING("compound datatype with array as field");
/* Allocate space for the points & check arrays */
if (NULL == (points = (s1 *)malloc(sizeof(s1) * DIM0 * DIM1)))
if (NULL == (points = malloc(sizeof(s1) * DIM0 * DIM1)))
TEST_ERROR;
if (NULL == (check = (s1 *)calloc(sizeof(s1), DIM0 * DIM1)))
if (NULL == (check = calloc(DIM0 * DIM1, sizeof(s1))))
TEST_ERROR;
/* Initialize the dataset */
@ -982,7 +982,7 @@ test_compound_dtype3(hid_t file)
* Cray */
if (NULL == (tmp = malloc(DIM0 * DIM1 * H5Tget_size(native_type))))
TEST_ERROR;
if (NULL == (bkg = calloc(sizeof(s1), DIM0 * DIM1)))
if (NULL == (bkg = calloc(DIM0 * DIM1, sizeof(s1))))
TEST_ERROR;
if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
@ -1091,9 +1091,9 @@ test_compound_opaque(hid_t file)
TESTING("compound datatype with opaque field");
/* Allocate space for the points & check arrays */
if (NULL == (points = (s1 *)malloc(sizeof(s1) * DIM0 * DIM1)))
if (NULL == (points = malloc(sizeof(s1) * DIM0 * DIM1)))
TEST_ERROR;
if (NULL == (check = (s1 *)calloc(sizeof(s1), DIM0 * DIM1)))
if (NULL == (check = calloc(DIM0 * DIM1, sizeof(s1))))
TEST_ERROR;
/* Initialize the dataset */
@ -1208,7 +1208,7 @@ test_compound_opaque(hid_t file)
* Cray */
if (NULL == (tmp = malloc(DIM0 * DIM1 * H5Tget_size(native_type))))
TEST_ERROR;
if (NULL == (bkg = calloc(sizeof(s1), DIM0 * DIM1)))
if (NULL == (bkg = calloc(DIM0 * DIM1, sizeof(s1))))
TEST_ERROR;
if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
@ -1469,9 +1469,9 @@ test_array_dtype(hid_t file)
TESTING("array of compound datatype");
/* Allocate space for the points & check arrays */
if (NULL == (points = (s1 *)malloc(sizeof(s1) * DIM0 * DIM1 * 5)))
if (NULL == (points = malloc(sizeof(s1) * DIM0 * DIM1 * 5)))
TEST_ERROR;
if (NULL == (check = (s1 *)calloc(sizeof(s1), DIM0 * DIM1 * 5)))
if (NULL == (check = calloc(DIM0 * DIM1 * 5, sizeof(s1))))
TEST_ERROR;
/* Initialize the dataset */
@ -2428,9 +2428,9 @@ test_refer_dtype2(hid_t file)
TESTING("dataset region reference");
/* Allocate write & read buffers */
if (NULL == (dwbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2)))
if (NULL == (dwbuf = malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2)))
TEST_ERROR;
if (NULL == (drbuf = (uint8_t *)calloc(sizeof(uint8_t), SPACE2_DIM1 * SPACE2_DIM2)))
if (NULL == (drbuf = calloc(SPACE2_DIM1 * SPACE2_DIM2, sizeof(uint8_t))))
TEST_ERROR;
/* Create dataspace for datasets */

View File

@ -1834,9 +1834,10 @@ main(void)
H5O_loc_t oh_loc; /* Object header locations */
H5F_libver_t low, high; /* File format bounds */
time_t time_new, ro;
int i; /* Local index variable */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret; /* Generic return value */
int i; /* Local index variable */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret; /* Generic return value */
/* Get the VFD to use */
driver_name = h5_get_test_driver_name();
@ -1850,7 +1851,7 @@ main(void)
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;

View File

@ -2051,6 +2051,7 @@ main(void)
hid_t fapl = H5I_INVALID_HID; /* File access property list for data files */
unsigned nerrors = 0; /* Cumulative error count */
const char *driver_name = NULL; /* File Driver value from environment */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
h5_test_init();
@ -2075,7 +2076,7 @@ main(void)
}
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;

View File

@ -698,7 +698,7 @@ test_iter_group_large(hid_t fapl)
} s1_t;
/* Allocate & initialize array */
names = (iter_info *)calloc(sizeof(iter_info), (ITER_NGROUPS + 2));
names = (iter_info *)calloc((ITER_NGROUPS + 2), sizeof(iter_info));
CHECK_PTR(names, "calloc");
/* Output message about test being performed */

View File

@ -124,10 +124,10 @@ test_reference_params(void)
MESSAGE(5, ("Testing Reference Parameters\n"));
/* Allocate write & read buffers */
wbuf = (H5R_ref_t *)calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
rbuf = (H5R_ref_t *)calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
tbuf = (H5R_ref_t *)calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
obuf = calloc(sizeof(unsigned), SPACE1_DIM1);
wbuf = (H5R_ref_t *)calloc(SPACE1_DIM1, sizeof(H5R_ref_t));
rbuf = (H5R_ref_t *)calloc(SPACE1_DIM1, sizeof(H5R_ref_t));
tbuf = (H5R_ref_t *)calloc(SPACE1_DIM1, sizeof(H5R_ref_t));
obuf = calloc(SPACE1_DIM1, sizeof(unsigned));
for (i = 0; i < SPACE1_DIM1; i++)
obuf[i] = i * 3;
@ -468,10 +468,10 @@ test_reference_obj(void)
MESSAGE(5, ("Testing Object Reference Functions\n"));
/* Allocate write & read buffers */
wbuf = calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
rbuf = calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
ibuf = calloc(sizeof(unsigned), SPACE1_DIM1);
obuf = calloc(sizeof(unsigned), SPACE1_DIM1);
wbuf = calloc(SPACE1_DIM1, sizeof(H5R_ref_t));
rbuf = calloc(SPACE1_DIM1, sizeof(H5R_ref_t));
ibuf = calloc(SPACE1_DIM1, sizeof(unsigned));
obuf = calloc(SPACE1_DIM1, sizeof(unsigned));
for (i = 0; i < SPACE1_DIM1; i++)
obuf[i] = i * 3;
@ -571,7 +571,7 @@ test_reference_obj(void)
VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3");
/* Check copying a reference */
wbuf_cp = calloc(sizeof(H5R_ref_t), 1);
wbuf_cp = calloc(1, sizeof(H5R_ref_t));
ret = H5Rcopy(&wbuf[0], &wbuf_cp[0]);
CHECK(ret, FAIL, "H5Rcopy");
@ -838,9 +838,9 @@ test_reference_vlen_obj(void)
MESSAGE(5, ("Testing Object Reference Functions within VLEN type\n"));
/* Allocate write & read buffers */
wbuf = calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
ibuf = calloc(sizeof(unsigned), SPACE1_DIM1);
obuf = calloc(sizeof(unsigned), SPACE1_DIM1);
wbuf = calloc(SPACE1_DIM1, sizeof(H5R_ref_t));
ibuf = calloc(SPACE1_DIM1, sizeof(unsigned));
obuf = calloc(SPACE1_DIM1, sizeof(unsigned));
for (i = 0; i < SPACE1_DIM1; i++)
obuf[i] = i * 3;
@ -1102,8 +1102,8 @@ test_reference_cmpnd_obj(void)
MESSAGE(5, ("Testing Object Reference Functions within compound type\n"));
/* Allocate write & read buffers */
ibuf = calloc(sizeof(unsigned), SPACE1_DIM1);
obuf = calloc(sizeof(unsigned), SPACE1_DIM1);
ibuf = calloc(SPACE1_DIM1, sizeof(unsigned));
obuf = calloc(SPACE1_DIM1, sizeof(unsigned));
for (i = 0; i < SPACE1_DIM1; i++)
obuf[i] = i * 3;
@ -1411,10 +1411,10 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
MESSAGE(5, ("Testing Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
wbuf = calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
rbuf = calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
dwbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
drbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
wbuf = calloc(SPACE1_DIM1, sizeof(H5R_ref_t));
rbuf = calloc(SPACE1_DIM1, sizeof(H5R_ref_t));
dwbuf = (uint8_t *)calloc((size_t)(SPACE2_DIM1 * SPACE2_DIM2), sizeof(uint8_t));
drbuf = (uint8_t *)calloc((size_t)(SPACE2_DIM1 * SPACE2_DIM2), sizeof(uint8_t));
for (tu8 = dwbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++)
*tu8++ = (uint8_t)(i * 3);
@ -1867,10 +1867,10 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
wbuf = calloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1);
rbuf = calloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1);
dwbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
drbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
wbuf = calloc((size_t)SPACE1_DIM1, sizeof(H5R_ref_t));
rbuf = calloc((size_t)SPACE1_DIM1, sizeof(H5R_ref_t));
dwbuf = (uint8_t *)calloc((size_t)SPACE3_DIM1, sizeof(uint8_t));
drbuf = (uint8_t *)calloc((size_t)SPACE3_DIM1, sizeof(uint8_t));
for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
*tu8++ = (uint8_t)(i * 3);
@ -3125,10 +3125,10 @@ test_reference_compat_conv(void)
}
/* Allocate write & read buffers */
wbuf_obj = (hobj_ref_t *)calloc(sizeof(hobj_ref_t), SPACE1_DIM1);
rbuf_obj = calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
wbuf_reg = calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
rbuf_reg = calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
wbuf_obj = calloc(SPACE1_DIM1, sizeof(hobj_ref_t));
rbuf_obj = calloc(SPACE1_DIM1, sizeof(H5R_ref_t));
wbuf_reg = calloc(SPACE1_DIM1, sizeof(hdset_reg_ref_t));
rbuf_reg = calloc(SPACE1_DIM1, sizeof(H5R_ref_t));
/* Create dataspace for datasets */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
@ -3434,17 +3434,17 @@ test_reference_perf(void)
MESSAGE(5, ("Testing Object Reference Performance\n"));
/* Allocate write & read buffers */
wbuf = calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
obuf = calloc(sizeof(unsigned), SPACE1_DIM1);
ibuf = calloc(sizeof(unsigned), SPACE1_DIM1);
wbuf_deprec = (hobj_ref_t *)calloc(sizeof(hobj_ref_t), SPACE1_DIM1);
rbuf = (H5R_ref_t *)calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
rbuf_deprec = (hobj_ref_t *)calloc(sizeof(hobj_ref_t), SPACE1_DIM1);
tbuf = (H5R_ref_t *)calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
wbuf_reg = (H5R_ref_t *)calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
rbuf_reg = (H5R_ref_t *)calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
wbuf_reg_deprec = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
rbuf_reg_deprec = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
wbuf = calloc(SPACE1_DIM1, sizeof(H5R_ref_t));
obuf = calloc(SPACE1_DIM1, sizeof(unsigned));
ibuf = calloc(SPACE1_DIM1, sizeof(unsigned));
wbuf_deprec = calloc(SPACE1_DIM1, sizeof(hobj_ref_t));
rbuf = calloc(SPACE1_DIM1, sizeof(H5R_ref_t));
rbuf_deprec = calloc(SPACE1_DIM1, sizeof(hobj_ref_t));
tbuf = calloc(SPACE1_DIM1, sizeof(H5R_ref_t));
wbuf_reg = calloc(SPACE1_DIM1, sizeof(H5R_ref_t));
rbuf_reg = calloc(SPACE1_DIM1, sizeof(H5R_ref_t));
wbuf_reg_deprec = calloc(SPACE1_DIM1, sizeof(hdset_reg_ref_t));
rbuf_reg_deprec = calloc(SPACE1_DIM1, sizeof(hdset_reg_ref_t));
for (i = 0; i < SPACE1_DIM1; i++)
obuf[i] = i * 3;

View File

@ -623,10 +623,10 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
MESSAGE(5, ("Testing Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
wbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
rbuf = (hdset_reg_ref_t *)malloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
dwbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
drbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
wbuf = calloc((size_t)SPACE1_DIM1, sizeof(hdset_reg_ref_t));
rbuf = malloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
dwbuf = malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
drbuf = calloc((size_t)(SPACE2_DIM1 * SPACE2_DIM2), sizeof(uint8_t));
/* Create file access property list */
fapl = H5Pcreate(H5P_FILE_ACCESS);
@ -1064,10 +1064,10 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
wbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
rbuf = (hdset_reg_ref_t *)malloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
dwbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE3_DIM1);
drbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
wbuf = calloc((size_t)SPACE1_DIM1, sizeof(hdset_reg_ref_t));
rbuf = malloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
dwbuf = malloc(sizeof(uint8_t) * SPACE3_DIM1);
drbuf = calloc((size_t)SPACE3_DIM1, sizeof(uint8_t));
/* Create the file access property list */
fapl = H5Pcreate(H5P_FILE_ACCESS);
@ -1636,10 +1636,10 @@ test_reference_compat(void)
MESSAGE(5, ("Testing Deprecated Object Reference Functions\n"));
/* Allocate write & read buffers */
wbuf_obj = (hobj_ref_t *)calloc(sizeof(hobj_ref_t), SPACE1_DIM1);
rbuf_obj = (hobj_ref_t *)malloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
wbuf_reg = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
rbuf_reg = (hdset_reg_ref_t *)malloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
wbuf_obj = calloc(SPACE1_DIM1, sizeof(hobj_ref_t));
rbuf_obj = malloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
wbuf_reg = calloc(SPACE1_DIM1, sizeof(hdset_reg_ref_t));
rbuf_reg = malloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);

View File

@ -249,7 +249,7 @@ test_select_hyper(hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
rbuf = (uint8_t *)calloc((size_t)(SPACE3_DIM1 * SPACE3_DIM2), sizeof(uint8_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -503,7 +503,7 @@ test_select_point(hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
rbuf = (uint8_t *)calloc((size_t)(SPACE3_DIM1 * SPACE3_DIM2), sizeof(uint8_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -865,7 +865,7 @@ test_select_all(hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3));
rbuf = (uint8_t *)calloc((size_t)(SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3), sizeof(uint8_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -952,7 +952,7 @@ test_select_all_hyper(hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
rbuf = (uint8_t *)calloc((size_t)(SPACE3_DIM1 * SPACE3_DIM2), sizeof(uint8_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -1106,7 +1106,7 @@ test_select_combo(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
rbuf = (uint8_t *)calloc((size_t)(SPACE3_DIM1 * SPACE3_DIM2), sizeof(uint8_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -1301,7 +1301,7 @@ test_select_hyper_stride(hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint16_t *)malloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint16_t *)calloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
rbuf = (uint16_t *)calloc((size_t)(SPACE3_DIM1 * SPACE3_DIM2), sizeof(uint16_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -1447,7 +1447,7 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint16_t *)malloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint16_t *)calloc(sizeof(uint16_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
rbuf = (uint16_t *)calloc((size_t)(SPACE2_DIM1 * SPACE2_DIM2), sizeof(uint16_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -1588,7 +1588,7 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist)
wbuf = (uint16_t *)malloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4);
CHECK_PTR(wbuf, "malloc");
rbuf =
(uint16_t *)calloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4));
(uint16_t *)calloc((size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4), sizeof(uint16_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -1734,7 +1734,7 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist)
wbuf = (uint16_t *)malloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4);
CHECK_PTR(wbuf, "malloc");
rbuf =
(uint16_t *)calloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4));
(uint16_t *)calloc((size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4), sizeof(uint16_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -2003,9 +2003,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, co
block_ptr = &(block[SS_DR_MAX_RANK - large_rank]);
/* Allocate buffers */
small_cube_buf_1 = (uint16_t *)calloc(sizeof(uint16_t), small_cube_size);
small_cube_buf_1 = (uint16_t *)calloc(small_cube_size, sizeof(uint16_t));
CHECK_PTR(small_cube_buf_1, "calloc");
large_cube_buf_1 = (uint16_t *)calloc(sizeof(uint16_t), large_cube_size);
large_cube_buf_1 = (uint16_t *)calloc(large_cube_size, sizeof(uint16_t));
CHECK_PTR(large_cube_buf_1, "calloc");
/* Create a dataset transfer property list */
@ -2539,7 +2539,7 @@ test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist)
*cube_ptr++ = (uint16_t)s;
/* Allocate cube buffer for zeroing values on disk */
zero_buf = (uint16_t *)calloc(sizeof(uint16_t), max_cube_size);
zero_buf = (uint16_t *)calloc(max_cube_size, sizeof(uint16_t));
CHECK_PTR(zero_buf, "calloc");
for (large_rank = 1; large_rank <= max_rank; large_rank++) {
@ -2988,9 +2988,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
assert(large_cube_size < (size_t)(64 * 1024));
/* Allocate & initialize buffers */
small_cube_buf_1 = (uint16_t *)calloc(sizeof(uint16_t), small_cube_size);
small_cube_buf_1 = (uint16_t *)calloc(small_cube_size, sizeof(uint16_t));
CHECK_PTR(small_cube_buf_1, "calloc");
large_cube_buf_1 = (uint16_t *)calloc(sizeof(uint16_t), large_cube_size);
large_cube_buf_1 = (uint16_t *)calloc(large_cube_size, sizeof(uint16_t));
CHECK_PTR(large_cube_buf_1, "calloc");
/* Create a dataset transfer property list */
@ -3615,7 +3615,7 @@ test_select_hyper_checker_board_dr(hid_t dset_type, hid_t xfer_plist)
*cube_ptr++ = (uint16_t)s;
/* Allocate cube buffer for zeroing values on disk */
zero_buf = (uint16_t *)calloc(sizeof(uint16_t), max_cube_size);
zero_buf = (uint16_t *)calloc(max_cube_size, sizeof(uint16_t));
CHECK_PTR(zero_buf, "calloc");
for (large_rank = 1; large_rank <= max_rank; large_rank++) {
@ -3681,9 +3681,9 @@ test_select_hyper_copy(void)
/* Allocate write & read buffers */
wbuf = (uint16_t *)malloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint16_t *)calloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
rbuf = (uint16_t *)calloc((size_t)(SPACE3_DIM1 * SPACE3_DIM2), sizeof(uint16_t));
CHECK_PTR(rbuf, "calloc");
rbuf2 = (uint16_t *)calloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
rbuf2 = (uint16_t *)calloc((size_t)(SPACE3_DIM1 * SPACE3_DIM2), sizeof(uint16_t));
CHECK_PTR(rbuf2, "calloc");
/* Initialize write buffer */
@ -3852,9 +3852,9 @@ test_select_point_copy(void)
/* Allocate write & read buffers */
wbuf = (uint16_t *)malloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint16_t *)calloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
rbuf = (uint16_t *)calloc((size_t)(SPACE3_DIM1 * SPACE3_DIM2), sizeof(uint16_t));
CHECK_PTR(rbuf, "calloc");
rbuf2 = (uint16_t *)calloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
rbuf2 = (uint16_t *)calloc((size_t)(SPACE3_DIM1 * SPACE3_DIM2), sizeof(uint16_t));
CHECK_PTR(rbuf2, "calloc");
/* Initialize write buffer */
@ -4070,7 +4070,7 @@ test_select_hyper_offset(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
rbuf = (uint8_t *)calloc((size_t)(SPACE3_DIM1 * SPACE3_DIM2), sizeof(uint8_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -4278,7 +4278,7 @@ test_select_hyper_offset2(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE7_DIM1 * SPACE7_DIM2));
rbuf = (uint8_t *)calloc((size_t)(SPACE7_DIM1 * SPACE7_DIM2), sizeof(uint8_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -4408,7 +4408,7 @@ test_select_point_offset(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
rbuf = (uint8_t *)calloc((size_t)(SPACE3_DIM1 * SPACE3_DIM2), sizeof(uint8_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -4635,7 +4635,7 @@ test_select_hyper_union(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
rbuf = (uint8_t *)calloc((size_t)(SPACE3_DIM1 * SPACE3_DIM2), sizeof(uint8_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -5413,7 +5413,7 @@ test_select_hyper_union_3d(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint8_t *)calloc(sizeof(uint8_t), SPACE3_DIM1 * SPACE3_DIM2);
rbuf = (uint8_t *)calloc(SPACE3_DIM1 * SPACE3_DIM2, sizeof(uint8_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -5737,7 +5737,7 @@ test_select_hyper_and_2d(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
rbuf = (uint8_t *)calloc((size_t)(SPACE2_DIM1 * SPACE2_DIM2), sizeof(uint8_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -5876,7 +5876,7 @@ test_select_hyper_xor_2d(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
rbuf = (uint8_t *)calloc((size_t)(SPACE2_DIM1 * SPACE2_DIM2), sizeof(uint8_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -6017,7 +6017,7 @@ test_select_hyper_notb_2d(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
rbuf = (uint8_t *)calloc((size_t)(SPACE2_DIM1 * SPACE2_DIM2), sizeof(uint8_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -6156,7 +6156,7 @@ test_select_hyper_nota_2d(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint8_t *)calloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
rbuf = (uint8_t *)calloc((size_t)(SPACE2_DIM1 * SPACE2_DIM2), sizeof(uint8_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -6326,8 +6326,8 @@ test_select_hyper_union_random_5d(hid_t read_plist)
/* Allocate write & read buffers */
wbuf = (int *)malloc(sizeof(int) * SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5);
CHECK_PTR(wbuf, "malloc");
rbuf = (int *)calloc(sizeof(int),
(size_t)(SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5));
rbuf = (int *)calloc((size_t)(SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5),
sizeof(int));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -7997,7 +7997,7 @@ test_select_none(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2);
CHECK_PTR(wbuf, "malloc");
rbuf = (uint8_t *)calloc(sizeof(uint8_t), SPACE7_DIM1 * SPACE7_DIM2);
rbuf = (uint8_t *)calloc(SPACE7_DIM1 * SPACE7_DIM2, sizeof(uint8_t));
CHECK_PTR(rbuf, "calloc");
/* Initialize write buffer */
@ -13581,7 +13581,7 @@ test_select_hyper_chunk_offset(void)
/* Allocate buffers */
wbuf = (int *)malloc(sizeof(int) * SPACE10_DIM1);
CHECK_PTR(wbuf, "malloc");
rbuf = (int *)calloc(sizeof(int), SPACE10_DIM1);
rbuf = (int *)calloc(SPACE10_DIM1, sizeof(int));
CHECK_PTR(rbuf, "calloc");
/* Initialize the write buffer */

View File

@ -275,16 +275,17 @@ error:
int
main(void)
{
hid_t fapl_id = H5I_INVALID_HID;
int nerrors = 0;
bool api_ctx_pushed = false; /* Whether API context pushed */
hid_t fapl_id = H5I_INVALID_HID;
int nerrors = 0;
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
/* Testing setup */
h5_test_init();
fapl_id = h5_fileaccess();
/* Push API context */
if (H5CX_push() < 0)
if (H5CX_push(&api_ctx) < 0)
FAIL_STACK_ERROR;
api_ctx_pushed = true;

View File

@ -1681,7 +1681,8 @@ exercise_reg_opt_oper(hid_t fake_vol_id, hid_t reg_opt_vol_id, H5VL_subclass_t s
int fake_obj, fake_arg;
int op_val = -1, op_val2 = -1;
int find_op_val;
herr_t ret = SUCCEED;
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
herr_t ret = SUCCEED;
/* Test registering optional operation */
snprintf(op_name, sizeof(op_name), "%s-op1", subcls_name);
@ -1724,7 +1725,7 @@ exercise_reg_opt_oper(hid_t fake_vol_id, hid_t reg_opt_vol_id, H5VL_subclass_t s
/* Push a new API context on the stack */
/* (Necessary for the named datatype construction routines) */
if (H5VL_SUBCLS_DATATYPE == subcls)
H5CX_push();
H5CX_push(&api_ctx);
/* Create fake object on fake VOL connector */
if (H5I_INVALID_HID == (obj_id = H5VL__register_using_vol_id_test(id_type, &fake_obj, fake_vol_id)))
@ -1779,8 +1780,9 @@ exercise_reg_opt_oper(hid_t fake_vol_id, hid_t reg_opt_vol_id, H5VL_subclass_t s
/* Push a new API context on the stack */
/* (Necessary for the named datatype construction routines) */
memset(&api_ctx, 0, sizeof(api_ctx));
if (H5VL_SUBCLS_DATATYPE == subcls)
H5CX_push();
H5CX_push(&api_ctx);
/* Create fake object on reg_opt VOL connector */
if (H5I_INVALID_HID == (obj_id = H5VL__register_using_vol_id_test(id_type, &fake_obj, reg_opt_vol_id)))

View File

@ -3591,6 +3591,7 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr
H5F_t *file_ptr = NULL;
H5C_t *cache_ptr = NULL;
haddr_t actual_base_addr;
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
assert(fid_ptr != NULL);
assert(file_ptr_ptr != NULL);
@ -3599,7 +3600,7 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr
fid = H5Fcreate(filenames[0], H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
/* Push API context */
H5CX_push();
H5CX_push(&api_ctx);
if (fid < 0) {
nerrors++;
@ -4043,7 +4044,6 @@ take_down_cache(hid_t fid, H5C_t *cache_ptr)
}
return (success);
} /* take_down_cache() */
/*****************************************************************************
@ -4945,6 +4945,7 @@ smoke_check_1(int metadata_write_strategy)
}
else /* run the clients */
{
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
if (!setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy)) {
nerrors++;
@ -4955,6 +4956,9 @@ smoke_check_1(int metadata_write_strategy)
}
}
/* Push API context */
H5CX_push(&api_ctx);
for (i = 0; i < (virt_num_data_entries / 2); i++) {
insert_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
}
@ -5021,6 +5025,9 @@ smoke_check_1(int metadata_write_strategy)
}
}
}
/* Pop API context */
H5CX_pop(false);
}
max_nerrors = get_max_nerrors();
@ -5041,7 +5048,6 @@ smoke_check_1(int metadata_write_strategy)
success = ((success) && (max_nerrors == 0));
return (success);
} /* smoke_check_1() */
/*****************************************************************************
@ -5107,6 +5113,7 @@ smoke_check_2(int metadata_write_strategy)
}
else /* run the clients */
{
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
if (!setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy)) {
nerrors++;
@ -5117,6 +5124,9 @@ smoke_check_2(int metadata_write_strategy)
}
}
/* Push API context */
H5CX_push(&api_ctx);
for (i = 0; i < (virt_num_data_entries / 2); i++) {
insert_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
@ -5217,6 +5227,9 @@ smoke_check_2(int metadata_write_strategy)
}
}
}
/* Pop API context */
H5CX_pop(false);
}
max_nerrors = get_max_nerrors();
@ -5237,7 +5250,6 @@ smoke_check_2(int metadata_write_strategy)
success = ((success) && (max_nerrors == 0));
return (success);
} /* smoke_check_2() */
/*****************************************************************************
@ -5310,6 +5322,7 @@ smoke_check_3(int metadata_write_strategy)
}
else /* run the clients */
{
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
if (!setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy)) {
nerrors++;
@ -5320,6 +5333,9 @@ smoke_check_3(int metadata_write_strategy)
}
}
/* Push API context */
H5CX_push(&api_ctx);
min_count = 100 / ((file_mpi_rank + 1) * (file_mpi_rank + 1));
max_count = min_count + 50;
@ -5500,6 +5516,9 @@ smoke_check_3(int metadata_write_strategy)
}
}
}
/* Pop API context */
H5CX_pop(false);
}
max_nerrors = get_max_nerrors();
@ -5520,7 +5539,6 @@ smoke_check_3(int metadata_write_strategy)
success = ((success) && (max_nerrors == 0));
return (success);
} /* smoke_check_3() */
/*****************************************************************************
@ -5593,6 +5611,7 @@ smoke_check_4(int metadata_write_strategy)
}
else /* run the clients */
{
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
if (!setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy)) {
nerrors++;
@ -5603,6 +5622,9 @@ smoke_check_4(int metadata_write_strategy)
}
}
/* Push API context */
H5CX_push(&api_ctx);
min_count = 100 * (file_mpi_rank % 4);
max_count = min_count + 50;
@ -5782,6 +5804,9 @@ smoke_check_4(int metadata_write_strategy)
}
}
}
/* Pop API context */
H5CX_pop(false);
}
max_nerrors = get_max_nerrors();
@ -5802,7 +5827,6 @@ smoke_check_4(int metadata_write_strategy)
success = ((success) && (max_nerrors == 0));
return (success);
} /* smoke_check_4() */
/*****************************************************************************
@ -5866,6 +5890,7 @@ smoke_check_5(int metadata_write_strategy)
}
else /* run the clients */
{
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
if (!setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy)) {
@ -5877,6 +5902,9 @@ smoke_check_5(int metadata_write_strategy)
}
}
/* Push API context */
H5CX_push(&api_ctx);
for (i = 0; i < (virt_num_data_entries / 2); i++) {
insert_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
}
@ -5972,6 +6000,9 @@ smoke_check_5(int metadata_write_strategy)
}
}
}
/* Pop API context */
H5CX_pop(false);
}
max_nerrors = get_max_nerrors();
@ -5992,7 +6023,6 @@ smoke_check_5(int metadata_write_strategy)
success = ((success) && (max_nerrors == 0));
return (success);
} /* smoke_check_5() */
/*****************************************************************************
@ -6148,6 +6178,7 @@ trace_file_check(int metadata_write_strategy)
}
else {
/* run the clients */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
if (!setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy)) {
@ -6158,6 +6189,9 @@ trace_file_check(int metadata_write_strategy)
fprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, __func__);
}
/* Push API context */
H5CX_push(&api_ctx);
if (nerrors == 0) {
config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
@ -6370,6 +6404,9 @@ trace_file_check(int metadata_write_strategy)
trace_file_ptr = NULL;
HDremove(trace_file_name);
}
/* Pop API context */
H5CX_pop(false);
} /* end giant else that runs clients */
max_nerrors = get_max_nerrors();
@ -6388,7 +6425,6 @@ trace_file_check(int metadata_write_strategy)
success = ((success) && (max_nerrors == 0));
return (success);
} /* trace_file_check() */
/*****************************************************************************
@ -6453,7 +6489,8 @@ smoke_check_6(int metadata_write_strategy)
}
else /* run the clients */
{
int temp;
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
int temp;
if (!setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy)) {
@ -6465,6 +6502,9 @@ smoke_check_6(int metadata_write_strategy)
}
}
/* Push API context */
H5CX_push(&api_ctx);
temp = virt_num_data_entries;
virt_num_data_entries = NUM_DATA_ENTRIES;
@ -6621,6 +6661,9 @@ smoke_check_6(int metadata_write_strategy)
}
}
virt_num_data_entries = temp;
/* Pop API context */
H5CX_pop(false);
}
max_nerrors = get_max_nerrors();
@ -6641,7 +6684,6 @@ smoke_check_6(int metadata_write_strategy)
success = ((success) && (max_nerrors == 0));
return (success);
} /* smoke_check_6() */
/*****************************************************************************

View File

@ -141,12 +141,13 @@ test_page_buffer_access(const void *params)
hid_t fcpl, fapl;
herr_t ret; /* generic return value */
#ifdef PB_OUT
size_t page_count = 0;
int i, num_elements = 200;
haddr_t raw_addr, meta_addr;
int *data;
H5F_t *f = NULL;
bool api_ctx_pushed = false; /* Whether API context pushed */
size_t page_count = 0;
int i, num_elements = 200;
haddr_t raw_addr, meta_addr;
int *data;
H5F_t *f = NULL;
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
#endif
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
@ -229,7 +230,7 @@ test_page_buffer_access(const void *params)
VRFY((file_id >= 0), "");
/* Push API context */
ret = H5CX_push();
ret = H5CX_push(&api_ctx);
VRFY((ret == 0), "H5CX_push()");
api_ctx_pushed = true;
@ -339,7 +340,7 @@ test_page_buffer_access(const void *params)
VRFY((file_id >= 0), "");
/* Push API context */
ret = H5CX_push();
ret = H5CX_push(&api_ctx);
VRFY((ret == 0), "H5CX_push()");
api_ctx_pushed = true;
@ -483,7 +484,8 @@ create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_str
H5F_t *f = NULL;
H5C_t *cache_ptr = NULL;
H5AC_cache_config_t config;
bool api_ctx_pushed = false; /* Whether API context pushed */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret;
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
@ -493,7 +495,7 @@ create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_str
VRFY((ret == 0), "");
/* Push API context */
ret = H5CX_push();
ret = H5CX_push(&api_ctx);
VRFY((ret == 0), "H5CX_push()");
api_ctx_pushed = true;
@ -639,7 +641,8 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, hsize_t
H5F_t *f = NULL;
H5C_t *cache_ptr = NULL;
H5AC_cache_config_t config;
bool api_ctx_pushed = false; /* Whether API context pushed */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t ret;
config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
@ -656,7 +659,7 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, hsize_t
VRFY((file_id >= 0), "");
/* Push API context */
ret = H5CX_push();
ret = H5CX_push(&api_ctx);
VRFY((ret == 0), "H5CX_push()");
api_ctx_pushed = true;

View File

@ -21,10 +21,10 @@
/* Define this macro to indicate that the testing APIs should be available */
#define H5S_TESTING
#include "H5Spkg.h" /* Dataspaces */
#include "testpar.h"
#include "H5Spkg.h" /* Dataspaces */
/* Include testing framework functionality */
#include "testframe.h"

View File

@ -233,7 +233,8 @@ main(int argc, char *argv[])
size_t u;
H5E_auto2_t func = NULL;
void *edata = NULL;
bool api_ctx_pushed = false; /* Whether API context pushed */
H5CX_node_t api_ctx = {{0}, NULL}; /* API context node to push */
bool api_ctx_pushed = false; /* Whether API context pushed */
herr_t status = SUCCEED;
int exit_value = 0;
@ -275,7 +276,7 @@ main(int argc, char *argv[])
} /* end if */
/* Push API context */
if (H5CX_push() < 0) {
if (H5CX_push(&api_ctx) < 0) {
fprintf(stderr, "cannot set API context\n");
exit_value = 1;
goto done;