summaryrefslogtreecommitdiffstats
path: root/src/H5R.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-01-16 21:29:34 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-05-20 14:31:50 (GMT)
commit3e6a192e9cef92ee1e0cf1842d05995da83efd27 (patch)
tree3cd0e18b9a50af6fc00a30a7da24d016b07efbb7 /src/H5R.c
parent335fc0096c4287c1121c45c85085e67e5735c47d (diff)
downloadhdf5-3e6a192e9cef92ee1e0cf1842d05995da83efd27.zip
hdf5-3e6a192e9cef92ee1e0cf1842d05995da83efd27.tar.gz
hdf5-3e6a192e9cef92ee1e0cf1842d05995da83efd27.tar.bz2
Squashed commit of the token_refactoring branch:
Diffstat (limited to 'src/H5R.c')
-rw-r--r--src/H5R.c143
1 files changed, 73 insertions, 70 deletions
diff --git a/src/H5R.c b/src/H5R.c
index 3a022eb..8b9c979 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -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,7 +135,7 @@ 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 */
@@ -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,7 +228,7 @@ 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 */
@@ -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,7 +317,7 @@ 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 */
@@ -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 */
@@ -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 */
@@ -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)
@@ -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);
@@ -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 */
@@ -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
*
*-------------------------------------------------------------------------
*/