summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-11-13 15:00:06 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-11-13 15:00:06 (GMT)
commit3f25d6c6d1ae867a93ea904fe9bbf0f744ac052c (patch)
tree14b4fca4690d97018a4c3c92da8a075812e92b1e /src
parent2355d25955756f689f68bc6d8681116e2a41a5a6 (diff)
downloadhdf5-3f25d6c6d1ae867a93ea904fe9bbf0f744ac052c.zip
hdf5-3f25d6c6d1ae867a93ea904fe9bbf0f744ac052c.tar.gz
hdf5-3f25d6c6d1ae867a93ea904fe9bbf0f744ac052c.tar.bz2
[svn-r12895] Description:
Add new H5Lget_val_by_idx() routine & tests. Also includes most of changes for H5Ldelete_by_idx() routine. Tested on: Mac OS X/32 10.4.8 (amazon) FreeBSD/32 4.11 (sleipnir) Linux/32 2.4 (heping) Linux/64 2.4 (mir) AIX/32 5.? (copper)
Diffstat (limited to 'src')
-rw-r--r--src/H5Gdeprec.c2
-rw-r--r--src/H5Gloc.c6
-rw-r--r--src/H5Gobj.c135
-rw-r--r--src/H5L.c553
-rw-r--r--src/H5Lprivate.h4
-rw-r--r--src/H5Lpublic.h9
6 files changed, 544 insertions, 165 deletions
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index af7982c..72a5dae 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -422,7 +422,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, H5AC_ind_dxpl_id) < 0)
+ if(H5L_get_val(&loc, name, buf, size, 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 24cfddb..f33680a 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -443,7 +443,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_loc_remove(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, hid_t dxpl_id)
+H5G_loc_remove(H5G_loc_t *grp_loc, const char *link_name, H5G_loc_t *obj_loc, hid_t dxpl_id)
{
H5G_obj_t obj_type; /* Type of object removed */
herr_t ret_value = SUCCEED; /* Return value */
@@ -452,10 +452,10 @@ H5G_loc_remove(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, hid_t d
/* Check args. */
HDassert(grp_loc);
- HDassert(name && *name);
+ HDassert(link_name && *link_name);
/* Remove object from group */
- if(H5G_obj_remove(grp_loc->oloc, name, &obj_type, dxpl_id) < 0)
+ if(H5G_obj_remove(grp_loc->oloc, link_name, &obj_type, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "component not found")
/* Search the open IDs and replace names for unlinked object */
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 2f51758..a5cea7e 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -993,7 +993,6 @@ H5G_obj_remove(H5O_loc_t *oloc, const char *name, H5G_obj_t *obj_type, hid_t dxp
{
H5O_linfo_t linfo; /* Link info message */
hbool_t use_old_format; /* Whether to use 'old format' (symbol table) for deletion or not */
- hbool_t use_new_dense = FALSE; /* Whether to use "dense" form of 'new format' group */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_remove, FAIL)
@@ -1008,73 +1007,8 @@ H5G_obj_remove(H5O_loc_t *oloc, const char *name, H5G_obj_t *obj_type, hid_t dxp
/* Using the new format for groups */
use_old_format = FALSE;
- /* Check for deleting enough links from group to go back to link messages */
+ /* Check for dense or compact storage */
if(H5F_addr_defined(linfo.link_fheap_addr)) {
- H5O_ginfo_t ginfo; /* Group info message */
-
- /* Get the group info */
- if(NULL == H5O_read(oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
-
- /* Check if we should switch from dense storage back to link messages */
- if(linfo.nlinks <= ginfo.min_dense) {
- H5G_link_table_t ltable; /* Table of links */
- hbool_t can_convert = TRUE; /* Whether converting to link messages is possible */
- size_t u; /* Local index */
-
- /* Build the table of links for this group */
- if(H5G_dense_build_table(oloc->file, dxpl_id, &linfo, H5L_INDEX_NAME, H5_ITER_NATIVE, &ltable) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links")
-
- /* Inspect links in table for ones that can't be converted back
- * into link message form (currently only links which can't fit
- * into an object header message)
- */
- for(u = 0; u < linfo.nlinks; u++)
- if(H5O_mesg_size(H5O_LINK_ID, oloc->file, &(ltable.lnks[u]), (size_t)0) >= H5O_MESG_MAX_SIZE) {
- can_convert = FALSE;
- break;
- } /* end if */
-
- /* If ok, insert links as link messages */
- if(can_convert) {
- /* Insert link messages into group */
- for(u = 0; u < linfo.nlinks; u++)
- if(H5O_modify(oloc, H5O_LINK_ID, H5O_NEW_MESG, 0, H5O_UPDATE_TIME, &(ltable.lnks[u]), dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
-
- /* Remove the dense storage */
- if(H5G_dense_delete(oloc->file, dxpl_id, &linfo, FALSE) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete dense link storage")
-
- use_new_dense = FALSE;
- } /* end if */
- else
- use_new_dense = TRUE;
-
- /* Free link table information */
- if(H5G_obj_release_table(&ltable) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
- } /* end if */
- else
- use_new_dense = TRUE;
- } /* end if */
- else
- use_new_dense = FALSE;
- } /* end if */
- else {
- H5E_clear_stack(NULL); /* Clear error stack from not finding the link info message */
- use_old_format = TRUE;
- } /* end else */
-
- /* If the symbol table doesn't exist, search link messages */
- if(use_old_format) {
- /* Remove object from the symbol table */
- if(H5G_stab_remove(oloc, name, obj_type, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object")
- } /* end if */
- else {
- if(use_new_dense) {
/* Remove object from the dense link storage */
if(H5G_dense_remove(oloc->file, dxpl_id, &linfo, name, obj_type) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object")
@@ -1084,6 +1018,17 @@ H5G_obj_remove(H5O_loc_t *oloc, const char *name, H5G_obj_t *obj_type, hid_t dxp
if(H5G_link_remove(oloc, name, obj_type, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object")
} /* end else */
+ } /* end if */
+ else {
+ /* Clear error stack from not finding the link info message */
+ H5E_clear_stack(NULL);
+
+ /* Using the old format for groups */
+ use_old_format = TRUE;
+
+ /* Remove object from the symbol table */
+ if(H5G_stab_remove(oloc, name, obj_type, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object")
} /* end else */
/* Update link info for a new-style group */
@@ -1091,10 +1036,58 @@ H5G_obj_remove(H5O_loc_t *oloc, const char *name, H5G_obj_t *obj_type, hid_t dxp
/* Decrement # of links in group */
linfo.nlinks--;
- /* Remove the dense link storage, if we are using it and the number of links drops to zero */
- if(linfo.nlinks == 0 && use_new_dense) {
- if(H5G_dense_delete(oloc->file, dxpl_id, &linfo, FALSE) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete dense link storage")
+ /* Check for transitioning out of dense storage, if we are using it */
+ if(H5F_addr_defined(linfo.link_fheap_addr)) {
+ /* If there's no more links, delete the dense storage */
+ if(linfo.nlinks == 0) {
+ if(H5G_dense_delete(oloc->file, dxpl_id, &linfo, FALSE) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete dense link storage")
+ } /* end if */
+ /* Check for switching back to compact storage */
+ else {
+ H5O_ginfo_t ginfo; /* Group info message */
+
+ /* Get the group info */
+ if(NULL == H5O_read(oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
+
+ /* Check if we should switch from dense storage back to link messages */
+ if(linfo.nlinks < ginfo.min_dense) {
+ H5G_link_table_t ltable; /* Table of links */
+ hbool_t can_convert = TRUE; /* Whether converting to link messages is possible */
+ size_t u; /* Local index */
+
+ /* Build the table of links for this group */
+ if(H5G_dense_build_table(oloc->file, dxpl_id, &linfo, H5L_INDEX_NAME, H5_ITER_NATIVE, &ltable) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links")
+
+ /* Inspect links in table for ones that can't be converted back
+ * into link message form (currently only links which can't fit
+ * into an object header message)
+ */
+ for(u = 0; u < linfo.nlinks; u++)
+ if(H5O_mesg_size(H5O_LINK_ID, oloc->file, &(ltable.lnks[u]), (size_t)0) >= H5O_MESG_MAX_SIZE) {
+ can_convert = FALSE;
+ break;
+ } /* end if */
+
+ /* If ok, insert links as link messages */
+ if(can_convert) {
+ /* Insert link messages into group */
+ for(u = 0; u < linfo.nlinks; u++)
+ if(H5O_modify(oloc, H5O_LINK_ID, H5O_NEW_MESG, 0, H5O_UPDATE_TIME, &(ltable.lnks[u]), dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
+
+ /* Remove the dense storage */
+ if(H5G_dense_delete(oloc->file, dxpl_id, &linfo, FALSE) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete dense link storage")
+ } /* end if */
+
+ /* Free link table information */
+ if(H5G_obj_release_table(&ltable) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
+ } /* end if */
+ } /* end else */
} /* end if */
/* Update link info in the object header */
diff --git a/src/H5L.c b/src/H5L.c
index 0d2669f..1dff29d 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -51,8 +51,20 @@
/* User data for path traversal routine for getting link info by name */
typedef struct {
H5L_info_t *linfo; /* Buffer to return to user */
- hid_t dxpl_id; /* dxpl to use in callback */
-} H5L_trav_ud1_t;
+ hid_t dxpl_id; /* DXPL to use in callback */
+} H5L_trav_gi_t;
+
+/* User data for path traversal routine for getting link info by index */
+typedef struct {
+ /* In */
+ H5L_index_t idx_type; /* Index to use */
+ H5_iter_order_t order; /* Order to iterate in index */
+ hsize_t n; /* Offset of link within index */
+ hid_t dxpl_id; /* DXPL to use in callback */
+
+ /* Out */
+ H5L_info_t *linfo; /* Buffer to return to user */
+} H5L_trav_gibi_t;
/* User data for path traversal callback to creating a link */
typedef struct {
@@ -61,7 +73,7 @@ typedef struct {
hid_t lcpl_id; /* Link creation property list */
H5G_name_t *path; /* Path to object being linked */
H5O_link_t *lnk; /* Pointer to link information to insert */
-} H5L_trav_ud2_t;
+} H5L_trav_cr_t;
/* User data for path traversal routine for moving and renaming a link */
typedef struct {
@@ -69,20 +81,9 @@ typedef struct {
H5T_cset_t cset; /* Char set for new name */
H5G_loc_t *dst_loc; /* Destination location for moving object */
hbool_t copy; /* TRUE if this is a copy operation */
- hid_t lapl_id; /* lapl to use in callback */
- hid_t dxpl_id; /* dxpl to use in callback */
-} H5L_trav_ud3_t;
-
-/* User data for path traversal routine for getting soft link value */
-typedef struct {
- size_t size; /* Size of user buffer */
- void *buf; /* User buffer */
-} H5L_trav_ud4_t;
-
-/* User data for path traversal routine for removing link (i.e. unlink) */
-typedef struct {
- hid_t dxpl_id; /* Dataset transfer property list */
-} H5L_trav_ud5_t;
+ hid_t lapl_id; /* LAPL to use in callback */
+ hid_t dxpl_id; /* DXPL to use in callback */
+} H5L_trav_mv_t;
/* User data for path traversal routine for moving and renaming an object */
typedef struct {
@@ -90,19 +91,40 @@ typedef struct {
H5O_link_t *lnk; /* Pointer to link information to insert */
hbool_t copy; /* TRUE if this is a copy operation */
hid_t dxpl_id; /* Dataset transfer property list */
-} H5L_trav_ud6_t;
+} H5L_trav_mv2_t;
-/* User data for path traversal routine for getting link info by index */
+/* User data for path traversal routine for getting link value */
+typedef struct {
+ size_t size; /* Size of user buffer */
+ void *buf; /* User buffer */
+} H5L_trav_gv_t;
+
+/* User data for path traversal routine for getting link value by index */
typedef struct {
/* In */
H5L_index_t idx_type; /* Index to use */
H5_iter_order_t order; /* Order to iterate in index */
hsize_t n; /* Offset of link within index */
- hid_t dxpl_id; /* dxpl to use in callback */
+ hid_t dxpl_id; /* DXPL to use in callback */
+ size_t size; /* Size of user buffer */
/* Out */
- H5L_info_t *linfo; /* Buffer to return to user */
-} H5L_trav_ud7_t;
+ void *buf; /* User buffer */
+} H5L_trav_gvbi_t;
+
+/* User data for path traversal routine for removing link */
+typedef struct {
+ hid_t dxpl_id; /* DXPL to use in callback */
+} H5L_trav_rm_t;
+
+/* User data for path traversal routine for removing link by index */
+typedef struct {
+ /* In */
+ H5L_index_t idx_type; /* Index to use */
+ H5_iter_order_t order; /* Order to iterate in index */
+ hsize_t n; /* Offset of link within index */
+ hid_t dxpl_id; /* DXPL to use in callback */
+} H5L_trav_rmbi_t;
/* User data for path traversal routine for getting name by index */
typedef struct {
@@ -111,11 +133,11 @@ typedef struct {
H5_iter_order_t order; /* Order to iterate in index */
hsize_t n; /* Offset of link within index */
size_t size; /* Size of name buffer */
- hid_t dxpl_id; /* dxpl to use in callback */
+ hid_t dxpl_id; /* DXPL to use in callback */
/* Out */
char *name; /* Buffer to return name to user */
-} H5L_trav_ud8_t;
+} H5L_trav_gnbi_t;
/********************/
/* Local Prototypes */
@@ -128,12 +150,25 @@ 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_get_val_real(const H5O_link_t *lnk, void *buf, size_t size);
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_get_val_by_idx_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_get_val_by_idx(H5G_loc_t *loc, const char *group_name,
+ H5L_index_t idx_type, H5_iter_order_t order, hsize_t n, void *buf/*out*/,
+ size_t size, hid_t lapl_id, hid_t dxpl_id);
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_delete_by_idx_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_by_idx(H5G_loc_t *loc, const char *group_name,
+ H5L_index_t idx_type, H5_iter_order_t order, hsize_t n, 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*/);
@@ -141,8 +176,8 @@ static herr_t H5L_move_dest_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_get_info_real(const H5O_link_t *lnk, H5L_info_t *linfo);
-static herr_t H5L_get_info_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
- const H5O_link_t *lnk, H5G_loc_t UNUSED *obj_loc, void *_udata/*in,out*/,
+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*/);
static herr_t H5L_get_info_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
@@ -635,6 +670,58 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Ldelete_by_idx
+ *
+ * Purpose: Removes the specified link from the group graph and
+ * decrements the link count for the object to which it
+ * points, according to the order within an index.
+ *
+ * If the link count reaches zero then all file-space
+ * associated with the object will be reclaimed (but if the
+ * object is open, then the reclamation of the file space is
+ * delayed until all handles to the object are closed).
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 13, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Ldelete_by_idx(hid_t loc_id, const char *group_name,
+ H5L_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id)
+{
+ H5G_loc_t loc; /* Group's location */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Ldelete_by_idx, FAIL)
+
+ /* 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 <= H5L_INDEX_UNKNOWN || idx_type >= H5L_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")
+
+ /* Unlink */
+ if(H5L_delete_by_idx(&loc, group_name, idx_type, order, n, lapl_id, H5AC_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Ldelete_by_idx() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Lget_val
*
* Purpose: Returns the link value of a link whose name is NAME. For
@@ -654,23 +741,28 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Lget_val(hid_t loc_id, const char *name, size_t size, void *buf/*out*/,
+H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size,
hid_t lapl_id)
{
- H5G_loc_t loc;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5G_loc_t loc; /* Group location for location to query */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Lget_val, FAIL)
- H5TRACE5("e","iszxi",loc_id,name,size,buf,lapl_id);
+ H5TRACE5("e","isxzi",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)
+ 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")
/* Get the link value */
- if(H5L_get_val(&loc, name, size, buf, lapl_id, H5AC_ind_dxpl_id) < 0)
+ 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")
done:
@@ -679,6 +771,58 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Lget_val_by_idx
+ *
+ * Purpose: Returns the link value of a link, according to the order of
+ * an index. For symbolic links, this is the path to which the
+ * link points, including the null terminator. For user-defined
+ * links, it is the link buffer.
+ *
+ * At most SIZE bytes are copied to the BUF result buffer.
+ *
+ * Return: Success: Non-negative with the link value in BUF.
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 13, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5L_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 */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Lget_val_by_idx, FAIL)
+
+ /* 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 <= H5L_INDEX_UNKNOWN || idx_type >= H5L_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")
+
+ /* Get the link value */
+ if(H5L_get_val_by_idx(&loc, group_name, idx_type, order, n, buf, size, lapl_id, H5AC_ind_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link value")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Lget_val_by_idx() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Lget_info
*
* Purpose: Gets metadata for a link.
@@ -741,8 +885,8 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
H5L_index_t idx_type, H5_iter_order_t order, hsize_t n,
H5L_info_t *linkbuf /*out*/, hid_t lapl_id)
{
- H5G_loc_t loc;
- herr_t ret_value = SUCCEED;
+ H5G_loc_t loc; /* Group location for group to query */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Lget_info_by_idx, FAIL)
@@ -1180,7 +1324,7 @@ static herr_t
H5L_link_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*/)
{
- H5L_trav_ud2_t *udata = (H5L_trav_ud2_t *)_udata; /* User data passed in */
+ H5L_trav_cr_t *udata = (H5L_trav_cr_t *)_udata; /* User data passed in */
H5G_t *grp = NULL; /* H5G_t for this group, opened to pass to user callback */
hid_t grp_id = FAIL; /* Id for this group (passed to user callback */
H5G_loc_t temp_loc; /* For UD callback */
@@ -1301,7 +1445,7 @@ H5L_create_real(H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path
unsigned target_flags = H5G_TARGET_NORMAL; /* Flags to pass to group traversal function */
H5T_cset_t char_encoding = H5F_DEFAULT_CSET; /* Character encoding for link */
H5P_genplist_t* lc_plist; /* Link creation property list */
- H5L_trav_ud2_t udata; /* User data for callback */
+ H5L_trav_cr_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5L_create_real)
@@ -1556,42 +1700,40 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L_get_val_cb
+ * Function: H5L_get_val_real
*
- * Purpose: Callback for retrieving link value or udata.
+ * Purpose: Retrieve link value from a link object
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * Tuesday, September 20, 2005
+ * Monday, November 13 2006
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5L_get_val_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const H5O_link_t *lnk,
- H5G_loc_t UNUSED *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/)
+H5L_get_val_real(const H5O_link_t *lnk, void *buf, size_t size)
{
- H5L_trav_ud4_t *udata = (H5L_trav_ud4_t *)_udata; /* User data passed in */
- const H5L_class_t *link_class; /* User-defined link class */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5L_get_val_cb)
+ FUNC_ENTER_NOAPI_NOINIT(H5L_get_val_real)
- /* Check if the name in this group resolved to a valid link */
- if(lnk == NULL)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist")
+ /* Sanity check */
+ HDassert(lnk);
- if(H5L_TYPE_SOFT == lnk->type)
- {
+ /* Check for soft link */
+ if(H5L_TYPE_SOFT == lnk->type) {
/* Copy to output buffer */
- if(udata->size > 0 && udata->buf) {
- HDstrncpy(udata->buf, lnk->u.soft.name, udata->size);
- if(HDstrlen(lnk->u.soft.name) >= udata->size)
- ((char *) udata->buf)[udata->size - 1] = '\0';
+ if(size > 0 && buf) {
+ HDstrncpy(buf, lnk->u.soft.name, size);
+ if(HDstrlen(lnk->u.soft.name) >= size)
+ ((char *)buf)[size - 1] = '\0';
} /* end if */
- }
- else if(lnk->type >= H5L_TYPE_UD_MIN)
- {
+ } /* end if */
+ /* Check for user-defined link */
+ else if(lnk->type >= H5L_TYPE_UD_MIN) {
+ const H5L_class_t *link_class; /* User-defined link class */
+
/* Get the link class for this type of link. It's okay if the class
* isn't registered, though--we just can't give any more information
* about it
@@ -1599,16 +1741,50 @@ H5L_get_val_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const H
link_class = H5L_find_class(lnk->type);
if(link_class != NULL && link_class->query_func != NULL) {
- if((link_class->query_func)(lnk->name, lnk->u.ud.udata, lnk->u.ud.size, udata->buf, udata->size) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "query callback returned failure")
- }
- else if(udata->buf && udata->size > 0)
- ((char *)udata->buf)[0] = '\0';
- }
+ if((link_class->query_func)(lnk->name, lnk->u.ud.udata, lnk->u.ud.size, buf, size) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "query callback returned failure")
+ } /* end if */
+ else if(buf && size > 0)
+ ((char *)buf)[0] = '\0';
+ } /* end if */
else
HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "object is not a symbolic or user-defined link")
done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_get_val_real() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_get_val_cb
+ *
+ * Purpose: Callback for retrieving link value or udata.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, September 20, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L_get_val_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const H5O_link_t *lnk,
+ H5G_loc_t UNUSED *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/)
+{
+ H5L_trav_gv_t *udata = (H5L_trav_gv_t *)_udata; /* User data passed in */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5L_get_val_cb)
+
+ /* Check if the name in this group resolved to a valid link */
+ if(lnk == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist")
+
+ /* Retrieve the value for the link */
+ if(H5L_get_val_real(lnk, udata->buf, udata->size) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value")
+
+done:
/* Indicate that this callback didn't take ownership of the group *
* location for the object */
*own_loc = H5G_OWN_NONE;
@@ -1637,13 +1813,18 @@ done:
*-------------------------------------------------------------------------
*/
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)
+H5L_get_val(H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size,
+ hid_t lapl_id, hid_t dxpl_id)
{
- H5L_trav_ud4_t udata; /* User data for callback */
+ H5L_trav_gv_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5L_get_val, FAIL)
+ /* Sanity check */
+ HDassert(loc);
+ HDassert(name && *name);
+
/* Set up user data for retrieving information */
udata.size = size;
udata.buf = buf;
@@ -1658,6 +1839,108 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5L_get_val_by_idx_cb
+ *
+ * Purpose: Callback for retrieving a link's value according to an
+ * index's order.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 13 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L_get_val_by_idx_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
+ const H5O_link_t UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
+ H5G_own_loc_t *own_loc/*out*/)
+{
+ H5L_trav_gvbi_t *udata = (H5L_trav_gvbi_t *)_udata; /* User data passed in */
+ H5O_link_t grp_lnk; /* Link within group */
+ hbool_t lnk_copied = FALSE; /* Whether the link was copied */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5L_get_val_by_idx_cb)
+
+ /* Check if the name of the group resolved to a valid object */
+ if(obj_loc == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group doesn't exist")
+
+ /* Query link */
+ if(H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order,
+ udata->n, &grp_lnk, udata->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "link not found")
+ lnk_copied = TRUE;
+
+ /* Retrieve the value for the link */
+ if(H5L_get_val_real(&grp_lnk, udata->buf, udata->size) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value")
+
+done:
+ /* Reset the link information, if we have a copy */
+ if(lnk_copied)
+ H5O_reset(H5O_LINK_ID, &grp_lnk);
+
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_get_val_by_idx_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_get_val_by_idx
+ *
+ * Purpose: Returns the value of a symbolic link or the udata for a
+ * user-defined link.
+ *
+ * Return: Success: Non-negative, with at most SIZE bytes of the
+ * link value copied into the BUF buffer. If the
+ * link value is larger than SIZE characters
+ * counting the null terminator then the BUF
+ * result will not be null terminated.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 13, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L_get_val_by_idx(H5G_loc_t *loc, const char *group_name, H5L_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size,
+ hid_t lapl_id, hid_t dxpl_id)
+{
+ H5L_trav_gvbi_t udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5L_get_val_by_idx)
+
+ /* Sanity check */
+ HDassert(loc);
+ HDassert(group_name && *group_name);
+
+ /* Set up user data for retrieving information */
+ udata.idx_type = idx_type;
+ udata.order = order;
+ udata.n = n;
+ udata.dxpl_id = dxpl_id;
+ 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, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5L_get_val_by_idx() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5L_delete_cb
*
* Purpose: Callback for deleting a link. This routine
@@ -1674,11 +1957,11 @@ static herr_t
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 */
- hid_t grp_id = FAIL; /* Id for this group (passed to user callback */
- H5L_trav_ud5_t *udata = (H5L_trav_ud5_t *)_udata; /* User data passed in */
- H5G_loc_t temp_loc; /* For UD callback */
- hbool_t temp_loc_init = FALSE;
+ H5L_trav_rm_t *udata = (H5L_trav_rm_t *)_udata; /* User data passed in */
+ H5G_t *grp = NULL; /* H5G_t for this group, opened to pass to user callback */
+ hid_t grp_id = FAIL; /* ID for this group (passed to user callback) */
+ H5G_loc_t temp_loc; /* For UD callback */
+ hbool_t temp_loc_init = FALSE; /* Temporary location has been initialized? */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5L_delete_cb)
@@ -1707,6 +1990,7 @@ H5L_delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSE
H5G_name_reset(&temp_path);
+ /* Get object location for link's parent group */
if(H5O_loc_copy(&temp_oloc, grp_loc->oloc, H5_COPY_DEEP) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location")
@@ -1714,20 +1998,21 @@ H5L_delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSE
temp_loc.path = &temp_path;
temp_loc_init = TRUE;
- /* Set up location for user-defined callback */
+ /* Set up group for user-defined callback */
if((grp = H5G_open(&temp_loc, udata->dxpl_id)) == NULL)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open group")
if((grp_id = H5I_register(H5I_GROUP, grp)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
+ /* Call user-defined link's 'delete' callback */
if((link_class->del_func)(name, grp_id, lnk->u.ud.udata, lnk->u.ud.size) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "link deletion callback returned failure")
- }
- }
+ } /* end if */
+ } /* end if */
/* Remove the link from the group */
if(H5G_loc_remove(grp_loc, name, obj_loc, udata->dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to unlink name from group")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to remove link from group")
done:
/* Close the location given to the user callback if it was created */
@@ -1761,7 +2046,7 @@ done:
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 */
+ H5L_trav_rm_t udata; /* User data for callback */
char *norm_name = NULL; /* Pointer to normalized name */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1791,6 +2076,98 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5L_delete_by_idx_cb
+ *
+ * Purpose: Callback for removing a link according to an index's order.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 13 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L_delete_by_idx_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
+ const H5O_link_t UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
+ H5G_own_loc_t *own_loc/*out*/)
+{
+ H5L_trav_gvbi_t *udata = (H5L_trav_gvbi_t *)_udata; /* User data passed in */
+ H5O_link_t grp_lnk; /* Link within group */
+ hbool_t lnk_copied = FALSE; /* Whether the link was copied */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5L_delete_by_idx_cb)
+
+ /* Check if the name of the group resolved to a valid object */
+ if(obj_loc == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group doesn't exist")
+
+ /* Query link */
+ if(H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order,
+ udata->n, &grp_lnk, udata->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "link not found")
+ lnk_copied = TRUE;
+
+ /* Retrieve the value for the link */
+ if(H5L_get_val_real(&grp_lnk, udata->buf, udata->size) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value")
+
+done:
+ /* Reset the link information, if we have a copy */
+ if(lnk_copied)
+ H5O_reset(H5O_LINK_ID, &grp_lnk);
+
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_delete_by_idx_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_delete_by_idx
+ *
+ * Purpose: Delete a link from a group, according to the order within an
+ * index.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 13, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L_delete_by_idx(H5G_loc_t *loc, const char *group_name, H5L_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, hid_t lapl_id, hid_t dxpl_id)
+{
+ H5L_trav_rmbi_t udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5L_delete_by_idx)
+
+ /* Sanity check */
+ HDassert(loc);
+ HDassert(group_name && *group_name);
+
+ /* Set up user data for unlink operation */
+ udata.idx_type = idx_type;
+ udata.order = order;
+ udata.n = n;
+ udata.dxpl_id = 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, 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
@@ -1809,7 +2186,7 @@ H5L_move_dest_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*/)
{
- H5L_trav_ud6_t *udata = (H5L_trav_ud6_t *)_udata; /* User data passed in */
+ H5L_trav_mv2_t *udata = (H5L_trav_mv2_t *)_udata; /* User data passed in */
H5RS_str_t *dst_name_r = NULL; /* Ref-counted version of dest name */
H5G_t *grp=NULL; /* H5G_t for this group, opened to pass to user callback */
hid_t grp_id = FAIL; /* Id for this group (passed to user callback */
@@ -1926,8 +2303,8 @@ 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*/)
{
- H5L_trav_ud3_t *udata = (H5L_trav_ud3_t *)_udata; /* User data passed in */
- H5L_trav_ud6_t udata_out; /* User data for H5L_move_dest_cb traversal */
+ H5L_trav_mv_t *udata = (H5L_trav_mv_t *)_udata; /* User data passed in */
+ H5L_trav_mv2_t udata_out; /* User data for H5L_move_dest_cb traversal */
H5G_obj_t type; /* Type of object being moved */
H5RS_str_t *dst_name_r = NULL; /* Ref-counted version of dest name */
char * orig_name = NULL; /* The name of the link in this group */
@@ -2053,7 +2430,7 @@ H5L_move(H5G_loc_t *src_loc, const char *src_name, H5G_loc_t *dst_loc,
H5T_cset_t char_encoding = H5F_DEFAULT_CSET; /* Character encoding for link */
H5P_genplist_t* lc_plist; /* Link creation property list */
H5P_genplist_t* la_plist; /* Link access property list */
- H5L_trav_ud3_t udata; /* User data for traversal */
+ H5L_trav_mv_t udata; /* User data for traversal */
hid_t lapl_copy; /* Copy of lapl for this function */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2202,7 +2579,7 @@ H5L_get_info_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
const H5O_link_t *lnk, H5G_loc_t UNUSED *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/)
{
- H5L_trav_ud1_t *udata = (H5L_trav_ud1_t *)_udata; /* User data passed in */
+ H5L_trav_gi_t *udata = (H5L_trav_gi_t *)_udata; /* User data passed in */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5L_get_info_cb)
@@ -2213,7 +2590,7 @@ H5L_get_info_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
/* Get information from the link */
if(H5L_get_info_real(lnk, udata->linfo) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get link info")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info")
done:
/* Indicate that this callback didn't take ownership of the group *
@@ -2240,7 +2617,7 @@ 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)
{
- H5L_trav_ud1_t udata; /* User data for callback */
+ H5L_trav_gi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5L_get_info, FAIL)
@@ -2275,7 +2652,7 @@ H5L_get_info_by_idx_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
const H5O_link_t UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/)
{
- H5L_trav_ud7_t *udata = (H5L_trav_ud7_t *)_udata; /* User data passed in */
+ H5L_trav_gibi_t *udata = (H5L_trav_gibi_t *)_udata; /* User data passed in */
H5O_link_t grp_lnk; /* Link within group */
hbool_t lnk_copied = FALSE; /* Whether the link was copied */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2294,7 +2671,7 @@ H5L_get_info_by_idx_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
/* Get information from the link */
if(H5L_get_info_real(&grp_lnk, udata->linfo) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get link info")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info")
done:
/* Reset the link information, if we have a copy */
@@ -2327,11 +2704,15 @@ H5L_get_info_by_idx(const H5G_loc_t *loc, const char *group_name,
H5L_index_t idx_type, H5_iter_order_t order, hsize_t n,
H5L_info_t *linkbuf/*out*/, hid_t lapl_id, hid_t dxpl_id)
{
- H5L_trav_ud7_t udata; /* User data for callback */
+ H5L_trav_gibi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5L_get_info_by_idx)
+ /* Sanity check */
+ HDassert(loc);
+ HDassert(group_name && *group_name);
+
/* Set up user data for callback */
udata.idx_type = idx_type;
udata.order = order;
@@ -2394,7 +2775,7 @@ H5L_get_name_by_idx_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
const H5O_link_t UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/)
{
- H5L_trav_ud8_t *udata = (H5L_trav_ud8_t *)_udata; /* User data passed in */
+ H5L_trav_gnbi_t *udata = (H5L_trav_gnbi_t *)_udata; /* User data passed in */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5L_get_name_by_idx_cb)
@@ -2435,7 +2816,7 @@ H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name,
H5L_index_t idx_type, H5_iter_order_t order, hsize_t n,
char *name/*out*/, size_t size, hid_t lapl_id, hid_t dxpl_id)
{
- H5L_trav_ud8_t udata; /* User data for callback */
+ H5L_trav_gnbi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5L_get_name_by_idx)
diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h
index 197287c..79d687f 100644
--- a/src/H5Lprivate.h
+++ b/src/H5Lprivate.h
@@ -71,8 +71,8 @@ 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_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_register_external(void);
/* User-defined link functions */
diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h
index 77f03e6..d8744ca 100644
--- a/src/H5Lpublic.h
+++ b/src/H5Lpublic.h
@@ -152,8 +152,13 @@ H5_DLL herr_t H5Lcreate_hard(hid_t cur_loc, const char *cur_name,
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 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 H5Ldelete_by_idx(hid_t loc_id, const char *group_name,
+ H5L_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id);
+H5_DLL herr_t H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/,
+ size_t size, hid_t lapl_id);
+H5_DLL herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name,
+ H5L_index_t idx_type, H5_iter_order_t order, hsize_t n,
+ void *buf/*out*/, size_t size, hid_t lapl_id);
H5_DLL herr_t H5Lget_info(hid_t loc_id, const char *name,
H5L_info_t *linkbuf /*out*/, hid_t lapl_id);
H5_DLL herr_t H5Lget_info_by_idx(hid_t loc_id, const char *group_name,