summaryrefslogtreecommitdiffstats
path: root/src/H5A.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2013-06-21 13:54:45 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2013-06-21 13:54:45 (GMT)
commitb94be74cbf9206b20d357154eb95da17185c474c (patch)
treeda27789d93b1b97b808679bbbc35273826c2c657 /src/H5A.c
parent018ed55299f5e5c2c580c5a40704a61dc30c72c9 (diff)
downloadhdf5-b94be74cbf9206b20d357154eb95da17185c474c.zip
hdf5-b94be74cbf9206b20d357154eb95da17185c474c.tar.gz
hdf5-b94be74cbf9206b20d357154eb95da17185c474c.tar.bz2
[svn-r23803] Add VOL callback for H5Aiterate
Add VOL callback for H5T get routines Update Native implementation
Diffstat (limited to 'src/H5A.c')
-rw-r--r--src/H5A.c101
1 files changed, 32 insertions, 69 deletions
diff --git a/src/H5A.c b/src/H5A.c
index d7eb7d9..7674db8 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -1389,9 +1389,9 @@ herr_t
H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
hsize_t *idx, H5A_operator2_t op, void *op_data)
{
- H5A_attr_iter_op_t attr_op; /* Attribute operator */
- hsize_t start_idx; /* Index of attribute to start iterating at */
- hsize_t last_attr; /* Index of last attribute examined */
+ void *obj = NULL; /* object token of loc_id */
+ H5VL_t *vol_plugin; /* VOL plugin information */
+ H5VL_loc_params_t loc_params;
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1405,18 +1405,20 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
- /* Build attribute operator info */
- attr_op.op_type = H5A_ATTR_OP_APP2;
- attr_op.u.app_op2 = op;
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
- /* Call attribute iteration routine */
- last_attr = start_idx = (idx ? *idx : 0);
- if((ret_value = H5O_attr_iterate(loc_id, H5AC_ind_dxpl_id, idx_type, order, start_idx, &last_attr, &attr_op, op_data)) < 0)
- HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
+ /* get the file object */
+ if(NULL == (obj = (void *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* get the plugin pointer */
+ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
- /* Set the last attribute information */
- if(idx)
- *idx = last_attr;
+ /* iterate over the links through the VOL */
+ if((ret_value = H5VL_attr_iterate(obj, loc_params, vol_plugin, idx_type, order, idx,
+ op, op_data, H5AC_dxpl_id, H5_EVENT_QUEUE_NULL)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1471,15 +1473,9 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data,
hid_t lapl_id)
{
- H5G_loc_t loc; /* Object location */
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
- hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
- hid_t obj_loc_id = (-1); /* ID for object located */
- H5A_attr_iter_op_t attr_op; /* Attribute operator */
- hsize_t start_idx; /* Index of attribute to start iterating at */
- hsize_t last_attr; /* Index of last attribute examined */
+ void *obj = NULL; /* object token of loc_id */
+ H5VL_t *vol_plugin; /* VOL plugin information */
+ H5VL_loc_params_t loc_params;
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1489,8 +1485,6 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
@@ -1503,55 +1497,24 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_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")
- /* Set up opened group location to fill in */
- obj_loc.oloc = &obj_oloc;
- obj_loc.path = &obj_path;
- H5G_loc_reset(&obj_loc);
-
- /* Find the object's location */
- if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
- loc_found = TRUE;
-
- /* Open the object */
- if((obj_loc_id = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
-
- /* get the native object from the ID created by the object header and create
- a "VOL object" ID */
- {
- void *temp_obj = NULL;
- H5I_type_t obj_type;
- obj_type = H5I_get_type(obj_loc_id);
- if(NULL == (temp_obj = H5I_remove(obj_loc_id)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object")
- /* Get an atom for the datatype */
- if((obj_loc_id = H5VL_native_register(obj_type, temp_obj, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
- }
-
- /* Build attribute operator info */
- attr_op.op_type = H5A_ATTR_OP_APP2;
- attr_op.u.app_op2 = op;
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.loc_data.loc_by_name.name = obj_name;
+ loc_params.loc_data.loc_by_name.plist_id = lapl_id;
- /* Call attribute iteration routine */
- last_attr = start_idx = (idx ? *idx : 0);
- if((ret_value = H5O_attr_iterate(obj_loc_id, H5AC_ind_dxpl_id, idx_type, order, start_idx, &last_attr, &attr_op, op_data)) < 0)
- HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
+ /* get the file object */
+ if(NULL == (obj = (void *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* get the plugin pointer */
+ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
- /* Set the last attribute information */
- if(idx)
- *idx = last_attr;
+ /* iterate over the links through the VOL */
+ if((ret_value = H5VL_attr_iterate(obj, loc_params, vol_plugin, idx_type, order, idx,
+ op, op_data, H5AC_dxpl_id, H5_EVENT_QUEUE_NULL)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "attribute iteration failed")
done:
- /* Release resources */
- if(obj_loc_id > 0) {
- if(H5I_dec_app_ref(obj_loc_id) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
- } /* end if */
- else if(loc_found && H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
-
FUNC_LEAVE_API(ret_value)
} /* H5Aiterate_by_name() */