2
0
mirror of https://github.com/HDFGroup/hdf5.git synced 2025-04-24 17:51:25 +08:00

[svn-r21117] Issue 2763 - I added a new parameter of object access property list to the function H5Rdereference. It's called H5Rdereference2 now. H5Rdereference function has been deprecated to H5Rdereference1. I also added some test cases in trefer.c.

Tested on jam, heiwa, and koala.
This commit is contained in:
Raymond Lu 2011-07-18 16:23:02 -05:00
parent cc0486926f
commit 304f19d730
21 changed files with 242 additions and 86 deletions

@ -437,7 +437,7 @@ void H5Object::reference(void* ref, const H5std_string& name) const
hid_t H5Object::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type)
{
hid_t temp_id;
temp_id = H5Rdereference(loc_id, ref_type, ref);
temp_id = H5Rdereference2(loc_id, H5P_DATASET_ACCESS_DEFAULT, ref_type, ref);
if (temp_id < 0)
{
throw ReferenceException("", "H5Rdereference failed");

@ -121,7 +121,7 @@ nh5rdereference_region_c(hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id)
/*
* Call H5Rdereference function.
*/
if((c_obj_id = H5Rdereference((hid_t)*dset_id, H5R_DATASET_REGION, &ref_c)) < 0)
if((c_obj_id = H5Rdereference2((hid_t)*dset_id, H5P_DATASET_ACCESS_DEFAULT, H5R_DATASET_REGION, &ref_c)) < 0)
HGOTO_DONE(FAIL)
/* Copy the object's ID */
@ -151,7 +151,7 @@ nh5rdereference_object_c(hid_t_f *dset_id, haddr_t_f *ref, hid_t_f *obj_id)
/*
* Call H5Rdereference function.
*/
if((c_obj_id = H5Rdereference((hid_t)*dset_id, H5R_OBJECT, &ref_c)) < 0)
if((c_obj_id = H5Rdereference2((hid_t)*dset_id, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &ref_c)) < 0)
HGOTO_DONE(FAIL)
/* Copy the object's ID */

@ -511,7 +511,7 @@ herr_t H5IM_get_palette(hid_t loc_id,
goto out;
/* Get the palette id */
if((pal_id = H5Rdereference(image_id, H5R_OBJECT, &refbuf[pal_number])) < 0)
if((pal_id = H5Rdereference2(image_id, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &refbuf[pal_number])) < 0)
goto out;
/* Read the palette dataset using the memory type TID */

@ -318,7 +318,7 @@ herr_t H5DSattach_scale(hid_t did,
ref_j = ((hobj_ref_t *)buf[idx].p)[i];
/* get the scale id for this REF */
if((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref_j)) < 0)
if((dsid_j = H5Rdereference2(did,H5P_DATASET_ACCESS_DEFAULT,H5R_OBJECT,&ref_j)) < 0)
goto out;
/* get info for DS in the parameter list */
@ -690,7 +690,7 @@ herr_t H5DSdetach_scale(hid_t did,
ref = ((hobj_ref_t *)buf[idx].p)[j];
/* get the DS id */
if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref)) < 0)
if ((dsid_j = H5Rdereference2(did,H5P_DATASET_ACCESS_DEFAULT,H5R_OBJECT,&ref)) < 0)
goto out;
/* get info for this DS */
@ -800,7 +800,7 @@ herr_t H5DSdetach_scale(hid_t did,
ref = dsbuf[ii].ref;
/* get the dataset id */
if ((did_i = H5Rdereference(did,H5R_OBJECT,&ref)) < 0)
if ((did_i = H5Rdereference2(did,H5P_DATASET_ACCESS_DEFAULT,H5R_OBJECT,&ref)) < 0)
goto out;
/* get info for this dataset */
@ -1048,7 +1048,7 @@ htri_t H5DSis_attached(hid_t did,
ref = ((hobj_ref_t *)buf[idx].p)[i];
/* get the scale id for this REF */
if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref)) < 0)
if ((dsid_j = H5Rdereference2(did,H5P_DATASET_ACCESS_DEFAULT,H5R_OBJECT,&ref)) < 0)
goto out;
/* get info for DS in the parameter list */
@ -1138,7 +1138,7 @@ htri_t H5DSis_attached(hid_t did,
if (ref)
{
/* get the dataset id */
if ((did_i = H5Rdereference(did,H5R_OBJECT,&ref)) < 0)
if ((did_i = H5Rdereference2(did,H5P_DATASET_ACCESS_DEFAULT,H5R_OBJECT,&ref)) < 0)
goto out;
/* get info for dataset in the parameter list */
@ -1342,7 +1342,7 @@ herr_t H5DSiterate_scales(hid_t did,
/* disable error reporting, the ID might refer to a deleted dataset */
H5E_BEGIN_TRY {
/* get the DS id */
if ((scale_id = H5Rdereference(did,H5R_OBJECT,&ref)) < 0)
if ((scale_id = H5Rdereference2(did,H5P_DATASET_ACCESS_DEFAULT,H5R_OBJECT,&ref)) < 0)
goto out;
} H5E_END_TRY;

@ -905,7 +905,7 @@ herr_t H5IMget_palette_info( hid_t loc_id,
goto out;
/* Get the actual palette */
if ( (pal_id = H5Rdereference( did, H5R_OBJECT, &refbuf[pal_number] )) < 0)
if ( (pal_id = H5Rdereference2( did, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &refbuf[pal_number] )) < 0)
goto out;
if ( (pal_space_id = H5Dget_space( pal_id )) < 0)
@ -1016,7 +1016,7 @@ herr_t H5IMget_palette( hid_t loc_id,
goto out;
/* Get the palette id */
if ( (pal_id = H5Rdereference( did, H5R_OBJECT, &refbuf[pal_number] )) < 0)
if ( (pal_id = H5Rdereference2( did, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &refbuf[pal_number] )) < 0)
goto out;
/* Read the palette dataset */

@ -91,6 +91,10 @@ New Features
Library:
--------
- I added a new parameter of object access property list to the function
H5Rdereference (Issue 2763). It's called H5Rdereference2 now. The former
H5Rdereference function has been deprecated to H5Rdereference1. (SLU -
2011/7/18)
- The library added two new dataset transfer property to control whether
to fill 0xff in the destination data or convert to the destination data
when overflow happens to ENUM data (Issue 7579). The two new functions

@ -38,8 +38,6 @@
/* Static functions */
static herr_t H5R_create(void *ref, H5G_loc_t *loc, const char *name,
H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id);
static hid_t H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type,
const void *_ref, hbool_t app_ref);
static H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref);
static ssize_t H5R_get_name(H5F_t *file, hid_t lapl_id, hid_t dxpl_id, hid_t id,
H5R_type_t ref_type, const void *_ref, char *name, size_t size);
@ -361,9 +359,13 @@ done:
Currently only set up to work with references to datasets
EXAMPLES
REVISION LOG
Raymond Lu
13 July 2011
I added the OAPL_ID parameter for the object being referenced. It only
supports dataset access property list currently.
--------------------------------------------------------------------------*/
static hid_t
H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref, hbool_t app_ref)
hid_t
H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref, hbool_t app_ref)
{
H5O_loc_t oloc; /* Object location */
H5G_name_t path; /* Path of object */
@ -462,11 +464,10 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_re
case H5O_TYPE_DATASET:
{
hid_t dapl_id = H5P_DATASET_ACCESS_DEFAULT; /* dapl to use to open dataset */
H5D_t *dset; /* Pointer to dataset to open */
/* Open the dataset */
if(NULL == (dset = H5D_open(&loc, dapl_id, dxpl_id)))
if(NULL == (dset = H5D_open(&loc, oapl_id, dxpl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found")
/* Create an atom for the dataset */
@ -488,11 +489,11 @@ done:
/*--------------------------------------------------------------------------
NAME
H5Rdereference
H5Rdereference2
PURPOSE
Opens the HDF5 object referenced.
USAGE
hid_t H5Rdereference(ref)
hid_t H5Rdereference2(ref)
hid_t id; IN: Dataset reference object is in or location ID of
object that the dataset is located within.
H5R_type_t ref_type; IN: Type of reference to create
@ -507,19 +508,22 @@ done:
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
Raymond Lu
13 July 2011
I added the OAPL_ID parameter for the object being referenced. It only
supports dataset access property list currently.
--------------------------------------------------------------------------*/
hid_t
H5Rdereference(hid_t id, H5R_type_t ref_type, const void *_ref)
H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_ref)
{
H5G_loc_t loc; /* Group location */
H5F_t *file = NULL; /* File object */
hid_t ret_value;
FUNC_ENTER_API(H5Rdereference, FAIL)
H5TRACE3("i", "iRt*x", id, ref_type, _ref);
FUNC_ENTER_API(H5Rdereference2, FAIL)
/* Check args */
if(H5G_loc(id, &loc) < 0)
if(H5G_loc(obj_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
@ -530,12 +534,12 @@ H5Rdereference(hid_t id, H5R_type_t ref_type, const void *_ref)
file = loc.oloc->file;
/* Create reference */
if((ret_value = H5R_dereference(file, H5AC_dxpl_id, ref_type, _ref, TRUE)) < 0)
if((ret_value = H5R_dereference(file, oapl_id, H5AC_dxpl_id, ref_type, _ref, TRUE)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable dereference object")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Rdereference() */
} /* end H5Rdereference2() */
/*--------------------------------------------------------------------------

@ -46,7 +46,7 @@
#include "H5Gprivate.h" /* Groups */
#include "H5Oprivate.h" /* Object headers */
#include "H5Rpkg.h" /* References */
#include "H5Ppublic.h" /* for using H5P_DATASET_ACCESS_DEFAULT */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/****************/
@ -158,5 +158,56 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Rget_obj_type1() */
/*--------------------------------------------------------------------------
NAME
H5Rdereference1
PURPOSE
Opens the HDF5 object referenced.
USAGE
hid_t H5Rdereference1(ref)
hid_t id; IN: Dataset reference object is in or location ID of
object that the dataset is located within.
H5R_type_t ref_type; IN: Type of reference to create
void *ref; IN: Reference to open.
RETURNS
Valid ID on success, Negative on failure
DESCRIPTION
Given a reference to some object, open that object and return an ID for
that object.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
hid_t
H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref)
{
H5G_loc_t loc; /* Group location */
H5F_t *file = NULL; /* File object */
hid_t ret_value;
FUNC_ENTER_API(H5Rdereference1, FAIL)
/* Check args */
if(H5G_loc(obj_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
if(_ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
/* Get the file pointer from the entry */
file = loc.oloc->file;
/* Create reference */
if((ret_value = H5R_dereference(file, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id, ref_type, _ref, TRUE)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable dereference object")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Rdereference1() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */

@ -57,6 +57,8 @@
H5_DLL herr_t H5R_init(void);
H5_DLL herr_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type,
const void *_ref, H5O_type_t *obj_type);
H5_DLL hid_t H5R_dereference(H5F_t *file, hid_t dapl_id, hid_t dxpl_id, H5R_type_t ref_type,
const void *_ref, hbool_t app_ref);
#endif /* _H5Rpkg_H */

@ -60,7 +60,7 @@ extern "C" {
/* Functions in H5R.c */
H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name,
H5R_type_t ref_type, hid_t space_id);
H5_DLL hid_t H5Rdereference(hid_t dataset, H5R_type_t ref_type, const void *ref);
H5_DLL hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref);
H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref);
H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *_ref,
H5O_type_t *obj_type);
@ -81,6 +81,7 @@ H5_DLL ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref,
/* Function prototypes */
H5_DLL H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *_ref);
H5_DLL hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref);
#endif /* H5_NO_DEPRECATED_SYMBOLS */

@ -62,6 +62,7 @@ FUNCTION: H5Pget_filter; ; v10, v18
FUNCTION: H5Pget_filter_by_id; ; v16, v18
FUNCTION: H5Pinsert; ; v14, v18
FUNCTION: H5Pregister; ; v14, v18
FUNCTION: H5Rdereference; ; v10, v110
FUNCTION: H5Rget_obj_type; ; v16, v18
FUNCTION: H5Tarray_create; ; v14, v18
FUNCTION: H5Tcommit; ; v10, v18

@ -111,6 +111,10 @@
#define H5Pregister_vers 1
#endif /* !defined(H5Pregister_vers) */
#if !defined(H5Rdereference_vers)
#define H5Rdereference_vers 1
#endif /* !defined(H5Rdereference_vers) */
#if !defined(H5Rget_obj_type_vers)
#define H5Rget_obj_type_vers 1
#endif /* !defined(H5Rget_obj_type_vers) */
@ -219,6 +223,10 @@
#define H5Pregister_vers 2
#endif /* !defined(H5Pregister_vers) */
#if !defined(H5Rdereference_vers)
#define H5Rdereference_vers 1
#endif /* !defined(H5Rdereference_vers) */
#if !defined(H5Rget_obj_type_vers)
#define H5Rget_obj_type_vers 2
#endif /* !defined(H5Rget_obj_type_vers) */
@ -459,6 +467,17 @@
#error "H5Pregister_vers set to invalid value"
#endif /* H5Pregister_vers */
#if !defined(H5Rdereference_vers) || H5Rdereference_vers == 2
#ifndef H5Rdereference_vers
#define H5Rdereference_vers 2
#endif /* H5Rdereference_vers */
#define H5Rdereference H5Rdereference2
#elif H5Rdereference_vers == 1
#define H5Rdereference H5Rdereference1
#else /* H5Rdereference_vers */
#error "H5Rdereference_vers set to invalid value"
#endif /* H5Rdereference_vers */
#if !defined(H5Rget_obj_type_vers) || H5Rget_obj_type_vers == 2
#ifndef H5Rget_obj_type_vers
#define H5Rget_obj_type_vers 2

@ -2518,7 +2518,7 @@ test_obj_ref(hid_t fapl)
FAIL_STACK_ERROR
TESTING("getting path to normal dataset in root group");
if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[0])) < 0) FAIL_STACK_ERROR
if((dataset2 = H5Rdereference2(dataset, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &wbuf[0])) < 0) FAIL_STACK_ERROR
*buf = '\0';
i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
@ -2530,7 +2530,7 @@ test_obj_ref(hid_t fapl)
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset in /Group1");
if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[1])) < 0) FAIL_STACK_ERROR
if((dataset2 = H5Rdereference2(dataset, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &wbuf[1])) < 0) FAIL_STACK_ERROR
*buf = '\0';
i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
@ -2542,7 +2542,7 @@ test_obj_ref(hid_t fapl)
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to /Group1");
if((group = H5Rdereference(dataset, H5R_OBJECT, &wbuf[2])) < 0) FAIL_STACK_ERROR
if((group = H5Rdereference2(dataset, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &wbuf[2])) < 0) FAIL_STACK_ERROR
*buf = '\0';
i = H5Iget_name(group, (char*)buf, sizeof(buf));
if(H5Gclose(group) < 0) FAIL_STACK_ERROR
@ -2554,7 +2554,7 @@ test_obj_ref(hid_t fapl)
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to datatype in /Group1");
if((tid1 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[3])) < 0) FAIL_STACK_ERROR
if((tid1 = H5Rdereference2(dataset, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &wbuf[3])) < 0) FAIL_STACK_ERROR
*buf = '\0';
i = H5Iget_name(tid1, (char*)buf, sizeof(buf));
if(H5Tclose(tid1) < 0) FAIL_STACK_ERROR
@ -2566,7 +2566,7 @@ test_obj_ref(hid_t fapl)
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset in nested group");
if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR
if((dataset2 = H5Rdereference2(dataset, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR
*buf = '\0';
i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
@ -2578,7 +2578,7 @@ test_obj_ref(hid_t fapl)
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to nested group");
if((group = H5Rdereference(dataset, H5R_OBJECT, &wbuf[5])) < 0) FAIL_STACK_ERROR
if((group = H5Rdereference2(dataset, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &wbuf[5])) < 0) FAIL_STACK_ERROR
*buf = '\0';
i = H5Iget_name(group, (char*)buf, sizeof(buf));
if(H5Gclose(group) < 0) FAIL_STACK_ERROR
@ -2590,7 +2590,7 @@ test_obj_ref(hid_t fapl)
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset created via hard link");
if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[6])) < 0) FAIL_STACK_ERROR
if((dataset2 = H5Rdereference2(dataset, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &wbuf[6])) < 0) FAIL_STACK_ERROR
*buf = '\0';
i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
@ -2602,7 +2602,7 @@ test_obj_ref(hid_t fapl)
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to root group");
if((group = H5Rdereference(dataset, H5R_OBJECT, &wbuf[7])) < 0) FAIL_STACK_ERROR
if((group = H5Rdereference2(dataset, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &wbuf[7])) < 0) FAIL_STACK_ERROR
*buf = '\0';
i = H5Iget_name(group, (char*)buf, sizeof(buf));
if(H5Gclose(group) < 0) FAIL_STACK_ERROR
@ -2617,7 +2617,7 @@ test_obj_ref(hid_t fapl)
FAIL_STACK_ERROR
TESTING("getting path to dataset hidden by a mounted file");
if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR
if((dataset2 = H5Rdereference2(dataset, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR
*buf = '\0';
i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
@ -2628,7 +2628,7 @@ test_obj_ref(hid_t fapl)
PASSED()
/* Now we try unlinking dataset2 from the file and searching for it. It shouldn't be found */
if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[1])) < 0)
if((dataset2 = H5Rdereference2(dataset, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &wbuf[1])) < 0)
FAIL_STACK_ERROR
if(H5Ldelete(fid1, "/Group1/Dataset2", H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
@ -2768,7 +2768,7 @@ test_reg_ref(hid_t fapl)
TESTING("H5Iget_name to get name from region reference(hyperslab)");
/* Dereference the first reference */
dsetv_id = H5Rdereference(dsetr_id, H5R_DATASET_REGION, &ref_out[0]);
dsetv_id = H5Rdereference2(dsetr_id, H5P_DATASET_ACCESS_DEFAULT, H5R_DATASET_REGION, &ref_out[0]);
/* Get name of the dataset the first region reference points using H5Iget_name */
*buf2 = '\0';
@ -2789,7 +2789,7 @@ test_reg_ref(hid_t fapl)
TESTING("H5Iget_name to get name from region reference(pnt selec)");
/* Dereference the second reference */
if((dsetv_id = H5Rdereference(dsetr_id, H5R_DATASET_REGION, &ref_out[1])) < 0) TEST_ERROR
if((dsetv_id = H5Rdereference2(dsetr_id, H5P_DATASET_ACCESS_DEFAULT, H5R_DATASET_REGION, &ref_out[1])) < 0) TEST_ERROR
/* Get name of the dataset the first region reference points using H5Iget_name */
*buf2 = '\0';

@ -2187,7 +2187,7 @@ test_refer_dtype(hid_t file)
TEST_ERROR;
/* Open datatype object */
if((tid1 = H5Rdereference(dataset, H5R_OBJECT, rbuf)) < 0)
if((tid1 = H5Rdereference2(dataset, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, rbuf)) < 0)
TEST_ERROR;
/* Verify correct datatype */
@ -2372,7 +2372,7 @@ test_refer_dtype2(hid_t file)
TEST_ERROR;
/* Try to open objects */
if((dset2 = H5Rdereference(dset1, H5R_DATASET_REGION, &rbuf)) < 0)
if((dset2 = H5Rdereference2(dset1, H5P_DATASET_ACCESS_DEFAULT, H5R_DATASET_REGION, &rbuf)) < 0)
TEST_ERROR;
/* Check what H5Rget_obj_type2 function returns */

@ -971,8 +971,8 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
if(obj1_type != obj2_type) TEST_ERROR
/* Open referenced objects */
if((obj1_id = H5Rdereference(parent1, H5R_OBJECT, ref_buf1)) < 0) TEST_ERROR
if((obj2_id = H5Rdereference(parent2, H5R_OBJECT, ref_buf2)) < 0) TEST_ERROR
if((obj1_id = H5Rdereference2(parent1, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, ref_buf1)) < 0) TEST_ERROR
if((obj2_id = H5Rdereference2(parent2, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, ref_buf2)) < 0) TEST_ERROR
/* break the infinite loop when the ref_object points to itself */
if(obj_owner > 0) {
@ -1029,8 +1029,8 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
if(obj1_type != obj2_type) TEST_ERROR
/* Open referenced objects */
if((obj1_id = H5Rdereference(parent1, H5R_DATASET_REGION, ref_buf1)) < 0) TEST_ERROR
if((obj2_id = H5Rdereference(parent2, H5R_DATASET_REGION, ref_buf2)) < 0) TEST_ERROR
if((obj1_id = H5Rdereference2(parent1, H5P_DATASET_ACCESS_DEFAULT, H5R_DATASET_REGION, ref_buf1)) < 0) TEST_ERROR
if((obj2_id = H5Rdereference2(parent2, H5P_DATASET_ACCESS_DEFAULT, H5R_DATASET_REGION, ref_buf2)) < 0) TEST_ERROR
/* break the infinite loop when the ref_object points to itself */
if(obj_owner > 0) {

@ -75,6 +75,7 @@ test_reference_params(void)
hid_t group; /* Group ID */
hid_t sid1; /* Dataspace ID */
hid_t tid1; /* Datatype ID */
hid_t dapl_id; /* Dataset access property list */
hsize_t dims1[] = {SPACE1_DIM1};
hobj_ref_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
@ -101,6 +102,10 @@ test_reference_params(void)
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create dataset access property list */
dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
CHECK(dapl_id, FAIL, "H5Pcreate");
/* Create a group */
group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group, FAIL, "H5Gcreate2");
@ -179,11 +184,11 @@ test_reference_params(void)
VERIFY(ret, FAIL, "H5Rcreate space");
/* Test parameters to H5Rdereference */
dset2 = H5Rdereference(-1, H5R_OBJECT, &rbuf[0]);
dset2 = H5Rdereference2(-1, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &rbuf[0]);
VERIFY(dset2, FAIL, "H5Rdereference loc_id");
dset2 = H5Rdereference(dataset, H5R_OBJECT, NULL);
dset2 = H5Rdereference2(dataset, dapl_id, H5R_OBJECT, NULL);
VERIFY(dset2, FAIL, "H5Rdereference ref");
dset2 = H5Rdereference(dataset, H5R_MAXTYPE, &rbuf[0]);
dset2 = H5Rdereference2(dataset, dapl_id, H5R_MAXTYPE, &rbuf[0]);
VERIFY(dset2, FAIL, "H5Rdereference type");
/* Test parameters to H5Rget_obj_type2 */
@ -214,6 +219,10 @@ test_reference_params(void)
ret = H5Sclose(sid1);
CHECK(ret, FAIL, "H5Sclose");
/* Close dataset access property list */
ret = H5Pclose(dapl_id);
CHECK(ret, FAIL, "H5Pclose");
/* Close Dataset */
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
@ -237,23 +246,24 @@ test_reference_params(void)
static void
test_reference_obj(void)
{
hid_t fid1; /* HDF5 File IDs */
hid_t dataset, /* Dataset ID */
dset2; /* Dereferenced dataset ID */
hid_t fid1; /* HDF5 File IDs */
hid_t dataset, /* Dataset ID */
dset2; /* Dereferenced dataset ID */
hid_t group; /* Group ID */
hid_t sid1; /* Dataspace ID */
hid_t tid1; /* Datatype ID */
hsize_t dims1[] = {SPACE1_DIM1};
hobj_ref_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf; /* temp. buffer read from disk */
hid_t dapl_id; /* Dataset access property list */
hobj_ref_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf; /* temp. buffer read from disk */
hobj_ref_t nvrbuf[3]={0,101,1000000000}; /* buffer with non-valid refs */
unsigned *tu32; /* Temporary pointer to uint32 data */
int i, j; /* counting variables */
unsigned *tu32; /* Temporary pointer to uint32 data */
int i, j; /* counting variables */
const char *write_comment="Foo!"; /* Comments for group */
char read_comment[10];
H5O_type_t obj_type; /* Object type */
herr_t ret; /* Generic return value */
H5O_type_t obj_type; /* Object type */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Object Reference Functions\n"));
@ -271,6 +281,10 @@ test_reference_obj(void)
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create dataset access property list */
dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
CHECK(dapl_id, FAIL, "H5Pcreate");
/* Create a group */
group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group, FAIL, "H5Gcreate2");
@ -389,7 +403,7 @@ test_reference_obj(void)
CHECK(ret, FAIL, "H5Dread");
/* Open dataset object */
dset2 = H5Rdereference(dataset, H5R_OBJECT, &rbuf[0]);
dset2 = H5Rdereference2(dataset, dapl_id, H5R_OBJECT, &rbuf[0]);
CHECK(dset2, FAIL, "H5Rdereference");
/* Check information in referenced dataset */
@ -410,8 +424,8 @@ test_reference_obj(void)
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
/* Open group object */
group = H5Rdereference(dataset, H5R_OBJECT, &rbuf[2]);
/* Open group object. GAPL isn't supported yet. But it's harmless to pass in */
group = H5Rdereference2(dataset, H5P_GROUP_ACCESS_DEFAULT, H5R_OBJECT, &rbuf[2]);
CHECK(group, FAIL, "H5Rdereference");
/* Get group's comment */
@ -426,8 +440,8 @@ test_reference_obj(void)
ret = H5Gclose(group);
CHECK(ret, FAIL, "H5Gclose");
/* Open datatype object */
tid1 = H5Rdereference(dataset, H5R_OBJECT, &rbuf[3]);
/* Open datatype object. TAPL isn't supported yet. But it's harmless to pass in */
tid1 = H5Rdereference2(dataset, H5P_DATATYPE_ACCESS_DEFAULT, H5R_OBJECT, &rbuf[3]);
CHECK(tid1, FAIL, "H5Rdereference");
/* Verify correct datatype */
@ -457,6 +471,10 @@ test_reference_obj(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
/* Close dataset access property list */
ret = H5Pclose(dapl_id);
CHECK(ret, FAIL, "H5Pclose");
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
@ -481,6 +499,7 @@ test_reference_region(void)
dset2; /* Dereferenced dataset ID */
hid_t sid1, /* Dataspace ID #1 */
sid2; /* Dataspace ID #2 */
hid_t dapl_id; /* Dataset access property list */
hsize_t dims1[] = {SPACE1_DIM1},
dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
@ -518,6 +537,10 @@ test_reference_region(void)
sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL);
CHECK(sid2, FAIL, "H5Screate_simple");
/* Create dataset access property list */
dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
CHECK(dapl_id, FAIL, "H5Pcreate");
/* Create a dataset */
dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8LE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset2, FAIL, "H5Dcreate2");
@ -615,7 +638,7 @@ test_reference_region(void)
CHECK(ret, FAIL, "H5Dread");
/* Try to open objects */
dset2 = H5Rdereference(dset1, H5R_DATASET_REGION, &rbuf[0]);
dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[0]);
CHECK(dset2, FAIL, "H5Rdereference");
/* Check what H5Rget_obj_type2 function returns */
@ -729,6 +752,10 @@ test_reference_region(void)
ret = H5Dclose(dset1);
CHECK(ret, FAIL, "H5Dclose");
/* Close dataset access property list */
ret = H5Pclose(dapl_id);
CHECK(ret, FAIL, "H5Pclose");
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
@ -754,6 +781,7 @@ test_reference_region_1D(void)
dset3; /* Dereferenced dataset ID */
hid_t sid1, /* Dataspace ID #1 */
sid3; /* Dataspace ID #3 */
hid_t dapl_id; /* Dataset access property list */
hsize_t dims1[] = {SPACE1_DIM1},
dims3[] = {SPACE3_DIM1};
hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
@ -790,6 +818,10 @@ test_reference_region_1D(void)
sid3 = H5Screate_simple(SPACE3_RANK, dims3, NULL);
CHECK(sid3, FAIL, "H5Screate_simple");
/* Create dataset access property list */
dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
CHECK(dapl_id, FAIL, "H5Pcreate");
/* Create a dataset */
dset3 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8LE, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset3, FAIL, "H5Dcreate2");
@ -887,7 +919,7 @@ test_reference_region_1D(void)
CHECK(ret, FAIL, "H5Dread");
/* Try to open objects */
dset3 = H5Rdereference(dset1, H5R_DATASET_REGION, &rbuf[0]);
dset3 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[0]);
CHECK(dset3, FAIL, "H5Rdereference");
/* Check what H5Rget_obj_type2 function returns */
@ -1005,6 +1037,10 @@ test_reference_region_1D(void)
ret = H5Dclose(dset1);
CHECK(ret, FAIL, "H5Dclose");
/* Close dataset access property list */
ret = H5Pclose(dapl_id);
CHECK(ret, FAIL, "H5Pclose");
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
@ -1094,12 +1130,12 @@ test_reference_obj_deleted(void)
CHECK(ret, FAIL, "H5Dread");
/* Open deleted dataset object */
dset2 = H5Rdereference(dataset, H5R_OBJECT, &oref);
dset2 = H5Rdereference2(dataset, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &oref);
VERIFY(dset2, FAIL, "H5Rdereference");
/* Open nonsense reference */
HDmemset(&oref, 0, sizeof(hobj_ref_t));
dset2 = H5Rdereference(dataset, H5R_OBJECT, &oref);
dset2 = H5Rdereference2(dataset, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &oref);
VERIFY(dset2, FAIL, "H5Rdereference");
/* Close Dataset */
@ -1238,7 +1274,7 @@ test_reference_group(void)
CHECK(ret, FAIL, "H5Dread");
/* Dereference to get the group */
gid = H5Rdereference(did, H5R_OBJECT, &rref);
gid = H5Rdereference2(did, H5P_GROUP_ACCESS_DEFAULT, H5R_OBJECT, &rref);
CHECK(gid, FAIL, "H5Rdereference");
/* Iterate through objects in dereferenced group */
@ -1286,11 +1322,11 @@ static void
test_reference_compat(void)
{
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
hid_t group; /* Group ID */
hid_t dataset, dset2; /* Dataset ID */
hid_t group, group2; /* Group ID */
hid_t sid1, /* Dataspace IDs */
sid2;
hid_t tid1; /* Datatype ID */
hid_t tid1, tid2; /* Datatype ID */
hsize_t dims1[] = {SPACE1_DIM1},
dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
@ -1485,6 +1521,32 @@ test_reference_compat(void)
CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
VERIFY(obj_type, H5G_TYPE, "H5Rget_obj_type1");
/* Make sure the referenced objects can be opened */
dset2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[0]);
CHECK(dset2, FAIL, "H5Rdereference1");
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
dset2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[1]);
CHECK(dset2, FAIL, "H5Rdereference1");
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
group2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[2]);
CHECK(group2, FAIL, "H5Rdereference1");
ret = H5Gclose(group2);
CHECK(ret, FAIL, "H5Gclose");
tid2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[3]);
CHECK(tid2, FAIL, "H5Rdereference1");
ret = H5Tclose(tid2);
CHECK(ret, FAIL, "H5Tclose");
/* Close Dataset */
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
@ -1513,11 +1575,23 @@ test_reference_compat(void)
obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[3]);
VERIFY(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
/* Make sure the referenced objects can be opened */
dset2 = H5Rdereference1(dataset, H5R_DATASET_REGION, &rbuf_reg[0]);
CHECK(dset2, FAIL, "H5Rdereference1");
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
dset2 = H5Rdereference1(dataset, H5R_DATASET_REGION, &rbuf_reg[1]);
CHECK(dset2, FAIL, "H5Rdereference1");
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
/* Close Dataset */
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");

@ -464,7 +464,7 @@ void test_objnames(hid_t fid, const char* string)
CHECK(ret, FAIL, "H5Dread");
/* Ensure that we can open named datatype using object reference */
type_id = H5Rdereference(dset_id, H5R_OBJECT, &obj_ref);
type_id = H5Rdereference2(dset_id, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &obj_ref);
CHECK(type_id, FAIL, "H5Rdereference");
ret = H5Tcommitted(type_id);
VERIFY(ret, 1, "H5Tcommitted");

@ -178,7 +178,7 @@ int do_copy_refobjs(hid_t fidin,
} /* end if */
for(u = 0; u < nelmts; u++) {
H5E_BEGIN_TRY {
if((refobj_id = H5Rdereference(dset_in, H5R_OBJECT, &buf[u])) < 0)
if((refobj_id = H5Rdereference2(dset_in, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &buf[u])) < 0)
continue;
} H5E_END_TRY;
@ -262,7 +262,7 @@ int do_copy_refobjs(hid_t fidin,
for(u = 0; u < nelmts; u++) {
H5E_BEGIN_TRY {
if((refobj_id = H5Rdereference(dset_in, H5R_DATASET_REGION, &buf[u])) < 0)
if((refobj_id = H5Rdereference2(dset_in, H5P_DATASET_ACCESS_DEFAULT, H5R_DATASET_REGION, &buf[u])) < 0)
continue;
} H5E_END_TRY;
@ -540,7 +540,7 @@ static int copy_refs_attr(hid_t loc_in,
{
H5E_BEGIN_TRY
{
if((refobj_id = H5Rdereference(attr_id, H5R_OBJECT, &buf[k])) < 0)
if((refobj_id = H5Rdereference2(attr_id, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &buf[k])) < 0)
goto error;
} H5E_END_TRY;
@ -620,7 +620,7 @@ static int copy_refs_attr(hid_t loc_in,
{
H5E_BEGIN_TRY
{
if((refobj_id = H5Rdereference(attr_id, H5R_DATASET_REGION, &buf[k])) < 0)
if((refobj_id = H5Rdereference2(attr_id, H5P_DATASET_ACCESS_DEFAULT, H5R_DATASET_REGION, &buf[k])) < 0)
continue;
} H5E_END_TRY;

@ -760,9 +760,9 @@ hsize_t diff_datum(void *_mem1,
hid_t region1_id;
hid_t region2_id;
if ((obj1_id = H5Rdereference(container1_id, H5R_DATASET_REGION, _mem1))<0)
if ((obj1_id = H5Rdereference2(container1_id, H5P_DATASET_ACCESS_DEFAULT, H5R_DATASET_REGION, _mem1))<0)
ret= -1;
if ((obj2_id = H5Rdereference(container2_id, H5R_DATASET_REGION, _mem2))<0)
if ((obj2_id = H5Rdereference2(container2_id, H5P_DATASET_ACCESS_DEFAULT, H5R_DATASET_REGION, _mem2))<0)
ret= -1;
if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1))<0)
ret= -1;
@ -811,9 +811,9 @@ hsize_t diff_datum(void *_mem1,
return 0;
}
if((obj1_id = H5Rdereference(container1_id, H5R_OBJECT, _mem1)) < 0)
if((obj1_id = H5Rdereference2(container1_id, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, _mem1)) < 0)
ret = -1;
if((obj2_id = H5Rdereference(container2_id, H5R_OBJECT, _mem2)) < 0)
if((obj2_id = H5Rdereference2(container2_id, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, _mem2)) < 0)
ret = -1;
if(ret == -1) {
options->err_stat = 1;

@ -988,7 +988,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
char ref_name[1024];
/* region data */
region_id = H5Rdereference(container, H5R_DATASET_REGION, memref);
region_id = H5Rdereference2(container, H5P_DATASET_ACCESS_DEFAULT, H5R_DATASET_REGION, memref);
if (region_id >= 0) {
region_space = H5Rget_region(container, H5R_DATASET_REGION, memref);
if (region_space >= 0) {
@ -4007,7 +4007,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem)
hid_t region_id, region_space;
H5S_sel_type region_type;
region_id = H5Rdereference(container, H5R_DATASET_REGION, mem);
region_id = H5Rdereference2(container, H5P_DATASET_ACCESS_DEFAULT, H5R_DATASET_REGION, mem);
if (region_id >= 0) {
region_space = H5Rget_region(container, H5R_DATASET_REGION, mem);
if (region_space >= 0) {

@ -1001,7 +1001,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
H5O_info_t oi;
const char *path;
obj = H5Rdereference(container, H5R_OBJECT, vp);
obj = H5Rdereference2(container, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, vp);
H5Oget_info(obj, &oi);
/* Print object type and close object */
@ -1191,7 +1191,7 @@ h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info,
char ref_name[1024];
H5S_sel_type region_type;
obj = H5Rdereference(container, H5R_DATASET_REGION, vp);
obj = H5Rdereference2(container, H5P_DATASET_ACCESS_DEFAULT, H5R_DATASET_REGION, vp);
if (obj >= 0) {
region = H5Rget_region(container, H5R_DATASET_REGION, vp);
if (region >= 0) {