summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/h5_extlink.c6
-rw-r--r--release_docs/RELEASE.txt2
-rw-r--r--src/H5Gdeprec.c22
-rw-r--r--src/H5Gloc.c2
-rw-r--r--src/H5Gname.c4
-rw-r--r--src/H5Gprivate.h2
-rw-r--r--src/H5L.c48
-rw-r--r--src/H5Lprivate.h6
-rw-r--r--src/H5Lpublic.h2
-rw-r--r--test/links.c32
10 files changed, 67 insertions, 59 deletions
diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c
index 33cac8e..7cca31e 100644
--- a/examples/h5_extlink.c
+++ b/examples/h5_extlink.c
@@ -370,8 +370,8 @@ void hard_link_example(void)
* other two links to that group and it won't be deleted until the
* UD hard link is deleted.
*/
- H5Lunlink(file_id, TARGET_GROUP, H5P_DEFAULT);
- H5Lunlink(file_id, HARD_LINK_NAME, H5P_DEFAULT);
+ H5Ldelete(file_id, TARGET_GROUP, H5P_DEFAULT);
+ H5Ldelete(file_id, HARD_LINK_NAME, H5P_DEFAULT);
/* The group is still accessible through the UD hard link. If this were
* a soft link instead, the object would have been deleted when the last
@@ -382,7 +382,7 @@ void hard_link_example(void)
H5Gclose(group_id);
/* Removing the user-defined hard link will delete the group. */
- H5Lunlink(file_id, UD_HARD_LINK_NAME, H5P_DEFAULT);
+ H5Ldelete(file_id, UD_HARD_LINK_NAME, H5P_DEFAULT);
H5Fclose(file_id);
}
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 3f7b5dd..3575d3b 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -209,7 +209,7 @@ New Features
H5Lcopy - copy a link without copying the underlying object
H5Lcreate_hard - like H5Glink2 for hard links
H5Lcreate_soft - like H5Glink2 for soft links
- H5Lunlink - just like H5Gunlink
+ H5Ldelete - just like H5Gunlink
H5Lget_val - just link H5Gget_linkval
H5Lget_info - gets link-specific info (like H5Gget_objinfo)
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index 9f8a39f..fc74bcf 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -151,20 +151,28 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Gunlink
*
- * Purpose: Removes a link. The new API is H5Lunlink.
+ * Purpose: Removes a link. The new API is H5Ldelete.
*
*-------------------------------------------------------------------------
*/
herr_t
H5Gunlink(hid_t loc_id, const char *name)
{
- herr_t ret_value;
+ H5G_loc_t loc; /* Group's location */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Gunlink, FAIL)
H5TRACE2("e","is",loc_id,name);
- if((ret_value = H5Lunlink(loc_id, name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "Couldn't delete link")
+ /* 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")
done:
FUNC_LEAVE_API(ret_value)
@@ -182,8 +190,8 @@ done:
herr_t
H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
{
- H5G_loc_t loc;
- herr_t ret_value = SUCCEED;
+ H5G_loc_t loc; /* Group's location */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Gget_linkval, FAIL)
H5TRACE4("e","iszx",loc_id,name,size,buf);
@@ -195,7 +203,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Call the new link routine which provides this capability */
- if(H5L_get_val(&loc, name, size, buf, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if(H5L_get_val(&loc, name, size, buf, H5P_DEFAULT, H5AC_ind_dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info")
done:
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index d683eff..24cfddb 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -459,7 +459,7 @@ H5G_loc_remove(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, hid_t d
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "component not found")
/* Search the open IDs and replace names for unlinked object */
- if(H5G_name_replace(obj_type, obj_loc, NULL, NULL, H5G_NAME_UNLINK) < 0)
+ if(H5G_name_replace(obj_type, obj_loc, NULL, NULL, H5G_NAME_DELETE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to replace name")
done:
diff --git a/src/H5Gname.c b/src/H5Gname.c
index e338c3f..d26c74b 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -823,10 +823,10 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
break;
/*-------------------------------------------------------------------------
- * H5G_NAME_UNLINK
+ * H5G_NAME_DELETE
*-------------------------------------------------------------------------
*/
- case H5G_NAME_UNLINK:
+ case H5G_NAME_DELETE:
/* Check if the location being unlinked is in the path for the current object */
if(H5G_common_path(obj_path->full_path_r, names->loc->path->full_path_r)) {
/* Free paths for object */
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 80a1df9..22013cf 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -103,7 +103,7 @@
/* Type of operation being performed for call to H5G_name_replace() */
typedef enum {
H5G_NAME_MOVE = 0, /* H5*move call */
- H5G_NAME_UNLINK, /* H5Lunlink call */
+ H5G_NAME_DELETE, /* H5Ldelete call */
H5G_NAME_MOUNT, /* H5Fmount call */
H5G_NAME_UNMOUNT /* H5Funmount call */
} H5G_names_op_t;
diff --git a/src/H5L.c b/src/H5L.c
index 09582b0..ee68517 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -110,11 +110,9 @@ static herr_t H5L_create_soft(const char *target_path, H5G_loc_t *cur_loc,
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_unlink_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
+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_unlink(H5G_loc_t *loc, const char *name, hid_t lapl_id,
- hid_t dxpl_id);
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);
@@ -689,7 +687,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lunlink
+ * Function: H5Ldelete
*
* Purpose: Removes the specified NAME from the group graph and
* decrements the link count for the object to which NAME
@@ -706,12 +704,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Lunlink(hid_t loc_id, const char *name, hid_t lapl_id)
+H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5G_loc_t loc;
- herr_t ret_value=SUCCEED; /* Return value */
+ H5G_loc_t loc; /* Group's location */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Lunlink, FAIL)
+ FUNC_ENTER_API(H5Ldelete, FAIL)
H5TRACE3("e","isi",loc_id,name,lapl_id);
/* Check arguments */
@@ -721,12 +719,12 @@ H5Lunlink(hid_t loc_id, const char *name, hid_t lapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
/* Unlink */
- if(H5L_unlink(&loc, name, lapl_id, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to unlink object")
+ if(H5L_delete(&loc, name, lapl_id, H5AC_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delet link")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Lunlink() */
+} /* end H5Ldelete() */
/*-------------------------------------------------------------------------
@@ -1522,7 +1520,7 @@ H5L_get_val(H5G_loc_t *loc, const char *name, size_t size, void *buf/*out*/, hid
H5L_trav_ud4_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5L_get_val)
+ FUNC_ENTER_NOAPI(H5L_get_val, FAIL)
/* Set up user data for retrieving information */
udata.size = size;
@@ -1538,10 +1536,10 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L_unlink_cb
+ * Function: H5L_delete_cb
*
- * Purpose: Callback for unlinking an object. This routine
- * deletes the link
+ * Purpose: Callback for deleting a link. This routine
+ * actually deletes the link
*
* Return: Non-negative on success/Negative on failure
*
@@ -1551,7 +1549,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5L_unlink_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED *lnk,
+H5L_delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED *lnk,
H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/)
{
H5G_t *grp=NULL; /* H5G_t for this group, opened to pass to user callback */
@@ -1561,7 +1559,7 @@ H5L_unlink_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSE
hbool_t temp_loc_init = FALSE;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT(H5L_unlink_cb)
+ FUNC_ENTER_NOAPI_NOINIT(H5L_delete_cb)
/* Check if the name in this group resolved to a valid link */
if(obj_loc == NULL)
@@ -1623,13 +1621,13 @@ done:
*own_loc = H5G_OWN_NONE;
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_unlink_cb() */
+} /* end H5L_delete_cb() */
/*-------------------------------------------------------------------------
- * Function: H5L_unlink
+ * Function: H5L_delete
*
- * Purpose: Unlink a name from a group.
+ * Purpose: Delete a link from a group.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1638,14 +1636,14 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5L_unlink(H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id)
+herr_t
+H5L_delete(H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id)
{
H5L_trav_ud5_t udata; /* User data for callback */
char *norm_name = NULL; /* Pointer to normalized name */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5L_unlink)
+ FUNC_ENTER_NOAPI(H5L_delete, FAIL)
/* Sanity check */
HDassert(loc);
@@ -1658,7 +1656,7 @@ H5L_unlink(H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id)
/* Set up user data for unlink operation */
udata.dxpl_id = dxpl_id;
- if(H5G_traverse(loc, norm_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT, H5L_unlink_cb, &udata, lapl_id, dxpl_id) < 0)
+ if(H5G_traverse(loc, norm_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT, H5L_delete_cb, &udata, lapl_id, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist")
done:
@@ -1667,7 +1665,7 @@ done:
H5MM_xfree(norm_name);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_unlink() */
+} /* end H5L_delete() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h
index d70835c..2ce5e48 100644
--- a/src/H5Lprivate.h
+++ b/src/H5Lprivate.h
@@ -23,8 +23,8 @@
#include "H5Lpublic.h"
/* Private headers needed by this file */
-#include "H5Gprivate.h"
-#include "H5Oprivate.h"
+#include "H5Gprivate.h" /* Groups */
+#include "H5Oprivate.h" /* Object headers */
/**************************/
/* Library Private Macros */
@@ -61,6 +61,8 @@ H5_DLL herr_t H5L_link(H5G_loc_t *new_loc, const char *new_name,
H5_DLL hid_t H5L_get_default_lcpl(void);
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_get_val(H5G_loc_t *loc, const char *name, size_t size,
void *buf/*out*/, hid_t lapl_id, hid_t dxpl_id);
H5_DLL herr_t H5L_register_external(void);
diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h
index 64955ca..e944965 100644
--- a/src/H5Lpublic.h
+++ b/src/H5Lpublic.h
@@ -139,7 +139,7 @@ H5_DLL herr_t H5Lcreate_hard(hid_t cur_loc, const char *cur_name,
hid_t lapl_id);
H5_DLL herr_t H5Lcreate_soft(const char *target_path, hid_t cur_loc,
const char *cur_name, hid_t lcpl_id, hid_t lapl_id);
-H5_DLL herr_t H5Lunlink(hid_t loc_id, const char *name, hid_t lapl_id);
+H5_DLL herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id);
H5_DLL herr_t H5Lget_val(hid_t loc_id, const char *name, size_t size,
void *buf/*out*/, hid_t lapl_id);
H5_DLL herr_t H5Lget_info(hid_t loc_id, const char *name,
diff --git a/test/links.c b/test/links.c
index bf15bc6..4785ac01 100644
--- a/test/links.c
+++ b/test/links.c
@@ -1945,7 +1945,7 @@ external_link_mult(hid_t fapl, hbool_t new_format)
/* Open the other with write access and delete the external link in it */
if((fid2=H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
- if(H5Lunlink(fid2, "G/H/I", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(fid2, "G/H/I", H5P_DEFAULT) < 0) TEST_ERROR
if(H5Fclose(fid2) < 0) TEST_ERROR
@@ -3429,11 +3429,11 @@ external_link_closing(hid_t fapl, hbool_t new_format)
if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (-1)) < 0) TEST_ERROR
/* Test unlink */
- if(H5Lunlink(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lunlink(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lunlink(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lunlink(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lunlink(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR
/* We've tested that the various functions above don't leave files open.
* Now test that we can't confuse HDF5 by giving unusual paths with external links
@@ -4923,8 +4923,8 @@ lapl_nlinks(hid_t fapl, hbool_t new_format)
if(H5Lcreate_hard(fid, "soft17", fid, "soft17/link2_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR
if(H5Lcreate_soft("/soft4", fid, "soft17/soft_link", H5P_DEFAULT, plist) < 0) TEST_ERROR
- /* H5Lunlink */
- if(H5Lunlink(fid, "soft17/soft_link", plist) < 0) TEST_ERROR
+ /* H5Ldelete */
+ if(H5Ldelete(fid, "soft17/soft_link", plist) < 0) TEST_ERROR
/* H5Lget_val and H5Lget_info */
if(H5Lget_val(fid, "soft17", (size_t)0, NULL, plist) < 0) TEST_ERROR
@@ -5639,7 +5639,7 @@ corder_transition(hid_t fapl)
/* Delete several links from group, until it resumes compact form */
for(u = max_compact; u >= min_dense; u--) {
sprintf(objname, "filler %u", u);
- if(H5Lunlink(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify state of group */
if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR
@@ -5653,7 +5653,7 @@ corder_transition(hid_t fapl)
/* Delete another link, to push group into compact form */
sprintf(objname, "filler %u", (min_dense - 1));
- if(H5Lunlink(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify state of group */
if(H5G_has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR
@@ -5702,7 +5702,7 @@ corder_transition(hid_t fapl)
/* Delete several links from group, until it resumes compact form */
for(u = max_compact; u >= min_dense; u--) {
sprintf(objname, "filler %u", u);
- if(H5Lunlink(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify state of group */
if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR
@@ -5716,7 +5716,7 @@ corder_transition(hid_t fapl)
/* Delete another link, to push group into compact form */
sprintf(objname, "filler %u", (min_dense - 1));
- if(H5Lunlink(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify state of group */
if(H5G_has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR
@@ -5743,10 +5743,10 @@ corder_transition(hid_t fapl)
/* Delete all the links */
for(u = max_compact; u > 0; u--) {
sprintf(objname, "filler %u", u);
- if(H5Lunlink(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
} /* end for */
sprintf(objname, "filler %u", 0);
- if(H5Lunlink(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
/* Close the group */
if(H5Gclose(group_id) < 0) TEST_ERROR
@@ -5866,7 +5866,7 @@ corder_delete(hid_t fapl)
/* Check for deleting group without re-opening file */
if(!reopen_file)
/* Delete the group with the creation order index */
- if(H5Lunlink(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Ldelete(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Close the file */
if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR
@@ -5877,7 +5877,7 @@ corder_delete(hid_t fapl)
if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
/* Delete the group with the creation order index */
- if(H5Lunlink(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Ldelete(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Close the file */
if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR