summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5A.c137
-rw-r--r--src/H5Adeprec.c80
-rw-r--r--src/H5Gdeprec.c92
-rw-r--r--src/H5L.c231
-rw-r--r--src/H5Lprivate.h9
-rw-r--r--src/H5O.c93
-rw-r--r--src/H5VL.c178
-rw-r--r--src/H5VLnative.c374
-rw-r--r--src/H5VLprivate.h5
-rw-r--r--src/H5VLpublic.h27
-rw-r--r--test/th5o.c12
11 files changed, 718 insertions, 520 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 8d22b9c..2989de3 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -663,7 +663,7 @@ H5Aopen_by_idx(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")
- if(H5VL_attr_generic(loc_id, H5VL_ATTR_OPEN_BY_IDX, &ret_value,
+ if(H5VL_object_generic(loc_id, H5VL_ATTR_OPEN_BY_IDX, &ret_value,
obj_name, idx_type, order, n, aapl_id, lapl_id) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to open attribute")
@@ -1527,7 +1527,7 @@ H5Aget_name_by_idx(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")
- if(H5VL_attr_generic(loc_id, H5VL_ATTR_OPEN_BY_IDX, &attr_id,
+ if(H5VL_object_generic(loc_id, H5VL_ATTR_OPEN_BY_IDX, &attr_id,
obj_name, idx_type, order, n, H5P_DEFAULT, lapl_id) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to open attribute")
@@ -1689,7 +1689,7 @@ done:
if(attr_id > 0 && H5VL_attr_close(attr_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
- if (NULL != location) {
+ if(NULL != location) {
free (location);
location = NULL;
}
@@ -1750,7 +1750,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
#endif
/* open the attribute through the VOL */
- if(H5VL_attr_generic(loc_id, H5VL_ATTR_OPEN_BY_IDX, &attr_id,
+ if(H5VL_object_generic(loc_id, H5VL_ATTR_OPEN_BY_IDX, &attr_id,
obj_name, idx_type, order, n, H5P_DEFAULT, lapl_id) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to open attribute")
@@ -1833,15 +1833,13 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name)
/* check arguments */
if(!old_name || !new_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil")
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if(H5I_ATTR_PUBLIC == 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")
/* Avoid thrashing things if the names are the same */
if(HDstrcmp(old_name, new_name))
- /* Call attribute rename routine */
- if(H5O_attr_rename(loc.oloc, H5AC_dxpl_id, old_name, new_name) < 0)
+ /* rename the attribute info through the VOL */
+ if(H5VL_object_generic(loc_id, H5VL_ATTR_RENAME, NULL, old_name, new_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
done:
@@ -1866,11 +1864,7 @@ herr_t
H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
const char *new_attr_name, 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 */
+ void *location = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1878,10 +1872,8 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
lapl_id);
/* check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if(H5I_ATTR_PUBLIC == 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(!old_attr_name || !*old_attr_name)
@@ -1896,26 +1888,20 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
/* Avoid thrashing things if the names are the same */
if(HDstrcmp(old_attr_name, new_attr_name)) {
- /* 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;
-
- /* Call attribute rename routine */
- if(H5O_attr_rename(obj_loc.oloc, H5AC_dxpl_id, old_attr_name, new_attr_name) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
+ /* Get the token for the Object location through the VOL */
+ if(H5VL_object_lookup(loc_id, H5VL_OBJECT_LOOKUP_BY_NAME, &location, obj_name, lapl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object")
+
+ /* get the attribute info through the VOL */
+ if(H5VL_object_generic(loc_id, H5VL_ATTR_RENAME, location, old_attr_name, new_attr_name) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info")
} /* end if */
done:
- /* Release resources */
- if(loc_found && H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
-
+ if(NULL != location) {
+ free (location);
+ location = NULL;
+ }
FUNC_LEAVE_API(ret_value)
} /* H5Arename_by_name() */
@@ -2226,21 +2212,15 @@ herr_t
H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, 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 */
+ void *location = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*sIiIohi", loc_id, obj_name, idx_type, order, n, lapl_id);
/* check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if(H5I_ATTR_PUBLIC == 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)
@@ -2253,25 +2233,19 @@ H5Adelete_by_idx(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_dxpl_id) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
- loc_found = TRUE;
+ /* Get the token for the Object location through the VOL */
+ if(H5VL_object_lookup(loc_id, H5VL_OBJECT_LOOKUP_BY_NAME, &location, obj_name, lapl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object")
- /* Delete the attribute from the location */
- if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
+ /* get the attribute info through the VOL */
+ if(H5VL_object_generic(loc_id, H5VL_ATTR_DELETE_BY_IDX, location, idx_type, order, n) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
- /* Release resources */
- if(loc_found && H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
-
+ if(NULL != location) {
+ free (location);
+ location = NULL;
+ }
FUNC_LEAVE_API(ret_value)
} /* H5Adelete_by_idx() */
@@ -2590,23 +2564,20 @@ done:
htri_t
H5Aexists(hid_t obj_id, const char *attr_name)
{
- H5G_loc_t loc; /* Object location */
htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("t", "i*s", obj_id, attr_name);
/* check arguments */
- if(H5I_ATTR == H5I_get_type(obj_id))
+ if(H5I_ATTR_PUBLIC == H5I_get_type(obj_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
- /* Check if the attribute exists */
- if((ret_value = H5O_attr_exists(loc.oloc, attr_name, H5AC_ind_dxpl_id)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
+ /* get the attribute info through the VOL */
+ if(H5VL_object_generic(obj_id, H5VL_ATTR_EXISTS, attr_name, NULL, &ret_value) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
FUNC_LEAVE_API(ret_value)
@@ -2630,21 +2601,15 @@ htri_t
H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
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 */
+ void *location = NULL;
htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("t", "i*s*si", loc_id, obj_name, attr_name, lapl_id);
/* check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if(H5I_ATTR_PUBLIC == 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(!attr_name || !*attr_name)
@@ -2655,25 +2620,19 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
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;
+ /* Get the token for the Object location through the VOL */
+ if(H5VL_object_lookup(loc_id, H5VL_OBJECT_LOOKUP_BY_NAME, &location, obj_name, lapl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object")
- /* Check if the attribute exists */
- if((ret_value = H5O_attr_exists(obj_loc.oloc, attr_name, H5AC_ind_dxpl_id)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
+ /* get the attribute info through the VOL */
+ if(H5VL_object_generic(loc_id, H5VL_ATTR_EXISTS, attr_name, location, &ret_value) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
- /* Release resources */
- if(loc_found && H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
-
+ if(NULL != location) {
+ free (location);
+ location = NULL;
+ }
FUNC_LEAVE_API(ret_value)
} /* H5Aexists_by_name() */
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)
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index e5c419b..41d8eb9 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -312,6 +312,8 @@ done:
herr_t
H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name)
{
+ hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -323,20 +325,31 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
if(!new_name || !*new_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
if(type == H5L_TYPE_HARD) {
- if((ret_value = H5G_link_hard(cur_loc_id, cur_name, H5L_SAME_LOC, new_name)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "couldn't create link")
+ /* set creation properties */
+ if(H5P_set(plist, H5L_CRT_TARGET_ID_NAME, &cur_loc_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id")
+ if(H5P_set(plist, H5L_CRT_TARGET_NAME_NAME, &cur_name) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target name")
+
+ /* Create the link through the VOL */
+ if((ret_value = H5VL_link_create(H5VL_CREATE_HARD_LINK, H5L_SAME_LOC, new_name,
+ lcpl_id, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
else if(type == H5L_TYPE_SOFT) {
- H5G_loc_t cur_loc; /* Group location for new link */
-
- /* Finish checking arguments */
- if(H5G_loc(cur_loc_id, &cur_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
-
- /* Create the link */
- if(H5L_create_soft(cur_name, &cur_loc, new_name, H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
+ /* set creation properties */
+ if(H5P_set(plist, H5L_CRT_TARGET_NAME_NAME, &cur_name) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
+
+ /* Create the link through the VOL */
+ if((ret_value = H5VL_link_create(H5VL_CREATE_SOFT_LINK, cur_loc_id, new_name,
+ lcpl_id, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else if */
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid link type")
@@ -358,6 +371,8 @@ herr_t
H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
hid_t new_loc_id, const char *new_name)
{
+ hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -369,25 +384,36 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
if(!new_name || !*new_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
if(type == H5L_TYPE_HARD) {
- if((ret_value = H5G_link_hard(cur_loc_id, cur_name, new_loc_id, new_name)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "couldn't create link")
+ /* set creation properties */
+ if(H5P_set(plist, H5L_CRT_TARGET_ID_NAME, &cur_loc_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id")
+ if(H5P_set(plist, H5L_CRT_TARGET_NAME_NAME, &cur_name) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target name")
+
+ /* Create the link through the VOL */
+ if((ret_value = H5VL_link_create(H5VL_CREATE_HARD_LINK, new_loc_id, new_name,
+ lcpl_id, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
else if(type == H5L_TYPE_SOFT) {
- H5G_loc_t new_loc; /* Group location for new link */
-
/* Soft links only need one location, the new_loc_id, but it's possible that
* new_loc_id is H5L_SAME_LOC */
if(new_loc_id == H5L_SAME_LOC)
new_loc_id = cur_loc_id;
- /* Finish checking arguments */
- if(H5G_loc(new_loc_id, &new_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ /* set creation properties */
+ if(H5P_set(plist, H5L_CRT_TARGET_NAME_NAME, &cur_name) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
- /* Create the link */
- if(H5L_create_soft(cur_name, &new_loc, new_name, H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
+ /* Create the link through the VOL */
+ if((ret_value = H5VL_link_create(H5VL_CREATE_SOFT_LINK, new_loc_id, new_name,
+ lcpl_id, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else if */
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type")
@@ -466,9 +492,10 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name)
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*s*s", src_loc_id, src_name, dst_name);
- /* Call common routine to move the link */
- if(H5G_move(src_loc_id, src_name, H5L_SAME_LOC, dst_name) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "couldn't move link")
+ /* Create the link through the VOL */
+ if((ret_value = H5VL_link_move(src_loc_id, src_name, H5L_SAME_LOC, dst_name,
+ FALSE, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
done:
FUNC_LEAVE_API(ret_value)
@@ -491,9 +518,10 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*si*s", src_loc_id, src_name, dst_loc_id, dst_name);
- /* Call common routine to move the link */
- if(H5G_move(src_loc_id, src_name, dst_loc_id, dst_name) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "couldn't move link")
+ /* Create the link through the VOL */
+ if((ret_value = H5VL_link_move(src_loc_id, src_name, dst_loc_id, dst_name,
+ FALSE, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
done:
FUNC_LEAVE_API(ret_value)
@@ -567,21 +595,17 @@ done:
herr_t
H5Gunlink(hid_t loc_id, const char *name)
{
- H5G_loc_t loc; /* Group's location */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*s", loc_id, name);
- /* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- /* Call H5L routine... */
- if(H5L_delete(&loc, name, H5P_DEFAULT, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "couldn't delete link")
+ /* Delete the link through the VOL */
+ if((ret_value = H5VL_link_delete(loc_id, name, NULL, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5L.c b/src/H5L.c
index fe30052..bc20d94 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -176,8 +176,6 @@ static herr_t H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
static herr_t H5L_exists_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static htri_t H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id,
- hid_t dxpl_id);
static herr_t H5L_get_info_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
@@ -602,7 +600,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
/* Delete the link through the VOL */
- if((ret_value = H5VL_link_delete(loc_id, name, lapl_id)) < 0)
+ if((ret_value = H5VL_link_delete(loc_id, name, NULL, lapl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
done:
@@ -633,38 +631,6 @@ herr_t
H5Ldelete_by_idx(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id)
{
- H5G_loc_t loc; /* Group's location */
- H5L_trav_rmbi_t udata; /* User data for callback */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "i*sIiIohi", loc_id, group_name, idx_type, order, n, lapl_id);
-
- /* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
- if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
- if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- 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 user data for unlink operation */
- udata.idx_type = idx_type;
- udata.order = order;
- udata.n = n;
- udata.dxpl_id = H5AC_dxpl_id;
-
- /* Traverse the group hierarchy to remove the link */
- if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT, H5L_delete_by_idx_cb, &udata, lapl_id, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist")
-#if 0
H5L_trav_rmbi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -691,9 +657,9 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name,
udata.dxpl_id = H5AC_dxpl_id;
/* Delete the link through the VOL */
- if((ret_value = H5VL_link_delete(loc_id, group_name, H5L_delete_by_idx_cb, &udata, lapl_id)) < 0)
+ if((ret_value = H5VL_link_delete(loc_id, group_name, &udata, lapl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
-#endif
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Ldelete_by_idx() */
@@ -722,15 +688,12 @@ herr_t
H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size,
hid_t lapl_id)
{
- H5G_loc_t loc; /* Group location for location to query */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*sxzi", loc_id, name, buf, size, lapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(H5P_DEFAULT == lapl_id)
@@ -739,9 +702,9 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size,
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
- /* Get the link value */
- if(H5L_get_val(&loc, name, buf, size, lapl_id, H5AC_ind_dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link value for '%s'", name)
+ /* Get the link info through the VOL */
+ if((ret_value = H5VL_link_get(loc_id, H5VL_LINK_GET_VAL, name, buf, size, NULL, lapl_id)) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
done:
FUNC_LEAVE_API(ret_value)
@@ -771,7 +734,6 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size,
hid_t lapl_id)
{
- H5G_loc_t loc; /* Group location for location to query */
H5L_trav_gvbi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -780,8 +742,6 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
lapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
@@ -802,10 +762,9 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
udata.buf = buf;
udata.size = size;
- /* Traverse the group hierarchy to locate the object to get info about */
- if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_val_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist")
-
+ /* Get the link info through the VOL */
+ if((ret_value = H5VL_link_get(loc_id, H5VL_LINK_GET_VAL, group_name, buf, size, &udata, lapl_id)) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link val")
done:
FUNC_LEAVE_API(ret_value)
@@ -828,15 +787,12 @@ done:
htri_t
H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5G_loc_t loc;
htri_t ret_value;
FUNC_ENTER_API(FAIL)
H5TRACE3("t", "i*si", loc_id, name, lapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(H5P_DEFAULT == lapl_id)
@@ -845,9 +801,9 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id)
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
- /* Check for the existence of the link */
- if((ret_value = H5L_exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info")
+ /* check link existence through the VOL */
+ if(H5VL_link_get(loc_id, H5VL_LINK_EXISTS, name, &ret_value, lapl_id) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link info")
done:
FUNC_LEAVE_API(ret_value)
@@ -872,15 +828,11 @@ herr_t
H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/,
hid_t lapl_id)
{
- H5G_loc_t loc;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id);
- /* Check arguments */
- if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(H5P_DEFAULT == lapl_id)
@@ -889,9 +841,9 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/,
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
- /* Get the link information */
- if(H5L_get_info(&loc, name, linfo, lapl_id, H5AC_ind_dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info")
+ /* Get the link info through the VOL */
+ if((ret_value = H5VL_link_get(loc_id, H5VL_LINK_GET_INFO, name, linfo, NULL, lapl_id)) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
done:
FUNC_LEAVE_API(ret_value)
@@ -917,7 +869,6 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
H5L_info_t *linfo /*out*/, hid_t lapl_id)
{
- H5G_loc_t loc; /* Group location for group to query */
H5L_trav_gibi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -926,8 +877,6 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
lapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
@@ -947,9 +896,10 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
udata.dxpl_id = H5AC_ind_dxpl_id;
udata.linfo = linfo;
- /* Traverse the group hierarchy to locate the object to get info about */
- if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_info_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info")
+ /* Get the link info through the VOL */
+ if((ret_value = H5VL_link_get(loc_id, H5VL_LINK_GET_INFO, group_name,
+ linfo, &udata, lapl_id)) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
done:
FUNC_LEAVE_API(ret_value)
@@ -1105,7 +1055,6 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
char *name /*out*/, size_t size, hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
H5L_trav_gnbi_t udata; /* User data for callback */
ssize_t ret_value; /* Return value */
@@ -1114,8 +1063,6 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name,
lapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
@@ -1137,9 +1084,9 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name,
udata.size = size;
udata.name_len = -1;
- /* Traverse the group hierarchy to locate the link to get name of */
- if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_name_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist")
+ /* Get the link info through the VOL */
+ if((ret_value = H5VL_link_get(loc_id, H5VL_LINK_GET_NAME, group_name, &udata, lapl_id)) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link name")
/* Set the return value */
ret_value = udata.name_len;
@@ -1328,18 +1275,6 @@ H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order,
id_type = H5I_get_type(grp_id);
-#if 0
- if (H5I_FILE_PUBLIC == id_type) {
- if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5I_object(uid)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
- grp_id = id_wrapper->obj_id;
- id_type = H5I_get_type(grp_id);
- }
- else {
- grp_id = uid;
- }
-#endif
-
/* Check args */
if(!(H5I_GROUP_PUBLIC == id_type || H5I_FILE_PUBLIC == id_type))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
@@ -2312,6 +2247,35 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5L_get_val_by_idx
+ *
+ * Purpose: Get Value of a link
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L_get_val_by_idx(H5G_loc_t *loc, const char *name, void *udata, hid_t lapl_id, hid_t dxpl_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Traverse the group hierarchy to locate the object to get val about */
+ if(H5G_traverse(loc, name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_val_by_idx_cb,
+ (H5L_trav_gvbi_t *)udata, lapl_id, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link val")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_get_val_by_idx() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5L_delete_cb
*
* Purpose: Callback for deleting a link. This routine
@@ -2443,6 +2407,39 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5L_delete_by_idx
+ *
+ * Purpose: Delete a link from a group.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L_delete_by_idx(H5G_loc_t *loc, const char *name, void *udata, hid_t lapl_id, hid_t dxpl_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(loc);
+ HDassert(name && *name);
+
+ /* Traverse the group hierarchy to remove the link */
+ if(H5G_traverse(loc, name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT,
+ H5L_delete_by_idx_cb, (H5L_trav_rmbi_t *)udata, lapl_id, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_delete_by_idx() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5L_move_dest_cb
*
* Purpose: Second callback for moving and renaming an object. This routine
@@ -2802,7 +2799,7 @@ H5L_exists_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
*
*-------------------------------------------------------------------------
*/
-static htri_t
+htri_t
H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id)
{
hbool_t exists = FALSE; /* Whether the link exists in the group */
@@ -2947,6 +2944,35 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5L_get_info_by_idx
+ *
+ * Purpose: Get_Info a link from a group.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L_get_info_by_idx(H5G_loc_t *loc, const char *name, void *udata, hid_t lapl_id, hid_t dxpl_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Traverse the group hierarchy to locate the object to get info about */
+ if(H5G_traverse(loc, name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_info_by_idx_cb,
+ (H5L_trav_gibi_t *)udata, lapl_id, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_get_info_by_idx() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5L_get_default_lcpl
*
* Purpose: Accessor for the default Link Creation Property List
@@ -3016,6 +3042,35 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5L_get_name_by_idx
+ *
+ * Purpose: Get name of a link from a group.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L_get_name_by_idx(H5G_loc_t *loc, const char *name, void *udata, hid_t lapl_id, hid_t dxpl_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Traverse the group hierarchy to locate the object to get name about */
+ if(H5G_traverse(loc, name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_name_by_idx_cb,
+ (H5L_trav_gnbi_t *)udata, lapl_id, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link name")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_get_name_by_idx() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5L_link_copy_file
*
* Purpose: Copy a link and the object it points to from one file to
diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h
index 70a5d76..e725378 100644
--- a/src/H5Lprivate.h
+++ b/src/H5Lprivate.h
@@ -90,8 +90,17 @@ H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name,
H5L_info_t *linkbuf/*out*/, hid_t lapl_id, hid_t dxpl_id);
H5_DLL herr_t H5L_delete(H5G_loc_t *loc, const char *name, hid_t lapl_id,
hid_t dxpl_id);
+H5_DLL herr_t H5L_delete_by_idx(H5G_loc_t *loc, const char *name,
+ void *udata, hid_t lapl_id, hid_t dxpl_id);
+H5_DLL htri_t H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id);
+H5_DLL herr_t H5L_get_info_by_idx(H5G_loc_t *loc, const char *name, void *udata,
+ hid_t lapl_id, hid_t dxpl_id);
+H5_DLL herr_t H5L_get_name_by_idx(H5G_loc_t *loc, const char *name, void *udata,
+ hid_t lapl_id, hid_t dxpl_id);
H5_DLL herr_t H5L_get_val(H5G_loc_t *loc, const char *name, void *buf/*out*/,
size_t size, hid_t lapl_id, hid_t dxpl_id);
+H5_DLL herr_t H5L_get_val_by_idx(H5G_loc_t *loc, const char *name, void *udata,
+ hid_t lapl_id, hid_t dxpl_id);
H5_DLL herr_t H5L_register_external(void);
/* User-defined link functions */
diff --git a/src/H5O.c b/src/H5O.c
index ec4cba9..61a506f 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -476,17 +476,13 @@ done:
herr_t
H5Oincr_refcount(hid_t object_id)
{
- H5O_loc_t *oloc;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", object_id);
- /* Get the object's oloc so we can adjust its link count */
- if((oloc = H5O_get_loc(object_id)) == NULL)
- HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID")
-
- if(H5O_link(oloc, 1, H5AC_dxpl_id) < 0)
+ /* change the ref count through the VOL */
+ if(H5VL_object_generic(object_id, H5VL_OBJECT_CHANGE_REF_COUNT, 1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
@@ -517,17 +513,13 @@ done:
herr_t
H5Odecr_refcount(hid_t object_id)
{
- H5O_loc_t *oloc;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", object_id);
- /* Get the object's oloc so we can adjust its link count */
- if((oloc = H5O_get_loc(object_id)) == NULL)
- HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID")
-
- if(H5O_link(oloc, -1, H5AC_dxpl_id) < 0)
+ /* change the ref count through the VOL */
+ if(H5VL_object_generic(object_id, H5VL_OBJECT_CHANGE_REF_COUNT, -1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
@@ -551,15 +543,12 @@ done:
htri_t
H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5G_loc_t loc; /* Location info */
hid_t ret_value = FAIL; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("t", "i*si", loc_id, name, lapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
if(H5P_DEFAULT == lapl_id)
@@ -568,8 +557,8 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
- /* Check if the object exists */
- if((ret_value = H5G_loc_exists(&loc, name, lapl_id, H5AC_dxpl_id)) < 0)
+ /* change the ref count through the VOL */
+ if(H5VL_object_generic(loc_id, H5VL_OBJECT_EXISTS, name, lapl_id, &ret_value) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name)
done:
@@ -604,10 +593,6 @@ H5Oget_info(hid_t loc_id, H5O_info_t *oinfo)
if(!oinfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
- /* Get the token for the Object location through the VOL
- if(H5VL_object_lookup (loc_id, H5VL_OBJECT_LOOKUP, &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, H5VL_OBJECT_GET_INFO, oinfo, NULL)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
@@ -637,7 +622,6 @@ done:
herr_t
H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id)
{
-#if 1
void *location = NULL; /* a pointer to VOL specific token that indicates
the location of the object */
herr_t ret_value = SUCCEED; /* Return value */
@@ -670,55 +654,6 @@ done:
location = NULL;
}
FUNC_LEAVE_API(ret_value)
-#endif
-#if 0
- H5G_loc_t loc; /* Location of group */
- 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 'name' found */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "i*s*xi", loc_id, name, oinfo, lapl_id);
-
- /* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- if(!oinfo)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
-
-
- obj_loc.oloc = &obj_oloc;
- obj_loc.path = &obj_path;
- H5G_loc_reset(&obj_loc);
-
- /* Find the object's location */
- if((ret_value = H5G_loc_find(&loc, name, &obj_loc, lapl_id, H5AC_dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
- loc_found = TRUE;
- /* Retrieve the object's information */
- if(H5O_get_info(obj_loc.oloc, H5AC_ind_dxpl_id, TRUE, oinfo) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve object info")
-
- /* Retrieve the object's information
- if(H5G_loc_info(&loc, name, TRUE, oinfo, lapl_id, H5AC_ind_dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
- */
-done:
- /* Release the object location */
- if(loc_found && H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
-
- FUNC_LEAVE_API(ret_value)
-#endif
} /* end H5Oget_info_by_name() */
@@ -801,18 +736,13 @@ done:
herr_t
H5Oset_comment(hid_t obj_id, const char *comment)
{
- H5G_loc_t loc; /* Location of group */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*s", obj_id, comment);
- /* Check args */
- if(H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
-
- /* (Re)set the object's comment */
- if(H5G_loc_set_comment(&loc, ".", comment, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id) < 0)
+ /* set comment on object through the VOL */
+ if(H5VL_object_generic(obj_id, H5VL_OBJECT_SET_COMMENT, ".", comment, H5P_LINK_ACCESS_DEFAULT) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
done:
@@ -841,15 +771,12 @@ herr_t
H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*s*si", loc_id, name, comment, lapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
if(H5P_DEFAULT == lapl_id)
@@ -858,8 +785,8 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
- /* (Re)set the object's comment */
- if(H5G_loc_set_comment(&loc, name, comment, lapl_id, H5AC_ind_dxpl_id) < 0)
+ /* set comment on object through the VOL */
+ if(H5VL_object_generic(loc_id, H5VL_OBJECT_SET_COMMENT, name, comment, lapl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
done:
diff --git a/src/H5VL.c b/src/H5VL.c
index c99200e..23a2d6b 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -808,72 +808,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL_attr_generic
- *
- * Purpose: perform a plugin specific operation
- *
- * Return: Success: non negative
- * Failure: negative
- *
- * Programmer: Mohamad Chaarawi
- * April, 2012
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_attr_generic(hid_t uid, H5VL_attr_generic_t generic_type, ...)
-{
- H5VL_id_wrapper_t *id_wrapper; /* user id structure */
- va_list arguments; /* argument list passed from the API call */
- H5I_type_t id_type;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- id_type = H5I_get_type(uid);
- /* Check id */
- 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)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID")
-
- /* get the ID struct */
- if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5I_object(uid)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
-
- if(NULL == id_wrapper->vol_plugin->attr_cls.generic)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr generic' method")
-
- va_start (arguments, generic_type);
- if((ret_value = (id_wrapper->vol_plugin->attr_cls.generic)(id_wrapper->obj_id, generic_type,
- arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "generic failed")
- va_end (arguments);
-
- if(H5VL_ATTR_OPEN_BY_IDX == generic_type) {
- H5VL_id_wrapper_t *temp_id_wrapper; /* user id structure */
- hid_t *ret_id;
-
- va_start (arguments, generic_type);
- ret_id = va_arg (arguments, hid_t *);
-
- /* Create a new id that points to a struct that holds the attr id and the VOL plugin */
- /* Allocate new id structure */
- if(NULL == (temp_id_wrapper = (H5VL_id_wrapper_t *)H5MM_malloc(sizeof(H5VL_id_wrapper_t))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- temp_id_wrapper->obj_id = *ret_id;
- temp_id_wrapper->vol_plugin = id_wrapper->vol_plugin;
-
- if((*ret_id = H5I_register(H5I_ATTR_PUBLIC, temp_id_wrapper, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attr handle")
- va_end (arguments);
- }
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_attr_generic() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5VL_attr_delete
*
* Purpose: Deletes an attribute through the VOL
@@ -2097,6 +2031,48 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL_link_get
+ *
+ * Purpose: Get specific information about the link through the VOL
+ *
+ * Return: Success: non negative
+ *
+ * Failure: negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_link_get(hid_t uid, H5VL_link_get_t get_type, ...)
+{
+ H5VL_id_wrapper_t *id_wrapper; /* user id structure */
+ va_list arguments; /* argument list passed from the API call */
+ H5I_type_t id_type; /* Type of ID */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* get the ID struct */
+ if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5I_object(uid)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
+
+ if(NULL == id_wrapper->vol_plugin->link_cls.get)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link get' method")
+
+ va_start (arguments, get_type);
+ if((ret_value = (id_wrapper->vol_plugin->link_cls.get)
+ (id_wrapper->obj_id, get_type, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
+ va_end (arguments);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_link_get() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_link_delete
*
* Purpose: Copy or delete a link from src to dst.
@@ -2108,7 +2084,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-H5_DLL herr_t H5VL_link_delete(hid_t loc_id, const char *name, hid_t lapl_id)
+H5_DLL herr_t H5VL_link_delete(hid_t loc_id, const char *name, void *udata, hid_t lapl_id)
{
H5VL_id_wrapper_t *id_wrapper;
herr_t ret_value = SUCCEED; /* Return value */
@@ -2124,7 +2100,7 @@ H5_DLL herr_t H5VL_link_delete(hid_t loc_id, const char *name, hid_t lapl_id)
/* call the corresponding VOL delete callback */
if((ret_value = (id_wrapper->vol_plugin->link_cls.delete)
- (id_wrapper->obj_id, name, lapl_id)) < 0)
+ (id_wrapper->obj_id, name, udata, lapl_id)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link delete failed")
done:
@@ -2298,6 +2274,72 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL_object_generic
+ *
+ * Purpose: perform a plugin specific operation
+ *
+ * Return: Success: non negative
+ * Failure: negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_object_generic(hid_t uid, H5VL_object_generic_t generic_type, ...)
+{
+ H5VL_id_wrapper_t *id_wrapper; /* user id structure */
+ va_list arguments; /* argument list passed from the API call */
+ H5I_type_t id_type;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ id_type = H5I_get_type(uid);
+ /* Check id */
+ 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)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID")
+
+ /* get the ID struct */
+ if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5I_object(uid)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
+
+ if(NULL == id_wrapper->vol_plugin->object_cls.generic)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object generic' method")
+
+ va_start (arguments, generic_type);
+ if((ret_value = (id_wrapper->vol_plugin->object_cls.generic)(id_wrapper->obj_id, generic_type,
+ arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "generic failed")
+ va_end (arguments);
+
+ if(H5VL_ATTR_OPEN_BY_IDX == generic_type) {
+ H5VL_id_wrapper_t *temp_id_wrapper; /* user id structure */
+ hid_t *ret_id;
+
+ va_start (arguments, generic_type);
+ ret_id = va_arg (arguments, hid_t *);
+
+ /* Create a new id that points to a struct that holds the attr id and the VOL plugin */
+ /* Allocate new id structure */
+ if(NULL == (temp_id_wrapper = (H5VL_id_wrapper_t *)H5MM_malloc(sizeof(H5VL_id_wrapper_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ temp_id_wrapper->obj_id = *ret_id;
+ temp_id_wrapper->vol_plugin = id_wrapper->vol_plugin;
+
+ if((*ret_id = H5I_register(H5I_ATTR_PUBLIC, temp_id_wrapper, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attr handle")
+ va_end (arguments);
+ }
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_object_generic() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_object_close
*
* Purpose: Closes a object through the VOL
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index afabef7..8abad51 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -67,7 +67,6 @@ static hid_t H5VL_native_attr_open(hid_t loc_id, void *location, const char *att
static herr_t H5VL_native_attr_read(hid_t attr_id, hid_t dtype_id, void *buf);
static herr_t H5VL_native_attr_write(hid_t attr_id, hid_t dtype_id, const void *buf);
static herr_t H5VL_native_attr_get(hid_t id, H5VL_attr_get_t get_type, va_list arguments);
-static herr_t H5VL_native_attr_generic(hid_t id, H5VL_attr_generic_t generic_type, va_list arguments);
static herr_t H5VL_native_attr_delete(hid_t loc_id, void *location, const char *attr_name);
static herr_t H5VL_native_attr_close(hid_t attr_id);
@@ -101,12 +100,13 @@ static herr_t H5VL_native_link_create(H5VL_link_create_type_t create_type, hid_t
const char *link_name, hid_t lcpl_id, hid_t lapl_id);
static herr_t H5VL_native_link_move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name, hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id);
-//static herr_t H5VL_native_link_delete(hid_t loc_id, char *name, H5G_traverse_t op, void *udata, hid_t lapl_id);
-static herr_t H5VL_native_link_delete(hid_t loc_id, const char *name, hid_t lapl_id);
+static herr_t H5VL_native_link_get(hid_t loc_id, H5VL_link_get_t get_type, va_list arguments);
+static herr_t H5VL_native_link_delete(hid_t loc_id, const char *name, void *udata, hid_t lapl_id);
static hid_t H5VL_native_object_open(hid_t loc_id, void *location, hid_t lapl_id);
-static herr_t H5VL_native_object_get(hid_t id, H5VL_object_get_t get_type, va_list arguments);
static herr_t H5VL_native_object_lookup(hid_t loc_id, H5VL_object_lookup_t lookup_type, va_list arguments);
+static herr_t H5VL_native_object_get(hid_t id, H5VL_object_get_t get_type, va_list arguments);
+static herr_t H5VL_native_object_generic(hid_t id, H5VL_object_generic_t generic_type, va_list arguments);
static herr_t H5VL_native_object_close(hid_t object_id);
H5VL_class_t H5VL_native_g = {
@@ -119,7 +119,6 @@ H5VL_class_t H5VL_native_g = {
H5VL_native_attr_read, /* read */
H5VL_native_attr_write, /* write */
H5VL_native_attr_get, /* get */
- H5VL_native_attr_generic, /* generic */
H5VL_native_attr_delete, /* delete */
H5VL_native_attr_close /* close */
},
@@ -153,7 +152,7 @@ H5VL_class_t H5VL_native_g = {
{ /* link_cls */
H5VL_native_link_create, /* create */
H5VL_native_link_move, /* move */
- NULL, /* get */
+ H5VL_native_link_get, /* get */
H5VL_native_link_delete /* delete */
},
{ /* object_cls */
@@ -162,6 +161,7 @@ H5VL_class_t H5VL_native_g = {
NULL, /* copy */
H5VL_native_object_lookup, /* lookup */
H5VL_native_object_get, /* get */
+ H5VL_native_object_generic, /* generic */
H5VL_native_object_close /* close */
}
};
@@ -380,7 +380,6 @@ H5VL_native_attr_open(hid_t loc_id, void *location, const char *attr_name, hid_t
if(H5G_loc_free(obj_loc) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
-
}
else { /* H5Aopen */
/* Read in attribute from object header */
@@ -572,65 +571,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL_native_attr_generic
- *
- * Purpose: Perform a plugin specific operation for an attribute
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Mohamad Chaarawi
- * April, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL_native_attr_generic(hid_t loc_id, H5VL_attr_generic_t generic_type, va_list arguments)
-{
- H5A_t *attr = NULL; /* Attribute opened */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- switch (generic_type) {
- /* H5Aopen_by_idx */
- case H5VL_ATTR_OPEN_BY_IDX:
- {
- hid_t *ret_id = va_arg (arguments, hid_t *);
- char *obj_name = va_arg (arguments, char *);
- H5_index_t idx_type = va_arg (arguments, H5_index_t);
- H5_iter_order_t order = va_arg (arguments, H5_iter_order_t);
- hsize_t n = va_arg (arguments, hsize_t);
- hid_t aapl_id = va_arg (arguments, hid_t);
- hid_t lapl_id = va_arg (arguments, hid_t);
- H5G_loc_t loc; /* Object location */
-
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
-
- /* Open the attribute in the object header */
- if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, H5AC_ind_dxpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute")
-
- /* Register the attribute and get an ID for it */
- if((*ret_id = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
- break;
- }
- default:
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type")
- }
-
-done:
- /* Cleanup on failure */
- if(H5VL_ATTR_OPEN_BY_IDX == generic_type && ret_value < 0)
- if(attr && H5A_close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_attr_generic() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5VL_native_attr_delete
*
* Purpose: Deletes an attribute from a location
@@ -1944,7 +1884,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5VL_native_group_get
*
- * Purpose: Gets certain data about a file
+ * Purpose: Gets certain data about a group
*
* Return: Success: 0
* Failure: -1
@@ -2212,6 +2152,107 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL_native_link_get
+ *
+ * Purpose: Gets certain data about a link
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_native_link_get(hid_t loc_id, H5VL_link_get_t get_type, va_list arguments)
+{
+ H5G_loc_t loc;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Check arguments */
+ if(H5G_loc(loc_id, &loc))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+
+ switch (get_type) {
+ /* H5Lexists */
+ case H5VL_LINK_EXISTS:
+ {
+ char *name = va_arg (arguments, char *);
+ htri_t *ret = va_arg (arguments, htri_t *);
+ hid_t lapl_id = va_arg (arguments, hid_t);
+
+ /* Check for the existence of the link */
+ if((*ret = H5L_exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info")
+ break;
+ }
+ /* H5Lget_info/H5Lget_info_by_idx */
+ case H5VL_LINK_GET_INFO:
+ {
+ char *name = va_arg (arguments, char *);
+ H5L_info_t *linfo = va_arg (arguments, H5L_info_t *);
+ void *udata = va_arg (arguments, void *);
+ hid_t lapl_id = va_arg (arguments, hid_t);
+
+ if(NULL == udata) { /* H5Lget_info */
+ /* Get the link information */
+ if(H5L_get_info(&loc, name, linfo, lapl_id, H5AC_ind_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info")
+ }
+ else { /* H5Lget_info_by_idx */
+ /* Get the link information */
+ if(H5L_get_info_by_idx(&loc, name, udata, lapl_id, H5AC_ind_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info")
+ }
+ break;
+ }
+ /* H5Lget_name_by_idx */
+ case H5VL_LINK_GET_NAME:
+ {
+ char *name = va_arg (arguments, char *);
+ void *udata = va_arg (arguments, void *);
+ hid_t lapl_id = va_arg (arguments, hid_t);
+
+ /* Get the link name */
+ if(H5L_get_name_by_idx(&loc, name, udata, lapl_id, H5AC_ind_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info")
+ break;
+ }
+ /* H5Lget_val/H5Lget_val_by_idx */
+ case H5VL_LINK_GET_VAL:
+ {
+ char *name = va_arg (arguments, char *);
+ void *buf = va_arg (arguments, void *);
+ size_t size = va_arg (arguments, size_t);
+ void *udata = va_arg (arguments, void *);
+ hid_t lapl_id = va_arg (arguments, hid_t);
+
+ if(NULL == udata) { /* H5Lget_val */
+ /* Get the link value */
+ if(H5L_get_val(&loc, name, buf, size, lapl_id, H5AC_ind_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL,
+ "unable to get link value for '%s'", name)
+ }
+ else { /* H5Lget_val_by_idx */
+ /* Get the link information */
+ if(H5L_get_val_by_idx(&loc, name, udata, lapl_id, H5AC_ind_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link val")
+ }
+ break;
+ }
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from link")
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_native_link_get() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_native_link_delete
*
* Purpose: Removes the specified NAME from the group graph and
@@ -2229,7 +2270,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_native_link_delete(hid_t loc_id, const char *name, hid_t lapl_id)
+H5VL_native_link_delete(hid_t loc_id, const char *name, void *udata, hid_t lapl_id)
{
H5G_loc_t loc; /* Object location */
herr_t ret_value = SUCCEED;
@@ -2239,15 +2280,16 @@ H5VL_native_link_delete(hid_t loc_id, const char *name, hid_t lapl_id)
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- /* Unlink */
- if(H5L_delete(&loc, name, lapl_id, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
-
- /* Traverse the group hierarchy to remove the link
- if(H5G_traverse(&loc, name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT,
- op, (H5L_trav_rm_t *)udata, lapl_id, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist")
- */
+ if(NULL == udata) { /* H5Ldelete */
+ /* Unlink */
+ if(H5L_delete(&loc, name, lapl_id, H5AC_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
+ }
+ else { /* H5Ldelete_by_idx */
+ /* Unlink */
+ if(H5L_delete_by_idx(&loc, name, udata, lapl_id, H5AC_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_native_link_delete() */
@@ -2434,6 +2476,184 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL_native_object_generic
+ *
+ * Purpose: Perform a plugin specific operation for an objectibute
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_native_object_generic(hid_t loc_id, H5VL_object_generic_t generic_type, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+ H5A_t *attr = NULL; /* Attribute opened */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ switch (generic_type) {
+ /* H5Adelete_by_idx */
+ case H5VL_ATTR_DELETE_BY_IDX:
+ {
+ H5G_loc_t *obj_loc = va_arg (arguments, H5G_loc_t *);
+ H5_index_t idx_type = va_arg (arguments, H5_index_t);
+ H5_iter_order_t order = va_arg (arguments, H5_iter_order_t);
+ hsize_t n = va_arg (arguments, hsize_t);
+
+ /* Delete the attribute from the location */
+ if(H5O_attr_remove_by_idx(obj_loc->oloc, idx_type, order, n, H5AC_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
+
+ if(H5G_loc_free(obj_loc) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
+
+ break;
+ }
+ /* H5Aexists/exists_by_name */
+ case H5VL_ATTR_EXISTS:
+ {
+ char *name = va_arg (arguments, char *);
+ void *location = va_arg (arguments, void *);
+ htri_t *ret = va_arg (arguments, htri_t *);
+ H5G_loc_t loc;
+
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+
+ if(NULL == location) { /* H5Aexists */
+ /* Check if the attribute exists */
+ if((*ret = H5O_attr_exists(loc.oloc, name, H5AC_ind_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
+ }
+ else {
+ H5G_loc_t *obj_loc = (H5G_loc_t *)location;
+ /* Check if the attribute exists */
+ if((*ret = H5O_attr_exists(obj_loc->oloc, name, H5AC_ind_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
+
+ if(H5G_loc_free(obj_loc) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
+ }
+ break;
+ }
+ /* H5Aopen_by_idx */
+ case H5VL_ATTR_OPEN_BY_IDX:
+ {
+ hid_t *ret_id = va_arg (arguments, hid_t *);
+ char *obj_name = va_arg (arguments, char *);
+ H5_index_t idx_type = va_arg (arguments, H5_index_t);
+ H5_iter_order_t order = va_arg (arguments, H5_iter_order_t);
+ hsize_t n = va_arg (arguments, hsize_t);
+ hid_t aapl_id = va_arg (arguments, hid_t);
+ hid_t lapl_id = va_arg (arguments, hid_t);
+ H5G_loc_t loc; /* Object location */
+
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+
+ /* Open the attribute in the object header */
+ if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, H5AC_ind_dxpl_id)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute")
+
+ /* Register the attribute and get an ID for it */
+ if((*ret_id = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ break;
+ }
+ /* H5Arename/rename_by_name */
+ case H5VL_ATTR_RENAME:
+ {
+ void *location = va_arg (arguments, void *);
+ char *old_name = va_arg (arguments, char *);
+ char *new_name = va_arg (arguments, char *);
+ H5G_loc_t loc;
+
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+
+ if(NULL == location) { /* H5Arename */
+ /* Call attribute rename routine */
+ if(H5O_attr_rename(loc.oloc, H5AC_dxpl_id, old_name, new_name) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
+ }
+ else {
+ H5G_loc_t *obj_loc = (H5G_loc_t *)location;
+
+ /* Call attribute rename routine */
+ if(H5O_attr_rename(obj_loc->oloc, H5AC_dxpl_id, old_name, new_name) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
+
+ if(H5G_loc_free(obj_loc) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
+ }
+ break;
+ }
+ /* H5Oincr_refcount / H5Odecr_refcount */
+ case H5VL_OBJECT_CHANGE_REF_COUNT:
+ {
+ int update_ref = va_arg (arguments, int);
+ H5O_loc_t *oloc;
+
+ /* Get the object's oloc so we can adjust its link count */
+ if((oloc = H5O_get_loc(loc_id)) == NULL)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID")
+
+ if(H5O_link(oloc, update_ref, H5AC_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
+
+ break;
+ }
+ /* H5Oexists_by_name */
+ case H5VL_OBJECT_EXISTS:
+ {
+ char *name = va_arg (arguments, char *);
+ hid_t lapl_id = va_arg (arguments, hid_t);
+ htri_t *ret = va_arg (arguments, htri_t *);
+ H5G_loc_t loc;
+
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+
+ /* Check if the object exists */
+ if((*ret = H5G_loc_exists(&loc, name, lapl_id, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name)
+ break;
+ }
+ /* H5Oset_comment */
+ case H5VL_OBJECT_SET_COMMENT:
+ {
+ const char *name = va_arg (arguments, char *);
+ const char *comment = va_arg (arguments, char *);
+ hid_t lapl_id = va_arg (arguments, hid_t);
+ H5G_loc_t loc;
+
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+
+ /* (Re)set the object's comment */
+ if(H5G_loc_set_comment(&loc, name, comment, lapl_id, H5AC_ind_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
+ break;
+ }
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type")
+ }
+
+done:
+ /* Cleanup on failure */
+ if(H5VL_ATTR_OPEN_BY_IDX == generic_type && ret_value < 0)
+ if(attr && H5A_close(attr) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_native_object_generic() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_native_object_get
*
* Purpose: Gets certain data about a file
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index e58106a..acb64a3 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -60,7 +60,6 @@ H5_DLL hid_t H5VL_attr_open(hid_t loc_id, void *location, const char *name, hid_
H5_DLL herr_t H5VL_attr_read(hid_t attr_id, hid_t dtype_id, void *buf);
H5_DLL herr_t H5VL_attr_write(hid_t attr_id, hid_t dtype_id, const void *buf);
H5_DLL herr_t H5VL_attr_get(hid_t id, H5VL_attr_get_t get_type, ...);
-H5_DLL herr_t H5VL_attr_generic(hid_t id, H5VL_attr_generic_t generic_type, ...);
H5_DLL herr_t H5VL_attr_delete(hid_t loc_id, void *location, const char *attr_name);
H5_DLL herr_t H5VL_attr_close(hid_t attr_id);
@@ -91,11 +90,13 @@ H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, hid_t loc_id
const char *link_name, hid_t lcpl_id, hid_t lapl_id);
H5_DLL herr_t H5VL_link_move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name, hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id);
-H5_DLL herr_t H5VL_link_delete(hid_t loc_id, const char *name, hid_t lapl_id);
+H5_DLL herr_t H5VL_link_get(hid_t loc_id, H5VL_link_get_t get_type, ...);
+H5_DLL herr_t H5VL_link_delete(hid_t loc_id, const char *name, void *udata, hid_t lapl_id);
H5_DLL hid_t H5VL_object_open_by_loc(hid_t uid, void *obj_loc, hid_t lapl_id);
H5_DLL herr_t H5VL_object_close(hid_t uid);
H5_DLL herr_t H5VL_object_get(hid_t uid, H5VL_object_get_t get_type, ...);
+H5_DLL herr_t H5VL_object_generic(hid_t id, H5VL_object_generic_t generic_type, ...);
H5_DLL herr_t H5VL_object_lookup(hid_t uid, H5VL_object_lookup_t lookup_type, ...);
H5_DLL herr_t H5VL_fapl_open(struct H5P_genplist_t *plist, H5VL_class_t *vol_cls);
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index fc57733..fb61135 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -57,11 +57,6 @@ typedef enum H5VL_attr_get_t {
H5VL_ATTR_GET_INFO = 5 /* offset */
} H5VL_attr_get_t;
-/* types for all attr general operations */
-typedef enum H5VL_attr_generic_t {
- H5VL_ATTR_OPEN_BY_IDX = 0 /* H5Aopen_by_idx */
-} H5VL_attr_generic_t;
-
/* types for all dataset get API routines */
typedef enum H5VL_dataset_get_t {
H5VL_DATASET_GET_SPACE = 0, /* dataspace */
@@ -81,9 +76,10 @@ typedef enum H5VL_group_get_t {
/* types for all link get API routines */
typedef enum H5VL_link_get_t {
- H5VL_LINK_GET_INFO = 0, /*link info */
- H5VL_LINK_GET_NAME = 1, /*link name */
- H5VL_LINK_GET_VAL = 2 /*link value */
+ H5VL_LINK_EXISTS = 0, /*link existence */
+ H5VL_LINK_GET_INFO = 1, /*link info */
+ H5VL_LINK_GET_NAME = 2, /*link name */
+ H5VL_LINK_GET_VAL = 3 /*link value */
} H5VL_link_get_t;
/* types for all object get API routines */
@@ -101,6 +97,17 @@ typedef enum H5VL_object_lookup_t {
H5VL_OBJECT_LOOKUP_BY_REF = 4
} H5VL_object_lookup_t;
+/* types for all attr general operations */
+typedef enum H5VL_object_generic_t {
+ H5VL_ATTR_DELETE_BY_IDX = 0, /* H5Adelete_by_idx */
+ H5VL_ATTR_EXISTS = 1, /* H5Aexists */
+ H5VL_ATTR_OPEN_BY_IDX = 2, /* H5Aopen_by_idx */
+ H5VL_ATTR_RENAME = 3, /* H5Arename */
+ H5VL_OBJECT_CHANGE_REF_COUNT = 4, /* H5Oincr/decr_refcount */
+ H5VL_OBJECT_EXISTS = 5, /* H5Oexists(_by_name) */
+ H5VL_OBJECT_SET_COMMENT = 6 /* H5Oset_comment(_by_name) */
+} H5VL_object_generic_t;
+
/* types for all object lookup API routines */
typedef enum H5VL_link_create_type_t {
H5VL_CREATE_HARD_LINK = 0,
@@ -117,7 +124,6 @@ typedef struct H5VL_attr_class_t {
herr_t (*read) (hid_t attr_id, hid_t mem_type_id, void *buf);
herr_t (*write) (hid_t attr_id, hid_t mem_type_id, const void *buf);
herr_t (*get) (hid_t file_id, H5VL_attr_get_t get_type, va_list arguments);
- herr_t (*generic)(hid_t id, H5VL_attr_generic_t generic_type, va_list arguments);
herr_t (*delete)(hid_t loc_id, void *location, const char *attr_name);
herr_t (*close) (hid_t attr_id);
} H5VL_attr_class_t;
@@ -167,7 +173,7 @@ typedef struct H5VL_link_class_t {
herr_t (*move) (hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dest_name, hbool_t copy_flag, hid_t lcpl, hid_t lapl);
herr_t (*get) (hid_t loc_id, H5VL_link_get_t get_type, va_list arguments);
- herr_t (*delete)(hid_t loc_id, const char *name, hid_t lapl_id);
+ herr_t (*delete)(hid_t loc_id, const char *name, void *udata, hid_t lapl_id);
} H5VL_link_class_t;
/* H5O routines */
@@ -179,6 +185,7 @@ typedef struct H5VL_object_class_t {
hid_t ocpypl_id, hid_t lcpl_id );
herr_t (*lookup)(hid_t loc_id, H5VL_object_lookup_t lookup_type, va_list arguments);
herr_t (*get) (hid_t loc_id, H5VL_object_get_t get_type, va_list arguments);
+ herr_t (*generic)(hid_t id, H5VL_object_generic_t generic_type, va_list arguments);
herr_t (*close) (hid_t obj_id);
} H5VL_object_class_t;
diff --git a/test/th5o.c b/test/th5o.c
index c695474..f504690 100644
--- a/test/th5o.c
+++ b/test/th5o.c
@@ -395,6 +395,12 @@ test_h5o_refcount(void)
ret = H5Tcommit2(fid, "datatype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Tcommit2");
+ /* MSC - workaround committed datatypes */
+ ret = H5Tclose(dtype);
+ CHECK(ret, FAIL, "H5Tclose");
+ dtype = H5Topen2(fid, "datatype", H5P_DEFAULT);
+ CHECK(dtype, FAIL, "H5Topen2");
+
/* Create the data space for the dataset. */
dims[0] = DIM0;
dims[1] = DIM1;
@@ -960,6 +966,12 @@ test_h5o_comment(void)
ret = H5Tcommit2(fid, "group/datatype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Tcommit2");
+ /* MSC - workaround committed datatypes */
+ ret = H5Tclose(dtype);
+ CHECK(ret, FAIL, "H5Tclose");
+ dtype = H5Topen2(fid, "group/datatype", H5P_DEFAULT);
+ CHECK(dtype, FAIL, "H5Topen2");
+
/* Putting a comment on the committed data type */
ret = H5Oset_comment(dtype, dtype_comment);
CHECK(ret, FAIL, "H5Oset_comment");