summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2012-03-26 20:47:38 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2012-03-26 20:47:38 (GMT)
commit04b257f380589c9136005695921bafdb5aa940fc (patch)
tree678709568728b1b6559b366c75ed6ac9a99bc1be /src/H5O.c
parent53f19d479479ca9098bbb02d1fee2e471a23ce81 (diff)
downloadhdf5-04b257f380589c9136005695921bafdb5aa940fc.zip
hdf5-04b257f380589c9136005695921bafdb5aa940fc.tar.gz
hdf5-04b257f380589c9136005695921bafdb5aa940fc.tar.bz2
[svn-r22151] - object lookup returns the haddr_t
- make the VL implementation for all variations of H5Oopen, H5Oget_info, H5Gget_info common, by looking up the object location first.
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c70
1 files changed, 58 insertions, 12 deletions
diff --git a/src/H5O.c b/src/H5O.c
index 23632b1..c24b789 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -304,8 +304,8 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
/* Get the token for the Object location through the VOL */
- if(H5VL_object_lookup (loc_id, H5O_LOOKUP_BY_IDX, 6, &location, group_name,
- idx_type, order, n, lapl_id) < 0)
+ if(H5VL_object_lookup(loc_id, H5O_LOOKUP_BY_IDX, 6, &location, group_name,
+ idx_type, order, n, lapl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object")
/* Open the object through the VOL */
@@ -581,6 +581,8 @@ done:
herr_t
H5Oget_info(hid_t loc_id, H5O_info_t *oinfo)
{
+ void *location = NULL; /* a pointer to VOL specific token that indicates
+ the location of the object */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -590,10 +592,33 @@ H5Oget_info(hid_t loc_id, H5O_info_t *oinfo)
if(!oinfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
- if((ret_value = H5VL_object_get(loc_id, H5O_GET_INFO, 1, oinfo)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object info")
+ /* Check id */
+ if(H5I_GROUP_PUBLIC != H5I_get_type(loc_id) && H5I_DATASET_PUBLIC != H5I_get_type(loc_id) &&
+ H5I_DATATYPE_PUBLIC != H5I_get_type(loc_id) && H5I_FILE_PUBLIC != H5I_get_type(loc_id)) {
+ H5G_loc_t loc; /* Location of group */
+
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+
+ if(H5G_loc_info(&loc, ".", TRUE, oinfo/*out*/, H5P_LINK_ACCESS_DEFAULT,
+ H5AC_ind_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
+ }
+
+ else {
+ /* Get the token for the Object location through the VOL */
+ if(H5VL_object_lookup (loc_id, H5O_LOOKUP, 1, &location) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object")
+ /* Get the group info through the VOL using the location token */
+ if((ret_value = H5VL_object_get(loc_id, H5O_GET_INFO, 2, oinfo, location)) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
+ }
done:
+ if (NULL != location) {
+ free (location);
+ location = NULL;
+ }
FUNC_LEAVE_API(ret_value)
} /* end H5Oget_info() */
@@ -614,6 +639,8 @@ done:
herr_t
H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id)
{
+ void *location = NULL; /* a pointer to VOL specific token that indicates
+ the location of the object */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -630,10 +657,19 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
- if((ret_value = H5VL_object_get(loc_id, H5O_GET_INFO, 3, oinfo, name, lapl_id)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object info")
+ /* Get the token for the Object location through the VOL */
+ if(H5VL_object_lookup (loc_id, H5O_LOOKUP_BY_NAME, 3, &location, name, lapl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object")
+
+ /* Get the group info through the VOL using the location token */
+ if((ret_value = H5VL_object_get(loc_id, H5O_GET_INFO, 2, oinfo, location)) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
done:
+ if (NULL != location) {
+ free (location);
+ location = NULL;
+ }
FUNC_LEAVE_API(ret_value)
} /* end H5Oget_info_by_name() */
@@ -656,6 +692,8 @@ herr_t
H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id)
{
+ void *location = NULL; /* a pointer to VOL specific token that indicates
+ the location of the object */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -677,11 +715,20 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
- if((ret_value = H5VL_object_get(loc_id, H5O_GET_INFO, 6, oinfo, group_name, idx_type,
- order, n, lapl_id)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object info")
+ /* Get the token for the Object location through the VOL */
+ if(H5VL_object_lookup(loc_id, H5O_LOOKUP_BY_IDX, 6, &location, group_name,
+ idx_type, order, n, lapl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object")
+
+ /* Get the group info through the VOL using the location token */
+ if((ret_value = H5VL_object_get(loc_id, H5O_GET_INFO, 2, oinfo, location)) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
done:
+ if (NULL != location) {
+ free (location);
+ location = NULL;
+ }
FUNC_LEAVE_API(ret_value)
} /* end H5Oget_info_by_idx() */
@@ -2382,9 +2429,8 @@ H5O_get_loc(hid_t id)
/* MSC - this is a workaround to allow the test suite to pass and
at some point needs to be removed once all high level operations
that needs to go through the VOL actually go through the VOL*/
- if (H5I_FILE_PUBLIC == id_type || H5I_GROUP_PUBLIC == id_type ||
- H5I_DATASET_PUBLIC == id_type || H5I_DATATYPE_PUBLIC == id_type ||
- H5I_ATTRIBUTE_PUBLIC == id_type) {
+ if (H5I_GROUP_PUBLIC == id_type || H5I_DATASET_PUBLIC == id_type ||
+ H5I_DATATYPE_PUBLIC == id_type) {
if(NULL == (uid_info = (H5I_t *)H5I_object(id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, NULL, "invalid user identifier")
object_id = uid_info->obj_id;