summaryrefslogtreecommitdiffstats
path: root/src/H5G.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/H5G.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/H5G.c')
-rw-r--r--src/H5G.c47
1 files changed, 40 insertions, 7 deletions
diff --git a/src/H5G.c b/src/H5G.c
index df50dd6..0e0de6a 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -459,25 +459,36 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Gget_info(hid_t obj_id, H5G_info_t *grp_info)
+H5Gget_info(hid_t loc_id, H5G_info_t *grp_info)
{
H5I_type_t id_type; /* Type of 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)
- H5TRACE2("e", "i*x", obj_id, grp_info);
+ H5TRACE2("e", "i*x", loc_id, grp_info);
/* Check args */
- id_type = H5I_get_type(obj_id);
+ id_type = H5I_get_type(loc_id);
if(!(H5I_GROUP_PUBLIC == id_type || H5I_FILE_PUBLIC == id_type))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
if(!grp_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
- if((ret_value = H5VL_group_get(obj_id, H5G_GET_INFO, 1, grp_info)) < 0)
+ /* 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_group_get(loc_id, H5G_GET_INFO, 2, grp_info, 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 H5Gget_info() */
@@ -499,6 +510,8 @@ herr_t
H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info,
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)
@@ -515,10 +528,19 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info,
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_group_get(loc_id, H5G_GET_INFO, 3, grp_info, name, lapl_id)) < 0)
+ /* 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_group_get(loc_id, H5G_GET_INFO, 2, grp_info, 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 H5Gget_info_by_name() */
@@ -541,6 +563,8 @@ herr_t
H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5G_info_t *grp_info, 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)
@@ -562,11 +586,20 @@ H5Gget_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_group_get(loc_id, H5G_GET_INFO, 6, grp_info, group_name,
- idx_type, order, n, lapl_id)) < 0)
+ /* 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_group_get(loc_id, H5G_GET_INFO, 2, grp_info, 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 H5Gget_info_by_idx() */