diff options
Diffstat (limited to 'src')
150 files changed, 7804 insertions, 3016 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c794c1a..070cf62 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -386,6 +386,7 @@ IDE_GENERATED_PROPERTIES ("H5I" "${H5I_HDRS}" "${H5I_SOURCES}" ) set (H5L_SOURCES ${HDF5_SRC_DIR}/H5L.c + ${HDF5_SRC_DIR}/H5Ldeprec.c ${HDF5_SRC_DIR}/H5Lexternal.c ) set (H5L_HDRS @@ -657,7 +658,9 @@ 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}/H5VLnative_token.c ${HDF5_SRC_DIR}/H5VLpassthru.c ) set (H5VL_HDRS @@ -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 @@ -253,7 +276,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id) { void *attr = NULL; /* Attribute created */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -337,8 +360,8 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id) { - void *attr = NULL; /* attr token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *attr = NULL; /* attr object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -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; @@ -418,8 +437,8 @@ done: hid_t H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { - void *attr = NULL; /* attr token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *attr = NULL; /* attr object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; @@ -489,8 +508,8 @@ hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id, hid_t lapl_id) { - void *attr = NULL; /* attr token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *attr = NULL; /* attr object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; @@ -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; @@ -575,7 +587,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t aapl_id, hid_t lapl_id) { void *attr = NULL; /* Attribute opened */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -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; @@ -1323,7 +1328,7 @@ herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ @@ -1402,7 +1407,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index e4b81fa..fadde28 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -498,7 +498,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t *aux_ptr, +H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t H5_ATTR_NDEBUG_UNUSED *aux_ptr, int sync_point_op) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 8d0e33c..e0a0f55 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -116,8 +116,8 @@ hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id) { - void *attr = NULL; /* attr token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + void *attr = NULL; /* attr object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -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 */ @@ -189,8 +190,8 @@ done: hid_t H5Aopen_name(hid_t loc_id, const char *name) { - void *attr = NULL; /* attr token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + void *attr = NULL; /* attr object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -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 */ @@ -254,8 +256,8 @@ done: hid_t H5Aopen_idx(hid_t loc_id, unsigned idx) { - void *attr = NULL; /* attr token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + void *attr = NULL; /* attr object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -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 */ @@ -318,9 +321,9 @@ done: int H5Aget_num_attrs(hid_t loc_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; - H5O_info_t oinfo; + H5O_info2_t oinfo; int ret_value = -1; FUNC_ENTER_API((-1)) @@ -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_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &oinfo, H5O_INFO_NUM_ATTRS) < 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); @@ -384,7 +387,7 @@ done: herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(H5_ITER_ERROR) @@ -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..fc5ea34 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)]) @@ -2062,7 +2063,7 @@ done: */ H5A_t * H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_size, - H5O_copy_t *cpy_info) + H5O_copy_t H5_ATTR_NDEBUG_UNUSED *cpy_info) { H5A_t *attr_dst = NULL; /* Destination attribute */ hid_t tid_src = -1; /* Datatype ID for source datatype */ 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); @@ -2020,7 +2020,6 @@ H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr) { H5B_t *bt = NULL; /* The B-tree */ H5UC_t *rc_shared; /* Ref-counted shared info */ - H5B_shared_t *shared; /* Pointer to shared B-tree info */ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ htri_t ret_value = SUCCEED; /* Return value */ @@ -2038,8 +2037,7 @@ H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr) /* Get shared info for B-tree */ if(NULL == (rc_shared = (type->get_shared)(f, NULL))) HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") - shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + HDassert((H5B_shared_t *)H5UC_GET_OBJ(rc_shared)); /* * Load the tree node. 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/H5B2dbg.c b/src/H5B2dbg.c index 0e3ebd5..b5b1c03 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -87,7 +87,7 @@ */ herr_t H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, - const H5B2_class_t *type, haddr_t obj_addr) + const H5B2_class_t H5_ATTR_NDEBUG_UNUSED *type, haddr_t H5_ATTR_NDEBUG_UNUSED obj_addr) { H5B2_hdr_t *hdr = NULL; /* B-tree header info */ unsigned u; /* Local index variable */ @@ -182,7 +182,7 @@ done: */ herr_t H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, - const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, unsigned depth, haddr_t obj_addr) + const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, unsigned depth, haddr_t H5_ATTR_NDEBUG_UNUSED obj_addr) { H5B2_hdr_t *hdr = NULL; /* B-tree header */ H5B2_internal_t *internal = NULL; /* B-tree internal node */ @@ -294,7 +294,7 @@ done: */ herr_t H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, - const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, haddr_t obj_addr) + const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, haddr_t H5_ATTR_NDEBUG_UNUSED obj_addr) { H5B2_hdr_t *hdr = NULL; /* B-tree header */ H5B2_leaf_t *leaf = NULL; /* B-tree 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; diff --git a/src/H5B2internal.c b/src/H5B2internal.c index 7f6b80a..92c802e 100644 --- a/src/H5B2internal.c +++ b/src/H5B2internal.c @@ -1355,7 +1355,7 @@ done: *------------------------------------------------------------------------- */ H5_ATTR_PURE herr_t -H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal) +H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_internal_t *internal) { hsize_t tot_all_nrec; /* Total number of records at or below this node */ uint16_t u, v; /* Local index variables */ @@ -1396,7 +1396,7 @@ H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2 *------------------------------------------------------------------------- */ H5_ATTR_PURE herr_t -H5B2__assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2) +H5B2__assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2) { hsize_t tot_all_nrec; /* Total number of records at or below this node */ uint16_t u, v; /* Local index variables */ diff --git a/src/H5B2leaf.c b/src/H5B2leaf.c index beca40c..7ed0468 100644 --- a/src/H5B2leaf.c +++ b/src/H5B2leaf.c @@ -1027,7 +1027,8 @@ done: *------------------------------------------------------------------------- */ H5_ATTR_PURE herr_t -H5B2__assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf) +H5B2__assert_leaf(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, + const H5B2_leaf_t H5_ATTR_NDEBUG_UNUSED *leaf) { /* General sanity checking on node */ HDassert(leaf->nrec <= hdr->node_info->split_nrec); @@ -1056,7 +1056,6 @@ H5C_flush_cache(H5F_t *f, unsigned flags) H5C_ring_t ring; H5C_t * cache_ptr; hbool_t destroy; - hbool_t ignore_protected; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -1101,9 +1100,8 @@ H5C_flush_cache(H5F_t *f, unsigned flags) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 ); destroy = ( (flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ); - HDassert( ! ( destroy && ignore_protected ) ); + HDassert( ! ( destroy && ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 )) ); HDassert( ! ( cache_ptr->flush_in_progress ) ); cache_ptr->flush_in_progress = TRUE; @@ -3856,7 +3854,11 @@ H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, { herr_t ret_value = SUCCEED; /* Return value */ +#if H5C_DO_SANITY_CHECKS FUNC_ENTER_STATIC +#else + FUNC_ENTER_STATIC_NOERR +#endif /* Sanity checking */ HDassert(cache_ptr); @@ -3873,7 +3875,9 @@ H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, /* Update the stats for an unpin operation */ H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) +#if H5C_DO_SANITY_CHECKS done: +#endif FUNC_LEAVE_NOAPI(ret_value) } /* H5C__unpin_entry_real() */ @@ -105,7 +105,7 @@ } /* end if */ #endif /* H5_HAVE_PARALLEL */ -#ifdef H5_HAVE_PARALLEL +#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_INSTRUMENTED_LIBRARY) /* Macro for the duplicated code to test and set properties for a property list */ #define H5CX_TEST_SET_PROP(PROP_NAME, PROP_FIELD) \ { \ @@ -127,7 +127,9 @@ (*head)->ctx.H5_GLUE(PROP_FIELD,_set) = TRUE; \ } /* end if */ \ } +#endif /* defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_INSTRUMENTED_LIBRARY) */ +#ifdef H5_HAVE_PARALLEL /* Macro for the duplicated code to test and set properties for a property list */ #define H5CX_SET_PROP(PROP_NAME, PROP_FIELD) \ if((*head)->ctx.H5_GLUE(PROP_FIELD,_set)) { \ diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c index dd9e9b2..5ac354d 100644 --- a/src/H5Clog_json.c +++ b/src/H5Clog_json.c @@ -1281,7 +1281,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, +H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t H5_ATTR_NDEBUG_UNUSED *config, herr_t fxn_ret_value) { H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 9156c0d..cafc6d5 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -4923,7 +4923,7 @@ H5_DLL herr_t H5C__untag_entry(H5C_t *cache, H5C_cache_entry_t *entry); /* Testing functions */ #ifdef H5C_TESTING -H5_DLL herr_t H5C__verify_cork_tag_test(hid_t fid, haddr_t tag, hbool_t status); +H5_DLL herr_t H5C__verify_cork_tag_test(hid_t fid, H5O_token_t tag_token, hbool_t status); #endif /* H5C_TESTING */ #endif /* _H5Cpkg_H */ diff --git a/src/H5Ctest.c b/src/H5Ctest.c index 340071a..7f24302 100644 --- a/src/H5Ctest.c +++ b/src/H5Ctest.c @@ -35,12 +35,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Cpkg.h" /* Cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* Files */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5Cpkg.h" /* Cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* Files */ +#include "H5Iprivate.h" /* IDs */ #include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative_private.h" /* Native VOL connector */ /****************/ @@ -132,11 +133,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C__verify_cork_tag_test(hid_t fid, haddr_t tag, hbool_t status) +H5C__verify_cork_tag_test(hid_t fid, H5O_token_t tag_token, hbool_t status) { H5F_t * f; /* File Pointer */ H5C_t * cache; /* Cache Pointer */ H5C_tag_iter_vct_ctx_t ctx; /* Context for iterator callback */ + haddr_t tag; /* Tagged address */ herr_t ret_value = SUCCEED; /* Return value */ /* Function enter macro */ @@ -146,6 +148,11 @@ H5C__verify_cork_tag_test(hid_t fid, haddr_t tag, hbool_t status) if(NULL == (f = (H5F_t *)H5VL_object_verify(fid, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + /* Convert token to address */ + tag = HADDR_UNDEF; + if(H5VL_native_token_to_addr(f, H5I_FILE, tag_token, &tag) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't get address for token") + /* Get cache pointer */ cache = f->shared->cache; @@ -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 */ @@ -106,7 +100,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id) { void *dset = NULL; /* New dataset's info */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -205,8 +199,8 @@ hid_t H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id) { - void *dset = NULL; /* dset token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *dset = NULL; /* dset object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -271,8 +265,8 @@ done: hid_t H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) { - void *dset = NULL; /* dset token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *dset = NULL; /* dset object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -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/H5Dbtree.c b/src/H5Dbtree.c index c13c36a..098e01b 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -253,7 +253,7 @@ H5D__btree_get_shared(const H5F_t H5_ATTR_UNUSED *f, const void *_udata) *------------------------------------------------------------------------- */ static herr_t -H5D__btree_new_node(H5F_t *f, H5B_ins_t op, void *_lt_key, void *_udata, +H5D__btree_new_node(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5B_ins_t op, void *_lt_key, void *_udata, void *_rt_key, haddr_t *addr_p/*out*/) { H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key; @@ -536,7 +536,7 @@ done: *------------------------------------------------------------------------- */ static H5B_ins_t -H5D__btree_insert(H5F_t *f, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, +H5D__btree_insert(H5F_t H5_ATTR_NDEBUG_UNUSED *f, haddr_t H5_ATTR_NDEBUG_UNUSED addr, void *_lt_key, hbool_t *lt_key_changed, void *_md_key, void *_udata, void *_rt_key, hbool_t H5_ATTR_UNUSED *rt_key_changed, haddr_t *new_node_p/*out*/) { diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 35773b6..43cfd02 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..f4f4223 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -113,11 +113,9 @@ hid_t H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id) { - void *dset = NULL; /* dset token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *dset = NULL; /* dset object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object 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 */ @@ -187,8 +186,8 @@ done: hid_t H5Dopen1(hid_t loc_id, const char *name) { - void *dset = NULL; /* dset token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *dset = NULL; /* dset object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ diff --git a/src/H5Dint.c b/src/H5Dint.c index c3d4398..436a507 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 */ @@ -60,9 +89,14 @@ static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overw hsize_t old_dim[]); static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id); 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__use_minimized_dset_headers(H5F_t *file, 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; @@ -699,14 +737,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__use_minimized_dset_headers(H5F_t *file, H5D_t *dset, hbool_t *minimize) +H5D__use_minimized_dset_headers(H5F_t *file, hbool_t *minimize) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT; HDassert(file); - HDassert(dset); HDassert(minimize); /* Get the dataset object header minimize flag for this call */ @@ -977,7 +1014,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value info") } /* end if */ - if(H5D__use_minimized_dset_headers(file, dset, &minimize_header) == FAIL) + if(H5D__use_minimized_dset_headers(file, &minimize_header) == FAIL) HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get minimize settings") if(TRUE == minimize_header) { @@ -2567,29 +2604,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 +2789,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/H5Dnone.c b/src/H5Dnone.c index 9346220..2093512 100644 --- a/src/H5Dnone.c +++ b/src/H5Dnone.c @@ -378,7 +378,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__none_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, +H5D__none_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst) { herr_t ret_value = SUCCEED; /* Return value */ 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/H5Dsingle.c b/src/H5Dsingle.c index 4510a03..8efa771 100644 --- a/src/H5Dsingle.c +++ b/src/H5Dsingle.c @@ -437,7 +437,7 @@ H5D__single_idx_delete(const H5D_chk_idx_info_t *idx_info) *------------------------------------------------------------------------- */ static herr_t -H5D__single_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, +H5D__single_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index da67e6b..1d182a4 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); @@ -1540,7 +1543,7 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ */ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, -H5EA__cache_dblock_deserialize(const void *_image, size_t len, +H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)) /* Local variables */ @@ -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); @@ -2076,7 +2080,7 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */ */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, -H5EA__cache_dblk_page_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, +H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)) /* Local variables */ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index 814e64f..58e255a 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -279,7 +279,7 @@ END_FUNC(STATIC) /* end H5EA__test_encode() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, -H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)) +H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_NDEBUG_UNUSED *_ctx)) /* Local variables */ #ifndef NDEBUG diff --git a/src/H5Epkg.h b/src/H5Epkg.h index ac98496..86b5b73 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -77,7 +77,7 @@ typedef struct { } H5E_auto_op_t; #else /* H5_NO_DEPRECATED_SYMBOLS */ typedef struct { - H5E_auto_t func2; /* Only the new style callback function is available. */ + H5E_auto2_t func2; /* Only the new style callback function is available. */ } H5E_auto_op_t; #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Epublic.h b/src/H5Epublic.h index 3eae2da..ed14217 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -100,14 +100,14 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g; } #else /* H5_NO_DEPRECATED_SYMBOLS */ #define H5E_BEGIN_TRY { \ - H5E_auto_t saved_efunc; \ + H5E_auto2_t saved_efunc; \ void *H5E_saved_edata; \ \ - (void)H5Eget_auto(H5E_DEFAULT, &saved_efunc, &H5E_saved_edata); \ - (void)H5Eset_auto(H5E_DEFAULT, NULL, NULL); + (void)H5Eget_auto2(H5E_DEFAULT, &saved_efunc, &H5E_saved_edata); \ + (void)H5Eset_auto2(H5E_DEFAULT, NULL, NULL); #define H5E_END_TRY \ - (void)H5Eset_auto(H5E_DEFAULT, saved_efunc, H5E_saved_edata); \ + (void)H5Eset_auto2(H5E_DEFAULT, saved_efunc, H5E_saved_edata); \ } #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -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..922153c 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -253,7 +253,7 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_verify_chksum() */ */ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, -H5FA__cache_hdr_deserialize(const void *_image, size_t len, +H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)) /* Local variables */ @@ -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) */ @@ -650,7 +651,7 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_verify_chksum() */ */ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, -H5FA__cache_dblock_deserialize(const void *_image, size_t len, +H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)) /* Local variables */ @@ -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); @@ -1176,7 +1178,7 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */ */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, -H5FA__cache_dblk_page_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, +H5FA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)) /* Local variables */ 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 */ @@ -665,14 +665,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) +H5FS_size(const H5FS_t *fspace, hsize_t *meta_size) { FUNC_ENTER_NOAPI_NOINIT_NOERR /* * Check arguments. */ - HDassert(f); HDassert(fspace); HDassert(meta_size); diff --git a/src/H5FScache.c b/src/H5FScache.c index b520458..d5f2817 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -241,7 +241,7 @@ H5FS__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE *------------------------------------------------------------------------- */ static void * -H5FS__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, +H5FS__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5FS_t *fspace = NULL; /* Free space header info */ @@ -404,8 +404,8 @@ H5FS__cache_hdr_image_len(const void *_thing, size_t *image_len) */ static herr_t H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, - haddr_t addr, size_t H5_ATTR_UNUSED len, haddr_t *new_addr, size_t *new_len, - unsigned *flags) + haddr_t addr, size_t H5_ATTR_UNUSED len, haddr_t H5_ATTR_NDEBUG_UNUSED *new_addr, + size_t H5_ATTR_NDEBUG_UNUSED *new_len, unsigned *flags) { H5FS_t *fspace = (H5FS_t *)_thing; /* Pointer to the object */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ @@ -694,7 +694,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len, +H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5FS_t *fspace = (H5FS_t *)_thing; /* Pointer to the object */ @@ -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); @@ -979,8 +979,8 @@ H5FS__cache_sinfo_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU *------------------------------------------------------------------------- */ static void * -H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, - hbool_t *dirty) +H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, + hbool_t H5_ATTR_NDEBUG_UNUSED *dirty) { H5FS_sinfo_cache_ud_t *udata = (H5FS_sinfo_cache_ud_t *)_udata; /* User data for callback */ H5FS_t *fspace; /* free space manager */ @@ -1025,11 +1025,11 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, /* Check for any serialized sections */ if(fspace->serial_sect_count > 0) { - hsize_t old_tot_sect_count; /* Total section count from header */ - hsize_t old_serial_sect_count; /* Total serializable section count from header */ - hsize_t old_ghost_sect_count; /* Total ghost section count from header */ - hsize_t old_tot_space; /* Total space managed from header */ - unsigned sect_cnt_size; /* The size of the section size counts */ + hsize_t old_tot_sect_count; /* Total section count from header */ + hsize_t H5_ATTR_NDEBUG_UNUSED old_serial_sect_count; /* Total serializable section count from header */ + hsize_t H5_ATTR_NDEBUG_UNUSED old_ghost_sect_count; /* Total ghost section count from header */ + hsize_t H5_ATTR_NDEBUG_UNUSED old_tot_space; /* Total space managed from header */ + unsigned sect_cnt_size; /* The size of the section size counts */ /* Compute the size of the section counts */ sect_cnt_size = H5VM_limit_enc_size((uint64_t)fspace->serial_sect_count); @@ -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 */ @@ -1141,7 +1141,6 @@ static herr_t H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len) { const H5FS_sinfo_t *sinfo = (const H5FS_sinfo_t *)_thing; /* Pointer to the object */ - const H5FS_t *fspace; /* Free space header */ FUNC_ENTER_STATIC_NOERR @@ -1149,10 +1148,9 @@ H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len) HDassert(sinfo); HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); - fspace = sinfo->fspace; - HDassert(fspace); - HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR); + HDassert(sinfo->fspace); + HDassert(sinfo->fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR); HDassert(image_len); /* Set the image length size */ @@ -1180,7 +1178,8 @@ H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len) */ static herr_t H5FS__cache_sinfo_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, - size_t len, haddr_t *new_addr, size_t *new_len, unsigned *flags) + size_t H5_ATTR_NDEBUG_UNUSED len, haddr_t *new_addr, size_t H5_ATTR_NDEBUG_UNUSED *new_len, + unsigned *flags) { H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing; /* Pointer to the object */ H5FS_t *fspace; /* Free space header */ @@ -1267,7 +1266,6 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len, void *_thing) { H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing; /* Pointer to the object */ - H5FS_t *fspace; /* Free space header */ H5FS_iter_ud_t udata; /* User data for callbacks */ uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint8_t *chksum_image = NULL; /* Points to chksum location */ @@ -1283,12 +1281,11 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len, HDassert(sinfo); HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); - fspace = sinfo->fspace; - HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR); - HDassert(fspace->cache_info.is_pinned); - HDassert(fspace->sect_size == len); - HDassert(fspace->sect_cls); + HDassert(sinfo->fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR); + HDassert(sinfo->fspace->cache_info.is_pinned); + HDassert(sinfo->fspace->sect_size == len); + HDassert(sinfo->fspace->sect_cls); /* Magic number */ H5MM_memcpy(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -1418,7 +1415,6 @@ static herr_t H5FS__cache_sinfo_free_icr(void *_thing) { H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing; /* Pointer to the object */ - H5FS_t *fspace; /* Free space header */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1427,10 +1423,9 @@ H5FS__cache_sinfo_free_icr(void *_thing) HDassert(sinfo); HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); - fspace = sinfo->fspace; - HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR); - HDassert(fspace->cache_info.is_pinned); + HDassert(sinfo->fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR); + HDassert(sinfo->fspace->cache_info.is_pinned); /* Destroy free space info */ if(H5FS__sinfo_dest(sinfo) < 0) diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index 31fc63c..d2e1f90 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -182,7 +182,7 @@ H5_DLL H5FS_t *H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_c H5_DLL H5FS_t *H5FS_open(H5F_t *f, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold); -H5_DLL herr_t H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size); +H5_DLL herr_t H5FS_size(const H5FS_t *fspace, hsize_t *meta_size); H5_DLL herr_t H5FS_delete(H5F_t *f, haddr_t fs_addr); H5_DLL herr_t H5FS_close(H5F_t *f, H5FS_t *fspace); H5_DLL herr_t H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr); 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 3a8dc3b..74189c1 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -3581,78 +3581,6 @@ done: } /* H5F__format_convert() */ -/*--------------------------------------------------------------------------- - * Function: H5F__get_file - * - * Purpose: Utility routine to get file struct for an object - * - * Returns: SUCCESS: A pointer to the H5F_t struct for the file - * associated with the object. - * FAILURE: NULL - * - *--------------------------------------------------------------------------- - */ -H5F_t * -H5F__get_file(void *obj, H5I_type_t type) -{ - H5F_t *ret_value = NULL; /* File pointer */ - H5O_loc_t *oloc = NULL; /* Object location for ID */ - - FUNC_ENTER_PACKAGE - - switch(type) { - case H5I_FILE: - ret_value = (H5F_t *)obj; - break; - - case H5I_GROUP: - oloc = H5G_oloc((H5G_t *)obj); - break; - - case H5I_DATATYPE: - oloc = H5T_oloc((H5T_t *)obj); - break; - - case H5I_DATASET: - oloc = H5D_oloc((H5D_t *)obj); - break; - - case H5I_ATTR: - oloc = H5A_oloc((H5A_t *)obj); - break; - - case H5I_MAP: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "maps not supported in native VOL connector") - - 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_ARGS, H5E_BADTYPE, NULL, "not a file or file object") - } /* end switch */ - - /* Set return value for objects (not files) */ - if(oloc) - ret_value = oloc->file; - - /* Couldn't find a file struct */ - if(!ret_value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "object is not associated with a file") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5F__get_file */ - - /*------------------------------------------------------------------------- * Function: H5F_get_file_id * @@ -3669,8 +3597,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 +3609,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 +3617,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 +3635,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/H5Fpkg.h b/src/H5Fpkg.h index 6e2c994..b85305e 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -411,7 +411,6 @@ H5_DLL herr_t H5F__format_convert(H5F_t *f); H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); H5_DLL herr_t H5F__close(H5F_t *f); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); -H5_DLL H5F_t *H5F__get_file(void *obj, H5I_type_t type); H5_DLL herr_t H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info); /* File mount related routines */ 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); diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 125d6cf..f95f13d 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -344,7 +344,7 @@ H5F__cache_superblock_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *------------------------------------------------------------------------- */ static herr_t -H5F__cache_superblock_get_final_load_size(const void *_image, size_t image_len, +H5F__cache_superblock_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image_len, void *_udata, size_t *actual_len) { const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ @@ -434,7 +434,7 @@ H5F__cache_superblock_verify_chksum(const void *_image, size_t len, void *_udata *------------------------------------------------------------------------- */ static void * -H5F__cache_superblock_deserialize(const void *_image, size_t len, void *_udata, +H5F__cache_superblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5F_super_t *sblock = NULL; /* File's superblock */ @@ -867,7 +867,7 @@ H5F__cache_drvrinfo_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *i *------------------------------------------------------------------------- */ static herr_t -H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t image_len, +H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image_len, void *_udata, size_t *actual_len) { const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ @@ -911,7 +911,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5F__cache_drvrinfo_deserialize(const void *_image, size_t len, void *_udata, +H5F__cache_drvrinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5O_drvinfo_t *drvinfo = NULL; /* Driver info */ @@ -1006,7 +1006,7 @@ H5F__cache_drvrinfo_image_len(const void *_thing, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5F__cache_drvrinfo_serialize(const H5F_t *f, void *_image, size_t len, +H5F__cache_drvrinfo_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5O_drvinfo_t *drvinfo = (H5O_drvinfo_t *)_thing; /* Pointer to the object */ @@ -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. @@ -318,9 +341,9 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id) { void *grp = NULL; /* Structure for new group */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object 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); @@ -413,7 +436,7 @@ hid_t H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) { void *grp = NULL; /* Structure for new group */ - H5VL_object_t *vol_obj = NULL; /* Object token for loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object for loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -475,10 +498,10 @@ done: hid_t 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 */ + void *grp = NULL; /* Group opened */ + H5VL_object_t *vol_obj = NULL; /* object 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..126456b 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -173,10 +173,9 @@ hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) { void *grp = NULL; /* New group created */ - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object 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 */ @@ -269,7 +269,7 @@ hid_t H5Gopen1(hid_t loc_id, const char *name) { void *grp = NULL; /* Group opened */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -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) @@ -334,19 +334,19 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Create link */ if(type == H5L_TYPE_HARD) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; - H5VL_object_t tmp_vol_obj; /* Temporary object token of */ + H5VL_object_t tmp_vol_obj; /* Temporary object */ 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,16 +357,17 @@ 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) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; 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) @@ -415,20 +416,20 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* Create the appropriate kind of link */ if(type == H5L_TYPE_HARD) { - H5VL_object_t *vol_obj1; /* Object token of loc_id */ - H5VL_object_t *vol_obj2; /* Object token of loc_id */ + H5VL_object_t *vol_obj1; /* Object of loc_id */ + H5VL_object_t *vol_obj2; /* Object of loc_id */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; 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,11 +438,12 @@ 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) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Soft links only need one location, the new_loc_id, but it's possible that @@ -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 @@ -480,7 +483,7 @@ done: herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ @@ -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: @@ -525,9 +529,9 @@ herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name) { - H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */ + H5VL_object_t *vol_obj1 = NULL; /* Object of src_id */ H5VL_loc_params_t loc_params1; - H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ + H5VL_object_t *vol_obj2 = NULL; /* Object of dst_id */ H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ @@ -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: @@ -578,7 +583,7 @@ done: herr_t H5Gunlink(hid_t loc_id, const char *name) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -622,7 +627,7 @@ done: herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -675,7 +680,7 @@ done: herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -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: @@ -734,7 +739,7 @@ done: int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; ssize_t op_ret; /* Return value from operation */ int ret_value; /* Return value */ @@ -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 */ @@ -801,7 +806,7 @@ herr_t H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *op_data) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_obj; /* Index of last object looked at */ @@ -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 */ @@ -869,7 +874,7 @@ done: herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5I_type_t id_type; /* Type of ID */ H5VL_loc_params_t loc_params; H5G_info_t grp_info; /* Group information */ @@ -926,7 +931,7 @@ herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -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,52 +989,59 @@ 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 * a hard link, follow it and get info on the object */ - if (udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) { - H5O_info_t oinfo; /* Object information */ + if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) { + H5O_info2_t dm_info; /* Data model information */ + H5O_native_info_t nat_info; /* Native information */ + haddr_t obj_addr; /* Address of object */ - /* Go retrieve the object information */ + /* Go retrieve the data model & native object information */ /* (don't need index & heap info) */ HDassert(obj_loc); - if (H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_HDR) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info"); + if(H5O_get_info(obj_loc->oloc, &dm_info, H5O_INFO_BASIC | H5O_INFO_TIME) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get data model object info") + if(H5O_get_native_info(obj_loc->oloc, &nat_info, H5O_INFO_HDR) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get native object info") /* Get mapped object type */ - statbuf->type = H5G_map_obj_type(oinfo.type); + statbuf->type = H5G_map_obj_type(dm_info.type); /* Get object number (i.e. address) for object */ - statbuf->objno[0] = (unsigned long)(oinfo.addr); + if(H5VL_native_token_to_addr(obj_loc->oloc->file, H5I_FILE, dm_info.token, &obj_addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + + statbuf->objno[0] = (unsigned long)(obj_addr); #if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - statbuf->objno[1] = (unsigned long)(oinfo.addr >> 8 * sizeof(long)); + statbuf->objno[1] = (unsigned long)(obj_addr >> 8 * sizeof(long)); #else statbuf->objno[1] = 0; #endif /* Get # of hard links pointing to object */ - statbuf->nlink = oinfo.rc; + statbuf->nlink = dm_info.rc; /* Get modification time for object */ - statbuf->mtime = oinfo.ctime; + statbuf->mtime = dm_info.ctime; /* Retrieve the object header information */ - statbuf->ohdr.size = oinfo.hdr.space.total; - statbuf->ohdr.free = oinfo.hdr.space.free; - statbuf->ohdr.nmesgs = oinfo.hdr.nmesgs; - statbuf->ohdr.nchunks = oinfo.hdr.nchunks; - } - } + statbuf->ohdr.size = nat_info.hdr.space.total; + statbuf->ohdr.free = nat_info.hdr.space.free; + statbuf->ohdr.nmesgs = nat_info.hdr.nmesgs; + statbuf->ohdr.nchunks = nat_info.hdr.nchunks; + } /* end if */ + } /* end if */ done: /* Indicate that this callback didn't take ownership of the group * @@ -1084,7 +1096,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, /* If we're pointing at a soft or UD link, get the real link length and type */ if (statbuf && follow_link == 0) { - H5L_info_t linfo; /* Link information buffer */ + H5L_info2_t linfo; /* Link information buffer */ herr_t ret; /* Get information about link to the object. If this fails, e.g. @@ -1137,7 +1149,7 @@ done: ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; ssize_t ret_value; /* Return value */ @@ -1188,10 +1200,9 @@ done: H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - H5O_info_t oinfo; /* Object info (contains object type) */ - unsigned fields; /* Which fields in object info to populate */ + H5O_info2_t oinfo; /* Object info (contains object type) */ H5G_obj_t ret_value; /* Return value */ FUNC_ENTER_API(H5G_UNKNOWN) @@ -1211,8 +1222,7 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier") /* 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_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &oinfo, H5O_INFO_BASIC) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info") /* Map to group object type */ diff --git a/src/H5Gint.c b/src/H5Gint.c index 049c696..e0b8bd7 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -58,6 +58,7 @@ typedef struct { /* User data for application-style iteration over links in a group */ typedef struct { hid_t gid; /* The group ID for the application callback */ + H5O_loc_t *link_loc; /* The object location for the link */ H5G_link_iterate_t lnk_op; /* Application callback */ void *op_data; /* Application's op data */ } H5G_iter_appcall_ud_t; @@ -72,7 +73,7 @@ typedef struct { char *path; /* Path name of the link */ size_t curr_path_len; /* Current length of the path in the buffer */ size_t path_buf_size; /* Size of path buffer */ - H5L_iterate_t op; /* Application callback */ + H5L_iterate2_t op; /* Application callback */ void *op_data; /* Application's op data */ } H5G_iter_visit_ud_t; @@ -752,10 +753,10 @@ H5G_iterate_cb(const H5O_link_t *lnk, void *_udata) case H5G_LINK_OP_NEW: { - H5L_info_t info; /* Link info */ + H5L_info2_t info; /* Link info */ /* Retrieve the info for the link */ - if(H5G_link_to_info(lnk, &info) < 0) + if(H5G_link_to_info(udata->link_loc, lnk, &info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get info for link") /* Make the application callback */ @@ -812,6 +813,7 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name, /* Set up user data for callback */ udata.gid = gid; + udata.link_loc = &grp->oloc; udata.lnk_op = *lnk_op; udata.op_data = op_data; @@ -872,7 +874,7 @@ static herr_t H5G_visit_cb(const H5O_link_t *lnk, void *_udata) { H5G_iter_visit_ud_t *udata = (H5G_iter_visit_ud_t *)_udata; /* User data for callback */ - H5L_info_t info; /* Link info */ + H5L_info2_t info; /* Link info */ H5G_loc_t obj_loc; /* Location of object */ H5G_name_t obj_path; /* Object's group hier. path */ H5O_loc_t obj_oloc; /* Object's object location */ @@ -908,7 +910,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata) udata->curr_path_len += link_name_len; /* Construct the link info from the link message */ - if(H5G_link_to_info(lnk, &info) < 0) + if(H5G_link_to_info(udata->curr_loc->oloc, lnk, &info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get info for link") /* Make the application callback */ @@ -1044,7 +1046,7 @@ done: */ herr_t H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, H5L_iterate_t op, void *op_data) + H5_iter_order_t order, H5L_iterate2_t op, void *op_data) { H5G_iter_visit_ud_t udata; /* User data for callback */ H5O_linfo_t linfo; /* Link info message */ diff --git a/src/H5Glink.c b/src/H5Glink.c index 04ccbc5..6c42f1d 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -41,6 +41,8 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Ppublic.h" /* Property Lists */ +#include "H5VLnative_private.h" /* Native VOL connector */ + /****************/ /* Local Macros */ @@ -290,13 +292,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_link_to_info(const H5O_link_t *lnk, H5L_info_t *info) +H5G_link_to_info(const H5O_loc_t *link_loc, const H5O_link_t *lnk, H5L_info2_t *info) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ + HDassert(link_loc); HDassert(lnk); /* Get information from the link */ @@ -308,7 +311,9 @@ H5G_link_to_info(const H5O_link_t *lnk, H5L_info_t *info) switch(lnk->type) { case H5L_TYPE_HARD: - info->u.address = lnk->u.hard.addr; + /* Serialize the address into a VOL token */ + if(H5VL_native_addr_to_token(link_loc->file, H5I_FILE, lnk->u.hard.addr, &info->u.token) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token") break; case H5L_TYPE_SOFT: diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 40d56c6..4d89abb 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -73,15 +73,24 @@ typedef struct { H5G_loc_t *loc; /* Group location to set */ } H5G_loc_fbi_t; -/* User data for getting an object's info in a group */ +/* User data for getting an object's data model info in a group */ typedef struct { /* downward */ - unsigned fields; /* which fields in H5O_info_t struct to fill in */ + unsigned fields; /* which fields in H5O_info2_t struct to fill in */ /* upward */ - H5O_info_t *oinfo; /* Object information to retrieve */ + H5O_info2_t *oinfo; /* Object information to retrieve */ } H5G_loc_info_t; +/* User data for getting an object's native info in a group */ +typedef struct { + /* downward */ + unsigned fields; /* which fields in H5O_native_info_t struct to fill in */ + + /* upward */ + H5O_native_info_t *oinfo; /* Object information to retrieve */ +} H5G_loc_native_info_t; + /* User data for setting an object's comment in a group */ typedef struct { /* downward */ @@ -112,6 +121,12 @@ 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_native_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,9 +699,81 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_loc_info_cb + * Function: H5G__loc_addr_cb * - * Purpose: Callback for retrieving object info for an object in a group + * 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 data model info for an object in a group * * Return: Non-negative on success/Negative on failure * @@ -696,13 +783,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,13 +805,13 @@ done: *own_loc = H5G_OWN_NONE; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_loc_info_cb() */ +} /* end H5G__loc_info_cb() */ /*------------------------------------------------------------------------- * Function: H5G_loc_info * - * Purpose: Retrieve the information for an object from a group location + * Purpose: Retrieve the data model information for an object from a group location * and path to that object * * Return: Non-negative on success/Negative on failure @@ -735,7 +822,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo/*out*/, unsigned fields) +H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info2_t *oinfo/*out*/, unsigned fields) { H5G_loc_info_t udata; /* User data for traversal callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -752,7 +839,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: @@ -761,6 +848,84 @@ done: /*------------------------------------------------------------------------- + * Function: H5G__loc_native_info_cb + * + * Purpose: Callback for retrieving native info for an object in a group + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, November 23, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5G__loc_native_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_native_info_t *udata = (H5G_loc_native_info_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") + + /* Query object information */ + if(H5O_get_native_info(obj_loc->oloc, udata->oinfo, udata->fields) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object info") + +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_native_info_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_loc_native_info + * + * Purpose: Retrieve the native 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_native_info(const H5G_loc_t *loc, const char *name, H5O_native_info_t *oinfo/*out*/, + unsigned fields) +{ + H5G_loc_native_info_t udata; /* User data for traversal callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check args. */ + HDassert(loc); + HDassert(name && *name); + HDassert(oinfo); + + /* Set up user data for locating object */ + udata.fields = fields; + udata.oinfo = oinfo; + + /* Traverse group hierarchy to locate object */ + if(H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_native_info_cb, &udata) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_loc_native_info() */ + + +/*------------------------------------------------------------------------- * Function: H5G__loc_set_comment_cb * * Purpose: Callback for (re)setting object comment for an object in a group diff --git a/src/H5Gname.c b/src/H5Gname.c index 86a0c2f..4b0f04c 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -42,6 +42,8 @@ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory wrappers */ +#include "H5VLnative_private.h" /* Native VOL connector */ + /****************/ /* Local Macros */ @@ -1195,16 +1197,16 @@ 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 * *------------------------------------------------------------------------- */ static herr_t -H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info_t *linfo, +H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info2_t *linfo, void *_udata) { H5G_gnba_iter_t *udata = (H5G_gnba_iter_t *)_udata; /* User data for iteration */ @@ -1212,7 +1214,7 @@ H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info_t *linfo, H5G_name_t obj_path; /* Object's group hier. path */ H5O_loc_t obj_oloc; /* Object's object location */ hbool_t obj_found = FALSE; /* Object at 'path' found */ - herr_t ret_value = H5_ITER_CONT; /* Return value */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1223,31 +1225,39 @@ H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info_t *linfo, HDassert(udata->path == NULL); /* Check for hard link with correct address */ - if(linfo->type == H5L_TYPE_HARD && udata->loc->addr == linfo->u.address) { - H5G_loc_t grp_loc; /* Location of group */ - - /* Get group's location */ - if(H5G_loc(gid, &grp_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "bad group location") - - /* Set up opened object location to fill in */ - obj_loc.oloc = &obj_oloc; - obj_loc.path = &obj_path; - H5G_loc_reset(&obj_loc); - - /* Find the object */ - if(H5G_loc_find(&grp_loc, path, &obj_loc/*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "object not found") - obj_found = TRUE; - - /* Check for object in same file (handles mounted files) */ - /* (re-verify address, in case we traversed a file mount) */ - if(udata->loc->addr == obj_loc.oloc->addr && udata->loc->file == obj_loc.oloc->file) { - if(NULL == (udata->path = H5MM_strdup(path))) - HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, H5_ITER_ERROR, "can't duplicate path string") - - /* We found a match so we return immediately */ - HGOTO_DONE(H5_ITER_STOP) + if(linfo->type == H5L_TYPE_HARD) { + haddr_t link_addr; + + /* Retrieve hard link address from VOL token */ + if(H5VL_native_token_to_addr(udata->loc->file, H5I_FILE, linfo->u.token, &link_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + + if(udata->loc->addr == link_addr) { + H5G_loc_t grp_loc; /* Location of group */ + + /* Get group's location */ + if(H5G_loc(gid, &grp_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "bad group location") + + /* Set up opened object location to fill in */ + obj_loc.oloc = &obj_oloc; + obj_loc.path = &obj_path; + H5G_loc_reset(&obj_loc); + + /* Find the object */ + if(H5G_loc_find(&grp_loc, path, &obj_loc/*out*/) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "object not found") + obj_found = TRUE; + + /* Check for object in same file (handles mounted files) */ + /* (re-verify address, in case we traversed a file mount) */ + if(udata->loc->addr == obj_loc.oloc->addr && udata->loc->file == obj_loc.oloc->file) { + if(NULL == (udata->path = H5MM_strdup(path))) + HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, H5_ITER_ERROR, "can't duplicate path string") + + /* We found a match so we return immediately */ + HGOTO_DONE(H5_ITER_STOP) + } /* end if */ } /* end if */ } /* end if */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index b79b7d2..35b90f3 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -762,12 +762,11 @@ done: *------------------------------------------------------------------------- */ static H5B_ins_t -H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/, +H5G_node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key/*in,out*/, hbool_t H5_ATTR_UNUSED *lt_key_changed/*out*/, void *_udata/*in,out*/, void *_rt_key/*in,out*/, hbool_t *rt_key_changed/*out*/) { - H5G_node_key_t *lt_key = (H5G_node_key_t *)_lt_key; H5G_node_key_t *rt_key = (H5G_node_key_t *)_rt_key; H5G_bt_rm_t *udata = (H5G_bt_rm_t *)_udata; H5G_node_t *sn = NULL; @@ -781,7 +780,7 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/, /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); - HDassert(lt_key); + HDassert((H5G_node_key_t *)_lt_key); HDassert(rt_key); HDassert(udata && udata->common.heap); @@ -1256,7 +1255,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 +1273,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..19b120c 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -174,7 +174,7 @@ typedef struct { #ifndef H5_NO_DEPRECATED_SYMBOLS H5G_iterate_t op_old; /* "Old" application callback for each link */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - H5L_iterate_t op_new; /* "New" application callback for each link */ + H5L_iterate2_t op_new; /* "New" application callback for each link */ } op_func; } H5G_link_iterate_t; @@ -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); @@ -213,12 +214,12 @@ H5_DLL herr_t H5G_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, const H5G_link_iterate_t *lnk_op, void *op_data); H5_DLL herr_t H5G_visit(H5G_loc_t *loc, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data); + H5_index_t idx_type, H5_iter_order_t order, H5L_iterate2_t op, void *op_data); /* * Functions that understand links in groups */ -H5_DLL herr_t H5G_link_to_info(const struct H5O_link_t *lnk, H5L_info_t *linfo); +H5_DLL herr_t H5G_link_to_info(const struct H5O_loc_t *link_loc, const struct H5O_link_t *lnk, H5L_info2_t *linfo); /* * Functions that understand group objects @@ -278,7 +279,9 @@ H5_DLL herr_t H5G_loc_find_by_idx(const H5G_loc_t *loc, const char *group_name, H5G_loc_t *obj_loc/*out*/); H5_DLL htri_t H5G_loc_exists(const H5G_loc_t *loc, const char *name); H5_DLL herr_t H5G_loc_info(const H5G_loc_t *loc, const char *name, - H5O_info_t *oinfo/*out*/, unsigned fields); + H5O_info2_t *oinfo/*out*/, unsigned fields); +H5_DLL herr_t H5G_loc_native_info(const H5G_loc_t *loc, const char *name, + H5O_native_info_t *oinfo/*out*/, unsigned fields); H5_DLL herr_t H5G_loc_set_comment(const H5G_loc_t *loc, const char *name, const char *comment); H5_DLL ssize_t H5G_loc_get_comment(const H5G_loc_t *loc, const char *name, diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 492b5b9..7482e27 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -201,11 +201,15 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") /* User-defined callback function */ +#ifndef H5_NO_DEPRECATED_SYMBOLS /* (Backwardly compatible with v0 H5L_class_t traverssal callback) */ if(link_class->version == H5L_LINK_CLASS_T_VERS_0) cb_return = (((const H5L_class_0_t *)link_class)->trav_func)(lnk->name, cur_grp, lnk->u.ud.udata, lnk->u.ud.size, H5CX_get_lapl()); else cb_return = (link_class->trav_func)(lnk->name, cur_grp, lnk->u.ud.udata, lnk->u.ud.size, H5CX_get_lapl(), H5CX_get_dxpl()); +#else /* H5_NO_DEPRECATED_SYMBOLS */ + cb_return = (link_class->trav_func)(lnk->name, cur_grp, lnk->u.ud.udata, lnk->u.ud.size, H5CX_get_lapl(), H5CX_get_dxpl()); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Check for failing to locate the object */ if(cb_return < 0) { diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 2d1c1f2..4a2ff91 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -403,7 +403,7 @@ H5HF__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5HF__cache_hdr_get_final_load_size(const void *_image, size_t image_len, +H5HF__cache_hdr_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image_len, void *_udata, size_t *actual_len) { H5HF_hdr_t hdr; /* Temporary fractal heap header */ @@ -749,7 +749,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len, +H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5HF_hdr_t *hdr = (H5HF_hdr_t *)_thing; /* Fractal heap info */ @@ -979,8 +979,8 @@ H5HF__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UN *------------------------------------------------------------------------- */ static void * -H5HF__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty) +H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, + void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5HF_hdr_t *hdr; /* Shared fractal heap information */ H5HF_iblock_cache_ud_t *udata = (H5HF_iblock_cache_ud_t *)_udata; /* User data for callback */ @@ -1326,7 +1326,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t len, +H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5HF_hdr_t *hdr; /* Shared fractal heap information */ @@ -1471,8 +1471,8 @@ H5HF__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) else { /* if this is a child iblock, verify that the pointers are */ /* either uninitialized or set up correctly. */ - H5HF_indirect_t *par_iblock = iblock->parent; - unsigned indir_idx; /* Index in parent's child iblock pointer array */ + H5HF_indirect_t H5_ATTR_NDEBUG_UNUSED *par_iblock = iblock->parent; + unsigned H5_ATTR_NDEBUG_UNUSED indir_idx; /* Index in parent's child iblock pointer array */ /* Sanity check */ HDassert(par_iblock->child_iblocks); @@ -2438,8 +2438,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF__cache_dblock_serialize(const H5F_t *f, void *image, size_t len, - void *_thing) +H5HF__cache_dblock_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *image, + size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5HF_direct_t *dblock = (H5HF_direct_t *)_thing; /* Direct block info */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index f5ac8e5..c11bc34 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -1185,9 +1185,9 @@ H5HF__sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5 H5HF_indirect_t *iblock; /* Indirect block that section's direct block resides in */ haddr_t dblock_addr; /* Direct block address */ size_t dblock_size; /* Direct block size */ - size_t dblock_overhead; /* Direct block's overhead */ unsigned dblock_status = 0; /* Direct block's status in the metadata cache */ - herr_t status; /* Generic status value */ + size_t H5_ATTR_NDEBUG_UNUSED dblock_overhead; /* Direct block's overhead */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Generic status value */ /* Sanity check settings for section's direct block's parent */ iblock = sect->u.single.parent; @@ -2038,7 +2038,7 @@ H5HF__sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t const H5HF_hdr_t *hdr; /* Fractal heap header */ const H5HF_free_section_t *sect = (const H5HF_free_section_t *)_sect; /* Pointer to section to check */ const H5HF_free_section_t *indir_sect; /* Pointer to underlying indirect section */ - unsigned indir_idx; /* Index of row in underlying indirect section's row array */ + unsigned H5_ATTR_NDEBUG_UNUSED indir_idx; /* Index of row in underlying indirect section's row array */ FUNC_ENTER_STATIC_NOERR @@ -4125,7 +4125,7 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) dir_nrows = (max_dir_row - start_row) + 1; HDassert(dir_nrows == sect->u.indirect.dir_nrows); for(u = 0; u < dir_nrows; u++) { - const H5HF_free_section_t *tmp_row_sect; /* Pointer to row section */ + const H5HF_free_section_t H5_ATTR_NDEBUG_UNUSED *tmp_row_sect; /* Pointer to row section */ tmp_row_sect = sect->u.indirect.dir_rows[u]; HDassert(tmp_row_sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW @@ -4133,7 +4133,7 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) HDassert(tmp_row_sect->u.row.under == sect); HDassert(tmp_row_sect->u.row.row == (start_row + u)); if(u > 0) { - const H5HF_free_section_t *tmp_row_sect2; /* Pointer to row section */ + const H5HF_free_section_t H5_ATTR_NDEBUG_UNUSED *tmp_row_sect2; /* Pointer to row section */ tmp_row_sect2 = sect->u.indirect.dir_rows[u - 1]; HDassert(tmp_row_sect2->u.row.row < tmp_row_sect->u.row.row); @@ -4160,7 +4160,7 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) HDassert(tmp_child_sect->sect_info.type == H5HF_FSPACE_SECT_INDIRECT); HDassert(tmp_child_sect->u.indirect.parent == sect); if(u > 0) { - const H5HF_free_section_t *tmp_child_sect2; /* Pointer to child indirect section */ + const H5HF_free_section_t H5_ATTR_NDEBUG_UNUSED *tmp_child_sect2; /* Pointer to child indirect section */ tmp_child_sect2 = sect->u.indirect.indir_ents[u - 1]; HDassert(H5F_addr_lt(tmp_child_sect2->sect_info.addr, tmp_child_sect->sect_info.addr)); diff --git a/src/H5HFspace.c b/src/H5HFspace.c index 37a0502..ad5ff0f 100644 --- a/src/H5HFspace.c +++ b/src/H5HFspace.c @@ -447,7 +447,7 @@ H5HF__space_size(H5HF_hdr_t *hdr, hsize_t *fs_size) /* Get free space metadata size */ if(hdr->fspace) { - if(H5FS_size(hdr->f, hdr->fspace, fs_size) < 0) + if(H5FS_size(hdr->fspace, fs_size) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't retrieve FS meta storage info") } /* end if */ else 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/H5HGcache.c b/src/H5HGcache.c index 29e88df..18625cc 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -202,7 +202,7 @@ H5HG__cache_heap_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *imag *------------------------------------------------------------------------- */ static herr_t -H5HG__cache_heap_get_final_load_size(const void *image, size_t image_len, +H5HG__cache_heap_get_final_load_size(const void *image, size_t H5_ATTR_NDEBUG_UNUSED image_len, void *udata, size_t *actual_len) { H5HG_heap_t heap; /* Global heap */ @@ -432,7 +432,7 @@ H5HG__cache_heap_image_len(const void *_thing, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5HG__cache_heap_serialize(const H5F_t *f, void *image, size_t len, +H5HG__cache_heap_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *image, size_t len, void *_thing) { H5HG_heap_t *heap = (H5HG_heap_t *)_thing; 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); diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 8b04b47..b0ac05f 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -364,7 +364,7 @@ H5HL__cache_prefix_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *im *------------------------------------------------------------------------- */ static herr_t -H5HL__cache_prefix_get_final_load_size(const void *_image, size_t image_len, +H5HL__cache_prefix_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image_len, void *_udata, size_t *actual_len) { const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ @@ -415,8 +415,8 @@ done: *------------------------------------------------------------------------- */ static void * -H5HL__cache_prefix_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty) +H5HL__cache_prefix_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, + void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5HL_t *heap = NULL; /* Local heap */ H5HL_prfx_t *prfx = NULL; /* Heap prefix deserialized */ @@ -555,7 +555,7 @@ H5HL__cache_prefix_image_len(const void *_thing, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5HL__cache_prefix_serialize(const H5F_t *f, void *_image, size_t len, +H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5HL_prfx_t *prfx = (H5HL_prfx_t *)_thing; /* Pointer to local heap prefix to query */ @@ -826,8 +826,8 @@ H5HL__cache_datablock_image_len(const void *_thing, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5HL__cache_datablock_serialize(const H5F_t *f, void *image, size_t len, - void *_thing) +H5HL__cache_datablock_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *image, + size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5HL_t *heap; /* Pointer to the local heap */ H5HL_dblk_t *dblk = (H5HL_dblk_t *)_thing; /* Pointer to the local heap data block */ @@ -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 */ @@ -2220,7 +2219,7 @@ done: ssize_t H5Iget_name(hid_t id, char *name/*out*/, size_t size) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; ssize_t ret_value; /* Return value */ @@ -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 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..07c1965 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -78,7 +78,7 @@ ssize_t H5I__get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached) { - H5VL_object_t *vol_obj; /* Object token of id */ + H5VL_object_t *vol_obj; /* Object of id */ H5G_loc_t loc; /* Object location */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hbool_t vol_wrapper_set = FALSE;/* Whether the VOL object wrapping context was set up */ @@ -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; @@ -34,7 +34,7 @@ #include "H5Oprivate.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ #include "H5VLprivate.h" /* Virtual Object Layer */ - +#include "H5VLnative_private.h" /* Native VOL */ /****************/ /* Local Macros */ @@ -49,7 +49,7 @@ /* User data for path traversal routine for getting link info by name */ typedef struct { - H5L_info_t *linfo; /* Buffer to return to user */ + H5L_info2_t *linfo; /* Buffer to return to user */ } H5L_trav_gi_t; /* User data for path traversal callback to creating a link */ @@ -93,6 +93,7 @@ typedef struct { void *buf; /* User buffer */ } H5L_trav_gv_t; + /********************/ /* Local Prototypes */ /********************/ @@ -274,11 +275,11 @@ herr_t H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t lcpl_id, hid_t lapl_id) { - H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */ + H5VL_object_t *vol_obj1 = NULL; /* Object of src_id */ H5VL_loc_params_t loc_params1; - H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ + H5VL_object_t *vol_obj2 = NULL; /* Object of dst_id */ H5VL_loc_params_t loc_params2; - H5VL_object_t tmp_vol_obj; /* Temporary object token */ + H5VL_object_t tmp_vol_obj; /* Temporary object */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -364,11 +365,11 @@ herr_t H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t lcpl_id, hid_t lapl_id) { - H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */ + H5VL_object_t *vol_obj1 = NULL; /* Object of src_id */ H5VL_loc_params_t loc_params1; - H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ + H5VL_object_t *vol_obj2 = NULL; /* Object of dst_id */ H5VL_loc_params_t loc_params2; - H5VL_object_t tmp_vol_obj; /* Temporary object token */ + H5VL_object_t tmp_vol_obj; /* Temporary object */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -458,7 +459,7 @@ herr_t H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -486,6 +487,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 +501,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") @@ -529,9 +530,9 @@ herr_t H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id) { - H5VL_object_t *vol_obj1 = NULL; /* Object token of cur_loc_id */ - H5VL_object_t *vol_obj2 = NULL; /* Object token of new_loc_id */ - H5VL_object_t tmp_vol_obj; /* Temporary object token of */ + H5VL_object_t *vol_obj1 = NULL; /* Object of cur_loc_id */ + H5VL_object_t *vol_obj2 = NULL; /* Object of new_loc_id */ + H5VL_object_t tmp_vol_obj; /* Temporary object */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ @@ -631,7 +632,7 @@ herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -696,7 +697,7 @@ done: herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -753,7 +754,7 @@ herr_t H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -816,7 +817,7 @@ herr_t H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -872,7 +873,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -928,7 +929,7 @@ done: htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; htri_t ret_value = FAIL; /* Return value */ @@ -965,13 +966,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lget_info + * Function: H5Lget_info2 * - * Purpose: Gets metadata for a link. + * Purpose: Gets metadata for a link. * - * Return: Success: Non-negative with information in LINFO - * - * Failure: Negative + * Return: Success: Non-negative with information in LINFO + * Failure: Negative * * Programmer: James Laird * Wednesday, June 21, 2006 @@ -979,12 +979,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, +H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_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 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); @@ -1012,17 +1012,17 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, done: FUNC_LEAVE_API(ret_value) -} /* end H5Lget_info() */ +} /* end H5Lget_info2() */ /*------------------------------------------------------------------------- - * Function: H5Lget_info_by_idx + * Function: H5Lget_info_by_idx2 * - * 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 @@ -1030,13 +1030,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lget_info_by_idx(hid_t loc_id, const char *group_name, +H5Lget_info_by_idx2(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) + H5L_info2_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 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, @@ -1072,7 +1072,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, done: FUNC_LEAVE_API(ret_value) -} /* end H5Lget_info_by_idx() */ +} /* end H5Lget_info_by_idx2() */ /*------------------------------------------------------------------------- @@ -1115,6 +1115,10 @@ H5Lregister(const H5L_class_t *cls) */ if(cls->version > H5L_LINK_CLASS_T_VERS) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5L_class_t version number") +#ifdef H5_NO_DEPRECATED_SYMBOLS + if(cls->version < H5L_LINK_CLASS_T_VERS) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "deprecated H5L_class_t version number (%d) and library built without deprecated symbol support", cls->version) +#endif /* H5_NO_DEPRECATED_SYMBOLS */ if(cls->id < H5L_TYPE_UD_MIN || cls->id > H5L_TYPE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link identification number") @@ -1229,7 +1233,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; ssize_t ret_value = -1; /* Return value */ @@ -1272,7 +1276,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Literate + * Function: H5Literate2 * * Purpose: Iterates over links in a group, with user callback routine, * according to the order within an index. @@ -1290,10 +1294,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, - hsize_t *idx_p, H5L_iterate_t op, void *op_data) +H5Literate2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, + hsize_t *idx_p, H5L_iterate2_t op, void *op_data) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; H5I_type_t id_type; /* Type of ID */ herr_t ret_value; /* Return value */ @@ -1321,16 +1325,17 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.obj_type = H5I_get_type(group_id); /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (unsigned)FALSE, (int)idx_type, (int)order, idx_p, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (unsigned)FALSE, (int)idx_type, (int)order, idx_p, + op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: FUNC_LEAVE_API(ret_value) -} /* end H5Literate() */ +} /* end H5Literate2() */ /*------------------------------------------------------------------------- - * Function: H5Literate_by_name + * Function: H5Literate_by_name2 * * Purpose: Iterates over links in a group, with user callback routine, * according to the order within an index. @@ -1346,17 +1351,17 @@ done: * of the operators. * * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 16, 2006 * *------------------------------------------------------------------------- */ herr_t -H5Literate_by_name(hid_t loc_id, const char *group_name, +H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, - H5L_iterate_t op, void *op_data, hid_t lapl_id) + H5L_iterate2_t op, void *op_data, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ @@ -1391,7 +1396,8 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, + op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1400,7 +1406,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lvisit + * Function: H5Lvisit2 * * Purpose: Recursively visit all the links in a group and all * the groups that are linked to from that group. Links within @@ -1423,15 +1429,15 @@ done: * of the operators. * * Programmer: Quincey Koziol - * November 24 2007 + * November 24 2007 * *------------------------------------------------------------------------- */ herr_t -H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, - H5L_iterate_t op, void *op_data) +H5Lvisit2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, + H5L_iterate2_t op, void *op_data) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; H5I_type_t id_type; /* Type of ID */ herr_t ret_value; /* Return value */ @@ -1459,16 +1465,17 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, + op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: FUNC_LEAVE_API(ret_value) -} /* end H5Lvisit() */ +} /* end H5Lvisit2() */ /*------------------------------------------------------------------------- - * Function: H5Lvisit_by_name + * Function: H5Lvisit_by_name2 * * Purpose: Recursively visit all the links in a group and all * the groups that are linked to from that group. Links within @@ -1490,16 +1497,16 @@ done: * library, or the negative value returned by one * of the operators. * - * Programmer: Quincey Koziol - * November 3 2007 + * Programmer: Quincey Koziol + * November 3 2007 * *------------------------------------------------------------------------- */ herr_t -H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id) +H5Lvisit_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, H5L_iterate2_t op, void *op_data, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ @@ -1534,12 +1541,13 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* Visit the links */ - if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, + op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: FUNC_LEAVE_API(ret_value) -} /* end H5Lvisit_by_name() */ +} /* end H5Lvisit_by_name2() */ /* *------------------------------------------------------------------------- @@ -3143,7 +3151,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L__get_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, +H5L__get_info_cb(H5G_loc_t *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t *lnk, H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) { @@ -3157,7 +3165,7 @@ H5L__get_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNU HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist") /* Get information from the link */ - if(H5G_link_to_info(lnk, udata->linfo) < 0) + if(H5G_link_to_info(grp_loc->oloc, lnk, udata->linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info") done: @@ -3172,9 +3180,9 @@ done: /*------------------------------------------------------------------------- * Function: H5L_get_info * - * Purpose: Returns metadata about a link. + * 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 @@ -3182,7 +3190,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linfo/*out*/) +H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info2_t *linfo/*out*/) { H5L_trav_gi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3235,7 +3243,7 @@ H5L__get_info_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_A lnk_copied = TRUE; /* Get information from the link */ - if(H5G_link_to_info(&fnd_lnk, udata->linfo) < 0) + if(H5G_link_to_info(obj_loc->oloc, &fnd_lnk, udata->linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info") done: @@ -3263,7 +3271,7 @@ done: */ herr_t H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, H5L_info_t *linfo /*out*/) + H5_iter_order_t order, hsize_t n, H5L_info2_t *linfo /*out*/) { H5L_trav_gibi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3516,7 +3524,7 @@ done: */ herr_t H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data) + H5_iter_order_t order, hsize_t *idx_p, H5L_iterate2_t op, void *op_data) { H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_lnk; /* Index of last object looked at */ diff --git a/src/H5Ldeprec.c b/src/H5Ldeprec.c new file mode 100644 index 0000000..8b83230 --- /dev/null +++ b/src/H5Ldeprec.c @@ -0,0 +1,628 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Purpose: Deprecated functions from the H5L interface. These + * functions are here for compatibility purposes and may be + * removed in the future. Applications should switch to the + * newer APIs. + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Lmodule.h" /* This source code file is part of the H5L module */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lpkg.h" /* Links */ + +#include "H5VLnative_private.h" + +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + +/* Shim data for using native H5Literate/visit callbacks with the VOL */ +typedef struct H5L_shim_data_t { + H5L_iterate1_t real_op; + void *real_op_data; +} H5L_shim_data_t; + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5L__iterate2_shim + * + * Purpose: Shim function for translating between H5L_info2_t and + * H5L_info1_t structures, as used by H5Literate2/H5Lvisit2 + * and H5Literate1/H5Lvisit1, respectively. + * + * Return: Success: H5_ITER_CONT or H5_ITER_STOP + * Failure: H5_ITER_ERROR + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__iterate2_shim(hid_t group_id, const char *name, const H5L_info2_t *linfo2, void *op_data) +{ + H5L_shim_data_t *shim_data = (H5L_shim_data_t *)op_data; + H5L_info1_t linfo; + herr_t ret_value = H5_ITER_CONT; + + FUNC_ENTER_STATIC + + /* Copy the new-style members into the old-style struct */ + if (linfo2) { + linfo.type = linfo2->type; + linfo.corder_valid = linfo2->corder_valid; + linfo.corder = linfo2->corder; + linfo.cset = linfo2->cset; + if (H5L_TYPE_HARD == linfo2->type) { + if(H5VLnative_token_to_addr(group_id, linfo2->u.token, &linfo.u.address) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTUNSERIALIZE, H5_ITER_ERROR, "can't deserialize object token into address") + } + else + linfo.u.val_size = linfo2->u.val_size; + } + + /* Invoke the real callback */ + ret_value = shim_data->real_op(group_id, name, &linfo, shim_data->real_op_data); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__iterate2_shim() */ + + +/*------------------------------------------------------------------------- + * Function: H5Literate1 + * + * Purpose: Iterates over links in a group, with user callback routine, + * according to the order within an index. + * + * Same pattern of behavior as H5Giterate. + * + * Note: Deprecated in favor of H5Literate2 + * + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. + * + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. + * + *------------------------------------------------------------------------- + */ +herr_t +H5Literate1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, + hsize_t *idx_p, H5L_iterate1_t op, void *op_data) +{ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + H5I_type_t id_type; /* Type of ID */ + H5L_shim_data_t shim_data; + hbool_t is_native_vol_obj; + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "iIiIo*hx*x", group_id, idx_type, order, idx_p, op, op_data); + + /* Check arguments */ + id_type = H5I_get_type(group_id); + if (!(H5I_GROUP == id_type || H5I_FILE == id_type)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") + if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if (!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + + /* Get the location object */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Literate1 is only meant to be used with the native VOL connector") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(group_id); + + /* Set up shim */ + shim_data.real_op = op; + shim_data.real_op_data = op_data; + + /* Iterate over the links */ + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (unsigned)FALSE, (int)idx_type, (int)order, idx_p, + H5L__iterate2_shim, (void *)&shim_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Literate1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Literate_by_name1 + * + * Purpose: Iterates over links in a group, with user callback routine, + * according to the order within an index. + * + * Same pattern of behavior as H5Giterate. + * + * Note: Deprecated in favor of H5Literate_by_name2 + * + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. + * + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. + * + * + * Programmer: Quincey Koziol + * Thursday, November 16, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Literate_by_name1(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, + H5L_iterate1_t op, void *op_data, hid_t lapl_id) +{ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + H5L_shim_data_t shim_data; + hbool_t is_native_vol_obj; + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, group_name, idx_type, order, idx_p, op, + op_data, lapl_id); + + /* Check arguments */ + if(!group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL") + if(!*group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string") + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Literate_by_name1 is only meant to be used with the native VOL connector") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = group_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + + /* Set up shim */ + shim_data.real_op = op; + shim_data.real_op_data = op_data; + + /* Iterate over the links */ + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, + H5L__iterate2_shim, (void *)&shim_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Literate_by_name1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Lget_info1 + * + * Purpose: Gets metadata for a link. + * + * Note: Deprecated in favor of H5Lget_info2 + * + * Return: Success: Non-negative with information in LINFO + * Failure: Negative + * + * Programmer: James Laird + * Wednesday, June 21, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, + hid_t lapl_id) +{ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ + H5VL_loc_params_t loc_params; + H5L_info2_t linfo2; /* New-style link info */ + hbool_t is_native_vol_obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id); + + /* Check arguments */ + if(!name || !*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, 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.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Lget_info1 is only meant to be used with the native VOL connector") + + /* Get the link information */ + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &linfo2) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + + /* Copy the new-style members into the old-style struct */ + if(linfo) { + linfo->type = linfo2.type; + linfo->corder_valid = linfo2.corder_valid; + linfo->corder = linfo2.corder; + linfo->cset = linfo2.cset; + if(H5L_TYPE_HARD == linfo2.type) { + void *vol_obj_data; + + if(NULL == (vol_obj_data = H5VL_object_data(vol_obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object") + + if(H5VL_native_token_to_addr(vol_obj_data, loc_params.obj_type, linfo2.u.token, &linfo->u.address) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + } /* end if */ + else + linfo->u.val_size = linfo2.u.val_size; + } /* end if */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Lget_info1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Lget_info_by_idx1 + * + * Purpose: Gets metadata for a link, according to the order within an + * index. + * + * Note: Deprecated in favor of H5Lget_info_by_idx2 + * + * Return: Success: Non-negative with information in LINFO + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, November 6, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + H5L_info1_t *linfo /*out*/, hid_t lapl_id) +{ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ + H5VL_loc_params_t loc_params; + H5L_info2_t linfo2; /* New-style link info */ + hbool_t is_native_vol_obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, linfo, + lapl_id); + + /* Check arguments */ + if(!group_name || !*group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Lget_info_by_idx1 is only meant to be used with the native VOL connector") + + /* Get the link information */ + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &linfo2) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + + /* Copy the new-style members into the old-style struct */ + if(linfo) { + linfo->type = linfo2.type; + linfo->corder_valid = linfo2.corder_valid; + linfo->corder = linfo2.corder; + linfo->cset = linfo2.cset; + if(H5L_TYPE_HARD == linfo2.type) { + void *vol_obj_data; + + if(NULL == (vol_obj_data = H5VL_object_data(vol_obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object") + + if(H5VL_native_token_to_addr(vol_obj_data, loc_params.obj_type, linfo2.u.token, &linfo->u.address) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + } /* end if */ + else + linfo->u.val_size = linfo2.u.val_size; + } /* end if */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Lget_info_by_idx1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Lvisit1 + * + * Purpose: Recursively visit all the links in a group and all + * the groups that are linked to from that group. Links within + * each group are visited according to the order within the + * specified index (unless the specified index does not exist for + * a particular group, then the "name" index is used). + * + * NOTE: Each _link_ reachable from the initial group will only be + * visited once. However, because an object may be reached from + * more than one link, the visitation may call the application's + * callback with more than one link that points to a particular + * _object_. + * + * Note: Deprecated in favor of H5Lvisit2 + * + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. + * + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. + * + * Programmer: Quincey Koziol + * November 24 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Lvisit1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, + H5L_iterate1_t op, void *op_data) +{ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + H5I_type_t id_type; /* Type of ID */ + H5L_shim_data_t shim_data; + hbool_t is_native_vol_obj; + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "iIiIox*x", group_id, idx_type, order, op, op_data); + + /* Check args */ + id_type = H5I_get_type(group_id); + if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(group_id); + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Lvisit1 is only meant to be used with the native VOL connector") + + /* Set up shim */ + shim_data.real_op = op; + shim_data.real_op_data = op_data; + + /* Iterate over the links */ + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, TRUE, idx_type, order, NULL, H5L__iterate2_shim, (void *)&shim_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Lvisit1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Lvisit_by_name1 + * + * Purpose: Recursively visit all the links in a group and all + * the groups that are linked to from that group. Links within + * each group are visited according to the order within the + * specified index (unless the specified index does not exist for + * a particular group, then the "name" index is used). + * + * NOTE: Each _link_ reachable from the initial group will only be + * visited once. However, because an object may be reached from + * more than one link, the visitation may call the application's + * callback with more than one link that points to a particular + * _object_. + * + * Note: Deprecated in favor of H5Lvisit_by_name2 + * + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. + * + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. + * + * Programmer: Quincey Koziol + * November 3 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, H5L_iterate1_t op, void *op_data, hid_t lapl_id) +{ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + H5L_shim_data_t shim_data; + hbool_t is_native_vol_obj; + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "i*sIiIox*xi", loc_id, group_name, idx_type, order, op, op_data, + lapl_id); + + /* Check args */ + if(!group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL") + if(!*group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string") + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Lvisit_by_name1 is only meant to be used with the native VOL connector") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = group_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + + /* Set up shim */ + shim_data.real_op = op; + shim_data.real_op_data = op_data; + + /* Visit the links */ + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, TRUE, idx_type, order, NULL, H5L__iterate2_shim, (void *)&shim_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Lvisit_by_name1() */ + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index e075ed7..1b007b6 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -341,7 +341,7 @@ herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; char *norm_obj_name = NULL; /* Pointer to normalized current name */ void *ext_link_buf = NULL; /* Buffer to contain external link */ @@ -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..ab68b84 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -63,12 +63,12 @@ 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 */ /* Out */ - H5L_info_t *linfo; /* Buffer to return to user */ + H5L_info2_t *linfo; /* Buffer to return to user */ } H5L_trav_gibi_t; /* User data for path traversal routine for getting name by index */ @@ -98,7 +98,6 @@ typedef struct H5L_elink_cb_t { void *user_data; } H5L_elink_cb_t; - /*****************************/ /* Library Private Variables */ /*****************************/ @@ -124,13 +123,13 @@ H5_DLL herr_t H5L_move(const H5G_loc_t *src_loc, const char *src_name, H5_DLL htri_t H5L_exists_tolerant(const H5G_loc_t *loc, const char *name); H5_DLL htri_t H5L_exists(const H5G_loc_t *loc, const char *name); H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name, - H5L_info_t *linkbuf/*out*/); + H5L_info2_t *linkbuf/*out*/); H5_DLL herr_t H5L_delete(const H5G_loc_t *loc, const char *name); H5_DLL herr_t H5L_delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n); H5_DLL herr_t H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - H5L_info_t *linfo /*out*/); + H5L_info2_t *linfo /*out*/); H5_DLL ssize_t H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size); @@ -142,7 +141,7 @@ H5_DLL herr_t H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_DLL herr_t H5L_register_external(void); H5_DLL herr_t H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, - H5L_iterate_t op, void *op_data); + H5L_iterate2_t op, void *op_data); /* User-defined link functions */ H5_DLL herr_t H5L_register(const H5L_class_t *cls); diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index 7bdb001..3bac5ac 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -27,6 +27,7 @@ /* Public headers needed by this file */ #include "H5public.h" /* Generic Functions */ #include "H5Ipublic.h" /* IDs */ +#include "H5Opublic.h" /* Object Headers */ #include "H5Tpublic.h" /* Datatypes */ /*****************/ @@ -43,9 +44,6 @@ /* Current version of the H5L_class_t struct */ #define H5L_LINK_CLASS_T_VERS 1 -/* Previous versions of the H5L_class_t struct */ -#define H5L_LINK_CLASS_T_VERS_0 0 - #ifdef __cplusplus extern "C" { #endif @@ -72,17 +70,19 @@ typedef enum { #define H5L_TYPE_BUILTIN_MAX H5L_TYPE_SOFT /* Maximum value link value for "built-in" link types */ #define H5L_TYPE_UD_MIN H5L_TYPE_EXTERNAL /* Link ids at or above this value are "user-defined" link types. */ -/* Information struct for link (for H5Lget_info/H5Lget_info_by_idx) */ +/* Information struct for link (for H5Lget_info2/H5Lget_info_by_idx2) + * H5O_token_t version used in VOL layer and future public API calls + */ typedef struct { H5L_type_t type; /* Type of link */ hbool_t corder_valid; /* Indicate if creation order is valid */ int64_t corder; /* Creation order */ H5T_cset_t cset; /* Character set of link name */ union { - haddr_t address; /* Address hard link points to */ + H5O_token_t token; /* Token of location that hard link points to */ size_t val_size; /* Size of a soft link or UD link value */ } u; -} H5L_info_t; +} H5L_info2_t; /* The H5L_class_t struct can be used to override the behavior of a * "user-defined" link class. Users should populate the struct with callback @@ -102,8 +102,6 @@ typedef herr_t (*H5L_copy_func_t)(const char *new_name, hid_t new_loc, const void *lnkdata, size_t lnkdata_size); /* Callback during link traversal */ -typedef hid_t (*H5L_traverse_0_func_t)(const char *link_name, hid_t cur_group, - const void *lnkdata, size_t lnkdata_size, hid_t lapl_id); typedef hid_t (*H5L_traverse_func_t)(const char *link_name, hid_t cur_group, const void *lnkdata, size_t lnkdata_size, hid_t lapl_id, hid_t dxpl_id); @@ -116,19 +114,6 @@ typedef herr_t (*H5L_delete_func_t)(const char *link_name, hid_t file, typedef ssize_t (*H5L_query_func_t)(const char *link_name, const void *lnkdata, size_t lnkdata_size, void *buf /*out*/, size_t buf_size); -/* User-defined link types */ -typedef struct { - int version; /* Version number of this struct */ - H5L_type_t id; /* Link type ID */ - const char *comment; /* Comment for debugging */ - H5L_create_func_t create_func; /* Callback during link creation */ - H5L_move_func_t move_func; /* Callback after moving link */ - H5L_copy_func_t copy_func; /* Callback after copying link */ - H5L_traverse_0_func_t trav_func; /* Callback during link traversal */ - H5L_delete_func_t del_func; /* Callback for link deletion */ - H5L_query_func_t query_func; /* Callback for queries */ -} H5L_class_0_t; - typedef struct { int version; /* Version number of this struct */ H5L_type_t id; /* Link type ID */ @@ -141,8 +126,10 @@ typedef struct { H5L_query_func_t query_func; /* Callback for queries */ } H5L_class_t; -/* Prototype for H5Literate/H5Literate_by_name() operator */ -typedef herr_t (*H5L_iterate_t)(hid_t group, const char *name, const H5L_info_t *info, +/* Prototype for H5Literate2/H5Literate_by_name2() operator + * H5O_token_t version used in VOL layer and future public API calls + */ +typedef herr_t (*H5L_iterate2_t)(hid_t group, const char *name, const H5L_info2_t *info, void *op_data); /* Callback for external link traversal */ @@ -177,23 +164,23 @@ H5_DLL herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size, hid_t lapl_id); H5_DLL htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id); -H5_DLL herr_t H5Lget_info(hid_t loc_id, const char *name, - H5L_info_t *linfo /*out*/, hid_t lapl_id); -H5_DLL herr_t H5Lget_info_by_idx(hid_t loc_id, const char *group_name, +H5_DLL herr_t H5Lget_info2(hid_t loc_id, const char *name, + H5L_info2_t *linfo /*out*/, hid_t lapl_id); +H5_DLL herr_t H5Lget_info_by_idx2(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); + H5L_info2_t *linfo /*out*/, hid_t lapl_id); H5_DLL ssize_t H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size, hid_t lapl_id); -H5_DLL herr_t H5Literate(hid_t grp_id, H5_index_t idx_type, - H5_iter_order_t order, hsize_t *idx, H5L_iterate_t op, void *op_data); -H5_DLL herr_t H5Literate_by_name(hid_t loc_id, const char *group_name, +H5_DLL herr_t H5Literate2(hid_t grp_id, H5_index_t idx_type, + H5_iter_order_t order, hsize_t *idx, H5L_iterate2_t op, void *op_data); +H5_DLL herr_t H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, - H5L_iterate_t op, void *op_data, hid_t lapl_id); -H5_DLL herr_t H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, - H5L_iterate_t op, void *op_data); -H5_DLL herr_t H5Lvisit_by_name(hid_t loc_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, + H5L_iterate2_t op, void *op_data, hid_t lapl_id); +H5_DLL herr_t H5Lvisit2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, + H5L_iterate2_t op, void *op_data); +H5_DLL herr_t H5Lvisit_by_name2(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, H5L_iterate2_t op, void *op_data, hid_t lapl_id); /* UD link functions */ @@ -210,6 +197,73 @@ H5_DLL herr_t H5Lunpack_elink_val(const void *ext_linkval/*in*/, size_t link_siz H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id); +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/* Macros */ + +/* Previous versions of the H5L_class_t struct */ +#define H5L_LINK_CLASS_T_VERS_0 0 + + +/* Typedefs */ + +/* Information struct for link (for H5Lget_info1/H5Lget_info_by_idx1) */ +typedef struct { + H5L_type_t type; /* Type of link */ + hbool_t corder_valid; /* Indicate if creation order is valid */ + int64_t corder; /* Creation order */ + H5T_cset_t cset; /* Character set of link name */ + union { + haddr_t address; /* Address hard link points to */ + size_t val_size; /* Size of a soft link or UD link value */ + } u; +} H5L_info1_t; + +/* Callback during link traversal */ +typedef hid_t (*H5L_traverse_0_func_t)(const char *link_name, hid_t cur_group, + const void *lnkdata, size_t lnkdata_size, hid_t lapl_id); + +/* User-defined link types */ +typedef struct { + int version; /* Version number of this struct */ + H5L_type_t id; /* Link type ID */ + const char *comment; /* Comment for debugging */ + H5L_create_func_t create_func; /* Callback during link creation */ + H5L_move_func_t move_func; /* Callback after moving link */ + H5L_copy_func_t copy_func; /* Callback after copying link */ + H5L_traverse_0_func_t trav_func; /* Callback during link traversal */ + H5L_delete_func_t del_func; /* Callback for link deletion */ + H5L_query_func_t query_func; /* Callback for queries */ +} H5L_class_0_t; + +/* Prototype for H5Literate1/H5Literate_by_name1() operator */ +typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_t *info, + void *op_data); + + +/* Function prototypes */ +H5_DLL herr_t H5Lget_info1(hid_t loc_id, const char *name, + H5L_info1_t *linfo /*out*/, hid_t lapl_id); +H5_DLL herr_t H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + H5L_info1_t *linfo /*out*/, hid_t lapl_id); +H5_DLL herr_t H5Literate1(hid_t grp_id, H5_index_t idx_type, + H5_iter_order_t order, hsize_t *idx, H5L_iterate1_t op, void *op_data); +H5_DLL herr_t H5Literate_by_name1(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, + H5L_iterate1_t op, void *op_data, hid_t lapl_id); +H5_DLL herr_t H5Lvisit1(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, + H5L_iterate1_t op, void *op_data); +H5_DLL herr_t H5Lvisit_by_name1(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, H5L_iterate1_t op, + void *op_data, hid_t lapl_id); + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + #ifdef __cplusplus } #endif @@ -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 */ @@ -233,7 +256,7 @@ H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, hid_t lcpl_id, hid_t mcpl_id, hid_t mapl_id) { void *map = NULL; /* New map's info */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -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) @@ -320,8 +343,8 @@ hid_t H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, hid_t mcpl_id, hid_t mapl_id) { - void *map = NULL; /* map token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *map = NULL; /* map object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return 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) @@ -384,8 +407,8 @@ done: hid_t H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id) { - void *map = NULL; /* map token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *map = NULL; /* map object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return 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: @@ -2290,7 +2290,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) /* Retrieve free space size from free space manager */ if(H5FS_sect_stats(f->shared->fs_man[type], &type_fs_size, NULL) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space stats") - if(H5FS_size(f, f->shared->fs_man[type], &type_meta_size) < 0) + if(H5FS_size(f->shared->fs_man[type], &type_meta_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space metadata stats") /* Increment total free space for types */ 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); /*****************************/ @@ -102,7 +102,7 @@ hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5I_type_t opened_type; void *opened_obj = NULL; H5VL_loc_params_t loc_params; @@ -171,7 +171,7 @@ hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5I_type_t opened_type; void *opened_obj = NULL; H5VL_loc_params_t loc_params; @@ -217,57 +217,34 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oopen_by_addr + * Function: H5Oopen_by_token * - * Purpose: Warning! This function is EXTREMELY DANGEROUS! - * Improper use can lead to FILE CORRUPTION, INACCESSIBLE DATA, - * and other VERY BAD THINGS! + * Purpose: Same as H5Oopen_by_addr, but uses VOL-independent tokens. * - * This function opens an object using its address within the - * HDF5 file, similar to an HDF5 hard link. The open object - * is identical to an object opened with H5Oopen() and should - * be closed with H5Oclose() or a type-specific closing - * function (such as H5Gclose() ). - * - * This function is very dangerous if called on an invalid - * address. For this reason, H5Oincr_refcount() should be - * used to prevent HDF5 from deleting any object that is - * referenced by address (e.g. by a user-defined link). - * H5Odecr_refcount() should be used when the object is - * no longer being referenced by address (e.g. when the UD link - * is deleted). - * - * The address of the HDF5 file on disk has no effect on - * H5Oopen_by_addr(), nor does the use of any unusual file - * drivers. The "address" is really the offset within the - * HDF5 file, and HDF5's file drivers will transparently - * map this to an address on disk for the filesystem. + * Return: Success: An open object identifier + * Failure: H5I_INVALID_HID * - * Return: Success: An open object identifier - * Failure: H5I_INVALID_HID - * - * Programmer: James Laird - * July 14 2006 + * Programmer: Dana Robinson + * Winter 2019 * *------------------------------------------------------------------------- */ hid_t -H5Oopen_by_addr(hid_t loc_id, haddr_t addr) +H5Oopen_by_token(hid_t loc_id, H5O_token_t token) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ H5I_type_t opened_type; /* Opened object type */ void *opened_obj = NULL; /* Opened object */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ - hid_t file_id = H5I_INVALID_HID; /* File ID */ - void *vol_obj_file = NULL; /* Object token of file_id */ - H5F_t *f = NULL; - uint8_t *p = NULL; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) - H5TRACE2("i", "ia", loc_id, addr); + H5TRACE2("i", "ik", loc_id, token); + + /* Check args */ + if(H5O_IS_TOKEN_UNDEF(token)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "can't open H5O_TOKEN_UNDEF") /* Get the location object */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) @@ -277,39 +254,21 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) if((vol_obj_type = H5I_get_type(loc_id)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") - /* Get the file for the object */ - if((file_id = H5F_get_file_id(vol_obj, vol_obj_type, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file or file object") - - /* Retrieve VOL object */ - if(NULL == (vol_obj_file = H5VL_vol_object(file_id))) - 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))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL object") - - /* This is a native specific routine that requires serialization of the token */ - p = (uint8_t *)&obj_token; - H5F_addr_encode(f, &p, addr); - loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = &obj_token; + loc_params.loc_data.loc_by_token.token = &token; loc_params.obj_type = vol_obj_type; /* Open the object */ if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") - /* Register the dataset ID */ + /* Register the object's ID */ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") 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") FUNC_LEAVE_API(ret_value) -} /* end H5Oopen_by_addr() */ +} /* end H5Oopen_by_token() */ /*------------------------------------------------------------------------- @@ -337,9 +296,9 @@ herr_t H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id) { - H5VL_object_t *vol_obj1 = NULL; /* object token of obj_id */ - H5VL_object_t *vol_obj2 = NULL; /* object token of new_loc_id */ - H5VL_object_t tmp_vol_obj; /* Temporary object token of */ + H5VL_object_t *vol_obj1 = NULL; /* object of obj_id */ + H5VL_object_t *vol_obj2 = NULL; /* object of new_loc_id */ + H5VL_object_t tmp_vol_obj; /* Temporary object */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ @@ -429,7 +388,7 @@ done: herr_t H5Oincr_refcount(hid_t object_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; @@ -479,7 +438,7 @@ done: herr_t H5Odecr_refcount(hid_t object_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -522,7 +481,7 @@ done: htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; htri_t ret_value = FAIL; /* Return value */ @@ -559,23 +518,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oget_info2 + * Function: H5Oget_info3 * * Purpose: Retrieve information about an object. * - * NOTE: Add a parameter "fields" to indicate selection of object info. - * * Return: SUCCEED/FAIL * - * Programmer: Neil Fortner - * July 7 2010 + * Programmer: Dana Robinson + * Fall 2019 * *------------------------------------------------------------------------- */ herr_t -H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) +H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo, unsigned fields) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -597,33 +554,31 @@ 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) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object") done: FUNC_LEAVE_API(ret_value) -} /* end H5Oget_info2() */ +} /* end H5Oget_info3() */ /*------------------------------------------------------------------------- - * Function: H5Oget_info_by_name2 + * Function: H5Oget_info_by_name3 * * Purpose: Retrieve information about an object * - * NOTE: Add a parameter "fields" to indicate selection of object info. - * * Return: SUCCEED/FAIL * - * Programmer: Neil Fortner - * July 7 2010 + * Programmer: Dana Robinson + * Fall 2019 * *------------------------------------------------------------------------- */ herr_t -H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, - unsigned fields, hid_t lapl_id) +H5Oget_info_by_name3(hid_t loc_id, const char *name, + H5O_info2_t *oinfo, unsigned fields, hid_t lapl_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -655,35 +610,33 @@ 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) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) + if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object") done: FUNC_LEAVE_API(ret_value) -} /* end H5Oget_info_by_name2() */ +} /* end H5Oget_info_by_name3() */ /*------------------------------------------------------------------------- - * Function: H5Oget_info_by_idx2 - * - * Purpose: Retrieve information about an object, according to the order - * of an index. + * Function: H5Oget_info_by_idx3 * - * NOTE: Add a parameter "fields" to indicate selection of object info. + * Purpose: Retrieve information about an object, according to + * the order of an index. * * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * November 26 2006 + * Programmer: Dana Robinson + * Fall 2019 * *------------------------------------------------------------------------- */ herr_t -H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id) +H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, H5O_info2_t *oinfo, unsigned fields, hid_t lapl_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -720,12 +673,176 @@ 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) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_info_by_idx3() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oget_native_info + * + * Purpose: Retrieve native file format information about an object. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo, unsigned fields) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "i*xIu", loc_id, oinfo, fields); + + /* Check args */ + if(!oinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") + if(fields & ~H5O_NATIVE_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + 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_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object") done: FUNC_LEAVE_API(ret_value) -} /* end H5Oget_info_by_idx2() */ +} /* end H5Oget_native_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oget_native_info_by_name + * + * Purpose: Retrieve native file format information about an object + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oinfo, + unsigned fields, hid_t lapl_id) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "i*s*xIui", loc_id, name, oinfo, fields, lapl_id); + + /* Check args */ + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") + if(!oinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") + if(fields & ~H5O_NATIVE_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Fill out location struct */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + 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_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object: '%s'", name) + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_native_info_by_name() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oget_native_info_by_idx + * + * Purpose: Retrieve native file format information about an object, + * according to the order of an index. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Dana Robinson + * Fall 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, H5O_native_info_t *oinfo, unsigned fields, hid_t lapl_id) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE8("e", "i*sIiIoh*xIui", loc_id, group_name, idx_type, order, n, oinfo, + fields, lapl_id); + + /* Check args */ + if(!group_name || !*group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!oinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + if(fields & ~H5O_NATIVE_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + 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_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_native_info_by_idx() */ /*------------------------------------------------------------------------- @@ -748,7 +865,7 @@ done: herr_t H5Oset_comment(hid_t obj_id, const char *comment) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -768,7 +885,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: @@ -797,7 +914,7 @@ herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -823,7 +940,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: @@ -850,9 +967,9 @@ done: ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - ssize_t ret_value = -1; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize); @@ -866,7 +983,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: @@ -894,9 +1011,9 @@ ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize, hid_t lapl_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - ssize_t ret_value = -1; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE5("Zs", "i*s*szi", loc_id, name, comment, bufsize, lapl_id); @@ -920,7 +1037,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: @@ -929,7 +1046,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ovisit2 + * Function: H5Ovisit3 * * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects @@ -964,12 +1081,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, - H5O_iterate_t op, void *op_data, unsigned fields) +H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, + H5O_iterate2_t op, void *op_data, unsigned fields) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - herr_t ret_value; /* Return value */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iIiIox*xIu", obj_id, idx_type, order, op, op_data, fields); @@ -998,11 +1115,11 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, done: FUNC_LEAVE_API(ret_value) -} /* end H5Ovisit2() */ +} /* end H5Ovisit3() */ /*------------------------------------------------------------------------- - * Function: H5Ovisit_by_name2 + * Function: H5Ovisit_by_name3 * * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects @@ -1037,12 +1154,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, - H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields, hid_t lapl_id) +H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t idx_type, + H5_iter_order_t order, H5O_iterate2_t op, void *op_data, unsigned fields, hid_t lapl_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ - H5VL_loc_params_t loc_params; - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE8("e", "i*sIiIox*xIui", loc_id, obj_name, idx_type, order, op, op_data, @@ -1082,7 +1199,7 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, done: FUNC_LEAVE_API(ret_value) -} /* end H5Ovisit_by_name2() */ +} /* end H5Ovisit_by_name3() */ /*------------------------------------------------------------------------- @@ -1187,7 +1304,7 @@ done: herr_t H5Odisable_mdc_flushes(hid_t object_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1207,7 +1324,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: @@ -1256,7 +1373,7 @@ done: herr_t H5Oenable_mdc_flushes(hid_t object_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1264,11 +1381,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 +1393,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: @@ -1330,7 +1447,7 @@ done: herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1338,15 +1455,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,10 +1471,132 @@ 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: FUNC_LEAVE_API(ret_value) } /* H5Oare_mdc_flushes_disabled() */ + +/*--------------------------------------------------------------------------- + * Function: H5Otoken_cmp + * + * Purpose: Compares two VOL connector object tokens + * + * Note: Both object tokens must be from the same VOL connector class + * + * Return: Success: Non-negative, with *cmp_value set to positive if + * token1 is greater than token2, negative if token2 + * is greater than token1 and zero if token1 and + * token2 are equal. + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2, + int *cmp_value) +{ + H5VL_object_t *vol_obj; /* VOL object for ID */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "i*k*k*Is", loc_id, token1, token2, cmp_value); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + if(NULL == cmp_value) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid cmp_value pointer") + + /* Compare the two tokens */ + if(H5VL_token_cmp(vol_obj, token1, token2, cmp_value) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "object token comparison failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Otoken_cmp() */ + + +/*--------------------------------------------------------------------------- + * Function: H5Otoken_to_str + * + * Purpose: Serialize a connector's object token into a string + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str) +{ + H5VL_object_t *vol_obj; /* VOL object for ID */ + H5I_type_t vol_obj_type; /* VOL object's type */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "i*k**s", loc_id, token, token_str); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + if(NULL == token) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer") + if(NULL == token_str) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token string pointer") + + /* Get object type */ + if((vol_obj_type = H5I_get_type(loc_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object type") + + /* Serialize the token */ + if(H5VL_token_to_str(vol_obj, vol_obj_type, token, token_str) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "object token serialization failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Otoken_to_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5Otoken_from_str + * + * Purpose: Deserialize a string into a connector object token + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token) +{ + H5VL_object_t *vol_obj; /* VOL object for ID */ + H5I_type_t vol_obj_type; /* VOL object's type */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "i*s*k", loc_id, token_str, token); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + if(NULL == token) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer") + if(NULL == token_str) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token string pointer") + + /* Get object type */ + if((vol_obj_type = H5I_get_type(loc_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object type") + + /* Deserialize the token */ + if(H5VL_token_from_str(vol_obj, vol_obj_type, token_str, token) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "object token deserialization failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Otoken_from_str() */ + diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 7f4f17f..2d95ee9 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; @@ -334,7 +334,7 @@ H5O__ainfo_free(void *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O__ainfo_delete(H5F_t *f, H5O_t *open_oh, void *_mesg) +H5O__ainfo_delete(H5F_t *f, H5O_t H5_ATTR_NDEBUG_UNUSED *open_oh, void *_mesg) { H5O_ainfo_t *ainfo = (H5O_ainfo_t *)_mesg; herr_t ret_value = SUCCEED; /* Return value */ @@ -405,9 +405,9 @@ H5O_ainfo_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSE *------------------------------------------------------------------------- */ static void * -H5O__ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, +H5O__ainfo_copy_file(H5F_t H5_ATTR_NDEBUG_UNUSED *file_src, void *mesg_src, H5F_t *file_dst, hbool_t H5_ATTR_UNUSED *recompute_size, unsigned H5_ATTR_UNUSED *mesg_flags, - H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata) + H5O_copy_t H5_ATTR_NDEBUG_UNUSED *cpy_info, void H5_ATTR_UNUSED *udata) { H5O_ainfo_t *ainfo_src = (H5O_ainfo_t *)mesg_src; H5O_ainfo_t *ainfo_dst = NULL; diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index c1f90cb..8850ef6 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -111,7 +111,7 @@ H5FL_EXTERN(H5O_cont_t); *------------------------------------------------------------------------- */ static herr_t -H5O__add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied, +H5O__add_gap(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied, size_t idx, uint8_t *new_gap_loc, size_t new_gap_size) { hbool_t merged_with_null; /* Whether the gap was merged with a null message */ 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/H5Oattribute.c b/src/H5Oattribute.c index 71cbc1d..a4a746e 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -86,19 +86,6 @@ typedef struct { hbool_t found; /* Whether the attribute was found */ } H5O_iter_ren_t; -/* User data for iteration when iterating over attributes */ -typedef struct { - /* down */ - H5F_t *f; /* Pointer to file attribute is in */ - hid_t loc_id; /* ID of object being iterated over */ - unsigned skip; /* # of attributes to skip over */ - H5A_operator_t op; /* Callback routine for each attribute */ - void *op_data; /* User data for callback */ - - /* up */ - unsigned count; /* Count of attributes examined */ -} H5O_iter_itr_t; - /* User data for iteration when removing an attribute */ typedef struct { /* down */ @@ -109,15 +96,6 @@ typedef struct { hbool_t found; /* Found attribute to delete */ } H5O_iter_rm_t; -/* User data for iteration when checking if an attribute exists */ -typedef struct { - /* down */ - const char *name; /* Name of attribute to open */ - - /* up */ - hbool_t found; /* Found attribute */ -} H5O_iter_xst_t; - /********************/ /* Package Typedefs */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 683d155..8bad181 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -201,7 +201,7 @@ H5O__cache_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5O__cache_get_final_load_size(const void *image, size_t image_len, +H5O__cache_get_final_load_size(const void *image, size_t H5_ATTR_NDEBUG_UNUSED image_len, void *_udata, size_t *actual_len) { H5O_cache_ud_t *udata = (H5O_cache_ud_t *)_udata; /* User data for callback */ @@ -306,7 +306,7 @@ H5O__cache_verify_chksum(const void *_image, size_t len, void *_udata) *------------------------------------------------------------------------- */ static void * -H5O__cache_deserialize(const void *image, size_t len, void *_udata, +H5O__cache_deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t *dirty) { H5O_t *oh = NULL; /* Object header read in */ @@ -763,7 +763,7 @@ H5O__cache_chk_verify_chksum(const void *_image, size_t len, void *_udata) *------------------------------------------------------------------------- */ static void * -H5O__cache_chk_deserialize(const void *image, size_t len, void *_udata, +H5O__cache_chk_deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t *dirty) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk proxy object */ diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 55013c9..469a9e0 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -88,7 +88,7 @@ static herr_t H5O__copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, static herr_t H5O__copy_free_comm_dt_cb(void *item, void *key, void *op_data); static int H5O__copy_comm_dt_cmp(const void *dt1, const void *dt2); static herr_t H5O__copy_search_comm_dt_cb(hid_t group, const char *name, - const H5L_info_t *linfo, void *udata); + const H5L_info2_t *linfo, void *udata); static htri_t H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, H5O_loc_t *oloc_dst/*in, out*/, H5O_copy_t *cpy_info); static herr_t H5O__copy_insert_comm_dt(H5F_t *file_src, H5O_t *oh_src, @@ -197,9 +197,9 @@ herr_t H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id) { - H5VL_object_t *vol_obj1 = NULL; /* object token of src_id */ + H5VL_object_t *vol_obj1 = NULL; /* object of src_id */ H5VL_loc_params_t loc_params1; - H5VL_object_t *vol_obj2 = NULL; /* object token of dst_id */ + H5VL_object_t *vol_obj2 = NULL; /* object of dst_id */ H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ @@ -1523,7 +1523,7 @@ done: */ static herr_t H5O__copy_search_comm_dt_cb(hid_t H5_ATTR_UNUSED group, const char *name, - const H5L_info_t *linfo, void *_udata) + const H5L_info2_t *linfo, void *_udata) { H5O_copy_search_comm_dt_ud_t *udata = (H5O_copy_search_comm_dt_ud_t *)_udata; /* Skip list of dtypes in dest file */ H5G_loc_t obj_loc; /* Location of object */ diff --git a/src/H5Ocopy_ref.c b/src/H5Ocopy_ref.c index b835f8e..0de661f 100644 --- a/src/H5Ocopy_ref.c +++ b/src/H5Ocopy_ref.c @@ -38,6 +38,8 @@ #include "H5Opkg.h" /* Object headers */ #include "H5Rpkg.h" /* References */ +#include "H5VLnative_private.h" /* Native VOL connector */ + /****************/ /* Local Macros */ @@ -165,7 +167,7 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src, size_t buf_size = H5R_OBJ_REF_BUF_SIZE; size_t i; /* Local index variable */ size_t token_size = H5F_SIZEOF_ADDR(src_oloc->file); - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -173,8 +175,7 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src, for(i = 0; i < ref_count; i++) { const unsigned char *src_buf = (const unsigned char *)&src_ref[i]; unsigned char *dst_buf = (unsigned char *)&dst_ref[i]; - H5VL_token_t tmp_token = { 0 }; - uint8_t *p; + H5O_token_t tmp_token = { 0 }; /* If data is not initialized, copy zeros and skip */ if(0 == HDmemcmp(src_buf, zeros, buf_size)) { @@ -185,8 +186,9 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src, /* Set up for the object copy for the reference */ if(H5R__decode_token_obj_compat(src_buf, &buf_size, &tmp_token, token_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode src object address") - p = (uint8_t *)&tmp_token; - H5F_addr_decode(src_oloc->file, (const uint8_t **)&p, &src_oloc->addr); + if(H5VL_native_token_to_addr(src_oloc->file, H5I_FILE, tmp_token, &src_oloc->addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + if(!H5F_addr_defined(src_oloc->addr) || src_oloc->addr == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "undefined reference pointer") dst_oloc->addr = HADDR_UNDEF; @@ -196,9 +198,9 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src, HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") /* Set the object reference info for the destination file */ - p = (uint8_t *)&tmp_token; - H5F_addr_encode(dst_oloc->file, &p, dst_oloc->addr); - if(H5R__encode_token_obj_compat((const H5VL_token_t *)&tmp_token, token_size, dst_buf, &buf_size) < 0) + if(H5VL_native_addr_to_token(dst_oloc->file, H5I_FILE, dst_oloc->addr, &tmp_token) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token") + if(H5R__encode_token_obj_compat((const H5O_token_t *)&tmp_token, token_size, dst_buf, &buf_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to encode dst object address") } /* end for */ @@ -365,25 +367,25 @@ H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src, H5T_t *dt_src, for(i = 0; i < ref_count; i++) { H5R_ref_t *ref_ptr = (H5R_ref_t *)conv_buf; H5R_ref_priv_t *ref = (H5R_ref_priv_t *)&ref_ptr[i]; - H5VL_token_t tmp_token = { 0 }; - uint8_t *p; + H5O_token_t tmp_token = { 0 }; /* Get src object address */ if(H5R__get_obj_token(ref, &tmp_token, &token_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object token") - p = (uint8_t *)&tmp_token; - H5F_addr_decode(src_oloc->file, (const uint8_t **)&p, &src_oloc->addr); + if(H5VL_native_token_to_addr(src_oloc->file, H5I_FILE, tmp_token, &src_oloc->addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") /* Attempt to copy object from source to destination file */ if(H5O__copy_obj_by_ref(src_oloc, dst_oloc, dst_root_loc, cpy_info) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") /* Set dst object address */ - p = (uint8_t *)&tmp_token; - H5F_addr_encode(dst_oloc->file, &p, dst_oloc->addr); - if(H5R__set_obj_token(ref, (const H5VL_token_t *)&tmp_token, token_size) < 0) + if(H5VL_native_addr_to_token(dst_oloc->file, H5I_FILE, dst_oloc->addr, &tmp_token) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token") + if(H5R__set_obj_token(ref, (const H5O_token_t *)&tmp_token, token_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set object token") - if(H5R__set_loc_id(ref, dst_loc_id, TRUE) < 0) + /* Do not set app_ref since references are released once the copy is done */ + if(H5R__set_loc_id(ref, dst_loc_id, TRUE, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set destination loc id") } /* end for */ diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 7aefc67..e43213d 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -39,6 +39,7 @@ #include "H5VLnative_private.h" /* Native VOL connector */ +#ifndef H5_NO_DEPRECATED_SYMBOLS /****************/ /* Local Macros */ @@ -49,6 +50,13 @@ /* Local Typedefs */ /******************/ +/* Adapter for using deprecated H5Ovisit1 callbacks with the VOL */ +typedef struct H5O_visit1_adapter_t { + H5O_iterate1_t real_op; /* Application callback to invoke */ + unsigned fields; /* Original fields passed to H5Ovisit */ + void *real_op_data; /* Application op_data */ +} H5O_visit1_adapter_t; + /********************/ /* Package Typedefs */ @@ -58,7 +66,10 @@ /********************/ /* Local Prototypes */ /********************/ - +static herr_t H5O__reset_info1(H5O_info1_t *oinfo); +static herr_t H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2, void *op_data); +static herr_t H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, + H5O_info1_t *oinfo, unsigned fields); /*********************/ /* Package Variables */ @@ -75,7 +86,295 @@ /*******************/ -#ifndef H5_NO_DEPRECATED_SYMBOLS +/*------------------------------------------------------------------------- + * Function: H5O__reset_info1 + * + * Purpose: Resets/initializes an H5O_info1_t struct. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O__reset_info1(H5O_info1_t *oinfo) +{ + FUNC_ENTER_STATIC_NOERR; + + /* Reset the passed-in info struct */ + HDmemset(oinfo, 0, sizeof(H5O_info1_t)); + oinfo->type = H5O_TYPE_UNKNOWN; + oinfo->addr = HADDR_UNDEF; + + FUNC_LEAVE_NOAPI(SUCCEED); +} /* end H5O__reset_info1() */ + + +/*------------------------------------------------------------------------- + * Function: H5O__iterate1_adapter + * + * Purpose: Retrieve information about an object, according to the order + * of an index. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * November 26 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2, + void *op_data) +{ + H5O_visit1_adapter_t *shim_data = (H5O_visit1_adapter_t *)op_data; + H5O_info1_t oinfo; /* Deprecated object info struct */ + unsigned dm_fields; /* Fields for data model query */ + unsigned nat_fields; /* Fields for native query */ + H5VL_object_t *vol_obj; /* Object of obj_id */ + H5VL_loc_params_t loc_params; /* Location parameters for VOL callback */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(oinfo2); + HDassert(op_data); + + /* Reset the legacy info struct */ + if(H5O__reset_info1(&oinfo) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset object data struct") + + /* Check for retrieving data model information */ + dm_fields = shim_data->fields & (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS); + if(dm_fields) { + /* Set the data model fields */ + if(shim_data->fields & H5O_INFO_BASIC) { + oinfo.fileno = oinfo2->fileno; + oinfo.type = oinfo2->type; + oinfo.rc = oinfo2->rc; + + /* Deserialize VOL object token into object address */ + if(H5VLnative_token_to_addr(obj_id, oinfo2->token, &oinfo.addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + } + if(shim_data->fields & H5O_INFO_TIME) { + oinfo.atime = oinfo2->atime; + oinfo.mtime = oinfo2->mtime; + oinfo.ctime = oinfo2->ctime; + oinfo.btime = oinfo2->btime; + } + if(shim_data->fields & H5O_INFO_NUM_ATTRS) + oinfo.num_attrs = oinfo2->num_attrs; + } + + /* Fill out location struct */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(obj_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier") + + /* Check for retrieving native information */ + nat_fields = shim_data->fields & (H5O_INFO_HDR | H5O_INFO_META_SIZE); + if(nat_fields) { + H5O_native_info_t nat_info; /* Native object info */ + + /* Retrieve the object's native information */ + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, &nat_info, nat_fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native info for object") + + /* Set the native fields */ + if(shim_data->fields & H5O_INFO_HDR) + HDmemcpy(&(oinfo.hdr), &(nat_info.hdr), sizeof(H5O_hdr_info_t)); + if(shim_data->fields & H5O_INFO_META_SIZE) { + HDmemcpy(&(oinfo.meta_size.obj), &(nat_info.meta_size.obj), sizeof(H5_ih_info_t)); + HDmemcpy(&(oinfo.meta_size.attr), &(nat_info.meta_size.attr), sizeof(H5_ih_info_t)); + } + } + + /* Invoke the application callback */ + ret_value = (shim_data->real_op)(obj_id, name, &oinfo, shim_data->real_op_data); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O__iterate1_adapter() */ + + +/*------------------------------------------------------------------------- + * Function: H5O__get_info_old + * + * Purpose: Retrieve deprecated info about an object. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * December 21 2019 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, + H5O_info1_t *oinfo, unsigned fields) +{ + unsigned dm_fields; /* Fields for data model query */ + unsigned nat_fields; /* Fields for native query */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(vol_obj); + HDassert(loc_params); + + /* Reset the passed-in info struct */ + if(H5O__reset_info1(oinfo) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset object data struct") + + /* Check for retrieving data model information */ + dm_fields = fields & (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS); + if(dm_fields) { + H5O_info2_t dm_info; /* Data model object info */ + + /* Retrieve the object's data model information */ + if(H5VL_object_get(vol_obj, loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &dm_info, dm_fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object") + + /* Set the data model fields */ + if(fields & H5O_INFO_BASIC) { + void *vol_obj_data; + + if(NULL == (vol_obj_data = H5VL_object_data(vol_obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object") + + oinfo->fileno = dm_info.fileno; + oinfo->type = dm_info.type; + oinfo->rc = dm_info.rc; + + /* Deserialize VOL object token into object address */ + if(H5VL_native_token_to_addr(vol_obj_data, loc_params->obj_type, dm_info.token, &oinfo->addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + } /* end if */ + if(fields & H5O_INFO_TIME) { + oinfo->atime = dm_info.atime; + oinfo->mtime = dm_info.mtime; + oinfo->ctime = dm_info.ctime; + oinfo->btime = dm_info.btime; + } /* end if */ + if(fields & H5O_INFO_NUM_ATTRS) + oinfo->num_attrs = dm_info.num_attrs; + } /* end if */ + + /* Check for retrieving native information */ + nat_fields = fields & (H5O_INFO_HDR | H5O_INFO_META_SIZE); + if(nat_fields) { + H5O_native_info_t nat_info; /* Native object info */ + + /* Retrieve the object's native information */ + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, &nat_info, nat_fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native info for object") + + /* Set the native fields */ + if(fields & H5O_INFO_HDR) + HDmemcpy(&(oinfo->hdr), &(nat_info.hdr), sizeof(H5O_hdr_info_t)); + if(fields & H5O_INFO_META_SIZE) { + HDmemcpy(&(oinfo->meta_size.obj), &(nat_info.meta_size.obj), sizeof(H5_ih_info_t)); + HDmemcpy(&(oinfo->meta_size.attr), &(nat_info.meta_size.attr), sizeof(H5_ih_info_t)); + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O__get_info_old() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oopen_by_addr + * + * Purpose: Warning! This function is EXTREMELY DANGEROUS! + * Improper use can lead to FILE CORRUPTION, INACCESSIBLE DATA, + * and other VERY BAD THINGS! + * + * This function opens an object using its address within the + * HDF5 file, similar to an HDF5 hard link. The open object + * is identical to an object opened with H5Oopen() and should + * be closed with H5Oclose() or a type-specific closing + * function (such as H5Gclose() ). + * + * This function is very dangerous if called on an invalid + * address. For this reason, H5Oincr_refcount() should be + * used to prevent HDF5 from deleting any object that is + * referenced by address (e.g. by a user-defined link). + * H5Odecr_refcount() should be used when the object is + * no longer being referenced by address (e.g. when the UD link + * is deleted). + * + * The address of the HDF5 file on disk has no effect on + * H5Oopen_by_addr(), nor does the use of any unusual file + * drivers. The "address" is really the offset within the + * HDF5 file, and HDF5's file drivers will transparently + * map this to an address on disk for the filesystem. + * + * Return: Success: An open object identifier + * Failure: H5I_INVALID_HID + * + * Programmer: James Laird + * July 14 2006 + * + *------------------------------------------------------------------------- + */ +hid_t +H5Oopen_by_addr(hid_t loc_id, haddr_t addr) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ + H5I_type_t opened_type; /* Opened object type */ + void *opened_obj = NULL; /* Opened object */ + H5VL_loc_params_t loc_params; /* Location parameters */ + H5O_token_t obj_token = {0}; /* Object token */ + hbool_t is_native_vol_obj; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE2("i", "ia", loc_id, addr); + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Get object type */ + if((vol_obj_type = H5I_get_type(loc_id)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") + if(is_native_vol_obj) { + /* This is a native-specific routine that requires serialization of the token */ + if(H5VLnative_addr_to_token(loc_id, addr, &obj_token) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, H5I_INVALID_HID, "can't serialize address into object token") + } /* end if */ + else + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Oopen_by_addr is only meant to be used with the native VOL connector") + + loc_params.type = H5VL_OBJECT_BY_TOKEN; + loc_params.loc_data.loc_by_token.token = &obj_token; + loc_params.obj_type = vol_obj_type; + + /* Open the object */ + if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + + /* Register the object's ID */ + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oopen_by_addr() */ /*------------------------------------------------------------------------- @@ -89,9 +388,9 @@ *------------------------------------------------------------------------- */ herr_t -H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) +H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -111,8 +410,8 @@ 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) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + if(H5O__get_info_old(vol_obj, &loc_params, oinfo, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") done: FUNC_LEAVE_API(ret_value) @@ -130,9 +429,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id) +H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -162,8 +461,8 @@ 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) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) + if(H5O__get_info_old(vol_obj, &loc_params, oinfo, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") done: FUNC_LEAVE_API(ret_value) @@ -186,9 +485,9 @@ done: */ herr_t H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id) + H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -223,8 +522,8 @@ 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) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + if(H5O__get_info_old(vol_obj, &loc_params, oinfo, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") done: FUNC_LEAVE_API(ret_value) @@ -232,6 +531,197 @@ done: /*------------------------------------------------------------------------- + * Function: H5Oget_info2 + * + * Purpose: Retrieve information about an object. + * + * NOTE: Add a parameter "fields" to indicate selection of object info. + * + * Return: SUCCEED/FAIL + * + * Programmer: Neil Fortner + * July 7 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo, unsigned fields) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + hbool_t is_native_vol_obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "i*xIu", loc_id, oinfo, fields); + + /* Check args */ + if(!oinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") + if(fields & ~H5O_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Oget_info2 is only meant to be used with the native VOL connector") + + /* Retrieve deprecated info struct */ + if(H5O__get_info_old(vol_obj, &loc_params, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_info2() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oget_info_by_name2 + * + * Purpose: Retrieve information about an object + * + * NOTE: Add a parameter "fields" to indicate selection of object info. + * + * Return: SUCCEED/FAIL + * + * Programmer: Neil Fortner + * July 7 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo, + unsigned fields, hid_t lapl_id) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + hbool_t is_native_vol_obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "i*s*xIui", loc_id, name, oinfo, fields, lapl_id); + + /* Check args */ + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") + if(!oinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") + if(fields & ~H5O_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Fill out location struct */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Oget_info_by_name2 is only meant to be used with the native VOL connector") + + /* Retrieve deprecated info struct */ + if(H5O__get_info_old(vol_obj, &loc_params, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_info_by_name2() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oget_info_by_idx2 + * + * Purpose: Retrieve information about an object, according to the order + * of an index. + * + * NOTE: Add a parameter "fields" to indicate selection of object info. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * November 26 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo, unsigned fields, hid_t lapl_id) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + hbool_t is_native_vol_obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE8("e", "i*sIiIoh*xIui", loc_id, group_name, idx_type, order, n, oinfo, + fields, lapl_id); + + /* Check args */ + if(!group_name || !*group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!oinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + if(fields & ~H5O_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Oget_info_by_idx2 is only meant to be used with the native VOL connector") + + /* Retrieve deprecated info struct */ + if(H5O__get_info_old(vol_obj, &loc_params, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_info_by_idx2() */ + + +/*------------------------------------------------------------------------- * Function: H5Ovisit1 * * Purpose: Recursively visit an object and all the objects reachable @@ -265,10 +755,11 @@ done: */ herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, - H5O_iterate_t op, void *op_data) + H5O_iterate1_t op, void *op_data) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; + H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -290,8 +781,13 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(obj_id); + /* Set up adapter */ + shim_data.real_op = op; + shim_data.fields = H5O_INFO_ALL; + shim_data.real_op_data = op_data; + /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, op, op_data, H5O_INFO_ALL)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter, (void *)&shim_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: @@ -333,10 +829,11 @@ done: */ herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, - H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id) + H5_iter_order_t order, H5O_iterate1_t op, void *op_data, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ - H5VL_loc_params_t loc_params; + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -369,13 +866,203 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; loc_params.obj_type = H5I_get_type(loc_id); + /* Set up adapter */ + shim_data.real_op = op; + shim_data.fields = H5O_INFO_ALL; + shim_data.real_op_data = op_data; + /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, op, op_data, H5O_INFO_ALL)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter, (void *)&shim_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: FUNC_LEAVE_API(ret_value) } /* end H5Ovisit_by_name1() */ + +/*------------------------------------------------------------------------- + * Function: H5Ovisit2 + * + * Purpose: Recursively visit an object and all the objects reachable + * from it. If the starting object is a group, all the objects + * linked to from that group will be visited. Links within + * each group are visited according to the order within the + * specified index (unless the specified index does not exist for + * a particular group, then the "name" index is used). + * + * NOTE: Soft links and user-defined links are ignored during + * this operation. + * + * NOTE: Each _object_ reachable from the initial group will only + * be visited once. If multiple hard links point to the same + * object, the first link to the object's path (according to the + * iteration index and iteration order given) will be used to in + * the callback about the object. + * + * NOTE: Add a a parameter "fields" to indicate selection of + * object info to be retrieved to the callback "op". + * + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. + * + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. + * + * Programmer: Quincey Koziol + * November 25 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, + H5O_iterate1_t op, void *op_data, unsigned fields) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */ + hbool_t is_native_vol_obj; + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "iIiIox*xIu", obj_id, idx_type, order, op, op_data, fields); + + /* Check args */ + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + if(fields & ~H5O_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Ovisit2 is only meant to be used with the native VOL connector") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(obj_id); + + /* Set up adapter */ + shim_data.real_op = op; + shim_data.fields = fields; + shim_data.real_op_data = op_data; + + /* Visit the objects */ + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter, (void *)&shim_data, fields)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Ovisit2() */ + + +/*------------------------------------------------------------------------- + * Function: H5Ovisit_by_name2 + * + * Purpose: Recursively visit an object and all the objects reachable + * from it. If the starting object is a group, all the objects + * linked to from that group will be visited. Links within + * each group are visited according to the order within the + * specified index (unless the specified index does not exist for + * a particular group, then the "name" index is used). + * + * NOTE: Soft links and user-defined links are ignored during + * this operation. + * + * NOTE: Each _object_ reachable from the initial group will only + * be visited once. If multiple hard links point to the same + * object, the first link to the object's path (according to the + * iteration index and iteration order given) will be used to in + * the callback about the object. + * + * NOTE: Add a a parameter "fields" to indicate selection of + * object info to be retrieved to the callback "op". + * + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. + * + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. + * + * Programmer: Quincey Koziol + * November 24 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, + H5_iter_order_t order, H5O_iterate1_t op, void *op_data, unsigned fields, hid_t lapl_id) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */ + hbool_t is_native_vol_obj; + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE8("e", "i*sIiIox*xIui", loc_id, obj_name, idx_type, order, op, op_data, + fields, lapl_id); + + /* Check args */ + if(!obj_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL") + if(!*obj_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string") + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + if(fields & ~H5O_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Ovisit_by_name2 is only meant to be used with the native VOL connector") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Set up adapter */ + shim_data.real_op = op; + shim_data.fields = fields; + shim_data.real_op_data = op_data; + + /* Visit the objects */ + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter, (void *)&shim_data, fields)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Ovisit_by_name2() */ + #endif /* H5_NO_DEPRECATED_SYMBOLS */ 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/H5Oflush.c b/src/H5Oflush.c index a03cfa1..b441840 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -72,7 +72,7 @@ static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, herr_t H5Oflush(hid_t obj_id) { - H5VL_object_t *vol_obj = NULL; /* Object token */ + H5VL_object_t *vol_obj = NULL; /* Object of obj_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -236,7 +236,7 @@ done: herr_t H5Orefresh(hid_t oid) { - H5VL_object_t *vol_obj = NULL; /* Object token */ + H5VL_object_t *vol_obj = NULL; /* Object of oid */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ 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..d5a3a71 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 */ @@ -42,6 +43,8 @@ #include "H5Opkg.h" /* Object headers */ #include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative_private.h" /* Native VOL connector */ + /****************/ /* Local Macros */ @@ -55,9 +58,9 @@ /* 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 */ + H5O_iterate2_t op; /* Application callback */ void *op_data; /* Application's op data */ unsigned fields; /* Selection of object info */ } H5O_iter_visit_ud_t; @@ -77,9 +80,11 @@ static herr_t H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type); static herr_t H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr); static herr_t H5O__free_visit_visited(void *item, void *key, void *operator_data/*in,out*/); -static herr_t H5O__visit_cb(hid_t group, const char *name, const H5L_info_t *linfo, +static herr_t H5O__visit_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void *_udata); static const H5O_obj_class_t *H5O__obj_class_real(const H5O_t *oh); +static herr_t H5O__reset_info2(H5O_info2_t *oinfo); + /*********************/ /* Package Variables */ @@ -150,6 +155,13 @@ H5FL_BLK_DEFINE(chunk_image); /* Declare external the free list for H5O_cont_t sequences */ H5FL_SEQ_EXTERN(H5O_cont_t); +/* The canonical 'undefined' token */ +const H5O_token_t H5O_TOKEN_UNDEF_g = {{ + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255}}; + /*****************************/ /* Library Private Variables */ @@ -239,7 +251,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)]) @@ -2154,9 +2166,7 @@ H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) /*------------------------------------------------------------------------- * Function: H5O_get_info * - * Purpose: Retrieve the information for an object - * - * Note: Add a parameter "fields" to indicate selection of object info. + * Purpose: Retrieve the data model information for an object * * Return: Success: Non-negative * Failure: Negative @@ -2167,7 +2177,7 @@ H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) *------------------------------------------------------------------------- */ herr_t -H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields) +H5O_get_info(const H5O_loc_t *loc, H5O_info2_t *oinfo, unsigned fields) { const H5O_obj_class_t *obj_class; /* Class of object for header */ H5O_t *oh = NULL; /* Object header */ @@ -2188,15 +2198,17 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class") /* Reset the object info structure */ - HDmemset(oinfo, 0, sizeof(*oinfo)); + if(H5O__reset_info2(oinfo) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset object data struct") /* Get basic information, if requested */ if(fields & H5O_INFO_BASIC) { /* Retrieve the file's fileno */ H5F_GET_FILENO(loc->file, oinfo->fileno); - /* Set the object's address */ - oinfo->addr = loc->addr; + /* Set the object's address into the token */ + if(H5VL_native_addr_to_token(loc->file, H5I_FILE, loc->addr, &oinfo->token) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token") /* Retrieve the type of the object */ oinfo->type = obj_class->type; @@ -2248,31 +2260,11 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields) } /* end else */ } /* end if */ - /* Get the information for the object header, if requested */ - if(fields & H5O_INFO_HDR) - if(H5O__get_hdr_info_real(oh, &oinfo->hdr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info") - /* Retrieve # of attributes */ if(fields & H5O_INFO_NUM_ATTRS) if(H5O__attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count") - /* Get B-tree & heap metadata storage size, if requested */ - if(fields & H5O_INFO_META_SIZE) { - /* Check for 'bh_info' callback for this type of object */ - if(obj_class->bh_info) - /* Call the object's class 'bh_info' routine */ - if((obj_class->bh_info)(loc, oh, &oinfo->meta_size.obj) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info") - - /* Get B-tree & heap info for any attributes */ - if(!(fields & H5O_INFO_NUM_ATTRS) || oinfo->num_attrs > 0) { - if(H5O__attr_bh_info(loc->file, oh, &oinfo->meta_size.attr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info") - } /* end if */ - } /* end if */ - done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") @@ -2282,60 +2274,66 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__get_info_by_idx + * Function: H5O_get_native_info * - * 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. + * Purpose: Retrieve the native file-format information for an object * * Return: Success: Non-negative * Failure: Negative * * Programmer: Quincey Koziol - * December 28, 2017 + * November 21 2006 * *------------------------------------------------------------------------- */ 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) +H5O_get_native_info(const H5O_loc_t *loc, H5O_native_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 */ + const H5O_obj_class_t *obj_class; /* Class of object for header */ + H5O_t *oh = NULL; /* Object header */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI_TAG(loc->addr, FAIL) - /* Check arguments */ + /* Check args */ 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); + /* Get the object header */ + if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") - /* 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; + /* Get class for object */ + if(NULL == (obj_class = H5O__obj_class_real(oh))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class") + + /* Reset the object info structure */ + HDmemset(oinfo, 0, sizeof(*oinfo)); - /* 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") + /* Get the information for the object header, if requested */ + if(fields & H5O_NATIVE_INFO_HDR) + if(H5O__get_hdr_info_real(oh, &oinfo->hdr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info") + + /* Get B-tree & heap metadata storage size, if requested */ + if(fields & H5O_NATIVE_INFO_META_SIZE) { + /* Check for 'bh_info' callback for this type of object */ + if(obj_class->bh_info) + /* Call the object's class 'bh_info' routine */ + if((obj_class->bh_info)(loc, oh, &oinfo->meta_size.obj) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info") + + /* Get B-tree & heap info for any attributes */ + if(H5O__attr_bh_info(loc->file, oh, &oinfo->meta_size.attr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info") + } /* end if */ 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") + if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__get_info_by_idx() */ + FUNC_LEAVE_NOAPI_TAG(ret_value) +} /* end H5O_get_native_info() */ /*------------------------------------------------------------------------- @@ -2378,7 +2376,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) @@ -2649,7 +2647,7 @@ H5O__free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSE *------------------------------------------------------------------------- */ static herr_t -H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t *linfo, +H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t *linfo, void *_udata) { H5O_iter_visit_ud_t *udata = (H5O_iter_visit_ud_t *)_udata; /* User data for callback */ @@ -2687,7 +2685,7 @@ H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t *li /* Check if we've seen the object the link references before */ if(NULL == H5SL_search(udata->visited, &obj_pos)) { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ /* Get the object's info */ if(H5O_get_info(&obj_oloc, &oinfo, udata->fields) < 0) @@ -2763,14 +2761,14 @@ done: */ 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_iter_order_t order, H5O_iterate2_t op, void *op_data, unsigned fields) { H5O_iter_visit_ud_t udata; /* User data for callback */ H5G_loc_t obj_loc; /* Location used to open object */ 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 */ - H5O_info_t oinfo; /* Object info struct */ + H5O_info2_t oinfo; /* Object info struct */ void *obj = NULL; /* Object */ H5I_type_t opened_type; /* ID type of object */ hid_t obj_id = H5I_INVALID_HID; /* ID of object */ @@ -2846,7 +2844,10 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, /* Construct unique "position" for this object */ obj_pos->fileno = oinfo.fileno; - obj_pos->addr = oinfo.addr; + + /* De-serialize object token into an object address */ + if(H5VL_native_token_to_addr(loc->oloc->file, H5I_FILE, oinfo.token, &(obj_pos->addr)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") /* Add to list of visited objects */ if(H5SL_insert(udata.visited, obj_pos, obj_pos) < 0) @@ -3083,3 +3084,25 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__free() */ +/*------------------------------------------------------------------------- + * Function: H5O__reset_info2 + * + * Purpose: Resets/initializes an H5O_info2_t struct. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O__reset_info2(H5O_info2_t *oinfo) +{ + FUNC_ENTER_STATIC_NOERR; + + /* Reset the passed-in info struct */ + HDmemset(oinfo, 0, sizeof(H5O_info2_t)); + oinfo->type = H5O_TYPE_UNKNOWN; + oinfo->token = H5O_TOKEN_UNDEF; + + FUNC_LEAVE_NOAPI(SUCCEED); +} /* end H5O__reset_info2() */ + 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/H5Omessage.c b/src/H5Omessage.c index 18f3706..d66ea69 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -1686,17 +1686,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_reset_share(unsigned type_id, void *mesg) +H5O_msg_reset_share(unsigned H5_ATTR_NDEBUG_UNUSED type_id, void *mesg) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - HDassert(type->share_flags & H5O_SHARE_IS_SHARABLE); + HDassert(H5O_msg_class_g[type_id]); /* map the type ID to the actual type object */ + HDassert(H5O_msg_class_g[type_id]->share_flags & H5O_SHARE_IS_SHARABLE); HDassert(mesg); /* Reset the shared component in the message to zero. */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 4afa452..fb08f7d 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -556,10 +556,8 @@ 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_iter_order_t order, H5O_iterate2_t op, void *op_data, unsigned fields); H5_DLL herr_t H5O__inc_rc(H5O_t *oh); H5_DLL herr_t H5O__dec_rc(H5O_t *oh); H5_DLL herr_t H5O__free(H5O_t *oh); diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 54e8ec8..52a72b2 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; @@ -906,7 +907,8 @@ H5_DLL herr_t H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned mesg_id, unsigned mesg_ #endif /* H5O_ENABLE_BOGUS */ H5_DLL herr_t H5O_delete(H5F_t *f, haddr_t addr); H5_DLL herr_t H5O_get_hdr_info(const H5O_loc_t *oloc, H5O_hdr_info_t *hdr); -H5_DLL herr_t H5O_get_info(const H5O_loc_t *oloc, H5O_info_t *oinfo, unsigned fields); +H5_DLL herr_t H5O_get_info(const H5O_loc_t *oloc, H5O_info2_t *oinfo, unsigned fields); +H5_DLL herr_t H5O_get_native_info(const H5O_loc_t *oloc, H5O_native_info_t *oinfo, unsigned fields); H5_DLL herr_t H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type); H5_DLL herr_t H5O_get_create_plist(const H5O_loc_t *loc, struct H5P_genplist_t *oc_plist); H5_DLL void *H5O_open_name(const H5G_loc_t *loc, const char *name, H5I_type_t *opened_type/*out*/); diff --git a/src/H5Opublic.h b/src/H5Opublic.h index 234f4f0..d0f8ab3 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -75,14 +75,24 @@ /* 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 */ #define H5O_INFO_NUM_ATTRS 0x0004u /* Fill in the num_attrs field */ -#define H5O_INFO_HDR 0x0008u /* Fill in the hdr field */ -#define H5O_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */ -#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE) +#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS) + +/* Flags for H5Oget_native_info. + * Theses flags determine which fields will be filled in in the H5O_native_info_t + * struct. + */ +#define H5O_NATIVE_INFO_HDR 0x0008u /* Fill in the hdr field */ +#define H5O_NATIVE_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */ +#define H5O_NATIVE_INFO_ALL (H5O_NATIVE_INFO_HDR | H5O_NATIVE_INFO_META_SIZE) + +/* Convenience macro to check if the token is the 'undefined' token value */ +#define H5O_IS_TOKEN_UNDEF(token) (!HDmemcmp(&(token), &(H5O_TOKEN_UNDEF), sizeof(H5O_token_t))) + /*******************/ /* Public Typedefs */ @@ -116,30 +126,36 @@ typedef struct H5O_hdr_info_t { } mesg; } H5O_hdr_info_t; -/* Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) */ -typedef struct H5O_info_t { - unsigned long fileno; /* File number that object is located in */ - haddr_t addr; /* Object address in file */ - H5O_type_t type; /* Basic object type (group, dataset, etc.) */ - unsigned rc; /* Reference count of object */ - time_t atime; /* Access time */ - time_t mtime; /* Modification time */ - time_t ctime; /* Change time */ - time_t btime; /* Birth time */ - hsize_t num_attrs; /* # of attributes attached to object */ +/* Data model information struct for objects */ +/* (For H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx version 3) */ +typedef struct H5O_info2_t { + unsigned long fileno; /* File number that object is located in */ + H5O_token_t token; /* Token representing the object */ + H5O_type_t type; /* Basic object type (group, dataset, etc.) */ + unsigned rc; /* Reference count of object */ + time_t atime; /* Access time */ + time_t mtime; /* Modification time */ + time_t ctime; /* Change time */ + time_t btime; /* Birth time */ + hsize_t num_attrs; /* # of attributes attached to object */ +} H5O_info2_t; + +/* Native file format information struct for objects */ +/* (For H5Oget_native_info / H5Oget_native_info_by_name / H5Oget_native_info_by_idx) */ +typedef struct H5O_native_info_t { H5O_hdr_info_t hdr; /* Object header information */ /* Extra metadata storage for obj & attributes */ struct { H5_ih_info_t obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ H5_ih_info_t attr; /* v2 B-tree & heap for attributes */ } meta_size; -} H5O_info_t; +} H5O_native_info_t; /* Typedef for message creation indexes */ typedef uint32_t H5O_msg_crt_idx_t; -/* Prototype for H5Ovisit/H5Ovisit_by_name() operator */ -typedef herr_t (*H5O_iterate_t)(hid_t obj, const char *name, const H5O_info_t *info, +/* Prototype for H5Ovisit/H5Ovisit_by_name() operator (version 3) */ +typedef herr_t (*H5O_iterate2_t)(hid_t obj, const char *name, const H5O_info2_t *info, void *op_data); typedef enum H5O_mcdt_search_ret_t { @@ -165,15 +181,21 @@ extern "C" { #endif H5_DLL hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id); -H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr); +H5_DLL hid_t H5Oopen_by_token(hid_t loc_id, H5O_token_t token); H5_DLL hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id); H5_DLL htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id); -H5_DLL herr_t H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields); -H5_DLL herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, +H5_DLL herr_t H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo, unsigned fields); +H5_DLL herr_t H5Oget_info_by_name3(hid_t loc_id, const char *name, H5O_info2_t *oinfo, unsigned fields, hid_t lapl_id); -H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, +H5_DLL herr_t H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info2_t *oinfo, + unsigned fields, hid_t lapl_id); +H5_DLL herr_t H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo, unsigned fields); +H5_DLL herr_t H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oinfo, + unsigned fields, hid_t lapl_id); +H5_DLL herr_t H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_native_info_t *oinfo, unsigned fields, hid_t lapl_id); H5_DLL herr_t H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id); @@ -187,10 +209,10 @@ H5_DLL herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name, H5_DLL ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize); H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize, hid_t lapl_id); -H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, - H5O_iterate_t op, void *op_data, unsigned fields); -H5_DLL herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, - H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, +H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, + H5O_iterate2_t op, void *op_data, unsigned fields); +H5_DLL herr_t H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, + H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2_t op, void *op_data, unsigned fields, hid_t lapl_id); H5_DLL herr_t H5Oclose(hid_t object_id); H5_DLL herr_t H5Oflush(hid_t obj_id); @@ -198,6 +220,14 @@ H5_DLL herr_t H5Orefresh(hid_t oid); H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id); H5_DLL herr_t H5Oenable_mdc_flushes(hid_t object_id); H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled); +H5_DLL herr_t H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2, + int *cmp_value); +H5_DLL herr_t H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str); +H5_DLL herr_t H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token); + +/* The canonical 'undefined' token value */ +#define H5O_TOKEN_UNDEF (H5OPEN H5O_TOKEN_UNDEF_g) +H5_DLLVAR const H5O_token_t H5O_TOKEN_UNDEF_g; /* Symbols defined for compatibility with previous versions of the HDF5 API. * @@ -207,6 +237,12 @@ H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled /* Macros */ +/* Deprecated flags for earlier versions of H5Oget_info* */ +#define H5O_INFO_HDR 0x0008u /* Fill in the hdr field */ +#define H5O_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */ +#undef H5O_INFO_ALL +#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE) + /* Typedefs */ /* A struct that's part of the H5G_stat_t structure (deprecated) */ @@ -217,19 +253,56 @@ typedef struct H5O_stat_t { unsigned nchunks; /* Number of object header chunks */ } H5O_stat_t; +/* Information struct for object */ +/* (For H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx versions 1 & 2) */ +typedef struct H5O_info1_t { + unsigned long fileno; /* File number that object is located in */ + haddr_t addr; /* Object address in file */ + H5O_type_t type; /* Basic object type (group, dataset, etc.) */ + unsigned rc; /* Reference count of object */ + time_t atime; /* Access time */ + time_t mtime; /* Modification time */ + time_t ctime; /* Change time */ + time_t btime; /* Birth time */ + hsize_t num_attrs; /* # of attributes attached to object */ + H5O_hdr_info_t hdr; /* Object header information */ + /* Extra metadata storage for obj & attributes */ + struct { + H5_ih_info_t obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ + H5_ih_info_t attr; /* v2 B-tree & heap for attributes */ + } meta_size; +} H5O_info1_t; + +/* Prototype for H5Ovisit/H5Ovisit_by_name() operator (versions 1 & 2) */ +typedef herr_t (*H5O_iterate1_t)(hid_t obj, const char *name, const H5O_info1_t *info, + void *op_data); + + /* Function prototypes */ -H5_DLL herr_t H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo); -H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, +H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr); +H5_DLL herr_t H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo); +H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo, hid_t lapl_id); H5_DLL herr_t H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo, hid_t lapl_id); - +H5_DLL herr_t H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo, unsigned fields); +H5_DLL herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo, + unsigned fields, hid_t lapl_id); +H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo, + unsigned fields, hid_t lapl_id); H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, - H5O_iterate_t op, void *op_data); + H5O_iterate1_t op, void *op_data); H5_DLL herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, - H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, + H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op, void *op_data, hid_t lapl_id); +H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, + H5O_iterate1_t op, void *op_data, unsigned fields); +H5_DLL herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, + H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op, + void *op_data, unsigned fields, hid_t lapl_id); + #endif /* H5_NO_DEPRECATED_SYMBOLS */ #ifdef __cplusplus 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/H5Oshared.c b/src/H5Oshared.c index 67ca76f..b49e501 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -589,9 +589,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O__shared_copy_file(H5F_t *file_src, H5F_t *file_dst, +H5O__shared_copy_file(H5F_t H5_ATTR_NDEBUG_UNUSED *file_src, H5F_t *file_dst, const H5O_msg_class_t *mesg_type, const void *_native_src, void *_native_dst, - hbool_t H5_ATTR_UNUSED *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info, + hbool_t H5_ATTR_UNUSED *recompute_size, unsigned *mesg_flags, H5O_copy_t H5_ATTR_NDEBUG_UNUSED *cpy_info, void H5_ATTR_UNUSED *udata) { const H5O_shared_t *shared_src = (const H5O_shared_t *)_native_src; /* Alias to shared info in native source */ diff --git a/src/H5Oshared.h b/src/H5Oshared.h index 8040a6a..e4ad980 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -381,7 +381,7 @@ done: *------------------------------------------------------------------------- */ static H5_INLINE herr_t -H5O_SHARED_POST_COPY_FILE(const H5O_loc_t *oloc_src, const void *mesg_src, +H5O_SHARED_POST_COPY_FILE(const H5O_loc_t H5_ATTR_NDEBUG_UNUSED *oloc_src, const void *mesg_src, H5O_loc_t *oloc_dst, void *mesg_dst, unsigned *mesg_flags, H5O_copy_t *cpy_info) { diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 22252d3..3668229 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -5753,10 +5753,10 @@ H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED { const H5VL_connector_prop_t *info1 = (const H5VL_connector_prop_t *)_info1; /* Create local aliases for values */ const H5VL_connector_prop_t *info2 = (const H5VL_connector_prop_t *)_info2; - H5VL_class_t *cls1, *cls2; /* connector class for each property */ - int cmp_value = 0; /* Value from comparison */ - herr_t status; /* Status from info comparison */ - int ret_value = 0; /* Return value */ + H5VL_class_t *cls1, *cls2; /* connector class for each property */ + int cmp_value = 0; /* Value from comparison */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Status from info comparison */ + int ret_value = 0; /* Return value */ FUNC_ENTER_STATIC_NOERR diff --git a/src/H5Pint.c b/src/H5Pint.c index 2911eef..0810427 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -2780,8 +2780,8 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P__poke_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, - void *_udata) +H5P__poke_plist_cb(H5P_genplist_t H5_ATTR_NDEBUG_UNUSED *plist, const char H5_ATTR_NDEBUG_UNUSED *name, + H5P_genprop_t *prop, void *_udata) { H5P_prop_set_ud_t *udata = (H5P_prop_set_ud_t *)_udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2827,7 +2827,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P__poke_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, +H5P__poke_pclass_cb(H5P_genplist_t *plist, const char H5_ATTR_NDEBUG_UNUSED *name, H5P_genprop_t *prop, void *_udata) { H5P_prop_set_ud_t *udata = (H5P_prop_set_ud_t *)_udata; /* User data for callback */ @@ -4260,10 +4260,9 @@ property list class. REVISION LOG --------------------------------------------------------------------------*/ static int -H5P__iterate_pclass_cb(void *_item, void *_key, void *_udata) +H5P__iterate_pclass_cb(void *_item, void H5_ATTR_NDEBUG_UNUSED *_key, void *_udata) { H5P_genprop_t *item = (H5P_genprop_t *)_item; /* Pointer to the property */ - char *key = (char *)_key; /* Pointer to the property's name */ H5P_iter_pclass_ud_t *udata = (H5P_iter_pclass_ud_t *)_udata; /* Pointer to user data */ int ret_value = 0; /* Return value */ @@ -4271,7 +4270,7 @@ H5P__iterate_pclass_cb(void *_item, void *_key, void *_udata) /* Sanity check */ HDassert(item); - HDassert(key); + HDassert((char *)_key); /* Check if we've found the correctly indexed property */ if(*udata->curr_idx_ptr >= udata->prev_idx) { @@ -4397,8 +4396,8 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P__peek_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, - void *_udata) +H5P__peek_cb(H5P_genplist_t H5_ATTR_NDEBUG_UNUSED *plist, const char H5_ATTR_NDEBUG_UNUSED *name, + H5P_genprop_t *prop, void *_udata) { H5P_prop_get_ud_t *udata = (H5P_prop_get_ud_t *)_udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 7a7cc23..6e582fb 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: @@ -567,7 +567,7 @@ H5P__lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t H5_ATTR_ if(obj1 == NULL && obj2 != NULL) HGOTO_DONE(1); if(obj1 != NULL && obj2 == NULL) HGOTO_DONE(-1); if(obj1 && obj2) { - herr_t status; + herr_t H5_ATTR_NDEBUG_UNUSED status; status = H5P__cmp_plist(obj1, obj2, &ret_value); HDassert(status >= 0); @@ -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) diff --git a/src/H5Pmapl.c b/src/H5Pmapl.c index fe5be0f..3a3f619 100644 --- a/src/H5Pmapl.c +++ b/src/H5Pmapl.c @@ -137,6 +137,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__macc_reg_prop() */ +#ifdef H5_HAVE_MAP_API /*------------------------------------------------------------------------- * Function: H5Pset_map_iterate_hints @@ -214,4 +215,4 @@ H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size, size_t *key_a done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_map_iterate_hints() */ - +#endif @@ -66,22 +66,22 @@ /*------------------------------------------------------------------------- * Function: H5Rcreate_object * - * Purpose: Creates an object reference. The LOC_ID and NAME are used to locate - * the object pointed to. + * Purpose: Creates an object reference. The LOC_ID and NAME are used + * to locate the object pointed to. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / Negative on failure * *------------------------------------------------------------------------- */ herr_t H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_ptr) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t obj_type; /* Object type of loc_id */ hid_t file_id = H5I_INVALID_HID;/* File ID */ - H5VL_object_t *vol_obj_file = NULL; /* Object token of file_id */ + H5VL_object_t *vol_obj_file = NULL; /* Object of file_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; herr_t ret_value = SUCCEED; /* Return value */ @@ -135,11 +135,11 @@ H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_p /* Create the reference (do not pass filename, since file_id is attached) */ HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE); - if(H5R__create_object((const H5VL_token_t *)&obj_token, cont_info.token_size, (H5R_ref_priv_t *)ref_ptr) < 0) + if(H5R__create_object((const H5O_token_t *)&obj_token, cont_info.token_size, (H5R_ref_priv_t *)ref_ptr) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create object reference") /* Attach loc_id to reference and hold reference to it */ - if(H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE) < 0) + if(H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference") done: @@ -152,11 +152,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Rcreate_region * - * Purpose: Creates a region reference. The LOC_ID and NAME are used to locate - * the object pointed to and the SPACE_ID is used to choose the region pointed - * to. + * Purpose: Creates a region reference. The LOC_ID and NAME are used to + * locate the object pointed to and the SPACE_ID is used to + * choose the region pointed to. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / Negative on failure * *------------------------------------------------------------------------- */ @@ -164,12 +164,12 @@ herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id, H5R_ref_t *ref_ptr) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t obj_type; /* Object type of loc_id */ hid_t file_id = H5I_INVALID_HID;/* File ID */ - H5VL_object_t *vol_obj_file = NULL; /* Object token of file_id */ + H5VL_object_t *vol_obj_file = NULL; /* Object of file_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; struct H5S_t *space = NULL; /* Pointer to dataspace containing region */ herr_t ret_value = SUCCEED; /* Return value */ @@ -228,16 +228,16 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, /* Create the reference (do not pass filename, since file_id is attached) */ HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE); - if(H5R__create_region((const H5VL_token_t *)&obj_token, cont_info.token_size, space, (H5R_ref_priv_t *)ref_ptr) < 0) + if(H5R__create_region((const H5O_token_t *)&obj_token, cont_info.token_size, space, (H5R_ref_priv_t *)ref_ptr) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create region reference") /* Attach loc_id to reference and hold reference to it */ - if(H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE) < 0) + if(H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference") 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() */ @@ -245,10 +245,10 @@ done: /*------------------------------------------------------------------------- * Function: H5Rcreate_attr * - * Purpose: Creates an attribute reference. The LOC_ID, NAME and ATTR_NAME are - * used to locate the attribute pointed to. + * Purpose: Creates an attribute reference. The LOC_ID, NAME and + * ATTR_NAME are used to locate the attribute pointed to. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / Negative on failure * *------------------------------------------------------------------------- */ @@ -256,12 +256,12 @@ herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl_id, H5R_ref_t *ref_ptr) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t obj_type; /* Object type of loc_id */ hid_t file_id = H5I_INVALID_HID;/* File ID */ - H5VL_object_t *vol_obj_file = NULL; /* Object token of file_id */ + H5VL_object_t *vol_obj_file = NULL; /* Object of file_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; herr_t ret_value = SUCCEED; /* Return value */ @@ -317,16 +317,16 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, /* Create the reference (do not pass filename, since file_id is attached) */ HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE); - if(H5R__create_attr((const H5VL_token_t *)&obj_token, cont_info.token_size, attr_name, (H5R_ref_priv_t *)ref_ptr) < 0) + if(H5R__create_attr((const H5O_token_t *)&obj_token, cont_info.token_size, attr_name, (H5R_ref_priv_t *)ref_ptr) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create attribute reference") /* Attach loc_id to reference and hold reference to it */ - if(H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE) < 0) + if(H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference") 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() */ @@ -334,9 +334,10 @@ done: /*------------------------------------------------------------------------- * Function: H5Rdestroy * - * Purpose: Destroy reference and free resources allocated during H5Rcreate. + * Purpose: Destroy reference and free resources allocated during + * H5Rcreate. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / Negative on failure * *------------------------------------------------------------------------- */ @@ -367,9 +368,10 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_type * - * Purpose: Given a reference to some object, return the type of that reference. + * Purpose: Given a reference to some object, return the type of that + * reference. * - * Return: Reference type/H5R_BADTYPE on failure + * Return: Reference type / H5R_BADTYPE on failure * *------------------------------------------------------------------------- */ @@ -398,9 +400,9 @@ done: /*------------------------------------------------------------------------- * Function: H5Requal * - * Purpose: Compare two references + * Purpose: Compare two references * - * Return: TRUE if equal, FALSE if unequal, FAIL if error + * Return: TRUE if equal, FALSE if unequal, FAIL if error * *------------------------------------------------------------------------- */ @@ -428,9 +430,9 @@ done: /*------------------------------------------------------------------------- * Function: H5Rcopy * - * Purpose: Copy a reference + * Purpose: Copy a reference * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / Negative on failure * *------------------------------------------------------------------------- */ @@ -458,20 +460,20 @@ done: /*------------------------------------------------------------------------- * Function: H5Ropen_object * - * Purpose: Given a reference to some object, open that object and return an - * ID for that object. + * Purpose: Given a reference to some object, open that object and + * return an ID for that object. * - * Return: Valid ID on success/Negative on failure + * Return: Valid ID on success / H5I_INVALID_HID on failure * *------------------------------------------------------------------------- */ hid_t -H5Ropen_object(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id) +H5Ropen_object(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id) { hid_t loc_id; /* Reference location ID */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5I_type_t opened_type; /* Opened object type */ void *opened_obj = NULL; /* Opened object */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -530,21 +532,21 @@ done: /*------------------------------------------------------------------------- * Function: H5Ropen_region * - * Purpose: Given a reference to some object, creates a copy of the dataset - * pointed to's dataspace and defines a selection in the copy which is the - * region pointed to. + * Purpose: Given a reference to some object, creates a copy of the dataset + * pointed to's dataspace and defines a selection in the copy + * which is the region pointed to. * - * Return: Valid ID on success/Negative on failure + * Return: Valid ID on success / H5I_INVALID_HID on failure * *------------------------------------------------------------------------- */ hid_t -H5Ropen_region(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id) +H5Ropen_region(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id) { hid_t loc_id; /* Reference location ID */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5I_type_t opened_type; /* Opened object type */ void *opened_obj = NULL; /* Opened object */ hid_t opened_obj_id = H5I_INVALID_HID; /* Opened object ID */ @@ -616,7 +618,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() */ @@ -625,20 +627,20 @@ done: /*------------------------------------------------------------------------- * Function: H5Ropen_attr * - * Purpose: Given a reference to some attribute, open that attribute and - * return an ID for that attribute. + * Purpose: Given a reference to some attribute, open that attribute and + * return an ID for that attribute. * - * Return: Valid ID on success/Negative on failure + * Return: Valid ID on success / H5I_INVALID_HID on failure * *------------------------------------------------------------------------- */ hid_t -H5Ropen_attr(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id) +H5Ropen_attr(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id) { hid_t loc_id; /* Reference location ID */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5I_type_t opened_type; /* Opened object type */ void *opened_obj = NULL; /* Opened object */ hid_t opened_obj_id = H5I_INVALID_HID; /* Opened object ID */ @@ -688,7 +690,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 +702,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() */ @@ -720,20 +722,20 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_obj_type3 * - * Purpose: Given a reference to some object, this function returns the type - * of object pointed to. + * Purpose: Given a reference to some object, this function returns the + * type of object pointed to. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / Negative on failure * *------------------------------------------------------------------------- */ herr_t -H5Rget_obj_type3(const H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type) +H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type) { hid_t loc_id; /* Reference location ID */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -746,7 +748,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 +772,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) @@ -780,10 +782,10 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_file_name * - * Purpose: Given a reference to some object, determine a file name of the - * object located into. + * Purpose: Given a reference to some object, determine a file name of the + * object located into. * - * Return: Non-negative length of the path on success/Negative on failure + * Return: Non-negative length of the path on success / -1 on failure * *------------------------------------------------------------------------- */ @@ -809,8 +811,9 @@ H5Rget_file_name(const H5R_ref_t *ref_ptr, char *buf, size_t size) * copy of the filename */ if((ret_value = H5R__get_file_name((const H5R_ref_priv_t *)ref_ptr, buf, size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to retrieve file name") - } else { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + } + else { + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ /* Retrieve VOL file object */ if(NULL == (vol_obj = H5VL_vol_object(loc_id))) @@ -828,21 +831,21 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_obj_name * - * Purpose: Given a reference to some object, determine a path to the object - * referenced in the file. + * Purpose: Given a reference to some object, determine a path to the + * object referenced in the file. * - * Return: Non-negative length of the path on success/Negative on failure + * Return: Non-negative length of the path on success / -1 on failure * *------------------------------------------------------------------------- */ ssize_t -H5Rget_obj_name(const H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size) +H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size) { hid_t loc_id; /* Reference location ID */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ - ssize_t ret_value; /* Return value */ + H5O_token_t obj_token = {0}; /* Object token */ + ssize_t ret_value = 0; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE4("Zs", "*Rri*sz", ref_ptr, rapl_id, buf, size); @@ -854,7 +857,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))) { @@ -864,7 +867,7 @@ H5Rget_obj_name(const H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size) } /* Get object token */ - if((ret_value = H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL)) < 0) + if(H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to get object token") /* Get the VOL object */ @@ -878,7 +881,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) @@ -888,9 +891,9 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_attr_name * - * Purpose: Given a reference to some attribute, determine its name. + * Purpose: Given a reference to some attribute, determine its name. * - * Return: Non-negative length of the path on success/Negative on failure + * Return: Non-negative length of the path on success / -1 on failure * *------------------------------------------------------------------------- */ @@ -915,3 +918,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..4e44683 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -87,20 +87,20 @@ /*------------------------------------------------------------------------- * Function: H5Rget_obj_type1 * - * Purpose: Retrieves the type of the object that a reference points to. + * Purpose: Retrieves the type of the object that a reference points to. * - * Return: Object type (as defined in H5Gpublic.h) on success - * H5G_UNKNOWN on failure + * Return: Success: Object type (as defined in H5Gpublic.h) + * Failure: H5G_UNKNOWN * *------------------------------------------------------------------------- */ H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5O_type_t obj_type; /* Object type */ const unsigned char *buf = (const unsigned char *)ref; /* Reference buffer */ H5G_obj_t ret_value; /* Return value */ @@ -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); @@ -146,20 +146,21 @@ done: /*------------------------------------------------------------------------- * Function: H5Rdereference1 * - * Purpose: Given a reference to some object, open that object and return an - * ID for that object. + * Purpose: Given a reference to some object, open that object and return + * an ID for that object. * - * Return: Valid ID on success/Negative on failure + * Return: Success: Valid ID + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5I_type_t opened_type; /* Opened object type */ void *opened_obj = NULL; /* Opened object */ const unsigned char *buf = (const unsigned char *)ref; /* Reference buffer */ @@ -209,12 +210,12 @@ done: /*------------------------------------------------------------------------- * Function: H5Rcreate * - * Purpose: Creates a particular type of reference specified with REF_TYPE, - * in the space pointed to by REF. The LOC_ID and NAME are used to locate the - * object pointed to and the SPACE_ID is used to choose the region pointed to - * (for Dataset Region references). + * Purpose: Creates a particular type of reference specified with REF_TYPE, + * in the space pointed to by REF. The LOC_ID and NAME are used to + * locate the object pointed to and the SPACE_ID is used to choose + * the region pointed to (for Dataset Region references). * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / negative on failure * *------------------------------------------------------------------------- */ @@ -222,10 +223,10 @@ herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */ void *vol_obj_file = NULL; @@ -251,6 +252,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,16 +288,17 @@ 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 */ if(ref_type == H5R_OBJECT1) { size_t buf_size = H5R_OBJ_REF_BUF_SIZE; - if((ret_value = H5R__encode_token_obj_compat((const H5VL_token_t *)&obj_token, cont_info.token_size, buf, &buf_size)) < 0) + if((ret_value = H5R__encode_token_obj_compat((const H5O_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 +309,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) + if((ret_value = H5R__encode_token_region_compat(f, (const H5O_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) @@ -316,10 +328,10 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_obj_type2 * - * Purpose: Given a reference to some object, this function returns the type - * of object pointed to. + * Purpose: Given a reference to some object, this function returns the + * type of object pointed to. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / negative on failure * *------------------------------------------------------------------------- */ @@ -327,10 +339,10 @@ herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */ herr_t ret_value = SUCCEED; /* Return value */ @@ -362,7 +374,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) @@ -372,10 +384,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Rdereference2 * - * Purpose: Given a reference to some object, open that object and return an - * ID for that object. + * Purpose: Given a reference to some object, open that object and return + * an ID for that object. * - * Return: Valid ID on success/Negative on failure + * Return: Success: Valid ID + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -383,10 +396,10 @@ hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5I_type_t opened_type; /* Opened object type */ void *opened_obj = NULL; /* Opened object */ const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */ @@ -440,18 +453,19 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_region * - * Purpose: Given a reference to some object, creates a copy of the dataset - * pointed to's dataspace and defines a selection in the copy which is the - * region pointed to. + * Purpose: Given a reference to some object, creates a copy of the dataset + * pointed to's dataspace and defines a selection in the copy + * which is the region pointed to. * - * Return: Valid ID on success/Negative on failure + * Return: Success: Valid ID + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ void *vol_obj_file = NULL; /* VOL file */ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; @@ -475,6 +489,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 +515,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 +528,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) @@ -513,10 +540,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_name * - * Purpose: Given a reference to some object, determine a path to the object - * referenced in the file. + * Purpose: Given a reference to some object, determine a path to the + * object referenced in the file. * - * Return: Non-negative length of the path on success/Negative on failure + * Return: Success: Non-negative length of the path + * Failure: -1 * *------------------------------------------------------------------------- */ @@ -524,10 +552,10 @@ ssize_t H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name, size_t size) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */ ssize_t ret_value = -1; /* Return value */ @@ -559,8 +587,9 @@ 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) } /* end H5Rget_name() */ + diff --git a/src/H5Rint.c b/src/H5Rint.c index 2a21179..33ebe53 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -35,6 +35,8 @@ #include "H5Sprivate.h" /* Dataspaces */ #include "H5Tprivate.h" /* Datatypes */ +#include "H5VLnative_private.h" /* Native VOL connector */ + /****************/ /* Local Macros */ /****************/ @@ -93,9 +95,29 @@ HDfflush(stdout); \ } while (0) static const char * -H5R__print_token(const H5VL_token_t token) { +H5R__print_token(const H5O_token_t token) { static char string[64]; - HDsnprintf(string, 64, "%zu", *(haddr_t *)token); + + /* Print the raw token. */ + HDsnprintf(string, 64, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", + (unsigned char)token.__data[15], + (unsigned char)token.__data[14], + (unsigned char)token.__data[13], + (unsigned char)token.__data[12], + (unsigned char)token.__data[11], + (unsigned char)token.__data[10], + (unsigned char)token.__data[9], + (unsigned char)token.__data[8], + (unsigned char)token.__data[7], + (unsigned char)token.__data[6], + (unsigned char)token.__data[5], + (unsigned char)token.__data[4], + (unsigned char)token.__data[3], + (unsigned char)token.__data[2], + (unsigned char)token.__data[1], + (unsigned char)token.__data[0] + ); + return string; } #else @@ -110,8 +132,8 @@ H5R__print_token(const H5VL_token_t token) { /* Local Prototypes */ /********************/ -static herr_t H5R__encode_obj_token(const H5VL_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc); -static herr_t H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, H5VL_token_t *obj_token, uint8_t *token_size); +static herr_t H5R__encode_obj_token(const H5O_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc); +static herr_t H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, H5O_token_t *obj_token, uint8_t *token_size); static herr_t H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc); static herr_t H5R__decode_region(const unsigned char *buf, size_t *nbytes, H5S_t **space_ptr); static herr_t H5R__encode_string(const char *string, unsigned char *buf, size_t *nalloc); @@ -240,14 +262,14 @@ H5R_term_package(void) /*------------------------------------------------------------------------- * Function: H5R__create_object * - * Purpose: Creates an object reference. + * Purpose: Creates an object reference * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__create_object(const H5VL_token_t *obj_token, size_t token_size, +H5R__create_object(const H5O_token_t *obj_token, size_t token_size, H5R_ref_priv_t *ref) { size_t encode_size; @@ -258,11 +280,11 @@ H5R__create_object(const H5VL_token_t *obj_token, size_t token_size, HDassert(ref); /* Create new reference */ - H5MM_memcpy(&ref->ref.obj.token, obj_token, token_size); - ref->ref.obj.filename = NULL; + ref->info.obj.filename = NULL; ref->loc_id = H5I_INVALID_HID; ref->type = (uint8_t)H5R_OBJECT2; - ref->token_size = (uint8_t)token_size; + if(H5R__set_obj_token(ref, obj_token, token_size) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to set object token") /* Cache encoding size (assume no external reference) */ if(H5R__encode(NULL, ref, NULL, &encode_size, 0) < 0) @@ -270,7 +292,7 @@ H5R__create_object(const H5VL_token_t *obj_token, size_t token_size, ref->encode_size = (uint32_t)encode_size; H5R_LOG_DEBUG("Created object reference, %d, filename=%s, obj_addr=%s, encode size=%u", - (int)sizeof(H5R_ref_priv_t), ref->ref.obj.filename, H5R__print_token(ref->ref.obj.token), + (int)sizeof(H5R_ref_priv_t), ref->info.obj.filename, H5R__print_token(ref->info.obj.token), ref->encode_size); done: @@ -281,14 +303,14 @@ done: /*------------------------------------------------------------------------- * Function: H5R__create_region * - * Purpose: Creates a region reference. + * Purpose: Creates a region reference * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__create_region(const H5VL_token_t *obj_token, size_t token_size, +H5R__create_region(const H5O_token_t *obj_token, size_t token_size, H5S_t *space, H5R_ref_priv_t *ref) { size_t encode_size; @@ -300,14 +322,14 @@ H5R__create_region(const H5VL_token_t *obj_token, size_t token_size, HDassert(ref); /* Create new reference */ - H5MM_memcpy(&ref->ref.obj.token, obj_token, token_size); - ref->ref.obj.filename = NULL; - if(NULL == (ref->ref.reg.space = H5S_copy(space, FALSE, TRUE))) + ref->info.obj.filename = NULL; + if(NULL == (ref->info.reg.space = H5S_copy(space, FALSE, TRUE))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy dataspace") ref->loc_id = H5I_INVALID_HID; ref->type = (uint8_t)H5R_DATASET_REGION2; - ref->token_size = (uint8_t)token_size; + if(H5R__set_obj_token(ref, obj_token, token_size) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to set object token") /* Cache encoding size (assume no external reference) */ if(H5R__encode(NULL, ref, NULL, &encode_size, 0) < 0) @@ -315,16 +337,16 @@ H5R__create_region(const H5VL_token_t *obj_token, size_t token_size, ref->encode_size = (uint32_t)encode_size; H5R_LOG_DEBUG("Created region reference, %d, filename=%s, obj_addr=%s, encode size=%u", - (int)sizeof(H5R_ref_priv_t), ref->ref.obj.filename, H5R__print_token(ref->ref.obj.token), + (int)sizeof(H5R_ref_priv_t), ref->info.obj.filename, H5R__print_token(ref->info.obj.token), ref->encode_size); done: - if(ret_value < 0) { - if(ref->ref.reg.space) { - H5S_close(ref->ref.reg.space); - ref->ref.reg.space = NULL; - } - } + if(ret_value < 0) + if(ref->info.reg.space) { + H5S_close(ref->info.reg.space); + ref->info.reg.space = NULL; + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5R__create_region */ @@ -332,14 +354,14 @@ done: /*------------------------------------------------------------------------- * Function: H5R__create_attr * - * Purpose: Creates an attribute reference. + * Purpose: Creates an attribute reference * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__create_attr(const H5VL_token_t *obj_token, size_t token_size, +H5R__create_attr(const H5O_token_t *obj_token, size_t token_size, const char *attr_name, H5R_ref_priv_t *ref) { size_t encode_size; @@ -355,14 +377,14 @@ H5R__create_attr(const H5VL_token_t *obj_token, size_t token_size, HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, FAIL, "attribute name too long (%d > %d)", (int)HDstrlen(attr_name), H5R_MAX_STRING_LEN) /* Create new reference */ - H5MM_memcpy(&ref->ref.obj.token, obj_token, token_size); - ref->ref.obj.filename = NULL; - if(NULL == (ref->ref.attr.name = HDstrdup(attr_name))) + ref->info.obj.filename = NULL; + if(NULL == (ref->info.attr.name = HDstrdup(attr_name))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy attribute name") ref->loc_id = H5I_INVALID_HID; ref->type = (uint8_t)H5R_ATTR; - ref->token_size = (uint8_t)token_size; + if(H5R__set_obj_token(ref, obj_token, token_size) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to set object token") /* Cache encoding size (assume no external reference) */ if(H5R__encode(NULL, ref, NULL, &encode_size, 0) < 0) @@ -370,12 +392,15 @@ H5R__create_attr(const H5VL_token_t *obj_token, size_t token_size, ref->encode_size = (uint32_t)encode_size; H5R_LOG_DEBUG("Created attribute reference, %d, filename=%s, obj_addr=%s, attr name=%s, encode size=%u", - (int)sizeof(H5R_ref_priv_t), ref->ref.obj.filename, H5R__print_token(ref->ref.obj.token), - ref->ref.attr.name, ref->encode_size); + (int)sizeof(H5R_ref_priv_t), ref->info.obj.filename, H5R__print_token(ref->info.obj.token), + ref->info.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->info.attr.name); + ref->info.attr.name = NULL; + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5R__create_attr */ @@ -383,9 +408,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__destroy * - * Purpose: Destroy reference. + * Purpose: Destroy a reference * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -398,19 +423,24 @@ H5R__destroy(H5R_ref_priv_t *ref) HDassert(ref != NULL); - ref->ref.obj.filename = H5MM_xfree(ref->ref.obj.filename); + H5MM_xfree(ref->info.obj.filename); + ref->info.obj.filename = NULL; switch(ref->type) { case H5R_OBJECT2: break; + case H5R_DATASET_REGION2: - if(H5S_close(ref->ref.reg.space) < 0) + if(H5S_close(ref->info.reg.space) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "Cannot close dataspace") - ref->ref.reg.space = NULL; + ref->info.reg.space = NULL; break; + case H5R_ATTR: - ref->ref.attr.name = H5MM_xfree(ref->ref.attr.name); + H5MM_xfree(ref->info.attr.name); + ref->info.attr.name = NULL; break; + case H5R_OBJECT1: case H5R_DATASET_REGION1: break; @@ -418,14 +448,22 @@ 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)") } /* end switch */ /* Decrement refcount of attached loc_id */ - if(ref->type && (ref->loc_id != H5I_INVALID_HID) && (H5I_dec_ref(ref->loc_id) < 0)) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + if(ref->type && (ref->loc_id != H5I_INVALID_HID)) { + if(ref->app_ref) { + if(H5I_dec_app_ref(ref->loc_id) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + } else { + if(H5I_dec_ref(ref->loc_id) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + } + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -435,14 +473,14 @@ done: /*------------------------------------------------------------------------- * Function: H5R__set_loc_id * - * Purpose: Attach location ID to reference and increment location refcount. + * Purpose: Attach location ID to reference and increment location refcount. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref) +H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref, hbool_t app_ref) { herr_t ret_value = SUCCEED; /* Return value */ @@ -451,14 +489,26 @@ H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref) HDassert(ref != NULL); HDassert(id != H5I_INVALID_HID); - /* If a location ID was previously assigned, decrement refcount and assign new one */ - if((ref->loc_id != H5I_INVALID_HID) && (H5I_dec_ref(ref->loc_id) < 0)) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + /* If a location ID was previously assigned, decrement refcount and + * assign new one */ + if((ref->loc_id != H5I_INVALID_HID)) { + if(ref->app_ref) { + if(H5I_dec_app_ref(ref->loc_id) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + } else { + if(H5I_dec_ref(ref->loc_id) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + } + } ref->loc_id = id; - /* Prevent location ID from being freed until reference is destroyed */ - if(inc_ref && H5I_inc_ref(ref->loc_id, FALSE) < 0) + /* Prevent location ID from being freed until reference is destroyed, + * set app_ref if necessary as references are exposed to users and are + * expected to be destroyed, this allows the loc_id to be cleanly released + * on shutdown if users fail to call H5Rdestroy(). */ + if(inc_ref && H5I_inc_ref(ref->loc_id, app_ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINC, FAIL, "incrementing location ID failed") + ref->app_ref = app_ref; done: FUNC_LEAVE_NOAPI(ret_value) @@ -468,9 +518,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__get_loc_id * - * Purpose: Retrieve location ID attached to existing reference. + * Purpose: Retrieve location ID attached to existing reference. * - * Return: Valid ID on success/Negative on failure + * Return: Valid ID on success / H5I_INVALID_HID on failure * *------------------------------------------------------------------------- */ @@ -492,20 +542,20 @@ H5R__get_loc_id(const H5R_ref_priv_t *ref) /*------------------------------------------------------------------------- * Function: H5R__reopen_file * - * Purpose: Re-open referenced file using file access property list. + * Purpose: Re-open referenced file using file access property list. * - * Return: Valid ID on success/Negative on failure + * Return: Valid ID on success / H5I_INVALID_HID on failure * *------------------------------------------------------------------------- */ 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,32 +570,37 @@ 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) + if(H5R__set_loc_id((H5R_ref_priv_t *)ref, ret_value, FALSE, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "unable to attach location id to reference") done: @@ -556,9 +611,10 @@ done: /*------------------------------------------------------------------------- * Function: H5R__get_type * - * Purpose: Given a reference to some object, return the type of that reference. + * Purpose: Given a reference to some object, return the type of that + * reference. * - * Return: Type of the reference + * Return: Type of the reference * *------------------------------------------------------------------------- */ @@ -570,7 +626,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() */ @@ -579,9 +635,9 @@ H5R__get_type(const H5R_ref_priv_t *ref) /*------------------------------------------------------------------------- * Function: H5R__equal * - * Purpose: Compare two references + * Purpose: Compare two references * - * Return: TRUE if equal, FALSE if unequal, FAIL if error + * Return: TRUE if equal, FALSE if unequal, FAIL if error * *------------------------------------------------------------------------- */ @@ -602,27 +658,27 @@ H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2) /* Compare object addresses */ if(ref1->token_size != ref2->token_size) HGOTO_DONE(FALSE); - if(0 != HDmemcmp(&ref1->ref.obj.token, &ref2->ref.obj.token, ref1->token_size)) + if(0 != HDmemcmp(&ref1->info.obj.token, &ref2->info.obj.token, ref1->token_size)) HGOTO_DONE(FALSE); /* Compare filenames */ - if((ref1->ref.obj.filename && (NULL == ref2->ref.obj.filename)) - || ((NULL == ref1->ref.obj.filename) && ref2->ref.obj.filename)) + if((ref1->info.obj.filename && (NULL == ref2->info.obj.filename)) + || ((NULL == ref1->info.obj.filename) && ref2->info.obj.filename)) HGOTO_DONE(FALSE); - if(ref1->ref.obj.filename && ref1->ref.obj.filename - && (0 != HDstrcmp(ref1->ref.obj.filename, ref2->ref.obj.filename))) + if(ref1->info.obj.filename && ref1->info.obj.filename + && (0 != HDstrcmp(ref1->info.obj.filename, ref2->info.obj.filename))) HGOTO_DONE(FALSE); switch(ref1->type) { case H5R_OBJECT2: break; case H5R_DATASET_REGION2: - if((ret_value = H5S_extent_equal(ref1->ref.reg.space, ref2->ref.reg.space)) < 0) + if((ret_value = H5S_extent_equal(ref1->info.reg.space, ref2->info.reg.space)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "cannot compare dataspace extents") break; case H5R_ATTR: - HDassert(ref1->ref.attr.name && ref2->ref.attr.name); - if(0 != HDstrcmp(ref1->ref.attr.name, ref2->ref.attr.name)) + HDassert(ref1->info.attr.name && ref2->info.attr.name); + if(0 != HDstrcmp(ref1->info.attr.name, ref2->info.attr.name)) HGOTO_DONE(FALSE); break; case H5R_OBJECT1: @@ -644,9 +700,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__copy * - * Purpose: Copy a reference + * Purpose: Copy a reference * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -659,7 +715,7 @@ H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref) HDassert((src_ref != NULL) && (dst_ref != NULL)); - H5MM_memcpy(&dst_ref->ref.obj.token, &src_ref->ref.obj.token, src_ref->token_size); + H5MM_memcpy(&dst_ref->info.obj.token, &src_ref->info.obj.token, sizeof(H5O_token_t)); dst_ref->encode_size = src_ref->encode_size; dst_ref->type = src_ref->type; dst_ref->token_size = src_ref->token_size; @@ -668,11 +724,11 @@ H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref) case H5R_OBJECT2: break; case H5R_DATASET_REGION2: - if(NULL == (dst_ref->ref.reg.space = H5S_copy(src_ref->ref.reg.space, FALSE, TRUE))) + if(NULL == (dst_ref->info.reg.space = H5S_copy(src_ref->info.reg.space, FALSE, TRUE))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy dataspace") break; case H5R_ATTR: - if(NULL == (dst_ref->ref.attr.name = HDstrdup(src_ref->ref.attr.name))) + if(NULL == (dst_ref->info.attr.name = HDstrdup(src_ref->info.attr.name))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy attribute name") break; case H5R_OBJECT1: @@ -688,16 +744,17 @@ H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref) /* We only need to keep a copy of the filename if we don't have the loc_id */ if(src_ref->loc_id == H5I_INVALID_HID) { - HDassert(src_ref->ref.obj.filename); + HDassert(src_ref->info.obj.filename); - if(NULL == (dst_ref->ref.obj.filename = HDstrdup(src_ref->ref.obj.filename))) + if(NULL == (dst_ref->info.obj.filename = HDstrdup(src_ref->info.obj.filename))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy filename") dst_ref->loc_id = H5I_INVALID_HID; - } else { - dst_ref->ref.obj.filename = NULL; + } + else { + dst_ref->info.obj.filename = NULL; /* Set location ID and hold reference to it */ - if(H5R__set_loc_id(dst_ref, src_ref->loc_id, TRUE) < 0) + if(H5R__set_loc_id(dst_ref, src_ref->loc_id, TRUE, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "cannot set reference location ID") } @@ -709,14 +766,14 @@ done: /*------------------------------------------------------------------------- * Function: H5R__get_obj_token * - * Purpose: Given a reference to some object, get the encoded object addr. + * Purpose: Given a reference to some object, get the encoded token. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__get_obj_token(const H5R_ref_priv_t *ref, H5VL_token_t *obj_token, +H5R__get_obj_token(const H5R_ref_priv_t *ref, H5O_token_t *obj_token, size_t *token_size) { herr_t ret_value = SUCCEED; /* Return value */ @@ -724,12 +781,12 @@ H5R__get_obj_token(const H5R_ref_priv_t *ref, H5VL_token_t *obj_token, FUNC_ENTER_PACKAGE HDassert(ref != NULL); - HDassert(ref->token_size <= H5VL_MAX_TOKEN_SIZE); + HDassert(ref->token_size <= H5O_MAX_TOKEN_SIZE); if(obj_token) { if(0 == ref->token_size) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "NULL token size") - H5MM_memcpy(obj_token, &ref->ref.obj.token, ref->token_size); + H5MM_memcpy(obj_token, &ref->info.obj.token, sizeof(H5O_token_t)); } if(token_size) *token_size = ref->token_size; @@ -742,14 +799,14 @@ done: /*------------------------------------------------------------------------- * Function: H5R__set_obj_token * - * Purpose: Given a reference to some object, set the encoded object addr. + * Purpose: Given a reference to some object, set the encoded token. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__set_obj_token(H5R_ref_priv_t *ref, const H5VL_token_t *obj_token, +H5R__set_obj_token(H5R_ref_priv_t *ref, const H5O_token_t *obj_token, size_t token_size) { herr_t ret_value = SUCCEED; /* Return value */ @@ -759,10 +816,10 @@ H5R__set_obj_token(H5R_ref_priv_t *ref, const H5VL_token_t *obj_token, HDassert(ref != NULL); HDassert(obj_token); HDassert(token_size); - HDassert(token_size <= H5VL_MAX_TOKEN_SIZE); + HDassert(token_size <= H5O_MAX_TOKEN_SIZE); - H5MM_memcpy(&ref->ref.obj.token, obj_token, ref->token_size); - ref->token_size = token_size; + H5MM_memcpy(&ref->info.obj.token, obj_token, sizeof(H5O_token_t)); + ref->token_size = (uint8_t)token_size; FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__set_obj_token() */ @@ -771,11 +828,11 @@ H5R__set_obj_token(H5R_ref_priv_t *ref, const H5VL_token_t *obj_token, /*------------------------------------------------------------------------- * Function: H5R__get_region * - * Purpose: Given a reference to some object, creates a copy of the dataset - * pointed to's dataspace and defines a selection in the copy which is the - * region pointed to. + * Purpose: Given a reference to some object, creates a copy of the + * dataset pointed to's dataspace and defines a selection in + * the copy which is the region pointed to. * - * Return: Pointer to the dataspace on success/NULL on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -791,7 +848,7 @@ H5R__get_region(const H5R_ref_priv_t *ref, H5S_t *space) HDassert(space); /* Copy reference selection to destination */ - if(H5S_select_copy(space, ref->ref.reg.space, FALSE) < 0) + if(H5S_select_copy(space, ref->info.reg.space, FALSE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy selection") done: @@ -802,10 +859,10 @@ done: /*------------------------------------------------------------------------- * Function: H5R__get_file_name * - * Purpose: Given a reference to some object, determine a file name of the - * object located into. + * Purpose: Given a reference to some object, determine a file name of + * the object located into. * - * Return: Non-negative length of the path on success/Negative on failure + * Return: Non-negative length of the path on success / -1 on failure * *------------------------------------------------------------------------- */ @@ -821,17 +878,17 @@ H5R__get_file_name(const H5R_ref_priv_t *ref, char *buf, size_t size) HDassert(ref != NULL); /* Return if that reference has no filename set */ - if(!ref->ref.obj.filename) + if(!ref->info.obj.filename) HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, (-1), "no filename available for that reference") /* Get the file name length */ - copy_len = HDstrlen(ref->ref.obj.filename); + copy_len = HDstrlen(ref->info.obj.filename); HDassert(copy_len <= H5R_MAX_STRING_LEN); /* Copy the file name */ if(buf) { copy_len = MIN(copy_len, size - 1); - H5MM_memcpy(buf, ref->ref.obj.filename, copy_len); + H5MM_memcpy(buf, ref->info.obj.filename, copy_len); buf[copy_len] = '\0'; } ret_value = (ssize_t)(copy_len + 1); @@ -844,9 +901,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__get_attr_name * - * Purpose: Given a reference to some attribute, determine its name. + * Purpose: Given a reference to some attribute, determine its name. * - * Return: Non-negative length of the path on success/Negative on failure + * Return: Non-negative length of the path on success / -1 on failure * *------------------------------------------------------------------------- */ @@ -863,13 +920,13 @@ H5R__get_attr_name(const H5R_ref_priv_t *ref, char *buf, size_t size) HDassert(ref->type == H5R_ATTR); /* Get the attribute name length */ - attr_name_len = HDstrlen(ref->ref.attr.name); + attr_name_len = HDstrlen(ref->info.attr.name); HDassert(attr_name_len <= H5R_MAX_STRING_LEN); /* Get the attribute name */ if(buf) { size_t copy_len = MIN(attr_name_len, size - 1); - H5MM_memcpy(buf, ref->ref.attr.name, copy_len); + H5MM_memcpy(buf, ref->info.attr.name, copy_len); buf[copy_len] = '\0'; } @@ -882,9 +939,9 @@ H5R__get_attr_name(const H5R_ref_priv_t *ref, char *buf, size_t size) /*------------------------------------------------------------------------- * Function: H5R__encode * - * Purpose: Private function for H5Rencode. + * Purpose: Private function for H5Rencode * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -922,11 +979,11 @@ 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 */ - H5R_ENCODE_VAR(H5R__encode_obj_token, &ref->ref.obj.token, ref->token_size, + H5R_ENCODE_VAR(H5R__encode_obj_token, &ref->info.obj.token, ref->token_size, p, buf_size, encode_size, "Cannot encode object address"); /** @@ -937,31 +994,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, + H5R_ENCODE(H5R__encode_region, ref->info.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, + H5R_ENCODE(H5R__encode_string, ref->info.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)") @@ -977,9 +1037,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__decode * - * Purpose: Private function for H5Rdecode. + * Purpose: Private function for H5Rdecode * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1003,7 +1063,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") @@ -1014,28 +1074,29 @@ H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref) decode_size += H5R_ENCODE_HEADER_SIZE; /* Decode object token */ - H5R_DECODE_VAR(H5R__decode_obj_token, &ref->ref.obj.token, &ref->token_size, + H5R_DECODE_VAR(H5R__decode_obj_token, &ref->info.obj.token, &ref->token_size, p, buf_size, decode_size, "Cannot decode object address"); /* We do not need to store the filename if the reference is internal */ if(flags & H5R_IS_EXTERNAL) { /* Decode file name */ - H5R_DECODE(H5R__decode_string, &ref->ref.obj.filename, p, buf_size, + H5R_DECODE(H5R__decode_string, &ref->info.obj.filename, p, buf_size, decode_size, "Cannot decode filename"); - } else - ref->ref.obj.filename = NULL; + } + else + ref->info.obj.filename = NULL; switch(ref->type) { case H5R_OBJECT2: break; case H5R_DATASET_REGION2: /* Decode dataspace */ - H5R_DECODE(H5R__decode_region, &ref->ref.reg.space, p, buf_size, + H5R_DECODE(H5R__decode_region, &ref->info.reg.space, p, buf_size, decode_size, "Cannot decode region"); break; case H5R_ATTR: /* Decode attribute name */ - H5R_DECODE(H5R__decode_string, &ref->ref.attr.name, p, buf_size, + H5R_DECODE(H5R__decode_string, &ref->info.attr.name, p, buf_size, decode_size, "Cannot decode attribute name"); break; case H5R_OBJECT1: @@ -1053,10 +1114,10 @@ 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), + ref->info.obj.filename, H5R__print_token(ref->info.obj.token), ref->encode_size); *nbytes = decode_size; @@ -1069,14 +1130,14 @@ done: /*------------------------------------------------------------------------- * Function: H5R__encode_obj_token * - * Purpose: Encode an object address. + * Purpose: Encode an object address. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -H5R__encode_obj_token(const H5VL_token_t *obj_token, size_t token_size, +H5R__encode_obj_token(const H5O_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc) { herr_t ret_value = SUCCEED; @@ -1104,15 +1165,15 @@ H5R__encode_obj_token(const H5VL_token_t *obj_token, size_t token_size, /*------------------------------------------------------------------------- * Function: H5R__decode_obj_token * - * Purpose: Decode an object address. + * Purpose: Decode an object address. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, - H5VL_token_t *obj_token, uint8_t *token_size) + H5O_token_t *obj_token, uint8_t *token_size) { const uint8_t *p = (const uint8_t *)buf; herr_t ret_value = SUCCEED; @@ -1130,13 +1191,16 @@ H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, /* Get token size */ *token_size = *p++; - if(*token_size > sizeof(H5VL_token_t)) + if(*token_size > sizeof(H5O_token_t)) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Invalid token size (%u)", *token_size) + /* Make sure that token is initialized */ + HDmemset(obj_token, 0, sizeof(H5O_token_t)); + /* 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) @@ -1146,9 +1210,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__encode_region * - * Purpose: Encode a selection. + * Purpose: Encode a selection. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1184,7 +1248,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: @@ -1195,9 +1259,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__decode_region * - * Purpose: Decode a selection. + * Purpose: Decode a selection. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1251,9 +1315,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__encode_string * - * Purpose: Encode a string. + * Purpose: Encode a string. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1293,9 +1357,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__decode_string * - * Purpose: Decode a string. + * Purpose: Decode a string. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1322,7 +1386,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 */ @@ -1340,9 +1404,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__encode_heap * - * Purpose: Encode data and insert into heap (native only). + * Purpose: Encode data and insert into heap (native only). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1364,13 +1428,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: @@ -1381,9 +1445,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__decode_heap * - * Purpose: Decode data inserted into heap (native only). + * Purpose: Decode data inserted into heap (native only). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1416,7 +1480,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; @@ -1428,9 +1492,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__free_heap * - * Purpose: Remove data previously inserted into heap (native only). + * Purpose: Remove data previously inserted into heap (native only). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1462,7 +1526,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: @@ -1473,15 +1537,15 @@ done: /*------------------------------------------------------------------------- * Function: H5R__decode_token_compat * - * Purpose: Decode an object token. (native only) + * Purpose: Decode an object token. (native only) * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, - const unsigned char *buf, H5VL_token_t *obj_token) + const unsigned char *buf, H5O_token_t *obj_token) { hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */ H5VL_object_t *vol_obj_file = NULL; @@ -1490,6 +1554,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 +1576,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 +1585,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) @@ -1531,14 +1609,14 @@ done: /*------------------------------------------------------------------------- * Function: H5R__encode_token_obj_compat * - * Purpose: Encode an object token. (native only) + * Purpose: Encode an object token. (native only) * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__encode_token_obj_compat(const H5VL_token_t *obj_token, size_t token_size, +H5R__encode_token_obj_compat(const H5O_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc) { herr_t ret_value = SUCCEED; @@ -1562,15 +1640,15 @@ H5R__encode_token_obj_compat(const H5VL_token_t *obj_token, size_t token_size, /*------------------------------------------------------------------------- * Function: H5R__decode_token_obj_compat * - * Purpose: Decode an object token. (native only) + * Purpose: Decode an object token. (native only) * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5R__decode_token_obj_compat(const unsigned char *buf, size_t *nbytes, - H5VL_token_t *obj_token, size_t token_size) + H5O_token_t *obj_token, size_t token_size) { herr_t ret_value = SUCCEED; @@ -1597,14 +1675,15 @@ done: /*------------------------------------------------------------------------- * Function: H5R__encode_token_region_compat * - * Purpose: Encode dataset selection and insert data into heap (native only). + * Purpose: Encode dataset selection and insert data into heap + * (native only). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__encode_token_region_compat(H5F_t *f, const H5VL_token_t *obj_token, +H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token, size_t token_size, H5S_t *space, unsigned char *buf, size_t *nalloc) { size_t buf_size; @@ -1646,7 +1725,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; @@ -1672,19 +1751,20 @@ done: /*------------------------------------------------------------------------- * Function: H5R__decode_token_region_compat * - * Purpose: Decode dataset selection from data inserted into heap (native only). + * Purpose: Decode dataset selection from data inserted into heap + * (native only). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, - size_t *nbytes, H5VL_token_t *obj_token, size_t token_size, + size_t *nbytes, H5O_token_t *obj_token, size_t token_size, H5S_t **space_ptr) { unsigned char *data = NULL; - H5VL_token_t token = { 0 }; + H5O_token_t token = { 0 }; size_t data_size; const uint8_t *p; herr_t ret_value = SUCCEED; @@ -1708,16 +1788,17 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, if(space_ptr) { H5O_loc_t oloc; /* Object location */ H5S_t *space = NULL; - const uint8_t *q = (const uint8_t *)&token; /* Initialize the object location */ H5O_loc_reset(&oloc); oloc.file = f; - H5F_addr_decode(f, &q, &oloc.addr); + + if(H5VL_native_token_to_addr(f, H5I_FILE, token, &oloc.addr) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") /* 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) @@ -1726,9 +1807,10 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, *space_ptr = space; } if(obj_token) - H5MM_memcpy(obj_token, &token, token_size); + H5MM_memcpy(obj_token, &token, sizeof(H5O_token_t)); done: H5MM_free(data); FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__decode_token_region_compat() */ + diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index 7471487..36cf805 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -40,8 +40,8 @@ #define H5R_IS_EXTERNAL 0x1 /* Set when encoding reference to external file */ /* Macros for convenience */ -#define H5R_REF_FILENAME(x) ((x)->ref.obj.filename) -#define H5R_REF_ATTRNAME(x) ((x)->ref.attr.name) +#define H5R_REF_FILENAME(x) ((x)->info.obj.filename) +#define H5R_REF_ATTRNAME(x) ((x)->info.attr.name) /* Header size */ #define H5R_ENCODE_HEADER_SIZE (2 * H5_SIZEOF_UINT8_T) @@ -52,7 +52,7 @@ /* Object reference */ typedef struct H5R_ref_priv_obj_t { - H5VL_token_t token; /* Object token */ + H5O_token_t token; /* Object token */ char *filename; /* File name */ } H5R_ref_priv_obj_t; @@ -74,12 +74,12 @@ typedef struct H5R_ref_priv_t { H5R_ref_priv_obj_t obj;/* Object reference */ H5R_ref_priv_reg_t reg;/* Region reference */ H5R_ref_priv_attr_t attr;/* Attribute Reference */ - } ref; + } info; hid_t loc_id; /* Cached location identifier */ uint32_t encode_size; /* Cached encoding size */ int8_t type; /* Reference type */ uint8_t token_size; /* Cached token size */ - char unused[18]; /* Unused */ + hbool_t app_ref; /* App ref on loc_id */ } H5R_ref_priv_t; /*****************************/ @@ -90,12 +90,12 @@ typedef struct H5R_ref_priv_t { /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5R__create_object(const H5VL_token_t *obj_token, size_t token_size, H5R_ref_priv_t *ref); -H5_DLL herr_t H5R__create_region(const H5VL_token_t *obj_token, size_t token_size, H5S_t *space, H5R_ref_priv_t *ref); -H5_DLL herr_t H5R__create_attr(const H5VL_token_t *obj_token, size_t token_size, const char *attr_name, H5R_ref_priv_t *ref); +H5_DLL herr_t H5R__create_object(const H5O_token_t *obj_token, size_t token_size, H5R_ref_priv_t *ref); +H5_DLL herr_t H5R__create_region(const H5O_token_t *obj_token, size_t token_size, H5S_t *space, H5R_ref_priv_t *ref); +H5_DLL herr_t H5R__create_attr(const H5O_token_t *obj_token, size_t token_size, const char *attr_name, H5R_ref_priv_t *ref); H5_DLL herr_t H5R__destroy(H5R_ref_priv_t *ref); -H5_DLL herr_t H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref); +H5_DLL herr_t H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref, hbool_t app_ref); H5_DLL hid_t H5R__get_loc_id(const H5R_ref_priv_t *ref); H5_DLL hid_t H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id); @@ -103,8 +103,8 @@ H5_DLL H5R_type_t H5R__get_type(const H5R_ref_priv_t *ref); H5_DLL htri_t H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2); H5_DLL herr_t H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref); -H5_DLL herr_t H5R__get_obj_token(const H5R_ref_priv_t *ref, H5VL_token_t *obj_token, size_t *token_size); -H5_DLL herr_t H5R__set_obj_token(H5R_ref_priv_t *ref, const H5VL_token_t *obj_token, size_t token_size); +H5_DLL herr_t H5R__get_obj_token(const H5R_ref_priv_t *ref, H5O_token_t *obj_token, size_t *token_size); +H5_DLL herr_t H5R__set_obj_token(H5R_ref_priv_t *ref, const H5O_token_t *obj_token, size_t token_size); H5_DLL herr_t H5R__get_region(const H5R_ref_priv_t *ref, H5S_t *space); H5_DLL ssize_t H5R__get_file_name(const H5R_ref_priv_t *ref, char *buf, size_t size); @@ -118,13 +118,13 @@ H5_DLL herr_t H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc, c H5_DLL herr_t H5R__decode_heap(H5F_t *f, const unsigned char *buf, size_t *nbytes, unsigned char **data_ptr, size_t *data_size); H5_DLL herr_t H5R__free_heap(H5F_t *f, const unsigned char *buf, size_t nbytes); -H5_DLL herr_t H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5VL_token_t *obj_token); +H5_DLL herr_t H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5O_token_t *obj_token); -H5_DLL herr_t H5R__encode_token_obj_compat(const H5VL_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc); -H5_DLL herr_t H5R__decode_token_obj_compat(const unsigned char *buf, size_t *nbytes, H5VL_token_t *obj_token, size_t token_size); +H5_DLL herr_t H5R__encode_token_obj_compat(const H5O_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc); +H5_DLL herr_t H5R__decode_token_obj_compat(const unsigned char *buf, size_t *nbytes, H5O_token_t *obj_token, size_t token_size); -H5_DLL herr_t H5R__encode_token_region_compat(H5F_t *f, const H5VL_token_t *obj_token, size_t token_size, H5S_t *space, unsigned char *buf, size_t *nalloc); -H5_DLL herr_t H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, size_t *nbytes, H5VL_token_t *obj_token, size_t token_size, H5S_t **space_ptr); +H5_DLL herr_t H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token, size_t token_size, H5S_t *space, unsigned char *buf, size_t *nalloc); +H5_DLL herr_t H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, size_t *nbytes, H5O_token_t *obj_token, size_t token_size, H5S_t **space_ptr); #endif /* _H5Rpkg_H */ 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..13d82d7 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,10 @@ typedef struct { * should always be used with the current reference API. */ typedef struct { - char __data[H5R_REF_BUF_SIZE]; + union { + uint8_t __data[H5R_REF_BUF_SIZE]; /* opaque data */ + int64_t align; /* ensures alignment */ + } u; } H5R_ref_t; /********************/ @@ -108,16 +111,16 @@ H5_DLL htri_t H5Requal(const H5R_ref_t *ref1_ptr, const H5R_ref_t *ref2_ptr); H5_DLL herr_t H5Rcopy(const H5R_ref_t *src_ref_ptr, H5R_ref_t *dst_ref_ptr); /* Dereference */ -H5_DLL hid_t H5Ropen_object(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id); -H5_DLL hid_t H5Ropen_region(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id); -H5_DLL hid_t H5Ropen_attr(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id); +H5_DLL hid_t H5Ropen_object(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id); +H5_DLL hid_t H5Ropen_region(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id); +H5_DLL hid_t H5Ropen_attr(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id); /* Get type */ -H5_DLL herr_t H5Rget_obj_type3(const H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type); +H5_DLL herr_t H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type); /* Get name */ H5_DLL ssize_t H5Rget_file_name(const H5R_ref_t *ref_ptr, char *buf, size_t size); -H5_DLL ssize_t H5Rget_obj_name(const H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size); +H5_DLL ssize_t H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size); H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *buf, size_t size); /* Symbols defined for compatibility with previous versions of the HDF5 API. @@ -652,7 +652,7 @@ int H5SL_term_package(void) /* Terminate all the factories */ if(H5SL_fac_nused_g > 0) { size_t i; - herr_t ret; + herr_t H5_ATTR_NDEBUG_UNUSED ret; for(i = 0; i < H5SL_fac_nused_g; i++) { ret = H5FL_fac_term(H5SL_fac_g[i]); diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 49ce2b4..6d0f2b0 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -212,8 +212,8 @@ H5SM__cache_table_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU *------------------------------------------------------------------------- */ static void * -H5SM__cache_table_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty) +H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, + void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5F_t *f; /* File pointer -- from user data */ H5SM_master_table_t *table = NULL; /* Shared message table that we deserializing */ @@ -364,7 +364,7 @@ H5SM__cache_table_image_len(const void *_thing, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t len, +H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5SM_master_table_t *table = (H5SM_master_table_t *)_thing; /* Shared message table to encode */ @@ -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); @@ -568,8 +568,8 @@ H5SM__cache_list_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, vo *------------------------------------------------------------------------- */ static void * -H5SM__cache_list_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty) +H5SM__cache_list_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, + void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5SM_list_t *list = NULL; /* The SOHM list being read in */ H5SM_list_cache_ud_t *udata = (H5SM_list_cache_ud_t *)_udata; /* User data for callback */ @@ -687,7 +687,7 @@ H5SM__cache_list_image_len(const void *_thing, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t len, +H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5SM_list_t *list = (H5SM_list_t *)_thing ; /* Instance being serialized */ 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..13233ce 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() */ @@ -2601,9 +2601,9 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, { H5S_t *new_space = NULL; /* New dataspace constructed */ H5S_t *tmp_src_intersect_space = NULL; /* Temporary SIS converted from points->hyperslabs */ - H5S_sel_iter_t ss_iter; /* Selection iterator for src_space */ + H5S_sel_iter_t *ss_iter = NULL; /* Selection iterator for src_space */ hbool_t ss_iter_init = FALSE; /* Whether ss_iter has been initialized */ - H5S_sel_iter_t ds_iter; /* Selection iterator for dst_space */ + H5S_sel_iter_t *ds_iter = NULL; /* Selection iterator for dst_space */ hbool_t ds_iter_init = FALSE; /* Whether ds_iter has been initialized */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2617,6 +2617,11 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space)); HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space)); + if(NULL == (ss_iter = H5FL_CALLOC(H5S_sel_iter_t))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator") + if(NULL == (ds_iter = H5FL_CALLOC(H5S_sel_iter_t))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator") + /* Create new space, using dst extent. Start with "all" selection. */ if(NULL == (new_space = H5S_create(H5S_SIMPLE))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create output dataspace") @@ -2717,20 +2722,20 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") /* Initialize iterators */ - if(H5S_select_iter_init(&ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) + if(H5S_select_iter_init(ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize source space selection iterator") ss_iter_init = TRUE; - if(H5S_select_iter_init(&ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) + if(H5S_select_iter_init(ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize destination space selection iterator") ds_iter_init = TRUE; /* Iterate over points */ do { - HDassert(ss_iter.elmt_left > 0); - HDassert(ss_iter.elmt_left > 0); + HDassert(ss_iter->elmt_left > 0); + HDassert(ss_iter->elmt_left > 0); /* Get SS coords */ - if(H5S_SELECT_ITER_COORDS(&ss_iter, coords) < 0) + if(H5S_SELECT_ITER_COORDS(ss_iter, coords) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get source selection coordinates") /* Check for intersection */ @@ -2740,7 +2745,7 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, /* Add point if it intersects */ if(intersect) { /* Get DS coords */ - if(H5S_SELECT_ITER_COORDS(&ds_iter, coords) < 0) + if(H5S_SELECT_ITER_COORDS(ds_iter, coords) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get destination selection coordinates") /* Add point to new_space */ @@ -2749,14 +2754,14 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, } /* end if */ /* Advance iterators */ - if(H5S_SELECT_ITER_NEXT(&ss_iter, 1) < 0) + if(H5S_SELECT_ITER_NEXT(ss_iter, 1) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne source selection iterator") - ss_iter.elmt_left--; - if(H5S_SELECT_ITER_NEXT(&ds_iter, 1) < 0) + ss_iter->elmt_left--; + if(H5S_SELECT_ITER_NEXT(ds_iter, 1) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne destination selection iterator") - ds_iter.elmt_left--; - } while(ss_iter.elmt_left > 0); - HDassert(H5S_SELECT_ITER_NELMTS(&ds_iter) == 0); + ds_iter->elmt_left--; + } while(ss_iter->elmt_left > 0); + HDassert(H5S_SELECT_ITER_NELMTS(ds_iter) == 0); } /* end if */ else { HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_NONE); @@ -2783,11 +2788,14 @@ done: /* General cleanup */ if(tmp_src_intersect_space && H5S_close(tmp_src_intersect_space) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release temporary dataspace") - if(ss_iter_init && H5S_SELECT_ITER_RELEASE(&ss_iter) < 0) + if(ss_iter_init && H5S_SELECT_ITER_RELEASE(ss_iter) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release source selection iterator") - if(ds_iter_init && H5S_SELECT_ITER_RELEASE(&ds_iter) < 0) + if(ds_iter_init && H5S_SELECT_ITER_RELEASE(ds_iter) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release destination selection iterator") + ss_iter = H5FL_FREE(H5S_sel_iter_t, ss_iter); + ds_iter = H5FL_FREE(H5S_sel_iter_t, ds_iter); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_project_intersection() */ @@ -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..1b922d5 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -106,7 +106,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, void *data = NULL; /* VOL-managed datatype data */ H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */ H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -273,7 +273,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) void *dt = NULL; /* datatype object created by VOL connector */ H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */ H5T_t *type = NULL; /* Datatype created */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -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 */ @@ -567,8 +568,8 @@ done: hid_t H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) { - void *dt = NULL; /* datatype token created by VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *dt = NULL; /* datatype object created by VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -1095,7 +1096,7 @@ H5T_construct_datatype(H5VL_object_t *vol_obj) { ssize_t nalloc; void *buf = NULL; - H5T_t *dt = NULL; /* datatype token from VOL connector */ + H5T_t *dt = NULL; /* datatype object from VOL connector */ H5T_t *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 4cc5f3c..29fd582 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -1848,7 +1848,7 @@ H5T_conv_struct_free(H5T_conv_struct_t *priv) for(i = 0; i < priv->src_nmembs; i++) if(src2dst[i] >= 0) { - int status; + int H5_ATTR_NDEBUG_UNUSED status; status = H5I_dec_ref(src_memb_id[i]); HDassert(status >= 0); @@ -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..2c98dc0 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -110,7 +110,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) void *data = NULL; /* VOL-managed datatype data */ H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */ H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -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 */ @@ -174,8 +175,8 @@ done: hid_t H5Topen1(hid_t loc_id, const char *name) { - void *dt = NULL; /* Datatype token created by VOL connector */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + void *dt = NULL; /* Datatype object created by VOL connector */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ diff --git a/src/H5Tref.c b/src/H5Tref.c index 6f21363..f97b78a 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -46,7 +46,7 @@ /* For region compatibility support */ struct H5Tref_dsetreg { - H5VL_token_t token; /* Object token */ + H5O_token_t token; /* Object token */ H5S_t *space; /* Dataspace */ }; @@ -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 H5O_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)) { @@ -576,10 +622,11 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size if((file_id = H5F_get_file_id(src_file, H5I_FILE, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - /* Attach loc ID to reference and hold reference to it */ - if(H5R__set_loc_id(dst_ref, file_id, TRUE) < 0) + /* Attach loc ID to reference and hold reference to it, this is a + * user exposed reference so set app_ref to TRUE. */ + if(H5R__set_loc_id(dst_ref, file_id, TRUE, 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 +760,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) @@ -736,7 +784,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, +H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_NDEBUG_UNUSED src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t dst_size) { const uint8_t *p = (const uint8_t *)src_buf; @@ -856,8 +904,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 +954,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 +1002,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 +1024,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) + (H5O_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 +1057,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))) @@ -1013,26 +1101,37 @@ H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, { size_t ret_value = sizeof(struct H5Tref_dsetreg); +#ifndef NDEBUG FUNC_ENTER_STATIC +#else + FUNC_ENTER_STATIC_NOERR +#endif HDassert(src_buf); #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 */ +#ifndef NDEBUG done: +#endif FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__ref_dsetreg_disk_getsize() */ @@ -1061,8 +1160,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 +1181,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 +1209,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 @@ -249,6 +249,38 @@ done: /*------------------------------------------------------------------------- * Function: H5VLget_connector_id * + * Purpose: Retrieves the VOL connector ID for a given object ID. + * + * Return: A valid VOL connector ID. This ID will need to be closed + * using H5VLclose(). + * + * H5I_INVALID_HID on error. + * + * Programmer: Dana Robinson + * June 17, 2017 + * + *------------------------------------------------------------------------- + */ +hid_t +H5VLget_connector_id(hid_t obj_id) +{ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE1("i", "i", obj_id); + + /* Get connector ID */ + if((ret_value = H5VL__get_connector_id(obj_id, TRUE)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLget_connector_id() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLget_connector_id_by_name + * * Purpose: Retrieves the ID for a registered VOL connector. * * Return: A valid VOL connector ID if a connector by that name has @@ -264,7 +296,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VLget_connector_id(const char *name) +H5VLget_connector_id_by_name(const char *name) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -272,12 +304,12 @@ H5VLget_connector_id(const char *name) H5TRACE1("i", "*s", name); /* Get connector ID with this name */ - if((ret_value = H5VL__get_connector_id(name, TRUE)) < 0) + if((ret_value = H5VL__get_connector_id_by_name(name, TRUE)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLget_connector_id() */ +} /* end H5VLget_connector_id_by_name() */ /*------------------------------------------------------------------------- @@ -411,7 +443,7 @@ H5VLunregister_connector(hid_t vol_id) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* For the time being, we disallow unregistering the native VOL connector */ - if(H5I_INVALID_HID == (native_id = H5VL__get_connector_id(H5VL_NATIVE_NAME, FALSE))) + if(H5I_INVALID_HID == (native_id = H5VL__get_connector_id_by_name(H5VL_NATIVE_NAME, FALSE))) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to find the native VOL connector ID") if(vol_id == native_id) HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "unregistering the native VOL connector is not allowed") @@ -477,6 +509,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 +527,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..e4ebb95 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, - 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, +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_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,16 @@ 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__token_cmp(void *obj, const H5VL_class_t *cls, + const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value); +static herr_t H5VL__token_to_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls, + const H5O_token_t *token, char **token_str); +static herr_t H5VL__token_from_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls, + const char *token_str, H5O_token_t *token); +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 +966,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 +998,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 +1014,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 +1079,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 +1119,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 +1183,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 +1214,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 +1223,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 +1285,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 +1316,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 +1325,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 +1388,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 +1419,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 +1430,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 +1500,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 +1543,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 +1613,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 +1625,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 +1644,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 +1655,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 +1689,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 +1706,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 +1730,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 +1760,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 +1860,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 +1919,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 +1950,7 @@ done: * * Purpose: Opens a dataset through the VOL * - * Return: Success: Pointer to dataset + * Return: Success: Pointer to dataset * Failure: NULL * *------------------------------------------------------------------------- @@ -1950,7 +1965,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 +2028,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 +2060,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 +2071,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 +2134,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 +2166,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 +2177,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 +2241,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 +2272,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 +2283,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 +2353,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 +2384,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 +2395,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 +2465,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 +2477,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 +2496,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 +2506,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 +2541,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 +2558,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 +2625,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 +2677,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 +3443,7 @@ done: * * Purpose: Opens a file through the VOL. * - * Return: Success: Pointer to file. + * Return: Success: Pointer to file. * Failure: NULL * *------------------------------------------------------------------------- @@ -2810,7 +3477,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 +3556,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 +3587,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 +3598,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 +3658,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 +3668,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 +3679,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 +3691,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 +3699,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 +3714,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 +3742,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 +3814,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 +3826,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 +3845,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 +3856,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 +3890,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 +3907,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 +3968,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 +4072,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 +4177,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 +4241,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 +4272,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 +4283,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 +4353,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 +4384,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 +4395,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 +4465,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 +4477,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 +4496,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 +4507,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 +4541,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 +4558,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 +4619,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 +4683,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) { @@ -4113,7 +4719,7 @@ H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_o const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, ...) { - H5VL_object_t tmp_vol_obj; /* Temporary object token of */ + H5VL_object_t tmp_vol_obj; /* Temporary object */ 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 */ @@ -4140,7 +4746,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 +4814,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 +4846,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 +4859,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 +4923,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 +4955,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 +4968,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 +5075,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 +5145,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 +5187,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 +5257,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 +5269,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 +5288,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 +5299,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 +5333,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 +5350,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 +5409,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 +5472,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 +5505,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 +5521,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 +5630,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 +5700,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 +5743,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 +5817,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 +5829,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 +5848,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 +5859,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 +5893,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 +5910,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 +5919,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 + * Function: H5VL__introspect_get_conn_cls * - * 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 - * - * 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 +5930,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 +5968,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 +6006,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 */ - - 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") + 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_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 +6046,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 +6078,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 +6087,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 +6101,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 +6116,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 +6203,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 +6319,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 +6432,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 +6543,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 +6610,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 +6626,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 +6645,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 +6659,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 +6693,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 +6771,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 +6883,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 +6993,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 +7107,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 +7165,504 @@ 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__token_cmp + * + * Purpose: Compares two VOL connector object tokens. Sets *cmp_value + * to positive if token1 is greater than token2, negative if + * token2 is greater than token1 and zero if token1 and + * token2 are equal. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__token_cmp(void *obj, const H5VL_class_t *cls, + const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(obj); + HDassert(cls); + HDassert(cmp_value); + + /* Take care of cases where one or both pointers is NULL */ + if(token1 == NULL && token2 != NULL) + *cmp_value = -1; + else if(token1 != NULL && token2 == NULL) + *cmp_value = 1; + else if(token1 == NULL && token2 == NULL) + *cmp_value = 0; + else { + /* Use the class's token comparison routine to compare the tokens, + * if there is a callback, otherwise just compare the tokens as + * memory buffers. + */ + if(cls->token_cls.cmp) { + if((cls->token_cls.cmp)(obj, token1, token2, cmp_value) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare object tokens") + } /* end if */ + else + *cmp_value = HDmemcmp(token1, token2, sizeof(H5O_token_t)); + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__token_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_token_cmp + * + * Purpose: Compares two VOL connector object tokens. Sets *cmp_value + * to positive if token1 is greater than token2, negative if + * token2 is greater than token1 and zero if token1 and + * token2 are equal. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_token_cmp(const H5VL_object_t *vol_obj, const H5O_token_t *token1, + const H5O_token_t *token2, int *cmp_value) +{ + 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 checks */ + HDassert(vol_obj); + HDassert(cmp_value); + + /* 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((ret_value = H5VL__token_cmp(vol_obj->data, vol_obj->connector->cls, token1, token2, cmp_value)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "token compare 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_token_cmp() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLtoken_cmp + * + * Purpose: Compares two VOL connector object tokens + * + * Note: Both object tokens must be from the same VOL connector class + * + * Return: Success: Non-negative, with *cmp_value set to positive if + * token1 is greater than token2, negative if token2 + * is greater than token1 and zero if token1 and + * token2 are equal. + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLtoken_cmp(void *obj, hid_t connector_id, const H5O_token_t *token1, + const H5O_token_t *token2, int *cmp_value) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xi*k*k*Is", obj, connector_id, token1, token2, cmp_value); + + /* 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") + if(NULL == cmp_value) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid cmp_value pointer") + + /* Call the corresponding internal VOL routine */ + if(H5VL__token_cmp(obj, cls, token1, token2, cmp_value) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "object token comparison failed") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLtoken_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__token_to_str + * + * Purpose: Serialize a connector's object token into a string + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__token_to_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls, + const H5O_token_t *token, char **token_str) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(obj); + HDassert(cls); + HDassert(token); + HDassert(token_str); + + /* Use the class's token serialization routine on the token if there is a + * callback, otherwise just set the token_str to NULL. + */ + if(cls->token_cls.to_str) { + if((cls->token_cls.to_str)(obj, obj_type, token, token_str) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "can't serialize object token") + } /* end if */ + else + *token_str = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__token_to_str() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_token_to_str + * + * Purpose: Serialize a connector's object token into a string + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_token_to_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, + const H5O_token_t *token, char **token_str) +{ + 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 checks */ + HDassert(vol_obj); + HDassert(token); + HDassert(token_str); + + /* 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((ret_value = H5VL__token_to_str(vol_obj->data, obj_type, vol_obj->connector->cls, token, token_str)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "token serialization 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_token_to_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLtoken_to_str + * + * Purpose: Serialize a connector's object token into a string + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLtoken_to_str(void *obj, H5I_type_t obj_type, hid_t connector_id, + const H5O_token_t *token, char **token_str) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xIti*k**s", obj, obj_type, connector_id, token, token_str); + + /* 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") + if(NULL == token) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer") + if(NULL == token_str) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token_str pointer") + + /* Call the corresponding internal VOL routine */ + if(H5VL__token_to_str(obj, obj_type, cls, token, token_str) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "object token to string failed") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLtoken_to_str() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__token_from_str + * + * Purpose: Deserialize a string into a connector object token + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__token_from_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls, + const char *token_str, H5O_token_t *token) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(obj); + HDassert(cls); + HDassert(token_str); + HDassert(token); + + /* Use the class's token deserialization routine on the token if there is a + * callback, otherwise just set the token to H5_TOKEN_UNDEF. + */ + if(cls->token_cls.from_str) { + if((cls->token_cls.from_str)(obj, obj_type, token_str, token) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token string") + } /* end if */ + else + *token = H5O_TOKEN_UNDEF; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__token_from_str() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_token_from_str + * + * Purpose: Deserialize a string into a connector object token + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, + const char *token_str, H5O_token_t *token) +{ + 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 checks */ + HDassert(vol_obj); + HDassert(token); + HDassert(token_str); + + /* 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((ret_value = H5VL__token_from_str(vol_obj->data, obj_type, vol_obj->connector->cls, token_str, token)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "token deserialization 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_token_from_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLtoken_from_str + * + * Purpose: Deserialize a string into a connector object token + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLtoken_from_str(void *obj, H5I_type_t obj_type, hid_t connector_id, + const char *token_str, H5O_token_t *token) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xIti*s*k", obj, obj_type, connector_id, token_str, token); + + /* 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") + if(NULL == token) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer") + if(NULL == token_str) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token_str pointer") + + /* Call the corresponding internal VOL routine */ + if(H5VL__token_from_str(obj, obj_type, cls, token_str, token) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "object token from string failed") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLtoken_from_str() */ + + +/*------------------------------------------------------------------------- * Function: H5VL__optional * * Purpose: Optional operation specific to connectors. @@ -6991,7 +7673,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 +7685,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 +7704,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 +7715,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 +7749,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 +7765,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..9bc3a7b 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -43,18 +43,28 @@ /* The maximum size allowed for blobs */ #define H5VL_MAX_BLOB_ID_SIZE (16) /* Allow for 128-bits blob IDs */ -/* The maximum size allowed for tokens */ -#define H5VL_MAX_TOKEN_SIZE (16) /* Allow for 128-bits tokens */ /*******************/ /* Public Typedefs */ /*******************/ -/* type for tokens. Token are unique and permanent identifiers that are - * used to reference HDF5 objects. */ -typedef struct { - char __data[H5VL_MAX_TOKEN_SIZE]; -} H5VL_token_t; +/* 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_SUBCLS_TOKEN /* 'Token' subclass */ +} H5VL_subclass_t; /* types for attribute GET callback */ typedef enum H5VL_attr_get_t { @@ -74,13 +84,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 +105,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 +120,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 +138,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 +147,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 +162,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,11 +186,16 @@ 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 */ H5VL_OBJECT_GET_NAME, /* object name */ - H5VL_OBJECT_GET_TYPE /* object type */ + H5VL_OBJECT_GET_TYPE, /* object type */ + H5VL_OBJECT_GET_INFO /* H5Oget_info(_by_idx|name)3 */ } H5VL_object_get_t; /* types for object SPECIFIC callback */ @@ -178,6 +208,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 +218,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 +230,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, @@ -215,7 +256,7 @@ typedef struct H5VL_loc_by_idx { } H5VL_loc_by_idx_t; typedef struct H5VL_loc_by_token { - H5VL_token_t *token; + H5O_token_t *token; } H5VL_loc_by_token_t; /* Structure to hold parameters for object locations. @@ -278,7 +319,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 +338,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 +352,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 +364,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 +378,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 +396,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 +411,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,16 +450,15 @@ 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; +/* Object token routines */ +typedef struct H5VL_token_class_t { + herr_t (*cmp)(void *obj, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value); + herr_t (*to_str)(void *obj, H5I_type_t obj_type, const H5O_token_t *token, char **token_str); + herr_t (*from_str)(void *obj, H5I_type_t obj_type, const char *token_str, H5O_token_t *token); +} H5VL_token_class_t; /* Class information for each VOL connector */ typedef struct H5VL_class_t { @@ -422,11 +484,13 @@ 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 */ + H5VL_token_class_t token_cls; /* VOL connector object token 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 +508,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..b04f5eb 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,35 @@ 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 token callbacks */ +H5_DLL herr_t H5VLtoken_cmp(void *obj, hid_t connector_id, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value); +H5_DLL herr_t H5VLtoken_to_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const H5O_token_t *token, char **token_str); +H5_DLL herr_t H5VLtoken_from_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const char *token_str, H5O_token_t *token); /* 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..9038d38 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") @@ -406,7 +425,7 @@ H5VL__set_def_conn(void) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't check if VOL connector already registered") else if(connector_is_registered) { /* Retrieve the ID of the already-registered VOL connector */ - if((connector_id = H5VL__get_connector_id(tok, FALSE)) < 0) + if((connector_id = H5VL__get_connector_id_by_name(tok, FALSE)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector ID") } /* end else-if */ else { @@ -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 @@ -1239,6 +1366,41 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__get_connector_id * + * Purpose: Retrieves the VOL connector ID for a given object ID. + * + * Return: Positive if the VOL class has been registered + * Negative on error (if the class is not a valid class or not registered) + * + * Programmer: Dana Robinson + * June 17, 2017 + * + *------------------------------------------------------------------------- + */ +hid_t +H5VL__get_connector_id(hid_t obj_id, hbool_t is_api) +{ + H5VL_object_t *vol_obj = NULL; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Get the underlying VOL object for the object ID */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Return the VOL object's VOL class ID */ + ret_value = vol_obj->connector->id; + if(H5I_inc_ref(ret_value, is_api) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__get_connector_id() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__get_connector_id_by_name + * * Purpose: Retrieves the ID for a registered VOL connector. * * Return: Positive if the VOL class has been registered @@ -1250,7 +1412,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VL__get_connector_id(const char *name, hbool_t is_api) +H5VL__get_connector_id_by_name(const char *name, hbool_t is_api) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -1266,7 +1428,7 @@ H5VL__get_connector_id(const char *name, hbool_t is_api) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__get_connector_id() */ +} /* end H5VL__get_connector_id_by_name() */ /*------------------------------------------------------------------------- @@ -1395,7 +1557,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 +1575,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 +1664,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 +1673,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 +2053,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 +2069,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 +2090,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..616ca60 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -16,9 +16,15 @@ */ #include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ +#include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property lists */ +#include "H5Tprivate.h" /* Datatypes */ #include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5VLnative_private.h" /* Native VOL connector */ @@ -31,7 +37,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 +118,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 */ @@ -126,6 +136,11 @@ static H5VL_class_t H5VL_native_cls_g = { H5VL__native_blob_specific, /* specific */ NULL /* optional */ }, + { /* token_cls */ + H5VL__native_token_cmp, /* cmp */ + H5VL__native_token_to_str, /* to_str */ + H5VL__native_str_to_token /* from_str */ + }, NULL /* optional */ }; @@ -148,8 +163,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 +195,365 @@ 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() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_get_file_addr_len + * + * Purpose: Convenience function to get a file's address length from a + * location ID. Useful when you have to encode/decode addresses + * to/from tokens. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_native_get_file_addr_len(hid_t loc_id, size_t *addr_len) +{ + H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */ + void *vol_obj = NULL; /* VOL Object of loc_id */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* check arguments */ + HDassert(addr_len); + + /* Get object type */ + if((vol_obj_type = H5I_get_type(loc_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve underlying VOL object */ + if(NULL == (vol_obj = H5VL_object(loc_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve file address length */ + if(H5VL__native_get_file_addr_len(vol_obj, vol_obj_type, addr_len) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get file address length") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_get_file_addr_len() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_get_file_addr_len + * + * Purpose: Convenience function to get a file's address length from a + * VOL object. Useful when you have to encode/decode addresses + * to/from tokens. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL__native_get_file_addr_len(void *obj, H5I_type_t obj_type, size_t *addr_len) +{ + H5F_t *file = NULL; /* File stuct pointer */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* check arguments */ + HDassert(obj); + HDassert(addr_len); + + /* Retrieve file from the VOL object */ + if(H5VL_native_get_file_struct(obj, obj_type, &file) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "couldn't get file from VOL object") + + /* Get the length of an address in this file */ + *addr_len = H5F_SIZEOF_ADDR(file); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_get_file_addr_len() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLnative_addr_to_token + * + * Purpose: Converts a native VOL haddr_t address to an abstract VOL token. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLnative_addr_to_token(hid_t loc_id, haddr_t addr, H5O_token_t *token) +{ + H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */ + void *vol_obj = NULL; /* VOL Object of loc_id */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "ia*k", loc_id, addr, token); + + /* Check args */ + if(NULL == token) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "token pointer can't be NULL") + + /* Get object type */ + if((vol_obj_type = H5I_get_type(loc_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve underlying VOL object */ + if(NULL == (vol_obj = H5VL_object(loc_id))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object") + +#ifndef NDEBUG + { + H5VL_object_t *vol_obj_container; + hbool_t is_native_vol_obj; + + /* Get the location object */ + if(NULL == (vol_obj_container = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Make sure that the VOL object is a native connector object */ + if(H5VL_object_is_native(vol_obj_container, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + + HDassert(is_native_vol_obj && "not a native VOL connector object"); + } +#endif + + /* Convert the haddr_t to an object token */ + if(H5VL_native_addr_to_token(vol_obj, vol_obj_type, addr, token) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "couldn't serialize haddr_t into object token") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLnative_addr_to_token() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_addr_to_token + * + * Purpose: Converts a native VOL haddr_t address to an abstract VOL token. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_native_addr_to_token(void *obj, H5I_type_t obj_type, haddr_t addr, H5O_token_t *token) +{ + uint8_t *p; + size_t addr_len = 0; /* Size of haddr_t */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check args */ + HDassert(obj); + HDassert(token); + + /* Get the length of an haddr_t in the file */ + if(H5VL__native_get_file_addr_len(obj, obj_type, &addr_len) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "couldn't get length of haddr_t from VOL object") + + /* Ensure that token is initialized */ + HDmemset(token, 0, sizeof(H5O_token_t)); + + /* Encode token */ + p = (uint8_t *)token; + H5F_addr_encode_len(addr_len, &p, addr); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_addr_to_token() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLnative_token_to_addr + * + * Purpose: Converts an abstract VOL token to a native VOL haddr_t address. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLnative_token_to_addr(hid_t loc_id, H5O_token_t token, haddr_t *addr) +{ + H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */ + void *vol_obj = NULL; /* VOL Object of loc_id */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "ik*a", loc_id, token, addr); + + /* Check args */ + if(NULL == addr) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr pointer can't be NULL") + + /* Get object type */ + if((vol_obj_type = H5I_get_type(loc_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve underlying VOL object */ + if(NULL == (vol_obj = H5VL_object(loc_id))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object") + +#ifndef NDEBUG + { + H5VL_object_t *vol_obj_container; + hbool_t is_native_vol_obj; + + /* Get the location object */ + if(NULL == (vol_obj_container = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Make sure that the VOL object is a native connector object */ + if(H5VL_object_is_native(vol_obj_container, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + + HDassert(is_native_vol_obj && "not a native VOL connector object"); + } +#endif + + /* Convert the object token to an haddr_t */ + if(H5VL_native_token_to_addr(vol_obj, vol_obj_type, token, addr) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "couldn't deserialize object token into haddr_t") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLnative_token_to_addr() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_token_to_addr + * + * Purpose: Converts an abstract VOL token to a native VOL haddr_t address. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_native_token_to_addr(void *obj, H5I_type_t obj_type, H5O_token_t token, haddr_t *addr) +{ + const uint8_t *p; + size_t addr_len = 0; /* Size of haddr_t */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check args */ + HDassert(obj); + HDassert(addr); + + /* Get the length of an haddr_t in the file */ + if(H5VL__native_get_file_addr_len(obj, obj_type, &addr_len) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "couldn't get length of haddr_t from VOL object") + + /* Decode token */ + p = (const uint8_t *)&token; + H5F_addr_decode_len(addr_len, &p, addr); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_token_to_addr() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_native_get_file_struct + * + * Purpose: Utility routine to get file struct for an object + * + * Returns: SUCCEED/FAIL + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VL_native_get_file_struct(void *obj, H5I_type_t type, H5F_t **file) +{ + H5O_loc_t *oloc = NULL; /* Object location for ID */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL); + + *file = NULL; + + switch(type) { + case H5I_FILE: + *file = (H5F_t *)obj; + break; + + case H5I_GROUP: + oloc = H5G_oloc((H5G_t *)obj); + break; + + case H5I_DATATYPE: + oloc = H5T_oloc((H5T_t *)obj); + break; + + case H5I_DATASET: + oloc = H5D_oloc((H5D_t *)obj); + break; + + case H5I_ATTR: + oloc = H5A_oloc((H5A_t *)obj); + break; + + case H5I_MAP: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector") + + 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_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + } /* end switch */ + + /* Set return value for objects (not files) */ + if(oloc) + *file = oloc->file; + + /* Couldn't find a file struct */ + if(!*file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "object is not associated with a file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5VL_native_get_file_struct */ + diff --git a/src/H5VLnative.h b/src/H5VLnative.h index 73cec8d..e1f3f93 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,59 +47,86 @@ 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_SET_COMMENT 1 /* H5G|H5Oset_comment, H5Oset_comment_by_name */ +#define H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES 2 /* H5Odisable_mdc_flushes */ +#define H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES 3 /* H5Oenable_mdc_flushes */ +#define H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED 4 /* H5Oare_mdc_flushes_disabled */ +#define H5VL_NATIVE_OBJECT_GET_NATIVE_INFO 5 /* H5Oget_native_info(_by_idx, _by_name) */ + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ #ifdef __cplusplus extern "C" { #endif -/* Private functions */ +/* Token <--> address converters */ +H5_DLL herr_t H5VLnative_addr_to_token(hid_t loc_id, haddr_t addr, H5O_token_t *token); +H5_DLL herr_t H5VLnative_token_to_addr(hid_t loc_id, H5O_token_t token, haddr_t *addr); + +/* Not really public but must be included here */ H5_DLL hid_t H5VL_native_register(void); #ifdef __cplusplus 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..23ea37b 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -226,7 +226,7 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, ssize_t *ret = HDva_arg(arguments, ssize_t *); size_t len; - if(NULL == (f = H5F__get_file(obj, type))) + if(H5VL_native_get_file_struct(obj, type, &f) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") len = HDstrlen(H5F_OPEN_NAME(f)); @@ -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: { @@ -322,7 +313,7 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, H5F_t *f = NULL; /* File to flush */ /* Get the file for the object */ - if(NULL == (f = H5F__get_file(obj, type))) + if(H5VL_native_get_file_struct(obj, type, &f) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Nothing to do if the file is read only. This determination is @@ -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 @@ -528,7 +519,7 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR /* Get the file struct. This call is careful to not return the file pointer * for the top file in a mount hierarchy. */ - if(NULL == (f = H5F__get_file(obj, type))) + if(H5VL_native_get_file_struct(obj, type, &f) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct") /* Get the file info */ @@ -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..051de19 100644 --- a/src/H5VLnative_link.c +++ b/src/H5VLnative_link.c @@ -241,20 +241,21 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_ /* H5Lget_info/H5Lget_info_by_idx */ case H5VL_LINK_GET_INFO: { - H5L_info_t *linfo = HDva_arg(arguments, H5L_info_t *); + H5L_info2_t *linfo2 = HDva_arg(arguments, H5L_info2_t *); /* Get the link information */ if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_info */ - if(H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, linfo) < 0) + if(H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, linfo2) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") } /* end if */ else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_info_by_idx */ if(H5L_get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, - loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, linfo) < 0) + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, linfo2) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") } /* end else-if */ else HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") + break; } @@ -340,12 +341,12 @@ H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_ case H5VL_LINK_ITER: { H5G_loc_t loc; - hbool_t recursive = (hbool_t)HDva_arg(arguments, unsigned); - H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */ - H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */ - hsize_t *idx_p = HDva_arg(arguments, hsize_t *); - H5L_iterate_t op = HDva_arg(arguments, H5L_iterate_t); - void *op_data = HDva_arg(arguments, void *); + hbool_t recursive = (hbool_t)HDva_arg(arguments, unsigned); + H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */ + H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */ + hsize_t *idx_p = HDva_arg(arguments, hsize_t *); + H5L_iterate2_t op = HDva_arg(arguments, H5L_iterate2_t); + void *op_data = HDva_arg(arguments, void *); /* Get the location */ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c index 6a22b05..3a29b6c 100644 --- a/src/H5VLnative_object.c +++ b/src/H5VLnative_object.c @@ -72,11 +72,12 @@ H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_typ case H5VL_OBJECT_BY_TOKEN: { - const uint8_t *p = (const uint8_t *)loc_params->loc_data.loc_by_token.token; + H5O_token_t token = *loc_params->loc_data.loc_by_token.token; haddr_t addr; /* Decode token */ - H5F_addr_decode(loc.oloc->file, &p, &addr); + if(H5VL_native_token_to_addr(loc.oloc->file, H5I_FILE, token, &addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, NULL, "can't deserialize object token into address") /* Open the object */ if(NULL == (ret_value = H5O_open_by_addr(&loc, addr, opened_type))) @@ -184,13 +185,15 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj } /* end if */ else if(loc_params->type == H5VL_OBJECT_BY_TOKEN) { H5O_loc_t obj_oloc; /* Object location */ - const uint8_t *p = (const uint8_t *)loc_params->loc_data.loc_by_token.token; + H5O_token_t token = *loc_params->loc_data.loc_by_token.token; /* Initialize the object location */ H5O_loc_reset(&obj_oloc); obj_oloc.file = loc.oloc->file; + /* Decode token */ - H5F_addr_decode(obj_oloc.file, &p, &obj_oloc.addr); + if(H5VL_native_token_to_addr(obj_oloc.file, H5I_FILE, token, &obj_oloc.addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") /* Retrieve object's name */ if((*ret = H5G_get_name_by_addr(loc.oloc->file, &obj_oloc, name, size)) < 0) @@ -209,13 +212,15 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj if(loc_params->type == H5VL_OBJECT_BY_TOKEN) { H5O_loc_t obj_oloc; /* Object location */ unsigned rc; /* Reference count of object */ - const uint8_t *p = (const uint8_t *)loc_params->loc_data.loc_by_token.token; + H5O_token_t token = *loc_params->loc_data.loc_by_token.token; /* Initialize the object location */ H5O_loc_reset(&obj_oloc); obj_oloc.file = loc.oloc->file; + /* Decode token */ - H5F_addr_decode(obj_oloc.file, &p, &obj_oloc.addr); + if(H5VL_native_token_to_addr(obj_oloc.file, H5I_FILE, token, &obj_oloc.addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") /* Get the # of links for object, and its type */ /* (To check to make certain that this object hasn't been deleted) */ @@ -226,6 +231,56 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj break; } + /* H5Oget_info(_name|_by_idx)3 */ + case H5VL_OBJECT_GET_INFO: + { + H5O_info2_t *oinfo = HDva_arg(arguments, H5O_info2_t *); + unsigned fields = HDva_arg(arguments, unsigned); + + /* Use the original H5Oget_info code to get the data */ + + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */ + /* Retrieve the object's information */ + if(H5G_loc_info(&loc, ".", oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */ + /* Retrieve the object's information */ + if(H5G_loc_info(&loc, loc_params->loc_data.loc_by_name.name, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } /* end else-if */ + else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */ + 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 */ + + /* 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, loc_params->loc_data.loc_by_idx.name, + loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, + loc_params->loc_data.loc_by_idx.n, &obj_loc/*out*/) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found") + + /* Retrieve the object's information */ + if(H5O_get_info(obj_loc.oloc, oinfo, fields) < 0) { + H5G_loc_free(&obj_loc); + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") + } /* end if */ + + /* Release the object location */ + if(H5G_loc_free(&obj_loc) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + } /* end else-if */ + else + HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") + break; + } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") } /* end switch */ @@ -287,7 +342,7 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V /* Lookup object */ case H5VL_OBJECT_LOOKUP: { - H5VL_token_t *token = va_arg(arguments, H5VL_token_t *); + H5O_token_t *token = va_arg(arguments, H5O_token_t *); HDassert(token); @@ -295,7 +350,6 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V H5G_loc_t obj_loc; /* Group hier. location of object */ H5G_name_t obj_path; /* Object group hier. path */ H5O_loc_t obj_oloc; /* Object object location */ - uint8_t *p = (uint8_t *)token; /* Pointer to token */ /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -307,7 +361,8 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") /* Encode token */ - H5F_addr_encode(obj_oloc.file, &p, obj_loc.oloc->addr); + if(H5VL_native_addr_to_token(loc.oloc->file, H5I_FILE, obj_loc.oloc->addr, token) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token") /* Release the object location */ if(H5G_loc_free(&obj_loc) < 0) @@ -322,7 +377,7 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V { H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */ H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */ - H5O_iterate_t op = HDva_arg(arguments, H5O_iterate_t); + H5O_iterate2_t op = HDva_arg(arguments, H5O_iterate2_t); void *op_data = HDva_arg(arguments, void *); unsigned fields = HDva_arg(arguments, unsigned); @@ -384,10 +439,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 */ @@ -398,54 +452,6 @@ H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") switch(optional_type) { - /* H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx */ - case H5VL_NATIVE_OBJECT_GET_INFO: - { - H5O_info_t *obj_info = HDva_arg(arguments, H5O_info_t *); - unsigned fields = HDva_arg(arguments, unsigned); - - if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */ - /* Retrieve the object's information */ - if(H5G_loc_info(&loc, ".", obj_info, fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } /* end if */ - else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */ - /* Retrieve the object's information */ - if(H5G_loc_info(&loc, loc_params->loc_data.loc_by_name.name, obj_info, fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } /* end else-if */ - else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */ - 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 */ - - /* 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, loc_params->loc_data.loc_by_idx.name, - loc_params->loc_data.loc_by_idx.idx_type, - loc_params->loc_data.loc_by_idx.order, - loc_params->loc_data.loc_by_idx.n, &obj_loc/*out*/) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found") - - /* Retrieve the object's information */ - if(H5O_get_info(obj_loc.oloc, obj_info, fields) < 0) { - H5G_loc_free(&obj_loc); - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") - } /* end if */ - - /* Release the object location */ - if(H5G_loc_free(&obj_loc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") - } /* end else-if */ - else - HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") - break; - } - /* H5Oget_comment / H5Oget_comment_by_name */ case H5VL_NATIVE_OBJECT_GET_COMMENT: { @@ -521,6 +527,57 @@ H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, break; } + /* H5Oget_native_info(_name|_by_idx) */ + case H5VL_NATIVE_OBJECT_GET_NATIVE_INFO: + { + H5O_native_info_t *native_info = HDva_arg(arguments, H5O_native_info_t *); + unsigned fields = HDva_arg(arguments, unsigned); + + /* Use the original H5Oget_info code to get the data */ + + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */ + /* Retrieve the object's information */ + if(H5G_loc_native_info(&loc, ".", native_info, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */ + /* Retrieve the object's information */ + if(H5G_loc_native_info(&loc, loc_params->loc_data.loc_by_name.name, native_info, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } /* end else-if */ + else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */ + 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 */ + + /* 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, loc_params->loc_data.loc_by_idx.name, + loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, + loc_params->loc_data.loc_by_idx.n, &obj_loc/*out*/) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found") + + /* Retrieve the object's information */ + if(H5O_get_native_info(obj_loc.oloc, native_info, fields) < 0) { + H5G_loc_free(&obj_loc); + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") + } /* end if */ + + /* Release the object location */ + if(H5G_loc_free(&obj_loc) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + } /* end else-if */ + else + HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") + + break; + } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object"); } /* end switch */ diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h index 69a057e..30bddb6 100644 --- a/src/H5VLnative_private.h +++ b/src/H5VLnative_private.h @@ -18,7 +18,8 @@ #define _H5VLnative_private_H /* Private headers needed by this file */ -#include "H5VLnative.h" /* Native VOL connector */ +#include "H5Fprivate.h" /* Files */ +#include "H5VLnative.h" /* Native VOL connector */ /**************************/ @@ -51,7 +52,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 +62,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 +85,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,20 +100,29 @@ 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); H5_DLL herr_t H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx); H5_DLL herr_t H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); +/* Token callbacks */ +H5_DLL herr_t H5VL__native_token_cmp(void *obj, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value); +H5_DLL herr_t H5VL__native_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *token, char **token_str); +H5_DLL herr_t H5VL__native_str_to_token(void *obj, H5I_type_t obj_type, const char *token_str, H5O_token_t *token); + +/* Helper functions */ +H5_DLL herr_t H5VL_native_get_file_addr_len(hid_t loc_id, size_t *addr_len); +H5_DLL herr_t H5VL__native_get_file_addr_len(void *obj, H5I_type_t obj_type, size_t *addr_len); +H5_DLL herr_t H5VL_native_addr_to_token(void *obj, H5I_type_t obj_type, haddr_t addr, H5O_token_t *token); +H5_DLL herr_t H5VL_native_token_to_addr(void *obj, H5I_type_t obj_type, H5O_token_t token, haddr_t *addr); +H5_DLL herr_t H5VL_native_get_file_struct(void *obj, H5I_type_t type, H5F_t **file); + #ifdef __cplusplus } #endif diff --git a/src/H5VLnative_token.c b/src/H5VLnative_token.c new file mode 100644 index 0000000..2b5429e --- /dev/null +++ b/src/H5VLnative_token.c @@ -0,0 +1,157 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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: Object token callbacks for the native VOL connector + */ + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory handling */ +#include "H5VLnative_private.h" /* Native VOL connector */ + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*--------------------------------------------------------------------------- + * Function: H5VL__native_token_cmp + * + * Purpose: Compare two of the connector's object tokens, setting + * *cmp_value, following the same rules as strcmp(). + * + * Return: Success: 0 + * Failure: (can't fail) + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VL__native_token_cmp(void H5_ATTR_UNUSED *obj, + const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE_NOERR + + /* Check parameters */ + HDassert(token1); + HDassert(token2); + + *cmp_value = HDmemcmp(token1, token2, sizeof(H5O_token_t)); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_token_cmp() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL__native_token_to_str + * + * Purpose: Serialize an object token into a string + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VL__native_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *token, + char **token_str) +{ + haddr_t addr; + size_t addr_ndigits; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + /* Check parameters */ + HDassert(obj); + HDassert(token); + + if(H5VL_native_token_to_addr(obj, obj_type, *token, &addr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't convert object token to address") + + if(addr == 0) + addr_ndigits = 1; + else + addr_ndigits = (size_t)(HDfloor(HDlog10((double)addr)) + 1); + + if(NULL == (*token_str = H5MM_malloc(addr_ndigits + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for token string") + + HDsnprintf(*token_str, addr_ndigits + 1, H5_PRINTF_HADDR_FMT, addr); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_token_to_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL__native_str_to_token + * + * Purpose: Deserialize a string into an object token + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VL__native_str_to_token(void *obj, H5I_type_t obj_type, + const char *token_str, H5O_token_t *token) +{ + haddr_t addr; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + /* Check parameters */ + HDassert(token_str); + + HDsscanf(token_str, H5_PRINTF_HADDR_FMT, &addr); + + if(H5VL_native_addr_to_token(obj, obj_type, addr, token) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't convert address to object token") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_str_to_token() */ + diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index d9a207f..5c9f28c 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,40 @@ 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); + +/* Token callbacks */ +static herr_t H5VL_pass_through_token_cmp(void *obj, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value); +static herr_t H5VL_pass_through_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *token, char **token_str); +static herr_t H5VL_pass_through_token_from_str(void *obj, H5I_type_t obj_type, const char *token_str, H5O_token_t *token); + +/* 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 +283,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 +299,14 @@ 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 */ + }, + { /* token_cls */ + H5VL_pass_through_token_cmp, /* cmp */ + H5VL_pass_through_token_to_str, /* to_str */ + H5VL_pass_through_token_from_str /* from_str */ }, - NULL /* optional */ + H5VL_pass_through_optional /* optional */ }; /* The connector identification number, initialized at runtime */ @@ -489,7 +511,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 +628,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 +842,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 +879,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 +908,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 +939,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 +970,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 +1001,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 +1032,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 +1063,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 +1100,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 +1143,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 +1172,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 +1203,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 +1234,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 +1265,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 +1273,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 +1301,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 +1332,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 +1375,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 +1409,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 +1441,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 +1472,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 +1480,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 +1508,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 +1539,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 +1584,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 +1638,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 +1683,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 +1715,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 +1740,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 +1748,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 +1847,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 +1878,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 +1921,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 +1958,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 +1987,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 +2018,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 +2026,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 +2054,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 +2085,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 +2120,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 +2145,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 +2154,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 +2210,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 +2220,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 +2236,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 +2256,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 +2266,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 +2297,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 +2313,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 +2328,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 +2360,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 +2398,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 +2427,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 +2437,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 +2461,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 +2491,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 +2500,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 +2528,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 +2550,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 +2622,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 +2655,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 +2686,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 +2716,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 +2741,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 +2883,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 +2911,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 +3009,156 @@ 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_token_cmp + * + * Purpose: Compare two of the connector's object tokens, setting + * *cmp_value, following the same rules as strcmp(). + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_token_cmp(void *obj, const H5O_token_t *token1, + const H5O_token_t *token2, int *cmp_value) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_PASSTHRU_LOGGING + printf("------- PASS THROUGH VOL TOKEN Compare\n"); +#endif + + /* Sanity checks */ + assert(obj); + assert(token1); + assert(token2); + assert(cmp_value); + + ret_value = H5VLtoken_cmp(o->under_object, o->under_vol_id, token1, token2, cmp_value); + + return ret_value; +} /* end H5VL_pass_through_token_cmp() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_token_to_str + * + * Purpose: Serialize the connector's object token into a string. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_token_to_str(void *obj, H5I_type_t obj_type, + const H5O_token_t *token, char **token_str) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_PASSTHRU_LOGGING + printf("------- PASS THROUGH VOL TOKEN To string\n"); +#endif + + /* Sanity checks */ + assert(obj); + assert(token); + assert(token_str); + + ret_value = H5VLtoken_to_str(o->under_object, obj_type, o->under_vol_id, token, token_str); + + return ret_value; +} /* end H5VL_pass_through_token_to_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_token_from_str + * + * Purpose: Deserialize the connector's object token from a string. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_token_from_str(void *obj, H5I_type_t obj_type, + const char *token_str, H5O_token_t *token) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_PASSTHRU_LOGGING + printf("------- PASS THROUGH VOL TOKEN From string\n"); +#endif + + /* Sanity checks */ + assert(obj); + assert(token); + assert(token_str); + + ret_value = H5VLtoken_from_str(o->under_object, obj_type, o->under_vol_id, token_str, token); + + return ret_value; +} /* end H5VL_pass_through_token_from_str() */ + + +/*------------------------------------------------------------------------- + * 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/H5VLpkg.h b/src/H5VLpkg.h index fc3088d..5965adc 100644 --- a/src/H5VLpkg.h +++ b/src/H5VLpkg.h @@ -54,7 +54,8 @@ H5_DLL hid_t H5VL__register_connector_by_name(const char *name, hbool_t app_ref, H5_DLL hid_t H5VL__register_connector_by_value(H5VL_class_value_t value, hbool_t app_ref, hid_t vipl_id); H5_DLL htri_t H5VL__is_connector_registered(const char *name); -H5_DLL hid_t H5VL__get_connector_id(const char *name, hbool_t is_api); +H5_DLL hid_t H5VL__get_connector_id(hid_t obj_id, hbool_t is_api); +H5_DLL hid_t H5VL__get_connector_id_by_name(const char *name, hbool_t is_api); H5_DLL hid_t H5VL__peek_connector_id(const char *name); H5_DLL herr_t H5VL__connector_str_to_info(const char *str, hid_t connector_id, void **info); diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index c572b79..24ae1f3 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,45 @@ 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, ...); + +/* Token functions */ +H5_DLL herr_t H5VL_token_cmp(const H5VL_object_t *vol_obj, const H5O_token_t *token1, + const H5O_token_t *token2, int *cmp_value); +H5_DLL herr_t H5VL_token_to_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, + const H5O_token_t *token, char **token_str); +H5_DLL herr_t H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, + const char *token_str, H5O_token_t *token); /* 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..883aac8 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,12 +63,11 @@ 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); -H5_DLL hid_t H5VLget_connector_id(const char *name); +H5_DLL hid_t H5VLget_connector_id(hid_t obj_id); +H5_DLL hid_t H5VLget_connector_id_by_name(const char *name); H5_DLL ssize_t H5VLget_connector_name(hid_t id, char *name/*out*/, size_t size); H5_DLL herr_t H5VLclose(hid_t connector_id); H5_DLL herr_t H5VLunregister_connector(hid_t connector_id); @@ -73,5 +77,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/H5mpi.c b/src/H5mpi.c index f529b3d..15451d4 100644 --- a/src/H5mpi.c +++ b/src/H5mpi.c @@ -75,7 +75,7 @@ H5_mpi_set_bigio_count(hsize_t new_count) *------------------------------------------------------------------------- */ hsize_t -H5_mpi_get_bigio_count() +H5_mpi_get_bigio_count(void) { return bigio_count; } diff --git a/src/H5overflow.txt b/src/H5overflow.txt index a9e5099..ed71b98 100644 --- a/src/H5overflow.txt +++ b/src/H5overflow.txt @@ -29,6 +29,7 @@ # Creation Date: 2009/04/09 unsigned, UNSIGNED; +int8_t, SIGNED; int, SIGNED; int64_t, SIGNED; uint8_t, UNSIGNED; diff --git a/src/H5private.h b/src/H5private.h index 5ab9daf..c3375df 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -305,15 +305,21 @@ */ #ifdef __cplusplus # define H5_ATTR_FORMAT(X,Y,Z) /*void*/ -# define H5_ATTR_UNUSED /*void*/ -# define H5_ATTR_NORETURN /*void*/ -# define H5_ATTR_CONST /*void*/ -# define H5_ATTR_PURE /*void*/ -# define H5_ATTR_FALLTHROUGH /*void*/ +# define H5_ATTR_UNUSED /*void*/ +# define H5_ATTR_NDEBUG_UNUSED /*void*/ +# define H5_ATTR_NORETURN /*void*/ +# define H5_ATTR_CONST /*void*/ +# define H5_ATTR_PURE /*void*/ +# define H5_ATTR_FALLTHROUGH /*void*/ #else /* __cplusplus */ #if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C) # define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z))) # define H5_ATTR_UNUSED __attribute__((unused)) +#ifndef NDEBUG +#define H5_ATTR_NDEBUG_UNUSED /*void*/ +#else /* NDEBUG */ +#define H5_ATTR_NDEBUG_UNUSED H5_ATTR_UNUSED +#endif /* NDEBUG */ # define H5_ATTR_NORETURN __attribute__((noreturn)) # define H5_ATTR_CONST __attribute__((const)) # define H5_ATTR_PURE __attribute__((pure)) @@ -324,11 +330,12 @@ #endif #else # define H5_ATTR_FORMAT(X,Y,Z) /*void*/ -# define H5_ATTR_UNUSED /*void*/ -# define H5_ATTR_NORETURN /*void*/ -# define H5_ATTR_CONST /*void*/ -# define H5_ATTR_PURE /*void*/ -# define H5_ATTR_FALLTHROUGH /*void*/ +# define H5_ATTR_UNUSED /*void*/ +# define H5_ATTR_NDEBUG_UNUSED /*void*/ +# define H5_ATTR_NORETURN /*void*/ +# define H5_ATTR_CONST /*void*/ +# define H5_ATTR_PURE /*void*/ +# define H5_ATTR_FALLTHROUGH /*void*/ #endif #endif /* __cplusplus */ diff --git a/src/H5public.h b/src/H5public.h index 8021027..86a1fbb 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -328,6 +328,18 @@ typedef struct H5_ih_info_t { hsize_t heap_size; } H5_ih_info_t; +/* Tokens are unique and permanent identifiers that are + * used to reference HDF5 objects in a container. */ + +/* The maximum size allowed for tokens */ +#define H5O_MAX_TOKEN_SIZE (16) /* Allows for 128-bit tokens */ + +/* Type for object tokens */ +/* (Hoisted here, since it's used by both the H5Lpublic.h and H5Opublic.h headers) */ +typedef struct H5O_token_t { + uint8_t __data[H5O_MAX_TOKEN_SIZE]; +} H5O_token_t; + /* Functions in H5.c */ H5_DLL herr_t H5open(void); H5_DLL herr_t H5close(void); diff --git a/src/H5system.c b/src/H5system.c index 384360d..9310243 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -86,7 +86,11 @@ 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. + * + * The conversion 'k' refers to an H5O_token_t type. * * Return: Success: Number of characters printed * @@ -414,6 +418,32 @@ HDfprintf(FILE *stream, const char *fmt, ...) } break; + case 'k': + { + H5O_token_t token = HDva_arg(ap, H5O_token_t); + + /* Print the raw token. */ + n = fprintf(stream, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", + (unsigned char)token.__data[15], + (unsigned char)token.__data[14], + (unsigned char)token.__data[13], + (unsigned char)token.__data[12], + (unsigned char)token.__data[11], + (unsigned char)token.__data[10], + (unsigned char)token.__data[9], + (unsigned char)token.__data[8], + (unsigned char)token.__data[7], + (unsigned char)token.__data[6], + (unsigned char)token.__data[5], + (unsigned char)token.__data[4], + (unsigned char)token.__data[3], + (unsigned char)token.__data[2], + (unsigned char)token.__data[1], + (unsigned char)token.__data[0] + ); + } + break; + default: HDfputs(format_templ, stream); n = (int)HDstrlen(format_templ); diff --git a/src/H5trace.c b/src/H5trace.c index 65e267e..4a24804 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -1630,6 +1630,22 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ break; + case 'k': + if(ptr) { + if(vp) + HDfprintf(out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5O_token_t token = HDva_arg(ap, H5O_token_t); + int j; + + for (j = 0; j < H5O_MAX_TOKEN_SIZE; j++) + HDfprintf(out, "%02x", token.__data[j]); + } /* end else */ + break; + case 'L': switch(type[1]) { case 'l': @@ -2605,6 +2621,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 +2669,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 +2699,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 +2716,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 +2755,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 +2782,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 +2806,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 +2830,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 +2872,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 +2902,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 +2935,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 +2959,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 +2986,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 +3013,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 +3064,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'n': if(ptr) { if(vp) @@ -3009,12 +3085,16 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_OBJECT_GET_TYPE: HDfprintf(out, "H5VL_OBJECT_GET_TYPE"); break; + case H5VL_OBJECT_GET_INFO: + HDfprintf(out, "H5VL_OBJECT_GET_INFO"); + break; default: HDfprintf(out, "%ld", (long)get); break; } /* end switch */ } /* end else */ break; + case 'o': if(ptr) { if(vp) @@ -3050,6 +3130,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 +3157,353 @@ 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; + case H5VL_SUBCLS_TOKEN: + HDfprintf(out, "H5VL_SUBCLS_TOKEN"); + 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_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; + case H5VL_NATIVE_OBJECT_GET_NATIVE_INFO: + HDfprintf(out, "H5VL_NATIVE_OBJECT_GET_NATIVE_INFO"); + 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..ae1d600 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' # @@ -56,11 +56,26 @@ FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18 FUNCTION: H5Fget_info; H5F_info; v18, v110 FUNCTION: H5Gcreate; ; v10, v18 FUNCTION: H5Gopen; ; v10, v18 -FUNCTION: H5Oget_info; ; v18, v112 -FUNCTION: H5Oget_info_by_name; ; v18, v112 -FUNCTION: H5Oget_info_by_idx; ; v18, v112 -FUNCTION: H5Ovisit; ; v18, v112 -FUNCTION: H5Ovisit_by_name; ; v18, v112 +FUNCTION: H5Lget_info; H5L_info; v18, v112 +FUNCTION: H5Lget_info_by_idx; H5L_info; v18, v112 +FUNCTION: H5Literate; H5L_iterate; v18, v112 +FUNCTION: H5Literate_by_name; H5L_iterate; v18, v112 +FUNCTION: H5Lvisit; H5L_iterate; v18, v112 +FUNCTION: H5Lvisit_by_name; H5L_iterate; v18, v112 +# Note: v111 is allowed in make_vers because H5O functions were prematurely +# versioned in HDF5 1.10. Because users were affected by this, the +# versioning was rescinded but the H5O version 2 functions were kept +# to be called directly. Now that the version macros are added in 1.12, +# along with a 3rd version of the H5O functions, the H5O function +# version for default api=v110 should be version 1 to work correctly +# with 1.10 applications that were using unversioned H5O functions, +# and the H5O function version should be version 3 for default api=v112 +# (the default api version for 1.12). +FUNCTION: H5Oget_info; ; v18, v111, v112 +FUNCTION: H5Oget_info_by_name; ; v18, v111, v112 +FUNCTION: H5Oget_info_by_idx; ; v18, v111, v112 +FUNCTION: H5Ovisit; ; v18, v111, v112 +FUNCTION: H5Ovisit_by_name; ; v18, v111, v112 FUNCTION: H5Pencode; ; v110, v112 FUNCTION: H5Pget_filter; ; v10, v18 FUNCTION: H5Pget_filter_by_id; ; v16, v18 @@ -78,5 +93,7 @@ FUNCTION: H5Topen; ; v10, v18 # (although not required, it's easier to compare this file with the headers # generated if the list below is in alphanumeric sort order - QAK) TYPEDEF: H5E_auto; v10, v18 +TYPEDEF: H5O_info; v18, v112 +TYPEDEF: H5O_iterate; v18, v112 TYPEDEF: H5Z_class; v16, v18 diff --git a/src/Makefile.am b/src/Makefile.am index fa412c9..0c07c1b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -38,7 +38,8 @@ MOSTLYCLEANFILES=H5Tinit.c H5lib_settings.c DISTCLEANFILES=H5pubconf.h # library sources -libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ +libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \ + H5timer.c H5trace.c \ H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c H5Atest.c \ H5AC.c H5ACdbg.c H5ACproxy_entry.c \ H5B.c H5Bcache.c H5Bdbg.c \ @@ -48,59 +49,49 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Cprefetched.c H5Cquery.c H5Ctag.c H5Ctest.c \ H5CS.c \ H5CX.c \ - H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \ - H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c H5Dint.c \ - H5Dio.c H5Dlayout.c H5Dnone.c \ - H5Doh.c H5Dscatgath.c H5Dselect.c \ - H5Dsingle.c H5Dtest.c H5Dvirtual.c \ + H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c \ + H5Ddbg.c H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c \ + H5Dint.c H5Dio.c H5Dlayout.c H5Dnone.c H5Doh.c H5Dscatgath.c \ + H5Dselect.c H5Dsingle.c H5Dtest.c H5Dvirtual.c \ H5E.c H5Edeprec.c H5Eint.c \ H5EA.c H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c \ H5EAiblock.c H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c \ - H5F.c H5Faccum.c H5Fcwfs.c \ - H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fint.c H5Fio.c \ - H5Fmount.c H5Fquery.c \ - H5Fsfile.c H5Fspace.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \ + H5F.c H5Faccum.c H5Fcwfs.c H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c \ + H5Fint.c H5Fio.c H5Fmount.c H5Fquery.c H5Fsfile.c H5Fspace.c \ + H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \ H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \ H5FAint.c H5FAstat.c H5FAtest.c \ H5FD.c H5FDcore.c H5FDfamily.c H5FDhdfs.c H5FDint.c H5FDlog.c \ H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c H5FDtest.c \ H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSint.c H5FSsection.c \ H5FSstat.c H5FStest.c \ - H5G.c H5Gbtree2.c H5Gcache.c \ - H5Gcompact.c H5Gdense.c H5Gdeprec.c H5Gent.c \ - H5Gint.c H5Glink.c \ - H5Gloc.c H5Gname.c H5Gnode.c H5Gobj.c H5Goh.c H5Groot.c H5Gstab.c H5Gtest.c \ - H5Gtraverse.c \ + H5G.c H5Gbtree2.c H5Gcache.c H5Gcompact.c H5Gdense.c H5Gdeprec.c \ + H5Gent.c H5Gint.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c H5Gobj.c \ + H5Goh.c H5Groot.c H5Gstab.c H5Gtest.c H5Gtraverse.c \ H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \ H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \ H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \ H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c \ - H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c\ - H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c \ + H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c \ + H5HP.c \ + H5I.c H5Itest.c \ + H5L.c H5Ldeprec.c H5Lexternal.c \ H5M.c \ H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ H5MM.c H5MP.c H5MPtest.c \ - H5O.c H5Odeprec.c H5Oainfo.c H5Oalloc.c H5Oattr.c \ - H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c H5Ocache_image.c \ - H5Ochunk.c \ - H5Ocont.c H5Ocopy.c H5Ocopy_ref.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \ - H5Ofill.c H5Oflush.c H5Ofsinfo.c H5Oginfo.c \ - H5Oint.c H5Olayout.c \ - H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \ - H5Oname.c H5Onull.c H5Opline.c H5Orefcount.c \ - H5Osdspace.c H5Oshared.c \ - H5Oshmesg.c \ - H5Ostab.c \ - H5Otest.c H5Ounknown.c \ - H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \ - H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \ - H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \ - H5Pgcpl.c H5Pint.c H5Plapl.c H5Plcpl.c \ - H5Pmapl.c H5Pmcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c \ - H5Ptest.c \ + H5O.c H5Odeprec.c H5Oainfo.c H5Oalloc.c H5Oattr.c H5Oattribute.c \ + H5Obogus.c H5Obtreek.c H5Ocache.c H5Ocache_image.c H5Ochunk.c \ + H5Ocont.c H5Ocopy.c H5Ocopy_ref.c H5Odbg.c H5Odrvinfo.c H5Odtype.c \ + H5Oefl.c H5Ofill.c H5Oflush.c H5Ofsinfo.c H5Oginfo.c H5Oint.c \ + H5Olayout.c H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c H5Oname.c \ + H5Onull.c H5Opline.c H5Orefcount.c H5Osdspace.c H5Oshared.c \ + H5Oshmesg.c H5Ostab.c H5Otest.c H5Ounknown.c \ + H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \ + H5Pfapl.c H5Pfcpl.c H5Pfmpl.c H5Pgcpl.c H5Pint.c H5Plapl.c H5Plcpl.c \ + H5Pmapl.c H5Pmcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \ H5PB.c \ H5PL.c H5PLint.c H5PLpath.c H5PLplugin_cache.c \ - H5R.c H5Rint.c H5Rdeprec.c \ + H5R.c H5Rdeprec.c H5Rint.c \ H5UC.c \ H5RS.c \ H5S.c H5Sall.c H5Sdbg.c H5Sdeprec.c H5Shyper.c H5Snone.c H5Spoint.c \ @@ -109,21 +100,20 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5SM.c H5SMbtree2.c H5SMcache.c H5SMmessage.c H5SMtest.c \ H5ST.c \ H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c H5Tcompound.c H5Tconv.c \ - H5Tcset.c H5Tdbg.c H5Tdeprec.c H5Tenum.c H5Tfields.c \ - H5Tfixed.c \ - H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c \ - H5Topaque.c \ - H5Torder.c \ - H5Tref.c \ - H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \ + H5Tcset.c H5Tdbg.c H5Tdeprec.c H5Tenum.c H5Tfields.c H5Tfixed.c \ + H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c H5Topaque.c \ + H5Torder.c H5Tref.c H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c \ + H5Tvlen.c \ + H5TS.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 \ + H5VLnative_token.c \ H5VLpassthru.c \ H5VM.c H5WB.c H5Z.c \ - H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ - H5Zscaleoffset.c H5Zszip.c H5Ztrans.c + H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c H5Zscaleoffset.c \ + H5Zszip.c H5Ztrans.c # Only compile parallel sources if necessary if BUILD_PARALLEL_CONDITIONAL |