diff options
author | kmu <kmu@hdfgroup.org> | 2020-01-06 19:04:23 (GMT) |
---|---|---|
committer | kmu <kmu@hdfgroup.org> | 2020-01-06 19:04:23 (GMT) |
commit | e938f4407eeea3f55dc5df291a2a83854f54404a (patch) | |
tree | cc3a3eef4845d8b6c134e15d60e97aece8a8455c /src | |
parent | 7366709e4000a96a9942934da0d13474213567f3 (diff) | |
parent | 127f07d64affc285e729923b514b4d7f3c19ceeb (diff) | |
download | hdf5-e938f4407eeea3f55dc5df291a2a83854f54404a.zip hdf5-e938f4407eeea3f55dc5df291a2a83854f54404a.tar.gz hdf5-e938f4407eeea3f55dc5df291a2a83854f54404a.tar.bz2 |
Merge branch 'develop' of https://git.hdfgroup.org/scm/hdffv/hdf5 into develop
Diffstat (limited to 'src')
99 files changed, 3561 insertions, 1886 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c794c1a..4b020fa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -657,6 +657,7 @@ set (H5VL_SOURCES ${HDF5_SRC_DIR}/H5VLnative_file.c ${HDF5_SRC_DIR}/H5VLnative_group.c ${HDF5_SRC_DIR}/H5VLnative_link.c + ${HDF5_SRC_DIR}/H5VLnative_introspect.c ${HDF5_SRC_DIR}/H5VLnative_object.c ${HDF5_SRC_DIR}/H5VLpassthru.c ) @@ -100,6 +100,29 @@ static hbool_t H5A_top_package_initialize_s = FALSE; +/*------------------------------------------------------------------------- + * Function: H5A_init + * + * Purpose: Initialize the interface from some other layer. + * + * Return: Success: non-negative + * + * Failure: negative + *------------------------------------------------------------------------- + */ +herr_t +H5A_init(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + /* FUNC_ENTER() does all the work */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5A_init() */ + + /*-------------------------------------------------------------------------- NAME H5A__init_package -- Initialize interface-specific information @@ -360,13 +383,9 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - - if(H5P_DEFAULT != lapl_id) { - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID") - H5CX_set_lapl(lapl_id); - } + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info") + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set link access property list info") /* Set up location struct */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -507,16 +526,9 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - - /* Set lapl_id and add to context */ - if(H5P_DEFAULT != lapl_id) { - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID") - H5CX_set_lapl(lapl_id); - } - else - lapl_id = H5P_LINK_ACCESS_DEFAULT; + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info") + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set link access property list info") /* Fill in location struct fields */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -595,16 +607,9 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - - /* Set lapl_id and add to context */ - if(H5P_DEFAULT != lapl_id) { - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID") - H5CX_set_lapl(lapl_id); - } - else - lapl_id = H5P_LINK_ACCESS_DEFAULT; + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info") + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set link access property list info") /* Fill in location struct parameters */ loc_params.type = H5VL_OBJECT_BY_IDX; diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 8d0e33c..5fc2823 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -147,7 +147,8 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, type_id, space_id, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, type_id, space_id, acpl_id, + H5P_ATTRIBUTE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ @@ -212,7 +213,8 @@ H5Aopen_name(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, name, H5P_ATTRIBUTE_ACCESS_DEFAULT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ @@ -280,7 +282,8 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, H5P_ATTRIBUTE_ACCESS_DEFAULT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ @@ -334,7 +337,7 @@ H5Aget_num_attrs(hid_t loc_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get the number of attributes for the object */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, &oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, &oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object") H5_CHECKED_ASSIGN(ret_value, int, oinfo.num_attrs, hsize_t); @@ -399,7 +402,7 @@ H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier") /* Call attribute iteration routine */ - if((ret_value = H5VL_attr_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_ATTR_ITERATE_OLD, loc_id, attr_num, op, op_data)) < 0) + if((ret_value = H5VL_attr_optional(vol_obj, H5VL_NATIVE_ATTR_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_id, attr_num, op, op_data)) < 0) HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes"); done: diff --git a/src/H5Aint.c b/src/H5Aint.c index 436fced..90fb5c8 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -181,8 +181,9 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, if(NULL == (attr->shared = H5FL_CALLOC(H5A_shared_t))) HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "can't allocate shared attr structure") - /* If the creation property list is H5P_DEFAULT, use the default character encoding */ - if(acpl_id == H5P_DEFAULT) + /* If the creation property list is H5P_ATTRIBUTE_CREATE_DEFAULT, use the default character encoding */ + HDassert(acpl_id != H5P_DEFAULT); + if(acpl_id == H5P_ATTRIBUTE_CREATE_DEFAULT) attr->shared->encoding = H5F_DEFAULT_CSET; else { H5P_genplist_t *ac_plist; /* ACPL Property list */ @@ -2026,7 +2027,7 @@ H5A__set_version(const H5F_t *f, H5A_t *attr) version = H5O_ATTR_VERSION_1; /* Write out basic version */ /* Upgrade to the version indicated by the file's low bound if higher */ - version = MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]); + version = (uint8_t)MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]); /* Version bounds check */ if(version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(f)]) diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h index 342ffc8..b288228 100644 --- a/src/H5Aprivate.h +++ b/src/H5Aprivate.h @@ -73,6 +73,7 @@ typedef struct H5A_attr_iter_op_t { /***************************************/ /* General attribute routines */ +H5_DLL herr_t H5A_init(void); H5_DLL struct H5O_loc_t *H5A_oloc(H5A_t *attr); H5_DLL H5G_name_t *H5A_nameof(H5A_t *attr); H5_DLL H5T_t *H5A_type(const H5A_t *attr); diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 2a77bd5..65286e6 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -398,7 +398,8 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_HDR_VERSION; /* B-tree type */ - *image++ = hdr->cls->id; + HDassert(hdr->cls->id <= 255); + *image++ = (uint8_t)hdr->cls->id; /* Node size (in bytes) */ UINT32ENCODE(image, hdr->node_size); @@ -818,7 +819,8 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_INT_VERSION; /* B-tree type */ - *image++ = internal->hdr->cls->id; + HDassert(internal->hdr->cls->id <= 255); + *image++ = (uint8_t)internal->hdr->cls->id; HDassert((size_t)(image - (uint8_t *)_image) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); /* Serialize records for internal node */ @@ -1219,7 +1221,8 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H *image++ = H5B2_LEAF_VERSION; /* B-tree type */ - *image++ = leaf->hdr->cls->id; + HDassert(leaf->hdr->cls->id <= 255); + *image++ = (uint8_t)leaf->hdr->cls->id; HDassert((size_t)(image - (uint8_t *)_image) == (H5B2_LEAF_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); /* Serialize records for leaf node */ diff --git a/src/H5B2int.c b/src/H5B2int.c index 2d77276..ea03ed6 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -239,7 +239,7 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, old_node_nrec = internal->node_ptrs[idx].node_nrec; /* Determine "middle" record to promote to internal node */ - mid_record = old_node_nrec / 2; + mid_record = (uint16_t)(old_node_nrec / 2); /* Copy "upper half" of records to new child */ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0), @@ -507,8 +507,8 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, if(*left_nrec < *right_nrec) { /* Moving record from right node to left */ - uint16_t new_right_nrec = (uint16_t)(*left_nrec + *right_nrec) / 2; /* New number of records for right child */ - uint16_t move_nrec = (uint16_t)(*right_nrec - new_right_nrec); /* Number of records to move from right node to left */ + uint16_t new_right_nrec = (uint16_t)((*left_nrec + *right_nrec) / 2); /* New number of records for right child */ + uint16_t move_nrec = (uint16_t)(*right_nrec - new_right_nrec); /* Number of records to move from right node to left */ /* Copy record from parent node down into left child */ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); @@ -558,8 +558,8 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, else { /* Moving record from left node to right */ - uint16_t new_left_nrec = (uint16_t)(*left_nrec + *right_nrec) / 2; /* New number of records for left child */ - uint16_t move_nrec = (uint16_t)(*left_nrec - new_left_nrec); /* Number of records to move from left node to right */ + uint16_t new_left_nrec = (uint16_t)((*left_nrec + *right_nrec) / 2); /* New number of records for left child */ + uint16_t move_nrec = (uint16_t)(*left_nrec - new_left_nrec); /* Number of records to move from left node to right */ /* Sanity check */ HDassert(*left_nrec > *right_nrec); @@ -762,8 +762,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, { /* Compute new # of records in each node */ unsigned total_nrec = (unsigned)(*left_nrec + *middle_nrec + *right_nrec + 2); - uint16_t new_middle_nrec = (uint16_t)(total_nrec - 2) / 3; - uint16_t new_left_nrec = (uint16_t)((total_nrec - 2) - new_middle_nrec) / 2; + uint16_t new_middle_nrec = (uint16_t)((total_nrec - 2) / 3); + uint16_t new_left_nrec = (uint16_t)(((total_nrec - 2) - new_middle_nrec) / 2); uint16_t new_right_nrec = (uint16_t)((total_nrec - 2) - (unsigned)(new_left_nrec + new_middle_nrec)); uint16_t curr_middle_nrec = *middle_nrec; @@ -54,12 +54,6 @@ /* Package initialization variable */ hbool_t H5_PKG_INIT_VAR = FALSE; -/* Declare extern the free list to manage blocks of VL data */ -H5FL_BLK_EXTERN(vlen_vl_buf); - -/* Declare extern the free list to manage other blocks of VL data */ -H5FL_BLK_EXTERN(vlen_fl_buf); - /*****************************/ /* Library Private Variables */ @@ -717,14 +711,6 @@ done: * VL data, in memory. The *size value is modified according to how many * bytes are required to store the VL data in memory. * - * Implementation: This routine actually performs the read with a custom - * memory manager which basically just counts the bytes requested and - * uses a temporary memory buffer (through the H5FL API) to make certain - * enough space is available to perform the read. Then the temporary - * buffer is released and the number of bytes allocated is returned. - * Kinda kludgy, but easier than the other method of trying to figure out - * the sizes without actually reading the data in... - QAK - * * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol @@ -734,105 +720,43 @@ done: */ herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, - hsize_t *size) + hsize_t *size) { - H5D_vlen_bufsize_t vlen_bufsize = {NULL, H5I_INVALID_HID, H5I_INVALID_HID, NULL, NULL, 0, H5P_DATASET_XFER_DEFAULT}; - H5VL_object_t *vol_obj; /* Dataset for this operation */ - H5S_t *mspace = NULL; /* Memory dataspace */ - char bogus; /* bogus value to pass to H5Diterate() */ - H5S_t *space; /* Dataspace for iteration */ - H5T_t *type; /* Datatype */ - H5S_sel_iter_op_t dset_op; /* Operator for iteration */ - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ + hbool_t supported; /* Whether 'get vlen buf size' operation is supported by VOL connector */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "iii*h", dataset_id, type_id, space_id, size); /* Check args */ - if(H5I_DATASET != H5I_get_type(dataset_id) || - H5I_DATATYPE != H5I_get_type(type_id) || size == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(dataset_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") - if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace") - if(!(H5S_has_extent(space))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set") - - /* Save the dataset */ - vlen_bufsize.dset_vol_obj = vol_obj; - - /* Get a copy of the dataset's dataspace */ - if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace") - - /* Create a scalar for the memory dataspace */ - if(NULL == (mspace = H5S_create(H5S_SCALAR))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") - if((vlen_bufsize.mspace_id = H5I_register(H5I_DATASPACE, mspace, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") - - /* Grab the temporary buffers required */ - if(NULL == (vlen_bufsize.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, (size_t)1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available") - if(NULL == (vlen_bufsize.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available") - - /* Set the memory manager to the special allocation routine */ - if(H5CX_set_vlen_alloc_info(H5D__vlen_get_buf_size_alloc, &vlen_bufsize, NULL, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine") - - /* If we are not using the native VOL connector we must also set this - * property on the DXPL since the context is not visible to the connector - * and will be ignored if the connector re-enters the library */ - if(vol_obj->connector->cls->value != H5VL_NATIVE_VALUE) { - H5P_genplist_t *dxpl; - - if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get default DXPL") - if((vlen_bufsize.dxpl_id = H5P_copy_plist(dxpl, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, H5I_INVALID_HID, "can't copy property list"); - if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(vlen_bufsize.dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get copied DXPL") - if(H5P_set_vlen_mem_manager(dxpl, H5D__vlen_get_buf_size_alloc, &vlen_bufsize, NULL, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine on DXPL") + if(H5I_DATATYPE != H5I_get_type(type_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid datatype identifier") + if(H5I_DATASPACE != H5I_get_type(space_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace identifier") + if(size == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid 'size' pointer") + + /* Check if the 'get_vlen_buf_size' callback is supported */ + supported = FALSE; + if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_DATASET, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, &supported) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'get vlen buf size' operation") + if(supported) { + /* Make the 'get_vlen_buf_size' callback */ + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id, space_id, size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get vlen buf size") } /* end if */ - - /* Set the initial number of bytes required */ - vlen_bufsize.size = 0; - - /* Call H5S_select_iterate with args, etc. */ - dset_op.op_type = H5S_SEL_ITER_OP_APP; - dset_op.u.app_op.op = H5D__vlen_get_buf_size; - dset_op.u.app_op.type_id = type_id; - - ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize); - - /* Get the size if we succeeded */ - if(ret_value >= 0) - *size = vlen_bufsize.size; + else { + /* Perform a generic operation that will work with all VOL connectors */ + if(H5D__vlen_get_buf_size_gen(vol_obj, type_id, space_id, size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get vlen buf size") + } /* end else */ done: - if(ret_value < 0) - if(mspace && H5S_close(mspace) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") - - if(vlen_bufsize.fspace_id >= 0 && H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") - if(vlen_bufsize.mspace_id >= 0 && H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") - if(vlen_bufsize.fl_tbuf != NULL) - vlen_bufsize.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf); - if(vlen_bufsize.vl_tbuf != NULL) - vlen_bufsize.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.vl_tbuf); - if(vlen_bufsize.dxpl_id != H5P_DATASET_XFER_DEFAULT) - if(H5I_dec_app_ref(vlen_bufsize.dxpl_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close property list") - FUNC_LEAVE_API(ret_value) -} /* end H5Dvlen_get_buf_size() */ +} /* end H5Dvlen_get_buf_size() */ /*------------------------------------------------------------------------- @@ -981,7 +905,7 @@ H5Dformat_convert(hid_t dset_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Convert the dataset */ - if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_FORMAT_CONVERT) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_FORMAT_CONVERT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format") done: @@ -1017,7 +941,7 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL") /* Get the chunk indexing type */ - if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type") done: @@ -1058,7 +982,7 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL") /* Get the dataset creation property list */ - if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, offset, chunk_nbytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") done: @@ -1103,13 +1027,13 @@ H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") /* Get the number of written chunks */ - if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, fspace_id, nchunks) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fspace_id, nchunks) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks") done: FUNC_LEAVE_API(ret_value); } /* H5Dget_num_chunks() */ - + /*------------------------------------------------------------------------- * Function: H5Dget_chunk_info @@ -1151,7 +1075,7 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* Get the number of written chunks to check range */ - if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, fspace_id, &nchunks) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fspace_id, &nchunks) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks") /* Check range for chunk index */ @@ -1159,7 +1083,7 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk index is out of range") /* Call private function to get the chunk info given the chunk's index */ - if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX, fspace_id, chk_index, offset, filter_mask, addr, size) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fspace_id, chk_index, offset, filter_mask, addr, size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by index") done: @@ -1206,7 +1130,7 @@ H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filte HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") /* Call private function to get the chunk info given the chunk's index */ - if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD, offset, filter_mask, addr, size) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, offset, filter_mask, addr, size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by its logical coordinates") done: diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 35773b6..17b0d16 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -1100,14 +1100,10 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf H5D_chunk_map_t *fm) { const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */ - H5S_t *tmp_mspace = NULL; /* Temporary memory dataspace */ hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */ htri_t file_space_normalized = FALSE; /* File dataspace was normalized */ - H5T_t *file_type = NULL; /* Temporary copy of file datatype for iteration */ - hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */ unsigned f_ndims; /* The number of dimensions of the file's dataspace */ int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */ - char bogus; /* "bogus" buffer to pass to selection iterator */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1268,22 +1264,22 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_ else sel_hyper_flag = TRUE; - /* Check if file selection is a not a hyperslab selection */ - if(sel_hyper_flag) { - /* Build the file selection for each chunk */ - if(H5S_SEL_ALL == fm->fsel_type) { - if(H5D__create_chunk_file_map_all(fm, io_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections") - } /* end if */ - else { - /* Sanity check */ - HDassert(fm->fsel_type == H5S_SEL_HYPERSLABS); - - if(H5D__create_chunk_file_map_hyper(fm, io_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections") - } /* end else */ + /* Check if file selection is a not a hyperslab selection */ + if(sel_hyper_flag) { + /* Build the file selection for each chunk */ + if(H5S_SEL_ALL == fm->fsel_type) { + if(H5D__create_chunk_file_map_all(fm, io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections") } /* end if */ else { + /* Sanity check */ + HDassert(fm->fsel_type == H5S_SEL_HYPERSLABS); + + if(H5D__create_chunk_file_map_hyper(fm, io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections") + } /* end else */ + } /* end if */ + else { H5S_sel_iter_op_t iter_op; /* Operator for iteration */ H5D_chunk_file_iter_ud_t udata; /* User data for iteration */ @@ -1320,14 +1316,12 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_ if(H5D__create_chunk_mem_map_hyper(fm) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections") } /* end if */ - else if(sel_hyper_flag && - fm->f_ndims == 1 && fm->m_ndims == 1 && + else if(sel_hyper_flag && fm->f_ndims == 1 && fm->m_ndims == 1 && H5S_SELECT_IS_REGULAR(fm->mem_space) && H5S_SELECT_IS_SINGLE(fm->mem_space)) { - if(H5D__create_chunk_mem_map_1d(fm) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections") - - } else { + } /* end else-if */ + else { H5S_sel_iter_op_t iter_op; /* Operator for iteration */ size_t elmt_size; /* Memory datatype size */ @@ -1343,8 +1337,8 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_ fm->mchunk_tmpl = tmp_mspace; /* Create temporary datatypes for selection iteration */ - if(!file_type) - if(NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL))) + if(!file_type) + if(NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype") /* Create selection iterator for memory selection */ @@ -1366,11 +1360,9 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_ done: /* Release the [potentially partially built] chunk mapping information if an error occurs */ if(ret_value < 0) { - if(tmp_mspace && !fm->mchunk_tmpl) { + if(tmp_mspace && !fm->mchunk_tmpl) if(H5S_close(tmp_mspace) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template") - } /* end if */ - if(H5D__chunk_io_term(fm) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release chunk mapping") } /* end if */ @@ -2139,13 +2131,7 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) { H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */ H5SL_node_t *curr_node; /* Current node in skip list */ - hsize_t file_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */ - hsize_t file_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */ - hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */ - hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */ - hssize_t adjust[H5S_MAX_RANK]; /* Adjustment to make to all file chunks */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -2171,6 +2157,7 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) else { hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */ hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */ + HDassert(fm->m_ndims == 1); if(H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end) < 0) @@ -2179,7 +2166,7 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) /* Iterate over each chunk in the chunk list */ curr_node = H5SL_first(fm->sel_chunks); while(curr_node) { - hssize_t schunk_points; /* Number of elements in chunk selection */ + hsize_t chunk_points; /* Number of elements in chunk selection */ hsize_t tmp_count = 1; /* Get pointer to chunk's information */ @@ -2190,12 +2177,12 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) if((chunk_info->mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space") - schunk_points = H5S_GET_SELECT_NPOINTS(chunk_info->fspace); + chunk_points = H5S_GET_SELECT_NPOINTS(chunk_info->fspace); - if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count, &schunk_points) < 0) + if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count, &chunk_points) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection") - mem_sel_start[0] += schunk_points; + mem_sel_start[0] += chunk_points; /* Get the next chunk node in the skip list */ curr_node = H5SL_next(curr_node); @@ -5037,8 +5024,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, blocks++; } - /* MSC - * should use this if MPI_type_create_hindexed block is working + /* MSC - should use this if MPI_type_create_hindexed block is working: * mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE, &file_type); */ mpi_code = MPI_Type_create_hindexed(blocks, block_lens, chunk_disp_array, MPI_BYTE, &file_type); @@ -5512,7 +5498,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) } /* end if */ else dims_outside_fill[u] = FALSE; - } /* end if */ + } /* end else */ carry = FALSE; while(!carry) { @@ -5665,9 +5651,8 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) H5D_chunk_it_ud2_t *udata = (H5D_chunk_it_ud2_t *)_udata; /* User data for callback */ unsigned rank = udata->common.layout->ndims - 1; /* # of dimensions of dataset */ hsize_t chunk_index; - int ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* Compute the index for this chunk */ chunk_index = H5VM_array_offset_pre(rank, udata->common.layout->down_chunks, chunk_rec->scaled); @@ -5675,8 +5660,7 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Set it in the userdata to return */ udata->chunk_addr[chunk_index] = chunk_rec->chunk_addr; -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(H5_ITER_CONT) } /* H5D__chunk_addrmap_cb() */ @@ -5969,11 +5953,10 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Check for an edge chunk that is not filtered */ if(pline && pline->nused) { must_filter = TRUE; - if( (udata->common.layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) && - (H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, udata->common.layout->dim, - chunk_rec->scaled, udata->dset_dims)) ) + if((udata->common.layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) && + H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, udata->common.layout->dim, chunk_rec->scaled, udata->dset_dims)) must_filter = FALSE; - } + } /* end if */ /* Check parameter for type conversion */ if(udata->do_convert) { @@ -6011,7 +5994,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) HDassert(!H5F_addr_defined(chunk_rec->chunk_addr)); H5MM_memcpy(buf, udata->chunk, nbytes); udata->chunk = NULL; - } + } /* end if */ else { H5D_rdcc_ent_t *ent = NULL; /* Cache entry */ unsigned idx; /* Index of chunk in cache, if present */ @@ -6044,13 +6027,13 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) H5_CHECKED_ASSIGN(nbytes, size_t, shared_fo->layout.u.chunk.size, uint32_t); H5MM_memcpy(buf, ent->chunk, nbytes); - } + } /* end if */ else { /* read chunk data from the source file */ if(H5F_block_read(udata->file_src, H5FD_MEM_DRAW, chunk_rec->chunk_addr, nbytes, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk") - } - } + } /* end else */ + } /* end else */ /* Need to uncompress filtered variable-length & reference data elements that are not found in chunk cache */ if(must_filter && (is_vlen || fix_ref) && !udata->chunk_in_cache) { @@ -7088,7 +7071,7 @@ H5D__chunk_format_convert(H5D_t *dset, H5D_chk_idx_info_t *idx_info, H5D_chk_idx udata.dset_ndims = dset->shared->ndims; udata.dset_dims = dset->shared->curr_dims; - /* terate over the chunks in the current index and insert the chunk addresses into version 1 B-tree index */ + /* Iterate over the chunks in the current index and insert the chunk addresses into version 1 B-tree index */ if((idx_info->storage->ops->iterate)(idx_info, H5D__chunk_format_convert_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to chunk info") @@ -7152,7 +7135,6 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ hsize_t num_chunks = 0; /* Number of written chunks */ H5D_rdcc_ent_t *ent; /* Cache entry */ const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */ - const H5O_layout_t *layout; /* Dataset layout */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) @@ -7162,7 +7144,6 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ HDassert(space); HDassert(nchunks); - layout = &(dset->shared->layout); /* Dataset layout */ rdcc = &(dset->shared->cache.chunk); /* raw data chunk cache */ HDassert(rdcc); @@ -7179,15 +7160,14 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ idx_info.storage = &dset->shared->layout.storage.u.chunk; /* If the dataset is not written, number of chunks will be 0 */ - if(!H5F_addr_defined(idx_info.storage->idx_addr)) { + if(!H5F_addr_defined(idx_info.storage->idx_addr)) *nchunks = 0; - } else { /* Iterate over the allocated chunks */ if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_num_chunks_cb, &num_chunks) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve allocated chunk information from index") *nchunks = num_chunks; - } + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -7212,7 +7192,6 @@ static int H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) { H5D_chunk_info_iter_ud_t *chunk_info = (H5D_chunk_info_iter_ud_t *)_udata; - hsize_t ii = 0; /* Dimension index */ int ret_value = H5_ITER_CONT; /* Callback return value */ FUNC_ENTER_STATIC_NOERR @@ -7222,17 +7201,20 @@ H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) HDassert(chunk_info); /* If this is the queried chunk, retrieve its info and stop iterating */ - if (chunk_info->curr_idx == chunk_info->chunk_idx) { + if(chunk_info->curr_idx == chunk_info->chunk_idx) { + hsize_t ii = 0; /* Dimension index */ + + /* Copy info */ chunk_info->filter_mask = chunk_rec->filter_mask; chunk_info->chunk_addr = chunk_rec->chunk_addr; chunk_info->nbytes = chunk_rec->nbytes; - for (ii = 0; ii < chunk_info->ndims; ii++) + for(ii = 0; ii < chunk_info->ndims; ii++) chunk_info->scaled[ii] = chunk_rec->scaled[ii]; chunk_info->found = TRUE; /* Stop iterating */ ret_value = H5_ITER_STOP; - } + } /* end if */ /* Go to the next chunk */ else chunk_info->curr_idx++; @@ -7291,9 +7273,9 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Set addr & size for when dset is not written or queried chunk is not found */ - if (addr) + if(addr) *addr = HADDR_UNDEF; - if (size) + if(size) *size = 0; /* If the chunk is written, get its info, otherwise, return without error */ @@ -7322,7 +7304,7 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ if(offset) for(ii = 0; ii < udata.ndims; ii++) offset[ii] = udata.scaled[ii] * dset->shared->layout.u.chunk.dim[ii]; - } + } /* end if */ } /* end if H5F_addr_defined */ done: @@ -7347,9 +7329,9 @@ done: static int H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) { - hsize_t ii; H5D_chunk_info_iter_ud_t *chunk_info = (H5D_chunk_info_iter_ud_t *)_udata; hbool_t different = FALSE; /* TRUE when a scaled value pair mismatch */ + hsize_t ii; /* Local index value */ int ret_value = H5_ITER_CONT; /* Callback return value */ FUNC_ENTER_STATIC_NOERR @@ -7359,12 +7341,12 @@ H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) HDassert(chunk_info); /* Going through the scaled, stop when a mismatch is found */ - for (ii = 0; ii < chunk_info->ndims && !different; ii++) - if (chunk_info->scaled[ii] != chunk_rec->scaled[ii]) + for(ii = 0; ii < chunk_info->ndims && !different; ii++) + if(chunk_info->scaled[ii] != chunk_rec->scaled[ii]) different = TRUE; /* Same scaled coords means the chunk is found, copy the chunk info */ - if (!different) { + if(!different) { chunk_info->nbytes = chunk_rec->nbytes; chunk_info->filter_mask = chunk_rec->filter_mask; chunk_info->chunk_addr = chunk_rec->chunk_addr; @@ -7372,7 +7354,7 @@ H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Stop iterating */ ret_value = H5_ITER_STOP; - } + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* H5D__get_chunk_info_by_coord_cb() */ @@ -7423,9 +7405,9 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned* HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") /* Set addr & size for when dset is not written or queried chunk is not found */ - if (addr) + if(addr) *addr = HADDR_UNDEF; - if (size) + if(size) *size = 0; /* Compose chunked index info struct */ @@ -7452,14 +7434,14 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned* HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve information of the chunk by its scaled coordinates") /* Obtain requested info if the chunk is found */ - if (udata.found) { + if(udata.found) { if(filter_mask) *filter_mask = udata.filter_mask; if(addr) *addr = udata.chunk_addr; if(size) *size = udata.nbytes; - } + } /* end if */ } /* end if H5F_addr_defined */ done: diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index f321c82..2b50559 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -116,8 +116,6 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, void *dset = NULL; /* dset token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT; - hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -129,6 +127,10 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, if(!*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read") + if(H5P_DEFAULT == dcpl_id) dcpl_id = H5P_DATASET_CREATE_DEFAULT; else @@ -138,10 +140,6 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, /* Set the DCPL for the API context */ H5CX_set_dcpl(dcpl_id); - /* Verify access property list and set up collective metadata if appropriate */ - if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); @@ -151,7 +149,8 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, lcpl_id, type_id, space_id, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, H5P_LINK_CREATE_DEFAULT, type_id, space_id, dcpl_id, + H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ diff --git a/src/H5Dint.c b/src/H5Dint.c index c3d4398..c3e0c0d 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -43,6 +43,35 @@ /* Local Typedefs */ /******************/ +/* Shared data structure for computing variable-length dataset's total size */ +/* (Used for both native and generic 'get vlen buf size' operation) */ +typedef struct { + void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */ + void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */ + size_t vl_tbuf_size; /* Current size of the temp. buffer for VL data */ + hsize_t size; /* Accumulated number of bytes for the selection */ +} H5D_vlen_bufsize_common_t; + +/* Internal data structure for computing variable-length dataset's total size */ +/* (Used for native 'get vlen buf size' operation) */ +typedef struct { + H5D_t *dset; /* Dataset for operation */ + H5S_t *fspace; /* Dataset's dataspace for operation */ + H5S_t *mspace; /* Memory dataspace for operation */ + H5D_vlen_bufsize_common_t common; /* VL data buffers & accumulatd size */ +} H5D_vlen_bufsize_native_t; + +/* Internal data structure for computing variable-length dataset's total size */ +/* (Used for generic 'get vlen buf size' operation) */ +typedef struct { + H5VL_object_t *dset_vol_obj; /* VOL object for the dataset */ + hid_t fspace_id; /* Dataset dataspace ID of the dataset we are working on */ + H5S_t *fspace; /* Dataset's dataspace for operation */ + hid_t mspace_id; /* Memory dataspace ID of the dataset we are working on */ + hid_t dxpl_id; /* Dataset transfer property list to pass to dataset read */ + H5D_vlen_bufsize_common_t common; /* VL data buffers & accumulatd size */ +} H5D_vlen_bufsize_generic_t; + /********************/ /* Local Prototypes */ @@ -63,6 +92,11 @@ static herr_t H5D__close_cb(H5VL_object_t *dset_vol_obj); static herr_t H5D__use_minimized_dset_headers(H5F_t *file, H5D_t *dset, hbool_t *minimize); static herr_t H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc); static size_t H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr); +static void *H5D__vlen_get_buf_size_alloc(size_t size, void *info); +static herr_t H5D__vlen_get_buf_size_cb(void *elem, hid_t type_id, unsigned ndim, + const hsize_t *point, void *op_data); +static herr_t H5D__vlen_get_buf_size_gen_cb(void *elem, hid_t type_id, unsigned ndim, + const hsize_t *point, void *op_data); /*********************/ @@ -98,8 +132,12 @@ H5FL_EXTERN(H5D_chunk_info_t); /* Declare extern the free list to manage blocks of type conversion data */ H5FL_BLK_EXTERN(type_conv); +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlarger-than=" /* Define a static "default" dataset structure to use to initialize new datasets */ static H5D_shared_t H5D_def_dset; +#pragma GCC diagnostic pop /* Dataset ID class */ static const H5I_class_t H5I_DATASET_CLS[1] = {{ @@ -113,7 +151,7 @@ static const H5I_class_t H5I_DATASET_CLS[1] = {{ static hbool_t H5D_top_package_initialize_s = FALSE; /* Prefixes of VDS and external file from the environment variables - * HDF5_EXTFILE_PREFIX and HDF5_VDS_PREFIX */ + * HDF5_EXTFILE_PREFIX and HDF5_VDS_PREFIX */ static const char *H5D_prefix_ext_env = NULL; static const char *H5D_prefix_vds_env = NULL; @@ -2567,29 +2605,172 @@ done: * this data is not actually usable. * * Return: Non-negative on success, negative on failure + * *------------------------------------------------------------------------- */ -void * +static void * H5D__vlen_get_buf_size_alloc(size_t size, void *info) { - H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)info; + H5D_vlen_bufsize_common_t *vlen_bufsize_com = (H5D_vlen_bufsize_common_t *)info; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC + + /* Check for increasing the size of the temporary space for VL data */ + if(size > vlen_bufsize_com->vl_tbuf_size) { + if(NULL == (vlen_bufsize_com->vl_tbuf = H5FL_BLK_REALLOC(vlen_vl_buf, vlen_bufsize_com->vl_tbuf, size))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't reallocate temporary VL data buffer") + vlen_bufsize_com->vl_tbuf_size = size; + } /* end if */ - /* Get a temporary pointer to space for the VL data */ - if((vlen_bufsize->vl_tbuf = H5FL_BLK_REALLOC(vlen_vl_buf, vlen_bufsize->vl_tbuf, size)) != NULL) - vlen_bufsize->size += size; + /* Increment size of VL data buffer needed */ + vlen_bufsize_com->size += size; /* Set return value */ - ret_value = vlen_bufsize->vl_tbuf; + ret_value = vlen_bufsize_com->vl_tbuf; +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__vlen_get_buf_size_alloc() */ /*------------------------------------------------------------------------- - * Function: H5D__vlen_get_buf_size + * Function: H5D__vlen_get_buf_size_cb + * + * Purpose: Dataspace selection iteration callback for H5Dvlen_get_buf_size. + * + * Return: Non-negative on success, negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__vlen_get_buf_size_cb(void H5_ATTR_UNUSED *elem, hid_t type_id, + unsigned H5_ATTR_UNUSED ndim, const hsize_t *point, void *op_data) +{ + H5D_vlen_bufsize_native_t *vlen_bufsize = (H5D_vlen_bufsize_native_t *)op_data; + herr_t ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(H5I_DATATYPE == H5I_get_type(type_id)); + HDassert(point); + HDassert(op_data); + + /* Select point to read in */ + if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, H5_ITER_ERROR, "can't select point") + + /* Read in the point (with the custom VL memory allocator) */ + if(H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace, vlen_bufsize->common.fl_tbuf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, H5_ITER_ERROR, "can't read point") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__vlen_get_buf_size_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__vlen_get_buf_size + * + * Purpose: This routine checks the number of bytes required to store the VL + * data from the dataset, using the space_id for the selection in the + * dataset on disk and the type_id for the memory representation of the + * VL data, in memory. The *size value is modified according to how many + * bytes are required to store the VL data in memory. + * + * Implementation: This routine actually performs the read with a custom + * memory manager which basically just counts the bytes requested and + * uses a temporary memory buffer (through the H5FL API) to make certain + * enough space is available to perform the read. Then the temporary + * buffer is released and the number of bytes allocated is returned. + * Kinda kludgy, but easier than the other method of trying to figure out + * the sizes without actually reading the data in... - QAK + * + * Return: Non-negative on success, negative on failure + * + * Programmer: Quincey Koziol + * Wednesday, August 11, 1999 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__vlen_get_buf_size(H5D_t *dset, hid_t type_id, hid_t space_id, + hsize_t *size) +{ + H5D_vlen_bufsize_native_t vlen_bufsize = {NULL, NULL, NULL, {NULL, NULL, 0, 0}}; + H5S_t *fspace = NULL; /* Dataset's dataspace */ + H5S_t *mspace = NULL; /* Memory dataspace */ + char bogus; /* bogus value to pass to H5Diterate() */ + H5S_t *space; /* Dataspace for iteration */ + H5T_t *type; /* Datatype */ + H5S_sel_iter_op_t dset_op; /* Operator for iteration */ + herr_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check args */ + if(NULL == (type = (H5T_t *)H5I_object(type_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") + if(NULL == (space = (H5S_t *)H5I_object(space_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace") + if(!(H5S_has_extent(space))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set") + + /* Save the dataset */ + vlen_bufsize.dset = dset; + + /* Get a copy of the dataset's dataspace */ + if(NULL == (fspace = H5S_copy(dset->shared->space, FALSE, TRUE))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to get dataspace") + vlen_bufsize.fspace = fspace; + + /* Create a scalar for the memory dataspace */ + if(NULL == (mspace = H5S_create(H5S_SCALAR))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") + vlen_bufsize.mspace = mspace; + + /* Grab the temporary buffers required */ + if(NULL == (vlen_bufsize.common.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, H5T_get_size(type)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available") + if(NULL == (vlen_bufsize.common.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available") + vlen_bufsize.common.vl_tbuf_size = 1; + + /* Set the memory manager to the special allocation routine */ + if(H5CX_set_vlen_alloc_info(H5D__vlen_get_buf_size_alloc, &vlen_bufsize.common, NULL, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine") + + /* Set the initial number of bytes required */ + vlen_bufsize.common.size = 0; + + /* Call H5S_select_iterate with args, etc. */ + dset_op.op_type = H5S_SEL_ITER_OP_APP; + dset_op.u.app_op.op = H5D__vlen_get_buf_size_cb; + dset_op.u.app_op.type_id = type_id; + + ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize); + + /* Get the size if we succeeded */ + if(ret_value >= 0) + *size = vlen_bufsize.common.size; + +done: + if(fspace && H5S_close(fspace) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + if(mspace && H5S_close(mspace) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + if(vlen_bufsize.common.fl_tbuf != NULL) + vlen_bufsize.common.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.common.fl_tbuf); + if(vlen_bufsize.common.vl_tbuf != NULL) + vlen_bufsize.common.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.common.vl_tbuf); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__vlen_get_buf_size() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__vlen_get_buf_size_gen_cb * * Purpose: This routine checks the number of bytes required to store a single * element from a dataset in memory, creating a selection with just the @@ -2609,42 +2790,152 @@ H5D__vlen_get_buf_size_alloc(size_t size, void *info) * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ -herr_t -H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, +static herr_t +H5D__vlen_get_buf_size_gen_cb(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ATTR_UNUSED ndim, const hsize_t *point, void *op_data) { - H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)op_data; - H5VL_object_t *vol_obj = vlen_bufsize->dset_vol_obj; + H5D_vlen_bufsize_generic_t *vlen_bufsize = (H5D_vlen_bufsize_generic_t *)op_data; H5T_t *dt; /* Datatype for operation */ - H5S_t *fspace; /* File dataspace for operation */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC + /* Sanity check */ + HDassert(point); HDassert(op_data); - HDassert(H5I_DATATYPE == H5I_get_type(type_id)); /* Check args */ if(NULL == (dt = (H5T_t *)H5I_object(type_id))) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a datatype") /* Make certain there is enough fixed-length buffer available */ - if(NULL == (vlen_bufsize->fl_tbuf = H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->fl_tbuf, H5T_get_size(dt)))) + if(NULL == (vlen_bufsize->common.fl_tbuf = H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->common.fl_tbuf, H5T_get_size(dt)))) HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf") /* Select point to read in */ - if(NULL == (fspace = (H5S_t *)H5I_object_verify(vlen_bufsize->fspace_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - if(H5S_select_elements(fspace, H5S_SELECT_SET, (size_t)1, point) < 0) + if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point") /* Read in the point (with the custom VL memory allocator) */ - if(H5VL_dataset_read(vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, vlen_bufsize->dxpl_id, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) + if(H5VL_dataset_read(vlen_bufsize->dset_vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, vlen_bufsize->dxpl_id, vlen_bufsize->common.fl_tbuf, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__vlen_get_buf_size() */ +} /* end H5D__vlen_get_buf_size_gen_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__vlen_get_buf_size_gen + * + * Purpose: Generic routine to checks the number of bytes required to store the + * VL data from the dataset. + * + * Return: Non-negative on success, negative on failure + * + * Programmer: Quincey Koziol + * Friday, December 20, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id, + hsize_t *size) +{ + H5D_vlen_bufsize_generic_t vlen_bufsize = {NULL, H5I_INVALID_HID, NULL, H5I_INVALID_HID, H5I_INVALID_HID, {NULL, NULL, 0, 0}}; + H5P_genplist_t *dxpl = NULL; /* DXPL for operation */ + H5S_t *mspace = NULL; /* Memory dataspace */ + char bogus; /* Bogus value to pass to H5Diterate() */ + H5S_t *space; /* Dataspace for iteration */ + H5T_t *type; /* Datatype */ + H5S_sel_iter_op_t dset_op; /* Operator for iteration */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check args */ + if(NULL == (type = (H5T_t *)H5I_object(type_id))) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not an valid datatype") + if(NULL == (space = (H5S_t *)H5I_object(space_id))) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "invalid dataspace") + if(!(H5S_has_extent(space))) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dataspace does not have extent set") + + /* Save the dataset */ + vlen_bufsize.dset_vol_obj = vol_obj; + + /* Get a copy of the dataset's dataspace */ + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace") + if(NULL == (vlen_bufsize.fspace = (H5S_t *)H5I_object(vlen_bufsize.fspace_id))) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataspace") + + /* Create a scalar for the memory dataspace */ + if(NULL == (mspace = H5S_create(H5S_SCALAR))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create dataspace") + if((vlen_bufsize.mspace_id = H5I_register(H5I_DATASPACE, mspace, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + + /* Grab the temporary buffers required */ + if(NULL == (vlen_bufsize.common.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, H5T_get_size(type)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "no temporary buffers available") + if(NULL == (vlen_bufsize.common.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "no temporary buffers available") + vlen_bufsize.common.vl_tbuf_size = 1; + + /* Set the VL allocation callbacks on a DXPL */ + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get default DXPL") + if((vlen_bufsize.dxpl_id = H5P_copy_plist(dxpl, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy property list"); + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(vlen_bufsize.dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get copied DXPL") + if(H5P_set_vlen_mem_manager(dxpl, H5D__vlen_get_buf_size_alloc, &vlen_bufsize.common, NULL, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine on DXPL") + + /* Set the initial number of bytes required */ + vlen_bufsize.common.size = 0; + + /* Call H5S_select_iterate with args, etc. */ + dset_op.op_type = H5S_SEL_ITER_OP_APP; + dset_op.u.app_op.op = H5D__vlen_get_buf_size_gen_cb; + dset_op.u.app_op.type_id = type_id; + + ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize); + + /* Get the size if we succeeded */ + if(ret_value >= 0) + *size = vlen_bufsize.common.size; + +done: + if(vlen_bufsize.fspace_id >= 0) { + if(H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "problem freeing id") + vlen_bufsize.fspace = NULL; + } /* end if */ + if(vlen_bufsize.fspace && H5S_close(vlen_bufsize.fspace) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + if(vlen_bufsize.mspace_id >= 0) { + if(H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "problem freeing id") + mspace = NULL; + } /* end if */ + if(mspace && H5S_close(mspace) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + if(vlen_bufsize.common.fl_tbuf != NULL) + vlen_bufsize.common.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.common.fl_tbuf); + if(vlen_bufsize.common.vl_tbuf != NULL) + vlen_bufsize.common.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.common.vl_tbuf); + if(vlen_bufsize.dxpl_id != H5I_INVALID_HID) { + if(H5I_dec_app_ref(vlen_bufsize.dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close property list") + dxpl = NULL; + } /* end if */ + if(dxpl && H5P_close(dxpl) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release DXPL") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__vlen_get_buf_size_gen() */ /*------------------------------------------------------------------------- diff --git a/src/H5Dio.c b/src/H5Dio.c index 1237063..6b02b68 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -239,7 +239,7 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil H5CX_set_dxpl(dxpl_id); /* Read the raw chunk */ - if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_CHUNK_READ, offset, filters, buf) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_READ, dxpl_id, H5_REQUEST_NULL, offset, filters, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") done: @@ -367,7 +367,7 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of H5CX_set_dxpl(dxpl_id); /* Write chunk */ - if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_WRITE, dxpl_id, H5_REQUEST_NULL, filters, offset, data_size_32, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") done: diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 02121e6..c46e38b6 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -516,17 +516,6 @@ typedef struct H5D_fill_buf_info_t { hbool_t has_vlen_fill_type; /* Whether the datatype for the fill value has a variable-length component */ } H5D_fill_buf_info_t; -/* Internal data structure for computing variable-length dataset's total size */ -typedef struct { - H5VL_object_t *dset_vol_obj; /* VOL object for the dataset */ - hid_t fspace_id; /* File dataspace ID of the dataset we are working on */ - hid_t mspace_id; /* Memory dataspace ID of the dataset we are working on */ - void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */ - void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */ - hsize_t size; /* Accumulated number of bytes for the selection */ - hid_t dxpl_id; /* Dataset transfer property list to pass to dataset read */ -} H5D_vlen_bufsize_t; - /*****************************/ /* Package Private Variables */ @@ -575,8 +564,8 @@ H5_DLL herr_t H5D__get_num_chunks(const H5D_t *dset, const H5S_t *space, hsize_t H5_DLL herr_t H5D__get_chunk_info(const H5D_t *dset, const H5S_t *space, hsize_t chk_idx, hsize_t *coord, unsigned *filter_mask, haddr_t *offset, hsize_t *size); H5_DLL herr_t H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size); H5_DLL haddr_t H5D__get_offset(const H5D_t *dset); -H5_DLL void *H5D__vlen_get_buf_size_alloc(size_t size, void *info); -H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *op_data); +H5_DLL herr_t H5D__vlen_get_buf_size(H5D_t *dset, hid_t type_id, hid_t space_id, hsize_t *size); +H5_DLL herr_t H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id, hsize_t *size); H5_DLL herr_t H5D__check_filters(H5D_t *dataset); H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size); H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset); diff --git a/src/H5EAcache.c b/src/H5EAcache.c index da67e6b..1fd9c44 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -487,7 +487,8 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5EA_HDR_VERSION; /* Extensible array type */ - *image++ = hdr->cparam.cls->id; + HDassert(hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)hdr->cparam.cls->id; /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ @@ -875,7 +876,8 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_IBLOCK_VERSION; /* Extensible array type */ - *image++ = iblock->hdr->cparam.cls->id; + HDassert(iblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)iblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ H5F_addr_encode(f, &image, iblock->hdr->addr); @@ -1284,7 +1286,8 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_SBLOCK_VERSION; /* Extensible array type */ - *image++ = sblock->hdr->cparam.cls->id; + HDassert(sblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)sblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ H5F_addr_encode(f, &image, sblock->hdr->addr); @@ -1698,7 +1701,8 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_DBLOCK_VERSION; /* Extensible array type */ - *image++ = dblock->hdr->cparam.cls->id; + HDassert(dblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)dblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ H5F_addr_encode(f, &image, dblock->hdr->addr); @@ -113,6 +113,30 @@ static const H5I_class_t H5I_FILE_CLS[1] = {{ (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ }}; + + +/*------------------------------------------------------------------------- + * Function: H5F_init + * + * Purpose: Initialize the interface from some other layer. + * + * Return: Success: non-negative + * + * Failure: negative + *------------------------------------------------------------------------- + */ +herr_t +H5F_init(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + /* FUNC_ENTER() does all the work */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_init() */ + /*-------------------------------------------------------------------------- NAME @@ -547,7 +571,7 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Retrieve the VFD handle for the file */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_VFD_HANDLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, file_handle, fapl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle") done: @@ -623,8 +647,9 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { H5F_t *new_file = NULL; /* File struct for new file */ H5P_genplist_t *plist; /* Property list pointer */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ H5VL_object_t *vol_obj = NULL; /* VOL object for file */ + hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -687,9 +712,13 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(NULL == (vol_obj = H5VL_vol_object(ret_value))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") - /* Make the post open callback */ - if(H5VL_file_specific(vol_obj, H5VL_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file post open callback") + /* Make the 'post open' callback */ + supported = FALSE; + if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation") + if(supported) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback") done: FUNC_LEAVE_API(ret_value) @@ -718,11 +747,12 @@ done: hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { - H5F_t *new_file = NULL; /* File struct for new file */ - H5P_genplist_t *plist; /* Property list pointer */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - H5VL_object_t *vol_obj = NULL; /* VOL object for file */ - hid_t ret_value; /* return value */ + H5F_t *new_file = NULL; /* File struct for new file */ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_object_t *vol_obj = NULL; /* VOL object for file */ + hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */ + hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "*sIui", filename, flags, fapl_id); @@ -770,9 +800,13 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if(NULL == (vol_obj = H5VL_vol_object(ret_value))) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier") - /* Make the post open callback */ - if(H5VL_file_specific(vol_obj, H5VL_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file post open callback") + /* Make the 'post open' callback */ + supported = FALSE; + if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation") + if(supported) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback") done: FUNC_LEAVE_API(ret_value) @@ -880,13 +914,6 @@ H5Fdelete(const char *filename, hid_t fapl_id) if(!filename || !*filename) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") - /* Check the file access property list */ - if(H5P_DEFAULT == fapl_id) - fapl_id = H5P_FILE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") @@ -936,8 +963,9 @@ done: hid_t H5Freopen(hid_t file_id) { - H5VL_object_t *vol_obj = NULL; void *file = NULL; /* File struct for new file */ + H5VL_object_t *vol_obj = NULL; /* VOL object for file */ + hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -963,9 +991,13 @@ H5Freopen(hid_t file_id) if(NULL == (vol_obj = H5VL_vol_object(ret_value))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") - /* Make the post open callback */ - if(H5VL_file_specific(vol_obj, H5VL_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file post open callback") + /* Make the 'post open' callback */ + supported = FALSE; + if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation") + if(supported) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback") done: /* XXX (VOL MERGE): If registration fails, file will not be closed */ @@ -1070,7 +1102,7 @@ H5Fget_freespace(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the amount of free space in the file */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FREE_SPACE, &ret_value) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FREE_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space") done: @@ -1105,7 +1137,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the file size */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_SIZE, size) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") done: @@ -1166,7 +1198,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID") /* Get the file image */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FILE_IMAGE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf_ptr, &ret_value, buf_len) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image") done: @@ -1206,7 +1238,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the metadata cache configuration */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_CONF, config_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_CONF, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration") done: @@ -1239,7 +1271,7 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Set the metadata cache configuration */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_MDC_CONFIG, config_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MDC_CONFIG, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration") done: @@ -1275,7 +1307,7 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the current hit rate */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_HR, hit_rate_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_HR, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate") done: @@ -1312,7 +1344,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the size data */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_SIZE, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size") done: @@ -1350,7 +1382,7 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the hit rate statistic */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate") done: @@ -1444,7 +1476,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the file information */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_INFO, (int)type, finfo) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)type, finfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") done: @@ -1480,7 +1512,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the retry info */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info") done: @@ -1519,7 +1551,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0") /* Get the free-space section information in the file */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, (int)type, nsects) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FREE_SECTIONS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, sect_info, &ret_value, (int)type, nsects) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections") done: @@ -1552,7 +1584,7 @@ H5Fclear_elink_file_cache(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Release the EFC */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") done: @@ -1612,7 +1644,7 @@ H5Fstart_swmr_write(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Start SWMR writing */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_START_SWMR_WRITE) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_START_SWMR_WRITE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing") done: @@ -1644,7 +1676,7 @@ H5Fstart_mdc_logging(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_START_MDC_LOGGING) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_START_MDC_LOGGING, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to start mdc logging") done: @@ -1677,7 +1709,7 @@ H5Fstop_mdc_logging(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_STOP_MDC_LOGGING) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_STOP_MDC_LOGGING, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to stop mdc logging") done: @@ -1711,7 +1743,7 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, is_enabled, is_currently_logging) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to get logging status") done: @@ -1723,7 +1755,7 @@ done: * Function: H5Fset_libver_bounds * * Purpose: Set to a different low and high bounds while a file is open. - * This public routine is introduced in place of + * This public routine is introduced in place of * H5Fset_latest_format() starting release 1.10.2. * See explanation for H5Fset_latest_format() in H5Fdeprec.c. * @@ -1749,7 +1781,7 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Set the library's version bounds */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, low, high) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, low, high) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") done: @@ -1786,7 +1818,7 @@ H5Fformat_convert(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Convert the format */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_FORMAT_CONVERT) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_FORMAT_CONVERT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") done: @@ -1817,7 +1849,7 @@ H5Freset_page_buffering_stats(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the statistics */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering") done: @@ -1852,7 +1884,7 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2 HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats") /* Get the statistics */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS, accesses, hits, misses, evictions, bypasses) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, accesses, hits, misses, evictions, bypasses) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering") done: @@ -1887,7 +1919,7 @@ H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Go get the address and size of the cache image */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO, image_addr, image_len) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, image_addr, image_len) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info") done: @@ -1921,7 +1953,7 @@ H5Fget_eoa(hid_t file_id, haddr_t *eoa) /* Only do work if valid pointer to fill in */ if(eoa) { /* Retrieve the EOA for the file */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_EOA, eoa) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_EOA, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, eoa) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA") } /* end if */ @@ -1952,7 +1984,7 @@ H5Fincrement_filesize(hid_t file_id, hsize_t increment) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Increment the file size */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_INCR_FILESIZE, increment) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_INCR_FILESIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, increment) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size") done: @@ -1997,7 +2029,7 @@ H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize) if(NULL == vol_obj) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG, minimize) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, minimize) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag") done: @@ -2038,7 +2070,7 @@ H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize) if(NULL == vol_obj) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG, minimize) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, minimize) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag") done: diff --git a/src/H5FAcache.c b/src/H5FAcache.c index f440efe..2f0d1b4 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -417,7 +417,8 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5FA_HDR_VERSION; /* Fixed array type */ - *image++ = hdr->cparam.cls->id; + HDassert(hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)hdr->cparam.cls->id; /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ @@ -805,7 +806,8 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5FA_DBLOCK_VERSION; /* Fixed array type */ - *image++ = dblock->hdr->cparam.cls->id; + HDassert(dblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)dblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ H5F_addr_encode(f, &image, dblock->hdr->addr); diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 6db8af6..552b7ca 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -342,6 +342,7 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) unsigned char *ptr = file->mem + addr; /* mutable pointer into the * buffer (can't change mem) */ + HDoff_t offset = (HDoff_t)addr; /* Offset to write at */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -358,7 +359,6 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ - HDoff_t offset = (HDoff_t)addr; /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. @@ -371,7 +371,8 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) do { #ifdef H5_HAVE_PREADWRITE bytes_wrote = HDpwrite(file->fd, ptr, bytes_in, offset); - offset += bytes_wrote; + if(bytes_wrote > 0) + offset += bytes_wrote; #else bytes_wrote = HDwrite(file->fd, ptr, bytes_in); #endif /* H5_HAVE_PREADWRITE */ @@ -856,12 +857,12 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr * partial results, and the end of the file. */ - uint8_t *mem = file->mem; /* memory pointer for writes */ + uint8_t *mem = file->mem; /* memory pointer for writes */ + HDoff_t offset = (HDoff_t)0; /* offset for reading */ while(size > 0) { h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ - HDoff_t offset = (HDoff_t)0; /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. @@ -874,7 +875,8 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr do { #ifdef H5_HAVE_PREADWRITE bytes_read = HDpread(file->fd, mem, bytes_in, offset); - offset += bytes_read; + if(bytes_read > 0) + offset += bytes_read; #else bytes_read = HDread(file->fd, mem, bytes_in); #endif /* H5_HAVE_PREADWRITE */ diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index 819d200..3d086ea 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -569,11 +569,7 @@ done: * Return: Success: The driver ID for the hdfs driver. * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * - * Changes: Rename as appropriate for hdfs vfd. - * Jacob Smith 2018 + * Programmer: Jacob Smith, 2018 * *------------------------------------------------------------------------- */ @@ -581,7 +577,9 @@ hid_t H5FD_hdfs_init(void) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ +#if HDFS_STATS unsigned int bin_i; +#endif FUNC_ENTER_NOAPI(FAIL) @@ -589,28 +587,24 @@ H5FD_hdfs_init(void) HDfprintf(stdout, "H5FD_hdfs_init() called.\n"); #endif - if (H5I_VFL != H5I_get_type(H5FD_HDFS_g)) { - H5FD_HDFS_g = H5FD_register( - &H5FD_hdfs_g, - sizeof(H5FD_class_t), - FALSE); - } + if(H5I_VFL != H5I_get_type(H5FD_HDFS_g)) + H5FD_HDFS_g = H5FD_register( &H5FD_hdfs_g, sizeof(H5FD_class_t), FALSE); #if HDFS_STATS /* pre-compute statsbin boundaries */ - for (bin_i = 0; bin_i < HDFS_STATS_BIN_COUNT; bin_i++) { + for(bin_i = 0; bin_i < HDFS_STATS_BIN_COUNT; bin_i++) { unsigned long long value = 0; + HDFS_STATS_POW(bin_i, &value) hdfs_stats_boundaries[bin_i] = value; - } + } /* end for */ #endif ret_value = H5FD_HDFS_g; done: FUNC_LEAVE_NOAPI(ret_value) - } /* end H5FD_hdfs_init() */ diff --git a/src/H5FDlog.c b/src/H5FDlog.c index ac5667f..60255e5 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -1171,6 +1171,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd #ifdef H5_HAVE_GETTIMEOFDAY struct timeval timeval_start, timeval_stop; #endif /* H5_HAVE_GETTIMEOFDAY */ + HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1255,7 +1256,6 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ - HDoff_t offset = (HDoff_t)addr; /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. @@ -1268,7 +1268,8 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd do { #ifdef H5_HAVE_PREADWRITE bytes_read = HDpread(file->fd, buf, bytes_in, offset); - offset += bytes_read; + if(bytes_read > 0) + offset += bytes_read; #else bytes_read = HDread(file->fd, buf, bytes_in); #endif /* H5_HAVE_PREADWRITE */ @@ -1382,6 +1383,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had #ifdef H5_HAVE_GETTIMEOFDAY struct timeval timeval_start, timeval_stop; #endif /* H5_HAVE_GETTIMEOFDAY */ + HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1471,7 +1473,6 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ - HDoff_t offset = (HDoff_t)addr; /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. @@ -1484,7 +1485,8 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had do { #ifdef H5_HAVE_PREADWRITE bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset); - offset += bytes_wrote; + if(bytes_wrote > 0) + offset += bytes_wrote; #else bytes_wrote = HDwrite(file->fd, buf, bytes_in); #endif /* H5_HAVE_PREADWRITE */ diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 0054a86..a393490 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -669,6 +669,7 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS haddr_t addr, size_t size, void *buf /*out*/) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; + HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -687,7 +688,7 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS if(addr != file->pos || OP_READ != file->op) { if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - } /* end if */ + } #endif /* H5_HAVE_PREADWRITE */ /* Read data, being careful of interrupted system calls, partial results, @@ -697,7 +698,6 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ - HDoff_t offset = (HDoff_t)addr; /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. @@ -710,7 +710,8 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS do { #ifdef H5_HAVE_PREADWRITE bytes_read = HDpread(file->fd, buf, bytes_in, offset); - offset += bytes_read; + if(bytes_read > 0) + offset += bytes_read; #else bytes_read = HDread(file->fd, buf, bytes_in); #endif /* H5_HAVE_PREADWRITE */ @@ -773,6 +774,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU haddr_t addr, size_t size, const void *buf) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; + HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -791,7 +793,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if(addr != file->pos || OP_WRITE != file->op) { if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - } /* end if */ + } #endif /* H5_HAVE_PREADWRITE */ /* Write the data, being careful of interrupted system calls and partial @@ -801,7 +803,6 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ - HDoff_t offset = (HDoff_t)addr; /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. @@ -814,7 +815,8 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU do { #ifdef H5_HAVE_PREADWRITE bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset); - offset += bytes_wrote; + if(bytes_wrote > 0) + offset += bytes_wrote; #else bytes_wrote = HDwrite(file->fd, buf, bytes_in); #endif /* H5_HAVE_PREADWRITE */ diff --git a/src/H5FScache.c b/src/H5FScache.c index b520458..cb0abe9 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -735,7 +735,7 @@ H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len, *image++ = H5FS_HDR_VERSION; /* Client ID */ - *image++ = fspace->client; + H5_CHECKED_ASSIGN(*image++, uint8_t, fspace->client, int); /* Total space tracked */ H5F_ENCODE_LENGTH(f, image, fspace->tot_space); @@ -1046,8 +1046,8 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, /* Walk through the image, deserializing sections */ do { - hsize_t sect_size; /* Current section size */ - size_t node_count; /* # of sections of this size */ + hsize_t sect_size = 0; /* Current section size */ + size_t node_count = 0; /* # of sections of this size */ size_t u; /* Local index variable */ /* The number of sections of this node's size */ @@ -1061,7 +1061,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, /* Loop over nodes of this size */ for(u = 0; u < node_count; u++) { H5FS_section_info_t *new_sect; /* Section that was deserialized */ - haddr_t sect_addr; /* Address of free space section in the address space */ + haddr_t sect_addr = 0; /* Address of free space section in the address space */ unsigned sect_type; /* Type of free space section */ unsigned des_flags; /* Flags from deserialize callback */ diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index 18e915f..a047161 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -120,7 +120,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the file information */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_INFO, type, &finfo2) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, &finfo2) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") /* Copy the compatible fields into the older struct */ @@ -177,10 +177,10 @@ done: * bounds. * * Before release 1.10.2, the library supports only two - * combinations of low/high bounds: + * combinations of low/high bounds: * (earliest, latest) * (latest, latest) - * Thus, this public routine does the job in switching + * Thus, this public routine does the job in switching * between the two combinations listed above. * * Starting release 1.10.2, we add v18 to the enumerated @@ -198,7 +198,7 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Vailin Choi; December 2017 - * + * *------------------------------------------------------------------------- */ herr_t @@ -227,7 +227,7 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format) low = H5F_LIBVER_EARLIEST; /* Set the library's version bounds */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, (int)low, (int)high) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)low, (int)high) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") done: diff --git a/src/H5Fint.c b/src/H5Fint.c index 153ec2f..8b3d927 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -3669,8 +3669,9 @@ H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref) { void *vol_obj_file = NULL; /* File object pointer */ H5VL_loc_params_t loc_params; /* Location parameters */ - hid_t file_id = H5I_INVALID_HID; /* File ID for object */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t file_id = H5I_INVALID_HID; /* File ID for object */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(H5I_INVALID_HID) @@ -3680,7 +3681,7 @@ H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref) /* Retrieve VOL file from object */ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_FILE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vol_obj_file) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file from object") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file from object") /* Check if the file's ID already exists */ if(H5I_find_id(vol_obj_file, H5I_FILE, &file_id) < 0) @@ -3688,7 +3689,12 @@ H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref) /* If the ID does not exist, register it with the VOL connector */ if(H5I_INVALID_HID == file_id) { - if((file_id = H5VL_register(H5I_FILE, vol_obj_file, vol_obj->connector, app_ref)) < 0) + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + if((file_id = H5VL_wrap_register(H5I_FILE, vol_obj_file, app_ref)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") } /* end if */ else { @@ -3701,6 +3707,10 @@ H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref) ret_value = file_id; done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTRESET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_file_id() */ diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 1630d6b..0c46f59 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -291,11 +291,11 @@ H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag) H5TRACE2("e", "ib", file_id, flag); /* Get the file object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set atomicity value */ - if (H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_MPI_ATOMICITY, va_flag) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MPI_ATOMICITY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, va_flag) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set MPI atomicity"); done: @@ -359,11 +359,11 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag) H5TRACE2("e", "i*b", file_id, flag); /* Get the file object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Get atomicity value */ - if (H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MPI_ATOMICITY, flag) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MPI_ATOMICITY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, flag) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MPI atomicity"); done: @@ -374,8 +374,8 @@ done: /*------------------------------------------------------------------------- * Function: H5F_mpi_retrieve_comm * - * Purpose: Retrieves an MPI communicator from the file the location ID - * is in. If the loc_id is invalid, the fapl_id is used to + * Purpose: Retrieves an MPI communicator from the file the location ID + * is in. If the loc_id is invalid, the fapl_id is used to * retrieve the communicator. * * Return: Success: Non-negative diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index cfb796c..f0c28ca 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -93,7 +93,7 @@ typedef struct H5F_t H5F_t; for (_i = 0; _i < sizeof(int64_t); _i++, _n >>= 8) \ *_p++ = (uint8_t)(_n & 0xff); \ for (/*void*/; _i < 8; _i++) \ - *_p++ = (n) < 0 ? 0xff : 0; \ + *_p++ = (uint8_t)((n) < 0 ? 0xff : 0); \ (p) = (uint8_t*)(p)+8; \ } @@ -247,29 +247,29 @@ typedef struct H5F_t H5F_t; } /* Address-related macros */ -#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ - HADDR_UNDEF==(X)+(haddr_t)(Z) || \ +#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ + HADDR_UNDEF==(X)+(haddr_t)(Z) || \ (X)+(haddr_t)(Z)<(X)) #define H5F_addr_defined(X) ((X)!=HADDR_UNDEF) /* The H5F_addr_eq() macro guarantees that Y is not HADDR_UNDEF by making * certain that X is not HADDR_UNDEF and then checking that X equals Y */ -#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \ +#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \ (X)==(Y)) #define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y))) -#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ +#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ (X)<(Y)) -#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ +#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ (X)<=(Y)) -#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ +#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ (X)>(Y)) -#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ +#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ (X)>=(Y)) -#define H5F_addr_cmp(X,Y) (H5F_addr_eq((X), (Y)) ? 0 : \ +#define H5F_addr_cmp(X,Y) (H5F_addr_eq((X), (Y)) ? 0 : \ (H5F_addr_lt((X), (Y)) ? -1 : 1)) #define H5F_addr_pow2(N) ((haddr_t)1<<(N)) #define H5F_addr_overlap(O1,L1,O2,L2) (((O1) < (O2) && ((O1) + (L1)) > (O2)) || \ @@ -730,6 +730,7 @@ typedef enum H5F_prefix_open_t { /***************************************/ /* Private functions */ +H5_DLL herr_t H5F_init(void); H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/); H5_DLL hid_t H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref); @@ -144,6 +144,29 @@ static hbool_t H5G_top_package_initialize_s = FALSE; /*------------------------------------------------------------------------- + * Function: H5G_init + * + * Purpose: Initialize the interface from some other layer. + * + * Return: Success: non-negative + * + * Failure: negative + *------------------------------------------------------------------------- + */ +herr_t +H5G_init(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + /* FUNC_ENTER() does all the work */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_init() */ + + +/*------------------------------------------------------------------------- * Function: H5G__init_package * * Purpose: Initializes the H5G interface. @@ -320,7 +343,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, void *grp = NULL; /* Structure for new group */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "i*siii", loc_id, name, lcpl_id, gcpl_id, gapl_id); @@ -478,7 +501,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) void *grp = NULL; /* Group opened */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, gapl_id); @@ -534,7 +557,7 @@ hid_t H5Gget_create_plist(hid_t group_id) { H5VL_object_t *vol_obj = NULL; - hid_t ret_value = H5I_INVALID_HID; + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", group_id); diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index fcb16d3..830b0eb 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -176,7 +176,6 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */ - hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -228,7 +227,8 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, lcpl_id, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl, + H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ @@ -289,7 +289,8 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the group */ - if(NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, H5P_GROUP_ACCESS_DEFAULT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Get an atom for the group */ @@ -316,7 +317,6 @@ done: herr_t H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name) { - hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -342,11 +342,11 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new loc_params1.type = H5VL_OBJECT_BY_NAME; loc_params1.obj_type = H5I_get_type(cur_loc_id); loc_params1.loc_data.loc_by_name.name = cur_name; - loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params2.type = H5VL_OBJECT_BY_NAME; loc_params2.loc_data.loc_by_name.name = new_name; - loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; /* get the location object */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id))) @@ -357,7 +357,8 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new tmp_vol_obj.connector = vol_obj->connector; /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj->data, &loc_params1) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj->data, &loc_params1) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else if(type == H5L_TYPE_SOFT) { @@ -366,7 +367,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = new_name; - loc_params.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params.obj_type = H5I_get_type(cur_loc_id); /* get the location object */ @@ -374,7 +375,8 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cur_name) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cur_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end else-if */ else @@ -397,7 +399,6 @@ herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id, const char *new_name) { - hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -423,12 +424,12 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, loc_params1.type = H5VL_OBJECT_BY_NAME; loc_params1.obj_type = H5I_get_type(cur_loc_id); loc_params1.loc_data.loc_by_name.name = cur_name; - loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params2.type = H5VL_OBJECT_BY_NAME; loc_params2.obj_type = H5I_get_type(new_loc_id); loc_params2.loc_data.loc_by_name.name = new_name; - loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; /* get the location object */ if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(cur_loc_id))) @@ -437,7 +438,8 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj1->data, &loc_params1) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj1->data, &loc_params1) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else if(type == H5L_TYPE_SOFT) { @@ -451,7 +453,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = new_name; - loc_params.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params.obj_type = H5I_get_type(new_loc_id); /* get the location object */ @@ -459,7 +461,8 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cur_name) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cur_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end else-if */ else @@ -495,18 +498,19 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) loc_params1.type = H5VL_OBJECT_BY_NAME; loc_params1.obj_type = H5I_get_type(src_loc_id); loc_params1.loc_data.loc_by_name.name = src_name; - loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params2.type = H5VL_OBJECT_BY_NAME; loc_params2.loc_data.loc_by_name.name = dst_name; - loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; /* get the location object */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(src_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Move the link */ - if(H5VL_link_move(vol_obj, &loc_params1, NULL, &loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_move(vol_obj, &loc_params1, NULL, &loc_params2, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") done: @@ -541,13 +545,13 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Set location parameter for source object */ loc_params1.type = H5VL_OBJECT_BY_NAME; loc_params1.loc_data.loc_by_name.name = src_name; - loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params1.obj_type = H5I_get_type(src_loc_id); /* Set location parameter for destination object */ loc_params2.type = H5VL_OBJECT_BY_NAME; loc_params2.loc_data.loc_by_name.name = dst_name; - loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params2.obj_type = H5I_get_type(dst_loc_id); if(H5L_SAME_LOC != src_loc_id) @@ -560,7 +564,8 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Move the link */ - if(H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -700,7 +705,7 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set the comment */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_SET_COMMENT, &loc_params, comment) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_SET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") done: @@ -762,7 +767,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "invalid location identifier") /* Get the comment */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_COMMENT, &loc_params, buf, bufsize, &op_ret) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, buf, bufsize, &op_ret) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, -1, "unable to get comment value") /* Set return value */ @@ -838,7 +843,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") /* Call private iteration function, through VOL callback */ - if((ret_value = H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_GROUP_ITERATE_OLD, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0) + if((ret_value = H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0) HERROR(H5E_SYM, H5E_BADITER, "error iterating over group's links"); /* Set the index we stopped at */ @@ -934,11 +939,11 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf); /* Check arguments */ - if (!name || !*name) + if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Set up collective metadata if appropriate */ - if (H5CX_set_loc(loc_id) < 0) + if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Retrieve object info */ @@ -949,11 +954,11 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if (NULL == (vol_obj = H5VL_vol_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Retrieve the object's information */ - if (H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_GROUP_GET_OBJINFO, &loc_params, (unsigned)follow_link, statbuf) < 0) + if(H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_GET_OBJINFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, (unsigned)follow_link, statbuf) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name); done: @@ -984,15 +989,15 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c FUNC_ENTER_STATIC; /* Check if the name in this group resolved to a valid link */ - if (lnk == NULL && obj_loc == NULL) + if(lnk == NULL && obj_loc == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name); - /* Only modify user's buffer if it's available */ - if (udata->statbuf) { + /* Only modify user's buffer if it's available */ + if(udata->statbuf) { H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */ /* Common code to retrieve the file's fileno */ - if (H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0) + if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno"); /* Info for soft and UD links is gotten by H5L_get_info. If we have @@ -1212,7 +1217,7 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) /* Retrieve the object's basic information (which includes its type) */ fields = H5O_INFO_BASIC; - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, &oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, &oinfo, fields) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info") /* Map to group object type */ diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 40d56c6..56608e2 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -112,6 +112,10 @@ static herr_t H5G__loc_find_cb(H5G_loc_t *grp_loc, const char *name, static herr_t H5G__loc_find_by_idx_cb(H5G_loc_t *grp_loc, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata, H5G_own_loc_t *own_loc); +static herr_t H5G__loc_addr_cb(H5G_loc_t *grp_loc, const char *name, + const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata, H5G_own_loc_t *own_loc); +static herr_t H5G__loc_info_cb(H5G_loc_t *grp_loc, const char *name, + const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata, H5G_own_loc_t *own_loc); static herr_t H5G__loc_set_comment_cb(H5G_loc_t *grp_loc, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata, H5G_own_loc_t *own_loc); @@ -684,7 +688,79 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_loc_info_cb + * Function: H5G__loc_addr_cb + * + * Purpose: Callback for retrieving the address for an object in a group + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Saturday, December 21, 2019 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5G__loc_addr_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, + void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) +{ + haddr_t *udata = (haddr_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the name in this group resolved to a valid link */ + if(obj_loc == NULL) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") + + /* Set address of object */ + *udata = obj_loc->oloc->addr; + +done: + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G__loc_addr_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5G__loc_addr + * + * Purpose: Retrieve the information for an object from a group location + * and path to that object + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, November 23, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5G__loc_addr(const H5G_loc_t *loc, const char *name, haddr_t *addr/*out*/) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check args. */ + HDassert(loc); + HDassert(name && *name); + HDassert(addr); + + /* Traverse group hierarchy to locate object */ + if(H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_addr_cb, addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G__loc_addr() */ + + +/*------------------------------------------------------------------------- + * Function: H5G__loc_info_cb * * Purpose: Callback for retrieving object info for an object in a group * @@ -696,13 +772,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_loc_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t H5_ATTR_UNUSED *lnk, +H5G__loc_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) { H5G_loc_info_t *udata = (H5G_loc_info_t *)_udata; /* User data passed in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check if the name in this group resolved to a valid link */ if(obj_loc == NULL) @@ -718,7 +794,7 @@ done: *own_loc = H5G_OWN_NONE; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_loc_info_cb() */ +} /* end H5G__loc_info_cb() */ /*------------------------------------------------------------------------- @@ -752,7 +828,7 @@ H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo/*out*/, u udata.oinfo = oinfo; /* Traverse group hierarchy to locate object */ - if(H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G_loc_info_cb, &udata) < 0) + if(H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_info_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object") done: diff --git a/src/H5Gname.c b/src/H5Gname.c index 86a0c2f..ab8ddf4 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -1195,11 +1195,11 @@ done: * Purpose: Callback for retrieving object's name by address * * Return: Positive if path is for object desired - * 0 if not correct object - * negative on failure. + * 0 if not correct object + * negative on failure. * * Programmer: Quincey Koziol - * November 4 2007 + * November 4 2007 * *------------------------------------------------------------------------- */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index b79b7d2..d11d7a0 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -1256,7 +1256,7 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, /* expand soft link */ if(H5G_CACHED_SLINK == src_ent->type && cpy_info->expand_soft_link) { - H5O_info_t oinfo; /* Information about object pointed to by soft link */ + haddr_t obj_addr; /* Address of object pointed to by soft link */ H5G_loc_t grp_loc; /* Group location holding soft link */ H5G_name_t grp_path; /* Path for group holding soft link */ char *link_name; /* Pointer to value of soft link */ @@ -1274,9 +1274,8 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get link name") /* Check if the object pointed by the soft link exists in the source file */ - /* Only basic information is needed */ - if(H5G_loc_info(&grp_loc, link_name, &oinfo, H5O_INFO_BASIC) >= 0) { - tmp_src_ent.header = oinfo.addr; + if(H5G__loc_addr(&grp_loc, link_name, &obj_addr) >= 0) { + tmp_src_ent.header = obj_addr; src_ent = &tmp_src_ent; } /* end if */ else diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index f475bde..6dc025c 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -498,6 +498,8 @@ H5_DLL herr_t H5G__name_init(H5G_name_t *name, const char *path); */ H5_DLL herr_t H5G__loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, H5O_type_t obj_type, const void *crt_info); +H5_DLL herr_t H5G__loc_addr(const H5G_loc_t *loc, const char *name, + haddr_t *addr/*out*/); /* Testing functions */ #ifdef H5G_TESTING diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index f149f29..b735dbd 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -186,6 +186,7 @@ typedef struct H5G_entry_t H5G_entry_t; * Library prototypes... These are the ones that other packages routinely * call. */ +H5_DLL herr_t H5G_init(void); H5_DLL struct H5O_loc_t *H5G_oloc(H5G_t *grp); H5_DLL H5G_name_t * H5G_nameof(const H5G_t *grp); H5_DLL H5F_t *H5G_fileof(H5G_t *grp); diff --git a/src/H5HFtest.c b/src/H5HFtest.c index 6f174bb..d6eecd7 100644 --- a/src/H5HFtest.c +++ b/src/H5HFtest.c @@ -481,7 +481,7 @@ H5HF_get_id_type_test(const void *_id, unsigned char *obj_type) HDassert(obj_type); /* Get the type for a heap ID */ - *obj_type = *id & H5HF_ID_TYPE_MASK; + *obj_type = (uint8_t)(*id & H5HF_ID_TYPE_MASK); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF_get_id_type_test() */ @@ -505,7 +505,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/) +H5HG_insert(H5F_t *f, size_t size, const void *obj, H5HG_t *hobj/*out*/) { size_t need; /*total space needed for object */ size_t idx; diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h index 4841847..573ef39 100644 --- a/src/H5HGprivate.h +++ b/src/H5HGprivate.h @@ -55,7 +55,7 @@ typedef struct H5HG_heap_t H5HG_heap_t; /* Main global heap routines */ -H5_DLL herr_t H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/); +H5_DLL herr_t H5HG_insert(H5F_t *f, size_t size, const void *obj, H5HG_t *hobj/*out*/); H5_DLL void *H5HG_read(H5F_t *f, H5HG_t *hobj, void *object, size_t *buf_size/*out*/); H5_DLL int H5HG_link(H5F_t *f, const H5HG_t *hobj, int adjust); H5_DLL herr_t H5HG_get_obj_size(H5F_t *f, H5HG_t *hobj, size_t *obj_size); @@ -1235,8 +1235,7 @@ H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id) if(NULL == (curr_id = (H5I_id_info_t *)H5SL_remove(type_ptr->ids, &id))) HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node from skip list") - /* (Casting away const OK -QAK) */ - ret_value = (void *)curr_id->obj_ptr; + ret_value = (void *)curr_id->obj_ptr; /* (Casting away const OK -QAK) */ curr_id = H5FL_FREE(H5I_id_info_t, curr_id); /* Decrement the number of IDs in the type */ @@ -2259,8 +2258,8 @@ done: hid_t H5Iget_file_id(hid_t obj_id) { - H5I_type_t type; /* ID type */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5I_type_t type; /* ID type */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", obj_id); @@ -2269,15 +2268,15 @@ H5Iget_file_id(hid_t obj_id) type = H5I_TYPE(obj_id); /* Call internal function */ - if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - H5VL_object_t *vol_obj = NULL; /* Object token of obj_id */ + if(H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { + H5VL_object_t *vol_obj; /* Object token of obj_id */ /* Get the VOL object */ if(NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Get the file ID */ - if ((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0) + if((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") } /* end if */ else diff --git a/src/H5Itest.c b/src/H5Itest.c index 79bc482..7415303 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -96,7 +96,7 @@ H5I__get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached) HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -486,6 +486,10 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name /* Set the LCPL for the API context */ H5CX_set_lcpl(lcpl_id); + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set location fields */ loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = link_name; @@ -496,10 +500,6 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name if(NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(link_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Verify access property list and set up collective metadata if appropriate */ - if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") - /* Create the link */ if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, link_target) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link") @@ -982,9 +982,9 @@ herr_t H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ - H5VL_loc_params_t loc_params; - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id); @@ -1018,11 +1018,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Lget_info_by_idx * - * Purpose: Gets metadata for a link, according to the order within an + * Purpose: Gets metadata for a link, according to the order within an * index. * - * Return: Success: Non-negative with information in LINFO - * Failure: Negative + * Return: Success: Non-negative with information in LINFO + * Failure: Negative * * Programmer: Quincey Koziol * Monday, November 6, 2006 @@ -1034,9 +1034,9 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5L_info_t *linfo /*out*/, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ - H5VL_loc_params_t loc_params; - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, linfo, @@ -1346,7 +1346,7 @@ done: * of the operators. * * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 16, 2006 * *------------------------------------------------------------------------- @@ -1490,8 +1490,8 @@ done: * library, or the negative value returned by one * of the operators. * - * Programmer: Quincey Koziol - * November 3 2007 + * Programmer: Quincey Koziol + * November 3 2007 * *------------------------------------------------------------------------- */ @@ -3174,7 +3174,7 @@ done: * * Purpose: Returns metadata about a link. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: James Laird * Monday, April 17 2006 diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index e075ed7..dc104d7 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -371,6 +371,10 @@ H5Lcreate_external(const char *file_name, const char *obj_name, /* Set the LCPL for the API context */ H5CX_set_lcpl(lcpl_id); + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Get normalized copy of the link target */ if(NULL == (norm_obj_name = H5G_normalize(obj_name))) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize object name") @@ -389,10 +393,6 @@ H5Lcreate_external(const char *file_name, const char *obj_name, p += file_name_len; HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */ - /* Verify access property list and set up collective metadata if appropriate */ - if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") - loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = link_name; loc_params.loc_data.loc_by_name.lapl_id = lapl_id; diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h index fa3c097..6652352 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -63,7 +63,7 @@ typedef struct { /* User data for path traversal routine for getting link info by index */ typedef struct { /* In */ - H5_index_t idx_type; /* Index to use */ + H5_index_t idx_type; /* Index to use */ H5_iter_order_t order; /* Order to iterate in index */ hsize_t n; /* Offset of link within index */ @@ -78,6 +78,29 @@ static hbool_t H5M_top_package_initialize_s = FALSE; /*------------------------------------------------------------------------- + * Function: H5M_init + * + * Purpose: Initialize the interface from some other layer. + * + * Return: Success: non-negative + * + * Failure: negative + *------------------------------------------------------------------------- + */ +herr_t +H5M_init(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + /* FUNC_ENTER() does all the work */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5M_init() */ + + +/*------------------------------------------------------------------------- NAME H5M__init_package -- Initialize interface-specific information USAGE @@ -197,7 +220,7 @@ H5M__close_cb(H5VL_object_t *map_vol_obj) HDassert(map_vol_obj); /* Close the map */ - if(H5VL_optional(map_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0) + if(H5VL_optional(map_vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_MAP, H5E_CLOSEERROR, FAIL, "unable to close map"); /* Free the VOL object */ @@ -274,8 +297,8 @@ H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the map */ - if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CREATE, &loc_params, name, lcpl_id, - key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + &loc_params, name, lcpl_id, key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map") /* Get an atom for the map */ @@ -285,7 +308,7 @@ H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(map && H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0) + if(map && H5VL_optional(vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map") FUNC_LEAVE_API(ret_value) @@ -348,8 +371,8 @@ H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the map */ - if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CREATE, &loc_params, NULL, H5P_LINK_CREATE_DEFAULT, - key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + &loc_params, NULL, H5P_LINK_CREATE_DEFAULT, key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map") /* Get an atom for the map */ @@ -359,7 +382,7 @@ H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(map && H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0) + if(map && H5VL_optional(vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map") FUNC_LEAVE_API(ret_value) @@ -411,7 +434,7 @@ H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id) loc_params.obj_type = H5I_get_type(loc_id); /* Open the map */ - if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_OPEN, &loc_params, name, mapl_id, &map) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, name, mapl_id, &map) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open map") /* Register an atom for the map */ @@ -421,7 +444,7 @@ H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id) done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(map && H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0) + if(map && H5VL_optional(vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map") FUNC_LEAVE_API(ret_value) @@ -489,7 +512,7 @@ H5Mget_key_type(hid_t map_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") /* get the datatype */ - if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_KEY_TYPE, &ret_value) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_KEY_TYPE, &ret_value) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") done: @@ -524,7 +547,7 @@ H5Mget_val_type(hid_t map_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") /* get the datatype */ - if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_VAL_TYPE, &ret_value) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_VAL_TYPE, &ret_value) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") done: @@ -559,7 +582,7 @@ H5Mget_create_plist(hid_t map_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") /* Get the map creation property list */ - if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_MCPL, &ret_value) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_MCPL, &ret_value) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map creation properties") done: @@ -597,7 +620,7 @@ H5Mget_access_plist(hid_t map_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") /* Get the map access property list */ - if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_MAPL, &ret_value) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_MAPL, &ret_value) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties") done: @@ -641,7 +664,7 @@ H5Mget_count(hid_t map_id, hsize_t *count, hid_t dxpl_id) H5CX_set_dxpl(dxpl_id); /* Get the number of key-value pairs stored in the map */ - if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_COUNT, count) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_GET, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_GET_COUNT, count) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties") done: @@ -697,7 +720,7 @@ H5Mput(hid_t map_id, hid_t key_mem_type_id, const void *key, H5CX_set_dxpl(dxpl_id); /* Set the key/value pair */ - if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_PUT, key_mem_type_id, key, val_mem_type_id, value) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_PUT, dxpl_id, H5_REQUEST_NULL, key_mem_type_id, key, val_mem_type_id, value) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to put key/value pair") done: @@ -756,7 +779,7 @@ H5Mget(hid_t map_id, hid_t key_mem_type_id, const void *key, H5CX_set_dxpl(dxpl_id); /* Get the value for the key */ - if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_GET_VAL, key_mem_type_id, key, val_mem_type_id, value) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_GET_VAL, dxpl_id, H5_REQUEST_NULL, key_mem_type_id, key, val_mem_type_id, value) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map") done: @@ -806,7 +829,7 @@ H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists, H5CX_set_dxpl(dxpl_id); /* Check if key exists */ - if((ret_value = H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_EXISTS, key_mem_type_id, key, exists)) < 0) + if((ret_value = H5VL_optional(vol_obj, H5VL_MAP_EXISTS, dxpl_id, H5_REQUEST_NULL, key_mem_type_id, key, exists)) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTGET, ret_value, "unable to check if key exists") done: @@ -881,7 +904,7 @@ H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op, loc_params.obj_type = H5I_get_type(map_id); /* Iterate over keys */ - if((ret_value = H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0) + if((ret_value = H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0) HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to ierate over keys") done: @@ -964,7 +987,7 @@ H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* Iterate over keys */ - if((ret_value = H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0) + if((ret_value = H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0) HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to ierate over keys") done: @@ -1021,7 +1044,7 @@ H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, loc_params.obj_type = H5I_get_type(map_id); /* Delete the key/value pair */ - if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_DELETE, key_mem_type_id, key) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params, H5VL_MAP_DELETE, key_mem_type_id, key) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to delete key/value pair") done: diff --git a/src/H5Mprivate.h b/src/H5Mprivate.h index c841e75..3d0e8cc 100644 --- a/src/H5Mprivate.h +++ b/src/H5Mprivate.h @@ -65,6 +65,7 @@ /****************************/ /* Library Private Typedefs */ /****************************/ +H5_DLL herr_t H5M_init(void); /*****************************/ @@ -286,7 +286,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Retrieve file from VOL object */ - if(NULL == (f = (H5F_t *)H5VL_object_data(vol_obj_file))) + if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL object") /* This is a native specific routine that requires serialization of the token */ @@ -597,7 +597,7 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -655,7 +655,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: @@ -720,7 +720,7 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -768,7 +768,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) loc_params.obj_type = H5I_get_type(obj_id); /* (Re)set the object's comment */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_SET_COMMENT, &loc_params, comment) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_SET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") done: @@ -823,7 +823,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* (Re)set the object's comment */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_SET_COMMENT, &loc_params, comment) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_SET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name) done: @@ -866,7 +866,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) loc_params.obj_type = H5I_get_type(obj_id); /* Retrieve the object's comment */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object") done: @@ -920,7 +920,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Retrieve the object's comment */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name) done: @@ -1207,7 +1207,7 @@ H5Odisable_mdc_flushes(hid_t object_id) loc_params.obj_type = H5I_get_type(object_id); /* Cork the object */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES, &loc_params) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork object"); done: @@ -1264,11 +1264,11 @@ H5Oenable_mdc_flushes(hid_t object_id) H5TRACE1("e", "i", object_id); /* Make sure the ID is a file object */ - if (H5I_is_file_object(object_id) != TRUE) + if(H5I_is_file_object(object_id) != TRUE) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID is not a file object"); /* Get the VOL object */ - if (NULL == (vol_obj = H5VL_vol_object(object_id))) + if(NULL == (vol_obj = H5VL_vol_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object ID"); /* Fill in location struct fields */ @@ -1276,7 +1276,7 @@ H5Oenable_mdc_flushes(hid_t object_id) loc_params.obj_type = H5I_get_type(object_id); /* Uncork the object */ - if (H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES, &loc_params) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork object"); done: @@ -1338,15 +1338,15 @@ H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled) H5TRACE2("e", "i*b", object_id, are_disabled); /* Sanity check */ - if (!are_disabled) + if(!are_disabled) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from ID"); /* Make sure the ID is a file object */ - if (H5I_is_file_object(object_id) != TRUE) + if(H5I_is_file_object(object_id) != TRUE) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID is not a file object"); /* Get the VOL object */ - if (NULL == (vol_obj = H5VL_vol_object(object_id))) + if(NULL == (vol_obj = H5VL_vol_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object ID"); /* Fill in location struct fields */ @@ -1354,7 +1354,7 @@ H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled) loc_params.obj_type = H5I_get_type(object_id); /* Get the cork status */ - if (H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED, &loc_params, are_disabled) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, are_disabled) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve object's cork status"); done: diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 7f4f17f..23aba09 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -194,7 +194,7 @@ H5O_ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co *p++ = H5O_AINFO_VERSION; /* The flags for the attribute indices */ - flags = ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0; + flags = (unsigned char)(ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0); flags = (unsigned char)(flags | (ainfo->index_corder ? H5O_AINFO_INDEX_CORDER : 0)); *p++ = flags; diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 878cb8a..573bb7a 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -329,7 +329,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) /* The character encoding for the attribute's name, in later versions */ if(attr->shared->version >= H5O_ATTR_VERSION_3) - *p++ = attr->shared->encoding; + *p++ = (uint8_t)attr->shared->encoding; /* Write the name including null terminator */ H5MM_memcpy(p, attr->shared->name, name_len); diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 7aefc67..e4e8f96 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -111,7 +111,7 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -162,7 +162,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: @@ -223,7 +223,7 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 0cc58a6..cb75bc3 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -408,10 +408,10 @@ H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) if(fill->version < H5O_FILL_VERSION_3) { /* Space allocation time */ - *p++ = fill->alloc_time; + *p++ = (uint8_t)fill->alloc_time; /* Fill value writing time */ - *p++ = fill->fill_time; + *p++ = (uint8_t)fill->fill_time; /* Whether fill value is defined */ *p++ = (uint8_t)fill->fill_defined; diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 7e48b9e..78e8e19 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -223,8 +223,8 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c HDassert(p); HDassert(fsinfo); - *p++ = (uint8_t)fsinfo->version; /* message version */ - *p++ = fsinfo->strategy; /* File space strategy */ + *p++ = (uint8_t)fsinfo->version; /* message version */ + *p++ = (uint8_t)fsinfo->strategy; /* File space strategy */ *p++ = (unsigned char)fsinfo->persist; /* Free-space persist or not */ H5F_ENCODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section size threshold */ diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index 4b34a52..d6190c6 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -171,7 +171,7 @@ static herr_t H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *) _mesg; - unsigned char flags; /* Flags for encoding group info */ + unsigned char flags = 0; /* Flags for encoding group info */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -183,7 +183,7 @@ H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, *p++ = H5O_GINFO_VERSION; /* The flags for the group info */ - flags = ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0; + flags = (unsigned char)(ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0); flags = (unsigned char)(flags | (ginfo->store_est_entry_info ? H5O_GINFO_STORE_EST_ENTRY_INFO : 0)); *p++ = flags; diff --git a/src/H5Oint.c b/src/H5Oint.c index b97ff30..a16102a 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -31,6 +31,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* File access */ #include "H5FLprivate.h" /* Free lists */ @@ -55,7 +56,7 @@ /* User data for recursive traversal over objects from a group */ typedef struct { hid_t obj_id; /* The ID for the starting group */ - H5G_loc_t *start_loc; /* Location of starting group */ + H5G_loc_t *start_loc; /* Location of starting group */ H5SL_t *visited; /* Skip list for tracking visited nodes */ H5O_iterate_t op; /* Application callback */ void *op_data; /* Application's op data */ @@ -239,7 +240,7 @@ H5O_set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_idx version = H5O_VERSION_1; /* Upgrade to the version indicated by the file's low bound if higher */ - version = MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]); + version = (uint8_t)MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]); /* Version bounds check */ if(version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(f)]) @@ -2282,63 +2283,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__get_info_by_idx - * - * Purpose: Internal routine to retrieve an object's info according to - * an index within a group. - * - * - * Note: Add a parameter "fields" to indicate selection of object info. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields) -{ - H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ - hbool_t loc_found = FALSE; /* Entry at 'name' found */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check arguments */ - HDassert(loc); - HDassert(group_name && *group_name); - HDassert(oinfo); - - /* Set up opened group location to fill in */ - obj_loc.oloc = &obj_oloc; - obj_loc.path = &obj_path; - H5G_loc_reset(&obj_loc); - - /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(loc, group_name, idx_type, order, n, &obj_loc/*out*/) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - loc_found = TRUE; - - /* Retrieve the object's information */ - if(H5O_get_info(obj_loc.oloc, oinfo, fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") - -done: - /* Release the object location */ - if(loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__get_info_by_idx() */ - - -/*------------------------------------------------------------------------- * Function: H5O_get_create_plist * * Purpose: Retrieve the object creation properties for an object @@ -2378,7 +2322,7 @@ H5O_get_create_plist(const H5O_loc_t *loc, H5P_genplist_t *oc_plist) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set min. # of dense attributes in property list") /* Mask off non-"user visible" flags */ - ohdr_flags = oh->flags & (H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_STORE_TIMES); + H5_CHECKED_ASSIGN(ohdr_flags, uint8_t, oh->flags & (H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_STORE_TIMES), int); /* Set object header flags */ if(H5P_set(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 138f219..2a2a07b 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -570,7 +570,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, H5O_LAYOUT_VERSION_3 : mesg->version); /* Layout class */ - *p++ = mesg->type; + *p++ = (uint8_t)mesg->type; /* Write out layout class specific information */ switch(mesg->type) { diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index 9827b6a..a2f88d9 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -203,7 +203,7 @@ H5O_linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co *p++ = H5O_LINFO_VERSION; /* The flags for the link indices */ - index_flags = linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0; + index_flags = (uint8_t)(linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0); index_flags = (uint8_t)(index_flags | (linfo->index_corder ? H5O_LINFO_INDEX_CORDER : 0)); *p++ = index_flags; diff --git a/src/H5Olink.c b/src/H5Olink.c index 4bd952b..1f0c6c7 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -316,7 +316,7 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con /* Store the type of a non-default link */ if(link_flags & H5O_LINK_STORE_LINK_TYPE) - *p++ = lnk->type; + *p++ = (uint8_t)lnk->type; /* Store the link creation order in the file, if its valid */ if(lnk->corder_valid) diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 4afa452..c7167c7 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -556,8 +556,6 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1]; /* Package-local function prototypes */ H5_DLL const H5O_obj_class_t *H5O__obj_class(const H5O_loc_t *loc); H5_DLL int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted); -H5_DLL herr_t H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields); H5_DLL herr_t H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields); H5_DLL herr_t H5O__inc_rc(H5O_t *oh); diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 54e8ec8..5965fc6 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -877,6 +877,7 @@ typedef struct { void *new_obj; /* Pointer to new object created */ } H5O_obj_create_t; + /* Forward declarations for prototype arguments */ struct H5P_genplist_t; diff --git a/src/H5Opublic.h b/src/H5Opublic.h index 234f4f0..cda446b 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -75,7 +75,7 @@ /* Flags for H5Oget_info. * Theses flags determine which fields will be filled in in the H5O_info_t - * struct. + * struct. */ #define H5O_INFO_BASIC 0x0001u /* Fill in the fileno, addr, type, and rc fields */ #define H5O_INFO_TIME 0x0002u /* Fill in the atime, mtime, ctime, and btime fields */ diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index b4f00ea..33310dc 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -257,7 +257,7 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) /* Dataspace type */ if(sdim->version > H5O_SDSPACE_VERSION_1) - *p++ = sdim->type; + *p++ = (uint8_t)sdim->type; else { *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 7a7cc23..d899fa9 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -270,8 +270,8 @@ H5P__lacc_elink_fapl_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED if(NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") - if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") } /* end if */ done: @@ -313,8 +313,8 @@ H5P__lacc_elink_fapl_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED if(NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") - if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") } /* end if */ done: @@ -329,8 +329,8 @@ done: * property in the dataset access property list is * encoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -401,8 +401,8 @@ done: * property in the dataset access property list is * decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -454,15 +454,15 @@ done: /*-------------------------------------------------------------------------- - * Function: H5P__lacc_elink_fapl_del + * Function: H5P__lacc_elink_fapl_del * - * Purpose: Close the FAPL for link access + * Purpose: Close the FAPL for link access * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Vailin Choi - * Tuesday, Sept 23, 2008 + * Programmer: Vailin Choi + * Tuesday, Sept 23, 2008 * *-------------------------------------------------------------------------- */ @@ -482,7 +482,7 @@ H5P__lacc_elink_fapl_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED /* Close the FAPL */ if(l_fapl_id != H5P_DEFAULT && H5I_dec_ref(l_fapl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") done: FUNC_LEAVE_NOAPI(ret_value) @@ -490,15 +490,15 @@ done: /*-------------------------------------------------------------------------- - * Function: H5P__lacc_elink_fapl_copy + * Function: H5P__lacc_elink_fapl_copy * - * Purpose: Copy the FAPL for link access + * Purpose: Copy the FAPL for link access * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Vailin Choi - * Tuesday, Sept 23, 2008 + * Programmer: Vailin Choi + * Tuesday, Sept 23, 2008 * *-------------------------------------------------------------------------- */ @@ -522,8 +522,8 @@ H5P__lacc_elink_fapl_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED if(NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") - if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") } /* end if */ done: @@ -579,23 +579,23 @@ done: /*-------------------------------------------------------------------------- - * Function: H5P__lacc_elink_fapl_close + * Function: H5P__lacc_elink_fapl_close * - * Purpose: Close the FAPL for link access + * Purpose: Close the FAPL for link access * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Vailin Choi - * Tuesday, Sept 23, 2008 + * Programmer: Vailin Choi + * Tuesday, Sept 23, 2008 * *--------------------------------------------------------------------------- */ static herr_t H5P__lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - hid_t l_fapl_id; - herr_t ret_value = SUCCEED; + hid_t l_fapl_id; + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -607,7 +607,7 @@ H5P__lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE /* Close the FAPL */ if((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id) < 0)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") done: FUNC_LEAVE_NOAPI(ret_value) @@ -237,7 +237,7 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, done: if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement refcount on file") + HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file") FUNC_LEAVE_API(ret_value) } /* end H5Rcreate_region() */ @@ -326,7 +326,7 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, done: if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement refcount on file") + HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file") FUNC_LEAVE_API(ret_value) } /* end H5Rcreate_attr() */ @@ -616,7 +616,7 @@ done: HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close object") if(H5I_INVALID_HID == ret_value) /* Cleanup on failure */ if((space_id != H5I_INVALID_HID) && (H5I_dec_ref(space_id) < 0)) - HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close dataspace") + HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close dataspace") FUNC_LEAVE_API(ret_value) } /* end H5Ropen_region() */ @@ -688,7 +688,7 @@ H5Ropen_attr(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id) /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -700,18 +700,18 @@ H5Ropen_attr(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id) /* Open the attribute */ if(NULL == (opened_attr = H5VL_attr_open(opened_obj, &loc_params, H5R_REF_ATTRNAME((const H5R_ref_priv_t *)ref_ptr), aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", H5R_REF_ATTRNAME((const H5R_ref_priv_t *)ref_ptr)) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", H5R_REF_ATTRNAME((const H5R_ref_priv_t *)ref_ptr)) /* Register the attribute and get an ID for it */ if((ret_value = H5VL_register(H5I_ATTR, opened_attr, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: if((opened_obj_id != H5I_INVALID_HID) && (H5I_dec_ref(opened_obj_id) < 0)) HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close object") if(H5I_INVALID_HID == ret_value) /* Cleanup on failure */ if(opened_attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") + HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* end H5Ropen_attr() */ @@ -746,7 +746,7 @@ H5Rget_obj_type3(const H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type) || H5R__get_type((const H5R_ref_priv_t *)ref_ptr) >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") if(rapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Retrieve loc_id from reference */ if(H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) { @@ -770,7 +770,7 @@ H5Rget_obj_type3(const H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type) /* Retrieve object's type */ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object type") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve object type") done: FUNC_LEAVE_API(ret_value) @@ -854,7 +854,7 @@ H5Rget_obj_name(const H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size) || H5R__get_type((const H5R_ref_priv_t *)ref_ptr) >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type") if(rapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a property list") /* Retrieve loc_id from reference */ if(H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) { @@ -878,7 +878,7 @@ H5Rget_obj_name(const H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size) /* Retrieve object's name */ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, buf, size) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve object name") done: FUNC_LEAVE_API(ret_value) @@ -915,3 +915,4 @@ H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *buf, size_t size) done: FUNC_LEAVE_API(ret_value) } /* end H5Rget_attr_name() */ + diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index ad3c219..256c930 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -133,7 +133,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) /* Retrieve object's type */ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5G_UNKNOWN, "can't retrieve object type") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "can't retrieve object type") /* Set return value */ ret_value = H5G_map_obj_type(obj_type); @@ -251,6 +251,19 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(vol_obj, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ + /* Get object type */ if((vol_obj_type = H5I_get_type(loc_id)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") @@ -274,7 +287,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get container info */ - if(H5VL_file_get(vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) + if(H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info") /* Create reference */ @@ -283,7 +296,8 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, if((ret_value = H5R__encode_token_obj_compat((const H5VL_token_t *)&obj_token, cont_info.token_size, buf, &buf_size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to encode object reference") - } else { + } /* end if */ + else { H5F_t *f = NULL; H5S_t *space = NULL; /* Pointer to dataspace containing region */ size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE; @@ -294,17 +308,14 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, if(NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - /* Currently restrict API usage to native VOL - * TODO check for terminal connector or use capability flag */ - /* Retrieve file from VOL object */ - if(NULL == (f = (H5F_t *)H5VL_object_data(vol_obj_file))) + if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") /* Encode dataset region */ if((ret_value = H5R__encode_token_region_compat(f, (const H5VL_token_t *)&obj_token, cont_info.token_size, space, buf, &buf_size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to encode region reference") - } + } /* end else */ done: if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) @@ -362,7 +373,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, /* Retrieve object's type */ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object type") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve object type") done: FUNC_LEAVE_API(ret_value) @@ -475,6 +486,19 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) if(NULL == (vol_obj = H5VL_vol_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(vol_obj, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ + /* Get object type */ if((vol_obj_type = H5I_get_type(id)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") @@ -488,11 +512,11 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Get container info */ - if(H5VL_file_get(vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) + if(H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get container info") /* Retrieve file from VOL object */ - if(NULL == (f = (H5F_t *)H5VL_object_data(vol_obj_file))) + if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL object") /* Get the dataspace with the correct region selected */ @@ -501,7 +525,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) /* Atomize */ if((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") done: if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) @@ -559,7 +583,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name, /* Retrieve object's name */ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve object name") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Rint.c b/src/H5Rint.c index 2a21179..46e4c0c 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -319,12 +319,12 @@ H5R__create_region(const H5VL_token_t *obj_token, size_t token_size, ref->encode_size); done: - if(ret_value < 0) { + if(ret_value < 0) if(ref->ref.reg.space) { H5S_close(ref->ref.reg.space); ref->ref.reg.space = NULL; - } - } + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5R__create_region */ @@ -374,8 +374,11 @@ H5R__create_attr(const H5VL_token_t *obj_token, size_t token_size, ref->ref.attr.name, ref->encode_size); done: - if(ret_value < 0) - ref->ref.attr.name = H5MM_xfree(ref->ref.attr.name); + if(ret_value < 0) { + H5MM_xfree(ref->ref.attr.name); + ref->ref.attr.name = NULL; + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5R__create_attr */ @@ -398,19 +401,24 @@ H5R__destroy(H5R_ref_priv_t *ref) HDassert(ref != NULL); - ref->ref.obj.filename = H5MM_xfree(ref->ref.obj.filename); + H5MM_xfree(ref->ref.obj.filename); + ref->ref.obj.filename = NULL; switch(ref->type) { case H5R_OBJECT2: break; + case H5R_DATASET_REGION2: if(H5S_close(ref->ref.reg.space) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "Cannot close dataspace") ref->ref.reg.space = NULL; break; + case H5R_ATTR: - ref->ref.attr.name = H5MM_xfree(ref->ref.attr.name); + H5MM_xfree(ref->ref.attr.name); + ref->ref.attr.name = NULL; break; + case H5R_OBJECT1: case H5R_DATASET_REGION1: break; @@ -418,6 +426,7 @@ H5R__destroy(H5R_ref_priv_t *ref) case H5R_MAXTYPE: HDassert("invalid reference type" && 0); HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)") + default: HDassert("unknown reference type" && 0); HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") @@ -501,11 +510,11 @@ H5R__get_loc_id(const H5R_ref_priv_t *ref) hid_t H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id) { - void *new_file = NULL; - H5VL_connector_prop_t connector_prop; - unsigned flags = H5F_ACC_RDWR; /* Must open file read-write to allow for object modifications */ - H5P_genplist_t *plist; - H5VL_object_t *vol_obj = NULL; /* VOL object for file */ + H5P_genplist_t *plist; /* Property list for FAPL */ + void *new_file = NULL; /* File object opened */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_object_t *vol_obj = NULL; /* VOL object for file */ + hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */ hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_PACKAGE @@ -520,29 +529,34 @@ H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id) if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") /* Stash a copy of the "top-level" connector property, before any pass-through * connectors modify or unwrap it. */ if(H5CX_set_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context") /* Open the file */ - if(NULL == (new_file = H5VL_file_open(&connector_prop, H5R_REF_FILENAME(ref), flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") + /* (Must open file read-write to allow for object modifications) */ + if(NULL == (new_file = H5VL_file_open(&connector_prop, H5R_REF_FILENAME(ref), H5F_ACC_RDWR, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") /* Get an ID for the file */ if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") /* Get the file object */ if(NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier") - /* Make the post open callback */ - if(H5VL_file_specific(vol_obj, H5VL_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file post open callback") + /* Make the 'post open' callback */ + supported = FALSE; + if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation") + if(supported) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback") /* Attach loc_id to reference */ if(H5R__set_loc_id((H5R_ref_priv_t *)ref, ret_value, FALSE) < 0) @@ -570,7 +584,7 @@ H5R__get_type(const H5R_ref_priv_t *ref) FUNC_ENTER_PACKAGE_NOERR HDassert(ref != NULL); - ret_value = ref->type; + ret_value = (H5R_type_t)ref->type; FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_type() */ @@ -762,7 +776,7 @@ H5R__set_obj_token(H5R_ref_priv_t *ref, const H5VL_token_t *obj_token, HDassert(token_size <= H5VL_MAX_TOKEN_SIZE); H5MM_memcpy(&ref->ref.obj.token, obj_token, ref->token_size); - ref->token_size = token_size; + ref->token_size = (uint8_t)token_size; FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__set_obj_token() */ @@ -922,7 +936,7 @@ H5R__encode(const char *filename, const H5R_ref_priv_t *ref, unsigned char *buf, *p++ = (uint8_t)flags; buf_size = *nalloc - H5R_ENCODE_HEADER_SIZE; - } + } /* end if */ encode_size += H5R_ENCODE_HEADER_SIZE; /* Encode object token */ @@ -937,31 +951,34 @@ H5R__encode(const char *filename, const H5R_ref_priv_t *ref, unsigned char *buf, * - avoid duplicating VOL info on each reference * - must query terminal VOL connector to avoid passthrough confusion */ - if(flags & H5R_IS_EXTERNAL) { + if(flags & H5R_IS_EXTERNAL) /* Encode file name */ H5R_ENCODE(H5R__encode_string, filename, p, buf_size, encode_size, "Cannot encode filename"); - } switch(ref->type) { case H5R_OBJECT2: break; + case H5R_DATASET_REGION2: /* Encode dataspace */ H5R_ENCODE(H5R__encode_region, ref->ref.reg.space, p, buf_size, encode_size, "Cannot encode region"); break; + case H5R_ATTR: /* Encode attribute name */ H5R_ENCODE(H5R__encode_string, ref->ref.attr.name, p, buf_size, encode_size, "Cannot encode attribute name"); break; + case H5R_OBJECT1: case H5R_DATASET_REGION1: case H5R_BADTYPE: case H5R_MAXTYPE: HDassert("invalid reference type" && 0); HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)") + default: HDassert("unknown reference type" && 0); HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") @@ -1003,7 +1020,7 @@ H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small") /* Set new reference */ - ref->type = (H5R_type_t)*p++; + ref->type = (int8_t)*p++; if(ref->type <= H5R_BADTYPE || ref->type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") @@ -1053,7 +1070,7 @@ H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref) ref->loc_id = H5I_INVALID_HID; /* Set encoding size */ - ref->encode_size = decode_size; + ref->encode_size = (uint32_t)decode_size; H5R_LOG_DEBUG("Decoded reference, filename=%s, obj_addr=%s, encode size=%u", ref->ref.obj.filename, H5R__print_token(ref->ref.obj.token), @@ -1136,7 +1153,7 @@ H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, /* Decode token */ H5MM_memcpy(obj_token, p, *token_size); - *nbytes = *token_size + H5_SIZEOF_UINT8_T; + *nbytes = (size_t)*token_size + H5_SIZEOF_UINT8_T; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1184,7 +1201,7 @@ H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc) /* Serialize the selection */ if(H5S_SELECT_SERIALIZE(space, (unsigned char **)&p) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "can't serialize selection") - } + } /* end if */ *nalloc = (size_t)buf_size + 2 * H5_SIZEOF_UINT32_T; done: @@ -1322,7 +1339,7 @@ H5R__decode_string(const unsigned char *buf, size_t *nbytes, char **string_ptr) HDassert(string_len <= H5R_MAX_STRING_LEN); /* Allocate the string */ - if(NULL == (string = H5MM_malloc(string_len + 1))) + if(NULL == (string = (char *)H5MM_malloc(string_len + 1))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, FAIL, "Cannot allocate string") /* Copy the string */ @@ -1364,13 +1381,13 @@ H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc, uint8_t *p = (uint8_t *)buf; /* Write the reference information to disk (allocates space also) */ - if(H5HG_insert(f, data_size, (void *)data, &hobjid) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to write reference information") + if(H5HG_insert(f, data_size, data, &hobjid) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to write reference information") /* Encode the heap information */ H5F_addr_encode(f, &p, hobjid.addr); UINT32ENCODE(p, hobjid.idx); - } + } /* end if */ *nalloc = buf_size; done: @@ -1416,7 +1433,7 @@ H5R__decode_heap(H5F_t *f, const unsigned char *buf, size_t *nbytes, /* Read the information from disk */ if(NULL == (*data_ptr = (unsigned char *)H5HG_read(f, &hobjid, (void *)*data_ptr, data_size))) - HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "Unable to read reference data") + HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read reference data") *nbytes = buf_size; @@ -1462,7 +1479,7 @@ H5R__free_heap(H5F_t *f, const unsigned char *buf, size_t nbytes) if(hobjid.addr > 0) { /* Free heap object */ if(H5HG_remove(f, &hobjid) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object") + HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to remove heap object") } /* end if */ done: @@ -1490,6 +1507,19 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref FUNC_ENTER_PACKAGE +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(vol_obj, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ + /* Get the file for the object */ if((file_id = H5F_get_file_id(vol_obj, type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -1499,7 +1529,7 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get container info */ - if(H5VL_file_get(vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) + if(H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info") if(ref_type == H5R_OBJECT1) { @@ -1508,18 +1538,19 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref /* Get object address */ if(H5R__decode_token_obj_compat(buf, &buf_size, obj_token, cont_info.token_size) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object token") - } else { + } /* end if */ + else { size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE; H5F_t *f = NULL; /* Retrieve file from VOL object */ - if(NULL == (f = (H5F_t *)H5VL_object_data(vol_obj_file))) + if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") /* Get object address */ if(H5R__decode_token_region_compat(f, buf, &buf_size, obj_token, cont_info.token_size, NULL) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address") - } + } /* end else */ done: if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) @@ -1646,7 +1677,7 @@ H5R__encode_token_region_compat(H5F_t *f, const H5VL_token_t *obj_token, /* Allocate the space to store the serialized information */ H5_CHECK_OVERFLOW(data_size, hssize_t, size_t); if(NULL == (data = (uint8_t *)H5MM_malloc((size_t)data_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_REFERENCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Serialize information for dataset OID into heap buffer */ p = (uint8_t *)data; @@ -1717,7 +1748,7 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, /* Open and copy the dataset's dataspace */ if(NULL == (space = H5S_read(&oloc))) - HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, FAIL, "not found") + HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "not found") /* Unserialize the selection */ if(H5S_SELECT_DESERIALIZE(&space, &p) < 0) diff --git a/src/H5Rprivate.h b/src/H5Rprivate.h index 6afec47..870deaf 100644 --- a/src/H5Rprivate.h +++ b/src/H5Rprivate.h @@ -43,3 +43,4 @@ /******************************/ #endif /* _H5Rprivate_H */ + diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index a13d54b..cfbf3c8 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -71,7 +71,7 @@ typedef haddr_t hobj_ref_t; * Note! This type can only be used with the "native" HDF5 VOL connector. */ typedef struct { - char __data[H5R_DSET_REG_REF_BUF_SIZE]; + uint8_t __data[H5R_DSET_REG_REF_BUF_SIZE]; } hdset_reg_ref_t; /** @@ -80,7 +80,7 @@ typedef struct { * should always be used with the current reference API. */ typedef struct { - char __data[H5R_REF_BUF_SIZE]; + uint8_t __data[H5R_REF_BUF_SIZE]; } H5R_ref_t; /********************/ diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 49ce2b4..ee28fa4 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -397,7 +397,7 @@ H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t len, *image++ = H5SM_LIST_VERSION; /* Is message index a list or a B-tree? */ - *image++ = table->indexes[u].index_type; + *image++ = (uint8_t)table->indexes[u].index_type; /* Type of messages in the index */ UINT16ENCODE(image, table->indexes[u].mesg_types); diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c index 0cca6bb..e085204 100644 --- a/src/H5SMmessage.c +++ b/src/H5SMmessage.c @@ -298,7 +298,7 @@ H5SM__message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) /* Sanity check */ HDassert(ctx); - *raw++ = message->location; + *raw++ = (uint8_t)message->location; UINT32ENCODE(raw, message->hash); if(message->location == H5SM_IN_HEAP) { diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 1e1538e..dc97ea2 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -3688,7 +3688,7 @@ H5S__hyper_get_version_enc_size(const H5S_t *space, hsize_t block_count, uint32_ /* Determine the encoding size */ enc2 = H5S__hyper_get_enc_size_real(max2); - *enc_size = MAX(enc1, enc2); + *enc_size = (uint8_t)MAX(enc1, enc2); } /* end if */ else { hsize_t max_size = block_count; diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index f29319f..a61c505 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -238,7 +238,7 @@ H5_DLL herr_t H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *spac H5_DLL herr_t H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *buf); H5_DLL htri_t H5S_select_valid(const H5S_t *space); -H5_DLL hssize_t H5S_get_select_npoints(const H5S_t *space); +H5_DLL hsize_t H5S_get_select_npoints(const H5S_t *space); H5_DLL herr_t H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); H5_DLL herr_t H5S_get_select_offset(const H5S_t *space, hsize_t *offset); H5_DLL int H5S_get_select_unlim_dim(const H5S_t *space); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 6c8b898..9814e38 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -431,7 +431,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -H5_ATTR_PURE hssize_t +H5_ATTR_PURE hsize_t H5S_get_select_npoints(const H5S_t *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -439,7 +439,7 @@ H5S_get_select_npoints(const H5S_t *space) /* Check args */ HDassert(space); - FUNC_LEAVE_NOAPI((hssize_t)space->select.num_elem) + FUNC_LEAVE_NOAPI(space->select.num_elem) } /* end H5S_get_select_npoints() */ @@ -533,7 +533,7 @@ const unsigned H5O_dtype_ver_bounds[] = { H5O_DTYPE_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V18 */ H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V110 */ - H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V112 */ + H5O_DTYPE_VERSION_4, /* H5F_LIBVER_V112 */ H5O_DTYPE_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; diff --git a/src/H5Tbit.c b/src/H5Tbit.c index df6d2c3..c6c1777 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -363,7 +363,7 @@ H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value) /* The middle bytes */ while (size >= 8) { - buf[idx++] = value ? 0xff : 0x00; + buf[idx++] = (uint8_t)(value ? 0xff : 0x00); size -= 8; } @@ -532,7 +532,7 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size) acc = buf[idx]; acc++; carry = acc & 0x100; - buf[idx] = acc & 0xff; + buf[idx] = (uint8_t)(acc & 0xff); idx++; size -= 8; } diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index e5d12c0..5c848c2 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -306,7 +306,8 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Commit the datatype */ - if(NULL == (dt = H5VL_datatype_commit(vol_obj, &loc_params, NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dt = H5VL_datatype_commit(vol_obj, &loc_params, NULL, type_id, H5P_LINK_CREATE_DEFAULT, + tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Setup VOL object */ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 4cc5f3c..8a0c562 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3609,23 +3609,22 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, for(elmtno = 0; elmtno < safe; elmtno++) { size_t buf_size; hbool_t dst_copy = FALSE; - hbool_t is_nil; /* Whether sequence is "nil" */ + hbool_t is_nil; /* Whether reference is "nil" */ - /* Check for "nil" source sequence */ + /* Check for "nil" source reference */ if((*(src->shared->u.atomic.u.r.cls->isnull))(src->shared->u.atomic.u.r.file, s, &is_nil) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if reference data is 'nil'") if(is_nil) { - - /* Write "nil" sequence to destination location */ + /* Write "nil" reference to destination location */ if((*(dst->shared->u.atomic.u.r.cls->setnull))(dst->shared->u.atomic.u.r.file, d, b) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set reference data to 'nil'") } /* end else-if */ else { /* Get size of references */ if(0 == (buf_size = src->shared->u.atomic.u.r.cls->getsize( - src->shared->u.atomic.u.r.file, s, src->shared->size, - dst->shared->u.atomic.u.r.file, &dst_copy))) + src->shared->u.atomic.u.r.file, s, src->shared->size, + dst->shared->u.atomic.u.r.file, &dst_copy))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect size") /* Check if conversion buffer is large enough, resize if necessary. */ @@ -3636,26 +3635,26 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, HDmemset(conv_buf, 0, conv_buf_size); } /* end if */ - if(dst_copy && (src->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) { + if(dst_copy && (src->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) H5MM_memcpy(conv_buf, s, buf_size); - } else { + else { /* Read reference */ if(src->shared->u.atomic.u.r.cls->read( - src->shared->u.atomic.u.r.file, s, src->shared->size, - dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0) + src->shared->u.atomic.u.r.file, s, src->shared->size, + dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read reference data") - } + } /* end else */ - if(dst_copy && (dst->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) { + if(dst_copy && (dst->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) H5MM_memcpy(d, conv_buf, buf_size); - } else { + else { /* Write reference to destination location */ if(dst->shared->u.atomic.u.r.cls->write( - src->shared->u.atomic.u.r.file, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype, - dst->shared->u.atomic.u.r.file, d, dst->shared->size, b) < 0) + src->shared->u.atomic.u.r.file, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype, + dst->shared->u.atomic.u.r.file, d, dst->shared->size, b) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write reference data") - } - } + } /* end else */ + } /* end else */ /* Advance pointers */ s += s_stride; diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 6ee0cd7..9998317 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -137,7 +137,8 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Commit the datatype */ - if(NULL == (data = H5VL_datatype_commit(vol_obj, &loc_params, name, type_id, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (data = H5VL_datatype_commit(vol_obj, &loc_params, name, type_id, H5P_LINK_CREATE_DEFAULT, + H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Set up VOL object */ diff --git a/src/H5Tref.c b/src/H5Tref.c index 6f21363..f31fecf 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -159,24 +159,25 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* Set up the function pointers to access the reference in memory */ dt->shared->u.atomic.u.r.cls = &H5T_ref_mem_g; - - } else if(dt->shared->u.atomic.u.r.rtype == H5R_OBJECT1) { + } /* end if */ + else if(dt->shared->u.atomic.u.r.rtype == H5R_OBJECT1) { /* Size in memory, disk size is different */ dt->shared->size = H5T_REF_OBJ_MEM_SIZE; dt->shared->u.atomic.prec = 8 * dt->shared->size; /* Unused for now */ dt->shared->u.atomic.u.r.cls = NULL; - - } else if(dt->shared->u.atomic.u.r.rtype == H5R_DATASET_REGION1) { + } /* end else-if */ + else if(dt->shared->u.atomic.u.r.rtype == H5R_DATASET_REGION1) { /* Size in memory, disk size is different */ dt->shared->size = H5T_REF_DSETREG_MEM_SIZE; dt->shared->u.atomic.prec = 8 * dt->shared->size; /* Unused for now */ dt->shared->u.atomic.u.r.cls = NULL; - - } + } /* end else-if */ + else + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "invalid location") break; case H5T_LOC_DISK: /* Disk based reference datatype */ @@ -191,8 +192,18 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) if(dt->shared->u.atomic.u.r.rtype == H5R_OBJECT1) { H5F_t *f; - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (f = (H5F_t *)H5VL_object_data(file))) @@ -204,12 +215,22 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* Set up the function pointers to access the reference in memory */ dt->shared->u.atomic.u.r.cls = &H5T_ref_obj_disk_g; - - } else if(dt->shared->u.atomic.u.r.rtype == H5R_DATASET_REGION1) { + } /* end if */ + else if(dt->shared->u.atomic.u.r.rtype == H5R_DATASET_REGION1) { H5F_t *f; - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (f = (H5F_t *)H5VL_object_data(file))) @@ -221,8 +242,8 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* Set up the function pointers to access the reference in memory */ dt->shared->u.atomic.u.r.cls = &H5T_ref_dsetreg_disk_g; - - } else { + } /* end else-if */ + else { H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; size_t ref_encode_size; H5R_ref_priv_t fixed_ref; @@ -249,7 +270,6 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) * on disk, so use the same functions. */ dt->shared->u.atomic.u.r.cls = &H5T_ref_disk_g; - } break; @@ -267,8 +287,7 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) break; - case H5T_LOC_MAXLOC: - /* MAXLOC is invalid */ + case H5T_LOC_MAXLOC: /* MAXLOC is invalid */ default: HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid reference datatype location") } /* end switch */ @@ -345,17 +364,16 @@ static size_t H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, hbool_t *dst_copy) { - H5VL_object_t *vol_obj = NULL; + H5VL_object_t *vol_obj; /* VOL object for src ref's location */ const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf; - hbool_t files_equal = FALSE; - char file_name_buf_static[256]; - char *file_name_buf_dyn = NULL; - ssize_t file_name_len; - unsigned flags = 0; - size_t ret_value = 0; + hbool_t files_equal = FALSE; /* Whether src & dst references are in same file */ + char *file_name_buf_dyn = NULL; /* Pointer to dynamically allocated buffer for file name, if static buffer is too small */ + unsigned flags = 0; /* References flags */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_STATIC + /* Sanity check */ HDassert(src_buf); HDassert(src_size == H5T_REF_MEM_SIZE); @@ -364,21 +382,27 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") /* Set external flag if referenced file is not destination file */ - if(H5VL_file_specific(vol_obj, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, dst_file, &files_equal) < 0) + if(H5VL_file_is_same(vol_obj, dst_file, &files_equal) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, 0, "can't check if files are equal") flags |= !files_equal ? H5R_IS_EXTERNAL : 0; /* Force re-calculating encoding size if any flags are set */ if(flags || !src_ref->encode_size) { + char file_name_buf_static[256]; /* File name */ + ssize_t file_name_len; /* Size of file name buffer */ + /* Pass the correct encoding version for the selection depending on the * file libver bounds, this is later retrieved in H5S hyper encode */ if(src_ref->type == (int8_t)H5R_DATASET_REGION2) { - /* Temporary hack to check if this is the native connector. We need to - * add a way to check if the terminal connector is native. For now this - * will break passthroughs, but it's needed for other VOL connectors to - * work. -NAF */ - if(dst_file->connector->cls->value == H5VL_NATIVE_VALUE) { - H5F_t *dst_f; + hbool_t is_native = FALSE; /* Whether the dest. file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(dst_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") + + /* Set the file's libver bounds if using the native VOL connector */ + if(is_native) { + H5F_t *dst_f; /* Native file struct */ if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") @@ -401,14 +425,15 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf /* Determine encoding size */ if(H5R__encode(file_name_buf_dyn ? file_name_buf_dyn : file_name_buf_static, src_ref, NULL, &ret_value, flags) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, 0, "unable to determine encoding size") - } else { + } /* end if */ + else { /* Can do a direct copy and skip blob decoding */ if(src_ref->type == (int8_t)H5R_OBJECT2) *dst_copy = TRUE; /* Get cached encoding size */ ret_value = src_ref->encode_size; - } + } /* end else */ done: H5MM_xfree(file_name_buf_dyn); @@ -431,17 +456,18 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size) { - H5VL_object_t *vol_obj = NULL; + H5VL_object_t *vol_obj; /* VOL object for src ref's location */ const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf; - hbool_t files_equal = FALSE; - char file_name_buf_static[256]; - char *file_name_buf_dyn = NULL; - ssize_t file_name_len; - unsigned flags = 0; - herr_t ret_value = SUCCEED; + hbool_t files_equal = FALSE; /* Whether src & dst references are in same file */ + char file_name_buf_static[256]; /* File name */ + char *file_name_buf_dyn = NULL; /* Pointer to dynamically allocated buffer for file name, if static buffer is too small */ + ssize_t file_name_len; /* Size of file name buffer */ + unsigned flags = 0; /* References flags */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC + /* Sanity check */ HDassert(src_buf); HDassert(src_size == H5T_REF_MEM_SIZE); HDassert(dst_file); @@ -453,18 +479,21 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") /* Set external flag if referenced file is not destination file */ - if(H5VL_file_specific(vol_obj, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, dst_file, &files_equal) < 0) + if(H5VL_file_is_same(vol_obj, dst_file, &files_equal) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "can't check if files are equal") flags |= !files_equal ? H5R_IS_EXTERNAL : 0; /* Pass the correct encoding version for the selection depending on the * file libver bounds, this is later retrieved in H5S hyper encode */ if(src_ref->type == (int8_t)H5R_DATASET_REGION2) { - /* Temporary hack to check if this is the native connector. We need to - * add a way to check if the terminal connector is native. For now this - * will break passthroughs, but it's needed for other VOL connectors to - * work. -NAF */ - if(dst_file->connector->cls->value == H5VL_NATIVE_VALUE) { + hbool_t is_native = FALSE; /* Whether the dest. file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(dst_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") + + /* Set the file's libver bounds if using the native VOL connector */ + if(is_native) { H5F_t *dst_f; if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) @@ -517,14 +546,25 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size FUNC_ENTER_STATIC + /* Sanity check */ HDassert(src_file); HDassert(src_buf); HDassert(src_size); HDassert(dst_buf); HDassert(dst_size == H5T_REF_MEM_SIZE); - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(src_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) @@ -534,24 +574,29 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size HDmemset(dst_buf, 0, dst_size); switch(src_type) { - case H5R_OBJECT1: { - size_t token_size = H5F_SIZEOF_ADDR(src_f); + case H5R_OBJECT1: + { + size_t token_size = H5F_SIZEOF_ADDR(src_f); - if(H5R__create_object((const H5VL_token_t *)src_buf, token_size, dst_ref) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create object reference") - } + if(H5R__create_object((const H5VL_token_t *)src_buf, token_size, dst_ref) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create object reference") + } break; - case H5R_DATASET_REGION1: { - const struct H5Tref_dsetreg *src_reg = (const struct H5Tref_dsetreg *)src_buf; - size_t token_size = H5F_SIZEOF_ADDR(src_f); - - if(H5R__create_region(&src_reg->token, token_size, src_reg->space, dst_ref) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create region reference") - /* create_region creates its internal copy of the space */ - if(H5S_close(src_reg->space) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "Cannot close dataspace") - } + + case H5R_DATASET_REGION1: + { + const struct H5Tref_dsetreg *src_reg = (const struct H5Tref_dsetreg *)src_buf; + size_t token_size = H5F_SIZEOF_ADDR(src_f); + + if(H5R__create_region(&src_reg->token, token_size, src_reg->space, dst_ref) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create region reference") + + /* create_region creates its internal copy of the space */ + if(H5S_close(src_reg->space) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "Cannot close dataspace") + } break; + case H5R_DATASET_REGION2: /* Pass the correct encoding version for the selection depending on the * file libver bounds, this is later retrieved in H5S hyper decode */ @@ -563,12 +608,13 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size if(H5R__decode((const unsigned char *)src_buf, &src_size, dst_ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Cannot decode reference") break; + case H5R_BADTYPE: case H5R_MAXTYPE: default: HDassert("unknown reference type" && 0); HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") - } + } /* end switch */ /* If no filename set, this is not an external reference */ if(NULL == H5R_REF_FILENAME(dst_ref)) { @@ -579,7 +625,7 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size /* Attach loc ID to reference and hold reference to it */ if(H5R__set_loc_id(dst_ref, file_id, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference") - } + } /* end if */ done: if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0)) @@ -713,13 +759,14 @@ H5T__ref_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_bu *dst_copy = TRUE; ret_value = src_size; - } else { + } /* end if */ + else { /* Retrieve encoded data size */ UINT32DECODE(p, ret_value); /* Add size of the header */ ret_value += H5R_ENCODE_HEADER_SIZE; - } + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -856,8 +903,18 @@ static herr_t H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, HDassert(src_buf); HDassert(isnull); - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(src_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) @@ -896,8 +953,18 @@ H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *sr HDassert(src_file); HDassert(src_buf); - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(src_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) @@ -934,8 +1001,18 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ HDassert(src_buf); HDassert(dst_buf); - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(src_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) @@ -946,7 +1023,7 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ /* Get object address */ if(H5R__decode_token_obj_compat((const unsigned char *)src_buf, &src_size, - (H5VL_token_t *)dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0) + (H5VL_token_t *)dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address") done: @@ -979,8 +1056,18 @@ H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, HDassert(src_buf); HDassert(isnull); - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(src_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) @@ -1020,16 +1107,21 @@ H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, #ifndef NDEBUG { H5F_t *src_f; + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(src_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ + /* Must use native VOL connector for this operation */ + HDassert(is_native); /* Retrieve file from VOL object */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f)); - } /* end block */ + } #endif /* NDEBUG */ done: @@ -1061,8 +1153,18 @@ H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t HDassert(dst_buf); HDassert(dst_size == sizeof(struct H5Tref_dsetreg)); - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(src_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) @@ -1072,7 +1174,7 @@ H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t /* Retrieve object address and space */ if(H5R__decode_token_region_compat(src_f, (const unsigned char *)src_buf, - &src_size, &dst_reg->token, H5F_SIZEOF_ADDR(src_f), &dst_reg->space) < 0) + &src_size, &dst_reg->token, H5F_SIZEOF_ADDR(src_f), &dst_reg->space) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address") done: @@ -1100,8 +1202,7 @@ H5T_ref_reclaim(void *elem, const H5T_t *dt) HDassert(elem); HDassert(dt && (dt->shared->type == H5T_REFERENCE)); - if(dt->shared->u.atomic.u.r.opaque - && (H5R__destroy((H5R_ref_priv_t *)elem) < 0)) + if(dt->shared->u.atomic.u.r.opaque && H5R__destroy((H5R_ref_priv_t *)elem) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "cannot free reference") done: diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index ec84879..9d098c6 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -545,7 +545,8 @@ H5T__vlen_mem_seq_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size) +H5T__vlen_mem_seq_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc_info_t *vl_alloc_info, + void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size) { hvl_t vl; /* Temporary hvl_t to use during operation */ herr_t ret_value = SUCCEED; /* Return value */ @@ -728,7 +729,8 @@ H5T__vlen_mem_str_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5 *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, size_t len) +H5T__vlen_mem_str_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, + size_t len) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s = *(char **)_vl; /* Pointer to the user's string information */ @@ -107,7 +107,7 @@ H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id) if (cls->wrap_cls.get_wrap_ctx && !cls->wrap_cls.free_wrap_ctx) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for object wrapping contexts when a get callback is provided") - /* Check VOL initialization property list */ + /* Check VOL initialization property list */ if(H5P_DEFAULT == vipl_id) vipl_id = H5P_VOL_INITIALIZE_DEFAULT; else @@ -154,7 +154,7 @@ H5VLregister_connector_by_name(const char *name, hid_t vipl_id) if (0 == HDstrlen(name)) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL connector name is disallowed") - /* Check VOL initialization property list */ + /* Check VOL initialization property list */ if(H5P_DEFAULT == vipl_id) vipl_id = H5P_VOL_INITIALIZE_DEFAULT; else @@ -199,7 +199,7 @@ H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id) if(value < 0) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "negative VOL connector value is disallowed") - /* Check VOL initialization property list */ + /* Check VOL initialization property list */ if(H5P_DEFAULT == vipl_id) vipl_id = H5P_VOL_INITIALIZE_DEFAULT; else @@ -477,6 +477,9 @@ done: * iteration routine callbacks (i.e. the callbacks from H5Aiterate*, * H5Literate* / H5Lvisit*, and H5Ovisit* ). * + * type must be a VOL-managed object class (H5I_FILE, + * H5I_GROUP, H5I_DATATYPE, H5I_DATASET, H5I_MAP, or H5I_ATTR). + * * Return: Success: Non-negative hid_t for the object. * Failure: Negative (H5I_INVALID_HID) * @@ -492,8 +495,34 @@ H5VLwrap_register(void *obj, H5I_type_t type) H5TRACE2("i", "*xIt", obj, type); /* Check args */ - if(type <= H5I_BADID || type >= H5I_NTYPES) - HGOTO_ERROR(H5E_VOL, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number") + /* Use a switch here for (hopefully) better performance than a series of + * equality checks. We could also group these types together in H5I_type_t, + * make some assertions here to guarantee that, then just check the range. + */ + switch(type) { + case H5I_FILE: + case H5I_GROUP: + case H5I_DATATYPE: + case H5I_DATASET: + case H5I_MAP: + case H5I_ATTR: + /* VOL-managed objects, call is valid */ + break; + case H5I_UNINIT: + case H5I_BADID: + case H5I_DATASPACE: + case H5I_VFL: + case H5I_VOL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: + case H5I_NTYPES: + default: + HGOTO_ERROR(H5E_VOL, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number") + } /* end switch */ if(NULL == obj) HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "obj is NULL") diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 77df207..30cbae1 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -66,13 +66,13 @@ static herr_t H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type void *buf, hid_t dxpl_id, void **req); static herr_t H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req); -static herr_t H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, +static herr_t H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments); +static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_attr_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); static void *H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, @@ -87,26 +87,39 @@ static herr_t H5VL__dataset_read(void *dset, const H5VL_class_t *cls, static herr_t H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req); -static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, +static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, +static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static void * H5VL__datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t lcpl_id, + hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +static void *H5VL__datatype_open(void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, const char *name, hid_t tapl_id, hid_t dxpl_id, + void **req); +static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls, + H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, + H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, + va_list arguments); +static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, + H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req); static void * H5VL__file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); static void * H5VL__file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__file_specific_wrap_va_list(void *obj, const H5VL_class_t *cls, - H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); -static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments); +static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, + H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, + H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, + H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); static void *H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, @@ -115,12 +128,12 @@ static void *H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, static void *H5VL__group_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, +static herr_t H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments); +static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls, + H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, + H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); static herr_t H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, @@ -138,8 +151,8 @@ static herr_t H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, static herr_t H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments); +static herr_t H5VL__link_optional(void *obj, const H5VL_class_t *cls, + H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static void *H5VL__object_open(void *obj, const H5VL_loc_params_t *params, const H5VL_class_t *cls, H5I_type_t *opened_type, hid_t dxpl_id, void **req); static herr_t H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, @@ -152,23 +165,12 @@ static herr_t H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, static herr_t H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments); -static void * H5VL__datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, - const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t lcpl_id, - hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -static void *H5VL__datatype_open(void *obj, const H5VL_loc_params_t *loc_params, - const H5VL_class_t *cls, const char *name, hid_t tapl_id, hid_t dxpl_id, - void **req); -static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls, - H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, - H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, - va_list arguments); -static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, - hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req); +static herr_t H5VL__object_optional(void *obj, const H5VL_class_t *cls, + H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__introspect_get_conn_cls(void *obj, const H5VL_class_t *cls, + H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); +static herr_t H5VL__introspect_opt_query(void *obj, const H5VL_class_t *cls, + H5VL_subclass_t subcls, int opt_type, hbool_t *supported); static herr_t H5VL__request_wait(void *req, const H5VL_class_t *cls, uint64_t timeout, H5ES_status_t *status); static herr_t H5VL__request_notify(void *req, const H5VL_class_t *cls, @@ -177,7 +179,7 @@ static herr_t H5VL__request_cancel(void *req, const H5VL_class_t *cls); static herr_t H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific_t specific_type, va_list arguments); static herr_t H5VL__request_optional(void *req, const H5VL_class_t *cls, - va_list arguments); + H5VL_request_optional_t opt_type, va_list arguments); static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls); static herr_t H5VL__blob_put(void *obj, const H5VL_class_t *cls, const void *buf, size_t size, void *blob_id, void *ctx); @@ -185,6 +187,10 @@ static herr_t H5VL__blob_get(void *obj, const H5VL_class_t *cls, const void *blob_id, void *buf, size_t size, void *ctx); static herr_t H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); +static herr_t H5VL__blob_optional(void *obj, const H5VL_class_t *cls, + void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments); +static herr_t H5VL__optional(void *obj, const H5VL_class_t *cls, int op_type, + hid_t dxpl_id, void **req, va_list arguments); /*********************/ /* Package Variables */ @@ -954,7 +960,7 @@ done: * * Purpose: Creates an attribute through the VOL * - * Return: Success: Pointer to the new attribute + * Return: Success: Pointer to the new attribute * Failure: NULL * *------------------------------------------------------------------------- @@ -986,13 +992,13 @@ done: * * Purpose: Creates an attribute through the VOL * - * Return: Success: Pointer to the new attribute + * Return: Success: Pointer to the new attribute * Failure: NULL * *------------------------------------------------------------------------- */ void * -H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, +H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) { @@ -1002,7 +1008,7 @@ H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_para FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1067,7 +1073,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, +H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -1107,7 +1113,7 @@ H5VL_attr_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1171,7 +1177,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, +H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1202,7 +1208,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, void *buf, +H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) { hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ @@ -1211,7 +1217,7 @@ H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, void *buf, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1273,7 +1279,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, +H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1304,7 +1310,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, const void *buf, +H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) { hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ @@ -1313,7 +1319,7 @@ H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, const void *buf FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1376,7 +1382,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, +H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1407,7 +1413,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, +H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ @@ -1418,7 +1424,7 @@ H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1488,7 +1494,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, +H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { @@ -1531,7 +1537,7 @@ H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1601,8 +1607,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_attr_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1613,7 +1619,7 @@ H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr optional' method") /* Call the corresponding VOL callback */ - if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (cls->attr_cls.optional)(obj, opt_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: @@ -1632,7 +1638,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_attr_optional_t opt_type, + hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ @@ -1642,14 +1649,14 @@ H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ HDva_start(arguments, req); arg_started = TRUE; - if((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: @@ -1676,13 +1683,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLattr_optional(void *obj, hid_t connector_id, H5VL_attr_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVsi**xx", obj, connector_id, opt_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -1691,7 +1700,7 @@ H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_l HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if((ret_value = H5VL__attr_optional(obj, cls, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__attr_optional(obj, cls, opt_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: @@ -1715,7 +1724,7 @@ H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC - + /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr close' method") @@ -1745,7 +1754,7 @@ H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - + /* Sanity check */ HDassert(vol_obj); @@ -1845,7 +1854,7 @@ H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_p FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1904,13 +1913,13 @@ done: * * Purpose: Opens a dataset through the VOL * - * Return: Success: Pointer to dataset + * Return: Success: Pointer to dataset * Failure: NULL * *------------------------------------------------------------------------- */ static void * -H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, +H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -1935,7 +1944,7 @@ done: * * Purpose: Opens a dataset through the VOL * - * Return: Success: Pointer to dataset + * Return: Success: Pointer to dataset * Failure: NULL * *------------------------------------------------------------------------- @@ -1950,7 +1959,7 @@ H5VL_dataset_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_par FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2013,7 +2022,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL__dataset_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf, void **req) @@ -2045,7 +2054,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf, void **req) @@ -2056,7 +2065,7 @@ H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2119,7 +2128,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req) @@ -2151,7 +2160,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req) @@ -2162,7 +2171,7 @@ H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2226,7 +2235,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, +H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2257,7 +2266,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, +H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ @@ -2268,7 +2277,7 @@ H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2338,7 +2347,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, +H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2369,7 +2378,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t specific_type, +H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ @@ -2380,7 +2389,7 @@ H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t spec FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2450,8 +2459,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_dataset_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2462,7 +2471,7 @@ H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset optional' method") /* Call the corresponding VOL callback */ - if((cls->dataset_cls.optional)(obj, dxpl_id, req, arguments) < 0) + if((cls->dataset_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") done: @@ -2481,8 +2490,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, - void **req, ...) +H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_dataset_optional_t opt_type, + hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ @@ -2491,16 +2500,15 @@ H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, FUNC_ENTER_NOAPI(FAIL) - /* Call the corresponding VOL callback */ /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ HDva_start(arguments, req); arg_started = TRUE; - if(H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + if(H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") done: @@ -2527,14 +2535,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, - va_list arguments) +H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_dataset_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVti**xx", obj, connector_id, opt_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -2543,7 +2552,7 @@ H5VLdataset_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if(H5VL__dataset_optional(obj, cls, dxpl_id, req, arguments) < 0) + if(H5VL__dataset_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") done: @@ -2610,7 +2619,7 @@ H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) HDassert(vol_obj->connector->cls); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2662,6 +2671,658 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__datatype_commit + * + * Purpose: Commits a datatype to the file through the VOL + * + * Return: Success: Pointer to the new datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, + const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, + hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.commit) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'datatype commit' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->datatype_cls.commit)(obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_commit + * + * Purpose: Commits a datatype to the file through the VOL + * + * Return: Success: Pointer to the new datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_datatype_commit(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, + hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__datatype_commit(vol_obj->data, loc_params, vol_obj->connector->cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_commit + * + * Purpose: Commits a datatype to the file + * + * Return: Success: Pointer to the new datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, + const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, + hid_t tapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE10("*x", "*x*xi*siiiii**x", obj, loc_params, connector_id, name, + type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__datatype_commit(obj, loc_params, cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to commit datatype") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__datatype_open + * + * Purpose: Opens a named datatype through the VOL + * + * Return: Success: Pointer to the datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, + const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->datatype_cls.open)(obj, loc_params, name, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_open + * + * Purpose: Opens a named datatype through the VOL + * + * Return: Success: Pointer to the datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_datatype_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__datatype_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_open + * + * Purpose: Opens a named datatype + * + * Return: Success: Pointer to the datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, + const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*x*xi*sii**x", obj, loc_params, connector_id, name, tapl_id, + dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__datatype_open(obj, loc_params, cls, name, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open datatype") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__datatype_get + * + * Purpose: Get specific information about the datatype through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype get' method") + + /* Call the corresponding VOL callback */ + if((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_get + * + * Purpose: Get specific information about the datatype through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + HDva_start(arguments, req); + arg_started = TRUE; + if(H5VL__datatype_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + HDva_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_get + * + * Purpose: Gets information about the datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVei**xx", obj, connector_id, get_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `datatype get' method") + + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__datatype_specific + * + * Purpose: Specific operation on datatypes through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype specific' method") + + /* Call the corresponding VOL callback */ + if((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_specific + * + * Purpose: Specific operation on datatypes through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + HDva_start(arguments, req); + arg_started = TRUE; + if(H5VL__datatype_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + HDva_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_specific + * + * Purpose: Performs a connector-specific operation on a datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVfi**xx", obj, connector_id, specific_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__datatype_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_datatype_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype optional' method") + + /* Call the corresponding VOL callback */ + if((cls->datatype_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_datatype_optional_t opt_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + HDva_start(arguments, req); + arg_started = TRUE; + if(H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + HDva_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_optional + * + * Purpose: Performs an optional connector-specific operation on a datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_datatype_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVui**xx", obj, connector_id, opt_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__datatype_close + * + * Purpose: Closes a datatype through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype close' method") + + /* Call the corresponding VOL callback */ + if((cls->datatype_cls.close)(obj, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_close + * + * Purpose: Closes a datatype through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_close + * + * Purpose: Closes a datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_close(obj, cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_close() */ + + +/*------------------------------------------------------------------------- * Function: H5VL__file_create * * Purpose: Creates a file through the VOL @@ -2776,7 +3437,7 @@ done: * * Purpose: Opens a file through the VOL. * - * Return: Success: Pointer to file. + * Return: Success: Pointer to file. * Failure: NULL * *------------------------------------------------------------------------- @@ -2810,7 +3471,7 @@ done: * Note: Does not have a 'static' version of the routine, since there's * no objects in the container before this operation completes. * - * Return: Success: Pointer to file. + * Return: Success: Pointer to file. * Failure: NULL * *------------------------------------------------------------------------- @@ -2889,7 +3550,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, +H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2920,7 +3581,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, +H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ @@ -2931,7 +3592,7 @@ H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2991,43 +3652,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL__file_specific_wrap_va_list - * - * Purpose: Perform File specific operations through the VOL. Just - * starts a va_list and passes it to the connector's - * callback. Needed when the VOL layer needs to replace one - * of the variable arguments. - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -static herr_t -H5VL__file_specific_wrap_va_list(void *obj, const H5VL_class_t *cls, - H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* Argument list passed from the API call */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Start access to the varargs, so they are available in all situations below */ - HDva_start(arguments, req); - - /* Call the corresponding VOL callback */ - if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") - -done: - /* End access to the va_list */ - HDva_end(arguments); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__file_specific_wrap_va_list() */ - - -/*------------------------------------------------------------------------- * Function: H5VL__file_specific * * Purpose: Perform File specific operations through the VOL @@ -3038,7 +3662,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, +H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -3049,38 +3673,9 @@ H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t spe if(NULL == cls->file_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file specific' method") - /* Special handling for file is equal */ - if(specific_type == H5VL_FILE_IS_EQUAL) { - va_list tmp_args; /* Argument list passed from the API call */ - H5VL_object_t *vol_obj2; /* Second VOL object */ - hbool_t *is_equal; /* Output variable */ - int cmp_value; /* Comparison result */ - - /* Get parameters */ - HDva_copy(tmp_args, arguments); - vol_obj2 = HDva_arg(tmp_args, H5VL_object_t *); - is_equal = HDva_arg(tmp_args, hbool_t *); - HDva_end(tmp_args); - - HDassert(vol_obj2); - - /* Compare connector classes */ - if(H5VL_cmp_connector_cls(&cmp_value, cls, vol_obj2->connector->cls) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") - - /* If the classes are different the files are different */ - if(cmp_value) - *is_equal = FALSE; - else - /* Make callback (need to extract data from vol_obj2 and redo the - * va_list) */ - if(H5VL__file_specific_wrap_va_list(obj, cls, specific_type, dxpl_id, req, vol_obj2->data, is_equal) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") - } /* end if */ - else - /* Call the corresponding VOL callback */ - if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + /* Call the corresponding VOL callback */ + if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -3090,7 +3685,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_file_specific * - * Purpose: Perform File specific operations through the VOL + * Purpose: Perform file specific operations through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -3098,7 +3693,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, +H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...) { const H5VL_class_t *cls; /* VOL connector's class struct */ @@ -3113,7 +3708,8 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t HDva_start(arguments, req); arg_started = TRUE; - /* Special treatment of file access check */ + /* Special treatment of file access check & delete operations */ + /* (Retrieve the VOL connector from the FAPL, since the file isn't open) */ if(specific_type == H5VL_FILE_IS_ACCESSIBLE || specific_type == H5VL_FILE_DELETE) { H5P_genplist_t *plist; /* Property list pointer */ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ @@ -3140,7 +3736,7 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t /* Sanity check */ HDassert(vol_obj); - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -3212,8 +3808,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_file_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -3224,7 +3820,7 @@ H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file optional' method") /* Call the corresponding VOL callback */ - if((cls->file_cls.optional)(obj, dxpl_id, req, arguments) < 0) + if((cls->file_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") done: @@ -3243,7 +3839,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_file_optional_t opt_type, + hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ @@ -3253,14 +3850,14 @@ H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ HDva_start(arguments, req); arg_started = TRUE; - if(H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + if(H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") done: @@ -3287,14 +3884,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, - va_list arguments) +H5VLfile_optional(void *obj, hid_t connector_id, H5VL_file_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVvi**xx", obj, connector_id, opt_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -3303,7 +3901,7 @@ H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if(H5VL__file_optional(obj, cls, dxpl_id, req, arguments) < 0) + if(H5VL__file_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback") done: @@ -3364,7 +3962,7 @@ H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -3468,7 +4066,7 @@ H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_par FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -3573,7 +4171,7 @@ H5VL_group_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_param FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -3637,7 +4235,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, +H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -3668,7 +4266,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, +H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ @@ -3679,7 +4277,7 @@ H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -3749,7 +4347,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, +H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -3780,7 +4378,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, +H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ @@ -3791,7 +4389,7 @@ H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -3861,8 +4459,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_group_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -3873,7 +4471,7 @@ H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group optional' method") /* Call the corresponding VOL callback */ - if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (cls->group_cls.optional)(obj, opt_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: @@ -3892,7 +4490,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_group_optional_t opt_type, + hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ @@ -3902,14 +4501,14 @@ H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ... FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ HDva_start(arguments, req); arg_started = TRUE; - if((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: @@ -3936,14 +4535,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, - va_list arguments) +H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_group_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVwi**xx", obj, connector_id, opt_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -3952,7 +4552,7 @@ H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if((ret_value = H5VL__group_optional(obj, cls, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__group_optional(obj, cls, opt_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: @@ -4013,7 +4613,7 @@ H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -4077,7 +4677,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, +H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments) { @@ -4140,7 +4740,7 @@ H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_o tmp_vol_obj.connector = vol_obj->connector; /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(tmp_vol_obj.data, tmp_vol_obj.connector) < 0) + if(H5VL_set_vol_wrapper(&tmp_vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -4208,7 +4808,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) @@ -4240,7 +4840,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) @@ -4253,7 +4853,7 @@ H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_pa /* Set wrapper info in API context */ vol_obj = (src_vol_obj->data ? src_vol_obj : dst_vol_obj); - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -4317,7 +4917,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL__link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) @@ -4349,7 +4949,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +herr_t H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) @@ -4362,7 +4962,7 @@ H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_pa /* Set wrapper info in API context */ vol_obj = (src_vol_obj->data ? src_vol_obj : dst_vol_obj); - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -4469,7 +5069,7 @@ H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -4539,7 +5139,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, +H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4581,7 +5181,7 @@ H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -4651,8 +5251,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__link_optional(void *obj, const H5VL_class_t *cls, H5VL_link_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4663,7 +5263,7 @@ H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link optional' method") /* Call the corresponding VOL callback */ - if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0) + if((cls->link_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: @@ -4682,7 +5282,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +H5VL_link_optional(const H5VL_object_t *vol_obj, H5VL_link_optional_t opt_type, + hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ @@ -4692,14 +5293,14 @@ H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ HDva_start(arguments, req); arg_started = TRUE; - if(H5VL__link_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + if(H5VL__link_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: @@ -4726,13 +5327,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLlink_optional(void *obj, hid_t connector_id, H5VL_link_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVxi**xx", obj, connector_id, opt_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -4741,7 +5344,7 @@ H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_l HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if(H5VL__link_optional(obj, cls, dxpl_id, req, arguments) < 0) + if(H5VL__link_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: @@ -4800,7 +5403,7 @@ H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params, FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -4863,7 +5466,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, const H5VL_class_t *cls, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, @@ -4896,7 +5499,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +herr_t H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, const H5VL_object_t *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, @@ -4912,7 +5515,7 @@ H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_params_t *src_loc_ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "objects are accessed through different VOL connectors and can't be copied") /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(src_obj->data, src_obj->connector) < 0) + if(H5VL_set_vol_wrapper(src_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -5021,7 +5624,7 @@ H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_param FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -5091,7 +5694,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, +H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { @@ -5134,7 +5737,7 @@ H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_ FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -5208,8 +5811,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__object_optional(void *obj, const H5VL_class_t *cls, H5VL_object_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -5220,7 +5823,7 @@ H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object optional' method") /* Call the corresponding VOL callback */ - if((cls->object_cls.optional)(obj, dxpl_id, req, arguments) < 0) + if((cls->object_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: @@ -5239,7 +5842,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +H5VL_object_optional(const H5VL_object_t *vol_obj, H5VL_object_optional_t opt_type, + hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ @@ -5249,14 +5853,14 @@ H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, .. FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ HDva_start(arguments, req); arg_started = TRUE; - if(H5VL__object_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + if(H5VL__object_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: @@ -5283,13 +5887,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLobject_optional(void *obj, hid_t connector_id, H5VL_object_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVyi**xx", obj, connector_id, opt_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -5298,7 +5904,7 @@ H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if(H5VL__object_optional(obj, cls, dxpl_id, req, arguments) < 0) + if(H5VL__object_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: @@ -5307,220 +5913,10 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL__datatype_commit - * - * Purpose: Commits a datatype to the file through the VOL - * - * Return: Success: Pointer to the new datatype - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -static void * -H5VL__datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, - const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, - hid_t dxpl_id, void **req) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.commit) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'datatype commit' method") - - /* Call the corresponding VOL callback */ - if(NULL == (ret_value = (cls->datatype_cls.commit)(obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__datatype_commit() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_commit - * - * Purpose: Commits a datatype to the file through the VOL - * - * Return: Success: Pointer to the new datatype - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_datatype_commit(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, - const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, - hid_t dxpl_id, void **req) -{ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - - /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__datatype_commit(vol_obj->data, loc_params, vol_obj->connector->cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed") - -done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_commit() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_commit - * - * Purpose: Commits a datatype to the file - * - * Return: Success: Pointer to the new datatype - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, - const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, - hid_t tapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls; /* VOL connector's class struct */ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_API_NOINIT - H5TRACE10("*x", "*x*xi*siiiii**x", obj, loc_params, connector_id, name, - type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); - - /* Check args and get class pointer */ - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") - - /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__datatype_commit(obj, loc_params, cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to commit datatype") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdatatype_commit() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL__datatype_open - * - * Purpose: Opens a named datatype through the VOL - * - * Return: Success: Pointer to the datatype - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -static void * -H5VL__datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, - const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback") - - /* Call the corresponding VOL callback */ - if(NULL == (ret_value = (cls->datatype_cls.open)(obj, loc_params, name, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__datatype_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_open - * - * Purpose: Opens a named datatype through the VOL - * - * Return: Success: Pointer to the datatype - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_datatype_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, - const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) -{ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - - /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__datatype_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed") - -done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_open - * - * Purpose: Opens a named datatype - * - * Return: Success: Pointer to the datatype - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, - const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls; /* VOL connector's class struct */ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*x*xi*sii**x", obj, loc_params, connector_id, name, tapl_id, - dxpl_id, req); - - /* Check args and get class pointer */ - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") - - /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__datatype_open(obj, loc_params, cls, name, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open datatype") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdatatype_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL__datatype_get + * Function: H5VL__introspect_get_conn_cls * - * Purpose: Get specific information about the datatype through the VOL + * Purpose: Calls the connector-specific callback to query the connector + * class. * * Return: Success: Non-negative * Failure: Negative @@ -5528,146 +5924,37 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) +H5VL__introspect_get_conn_cls(void *obj, const H5VL_class_t *cls, + H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype get' method") - - /* Call the corresponding VOL callback */ - if((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__datatype_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_get - * - * Purpose: Get specific information about the datatype through the VOL - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - - /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if(H5VL__datatype_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed") - -done: - /* End access to the va_list, if we started it */ - if(arg_started) - HDva_end(arguments); - - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_get - * - * Purpose: Gets information about the datatype - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVei**xx", obj, connector_id, get_type, dxpl_id, req, - arguments); - - /* Check args and get class pointer */ - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") - - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `datatype get' method") - - /* Call the corresponding internal VOL routine */ - if(H5VL__datatype_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdatatype_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL__datatype_specific - * - * Purpose: Specific operation on datatypes through the VOL - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -static herr_t -H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC + /* Sanity check */ + HDassert(obj); + HDassert(cls); + HDassert(lvl >= H5VL_GET_CONN_LVL_CURR && lvl <= H5VL_GET_CONN_LVL_TERM); + HDassert(conn_cls); /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype specific' method") + if(NULL == cls->introspect_cls.get_conn_cls) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'get_conn_cls' method") /* Call the corresponding VOL callback */ - if((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + if((cls->introspect_cls.get_conn_cls)(obj, lvl, conn_cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__datatype_specific() */ +} /* end H5VL__introspect_get_conn_cls() */ /*------------------------------------------------------------------------- - * Function: H5VL_datatype_specific + * Function: H5VL_introspect_get_conn_cls * - * Purpose: Specific operation on datatypes through the VOL + * Purpose: Calls the connector-specific callback to query the connector + * class. * * Return: Success: Non-negative * Failure: Negative @@ -5675,44 +5962,37 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type, - hid_t dxpl_id, void **req, ...) +H5VL_introspect_get_conn_cls(const H5VL_object_t *vol_obj, H5VL_get_conn_lvl_t lvl, + const H5VL_class_t **conn_cls) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if(H5VL__datatype_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + if(H5VL__introspect_get_conn_cls(vol_obj->data, vol_obj->connector->cls, lvl, conn_cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class") done: - /* End access to the va_list, if we started it */ - if(arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_specific() */ +} /* end H5VL_introspect_get_conn_cls() */ /*------------------------------------------------------------------------- - * Function: H5VLdatatype_specific + * Function: H5VLintrospect_get_conn_cls * - * Purpose: Performs a connector-specific operation on a datatype + * Purpose: Calls the connector-specific callback to query the connector + * class. * * Return: Success: Non-negative * Failure: Negative @@ -5720,146 +6000,39 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments) +H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id, H5VL_get_conn_lvl_t lvl, + const H5VL_class_t **conn_cls) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVfi**xx", obj, connector_id, specific_type, dxpl_id, req, - arguments); + H5TRACE4("e", "*xiVL**x", obj, connector_id, lvl, conn_cls); - /* Check args and get class pointer */ + /* Check args */ if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") - - /* Call the corresponding internal VOL routine */ - if(H5VL__datatype_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdatatype_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL__datatype_optional - * - * Purpose: Optional operation specific to connectors. - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -static herr_t -H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype optional' method") - - /* Call the corresponding VOL callback */ - if((cls->datatype_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__datatype_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_optional - * - * Purpose: Optional operation specific to connectors. - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_datatype_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, - void **req, ...) -{ - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL obj pointer") + if(NULL == conn_cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL conn_cls pointer") - FUNC_ENTER_NOAPI(FAIL) - - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - - /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if(H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") - -done: - /* End access to the va_list, if we started it */ - if(arg_started) - HDva_end(arguments); - - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_optional - * - * Purpose: Performs an optional connector-specific operation on a datatype - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdatatype_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, - va_list arguments) -{ - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); - - /* Check args and get class pointer */ - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + /* Get class pointer */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if(H5VL__datatype_optional(obj, cls, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + if(H5VL__introspect_get_conn_cls(obj, cls, lvl, conn_cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class") done: FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdatatype_optional() */ +} /* end H5VLintrospect_get_conn_cls() */ /*------------------------------------------------------------------------- - * Function: H5VL__datatype_close + * Function: H5VL__introspect_opt_query * - * Purpose: Closes a datatype through the VOL + * Purpose: Calls the connector-specific callback to query if an optional + * operation is supported. * * Return: Success: Non-negative * Failure: Negative @@ -5867,30 +6040,31 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req) +H5VL__introspect_opt_query(void *obj, const H5VL_class_t *cls, H5VL_subclass_t subcls, + int opt_type, hbool_t *supported) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype close' method") + if(NULL == cls->introspect_cls.opt_query) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'opt_query' method") /* Call the corresponding VOL callback */ - if((cls->datatype_cls.close)(obj, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed") + if((cls->introspect_cls.opt_query)(obj, subcls, opt_type, supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__datatype_close() */ +} /* end H5VL__introspect_opt_query() */ /*------------------------------------------------------------------------- - * Function: H5VL_datatype_close + * Function: H5VL_introspect_opt_query * - * Purpose: Closes a datatype through the VOL + * Purpose: Calls the connector-specific callback to query if an optional + * operation is supported. * * Return: Success: Non-negative * Failure: Negative @@ -5898,7 +6072,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +H5VL_introspect_opt_query(const H5VL_object_t *vol_obj, H5VL_subclass_t subcls, + int opt_type, hbool_t *supported) { hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -5906,13 +6081,13 @@ H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__datatype_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed") + if(H5VL__introspect_opt_query(vol_obj->data, vol_obj->connector->cls, subcls, opt_type, supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") done: /* Reset object wrapping info in API context */ @@ -5920,13 +6095,14 @@ done: HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_close() */ +} /* end H5VL_introspect_opt_query() */ /*------------------------------------------------------------------------- - * Function: H5VLdatatype_close + * Function: H5VLintrospect_opt_query * - * Purpose: Closes a datatype + * Purpose: Calls the connector-specific callback to query if an optional + * operation is supported. * * Return: Success: Non-negative * Failure: Negative @@ -5934,27 +6110,26 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req) +H5VLintrospect_opt_query(void *obj, hid_t connector_id, H5VL_subclass_t subcls, + int opt_type, hbool_t *supported) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); + H5TRACE5("e", "*xiVSIs*b", obj, connector_id, subcls, opt_type, supported); - /* Check args and get class pointer */ - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + /* Get class pointer */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if(H5VL__datatype_close(obj, cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype") + if(H5VL__introspect_opt_query(obj, cls, subcls, opt_type, supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") done: FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdatatype_close() */ +} /* end H5VLintrospect_opt_query() */ /*------------------------------------------------------------------------- @@ -6022,7 +6197,7 @@ H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, HDassert(vol_obj); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6138,7 +6313,7 @@ H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb, HDassert(vol_obj); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6251,7 +6426,7 @@ H5VL_request_cancel(const H5VL_object_t *vol_obj) HDassert(vol_obj); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6362,7 +6537,7 @@ H5VL_request_specific(const H5VL_object_t *vol_obj, HDassert(vol_obj); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6429,7 +6604,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__request_optional(void *req, const H5VL_class_t *cls, va_list arguments) +H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_request_optional_t opt_type, + va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -6444,7 +6620,7 @@ H5VL__request_optional(void *req, const H5VL_class_t *cls, va_list arguments) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async optional' method") /* Call the corresponding VOL callback */ - if((ret_value = (cls->request_cls.optional)(req, arguments)) < 0) + if((ret_value = (cls->request_cls.optional)(req, opt_type, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") done: @@ -6463,7 +6639,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_request_optional(const H5VL_object_t *vol_obj, ...) +H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_request_optional_t opt_type, + ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ @@ -6476,14 +6653,14 @@ H5VL_request_optional(const H5VL_object_t *vol_obj, ...) HDassert(vol_obj); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, vol_obj); + HDva_start(arguments, opt_type); arg_started = TRUE; - if((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, arguments)) < 0) + if((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, opt_type, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") done: @@ -6510,20 +6687,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_optional(void *req, hid_t connector_id, va_list arguments) +H5VLrequest_optional(void *req, hid_t connector_id, H5VL_request_optional_t opt_type, + va_list arguments) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE3("e", "*xix", req, connector_id, arguments); + H5TRACE4("e", "*xiVzx", req, connector_id, opt_type, arguments); /* Get class pointer */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if((ret_value = H5VL__request_optional(req, cls, arguments)) < 0) + if((ret_value = H5VL__request_optional(req, cls, opt_type, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") done: @@ -6587,7 +6765,7 @@ H5VL_request_free(const H5VL_object_t *vol_obj) HDassert(vol_obj); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6699,7 +6877,7 @@ H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_t size, HDassert(blob_id); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6809,7 +6987,7 @@ H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, HDassert(buf); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6923,7 +7101,7 @@ H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, HDassert(blob_id); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6981,6 +7159,127 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__blob_optional + * + * Purpose: Optional operation on blobs through the VOL + * + * Return: SUCCEED / FAIL + * + * Programmer: Quincey Koziol + * Thursday, November 14, 2019 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id, + H5VL_blob_optional_t opt_type, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(obj); + HDassert(cls); + HDassert(blob_id); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->blob_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob optional' method") + + /* Call the corresponding VOL callback */ + if((cls->blob_cls.optional)(obj, blob_id, opt_type, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__blob_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_blob_optional + * + * Purpose: Optional operation on blobs through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, + H5VL_blob_optional_t opt_type, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + HDassert(blob_id); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + HDva_start(arguments, opt_type); + arg_started = TRUE; + if((ret_value = H5VL__blob_optional(vol_obj->data, vol_obj->connector->cls, blob_id, opt_type, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + HDva_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_blob_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLblob_optional + * + * Purpose: Optional operation on blobs through the VOL + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, + H5VL_blob_optional_t opt_type, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xi*xVAx", obj, connector_id, blob_id, opt_type, arguments); + + /* Get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding VOL callback */ + if(H5VL__blob_optional(obj, cls, blob_id, opt_type, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob optional operation failed") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLblob_optional() */ + + +/*------------------------------------------------------------------------- * Function: H5VL__optional * * Purpose: Optional operation specific to connectors. @@ -6991,7 +7290,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, +H5VL__optional(void *obj, const H5VL_class_t *cls, int op_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -7003,7 +7302,7 @@ H5VL__optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'optional' method") /* Call the corresponding VOL callback */ - if((ret_value = (cls->optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (cls->optional)(obj, op_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback") done: @@ -7022,7 +7321,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, +H5VL_optional(const H5VL_object_t *vol_obj, int op_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ @@ -7033,14 +7332,14 @@ H5VL_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ HDva_start(arguments, req); arg_started = TRUE; - if((ret_value = H5VL__optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__optional(vol_obj->data, vol_obj->connector->cls, op_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute optional callback") done: @@ -7067,14 +7366,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLoptional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, - va_list arguments) +H5VLoptional(void *obj, hid_t connector_id, int op_type, hid_t dxpl_id, + void **req, va_list arguments) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); + H5TRACE6("e", "*xiIsi**xx", obj, connector_id, op_type, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -7083,7 +7382,7 @@ H5VLoptional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if((ret_value = H5VL__optional(obj, cls, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__optional(obj, cls, op_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback") done: diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index 373eb44..4ce6bb1 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -50,6 +50,23 @@ /* Public Typedefs */ /*******************/ +/* Enum type for each VOL subclass */ +/* (Used for various queries, etc) */ +typedef enum H5VL_subclass_t { + H5VL_SUBCLS_NONE, /* Operations outside of a subclass */ + H5VL_SUBCLS_INFO, /* 'Info' subclass */ + H5VL_SUBCLS_WRAP, /* 'Wrap' subclass */ + H5VL_SUBCLS_ATTR, /* 'Attribute' subclass */ + H5VL_SUBCLS_DATASET, /* 'Dataset' subclass */ + H5VL_SUBCLS_DATATYPE, /* 'Named datatype' subclass */ + H5VL_SUBCLS_FILE, /* 'File' subclass */ + H5VL_SUBCLS_GROUP, /* 'Group' subclass */ + H5VL_SUBCLS_LINK, /* 'Link' subclass */ + H5VL_SUBCLS_OBJECT, /* 'Object' subclass */ + H5VL_SUBCLS_REQUEST, /* 'Request' subclass */ + H5VL_SUBCLS_BLOB /* 'Blob' subclass */ +} H5VL_subclass_t; + /* type for tokens. Token are unique and permanent identifiers that are * used to reference HDF5 objects. */ typedef struct { @@ -74,13 +91,16 @@ typedef enum H5VL_attr_specific_t { H5VL_ATTR_RENAME /* H5Arename(_by_name) */ } H5VL_attr_specific_t; +/* Typedef for VOL connector attribute optional VOL operations */ +typedef int H5VL_attr_optional_t; + /* types for dataset GET callback */ typedef enum H5VL_dataset_get_t { H5VL_DATASET_GET_DAPL, /* access property list */ H5VL_DATASET_GET_DCPL, /* creation property list */ H5VL_DATASET_GET_OFFSET, /* offset */ H5VL_DATASET_GET_SPACE, /* dataspace */ - H5VL_DATASET_GET_SPACE_STATUS, /* space status */ + H5VL_DATASET_GET_SPACE_STATUS, /* space status */ H5VL_DATASET_GET_STORAGE_SIZE, /* storage size */ H5VL_DATASET_GET_TYPE /* datatype */ } H5VL_dataset_get_t; @@ -92,6 +112,9 @@ typedef enum H5VL_dataset_specific_t { H5VL_DATASET_REFRESH /* H5Drefresh */ } H5VL_dataset_specific_t; +/* Typedef for VOL connector dataset optional VOL operations */ +typedef int H5VL_dataset_optional_t; + /* types for datatype GET callback */ typedef enum H5VL_datatype_get_t { H5VL_DATATYPE_GET_BINARY, /* get serialized form of transient type */ @@ -104,6 +127,10 @@ typedef enum H5VL_datatype_specific_t { H5VL_DATATYPE_REFRESH } H5VL_datatype_specific_t; +/* Typedef and values for native VOL connector named datatype optional VOL operations */ +typedef int H5VL_datatype_optional_t; +/* (No optional named datatype VOL operations currently) */ + /* types for file GET callback */ typedef enum H5VL_file_get_t { H5VL_FILE_GET_CONT_INFO, /* file get container info */ @@ -118,7 +145,6 @@ typedef enum H5VL_file_get_t { /* types for file SPECIFIC callback */ typedef enum H5VL_file_specific_t { - H5VL_FILE_POST_OPEN, /* Adjust file after open, with wrapping context */ H5VL_FILE_FLUSH, /* Flush file */ H5VL_FILE_REOPEN, /* Reopen the file */ H5VL_FILE_MOUNT, /* Mount a file */ @@ -128,6 +154,9 @@ typedef enum H5VL_file_specific_t { H5VL_FILE_IS_EQUAL /* Check if two files are the same */ } H5VL_file_specific_t; +/* Typedef for VOL connector file optional VOL operations */ +typedef int H5VL_file_optional_t; + /* types for group GET callback */ typedef enum H5VL_group_get_t { H5VL_GROUP_GET_GCPL, /* group creation property list */ @@ -140,6 +169,9 @@ typedef enum H5VL_group_specific_t { H5VL_GROUP_REFRESH } H5VL_group_specific_t; +/* Typedef for VOL connector group optional VOL operations */ +typedef int H5VL_group_optional_t; + /* link create types for VOL */ typedef enum H5VL_link_create_type_t { H5VL_LINK_CREATE_HARD, @@ -161,6 +193,10 @@ typedef enum H5VL_link_specific_t { H5VL_LINK_ITER /* H5Literate/visit(_by_name) */ } H5VL_link_specific_t; +/* Typedef and values for native VOL connector link optional VOL operations */ +typedef int H5VL_link_optional_t; +/* (No optional link VOL operations currently) */ + /* types for object GET callback */ typedef enum H5VL_object_get_t { H5VL_OBJECT_GET_FILE, /* object file */ @@ -178,6 +214,9 @@ typedef enum H5VL_object_specific_t { H5VL_OBJECT_REFRESH /* H5{D|G|O|T}refresh */ } H5VL_object_specific_t; +/* Typedef for VOL connector object optional VOL operations */ +typedef int H5VL_object_optional_t; + /* types for async request SPECIFIC callback */ typedef enum H5VL_request_specific_t { H5VL_REQUEST_WAITANY, /* Wait until any request completes */ @@ -185,6 +224,10 @@ typedef enum H5VL_request_specific_t { H5VL_REQUEST_WAITALL /* Wait until all requests complete */ } H5VL_request_specific_t; +/* Typedef and values for native VOL connector request optional VOL operations */ +typedef int H5VL_request_optional_t; +/* (No optional request VOL operations currently) */ + /* types for 'blob' SPECIFIC callback */ typedef enum H5VL_blob_specific_t { H5VL_BLOB_DELETE, /* Delete a blob (by ID) */ @@ -193,6 +236,10 @@ typedef enum H5VL_blob_specific_t { H5VL_BLOB_SETNULL /* Set a blob ID to the connector's "null" blob ID value */ } H5VL_blob_specific_t; +/* Typedef and values for native VOL connector blob optional VOL operations */ +typedef int H5VL_blob_optional_t; +/* (No optional blob VOL operations currently) */ + /* Types for different ways that objects are located in an HDF5 container */ typedef enum H5VL_loc_type_t { H5VL_OBJECT_BY_SELF, @@ -278,7 +325,8 @@ typedef struct H5VL_attr_class_t { herr_t (*get)(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, + void **req, va_list arguments); herr_t (*close) (void *attr, hid_t dxpl_id, void **req); } H5VL_attr_class_t; @@ -296,7 +344,8 @@ typedef struct H5VL_dataset_class_t { herr_t (*get)(void *obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); herr_t (*specific)(void *obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, + void **req, va_list arguments); herr_t (*close) (void *dset, hid_t dxpl_id, void **req); } H5VL_dataset_class_t; @@ -309,7 +358,7 @@ typedef struct H5VL_datatype_class_t { herr_t (*get) (void *obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); herr_t (*specific)(void *obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); herr_t (*close) (void *dt, hid_t dxpl_id, void **req); } H5VL_datatype_class_t; @@ -321,7 +370,8 @@ typedef struct H5VL_file_class_t { herr_t (*get)(void *obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); herr_t (*specific)(void *obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, H5VL_file_optional_t opt_type, hid_t dxpl_id, + void **req, va_list arguments); herr_t (*close) (void *file, hid_t dxpl_id, void **req); } H5VL_file_class_t; @@ -334,7 +384,7 @@ typedef struct H5VL_group_class_t { herr_t (*get)(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); herr_t (*specific)(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); herr_t (*close) (void *grp, hid_t dxpl_id, void **req); } H5VL_group_class_t; @@ -352,7 +402,8 @@ typedef struct H5VL_link_class_t { hid_t dxpl_id, void **req, va_list arguments); herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, + void **req, va_list arguments); } H5VL_link_class_t; /* H5O routines */ @@ -366,19 +417,37 @@ typedef struct H5VL_object_class_t { hid_t dxpl_id, void **req, va_list arguments); herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, H5VL_object_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments); } H5VL_object_class_t; /* Asynchronous request 'notify' callback */ typedef herr_t (*H5VL_request_notify_t)(void *ctx, H5ES_status_t status); +/* "Levels" for 'get connector class' introspection callback */ +typedef enum H5VL_get_conn_lvl_t { + H5VL_GET_CONN_LVL_CURR, /* Get "current" connector (for this object) */ + H5VL_GET_CONN_LVL_TERM /* Get "terminal" connector (for this object) */ + /* (Recursively called, for pass-through connectors) */ + /* (Connectors that "split" must choose which connector to return) */ +} H5VL_get_conn_lvl_t; + +/* Forward declaration of H5VL_class_t, defined later in this file */ +struct H5VL_class_t; + +/* Container/connector introspection routines */ +typedef struct H5VL_introspect_class_t { + herr_t (*get_conn_cls)(void *obj, H5VL_get_conn_lvl_t lvl, const struct H5VL_class_t **conn_cls); + herr_t (*opt_query)(void *obj, H5VL_subclass_t cls, int opt_type, hbool_t *supported); +} H5VL_introspect_class_t; + /* Async request operation routines */ typedef struct H5VL_request_class_t { herr_t (*wait)(void *req, uint64_t timeout, H5ES_status_t *status); herr_t (*notify)(void *req, H5VL_request_notify_t cb, void *ctx); herr_t (*cancel)(void *req); herr_t (*specific)(void *req, H5VL_request_specific_t specific_type, va_list arguments); - herr_t (*optional)(void *req, va_list arguments); + herr_t (*optional)(void *req, H5VL_request_optional_t opt_type, va_list arguments); herr_t (*free)(void *req); } H5VL_request_class_t; @@ -387,17 +456,9 @@ typedef struct H5VL_blob_class_t { herr_t (*put)(void *obj, const void *buf, size_t size, void *blob_id, void *ctx); herr_t (*get)(void *obj, const void *blob_id, void *buf, size_t size, void *ctx); herr_t (*specific)(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); - herr_t (*optional)(void *obj, void *blob_id, va_list arguments); + herr_t (*optional)(void *obj, void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments); } H5VL_blob_class_t; -/* - * VOL connector identifiers. Values 0 through 255 are for connectors defined - * by the HDF5 library. Values 256 through 511 are available for testing new - * filters. Subsequent values should be obtained from the HDF5 development - * team at help@hdfgroup.org. - */ -typedef int H5VL_class_value_t; - /* Class information for each VOL connector */ typedef struct H5VL_class_t { /* Overall connector fields & callbacks */ @@ -422,11 +483,12 @@ typedef struct H5VL_class_t { H5VL_object_class_t object_cls; /* Object (H5O*) class callbacks */ /* Infrastructure / Services */ + H5VL_introspect_class_t introspect_cls; /* Container/connector introspection class callbacks */ H5VL_request_class_t request_cls; /* Asynchronous request class callbacks */ - H5VL_blob_class_t blob_cls; /* 'blob' callbacks */ + H5VL_blob_class_t blob_cls; /* 'Blob' class callbacks */ /* Catch-all */ - herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */ + herr_t (*optional)(void *obj, int op_type, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */ } H5VL_class_t; @@ -444,6 +506,7 @@ extern "C" { #endif /* Helper routines for VOL connector authors */ +H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id); H5_DLL void *H5VLobject(hid_t obj_id); H5_DLL hid_t H5VLget_file_type(void *file_obj, hid_t connector_id, hid_t dtype_id); diff --git a/src/H5VLconnector_passthru.h b/src/H5VLconnector_passthru.h index a4c8742..5a937bf 100644 --- a/src/H5VLconnector_passthru.h +++ b/src/H5VLconnector_passthru.h @@ -92,7 +92,7 @@ H5_DLL herr_t H5VLattr_read(void *attr, hid_t connector_id, hid_t dtype_id, void H5_DLL herr_t H5VLattr_write(void *attr, hid_t connector_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_optional(void *obj, hid_t connector_id, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLattr_close(void *attr, hid_t connector_id, hid_t dxpl_id, void **req); /* Public wrappers for dataset callbacks */ @@ -102,15 +102,23 @@ H5_DLL herr_t H5VLdataset_read(void *dset, hid_t connector_id, hid_t mem_type_id H5_DLL herr_t H5VLdataset_write(void *dset, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); H5_DLL herr_t H5VLdataset_get(void *dset, hid_t connector_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLdataset_close(void *dset, hid_t connector_id, hid_t dxpl_id, void **req); +/* Public wrappers for named datatype callbacks */ +H5_DLL void *H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t connector_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t connector_id, hid_t dxpl_id, void **req); + /* Public wrappers for file callbacks */ H5_DLL void *H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLfile_get(void *file, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_optional(void *obj, hid_t connector_id, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLfile_close(void *file, hid_t connector_id, hid_t dxpl_id, void **req); /* Public wrappers for group callbacks */ @@ -118,7 +126,7 @@ H5_DLL void *H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hi H5_DLL void *H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLgroup_close(void *grp, hid_t connector_id, hid_t dxpl_id, void **req); /* Public wrappers for link callbacks */ @@ -131,7 +139,7 @@ H5_DLL herr_t H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_optional(void *obj, hid_t connector_id, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); /* Public wrappers for object callbacks */ H5_DLL void *H5VLobject_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req); @@ -140,31 +148,30 @@ H5_DLL herr_t H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *loc_params hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_optional(void *obj, hid_t connector_id, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); -/* Public wrappers for named datatype callbacks */ -H5_DLL void *H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t connector_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t connector_id, hid_t dxpl_id, void **req); +/* Public wrappers for connector/container introspection callbacks */ +H5_DLL herr_t H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id, + H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); +H5_DLL herr_t H5VLintrospect_opt_query(void *obj, hid_t connector_id, + H5VL_subclass_t subcls, int opt_type, hbool_t *supported); /* Public wrappers for asynchronous request callbacks */ H5_DLL herr_t H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_status_t *status); H5_DLL herr_t H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb, void *ctx); H5_DLL herr_t H5VLrequest_cancel(void *req, hid_t connector_id); H5_DLL herr_t H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type, va_list arguments); -H5_DLL herr_t H5VLrequest_optional(void *req, hid_t connector_id, va_list arguments); +H5_DLL herr_t H5VLrequest_optional(void *req, hid_t connector_id, H5VL_request_optional_t opt_type, va_list arguments); H5_DLL herr_t H5VLrequest_free(void *req, hid_t connector_id); /* Public wrappers for blob callbacks */ H5_DLL herr_t H5VLblob_put(void *obj, hid_t connector_id, const void *buf, size_t size, void *blob_id, void *ctx); H5_DLL herr_t H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf, size_t size, void *ctx); H5_DLL herr_t H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); +H5_DLL herr_t H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments); /* Public wrappers for generic 'optional' callback */ -H5_DLL herr_t H5VLoptional(void *obj, hid_t connector_id, hid_t dxpl_id, +H5_DLL herr_t H5VLoptional(void *obj, hid_t connector_id, int op_type, hid_t dxpl_id, void **req, va_list arguments); #ifdef __cplusplus diff --git a/src/H5VLint.c b/src/H5VLint.c index 284b266..242b1c7 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -30,10 +30,15 @@ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ #include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ #include "H5FLprivate.h" /* Free lists */ +#include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ +#include "H5Mprivate.h" /* Maps */ #include "H5MMprivate.h" /* Memory management */ #include "H5PLprivate.h" /* Plugins */ #include "H5Tprivate.h" /* Datatypes */ @@ -189,6 +194,20 @@ H5VL_init_phase2(void) FUNC_ENTER_NOAPI(FAIL) + /* Initialize all packages for VOL-managed objects */ + if(H5T_init() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize datatype interface") + if(H5D_init() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize dataset interface") + if(H5F_init() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize file interface") + if(H5G_init() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize group interface") + if(H5A_init() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize attribute interface") + if(H5M_init() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize map interface") + /* Set up the default VOL connector in the default FAPL */ if(H5VL__set_def_conn() < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to set default VOL connector") @@ -424,7 +443,7 @@ H5VL__set_def_conn(void) else { /* Register the VOL connector */ /* (NOTE: No provisions for vipl_id currently) */ - if((connector_id = H5VL__register_connector_by_name(tok, TRUE, H5P_DEFAULT)) < 0) + if((connector_id = H5VL__register_connector_by_name(tok, TRUE, H5P_VOL_INITIALIZE_DEFAULT)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register connector") } /* end else */ } /* end else */ @@ -705,7 +724,7 @@ H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ /* (Does not wrap object, since it's from a VOL callback) */ if(NULL == (vol_obj = H5VL__new_vol_obj(type, object, vol_connector, FALSE))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object") - + /* Register VOL object as _object_ type, for future object API calls */ if((ret_value = H5I_register(type, vol_obj, app_ref)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle") @@ -720,7 +739,7 @@ done: * * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it. * This routine will check to ensure the supplied ID is not already - * in use, and ensure that it is a valid ID for the given type, + * in use, and ensure that it is a valid ID for the given type, * but will NOT check to ensure the OBJECT is not already * registered (thus, it is possible to register one object under * multiple IDs). @@ -972,6 +991,114 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL_object_is_native + * + * Purpose: Query if an object is (if it's a file object) / is in (if its + * an object) a native connector's file. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * December 14, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_is_native(const H5VL_object_t *obj, hbool_t *is_native) +{ + const H5VL_class_t *cls; /* VOL connector class structs for object */ + const H5VL_class_t *native_cls; /* Native VOL connector class structs */ + int cmp_value; /* Comparison result */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ + HDassert(obj); + HDassert(is_native); + + /* Retrieve the terminal connector class for the object */ + cls = NULL; + if(H5VL_introspect_get_conn_cls(obj, H5VL_GET_CONN_LVL_TERM, &cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class") + + /* Retrieve the native connector class */ + if(NULL == (native_cls = (H5VL_class_t *)H5I_object_verify(H5VL_NATIVE, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve native VOL connector class") + + /* Compare connector classes */ + if(H5VL_cmp_connector_cls(&cmp_value, cls, native_cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + + /* If classes compare equal, then the object is / is in a native connector's file */ + *is_native = (cmp_value == 0); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_is_native() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_is_same + * + * Purpose: Query if two files are the same. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * December 14, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2, + hbool_t *same_file) +{ + const H5VL_class_t *cls1; /* VOL connector class struct for first object */ + const H5VL_class_t *cls2; /* VOL connector class struct for second object */ + int cmp_value; /* Comparison result */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ + HDassert(vol_obj1); + HDassert(vol_obj2); + HDassert(same_file); + + /* Retrieve the terminal connectors for each object */ + cls1 = NULL; + if(H5VL_introspect_get_conn_cls(vol_obj1, H5VL_GET_CONN_LVL_TERM, &cls1) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class") + cls2 = NULL; + if(H5VL_introspect_get_conn_cls(vol_obj2, H5VL_GET_CONN_LVL_TERM, &cls2) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class") + + /* Compare connector classes */ + if(H5VL_cmp_connector_cls(&cmp_value, cls1, cls2) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + + /* If the connector classes are different, the files are different */ + if(cmp_value) + *same_file = FALSE; + else { + void *obj2; /* Terminal object for second file */ + + /* Get unwrapped (terminal) object for vol_obj2 */ + if(NULL == (obj2 = H5VL_object_data(vol_obj2))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get unwrapped object") + + /* Make callback */ + if(H5VL_file_specific(vol_obj1, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, obj2, same_file) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_is_same() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_register_connector * * Purpose: Registers a new VOL connector as a member of the virtual object @@ -980,7 +1107,7 @@ done: * Return: Success: A VOL connector ID which is good until the * library is closed or the connector is unregistered. * - * Failure: H5I_INVALID_HID + * Failure: H5I_INVALID_HID * * Programmer: Dana Robinson * June 22, 2017 @@ -1395,7 +1522,7 @@ done: * * Purpose: Utility function to return the object pointer associated with * a hid_t. This routine is the same as H5I_object for all types - * except for named datatypes, where the vol_obj is returned that + * except for named datatypes, where the vol_obj is returned that * is attached to the H5T_t struct. * * Return: Success: object pointer @@ -1413,15 +1540,15 @@ H5VL_vol_object(hid_t id) FUNC_ENTER_NOAPI(NULL) obj_type = H5I_get_type(id); - if (H5I_FILE == obj_type || H5I_GROUP == obj_type || H5I_ATTR == obj_type || + if(H5I_FILE == obj_type || H5I_GROUP == obj_type || H5I_ATTR == obj_type || H5I_DATASET == obj_type || H5I_DATATYPE == obj_type) { /* Get the object */ - if (NULL == (obj = H5I_object(id))) + if(NULL == (obj = H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") - /* if this is a datatype, get the VOL object attached to the H5T_t struct */ - if (H5I_DATATYPE == obj_type) - if (NULL == (obj = H5T_get_named_type((H5T_t *)obj))) + /* If this is a datatype, get the VOL object attached to the H5T_t struct */ + if(H5I_DATATYPE == obj_type) + if(NULL == (obj = H5T_get_named_type((H5T_t *)obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype") } /* end if */ else @@ -1502,7 +1629,7 @@ done: static void * H5VL__object(hid_t id, H5I_type_t obj_type) { - H5VL_object_t *vol_obj = NULL; + H5VL_object_t *vol_obj = NULL; void *ret_value = NULL; FUNC_ENTER_STATIC @@ -1511,7 +1638,7 @@ H5VL__object(hid_t id, H5I_type_t obj_type) switch(obj_type) { case H5I_GROUP: case H5I_DATASET: - case H5I_FILE: + case H5I_FILE: case H5I_ATTR: case H5I_MAP: /* get the object */ @@ -1891,17 +2018,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_set_vol_wrapper(void *obj, H5VL_t *connector) +H5VL_set_vol_wrapper(const H5VL_object_t *vol_obj) { H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ - void *obj_wrap_ctx = NULL; /* VOL connector's wrapping context */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Sanity checks */ - HDassert(obj); - HDassert(connector); + /* Sanity check */ + HDassert(vol_obj); /* Retrieve the VOL object wrap context */ if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) @@ -1909,13 +2034,19 @@ H5VL_set_vol_wrapper(void *obj, H5VL_t *connector) /* Check for existing wrapping context */ if(NULL == vol_wrap_ctx) { + void *obj_wrap_ctx = NULL; /* VOL connector's wrapping context */ + + /* Sanity checks */ + HDassert(vol_obj->data); + HDassert(vol_obj->connector); + /* Check if the connector can create a wrap context */ - if(connector->cls->wrap_cls.get_wrap_ctx) { + if(vol_obj->connector->cls->wrap_cls.get_wrap_ctx) { /* Sanity check */ - HDassert(connector->cls->wrap_cls.free_wrap_ctx); + HDassert(vol_obj->connector->cls->wrap_cls.free_wrap_ctx); /* Get the wrap context from the connector */ - if((connector->cls->wrap_cls.get_wrap_ctx)(obj, &obj_wrap_ctx) < 0) + if((vol_obj->connector->cls->wrap_cls.get_wrap_ctx)(vol_obj->data, &obj_wrap_ctx) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL connector's object wrap context") } /* end if */ @@ -1924,11 +2055,11 @@ H5VL_set_vol_wrapper(void *obj, H5VL_t *connector) HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate VOL wrap context") /* Increment the outstanding objects that are using the connector */ - H5VL__conn_inc_rc(connector); + H5VL__conn_inc_rc(vol_obj->connector); /* Set up VOL object wrapper context */ vol_wrap_ctx->rc = 1; - vol_wrap_ctx->connector = connector; + vol_wrap_ctx->connector = vol_obj->connector; vol_wrap_ctx->obj_wrap_ctx = obj_wrap_ctx; } /* end if */ else diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 78eaee4..dfa57ef 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -31,7 +31,7 @@ static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID; static herr_t H5VL__native_term(void); /* Native VOL connector class struct */ -static H5VL_class_t H5VL_native_cls_g = { +static const H5VL_class_t H5VL_native_cls_g = { H5VL_NATIVE_VERSION, /* version */ H5VL_NATIVE_VALUE, /* value */ H5VL_NATIVE_NAME, /* name */ @@ -112,6 +112,10 @@ static H5VL_class_t H5VL_native_cls_g = { H5VL__native_object_specific, /* specific */ H5VL__native_object_optional /* optional */ }, + { /* introspect_cls */ + H5VL__native_introspect_get_conn_cls, /* get_conn_cls */ + H5VL__native_introspect_opt_query, /* opt_query */ + }, { /* request_cls */ NULL, /* wait */ NULL, /* notify */ @@ -148,8 +152,8 @@ H5VL_native_register(void) FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Register the native VOL connector, if it isn't already */ - if(NULL == H5I_object_verify(H5VL_NATIVE_ID_g, H5I_VOL)) - if((H5VL_NATIVE_ID_g = H5VL_register_connector((const H5VL_class_t *)&H5VL_native_cls_g, TRUE, H5P_DEFAULT)) < 0) + if(H5I_INVALID_HID == H5VL_NATIVE_ID_g) + if((H5VL_NATIVE_ID_g = H5VL_register_connector(&H5VL_native_cls_g, TRUE, H5P_VOL_INITIALIZE_DEFAULT)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL connector") /* Set return value */ @@ -180,3 +184,31 @@ H5VL__native_term(void) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5VL__native_term() */ + +/*--------------------------------------------------------------------------- + * Function: H5VL__native_introspect_get_conn_cls + * + * Purpose: Query the connector class. + * + * Note: This routine is in this file so that it can return the address + * of the staticly declared class struct. + * + * Returns: SUCCEED (Can't fail) + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VL__native_introspect_get_conn_cls(void H5_ATTR_UNUSED *obj, + H5VL_get_conn_lvl_t H5_ATTR_UNUSED lvl, const H5VL_class_t **conn_cls) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity check */ + HDassert(conn_cls); + + /* Retrieve the native VOL connector class */ + *conn_cls = &H5VL_native_cls_g; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__native_introspect_get_conn_cls() */ + diff --git a/src/H5VLnative.h b/src/H5VLnative.h index 73cec8d..44ed670 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -20,6 +20,11 @@ /* Public headers needed by this file */ #include "H5VLpublic.h" /* Virtual Object Layer */ + +/*****************/ +/* Public Macros */ +/*****************/ + /* Identifier for the native VOL connector */ #define H5VL_NATIVE (H5VL_native_register()) @@ -28,14 +33,12 @@ #define H5VL_NATIVE_VALUE H5_VOL_NATIVE /* enum value */ #define H5VL_NATIVE_VERSION 0 -/* Typedef and values for native VOL connector attribute optional VOL operations */ -typedef int H5VL_native_attr_optional_t; +/* Values for VOL connector attribute optional VOL operations */ #ifndef H5_NO_DEPRECATED_SYMBOLS -#define H5VL_NATIVE_ATTR_ITERATE_OLD 0 /* H5Aiterate (deprecated routine) */ +#define H5VL_NATIVE_ATTR_ITERATE_OLD 0 /* H5Aiterate (deprecated routine) */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ -/* Typedef and values for native VOL connector dataset optional VOL operations */ -typedef int H5VL_native_dataset_optional_t; +/* Values for native VOL connector dataset optional VOL operations */ #define H5VL_NATIVE_DATASET_FORMAT_CONVERT 0 /* H5Dformat_convert (internal) */ #define H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE 1 /* H5Dget_chunk_index_type */ #define H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE 2 /* H5Dget_chunk_storage_size */ @@ -44,53 +47,64 @@ typedef int H5VL_native_dataset_optional_t; #define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD 5 /* H5Dget_chunk_info_by_coord */ #define H5VL_NATIVE_DATASET_CHUNK_READ 6 /* H5Dchunk_read */ #define H5VL_NATIVE_DATASET_CHUNK_WRITE 7 /* H5Dchunk_write */ +#define H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE 8 /* H5Dvlen_get_buf_size */ + +/* Values for native VOL connector file optional VOL operations */ +#define H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE 0 /* H5Fclear_elink_file_cache */ +#define H5VL_NATIVE_FILE_GET_FILE_IMAGE 1 /* H5Fget_file_image */ +#define H5VL_NATIVE_FILE_GET_FREE_SECTIONS 2 /* H5Fget_free_sections */ +#define H5VL_NATIVE_FILE_GET_FREE_SPACE 3 /* H5Fget_freespace */ +#define H5VL_NATIVE_FILE_GET_INFO 4 /* H5Fget_info1/2 */ +#define H5VL_NATIVE_FILE_GET_MDC_CONF 5 /* H5Fget_mdc_config */ +#define H5VL_NATIVE_FILE_GET_MDC_HR 6 /* H5Fget_mdc_hit_rate */ +#define H5VL_NATIVE_FILE_GET_MDC_SIZE 7 /* H5Fget_mdc_size */ +#define H5VL_NATIVE_FILE_GET_SIZE 8 /* H5Fget_filesize */ +#define H5VL_NATIVE_FILE_GET_VFD_HANDLE 9 /* H5Fget_vfd_handle */ +#define H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE 10 /* H5Freset_mdc_hit_rate_stats */ +#define H5VL_NATIVE_FILE_SET_MDC_CONFIG 11 /* H5Fset_mdc_config */ +#define H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO 12 /* H5Fget_metadata_read_retry_info */ +#define H5VL_NATIVE_FILE_START_SWMR_WRITE 13 /* H5Fstart_swmr_write */ +#define H5VL_NATIVE_FILE_START_MDC_LOGGING 14 /* H5Fstart_mdc_logging */ +#define H5VL_NATIVE_FILE_STOP_MDC_LOGGING 15 /* H5Fstop_mdc_logging */ +#define H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS 16 /* H5Fget_mdc_logging_status */ +#define H5VL_NATIVE_FILE_FORMAT_CONVERT 17 /* H5Fformat_convert */ +#define H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS 18 /* H5Freset_page_buffering_stats */ +#define H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS 19 /* H5Fget_page_buffering_stats */ +#define H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO 20 /* H5Fget_mdc_image_info */ +#define H5VL_NATIVE_FILE_GET_EOA 21 /* H5Fget_eoa */ +#define H5VL_NATIVE_FILE_INCR_FILESIZE 22 /* H5Fincrement_filesize */ +#define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 23 /* H5Fset_latest_format/libver_bounds */ +#define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 24 /* H5Fget_dset_no_attrs_hint */ +#define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 25 /* H5Fset_dset_no_attrs_hint */ +#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 26 /* H5Fget_mpi_atomicity */ +#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 27 /* H5Fset_mpi_atomicity */ +#define H5VL_NATIVE_FILE_POST_OPEN 28 /* Adjust file after open, with wrapping context */ -/* Typedef and values for native VOL connector file optional VOL operations */ -typedef int H5VL_native_file_optional_t; -#define H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE 0 /* H5Fclear_elink_file_cache */ -#define H5VL_NATIVE_FILE_GET_FILE_IMAGE 1 /* H5Fget_file_image */ -#define H5VL_NATIVE_FILE_GET_FREE_SECTIONS 2 /* H5Fget_free_sections */ -#define H5VL_NATIVE_FILE_GET_FREE_SPACE 3 /* H5Fget_freespace */ -#define H5VL_NATIVE_FILE_GET_INFO 4 /* H5Fget_info1/2 */ -#define H5VL_NATIVE_FILE_GET_MDC_CONF 5 /* H5Fget_mdc_config */ -#define H5VL_NATIVE_FILE_GET_MDC_HR 6 /* H5Fget_mdc_hit_rate */ -#define H5VL_NATIVE_FILE_GET_MDC_SIZE 7 /* H5Fget_mdc_size */ -#define H5VL_NATIVE_FILE_GET_SIZE 8 /* H5Fget_filesize */ -#define H5VL_NATIVE_FILE_GET_VFD_HANDLE 9 /* H5Fget_vfd_handle */ -#define H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE 10 /* H5Freset_mdc_hit_rate_stats */ -#define H5VL_NATIVE_FILE_SET_MDC_CONFIG 11 /* H5Fset_mdc_config */ -#define H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO 12 /* H5Fget_metadata_read_retry_info */ -#define H5VL_NATIVE_FILE_START_SWMR_WRITE 13 /* H5Fstart_swmr_write */ -#define H5VL_NATIVE_FILE_START_MDC_LOGGING 14 /* H5Fstart_mdc_logging */ -#define H5VL_NATIVE_FILE_STOP_MDC_LOGGING 15 /* H5Fstop_mdc_logging */ -#define H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS 16 /* H5Fget_mdc_logging_status */ -#define H5VL_NATIVE_FILE_FORMAT_CONVERT 17 /* H5Fformat_convert */ -#define H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS 18 /* H5Freset_page_buffering_stats */ -#define H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS 19 /* H5Fget_page_buffering_stats */ -#define H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO 20 /* H5Fget_mdc_image_info */ -#define H5VL_NATIVE_FILE_GET_EOA 21 /* H5Fget_eoa */ -#define H5VL_NATIVE_FILE_INCR_FILESIZE 22 /* H5Fincrement_filesize */ -#define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 23 /* H5Fset_latest_format/libver_bounds */ -#define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 24 /* H5Fget_dset_no_attrs_hint */ -#define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 25 /* H5Fset_dset_no_attrs_hint */ -#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 26 /* H5Fget_mpi_atomicity */ -#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 27 /* H5Fset_mpi_atomicity */ - -/* Typedef and values for native VOL connector group optional VOL operations */ -typedef int H5VL_native_group_optional_t; +/* Values for native VOL connector group optional VOL operations */ #ifndef H5_NO_DEPRECATED_SYMBOLS -#define H5VL_NATIVE_GROUP_ITERATE_OLD 0 /* HG5Giterate (deprecated routine) */ -#define H5VL_NATIVE_GROUP_GET_OBJINFO 1 /* HG5Gget_objinfo (deprecated routine) */ +#define H5VL_NATIVE_GROUP_ITERATE_OLD 0 /* HG5Giterate (deprecated routine) */ +#define H5VL_NATIVE_GROUP_GET_OBJINFO 1 /* HG5Gget_objinfo (deprecated routine) */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ -/* Typedef and values for native VOL connector object optional VOL operations */ -typedef int H5VL_native_object_optional_t; -#define H5VL_NATIVE_OBJECT_GET_COMMENT 0 /* H5G|H5Oget_comment, H5Oget_comment_by_name */ -#define H5VL_NATIVE_OBJECT_GET_INFO 1 /* H5Oget_info(_by_idx, _by_name)(2) */ -#define H5VL_NATIVE_OBJECT_SET_COMMENT 2 /* H5G|H5Oset_comment, H5Oset_comment_by_name */ -#define H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES 3 /* H5Odisable_mdc_flushes */ -#define H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES 4 /* H5Oenable_mdc_flushes */ -#define H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED 5 /* H5Oare_mdc_flushes_disabled */ +/* Values for native VOL connector object optional VOL operations */ +#define H5VL_NATIVE_OBJECT_GET_COMMENT 0 /* H5G|H5Oget_comment, H5Oget_comment_by_name */ +#define H5VL_NATIVE_OBJECT_GET_INFO 1 /* H5Oget_info(_by_idx, _by_name)(2) */ +#define H5VL_NATIVE_OBJECT_SET_COMMENT 2 /* H5G|H5Oset_comment, H5Oset_comment_by_name */ +#define H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES 3 /* H5Odisable_mdc_flushes */ +#define H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES 4 /* H5Oenable_mdc_flushes */ +#define H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED 5 /* H5Oare_mdc_flushes_disabled */ + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ #ifdef __cplusplus extern "C" { diff --git a/src/H5VLnative_attr.c b/src/H5VLnative_attr.c index 85af320..e54c49f 100644 --- a/src/H5VLnative_attr.c +++ b/src/H5VLnative_attr.c @@ -524,16 +524,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL__native_attr_optional(void H5_ATTR_UNUSED *obj, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_attr_optional(void H5_ATTR_UNUSED *obj, H5VL_attr_optional_t opt_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { - H5VL_native_attr_optional_t optional_type; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - optional_type = HDva_arg(arguments, H5VL_native_attr_optional_t); - switch(optional_type) { + switch(opt_type) { #ifndef H5_NO_DEPRECATED_SYMBOLS case H5VL_NATIVE_ATTR_ITERATE_OLD: { diff --git a/src/H5VLnative_blob.c b/src/H5VLnative_blob.c index 6c7f9b2..8e34859 100644 --- a/src/H5VLnative_blob.c +++ b/src/H5VLnative_blob.c @@ -84,7 +84,7 @@ H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id, HDassert(id); /* Write the VL information to disk (allocates space also) */ - if(H5HG_insert(f, size, (void *)buf, &hobjid) < 0) + if(H5HG_insert(f, size, buf, &hobjid) < 0) HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write blob information") /* Encode the heap information */ diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c index 399c19f..bea2c50 100644 --- a/src/H5VLnative_dataset.c +++ b/src/H5VLnative_dataset.c @@ -203,7 +203,7 @@ H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id") /* Write the data */ - if(H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0) + if(H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") done: @@ -388,11 +388,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5D_t *dset = NULL; /* Dataset */ - H5VL_native_dataset_optional_t optional_type = HDva_arg(arguments, H5VL_native_dataset_optional_t); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -426,7 +425,7 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, case H5D_NLAYOUTS: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type") - default: + default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type") } /* end switch */ @@ -607,6 +606,20 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, break; } + case H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE: + { /* H5Dvlen_get_buf_size */ + hid_t type_id = HDva_arg(arguments, hid_t); + hid_t space_id = HDva_arg(arguments, hid_t); + hsize_t *size = HDva_arg(arguments, hsize_t *); + + dset = (H5D_t *)obj; + + if(H5D__vlen_get_buf_size(dset, type_id, space_id, size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of vlen buf needed") + break; + } + + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") } /* end switch */ diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index fb3cb7e..005859d 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -305,15 +305,6 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, FUNC_ENTER_PACKAGE switch(specific_type) { - /* Finalize H5Fopen */ - case H5VL_FILE_POST_OPEN: - { - /* Call package routine */ - if(H5F__post_open((H5F_t *)obj) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't finish opening file") - break; - } - /* H5Fflush */ case H5VL_FILE_FLUSH: { @@ -450,10 +441,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5F_t *f = NULL; /* File */ - H5VL_native_file_optional_t optional_type = HDva_arg(arguments, H5VL_native_file_optional_t); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -565,8 +556,8 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR { size_t *max_size_ptr = HDva_arg(arguments, size_t *); size_t *min_clean_size_ptr = HDva_arg(arguments, size_t *); - size_t *cur_size_ptr = HDva_arg(arguments, size_t *); - int *cur_num_entries_ptr = HDva_arg(arguments, int *); + size_t *cur_size_ptr = HDva_arg(arguments, size_t *); + int *cur_num_entries_ptr = HDva_arg(arguments, int *); uint32_t cur_num_entries; /* Go get the size data */ @@ -706,7 +697,7 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR unsigned *misses = HDva_arg(arguments, unsigned *); unsigned *evictions = HDva_arg(arguments, unsigned *); unsigned *bypasses = HDva_arg(arguments, unsigned *); - + /* Sanity check */ if(NULL == f->shared->page_buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file") @@ -828,6 +819,15 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR } #endif /* H5_HAVE_PARALLEL */ + /* Finalize H5Fopen */ + case H5VL_NATIVE_FILE_POST_OPEN: + { + /* Call package routine */ + if(H5F__post_open((H5F_t *)obj) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't finish opening file") + break; + } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") } /* end switch */ diff --git a/src/H5VLnative_group.c b/src/H5VLnative_group.c index b6bef7f..3fdb2d9 100644 --- a/src/H5VLnative_group.c +++ b/src/H5VLnative_group.c @@ -266,15 +266,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL__native_group_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_group_optional(void *obj, H5VL_group_optional_t optional_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { - H5VL_native_group_optional_t optional_type; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - optional_type = HDva_arg(arguments, H5VL_native_group_optional_t); switch(optional_type) { #ifndef H5_NO_DEPRECATED_SYMBOLS /* H5Giterate (deprecated) */ diff --git a/src/H5VLnative_introspect.c b/src/H5VLnative_introspect.c new file mode 100644 index 0000000..45b8d8c --- /dev/null +++ b/src/H5VLnative_introspect.c @@ -0,0 +1,52 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Connector/container introspection callbacks for the native VOL connector + * + */ + +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5VLprivate.h" /* Virtual Object Layer */ + +#include "H5VLnative_private.h" /* Native VOL connector */ + +/* Note: H5VL__native_introspect_get_conn_cls is in src/H5VLnative.c so that + * it can return the address of the staticly declared class struct. + */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL__native_introspect_opt_query + * + * Purpose: Query if an optional operation is supported by this connector + * + * Returns: SUCCEED (Can't fail) + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VL__native_introspect_opt_query(void H5_ATTR_UNUSED *obj, H5VL_subclass_t H5_ATTR_UNUSED cls, + int H5_ATTR_UNUSED opt_type, hbool_t *supported) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity check */ + HDassert(supported); + + /* The native VOL connector supports all optional operations */ + *supported = TRUE; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__native_introspect_opt_query() */ + diff --git a/src/H5VLnative_link.c b/src/H5VLnative_link.c index 2a8c27a..9a633ac 100644 --- a/src/H5VLnative_link.c +++ b/src/H5VLnative_link.c @@ -255,6 +255,7 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_ } /* end else-if */ else HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") + break; } diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c index 6a22b05..e6b3295 100644 --- a/src/H5VLnative_object.c +++ b/src/H5VLnative_object.c @@ -384,10 +384,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_object_optional(void *obj, H5VL_object_optional_t optional_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { - H5VL_native_object_optional_t optional_type = HDva_arg(arguments, H5VL_native_object_optional_t); H5VL_loc_params_t *loc_params = HDva_arg(arguments, H5VL_loc_params_t *); H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h index 69a057e..ad9a496 100644 --- a/src/H5VLnative_private.h +++ b/src/H5VLnative_private.h @@ -51,7 +51,7 @@ H5_DLL herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_ H5_DLL herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VL__native_attr_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VL__native_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req); /* Dataset callbacks */ @@ -61,15 +61,22 @@ H5_DLL herr_t H5VL__native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem H5_DLL herr_t H5VL__native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); H5_DLL herr_t H5VL__native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VL__native_dataset_optional(void *dset, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VL__native_dataset_optional(void *dset, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_dataset_close(void *dset, hid_t dxpl_id, void **req); +/* Datatype callbacks */ +H5_DLL void *H5VL__native_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req); + /* File callbacks */ H5_DLL void *H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL__native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VL__native_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VL__native_file_optional(void *file, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req); /* Group callbacks */ @@ -77,7 +84,7 @@ H5_DLL void *H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_p H5_DLL void *H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VL__native_group_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VL__native_group_optional(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req); /* Link callbacks */ @@ -92,14 +99,11 @@ H5_DLL void *H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_pa H5_DLL herr_t H5VL__native_object_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name, void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VL__native_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VL__native_object_optional(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); -/* Datatype callbacks */ -H5_DLL void *H5VL__native_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req); +/* Connector/container introspection functions */ +H5_DLL herr_t H5VL__native_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); +H5_DLL herr_t H5VL__native_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type, hbool_t *supported); /* Blob callbacks */ H5_DLL herr_t H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx); diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index d9a207f..076d6de 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -117,8 +117,8 @@ static herr_t H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *b static herr_t H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req); static herr_t H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req); /* Dataset callbacks */ static void *H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); @@ -128,7 +128,7 @@ static herr_t H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_ static herr_t H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); static herr_t H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_dataset_optional(void *obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req); /* Datatype callbacks */ @@ -136,7 +136,7 @@ static void *H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_ static void *H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); static herr_t H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_pass_through_datatype_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_datatype_optional(void *obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req); /* File callbacks */ @@ -144,7 +144,7 @@ static void *H5VL_pass_through_file_create(const char *name, unsigned flags, hid static void *H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); static herr_t H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_file_optional(void *file, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req); /* Group callbacks */ @@ -152,7 +152,7 @@ static void *H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t * static void *H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); static herr_t H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_group_optional(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req); /* Link callbacks */ @@ -161,27 +161,35 @@ static herr_t H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t static herr_t H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); static herr_t H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_pass_through_link_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_link_optional(void *obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); /* Object callbacks */ static void *H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); static herr_t H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); static herr_t H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_object_optional(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); + +/* Container/connector introspection callbacks */ +static herr_t H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); +static herr_t H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type, hbool_t *supported); /* Async request callbacks */ static herr_t H5VL_pass_through_request_wait(void *req, uint64_t timeout, H5ES_status_t *status); static herr_t H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx); static herr_t H5VL_pass_through_request_cancel(void *req); static herr_t H5VL_pass_through_request_specific(void *req, H5VL_request_specific_t specific_type, va_list arguments); -static herr_t H5VL_pass_through_request_optional(void *req, va_list arguments); +static herr_t H5VL_pass_through_request_optional(void *req, H5VL_request_optional_t opt_type, va_list arguments); static herr_t H5VL_pass_through_request_free(void *req); /* Blob callbacks */ static herr_t H5VL_pass_through_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx); static herr_t H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx); static herr_t H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); +static herr_t H5VL_pass_through_blob_optional(void *obj, void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments); + +/* Generic optional callback */ +static herr_t H5VL_pass_through_optional(void *obj, int op_type, hid_t dxpl_id, void **req, va_list arguments); /*******************/ @@ -270,6 +278,10 @@ static const H5VL_class_t H5VL_pass_through_g = { H5VL_pass_through_object_specific, /* specific */ H5VL_pass_through_object_optional /* optional */ }, + { /* introspect_cls */ + H5VL_pass_through_introspect_get_conn_cls, /* get_conn_cls */ + H5VL_pass_through_introspect_opt_query, /* opt_query */ + }, { /* request_cls */ H5VL_pass_through_request_wait, /* wait */ H5VL_pass_through_request_notify, /* notify */ @@ -282,9 +294,9 @@ static const H5VL_class_t H5VL_pass_through_g = { H5VL_pass_through_blob_put, /* put */ H5VL_pass_through_blob_get, /* get */ H5VL_pass_through_blob_specific, /* specific */ - NULL /* optional */ + H5VL_pass_through_blob_optional /* optional */ }, - NULL /* optional */ + H5VL_pass_through_optional /* optional */ }; /* The connector identification number, initialized at runtime */ @@ -489,7 +501,7 @@ H5VL_pass_through_info_cmp(int *cmp_value, const void *_info1, const void *_info /* Initialize comparison value */ *cmp_value = 0; - + /* Compare under VOL connector classes */ H5VLcmp_connector_cls(cmp_value, info1->under_vol_id, info2->under_vol_id); if(*cmp_value != 0) @@ -606,7 +618,7 @@ H5VL_pass_through_str_to_info(const char *str, void **_info) const char *under_vol_info_start, *under_vol_info_end; hid_t under_vol_id; void *under_vol_info = NULL; - + #ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL INFO String To Info\n"); #endif @@ -820,7 +832,7 @@ H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params, H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Create\n"); #endif @@ -857,7 +869,7 @@ H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params, H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Open\n"); #endif @@ -886,14 +898,14 @@ H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Read\n"); #endif @@ -917,14 +929,14 @@ H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Write\n"); #endif @@ -948,14 +960,14 @@ H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Get\n"); #endif @@ -979,14 +991,14 @@ H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Specific\n"); #endif @@ -1010,18 +1022,18 @@ H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, * *------------------------------------------------------------------------- */ -static herr_t -H5VL_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **req, - va_list arguments) +static herr_t +H5VL_pass_through_attr_optional(void *obj, H5VL_attr_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Optional\n"); #endif - ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); /* Check for async request */ if(req && *req) @@ -1041,13 +1053,13 @@ H5VL_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **req, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Close\n"); #endif @@ -1078,13 +1090,13 @@ H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req) static void * H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, - hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) + hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_pass_through_t *dset; H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Create\n"); #endif @@ -1121,7 +1133,7 @@ H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Open\n"); #endif @@ -1150,14 +1162,14 @@ H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Read\n"); #endif @@ -1181,14 +1193,14 @@ H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Write\n"); #endif @@ -1212,14 +1224,14 @@ H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_i * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Get\n"); #endif @@ -1243,7 +1255,7 @@ H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { @@ -1251,7 +1263,7 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t hid_t under_vol_id; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL H5Dspecific\n"); #endif @@ -1279,18 +1291,18 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t * *------------------------------------------------------------------------- */ -static herr_t -H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req, - va_list arguments) +static herr_t +H5VL_pass_through_dataset_optional(void *obj, H5VL_dataset_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Optional\n"); #endif - ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); /* Check for async request */ if(req && *req) @@ -1310,13 +1322,13 @@ H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Close\n"); #endif @@ -1353,7 +1365,7 @@ H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATATYPE Commit\n"); #endif @@ -1387,10 +1399,10 @@ H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) { H5VL_pass_through_t *dt; - H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATATYPE Open\n"); #endif @@ -1419,14 +1431,14 @@ H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)dt; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATATYPE Get\n"); #endif @@ -1450,7 +1462,7 @@ H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { @@ -1458,7 +1470,7 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific hid_t under_vol_id; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATATYPE Specific\n"); #endif @@ -1486,18 +1498,18 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific * *------------------------------------------------------------------------- */ -static herr_t -H5VL_pass_through_datatype_optional(void *obj, hid_t dxpl_id, void **req, - va_list arguments) +static herr_t +H5VL_pass_through_datatype_optional(void *obj, H5VL_datatype_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATATYPE Optional\n"); #endif - ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); /* Check for async request */ if(req && *req) @@ -1517,13 +1529,13 @@ H5VL_pass_through_datatype_optional(void *obj, hid_t dxpl_id, void **req, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)dt; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATATYPE Close\n"); #endif @@ -1562,7 +1574,7 @@ H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t under_fapl_id; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL FILE Create\n"); #endif @@ -1616,7 +1628,7 @@ H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t under_fapl_id; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL FILE Open\n"); #endif @@ -1661,14 +1673,14 @@ H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)file; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL FILE Get\n"); #endif @@ -1693,7 +1705,7 @@ H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...) { @@ -1718,7 +1730,7 @@ H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { @@ -1726,7 +1738,7 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t under_vol_id = -1; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL FILE Specific\n"); #endif @@ -1825,18 +1837,18 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, * *------------------------------------------------------------------------- */ -static herr_t -H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **req, - va_list arguments) +static herr_t +H5VL_pass_through_file_optional(void *file, H5VL_file_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)file; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL File Optional\n"); #endif - ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); /* Check for async request */ if(req && *req) @@ -1856,13 +1868,13 @@ H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **req, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)file; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL FILE Close\n"); #endif @@ -1899,7 +1911,7 @@ H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params, H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL GROUP Create\n"); #endif @@ -1936,7 +1948,7 @@ H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL GROUP Open\n"); #endif @@ -1965,14 +1977,14 @@ H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL GROUP Get\n"); #endif @@ -1996,7 +2008,7 @@ H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { @@ -2004,7 +2016,7 @@ H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t under_vol_id; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL GROUP Specific\n"); #endif @@ -2032,18 +2044,18 @@ H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, * *------------------------------------------------------------------------- */ -static herr_t -H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **req, - va_list arguments) +static herr_t +H5VL_pass_through_group_optional(void *obj, H5VL_group_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL GROUP Optional\n"); #endif - ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); /* Check for async request */ if(req && *req) @@ -2063,13 +2075,13 @@ H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **req, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)grp; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL H5Gclose\n"); #endif @@ -2098,7 +2110,7 @@ H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req) * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, ...) @@ -2123,7 +2135,7 @@ H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments) @@ -2132,7 +2144,7 @@ H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, hid_t under_vol_id = -1; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL LINK Create\n"); #endif @@ -2188,7 +2200,7 @@ H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) @@ -2198,7 +2210,7 @@ H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, hid_t under_vol_id = -1; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL LINK Copy\n"); #endif @@ -2214,7 +2226,7 @@ H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, /* Check for async request */ if(req && *req) *req = H5VL_pass_through_new_obj(*req, under_vol_id); - + return ret_value; } /* end H5VL_pass_through_link_copy() */ @@ -2234,7 +2246,7 @@ H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) @@ -2244,7 +2256,7 @@ H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, hid_t under_vol_id = -1; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL LINK Move\n"); #endif @@ -2275,14 +2287,14 @@ H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL LINK Get\n"); #endif @@ -2291,7 +2303,7 @@ H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, /* Check for async request */ if(req && *req) *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); - + return ret_value; } /* end H5VL_pass_through_link_get() */ @@ -2306,14 +2318,14 @@ H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, * *------------------------------------------------------------------------- */ -static herr_t -H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params, +static herr_t +H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL LINK Specific\n"); #endif @@ -2338,17 +2350,17 @@ H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params, *------------------------------------------------------------------------- */ static herr_t -H5VL_pass_through_link_optional(void *obj, hid_t dxpl_id, void **req, - va_list arguments) +H5VL_pass_through_link_optional(void *obj, H5VL_link_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL LINK Optional\n"); #endif - ret_value = H5VLlink_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + ret_value = H5VLlink_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); /* Check for async request */ if(req && *req) @@ -2376,7 +2388,7 @@ H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL OBJECT Open\n"); #endif @@ -2405,7 +2417,7 @@ H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, @@ -2415,7 +2427,7 @@ H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_pa H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL OBJECT Copy\n"); #endif @@ -2439,13 +2451,13 @@ H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_pa * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL OBJECT Get\n"); #endif @@ -2469,7 +2481,7 @@ H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5V * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) @@ -2478,7 +2490,7 @@ H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params hid_t under_vol_id; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL OBJECT Specific\n"); #endif @@ -2506,18 +2518,18 @@ H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params * *------------------------------------------------------------------------- */ -static herr_t -H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req, - va_list arguments) +static herr_t +H5VL_pass_through_object_optional(void *obj, H5VL_object_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL OBJECT Optional\n"); #endif - ret_value = H5VLobject_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + ret_value = H5VLobject_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); /* Check for async request */ if(req && *req) @@ -2528,6 +2540,66 @@ H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req, /*------------------------------------------------------------------------- + * Function: H5VL_pass_through_introspect_get_conn_clss + * + * Purpose: Query the connector class. + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, + const H5VL_class_t **conn_cls) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_PASSTHRU_LOGGING + printf("------- PASS THROUGH VOL INTROSPECT GetConnCls\n"); +#endif + + /* Check for querying this connector's class */ + if(H5VL_GET_CONN_LVL_CURR == lvl) { + *conn_cls = &H5VL_pass_through_g; + ret_value = 0; + } /* end if */ + else + ret_value = H5VLintrospect_get_conn_cls(o->under_object, o->under_vol_id, + lvl, conn_cls); + + return ret_value; +} /* end H5VL_pass_through_introspect_get_conn_cls() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_introspect_opt_query + * + * Purpose: Query if an optional operation is supported by this connector + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t cls, + int opt_type, hbool_t *supported) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_PASSTHRU_LOGGING + printf("------- PASS THROUGH VOL INTROSPECT OptQuery\n"); +#endif + + ret_value = H5VLintrospect_opt_query(o->under_object, o->under_vol_id, cls, + opt_type, supported); + + return ret_value; +} /* end H5VL_pass_through_introspect_opt_query() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_pass_through_request_wait * * Purpose: Wait (with a timeout) for an async operation to complete @@ -2540,14 +2612,14 @@ H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_request_wait(void *obj, uint64_t timeout, H5ES_status_t *status) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL REQUEST Wait\n"); #endif @@ -2573,13 +2645,13 @@ H5VL_pass_through_request_wait(void *obj, uint64_t timeout, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL REQUEST Notify\n"); #endif @@ -2604,13 +2676,13 @@ H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx) * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_request_cancel(void *obj) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL REQUEST Cancel\n"); #endif @@ -2634,7 +2706,7 @@ H5VL_pass_through_request_cancel(void *obj) * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id, H5VL_request_specific_t specific_type, ...) { @@ -2659,13 +2731,13 @@ H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id, * *------------------------------------------------------------------------- */ -static herr_t -H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_type, +static herr_t +H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_type, va_list arguments) { herr_t ret_value = -1; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL REQUEST Specific\n"); #endif @@ -2801,17 +2873,18 @@ H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_t * *------------------------------------------------------------------------- */ -static herr_t -H5VL_pass_through_request_optional(void *obj, va_list arguments) +static herr_t +H5VL_pass_through_request_optional(void *obj, H5VL_request_optional_t opt_type, + va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL REQUEST Optional\n"); #endif - ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, arguments); + ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, opt_type, arguments); return ret_value; } /* end H5VL_pass_through_request_optional() */ @@ -2828,13 +2901,13 @@ H5VL_pass_through_request_optional(void *obj, va_list arguments) * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_request_free(void *obj) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL REQUEST Free\n"); #endif @@ -2926,3 +2999,58 @@ H5VL_pass_through_blob_specific(void *obj, void *blob_id, return ret_value; } /* end H5VL_pass_through_blob_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_blob_optional + * + * Purpose: Handles the blob 'optional' callback + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_pass_through_blob_optional(void *obj, void *blob_id, + H5VL_blob_optional_t opt_type, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_PASSTHRU_LOGGING + printf("------- PASS THROUGH VOL BLOB Optional\n"); +#endif + + ret_value = H5VLblob_optional(o->under_object, o->under_vol_id, blob_id, + opt_type, arguments); + + return ret_value; +} /* end H5VL_pass_through_blob_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_optional + * + * Purpose: Handles the generic 'optional' callback + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_pass_through_optional(void *obj, int op_type, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_PASSTHRU_LOGGING + printf("------- PASS THROUGH VOL generic Optional\n"); +#endif + + ret_value = H5VLoptional(o->under_object, o->under_vol_id, op_type, + dxpl_id, req, arguments); + + return ret_value; +} /* end H5VL_pass_through_optional() */ + diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index c572b79..18d6825 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -91,6 +91,9 @@ H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type); H5_DLL H5VL_object_t *H5VL_vol_object(hid_t id); H5_DLL H5VL_object_t *H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id); H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj); +H5_DLL herr_t H5VL_object_is_native(const H5VL_object_t *obj, hbool_t *is_native); +H5_DLL herr_t H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2, + hbool_t *same_file); /* Functions that wrap / unwrap VOL objects */ H5_DLL herr_t H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, @@ -99,7 +102,7 @@ H5_DLL void * H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj, H5I_type_t obj_type); H5_DLL void * H5VL_unwrap_object(const H5VL_class_t *connector, void *obj); H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx); -H5_DLL herr_t H5VL_set_vol_wrapper(void *obj, H5VL_t *vol_connector); +H5_DLL herr_t H5VL_set_vol_wrapper(const H5VL_object_t *vol_obj); H5_DLL herr_t H5VL_inc_vol_wrapper(void *vol_wrap_ctx); H5_DLL herr_t H5VL_dec_vol_wrapper(void *vol_wrap_ctx); H5_DLL herr_t H5VL_reset_vol_wrapper(void); @@ -134,7 +137,7 @@ H5_DLL herr_t H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t dtype_id, void H5_DLL herr_t H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Dataset functions */ @@ -144,15 +147,23 @@ H5_DLL herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, H5_DLL herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req); H5_DLL herr_t H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_dataset_specific(const H5VL_object_t *cls, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); +/* Datatype functions */ +H5_DLL void *H5VL_datatype_commit(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_datatype_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); + /* File functions */ H5_DLL void *H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VL_file_open(const H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Group functions */ @@ -160,7 +171,7 @@ H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_para H5_DLL void *H5VL_group_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Link functions */ @@ -169,38 +180,37 @@ H5_DLL herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_pa H5_DLL herr_t H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req, ...); /* Object functions */ H5_DLL void *H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, const H5VL_object_t *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, ...); -/* Datatype functions */ -H5_DLL void *H5VL_datatype_commit(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_datatype_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_datatype_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); +/* Connector/container introspection functions */ +H5_DLL herr_t H5VL_introspect_get_conn_cls(const H5VL_object_t *vol_obj, H5VL_get_conn_lvl_t lvl, + const H5VL_class_t **conn_cls); +H5_DLL herr_t H5VL_introspect_opt_query(const H5VL_object_t *vol_obj, H5VL_subclass_t subcls, + int opt_type, hbool_t *supported); /* Asynchronous functions */ H5_DLL herr_t H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, H5ES_status_t *status); H5_DLL herr_t H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb, void *ctx); H5_DLL herr_t H5VL_request_cancel(const H5VL_object_t *vol_obj); H5_DLL herr_t H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_t specific_type, ...); -H5_DLL herr_t H5VL_request_optional(const H5VL_object_t *vol_obj, ...); +H5_DLL herr_t H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_request_optional_t opt_type, ...); H5_DLL herr_t H5VL_request_free(const H5VL_object_t *vol_obj); /* Blob functions */ H5_DLL herr_t H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_t size, void *blob_id, void *ctx); H5_DLL herr_t H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size_t size, void *ctx); H5_DLL herr_t H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specific_t specific_type, ...); +H5_DLL herr_t H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_optional_t opt_type, ...); /* Generic functions */ -H5_DLL herr_t H5VL_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id,void **req, ...); +H5_DLL herr_t H5VL_optional(const H5VL_object_t *vol_obj, int op_type, hid_t dxpl_id, void **req, ...); #endif /* _H5VLprivate_H */ diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 12448b6..34a642e 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -21,11 +21,6 @@ #include "H5public.h" /* Generic Functions */ #include "H5Ipublic.h" /* IDs */ -/* Semi-public headers mainly for VOL connector authors */ -#include "H5VLconnector.h" -#include "H5VLconnector_passthru.h" - - /*****************/ /* Public Macros */ /*****************/ @@ -33,7 +28,7 @@ /* VOL connector identifier values * These are H5VL_class_value_t values, NOT hid_t values! */ -#define H5_VOL_INVALID (-1) /* Invalid ID for VOL connector iD */ +#define H5_VOL_INVALID (-1) /* Invalid ID for VOL connector ID */ #define H5_VOL_NATIVE 0 /* Native HDF5 file format VOL connector */ #define H5_VOL_RESERVED 256 /* VOL connector IDs below this value are reserved for library use */ #define H5_VOL_MAX 65535 /* Maximum VOL connector ID */ @@ -43,6 +38,16 @@ /* Public Typedefs */ /*******************/ + +/* + * VOL connector identifiers. Values 0 through 255 are for connectors defined + * by the HDF5 library. Values 256 through 511 are available for testing new + * filters. Subsequent values should be obtained from the HDF5 development + * team at help@hdfgroup.org. + */ +typedef int H5VL_class_value_t; + + /********************/ /* Public Variables */ /********************/ @@ -58,8 +63,6 @@ extern "C" { /* The H5VL types uses in the API calls are not opaque - they are defined in * H5VLconnector.h, which is included at the top of this file. */ - -H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id); H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id); H5_DLL hid_t H5VLregister_connector_by_value(H5VL_class_value_t connector_value, hid_t vipl_id); H5_DLL htri_t H5VLis_connector_registered(const char *name); @@ -73,5 +76,10 @@ H5_DLL herr_t H5VLunregister_connector(hid_t connector_id); } #endif +/* Semi-public headers mainly for VOL connector authors */ +#include "H5VLconnector.h" /* VOL connector author routines */ +#include "H5VLconnector_passthru.h" /* Pass-through VOL connector author routines */ +#include "H5VLnative.h" /* Native VOL connector macros, for VOL connector authors */ + #endif /* _H5VLpublic_H */ diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 6d07513..2245bd3 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -324,7 +324,7 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); #define H5Z_XFORM_DO_OP5(TYPE, SIZE) \ { \ - TYPE val = ((tree->type == H5Z_XFORM_INTEGER) ? (TYPE)tree->value.int_val : (TYPE)tree->value.float_val); \ + TYPE val = (TYPE)((tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val); \ H5VM_array_fill(array, &val, sizeof(TYPE), (SIZE)); \ } diff --git a/src/H5system.c b/src/H5system.c index 384360d..4b5e290 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -86,7 +86,9 @@ static hbool_t H5_ntzset = FALSE; * prints an `hsize_t' value as a hex number right justified and * zero filled in an 18-character field. * - * The conversion `a' refers to an `haddr_t' type. + * The conversion 'a' refers to an haddr_t type. + * + * The conversion 't' refers to an htri_t type. * * Return: Success: Number of characters printed * diff --git a/src/H5trace.c b/src/H5trace.c index 65e267e..83f0ac7 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -2605,6 +2605,25 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + + case 'A': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_blob_optional_t optional = (H5VL_blob_optional_t)HDva_arg(ap, int); + + switch(optional) { + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + case 'b': if(ptr) { if(vp) @@ -2634,6 +2653,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'B': if(ptr) { if(vp) @@ -2663,6 +2683,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'C': if(ptr) { if(vp) @@ -2679,6 +2700,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "%ld", (long)class_val); } /* end else */ break; + case 'c': if(ptr) { if(vp) @@ -2717,6 +2739,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'd': if(ptr) { if(vp) @@ -2743,6 +2766,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'e': if(ptr) { if(vp) @@ -2766,6 +2790,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'f': if(ptr) { if(vp) @@ -2789,6 +2814,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'g': if(ptr) { if(vp) @@ -2830,6 +2856,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'h': if(ptr) { if(vp) @@ -2859,12 +2886,16 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_FILE_DELETE: HDfprintf(out, "H5VL_FILE_DELETE"); break; + case H5VL_FILE_IS_EQUAL: + HDfprintf(out, "H5VL_FILE_IS_EQUAL"); + break; default: HDfprintf(out, "%ld", (long)specific); break; } /* end switch */ } /* end else */ break; + case 'i': if(ptr) { if(vp) @@ -2888,6 +2919,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'j': if(ptr) { if(vp) @@ -2911,6 +2943,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'k': if(ptr) { if(vp) @@ -2937,6 +2970,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'l': if(ptr) { if(vp) @@ -2963,6 +2997,31 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + + case 'L': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_get_conn_lvl_t get = (H5VL_get_conn_lvl_t)HDva_arg(ap, int); + + switch(get) { + case H5VL_GET_CONN_LVL_CURR: + HDfprintf(out, "H5VL_GET_CONN_LVL_CURR"); + break; + case H5VL_GET_CONN_LVL_TERM: + HDfprintf(out, "H5VL_GET_CONN_LVL_TERM"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'm': if(ptr) { if(vp) @@ -2989,6 +3048,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'n': if(ptr) { if(vp) @@ -3015,6 +3075,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'o': if(ptr) { if(vp) @@ -3050,6 +3111,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'r': if(ptr) { if(vp) @@ -3076,6 +3138,350 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + + case 's': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_attr_optional_t optional = (H5VL_attr_optional_t)HDva_arg(ap, int); + + switch(optional) { +#ifndef H5_NO_DEPRECATED_SYMBOLS + case H5VL_NATIVE_ATTR_ITERATE_OLD: + HDfprintf(out, "H5VL_NATIVE_ATTR_ITERATE_OLD"); + break; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + + case 'S': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_subclass_t subclass = (H5VL_subclass_t)HDva_arg(ap, int); + + switch(subclass) { + case H5VL_SUBCLS_NONE: + HDfprintf(out, "H5VL_SUBCLS_NONE"); + break; + case H5VL_SUBCLS_INFO: + HDfprintf(out, "H5VL_SUBCLS_INFO"); + break; + case H5VL_SUBCLS_WRAP: + HDfprintf(out, "H5VL_SUBCLS_WRAP"); + break; + case H5VL_SUBCLS_ATTR: + HDfprintf(out, "H5VL_SUBCLS_ATTR"); + break; + case H5VL_SUBCLS_DATASET: + HDfprintf(out, "H5VL_SUBCLS_DATASET"); + break; + case H5VL_SUBCLS_DATATYPE: + HDfprintf(out, "H5VL_SUBCLS_DATATYPE"); + break; + case H5VL_SUBCLS_FILE: + HDfprintf(out, "H5VL_SUBCLS_FILE"); + break; + case H5VL_SUBCLS_GROUP: + HDfprintf(out, "H5VL_SUBCLS_GROUP"); + break; + case H5VL_SUBCLS_LINK: + HDfprintf(out, "H5VL_SUBCLS_LINK"); + break; + case H5VL_SUBCLS_OBJECT: + HDfprintf(out, "H5VL_SUBCLS_OBJECT"); + break; + case H5VL_SUBCLS_REQUEST: + HDfprintf(out, "H5VL_SUBCLS_REQUEST"); + break; + case H5VL_SUBCLS_BLOB: + HDfprintf(out, "H5VL_SUBCLS_BLOB"); + break; + default: + HDfprintf(out, "%ld", (long)subclass); + break; + } /* end switch */ + } /* end else */ + break; + + case 't': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_dataset_optional_t optional = (H5VL_dataset_optional_t)HDva_arg(ap, int); + + switch(optional) { + case H5VL_NATIVE_DATASET_FORMAT_CONVERT: + HDfprintf(out, "H5VL_NATIVE_DATASET_FORMAT_CONVERT"); + break; + case H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE: + HDfprintf(out, "H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE"); + break; + case H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE: + HDfprintf(out, "H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE"); + break; + case H5VL_NATIVE_DATASET_GET_NUM_CHUNKS: + HDfprintf(out, "H5VL_NATIVE_DATASET_GET_NUM_CHUNKS"); + break; + case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX: + HDfprintf(out, "H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX"); + break; + case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD: + HDfprintf(out, "H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD"); + break; + case H5VL_NATIVE_DATASET_CHUNK_READ: + HDfprintf(out, "H5VL_NATIVE_DATASET_CHUNK_READ"); + break; + case H5VL_NATIVE_DATASET_CHUNK_WRITE: + HDfprintf(out, "H5VL_NATIVE_DATASET_CHUNK_WRITE"); + break; + case H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE: + HDfprintf(out, "H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE"); + break; + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + + case 'u': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_datatype_optional_t optional = (H5VL_datatype_optional_t)HDva_arg(ap, int); + + switch(optional) { + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + + case 'v': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_file_optional_t optional = (H5VL_file_optional_t)HDva_arg(ap, int); + + switch(optional) { + case H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE: + HDfprintf(out, "H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE"); + break; + case H5VL_NATIVE_FILE_GET_FILE_IMAGE: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_FILE_IMAGE"); + break; + case H5VL_NATIVE_FILE_GET_FREE_SECTIONS: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_FREE_SECTIONS"); + break; + case H5VL_NATIVE_FILE_GET_FREE_SPACE: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_FREE_SPACE"); + break; + case H5VL_NATIVE_FILE_GET_INFO: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_INFO"); + break; + case H5VL_NATIVE_FILE_GET_MDC_CONF: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_MDC_CONF"); + break; + case H5VL_NATIVE_FILE_GET_MDC_HR: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_MDC_HR"); + break; + case H5VL_NATIVE_FILE_GET_MDC_SIZE: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_MDC_SIZE"); + break; + case H5VL_NATIVE_FILE_GET_SIZE: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_SIZE"); + break; + case H5VL_NATIVE_FILE_GET_VFD_HANDLE: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_VFD_HANDLE"); + break; + case H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE: + HDfprintf(out, "H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE"); + break; + case H5VL_NATIVE_FILE_SET_MDC_CONFIG: + HDfprintf(out, "H5VL_NATIVE_FILE_SET_MDC_CONFIG"); + break; + case H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO"); + break; + case H5VL_NATIVE_FILE_START_SWMR_WRITE: + HDfprintf(out, "H5VL_NATIVE_FILE_START_SWMR_WRITE"); + break; + case H5VL_NATIVE_FILE_START_MDC_LOGGING: + HDfprintf(out, "H5VL_NATIVE_FILE_START_MDC_LOGGING"); + break; + case H5VL_NATIVE_FILE_STOP_MDC_LOGGING: + HDfprintf(out, "H5VL_NATIVE_FILE_STOP_MDC_LOGGING"); + break; + case H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS"); + break; + case H5VL_NATIVE_FILE_FORMAT_CONVERT: + HDfprintf(out, "H5VL_NATIVE_FILE_FORMAT_CONVERT"); + break; + case H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS: + HDfprintf(out, "H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS"); + break; + case H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS"); + break; + case H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO"); + break; + case H5VL_NATIVE_FILE_GET_EOA: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_EOA"); + break; + case H5VL_NATIVE_FILE_INCR_FILESIZE: + HDfprintf(out, "H5VL_NATIVE_FILE_INCR_FILESIZE"); + break; + case H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS: + HDfprintf(out, "H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS"); + break; + case H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG"); + break; + case H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG: + HDfprintf(out, "H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG"); + break; + case H5VL_NATIVE_FILE_GET_MPI_ATOMICITY: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_MPI_ATOMICITY"); + break; + case H5VL_NATIVE_FILE_SET_MPI_ATOMICITY: + HDfprintf(out, "H5VL_NATIVE_FILE_SET_MPI_ATOMICITY"); + break; + case H5VL_NATIVE_FILE_POST_OPEN: + HDfprintf(out, "H5VL_NATIVE_FILE_POST_OPEN"); + break; + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + + case 'w': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_group_optional_t optional = (H5VL_group_optional_t)HDva_arg(ap, int); + + switch(optional) { +#ifndef H5_NO_DEPRECATED_SYMBOLS + case H5VL_NATIVE_GROUP_ITERATE_OLD: + HDfprintf(out, "H5VL_NATIVE_GROUP_ITERATE_OLD"); + break; + case H5VL_NATIVE_GROUP_GET_OBJINFO: + HDfprintf(out, "H5VL_NATIVE_GROUP_GET_OBJINFO"); + break; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + + case 'x': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_link_optional_t optional = (H5VL_link_optional_t)HDva_arg(ap, int); + + switch(optional) { + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + + case 'y': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_object_optional_t optional = (H5VL_object_optional_t)HDva_arg(ap, int); + + switch(optional) { + case H5VL_NATIVE_OBJECT_GET_COMMENT: + HDfprintf(out, "H5VL_NATIVE_OBJECT_GET_COMMENT"); + break; + case H5VL_NATIVE_OBJECT_GET_INFO: + HDfprintf(out, "H5VL_NATIVE_OBJECT_GET_INFO"); + break; + case H5VL_NATIVE_OBJECT_SET_COMMENT: + HDfprintf(out, "H5VL_NATIVE_OBJECT_SET_COMMENT"); + break; + case H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES: + HDfprintf(out, "H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES"); + break; + case H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES: + HDfprintf(out, "H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES"); + break; + case H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED: + HDfprintf(out, "H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED"); + break; + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + + case 'z': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_request_optional_t optional = (H5VL_request_optional_t)HDva_arg(ap, int); + + switch(optional) { + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + default: HDfprintf(out, "BADTYPE(Z%c)", type[1]); goto error; diff --git a/src/H5vers.txt b/src/H5vers.txt index 22117c3..4b2f222 100644 --- a/src/H5vers.txt +++ b/src/H5vers.txt @@ -20,7 +20,7 @@ # Blank lines and lines beginning with '#' are ignored # # The format of this file is as follows: -# <type>: <base routine name>; <list of parameter types for function>; <version introduced>, <list of revised versions> +# <type>: <base routine name>; <list of versioned parameter types for function>; <version introduced>, <list of revised versions> # # Where <type> is either 'FUNCTION' or 'TYPEDEF' # diff --git a/src/Makefile.am b/src/Makefile.am index fa412c9..8a4afbc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -119,7 +119,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5VL.c H5VLcallback.c H5VLint.c H5VLnative.c \ H5VLnative_attr.c H5VLnative_blob.c H5VLnative_dataset.c \ H5VLnative_datatype.c H5VLnative_file.c H5VLnative_group.c \ - H5VLnative_link.c H5VLnative_object.c \ + H5VLnative_link.c H5VLnative_introspect.c H5VLnative_object.c \ H5VLpassthru.c \ H5VM.c H5WB.c H5Z.c \ H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ |