summaryrefslogtreecommitdiffstats
path: root/src/H5L.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5L.c')
-rw-r--r--src/H5L.c384
1 files changed, 186 insertions, 198 deletions
diff --git a/src/H5L.c b/src/H5L.c
index acf51e8..f3dcd5b 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -102,20 +102,12 @@ static herr_t H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
static herr_t H5L_create_real(H5G_loc_t *link_loc, const char *link_name,
H5G_name_t *obj_path, H5F_t *obj_file, H5O_link_t *lnk, hid_t lcpl_id,
hid_t lapl_id, hid_t dxpl_id);
-static herr_t H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name,
- H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id,
- hid_t lapl_id, hid_t dxpl_id);
-static herr_t H5L_create_soft(const char *target_path, H5G_loc_t *cur_loc,
- const char *cur_name, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id);
static herr_t H5L_get_val_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 herr_t H5L_delete_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 herr_t H5L_move(H5G_loc_t *src_loc, const char *src_name,
- H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag,
- hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id);
static herr_t H5L_move_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*/);
@@ -230,128 +222,11 @@ H5L_term_interface(void)
/*-------------------------------------------------------------------------
- * Function: H5Lregister
- *
- * Purpose: Registers a class of user-defined links, or changes the
- * behavior of an existing class.
- *
- * The link class passed in will override any existing link
- * class for the specified link class ID. It must at least
- * include a H5L_class_t version (which should be
- * H5L_LINK_CLASS_T_VERS), a link class ID, and a traversal
- * function.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: James Laird
- * Monday, July 10, 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Lregister(const H5L_class_t *cls)
-{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Lregister, FAIL)
- H5TRACE1("e","*x",cls);
-
- /* Check args */
- if (cls==NULL)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class")
-
- /* Check H5L_class_t version number; this is where a function to convert
- * from an outdated version should be called.
- */
- if(cls->version != H5L_LINK_CLASS_T_VERS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5L_class_t version number");
-
- if (cls->id<H5L_TYPE_UD_MIN || cls->id>H5L_TYPE_MAX)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link identification number")
- if (cls->trav_func==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no traversal function specified")
-
- /* Do it */
- if (H5L_register (cls)<0)
- HGOTO_ERROR (H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register link type")
-
-done:
- FUNC_LEAVE_API(ret_value)
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5L_find_class_idx
- *
- * Purpose: Given a link class ID, return the offset in the global array
- * that holds all the registered link classes.
- *
- * Return: Success: Non-negative index of entry in global
- * link class table.
- * Failure: Negative
- *
- * Programmer: James Laird
- * Monday, July 10, 2006
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5L_find_class_idx(H5L_type_t id)
-{
- size_t i; /* Local index variable */
- int ret_value=FAIL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5L_find_class_idx)
-
- for (i=0; i<H5L_table_used_g; i++)
- if (H5L_table_g[i].id == id)
- HGOTO_DONE((int)i)
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_find_class_idx */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5L_find_class
- *
- * Purpose: Given a link class ID return a pointer to a global struct that
- * defines the link class.
- *
- * Return: Success: Ptr to entry in global link class table.
- * Failure: NULL
- *
- * Programmer: James Laird
- * Monday, July 10, 2006
- *
- *-------------------------------------------------------------------------
- */
-const H5L_class_t *
-H5L_find_class(H5L_type_t id)
-{
- int idx; /* Filter index in global table */
- H5L_class_t *ret_value=NULL; /* Return value */
-
- FUNC_ENTER_NOAPI(H5L_find_class, NULL)
-
- /* Get the index in the global table */
- if((idx=H5L_find_class_idx(id))<0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, NULL, "unable to find link class")
-
- /* Set return value */
- ret_value=H5L_table_g+idx;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_find_class */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Lmove
*
* 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 the inserted with the new name DST (which can specify a
+ * 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.
@@ -365,7 +240,7 @@ done:
*/
herr_t
H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
- const char *dst_name, hid_t lcpl_id, hid_t lapl_id)
+ const char *dst_name, hid_t lcpl_id, hid_t lapl_id)
{
H5G_loc_t src_loc, *src_loc_p;
H5G_loc_t dst_loc, *dst_loc_p;
@@ -376,6 +251,8 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
lapl_id);
/* Check arguments */
+ if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC")
if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0)
@@ -384,27 +261,25 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
if(!dst_name || !*dst_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified")
+ if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
/* Set up src & dst location pointers */
src_loc_p = &src_loc;
dst_loc_p = &dst_loc;
- if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC")
- else if(src_loc_id == H5L_SAME_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;
- if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
-
- if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name,
- FALSE, lcpl_id, lapl_id, H5AC_dxpl_id) < 0)
+ /* Move the link */
+ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id,
+ lapl_id, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Lmove() */
/*-------------------------------------------------------------------------
@@ -423,7 +298,7 @@ done:
*/
herr_t
H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
- const char *dst_name, hid_t lcpl_id, hid_t lapl_id)
+ const char *dst_name, hid_t lcpl_id, hid_t lapl_id)
{
H5G_loc_t src_loc, *src_loc_p;
H5G_loc_t dst_loc, *dst_loc_p;
@@ -434,6 +309,8 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
lapl_id);
/* Check arguments */
+ if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC")
if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0)
@@ -442,27 +319,25 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
if(!dst_name || !*dst_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified")
+ if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
/* Set up src & dst location pointers */
src_loc_p = &src_loc;
dst_loc_p = &dst_loc;
- if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC")
- else if(src_loc_id == H5L_SAME_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;
- if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
-
+ /* Copy the link */
if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id,
lapl_id, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Lcopy() */
/*-------------------------------------------------------------------------
@@ -508,10 +383,10 @@ H5Llink(hid_t new_loc_id, const char *new_name, hid_t obj_id, hid_t lcpl_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(HDstrlen(new_name) > H5L_MAX_LINK_NAME_LEN)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "name too long")
-
if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
+ /* Link to the object */
if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
@@ -540,29 +415,26 @@ done:
*/
herr_t
H5Lcreate_soft(const char *target_path,
- hid_t cur_loc, const char *cur_name, hid_t lcpl_id, hid_t lapl_id)
+ hid_t cur_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id)
{
- H5G_loc_t new_loc, *new_loc_p;
- herr_t ret_value=SUCCEED; /* Return value */
+ H5G_loc_t cur_loc; /* Group location for new link */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Lcreate_soft, FAIL)
- H5TRACE5("e","sisii",target_path,cur_loc,cur_name,lcpl_id,lapl_id);
+ H5TRACE5("e","sisii",target_path,cur_loc_id,new_name,lcpl_id,lapl_id);
/* Check arguments */
- if(H5G_loc(cur_loc, &new_loc) < 0)
+ if(H5G_loc(cur_loc_id, &cur_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!target_path || !*target_path)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no target specified")
- if(!cur_name || !*cur_name)
+ if(!new_name || !*new_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
-
if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
- new_loc_p = &new_loc;
-
- if(H5L_create_soft(target_path, new_loc_p, cur_name,
- lcpl_id, lapl_id, H5AC_dxpl_id) < 0)
+ /* Create the link */
+ if(H5L_create_soft(target_path, &cur_loc, new_name, lcpl_id, lapl_id, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:
@@ -588,17 +460,19 @@ done:
*/
herr_t
H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
- hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id)
+ hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id)
{
H5G_loc_t cur_loc, *cur_loc_p;
H5G_loc_t new_loc, *new_loc_p;
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Lcreate_hard, FAIL)
H5TRACE6("e","isisii",cur_loc_id,cur_name,new_loc_id,new_name,lcpl_id,
lapl_id);
/* Check arguments */
+ if(cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC)
+ HGOTO_ERROR(H5E_ARGS, 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_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(new_loc_id != H5L_SAME_LOC && H5G_loc(new_loc_id, &new_loc) < 0)
@@ -607,22 +481,20 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
if(!new_name || !*new_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
-
if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
/* Set up current & new location pointers */
cur_loc_p = &cur_loc;
new_loc_p = &new_loc;
- if(cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC")
- else if(cur_loc_id == H5L_SAME_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_ARGS, 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, lapl_id, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
@@ -680,7 +552,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
done:
FUNC_LEAVE_API(ret_value);
-} /* end H5Lcreate_ud */
+} /* end H5Lcreate_ud() */
/*-------------------------------------------------------------------------
@@ -717,7 +589,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id)
/* Unlink */
if(H5L_delete(&loc, name, lapl_id, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delet link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
FUNC_LEAVE_API(ret_value)
@@ -745,7 +617,7 @@ done:
*/
herr_t
H5Lget_val(hid_t loc_id, const char *name, size_t size, void *buf/*out*/,
- hid_t lapl_id)
+ hid_t lapl_id)
{
H5G_loc_t loc;
herr_t ret_value = SUCCEED; /* Return value */
@@ -804,7 +676,58 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linkbuf /*out*/,
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Gget_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Lregister
+ *
+ * Purpose: Registers a class of user-defined links, or changes the
+ * behavior of an existing class.
+ *
+ * The link class passed in will override any existing link
+ * class for the specified link class ID. It must at least
+ * include a H5L_class_t version (which should be
+ * H5L_LINK_CLASS_T_VERS), a link class ID, and a traversal
+ * function.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: James Laird
+ * Monday, July 10, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Lregister(const H5L_class_t *cls)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Lregister, FAIL)
+ H5TRACE1("e","*x",cls);
+
+ /* Check args */
+ if(cls == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class")
+
+ /* Check H5L_class_t version number; this is where a function to convert
+ * from an outdated version should be called.
+ */
+ if(cls->version != H5L_LINK_CLASS_T_VERS)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5L_class_t version number")
+
+ if (cls->id < H5L_TYPE_UD_MIN || cls->id > H5L_TYPE_MAX)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link identification number")
+ if (cls->trav_func == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no traversal function specified")
+
+ /* Do it */
+ if(H5L_register(cls) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register link type")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Lregister() */
/*-------------------------------------------------------------------------
@@ -831,12 +754,12 @@ H5Lunregister(H5L_type_t id)
H5TRACE1("e","Ll",id);
/* Check args */
- if (id<0 || id>H5L_TYPE_MAX)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type")
+ if(id < 0 || id > H5L_TYPE_MAX)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type")
/* Do it */
- if (H5L_unregister (id)<0)
- HGOTO_ERROR (H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to unregister link type")
+ if(H5L_unregister(id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to unregister link type")
done:
FUNC_LEAVE_API(ret_value)
@@ -888,6 +811,73 @@ done:
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_find_class_idx
+ *
+ * Purpose: Given a link class ID, return the offset in the global array
+ * that holds all the registered link classes.
+ *
+ * Return: Success: Non-negative index of entry in global
+ * link class table.
+ * Failure: Negative
+ *
+ * Programmer: James Laird
+ * Monday, July 10, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5L_find_class_idx(H5L_type_t id)
+{
+ size_t i; /* Local index variable */
+ int ret_value=FAIL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5L_find_class_idx)
+
+ for (i=0; i<H5L_table_used_g; i++)
+ if (H5L_table_g[i].id == id)
+ HGOTO_DONE((int)i)
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_find_class_idx */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_find_class
+ *
+ * Purpose: Given a link class ID return a pointer to a global struct that
+ * defines the link class.
+ *
+ * Return: Success: Ptr to entry in global link class table.
+ * Failure: NULL
+ *
+ * Programmer: James Laird
+ * Monday, July 10, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+const H5L_class_t *
+H5L_find_class(H5L_type_t id)
+{
+ int idx; /* Filter index in global table */
+ H5L_class_t *ret_value=NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5L_find_class, NULL)
+
+ /* Get the index in the global table */
+ if((idx=H5L_find_class_idx(id))<0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, NULL, "unable to find link class")
+
+ /* Set return value */
+ ret_value=H5L_table_g+idx;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_find_class */
+
/*-------------------------------------------------------------------------
* Function: H5L_register
@@ -1253,7 +1243,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name,
H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id, hid_t lapl_id,
hid_t dxpl_id)
@@ -1267,7 +1257,7 @@ H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name,
hbool_t loc_valid = FALSE;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5L_create_hard)
+ FUNC_ENTER_NOAPI(H5L_create_hard, FAIL)
/* Check args */
HDassert(cur_loc);
@@ -1320,7 +1310,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5L_create_soft
*
- * Purpose: Creates a soft link from NEW_NAME to CUR_NAME.
+ * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1329,15 +1319,15 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5L_create_soft( const char *target_path, H5G_loc_t *link_loc,
- const char *link_name, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id)
+herr_t
+H5L_create_soft(const char *target_path, H5G_loc_t *link_loc,
+ const char *link_name, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id)
{
char *norm_target = NULL; /* Pointer to normalized current name */
H5O_link_t lnk; /* Link to insert */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5L_create_soft)
+ FUNC_ENTER_NOAPI(H5L_create_soft, FAIL)
/* Check args */
HDassert(link_loc);
@@ -1835,7 +1825,7 @@ H5L_move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk,
/* Set up user data for move_dest_cb */
if((udata_out.lnk = H5O_copy(H5O_LINK_ID, lnk, NULL)) == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link to be moved");
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link to be moved")
/* In this special case, the link's name is going to be replaced at its
* destination, so we should free it here.
*/
@@ -1915,10 +1905,10 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5L_move(H5G_loc_t *src_loc, const char *src_name, H5G_loc_t *dst_loc,
- const char *dst_name, hbool_t copy_flag, hid_t lcpl_id,
- hid_t lapl_id, hid_t dxpl_id)
+ const char *dst_name, hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id,
+ hid_t dxpl_id)
{
unsigned target_flags = H5G_TARGET_MOUNT|H5G_TARGET_SLINK|H5G_TARGET_UDLINK;
H5T_cset_t char_encoding = H5F_DEFAULT_CSET; /* Character encoding for link */
@@ -1939,36 +1929,34 @@ H5L_move(H5G_loc_t *src_loc, const char *src_name, H5G_loc_t *dst_loc,
/* Check for flags present in creation property list */
if(lcpl_id != H5P_DEFAULT)
{
- unsigned crt_intmd_group;
+ unsigned crt_intmd_group;
- if(NULL == (lc_plist = H5I_object(lcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ if(NULL == (lc_plist = H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
- /* Get intermediate group creation property */
- if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &crt_intmd_group) <
-0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups")
+ /* Get intermediate group creation property */
+ if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &crt_intmd_group) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups")
- if (crt_intmd_group > 0)
- target_flags |= H5G_CRT_INTMD_GROUP;
+ if(crt_intmd_group > 0)
+ target_flags |= H5G_CRT_INTMD_GROUP;
- /* Get character encoding property */
- if(H5P_get(lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &char_encoding) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for character encoding")
+ /* Get character encoding property */
+ if(H5P_get(lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &char_encoding) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for character encoding")
} /* end if */
/* Copy the link access property list because traversing UD links will
* decrease the NLINKS property. HDF5 should have NLINKS traversals to
* get to the source and NLINKS more to get to the destination. */
- if(lapl_id == H5P_DEFAULT) {
+ if(lapl_id == H5P_DEFAULT)
lapl_copy = lapl_id;
- }
else {
- if (NULL==(la_plist=H5I_object(lapl_id)))
+ if(NULL == (la_plist = H5I_object(lapl_id)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid access PL")
- if((lapl_copy=H5P_copy_plist(la_plist)) < 0)
+ if((lapl_copy = H5P_copy_plist(la_plist)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy access properties")
- }
+ } /* end else */
/* Set up user data */
udata.dst_loc = dst_loc;