summaryrefslogtreecommitdiffstats
path: root/src/H5Adeprec.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-09-05 21:36:55 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-09-05 21:36:55 (GMT)
commit05d51c036140f94a07efb75aab9675b3b4bd5ef0 (patch)
tree5fe046db1c355df5c771077164ba6d6c1f272866 /src/H5Adeprec.c
parentf2e6cec0728a75f5982e3b6d91f0ce823d1206a6 (diff)
downloadhdf5-05d51c036140f94a07efb75aab9675b3b4bd5ef0.zip
hdf5-05d51c036140f94a07efb75aab9675b3b4bd5ef0.tar.gz
hdf5-05d51c036140f94a07efb75aab9675b3b4bd5ef0.tar.bz2
[svn-r25575] cleanup H5I usage in VOL by removing the use of the aux pointer and
make a higher level wrapper object around all VOL objects that includes the VOL information.
Diffstat (limited to 'src/H5Adeprec.c')
-rw-r--r--src/H5Adeprec.c100
1 files changed, 43 insertions, 57 deletions
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index 75d1665..28e4c3f 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -164,8 +164,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t plist_id)
{
void *attr = NULL; /* attr token from VOL plugin */
- void *obj = NULL; /* object token of loc_id */
- H5VL_t *vol_plugin; /* VOL plugin information */
+ H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
hid_t ret_value; /* Return value */
@@ -196,26 +195,24 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
- /* get the file object */
- if(NULL == (obj = (void *)H5VL_get_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")
+ /* get the location object */
+ if(NULL == (obj = H5VL_get_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Create the attribute through the VOL */
- if(NULL == (attr = H5VL_attr_create(obj, loc_params, vol_plugin->cls, name, plist_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)))
+ if(NULL == (attr = H5VL_attr_create(obj->vol_obj, loc_params, obj->vol_info->vol_cls, name,
+ plist_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create attribute")
- /* Get an atom for the attribute with the VOL information as the auxilary struct*/
- if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_plugin, TRUE)) < 0)
+ /* Get an atom for the attribute */
+ if((ret_value = H5VL_register_id(H5I_ATTR, attr, obj->vol_info, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attribute handle")
done:
if (ret_value < 0 && attr)
- if(H5VL_attr_close (attr, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
+ if(H5VL_attr_close(attr, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr")
+
FUNC_LEAVE_API(ret_value)
} /* H5Acreate1() */
@@ -246,8 +243,7 @@ hid_t
H5Aopen_name(hid_t loc_id, const char *name)
{
void *attr = NULL; /* attr token from VOL plugin */
- void *obj = NULL; /* object token of loc_id */
- H5VL_t *vol_plugin; /* VOL plugin information */
+ H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value;
@@ -263,27 +259,24 @@ H5Aopen_name(hid_t loc_id, const char *name)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
- /* get the file object */
- if(NULL == (obj = (void *)H5VL_get_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* get the location object */
+ if(NULL == (obj = H5VL_get_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location 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")
-
- /* Create the attribute through the VOL */
- if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin->cls, name, H5P_DEFAULT,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open attribute")
+ /* Open the attribute through the VOL */
+ if(NULL == (attr = H5VL_attr_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
+ name, H5P_DEFAULT, H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute")
- /* Get an atom for the attribute with the VOL information as the auxilary struct*/
- if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_plugin, TRUE)) < 0)
+ /* Get an atom for the attribute */
+ if((ret_value = H5VL_register_id(H5I_ATTR, attr, obj->vol_info, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attribute handle")
done:
if (ret_value < 0 && attr)
- if(H5VL_attr_close (attr, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
+ if(H5VL_attr_close(attr, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr")
+
FUNC_LEAVE_API(ret_value)
} /* H5Aopen_name() */
@@ -314,8 +307,7 @@ hid_t
H5Aopen_idx(hid_t loc_id, unsigned idx)
{
void *attr = NULL; /* attr token from VOL plugin */
- void *obj = NULL; /* object token of loc_id */
- H5VL_t *vol_plugin; /* VOL plugin information */
+ H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value;
@@ -334,26 +326,24 @@ H5Aopen_idx(hid_t loc_id, unsigned idx)
loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
loc_params.obj_type = H5I_get_type(loc_id);
- /* get the file object */
- if(NULL == (obj = (void *)H5VL_get_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")
+ /* get the location object */
+ if(NULL == (obj = H5VL_get_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* Create the attribute through the VOL */
- if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin->cls, NULL, H5P_DEFAULT,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open attribute")
+ /* Open the attribute through the VOL */
+ if(NULL == (attr = H5VL_attr_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
+ NULL, H5P_DEFAULT, H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute")
- /* Get an atom for the attribute with the VOL information as the auxilary struct*/
- if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_plugin, TRUE)) < 0)
+ /* Get an atom for the attribute */
+ if((ret_value = H5VL_register_id(H5I_ATTR, attr, obj->vol_info, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attribute handle")
done:
if (ret_value < 0 && attr)
- if(H5VL_attr_close (attr, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
+ if(H5VL_attr_close(attr, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr")
+
FUNC_LEAVE_API(ret_value)
} /* H5Aopen_idx() */
@@ -379,11 +369,10 @@ done:
int
H5Aget_num_attrs(hid_t loc_id)
{
- H5VL_t *vol_plugin;
- void *obj;
+ H5VL_object_t *obj;
H5VL_loc_params_t loc_params;
H5O_info_t oinfo;
- int ret_value;
+ int ret_value;
FUNC_ENTER_API(FAIL)
H5TRACE1("Is", "i", loc_id);
@@ -391,15 +380,12 @@ H5Aget_num_attrs(hid_t loc_id)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
- /* get the file object */
- if(NULL == (obj = (void *)H5VL_get_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")
+ /* get the location object */
+ if(NULL == (obj = H5VL_get_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the group info through the VOL using the location token */
- if(H5VL_object_optional(obj, vol_plugin->cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
+ if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
H5VL_OBJECT_GET_INFO, loc_params, &oinfo) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")