diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2021-05-07 22:38:40 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2021-05-07 22:38:40 (GMT) |
commit | af84ce737d94466e489d3b41953324651b1c9210 (patch) | |
tree | 4c03e4ecfd0bf1efced65af673a4b26521c4b623 | |
parent | 5ef0958d32147de399d7e0762ca1c08c450627ce (diff) | |
download | hdf5-af84ce737d94466e489d3b41953324651b1c9210.zip hdf5-af84ce737d94466e489d3b41953324651b1c9210.tar.gz hdf5-af84ce737d94466e489d3b41953324651b1c9210.tar.bz2 |
Brings over VOL arg setup
-rw-r--r-- | src/H5VLint.c | 270 | ||||
-rw-r--r-- | src/H5VLprivate.h | 16 |
2 files changed, 286 insertions, 0 deletions
diff --git a/src/H5VLint.c b/src/H5VLint.c index 804031e..d3fb618 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -2340,3 +2340,273 @@ H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_wrap_register() */ + +/*------------------------------------------------------------------------- + * Function: H5VL_setup_args + * + * Purpose: Set up arguments to access an object + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_setup_args(hid_t loc_id, H5I_type_t id_type, H5VL_object_t **vol_obj) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Get attribute pointer */ + if (NULL == (*vol_obj = (H5VL_object_t *)H5I_object_verify(loc_id, id_type))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not the correct type of ID") + + /* Set up collective metadata (if appropriate */ + if (H5CX_set_loc(loc_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set collective metadata read") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_setup_args() */ + +/*------------------------------------------------------------------------- + * Function: H5VL_setup_loc_args + * + * Purpose: Set up arguments to access an object + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_setup_loc_args(hid_t loc_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + HDassert(loc_params); + + /* Get the location object */ + if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not the correct type of ID") + + /* Set up collective metadata (if appropriate */ + if (H5CX_set_loc(loc_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set collective metadata read") + + /* Set location parameters */ + loc_params->type = H5VL_OBJECT_BY_SELF; + loc_params->obj_type = H5I_get_type(loc_id); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_setup_loc_args() */ + +/*------------------------------------------------------------------------- + * Function: H5VL_setup_acc_args + * + * Purpose: Set up arguments to access an object + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_setup_acc_args(hid_t loc_id, const H5P_libclass_t *libclass, hbool_t is_collective, hid_t *acspl_id, + H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(libclass); + HDassert(acspl_id); + HDassert(vol_obj); + HDassert(loc_params); + + /* Verify access property list and set up collective metadata if appropriate */ + if (H5CX_set_apl(acspl_id, libclass, loc_id, is_collective) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Get the location object */ + if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location parameters */ + loc_params->type = H5VL_OBJECT_BY_SELF; + loc_params->obj_type = H5I_get_type(loc_id); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_setup_acc_args() */ + +/*------------------------------------------------------------------------- + * Function: H5VL_setup_self_args + * + * Purpose: Set up arguments to access an object "by self" + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_setup_self_args(hid_t loc_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + HDassert(loc_params); + + /* Get the location object */ + if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location parameters */ + loc_params->type = H5VL_OBJECT_BY_SELF; + loc_params->obj_type = H5I_get_type(loc_id); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_setup_self_args() */ + +/*------------------------------------------------------------------------- + * Function: H5VL_setup_name_args + * + * Purpose: Set up arguments to access an object "by name" + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_setup_name_args(hid_t loc_id, const char *name, const H5P_libclass_t *libclass, hbool_t is_collective, + hid_t acspl_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + HDassert(loc_params); + + /* 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") + + /* Verify access property list and set up collective metadata if appropriate */ + if (H5CX_set_apl(&acspl_id, libclass, loc_id, is_collective) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Get the location object */ + if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set up location parameters */ + 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 = acspl_id; + loc_params->obj_type = H5I_get_type(loc_id); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_setup_name_args() */ + +/*------------------------------------------------------------------------- + * Function: H5VL_setup_idx_args + * + * Purpose: Set up arguments to access an object "by idx" + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_setup_idx_args(hid_t loc_id, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + const H5P_libclass_t *libclass, hbool_t is_collective, hid_t acspl_id, + H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + HDassert(loc_params); + + /* 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 (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(&acspl_id, libclass, loc_id, is_collective) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Get the location object */ + if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location parameters */ + loc_params->type = H5VL_OBJECT_BY_IDX; + loc_params->loc_data.loc_by_idx.name = 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 = acspl_id; + loc_params->obj_type = H5I_get_type(loc_id); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_setup_idx_args() */ + +/*------------------------------------------------------------------------- + * Function: H5VL_setup_token_args + * + * Purpose: Set up arguments to access an object by token + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_setup_token_args(hid_t loc_id, H5O_token_t *obj_token, H5VL_object_t **vol_obj, + H5VL_loc_params_t *loc_params) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + HDassert(loc_params); + + /* Get the location object */ + if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location parameters */ + loc_params->type = H5VL_OBJECT_BY_TOKEN; + loc_params->loc_data.loc_by_token.token = obj_token; + loc_params->obj_type = H5I_get_type(loc_id); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_setup_token_args() */ diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 75997df..e116c8f 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -114,6 +114,22 @@ H5_DLL hid_t H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t conne H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref, hid_t existing_id); +/* Object access functions */ +struct H5P_libclass_t; +H5_DLL herr_t H5VL_setup_args(hid_t loc_id, H5I_type_t id_type, H5VL_object_t **vol_obj); +H5_DLL herr_t H5VL_setup_loc_args(hid_t loc_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params); +H5_DLL herr_t H5VL_setup_acc_args(hid_t loc_id, const struct H5P_libclass_t *libclass, hbool_t is_collective, + hid_t *acspl_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params); +H5_DLL herr_t H5VL_setup_self_args(hid_t loc_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params); +H5_DLL herr_t H5VL_setup_name_args(hid_t loc_id, const char *name, const struct H5P_libclass_t *libclass, + hbool_t is_collective, hid_t acspl_id, H5VL_object_t **vol_obj, + H5VL_loc_params_t *loc_params); +H5_DLL herr_t H5VL_setup_idx_args(hid_t loc_id, const char *name, H5_index_t idx_type, H5_iter_order_t order, + hsize_t n, const struct H5P_libclass_t *libclass, hbool_t is_collective, + hid_t acspl_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params); +H5_DLL herr_t H5VL_setup_token_args(hid_t loc_id, H5O_token_t *obj_token, H5VL_object_t **vol_obj, + H5VL_loc_params_t *loc_params); + /********************************** * VOL connector callback wrappers *********************************/ |