summaryrefslogtreecommitdiffstats
path: root/src/H5Adeprec.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2012-04-12 19:23:22 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2012-04-12 19:23:22 (GMT)
commitbc68ed1d7554468ad1bf2aa742a3f21be38ec1c5 (patch)
tree39c8ff044338a13e95253e42043e450ba214f614 /src/H5Adeprec.c
parent1f15e6e9d482396e47df6785b161229e7efa1d80 (diff)
downloadhdf5-bc68ed1d7554468ad1bf2aa742a3f21be38ec1c5.zip
hdf5-bc68ed1d7554468ad1bf2aa742a3f21be38ec1c5.tar.gz
hdf5-bc68ed1d7554468ad1bf2aa742a3f21be38ec1c5.tar.bz2
[svn-r22283] H5Lget routines through VOL
H5G and H5A deprecated routines through VOL H5A exists(_by_name), delete_by_idx, rename through attr generic callbacks H5O incr/decr_ref_count set_comment(_by_name) exists(by_name) through a generic Object cb remove the attr generic callback and use the object generic callback instead add the usual workarounds for named datatypes in test code
Diffstat (limited to 'src/H5Adeprec.c')
-rw-r--r--src/H5Adeprec.c80
1 files changed, 11 insertions, 69 deletions
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index 96c03e8..9ae08a4 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -256,8 +256,8 @@ H5Aopen_idx(hid_t loc_id, unsigned idx)
if(H5I_ATTR_PUBLIC == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5VL_attr_generic(loc_id, H5VL_ATTR_OPEN_BY_IDX, &ret_value, ".", H5_INDEX_CRT_ORDER,
- H5_ITER_INC, (hsize_t)idx, H5P_DEFAULT, H5P_LINK_ACCESS_DEFAULT) < 0)
+ if(H5VL_object_generic(loc_id, H5VL_ATTR_OPEN_BY_IDX, &ret_value, ".", H5_INDEX_CRT_ORDER,
+ H5_ITER_INC, (hsize_t)idx, H5P_DEFAULT, H5P_LINK_ACCESS_DEFAULT) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataset access properties")
done:
@@ -284,77 +284,19 @@ done:
Deprecated in favor of H5Oget_info
--------------------------------------------------------------------------*/
int
-H5Aget_num_attrs(hid_t id)
+H5Aget_num_attrs(hid_t loc_id)
{
- H5O_loc_t *loc; /* Object location for attribute */
- void *obj;
- H5VL_id_wrapper_t *id_wrapper; /* user id structure */
- hid_t loc_id;
- H5I_type_t id_type;
- int ret_value;
+ H5O_info_t oinfo;
+ int ret_value;
FUNC_ENTER_API(FAIL)
- H5TRACE1("Is", "i", id);
-
- id_type = H5I_get_type(id);
- /* get the actual ID from an upper ID level */
- /* 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_ATTR_PUBLIC == id_type) {
- if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5I_object(id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, NULL, "invalid user identifier")
- loc_id = id_wrapper->obj_id;
- }
- else {
- loc_id = id;
- }
+ H5TRACE1("Is", "i", loc_id);
- /* check arguments */
- if(H5I_BADID == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad location ID")
- if(H5I_FILE == H5I_get_type(loc_id) || H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(NULL == (obj = H5I_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADATOM, FAIL, "illegal object atom")
- switch(H5I_get_type (loc_id)) {
- case H5I_DATASET:
- if(NULL == (loc = H5D_oloc((H5D_t*)obj)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object")
- break;
-
- case H5I_DATATYPE:
- if(NULL == (loc = H5T_oloc((H5T_t*)obj)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "target datatype is not committed")
- break;
-
- case H5I_GROUP:
- if(NULL == (loc = H5G_oloc((H5G_t*)obj)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object")
- break;
-
- case H5I_UNINIT:
- case H5I_BADID:
- case H5I_FILE:
- case H5I_DATASPACE:
- case H5I_ATTR:
- case H5I_REFERENCE:
- case H5I_VFL:
- case H5I_GENPROP_CLS:
- case H5I_GENPROP_LST:
- case H5I_ERROR_CLASS:
- case H5I_ERROR_MSG:
- case H5I_ERROR_STACK:
- case H5I_NTYPES:
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "inappropriate attribute target")
- } /*lint !e788 All appropriate cases are covered */
-
- /* Look up the # of attributes for the object */
- if((ret_value = H5O_attr_count(loc, H5AC_ind_dxpl_id)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object")
+ /* Get the group info through the VOL using the location token */
+ if(H5VL_object_get(loc_id, H5VL_OBJECT_GET_INFO, &oinfo, NULL) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
+
+ ret_value = oinfo.num_attrs;
done:
FUNC_LEAVE_API(ret_value)