From 9e72b7f834eba0e7225bbec858da14431e0c6954 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 11 Dec 2020 19:25:24 -0800 Subject: Minor normalization with the async branch (#159) * Minor normalization with the async branch * Update CMake and the Autotools to use the new pass-through VOL ID --- src/H5Adeprec.c | 4 ++-- src/H5Aint.c | 4 ++++ src/H5D.c | 4 ++-- src/H5F.c | 8 ++++---- src/H5Gnode.c | 2 +- src/H5HFhuge.c | 14 +++++++------- src/H5I.c | 3 ++- src/H5L.c | 8 ++++++-- src/H5Ldeprec.c | 4 ++-- src/H5O.c | 14 +++++++------- src/H5Odeprec.c | 2 +- src/H5TS.c | 10 +++++----- src/H5Tdeprec.c | 2 +- src/H5VLpassthru.h | 2 +- test/CMakePassthroughVOLTests.cmake | 4 +++- test/Makefile.am | 5 ++++- tools/src/misc/h5debug.c | 3 --- 17 files changed, 52 insertions(+), 41 deletions(-) diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index cfbe352..45792d2 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -387,12 +387,12 @@ H5Aiterate1(hid_t loc_id, unsigned *attr_num /*in,out*/, H5A_operator1_t op, voi /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier") + HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier") /* Call attribute iteration routine */ 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"); + HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Aint.c b/src/H5Aint.c index 48e22ad..9b24950 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -1478,6 +1478,10 @@ H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name) FUNC_ENTER_PACKAGE + /* Sanity check */ + HDassert(obj_name); + HDassert(attr_name); + /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; obj_loc.path = &obj_path; diff --git a/src/H5D.c b/src/H5D.c index 3a4d463..ff5fa6a 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -1000,7 +1000,7 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf /* Gather data */ if (0 == (nelmts_gathered = H5D__gather_mem(src_buf, iter, MIN(dst_buf_nelmts, (size_t)nelmts), dst_buf))) - HGOTO_ERROR(H5E_IO, H5E_CANTCOPY, FAIL, "gather failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "gather failed") HDassert(nelmts_gathered == MIN(dst_buf_nelmts, (size_t)nelmts)); /* Make callback to process dst_buf */ @@ -1207,7 +1207,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *s supported = 0; if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_DATASET, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, &supported) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check for 'get vlen buf size' operation") if (supported & H5VL_OPT_QUERY_SUPPORTED) { /* Make the 'get_vlen_buf_size' callback */ diff --git a/src/H5F.c b/src/H5F.c index 6705a3c..3653677 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -742,19 +742,19 @@ H5Fdelete(const char *filename, hid_t fapl_id) /* 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") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the VOL info from the fapl */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(fapl_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a 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_FILE, H5E_CANTGET, FAIL, "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_FILE, H5E_CANTSET, FAIL, "can't set VOL connector info in API context") /* Make sure this is HDF5 storage for this VOL connector */ if (H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, diff --git a/src/H5Gnode.c b/src/H5Gnode.c index a08acca..c66a174 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -97,7 +97,7 @@ H5B_class_t H5B_SNODE[1] = {{ H5G__node_create, /*new */ H5G__node_cmp2, /*cmp2 */ H5G__node_cmp3, /*cmp3 */ - H5G__node_found, /*found */ + H5G__node_found, /*found */ H5G__node_insert, /*insert */ TRUE, /*follow min branch? */ TRUE, /*follow max branch? */ diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c index 56f2477..b981797 100644 --- a/src/H5HFhuge.c +++ b/src/H5HFhuge.c @@ -525,7 +525,7 @@ H5HF__huge_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) /* Look up object in v2 B-tree */ if (H5B2_find(hdr->huge_bt2, &search_rec, H5HF__huge_bt2_filt_indir_found, &found_rec) != TRUE) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") /* Retrieve the object's length */ *obj_len_p = (size_t)found_rec.obj_size; @@ -539,7 +539,7 @@ H5HF__huge_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) /* Look up object in v2 B-tree */ if (H5B2_find(hdr->huge_bt2, &search_rec, H5HF__huge_bt2_indir_found, &found_rec) != TRUE) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") /* Retrieve the object's length */ *obj_len_p = (size_t)found_rec.len; @@ -607,7 +607,7 @@ H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off_p) /* Look up object in v2 B-tree */ if (H5B2_find(hdr->huge_bt2, &search_rec, H5HF__huge_bt2_filt_indir_found, &found_rec) != TRUE) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") /* Retrieve the object's address & length */ obj_addr = found_rec.addr; @@ -621,7 +621,7 @@ H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off_p) /* Look up object in v2 B-tree */ if (H5B2_find(hdr->huge_bt2, &search_rec, H5HF__huge_bt2_indir_found, &found_rec) != TRUE) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") /* Retrieve the object's address & length */ obj_addr = found_rec.addr; @@ -699,7 +699,7 @@ H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read, H5HF_ope /* Look up object in v2 B-tree */ if (H5B2_find(hdr->huge_bt2, &search_rec, H5HF__huge_bt2_filt_indir_found, &found_rec) != TRUE) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") /* Retrieve the object's address & length */ obj_addr = found_rec.addr; @@ -715,7 +715,7 @@ H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read, H5HF_ope /* Look up object in v2 B-tree */ if (H5B2_find(hdr->huge_bt2, &search_rec, H5HF__huge_bt2_indir_found, &found_rec) != TRUE) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") /* Retrieve the object's address & length */ obj_addr = found_rec.addr; @@ -846,7 +846,7 @@ H5HF__huge_write(H5HF_hdr_t *hdr, const uint8_t *id, const void *obj) /* Look up object in v2 B-tree */ if (H5B2_find(hdr->huge_bt2, &search_rec, H5HF__huge_bt2_indir_found, &found_rec) != TRUE) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") /* Retrieve the object's address & length */ obj_addr = found_rec.addr; diff --git a/src/H5I.c b/src/H5I.c index 90a7479..623a2f7 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -300,7 +300,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Iregister * - * Purpose: Public interface to H5I_register. + * Purpose: Register an object. * * Return: Success: New object ID * Failure: H5I_INVALID_HID @@ -318,6 +318,7 @@ H5Iregister(H5I_type_t type, const void *object) if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ID, H5E_BADGROUP, H5I_INVALID_HID, "cannot call public function on library type") + /* Register the object */ ret_value = H5I_register(type, object, TRUE); done: diff --git a/src/H5L.c b/src/H5L.c index 699521f..fbf5b1f 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -434,7 +434,7 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, April 6, 1998 * *------------------------------------------------------------------------- @@ -505,7 +505,7 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, April 6, 1998 * *------------------------------------------------------------------------- @@ -3251,6 +3251,10 @@ H5L__exists(const H5G_loc_t *loc, const char *name) FUNC_ENTER_PACKAGE + /* Sanity checks */ + HDassert(loc); + HDassert(name); + /* A path of "/" will always exist in a file */ if (0 == HDstrcmp(name, "/")) HGOTO_DONE(TRUE) diff --git a/src/H5Ldeprec.c b/src/H5Ldeprec.c index 2adc1fe..3eee8a1 100644 --- a/src/H5Ldeprec.c +++ b/src/H5Ldeprec.c @@ -341,7 +341,7 @@ H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t l 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") + HGOTO_ERROR(H5E_LINK, 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) @@ -431,7 +431,7 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H 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") + HGOTO_ERROR(H5E_LINK, 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) diff --git a/src/H5O.c b/src/H5O.c index 709f479..9da011b 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1422,8 +1422,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: James Laird - * July 14 2006 + * Programmer: James Laird + * July 14 2006 * *------------------------------------------------------------------------- */ @@ -1716,7 +1716,7 @@ H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2, /* 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") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOMPARE, FAIL, "object token comparison failed") done: FUNC_LEAVE_API(ret_value) @@ -1752,11 +1752,11 @@ H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str) /* 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") + HGOTO_ERROR(H5E_OHDR, 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") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "object token serialization failed") done: FUNC_LEAVE_API(ret_value) @@ -1792,11 +1792,11 @@ H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token) /* 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") + HGOTO_ERROR(H5E_OHDR, 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") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "object token deserialization failed") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 3fe1416..a4a5091 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -240,7 +240,7 @@ H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, H5O_inf 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") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get underlying VOL object") oinfo->fileno = dm_info.fileno; oinfo->type = dm_info.type; diff --git a/src/H5TS.c b/src/H5TS.c index 29be128..aa53943 100644 --- a/src/H5TS.c +++ b/src/H5TS.c @@ -332,7 +332,7 @@ H5TS_pthread_first_thread_init(void) * H5TS_mutex_lock(&mutex_var) * * RETURNS - * 0 on success and non-zero on error. + * Non-negative on success / Negative on failure * * DESCRIPTION * Recursive lock semantics for HDF5 (locking) - @@ -347,7 +347,7 @@ H5TS_pthread_first_thread_init(void) herr_t H5TS_mutex_lock(H5TS_mutex_t *mutex) { - herr_t ret_value = 0; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NAMECHECK_ONLY @@ -389,7 +389,7 @@ done: * H5TS_mutex_unlock(&mutex_var) * * RETURNS - * 0 on success and non-zero on error. + * Non-negative on success / Negative on failure * * DESCRIPTION * Recursive lock semantics for HDF5 (unlocking) - @@ -404,7 +404,7 @@ done: herr_t H5TS_mutex_unlock(H5TS_mutex_t *mutex) { - herr_t ret_value = 0; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NAMECHECK_ONLY @@ -444,7 +444,7 @@ done: * H5TS_cancel_count_inc() * * RETURNS - * 0 on success non-zero error code on error. + * Non-negative on success / Negative on failure * * DESCRIPTION * Creates a cancellation counter for a thread if it is the first time diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 89de9e1..a6a6631 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -135,7 +135,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) /* Set up VOL object */ if (NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) - HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "can't allocate top object structure") new_obj->connector = vol_obj->connector; new_obj->connector->nrefs++; new_obj->data = data; diff --git a/src/H5VLpassthru.h b/src/H5VLpassthru.h index a8ef42c..8576d21 100644 --- a/src/H5VLpassthru.h +++ b/src/H5VLpassthru.h @@ -25,7 +25,7 @@ /* Characteristics of the pass-through VOL connector */ #define H5VL_PASSTHRU_NAME "pass_through" -#define H5VL_PASSTHRU_VALUE 505 /* VOL connector ID */ +#define H5VL_PASSTHRU_VALUE 1 /* VOL connector ID */ #define H5VL_PASSTHRU_VERSION 0 /* Pass-through VOL connector info */ diff --git a/test/CMakePassthroughVOLTests.cmake b/test/CMakePassthroughVOLTests.cmake index e1b1f92..108b899 100644 --- a/test/CMakePassthroughVOLTests.cmake +++ b/test/CMakePassthroughVOLTests.cmake @@ -23,9 +23,11 @@ set (VOL_LIST vol_pass_through2 ) +# native VOL = 0 +# pass-through VOL = 1 set (vol_native native) set (vol_pass_through1 "pass_through under_vol=0\;under_info={}") -set (vol_pass_through2 "pass_through under_vol=505\;under_info={under_vol=0\;under_info={}}") +set (vol_pass_through2 "pass_through under_vol=1\;under_info={under_vol=0\;under_info={}}") foreach (voltest ${VOL_LIST}) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}") diff --git a/test/Makefile.am b/test/Makefile.am index 35e53be..9e74e00 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -158,8 +158,11 @@ endif # Test with just the native connector, with a single pass-through connector # and with a doubly-stacked pass-through. +# +# native = 0 +# pass-through = 1 VOL_LIST = native "pass_through under_vol=0;under_info={}" \ - "pass_through under_vol=505;under_info={under_vol=0;under_info={}}" + "pass_through under_vol=1;under_info={under_vol=0;under_info={}}" # Additional target for running timing test timings _timings: testmeta diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index cf7d544..343d8e2 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -67,7 +67,6 @@ * Return: Non-NULL on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- @@ -149,7 +148,6 @@ get_H5B2_class(const uint8_t *sig) * Return: Non-NULL on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- @@ -191,7 +189,6 @@ get_H5EA_class(const uint8_t *sig) * Return: Non-NULL on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- -- cgit v0.12