summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormattjala <124107509+mattjala@users.noreply.github.com>2023-10-23 19:32:54 (GMT)
committerGitHub <noreply@github.com>2023-10-23 19:32:54 (GMT)
commit5a00539e0dbec38894fe2e7ef7cdbef6d09f8dc2 (patch)
tree067f2ca4584bfcdca884bfdcf37f95f57ad902c4 /src
parente4fb67c84aa4a4983e2cee4994235600d813a9ee (diff)
downloadhdf5-5a00539e0dbec38894fe2e7ef7cdbef6d09f8dc2.zip
hdf5-5a00539e0dbec38894fe2e7ef7cdbef6d09f8dc2.tar.gz
hdf5-5a00539e0dbec38894fe2e7ef7cdbef6d09f8dc2.tar.bz2
Add native VOL checks to deprecated functions (#3647)
* Add native VOL checks to deprecated functions * Remove unneeded native VOL checks * Move native checks to top level calls
Diffstat (limited to 'src')
-rw-r--r--src/H5Odeprec.c75
-rw-r--r--src/H5Rdeprec.c128
2 files changed, 145 insertions, 58 deletions
diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c
index 6e8b34e..3de5818 100644
--- a/src/H5Odeprec.c
+++ b/src/H5Odeprec.c
@@ -116,9 +116,10 @@ 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 */
+ 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;
herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_PACKAGE
@@ -158,7 +159,6 @@ H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2,
/* Check for retrieving native information */
nat_fields = shim_data->fields & (H5O_INFO_HDR | H5O_INFO_META_SIZE);
if (nat_fields) {
- H5VL_object_t *vol_obj; /* Object of obj_id */
H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
H5VL_loc_params_t loc_params; /* Location parameters for VOL callback */
@@ -401,7 +401,8 @@ H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo /*out*/)
{
H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ bool is_native_vol_obj = false;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", loc_id, oinfo);
@@ -418,6 +419,15 @@ H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo /*out*/)
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier");
+ /* Check if using native VOL connector */
+ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object");
+
+ /* Must use native VOL connector for this operation */
+ if (!is_native_vol_obj)
+ HGOTO_ERROR(H5E_OHDR, H5E_VOL, FAIL,
+ "Deprecated H5Oget_info1 is only meant to be used with the native VOL connector");
+
/* Retrieve the object's information */
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");
@@ -441,7 +451,8 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo /*out*/,
{
H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ bool is_native_vol_obj = false;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sxi", loc_id, name, oinfo, lapl_id);
@@ -468,6 +479,15 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo /*out*/,
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier");
+ /* Check if using native VOL connector */
+ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object");
+
+ /* Must use native VOL connector for this operation */
+ if (!is_native_vol_obj)
+ HGOTO_ERROR(H5E_OHDR, H5E_VOL, FAIL,
+ "Deprecated H5Oget_info_by_name1 is only meant to be used with the native VOL connector");
+
/* Retrieve the object's information */
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");
@@ -493,7 +513,8 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
{
H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ bool is_native_vol_obj = false;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, oinfo, lapl_id);
@@ -524,6 +545,15 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier");
+ /* Check if using native VOL connector */
+ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object");
+
+ /* Must use native VOL connector for this operation */
+ if (!is_native_vol_obj)
+ HGOTO_ERROR(H5E_OHDR, H5E_VOL, FAIL,
+ "Deprecated H5Oget_info_by_idx1 is only meant to be used with the native VOL connector");
+
/* Retrieve the object's information */
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");
@@ -574,7 +604,7 @@ H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo /*out*/, unsigned fields)
"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");
+ "Deprecated 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)
@@ -637,7 +667,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo /*out*/,
"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");
+ "Deprecated 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)
@@ -706,7 +736,7 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
"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");
+ "Deprecated 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)
@@ -753,6 +783,7 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1
H5VL_loc_params_t loc_params; /* Location parameters for object access */
H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
herr_t ret_value; /* Return value */
+ bool is_native_vol_obj = false;
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "iIiIoOi*x", obj_id, idx_type, order, op, op_data);
@@ -769,6 +800,15 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1
if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier");
+ /* Check if using native VOL connector */
+ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object");
+
+ /* Must use native VOL connector for this operation */
+ if (!is_native_vol_obj)
+ HGOTO_ERROR(H5E_OHDR, H5E_VOL, FAIL,
+ "Deprecated H5Ovisit1 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);
@@ -833,6 +873,7 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it
H5VL_loc_params_t loc_params; /* Location parameters for object access */
H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
herr_t ret_value; /* Return value */
+ bool is_native_vol_obj = false;
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIoOi*xi", loc_id, obj_name, idx_type, order, op, op_data, lapl_id);
@@ -857,6 +898,15 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier");
+ /* Check if using native VOL connector */
+ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object");
+
+ /* Must use native VOL connector for this operation */
+ if (!is_native_vol_obj)
+ HGOTO_ERROR(H5E_OHDR, H5E_VOL, FAIL,
+ "Deprecated H5Ovisit_by_name1 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;
@@ -949,9 +999,10 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1
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");
+ "Deprecated H5Ovisit2 is only meant to be used with the native VOL connector");
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
@@ -1053,7 +1104,7 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it
"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");
+ "Deprecated H5Ovisit_by_name2 is only meant to be used with the native VOL connector");
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_NAME;
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
index 773d8b0..1d12eba 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -101,14 +101,14 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref
#ifndef NDEBUG
{
- bool is_native = false; /* Whether the src file is using the native VOL connector */
+ bool is_native_vol_obj = 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)
+ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 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 */
- assert(is_native);
+ assert(is_native_vol_obj);
}
#endif /* NDEBUG */
@@ -251,7 +251,8 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
H5O_token_t obj_token = {0}; /* Object token */
const unsigned char *buf = (const unsigned char *)ref; /* Reference buffer */
H5O_type_t obj_type = H5O_TYPE_UNKNOWN; /* Type of the referenced object */
- H5G_obj_t ret_value; /* Return value */
+ bool is_native_vol_obj; /* Whether the native VOL connector is in use */
+ H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_API(H5G_UNKNOWN)
H5TRACE3("Go", "iRt*x", id, ref_type, ref);
@@ -266,6 +267,16 @@ H5Rget_obj_type1(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, H5G_UNKNOWN, "invalid location identifier");
+ /* Check if using native VOL connector */
+ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL,
+ "can't determine if VOL object is native connector object");
+
+ /* Must use native VOL connector for this operation */
+ if (!is_native_vol_obj)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_VOL, FAIL,
+ "H5Rget_obj_type1 is only meant to be used with the native VOL connector");
+
/* Get object type */
if ((vol_obj_type = H5I_get_type(id)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier");
@@ -315,7 +326,8 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref)
H5I_type_t opened_type; /* Opened object type */
void *opened_obj = NULL; /* Opened object */
const unsigned char *buf = (const unsigned char *)ref; /* Reference buffer */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ bool is_native_vol_obj; /* Whether the native VOL connector is in use */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "iRt*x", obj_id, ref_type, ref);
@@ -330,6 +342,16 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref)
if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier");
+ /* Check if using native VOL connector */
+ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL,
+ "can't determine if VOL object is native connector object");
+
+ /* Must use native VOL connector for this operation */
+ if (!is_native_vol_obj)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_VOL, FAIL,
+ "H5Rdereference1 is only meant to be used with the native VOL connector");
+
/* Get object type */
if ((vol_obj_type = H5I_get_type(obj_id)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier");
@@ -382,8 +404,9 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
H5VL_file_get_args_t file_get_vol_cb_args; /* Arguments to VOL callback */
hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
void *vol_obj_file = NULL;
- unsigned char *buf = (unsigned char *)ref; /* Return reference pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ bool is_native_vol_obj = false; /* Whether the src file is using the native VOL connector */
+ unsigned char *buf = (unsigned char *)ref; /* Return reference pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "*xi*sRti", ref, loc_id, name, ref_type, space_id);
@@ -404,18 +427,13 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier");
-#ifndef NDEBUG
- {
- bool 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_vol_obj) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses 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 */
- assert(is_native);
- }
-#endif /* NDEBUG */
+ /* Must use native VOL connector for this operation */
+ if (!is_native_vol_obj)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_VOL, FAIL, "must use native VOL connector to create reference");
/* Get object type */
if ((vol_obj_type = H5I_get_type(loc_id)) < 0)
@@ -500,13 +518,14 @@ done:
herr_t
H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type /*out*/)
{
- H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
- H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
- H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
- H5VL_loc_params_t loc_params; /* Location parameters */
- 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 */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */
+ bool is_native_vol_obj = false; /* Whether the native VOL connector is in use */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iRt*xx", id, ref_type, ref, obj_type);
@@ -521,6 +540,16 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj
if (NULL == (vol_obj = H5VL_vol_object(id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier");
+ /* Check if using native VOL connector */
+ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL,
+ "can't determine if VOL object is native connector object");
+
+ /* Must use native VOL connector for this operation */
+ if (!is_native_vol_obj)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_VOL, FAIL,
+ "H5Rget_obj_type2 is only meant to be used with the native VOL connector");
+
/* Get object type */
if ((vol_obj_type = H5I_get_type(id)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier");
@@ -560,14 +589,15 @@ done:
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 of loc_id */
- H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- 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 */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ 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 */
+ 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 */
+ bool is_native_vol_obj = false; /* Whether the native VOL connector is in use */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE4("i", "iiRt*x", obj_id, oapl_id, ref_type, ref);
@@ -588,6 +618,16 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *re
if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier");
+ /* Check if using native VOL connector */
+ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL,
+ "can't determine if VOL object is native connector object");
+
+ /* Must use native VOL connector for this operation */
+ if (!is_native_vol_obj)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_VOL, FAIL,
+ "H5Rdereference2 is only meant to be used with the native VOL connector");
+
/* Get object type */
if ((vol_obj_type = H5I_get_type(obj_id)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier");
@@ -639,7 +679,8 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref)
H5S_t *space = NULL; /* Dataspace object */
hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */
- hid_t ret_value; /* Return value */
+ bool is_native_vol_obj = false; /* Whether the src file is using the native VOL connector */
+ hid_t ret_value; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "iRt*x", id, ref_type, ref);
@@ -654,19 +695,14 @@ 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
- {
- bool 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");
+ /* Check if using native VOL connector */
+ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 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 */
- assert(is_native);
- }
-#endif /* NDEBUG */
+ if (!is_native_vol_obj)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_VOL, FAIL,
+ "H5Rget_region is only meant to be used with the native VOL connector");
/* Get object type */
if ((vol_obj_type = H5I_get_type(id)) < 0)