summaryrefslogtreecommitdiffstats
path: root/src/H5Gdeprec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Gdeprec.c')
-rw-r--r--src/H5Gdeprec.c383
1 files changed, 231 insertions, 152 deletions
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index f8f668c..ab73e7e 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -43,6 +43,7 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5Pprivate.h" /* Property lists */
+#include "H5VLprivate.h" /* VOL plugins */
/****************/
@@ -72,10 +73,6 @@ typedef struct {
/* Local Prototypes */
/********************/
-static herr_t H5G__link(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);
-static herr_t H5G__move(hid_t src_loc_id, const char *src_name,
- hid_t dst_loc_id, const char *dst_name, hid_t lcpl_id);
static herr_t H5G__get_objinfo_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*/);
@@ -174,17 +171,18 @@ H5G_map_obj_type(H5O_type_t obj_type)
hid_t
H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
{
- H5G_loc_t loc; /* Location to create group */
- H5G_t *grp = NULL; /* New group created */
+ void *grp = NULL; /* New group created */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5P_genplist_t *plist; /* Property list pointer */
hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */
+ hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*sz", loc_id, name, size_hint);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given")
@@ -221,12 +219,28 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read info")
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(tmp_gcpl)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
+
+ /* get creation properties */
+ if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get property value for lcpl id")
+
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
/* Create the group */
- if(NULL == (grp = H5G__create_named(&loc, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl)))
+ if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, tmp_gcpl,
+ H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
- if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
+ if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
@@ -235,7 +249,7 @@ done:
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list")
if(H5I_INVALID_HID == ret_value)
- if(grp && H5G_close(grp) < 0)
+ if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
@@ -262,30 +276,38 @@ done:
hid_t
H5Gopen1(hid_t loc_id, const char *name)
{
- H5G_t *grp = NULL; /* Group opened */
- H5G_loc_t loc; /* Location of parent for group */
+ void *grp = NULL; /* Group opened */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "i*s", loc_id, name);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* get the location object */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
/* Open the group */
- if(NULL == (grp = H5G__open_name(&loc, name)))
+ if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->driver->cls, name, H5P_DEFAULT,
+ H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group")
/* Get an atom for the group */
- if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
+ if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
if(H5I_INVALID_HID == ret_value)
- if(grp && H5G_close(grp) < 0)
+ if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
@@ -303,6 +325,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)
@@ -318,9 +342,64 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
if(H5CX_set_loc(cur_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* 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")
+
/* Create link */
- if(H5G__link(cur_loc_id, cur_name, type, H5L_SAME_LOC, new_name, H5P_LINK_CREATE_DEFAULT) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link")
+ if(type == H5L_TYPE_HARD) {
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params1;
+ H5VL_loc_params_t loc_params2;
+
+ loc_params1.type = H5VL_OBJECT_BY_NAME;
+ loc_params1.obj_type = H5I_get_type(cur_loc_id);
+ loc_params1.loc_data.loc_by_name.name = cur_name;
+ loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+
+ loc_params2.type = H5VL_OBJECT_BY_NAME;
+ loc_params2.loc_data.loc_by_name.name = new_name;
+ loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* set creation properties */
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj->data) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target")
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target loc params")
+
+ /* Create the link through the VOL */
+ if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, vol_obj->driver->cls,
+ lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
+ }
+ else if(type == H5L_TYPE_SOFT) {
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.loc_data.loc_by_name.name = new_name;
+ loc_params.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+ loc_params.obj_type = H5I_get_type(cur_loc_id);
+
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* set creation properties */
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET_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_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls,
+ lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
+ }
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid link type")
done:
FUNC_LEAVE_API(ret_value)
@@ -339,6 +418,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)
@@ -354,84 +435,77 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
if(H5CX_set_loc(cur_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Create link */
- if(H5G__link(cur_loc_id, cur_name, type, new_loc_id, new_name, H5P_LINK_CREATE_DEFAULT) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Glink2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G__link
- *
- * Purpose: Internal routine to create a new link.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, December 18, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G__link(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)
-{
- H5G_loc_t new_loc; /* Information about new link's group */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
+ /* 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")
/* Create the appropriate kind of link */
if(type == H5L_TYPE_HARD) {
- H5G_loc_t cur_loc, *cur_loc_p; /* Information about current link's group */
- H5G_loc_t *new_loc_p; /* Information about new link's group */
-
- /* Finish checking arguments */
- if(cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC")
- if(cur_loc_id != H5L_SAME_LOC && H5G_loc(cur_loc_id, &cur_loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
- if(new_loc_id != H5L_SAME_LOC && H5G_loc(new_loc_id, &new_loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
-
- /* Set up current & new location pointers */
- cur_loc_p = &cur_loc;
- new_loc_p = &new_loc;
- if(cur_loc_id == H5L_SAME_LOC)
- cur_loc_p = new_loc_p;
- else if(new_loc_id == H5L_SAME_LOC)
- new_loc_p = cur_loc_p;
- else if(cur_loc_p->oloc->file != new_loc_p->oloc->file)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "source and destination should be in the same file.")
-
- /* Create the link */
- if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0)
+ H5VL_object_t *vol_obj1 = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj2 = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params1;
+ H5VL_loc_params_t loc_params2;
+
+ loc_params1.type = H5VL_OBJECT_BY_NAME;
+ loc_params1.obj_type = H5I_get_type(cur_loc_id);
+ loc_params1.loc_data.loc_by_name.name = cur_name;
+ loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+
+ loc_params2.type = H5VL_OBJECT_BY_NAME;
+ loc_params2.obj_type = H5I_get_type(new_loc_id);
+ loc_params2.loc_data.loc_by_name.name = new_name;
+ loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+
+ /* get the location object */
+ if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(cur_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(new_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* set creation properties */
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj1->data) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id")
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 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_LINK_CREATE_HARD, vol_obj2->data, loc_params2, vol_obj2->driver->cls,
+ lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
}
else if(type == H5L_TYPE_SOFT) {
- /* Soft links only need one location, the new_loc_id, but it's possible
- * that new_loc_id is H5L_SAME_LOC
- */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+
+ /* 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")
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.loc_data.loc_by_name.name = new_name;
+ loc_params.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+ loc_params.obj_type = H5I_get_type(new_loc_id);
+
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(new_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* Create the link */
- if(H5L_create_soft(cur_name, &new_loc, new_name, lcpl_id) < 0)
+ /* set creation properties */
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET_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_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls,
+ lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
}
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type")
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G__link() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Glink2() */
/*-------------------------------------------------------------------------
@@ -444,7 +518,10 @@ done:
herr_t
H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params1;
+ H5VL_loc_params_t loc_params2;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*s*s", src_loc_id, src_name, dst_name);
@@ -453,8 +530,22 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name)
if(H5CX_set_loc(src_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ loc_params1.type = H5VL_OBJECT_BY_NAME;
+ loc_params1.obj_type = H5I_get_type(src_loc_id);
+ loc_params1.loc_data.loc_by_name.name = src_name;
+ loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+
+ loc_params2.type = H5VL_OBJECT_BY_NAME;
+ loc_params2.loc_data.loc_by_name.name = dst_name;
+ loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(src_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
/* Move the link */
- if(H5G__move(src_loc_id, src_name, H5L_SAME_LOC, dst_name, H5P_LINK_CREATE_DEFAULT) < 0)
+ if((ret_value = H5VL_link_move(vol_obj->data, loc_params1, NULL, loc_params2, vol_obj->driver->cls,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link")
done:
@@ -473,21 +564,45 @@ herr_t
H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name)
{
+ H5VL_object_t *vol_obj1 = NULL; /* object token of src_id */
+ H5VL_loc_params_t loc_params1;
+ H5VL_object_t *vol_obj2 = NULL; /* object token of dst_id */
+ H5VL_loc_params_t loc_params2;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*si*s", src_loc_id, src_name, dst_loc_id, dst_name);
- /* Check arguments */
- if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC")
-
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(dst_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set location parameter for source object */
+ loc_params1.type = H5VL_OBJECT_BY_NAME;
+ loc_params1.loc_data.loc_by_name.name = src_name;
+ loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+ loc_params1.obj_type = H5I_get_type(src_loc_id);
+ /* Set location parameter for destination object */
+ loc_params2.type = H5VL_OBJECT_BY_NAME;
+ loc_params2.loc_data.loc_by_name.name = dst_name;
+ loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+ loc_params2.obj_type = H5I_get_type(dst_loc_id);
+
+ if(H5L_SAME_LOC != src_loc_id) {
+ /* get the location object */
+ if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ }
+ if(H5L_SAME_LOC != dst_loc_id) {
+ /* get the location object */
+ if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ }
+
/* Move the link */
- if(H5G__move(src_loc_id, src_name, dst_loc_id, dst_name, H5P_LINK_CREATE_DEFAULT) < 0)
+ if((ret_value = H5VL_link_move(vol_obj1->data, loc_params1, vol_obj2->data, loc_params2,
+ vol_obj1->driver->cls, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link")
done:
@@ -496,60 +611,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__move
- *
- * Purpose: Renames an object within an HDF5 file and moves it to a new
- * group. The original name SRC is unlinked from the group graph
- * and then inserted with the new name DST (which can specify a
- * new path for the object) as an atomic operation. The names
- * are interpreted relative to SRC_LOC_ID and
- * DST_LOC_ID, which are either file IDs or group ID.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, November 6, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G__move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
- const char *dst_name, hid_t lcpl_id)
-{
- H5G_loc_t src_loc, *src_loc_p; /* Group info for source location */
- H5G_loc_t dst_loc, *dst_loc_p; /* Group info for destination location */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Check arguments */
- if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
- if(dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
- if(!src_name || !*src_name)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no current name specified")
- if(!dst_name || !*dst_name)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no destination name specified")
-
- /* Set up src & dst location pointers */
- src_loc_p = &src_loc;
- dst_loc_p = &dst_loc;
- if(src_loc_id == H5L_SAME_LOC)
- src_loc_p = dst_loc_p;
- else if(dst_loc_id == H5L_SAME_LOC)
- dst_loc_p = src_loc_p;
-
- /* Move the link */
- if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G__move() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Gunlink
*
* Purpose: Removes a link. The new API is H5Ldelete/H5Ldelete_by_idx.
@@ -559,15 +620,14 @@ done:
herr_t
H5Gunlink(hid_t loc_id, const char *name)
{
- H5G_loc_t loc; /* Group's location */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
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")
@@ -575,8 +635,18 @@ H5Gunlink(hid_t loc_id, const char *name)
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.loc_data.loc_by_name.name = name;
+ loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+
+ /* Get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
/* Delete the link */
- if(H5L_delete(&loc, name) < 0)
+ if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE,
+ H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
done:
@@ -595,15 +665,14 @@ done:
herr_t
H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
{
- H5G_loc_t loc; /* Group's location */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*szx", loc_id, name, size, buf);
/* 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")
@@ -611,9 +680,19 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.loc_data.loc_by_name.name = name;
+ loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+
+ /* Get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
/* Get the link value */
- if(H5L_get_val(&loc, name, buf, size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info")
+ if((ret_value = H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL,
+ H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value")
done:
FUNC_LEAVE_API(ret_value)