summaryrefslogtreecommitdiffstats
path: root/src/H5R.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-03-21 15:10:17 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-03-21 15:10:17 (GMT)
commiteb89d7b53ab95623ab454186a602e1cafc7391f0 (patch)
treeceafe458b3011e38853e765352d3c7e59bbecce1 /src/H5R.c
parent3e468e6ff65d540a439e99ea568a6bff7add7cea (diff)
downloadhdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.zip
hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.tar.gz
hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.tar.bz2
[svn-r22105] Description:
Bring r20557:22085 from trunk to this branch, also fixing some other issues/failures in the branch simultaneously. The h5repack tests are still failing, but Neil will be checking into those, so the branch can be fully functional again. Tested on: Mac OSX/64 10.7.3 (amazon) w/debug
Diffstat (limited to 'src/H5R.c')
-rw-r--r--src/H5R.c70
1 files changed, 42 insertions, 28 deletions
diff --git a/src/H5R.c b/src/H5R.c
index 2d2766d..65ac7da 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -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);
@@ -63,7 +61,7 @@ H5R_init(void)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5R_init, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
/* FUNC_ENTER() does all the work */
done:
@@ -88,14 +86,14 @@ H5R_init_interface(void)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5R_init_interface);
+ FUNC_ENTER_NOAPI_NOINIT
/* Initialize the atom group for the file IDs */
if(H5I_register_type(H5I_REFERENCE, (size_t)H5I_REFID_HASHSIZE, H5R_RESERVED_ATOMS, (H5I_free_t)NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to initialize interface");
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -121,7 +119,7 @@ H5R_term_interface(void)
{
int n=0;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5R_term_interface);
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
if (H5_interface_initialize_g) {
if ((n=H5I_nmembers(H5I_REFERENCE))) {
@@ -133,7 +131,7 @@ H5R_term_interface(void)
}
}
- FUNC_LEAVE_NOAPI(n);
+ FUNC_LEAVE_NOAPI(n)
}
@@ -173,7 +171,7 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5
hbool_t obj_found = FALSE; /* Object location found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5R_create)
+ FUNC_ENTER_NOAPI_NOINIT
HDassert(_ref);
HDassert(loc);
@@ -312,7 +310,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
H5S_t *space = NULL; /* Pointer to dataspace containing region */
herr_t ret_value; /* Return value */
- FUNC_ENTER_API(H5Rcreate, FAIL)
+ FUNC_ENTER_API(FAIL)
H5TRACE5("e", "*xi*sRti", ref, loc_id, name, ref_type, space_id);
/* Check args */
@@ -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 */
@@ -372,7 +374,7 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_re
H5O_type_t obj_type; /* Type of object */
hid_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5R_dereference)
+ FUNC_ENTER_NOAPI_NOINIT
HDassert(_ref);
HDassert(ref_type > H5R_BADTYPE || ref_type < H5R_MAXTYPE);
@@ -462,11 +464,16 @@ 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 */
+ /* Get correct property list */
+ if(H5P_DEFAULT == oapl_id)
+ oapl_id = H5P_DATASET_ACCESS_DEFAULT;
+ else if(TRUE != H5P_isa_class(oapl_id, H5P_DATASET_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list")
+
/* 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,13 +495,14 @@ 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.
+ hid_t oapl_id; IN: Property list of the object being referenced.
H5R_type_t ref_type; IN: Type of reference to create
void *ref; IN: Reference to open.
@@ -507,20 +515,26 @@ 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(FAIL)
+ H5TRACE4("i", "iiRt*x", obj_id, oapl_id, ref_type, _ref);
/* 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(oapl_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
if(_ref == NULL)
@@ -530,12 +544,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() */
/*--------------------------------------------------------------------------
@@ -568,7 +582,7 @@ H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref)
uint8_t *buf = NULL; /* Buffer to store serialized selection in */
H5S_t *ret_value;
- FUNC_ENTER_NOAPI_NOINIT(H5R_get_region)
+ FUNC_ENTER_NOAPI_NOINIT
HDassert(_ref);
HDassert(file);
@@ -637,7 +651,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref)
H5S_t *space = NULL; /* Dataspace object */
hid_t ret_value;
- FUNC_ENTER_API(H5Rget_region, FAIL)
+ FUNC_ENTER_API(FAIL)
H5TRACE3("i", "iRt*x", id, ref_type, ref);
/* Check args */
@@ -691,7 +705,7 @@ H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type,
unsigned rc; /* Reference count of object */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5R_get_obj_type)
+ FUNC_ENTER_NOAPI_NOINIT
HDassert(file);
HDassert(_ref);
@@ -777,7 +791,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref,
H5G_loc_t loc; /* Object location */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Rget_obj_type2, FAIL)
+ FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iRt*x*Ot", id, ref_type, ref, obj_type);
/* Check args */
@@ -833,7 +847,7 @@ H5R_get_name(H5F_t *f, hid_t lapl_id, hid_t dxpl_id, hid_t id, H5R_type_t ref_ty
H5O_loc_t oloc; /* Object location describing object for reference */
ssize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5R_get_name)
+ FUNC_ENTER_NOAPI_NOINIT
/* Check args */
HDassert(f);
@@ -931,7 +945,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name,
H5F_t *file; /* File object */
ssize_t ret_value; /* Return value */
- FUNC_ENTER_API(H5Rget_name, FAIL)
+ FUNC_ENTER_API(FAIL)
H5TRACE5("Zs", "iRt*x*sz", id, ref_type, _ref, name, size);
/* Check args */