summaryrefslogtreecommitdiffstats
path: root/src/H5Glink.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Glink.c')
-rw-r--r--src/H5Glink.c195
1 files changed, 33 insertions, 162 deletions
diff --git a/src/H5Glink.c b/src/H5Glink.c
index c2334cc..f934052 100644
--- a/src/H5Glink.c
+++ b/src/H5Glink.c
@@ -63,6 +63,11 @@
/* Local Prototypes */
/********************/
+static int H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2);
+static int H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2);
+static int H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2);
+static int H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2);
+
/*********************/
/* Package Variables */
@@ -98,7 +103,7 @@
*
*-------------------------------------------------------------------------
*/
-int
+static int
H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -125,7 +130,7 @@ H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2)
*
*-------------------------------------------------------------------------
*/
-int
+static int
H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -151,7 +156,7 @@ H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2)
*
*-------------------------------------------------------------------------
*/
-int
+static int
H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2)
{
int ret_value; /* Return value */
@@ -186,7 +191,7 @@ H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2)
*
*-------------------------------------------------------------------------
*/
-int
+static int
H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2)
{
int ret_value; /* Return value */
@@ -205,7 +210,7 @@ H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2)
/*-------------------------------------------------------------------------
- * Function: H5G_ent_to_link
+ * Function: H5G__ent_to_link
*
* Purpose: Convert a symbol table entry to a link
*
@@ -218,10 +223,10 @@ H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2)
*-------------------------------------------------------------------------
*/
herr_t
-H5G_ent_to_link(H5O_link_t *lnk, const H5HL_t *heap,
+H5G__ent_to_link(H5O_link_t *lnk, const H5HL_t *heap,
const H5G_entry_t *ent, const char *name)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* check arguments */
HDassert(lnk);
@@ -258,7 +263,7 @@ H5G_ent_to_link(H5O_link_t *lnk, const H5HL_t *heap,
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5G_ent_to_link() */
+} /* end H5G__ent_to_link() */
/*-------------------------------------------------------------------------
@@ -338,7 +343,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G_link_to_loc
+ * Function: H5G__link_to_loc
*
* Purpose: Build group location from group and link object
*
@@ -350,12 +355,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
+H5G__link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
H5G_loc_t *obj_loc)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(grp_loc);
@@ -382,145 +387,11 @@ H5G_link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_link_to_loc() */
+} /* end H5G__link_to_loc() */
/*-------------------------------------------------------------------------
- * Function: H5G_link_copy_file
- *
- * Purpose: Copy a link and the object it points to from one file to
- * another.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Sep 29 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5G_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk,
- const H5O_loc_t *src_oloc, H5O_link_t *dst_lnk, H5O_copy_t *cpy_info)
-{
- H5O_link_t tmp_src_lnk; /* Temporary copy of src link, when needed */
- const H5O_link_t *src_lnk = _src_lnk; /* Source link */
- hbool_t dst_lnk_init = FALSE; /* Whether the destination link is initialized */
- hbool_t expanded_link_open = FALSE; /* Whether the target location has been opened */
- H5G_loc_t tmp_src_loc; /* Group location holding target object */
- H5G_name_t tmp_src_path; /* Path for target object */
- H5O_loc_t tmp_src_oloc; /* Object location for target object */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* check arguments */
- HDassert(dst_file);
- HDassert(src_lnk);
- HDassert(dst_lnk);
- HDassert(cpy_info);
-
- /* Expand soft or external link, if requested */
- if((H5L_TYPE_SOFT == src_lnk->type && cpy_info->expand_soft_link)
- || (H5L_TYPE_EXTERNAL == src_lnk->type
- && cpy_info->expand_ext_link)) {
- H5G_loc_t lnk_grp_loc; /* Group location holding link */
- H5G_name_t lnk_grp_path; /* Path for link */
- htri_t tar_exists; /* Whether the target object exists */
-
- /* Set up group location for link */
- H5G_name_reset(&lnk_grp_path);
- lnk_grp_loc.path = &lnk_grp_path;
- lnk_grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Casting away const OK -QAK */
-
- /* Check if the target object exists */
- if((tar_exists = H5G_loc_exists(&lnk_grp_loc, src_lnk->name, H5P_DEFAULT,
- dxpl_id)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to check if target object exists")
-
- if(tar_exists) {
- /* Make a temporary copy of the link, so that it will not change the
- * info in the cache when we change it to a hard link */
- if(NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, &tmp_src_lnk))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy message")
-
- /* Set up group location for target object. Let H5G_traverse expand
- * the link. */
- tmp_src_loc.path = &tmp_src_path;
- tmp_src_loc.oloc = &tmp_src_oloc;
- if(H5G_loc_reset(&tmp_src_loc) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to reset location")
-
- /* Find the target object */
- if(H5G_loc_find(&lnk_grp_loc, src_lnk->name, &tmp_src_loc,
- H5P_DEFAULT, dxpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to find target object")
- expanded_link_open = TRUE;
-
- /* Convert symbolic link to hard link */
- if(tmp_src_lnk.type == H5L_TYPE_SOFT)
- tmp_src_lnk.u.soft.name =
- (char *)H5MM_xfree(tmp_src_lnk.u.soft.name);
- else if(tmp_src_lnk.u.ud.size > 0)
- tmp_src_lnk.u.ud.udata = H5MM_xfree(tmp_src_lnk.u.ud.udata);
- tmp_src_lnk.type = H5L_TYPE_HARD;
- tmp_src_lnk.u.hard.addr = tmp_src_oloc.addr;
- src_lnk = &tmp_src_lnk;
- } /* end if */
- } /* end if */
-
- /* Copy src link information to dst link information */
- if(NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, dst_lnk))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy message")
- dst_lnk_init = TRUE;
-
- /* Check if object in source group is a hard link & copy it */
- if(H5L_TYPE_HARD == src_lnk->type) {
- H5O_loc_t new_dst_oloc; /* Copied object location in destination */
-
- /* Set up copied object location to fill in */
- H5O_loc_reset(&new_dst_oloc);
- new_dst_oloc.file = dst_file;
-
- if(!expanded_link_open) {
- /* Build temporary object location for source */
- H5O_loc_reset(&tmp_src_oloc);
- tmp_src_oloc.file = src_oloc->file;
- tmp_src_oloc.addr = src_lnk->u.hard.addr;
- } /* end if */
- HDassert(H5F_addr_defined(tmp_src_oloc.addr));
-
- /* Copy the shared object from source to destination */
- /* Don't care about obj_type or udata because those are only important
- * for old style groups */
- if(H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, dxpl_id, cpy_info,
- TRUE, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
-
- /* Copy new destination object's information for eventual insertion */
- dst_lnk->u.hard.addr = new_dst_oloc.addr;
- } /* end if */
-
-done:
- /* Check if we used a temporary src link */
- if(src_lnk != _src_lnk) {
- HDassert(src_lnk == &tmp_src_lnk);
- H5O_msg_reset(H5O_LINK_ID, &tmp_src_lnk);
- } /* end if */
- if(ret_value < 0)
- if(dst_lnk_init)
- H5O_msg_reset(H5O_LINK_ID, dst_lnk);
- /* Check if we need to free the temp source oloc */
- if(expanded_link_open)
- if(H5G_loc_free(&tmp_src_loc) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free object")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_link_copy_file() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G_link_sort_table
+ * Function: H5G__link_sort_table
*
* Purpose: Sort table containing a list of links for a group
*
@@ -533,10 +404,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type,
+H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type,
H5_iter_order_t order)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(ltable);
@@ -561,11 +432,11 @@ H5G_link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type,
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5G_link_sort_table() */
+} /* end H5G__link_sort_table() */
/*-------------------------------------------------------------------------
- * Function: H5G_link_iterate_table
+ * Function: H5G__link_iterate_table
*
* Purpose: Iterate over table containing a list of links for a group,
* making appropriate callbacks
@@ -579,13 +450,13 @@ H5G_link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type,
*-------------------------------------------------------------------------
*/
herr_t
-H5G_link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip,
+H5G__link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip,
hsize_t *last_lnk, const H5G_lib_iterate_t op, void *op_data)
{
size_t u; /* Local index variable */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(ltable);
@@ -611,11 +482,11 @@ H5G_link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip,
HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_link_iterate_table() */
+} /* end H5G__link_iterate_table() */
/*-------------------------------------------------------------------------
- * Function: H5G_link_release_table
+ * Function: H5G__link_release_table
*
* Purpose: Release table containing a list of links for a group
*
@@ -628,12 +499,12 @@ H5G_link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip,
*-------------------------------------------------------------------------
*/
herr_t
-H5G_link_release_table(H5G_link_table_t *ltable)
+H5G__link_release_table(H5G_link_table_t *ltable)
{
size_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(ltable);
@@ -653,11 +524,11 @@ H5G_link_release_table(H5G_link_table_t *ltable)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_link_release_table() */
+} /* end H5G__link_release_table() */
/*-------------------------------------------------------------------------
- * Function: H5G_link_name_replace
+ * Function: H5G__link_name_replace
*
* Purpose: Determine the type of object referred to (for hard links) or
* the link type (for soft links and user-defined links).
@@ -671,13 +542,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_link_name_replace(H5F_t *file, hid_t dxpl_id, H5RS_str_t *grp_full_path_r,
+H5G__link_name_replace(H5F_t *file, hid_t dxpl_id, H5RS_str_t *grp_full_path_r,
const H5O_link_t *lnk)
{
H5RS_str_t *obj_path_r = NULL; /* Full path for link being removed */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* check arguments */
HDassert(file);
@@ -694,5 +565,5 @@ done:
H5RS_decr(obj_path_r);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_link_name_replace() */
+} /* end H5G__link_name_replace() */