summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--release_docs/RELEASE.txt5
-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
-rw-r--r--test/links.c459
-rwxr-xr-xtest/objcopy.c8
-rw-r--r--tools/h5dump/h5dump.c8
-rw-r--r--tools/h5ls/h5ls.c4
-rw-r--r--tools/lib/h5diff.c8
12 files changed, 866 insertions, 335 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 982d83f..b16d100 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -160,6 +160,9 @@ New Features
Library:
--------
+ - Added new H5Lget_val_by_idx() routine to query the value of a soft link
+ according to the order within an index.
+ - QAK - 2006/11/13
- Added new H5Lget_name_by_idx() routine to query the name of a link
according to the order within an index.
- QAK - 2006/11/12
@@ -209,7 +212,7 @@ New Features
H5Lcreate_hard - like H5Glink2 for hard links
H5Lcreate_soft - like H5Glink2 for soft links
H5Ldelete - just like H5Gunlink
- H5Lget_val - just link H5Gget_linkval
+ H5Lget_val - just like H5Gget_linkval
H5Lget_info - gets link-specific info (like H5Gget_objinfo)
In addition, H5Gcreate_expand, H5Tcommit_expand, and H5Dcreate_expand
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,
diff --git a/test/links.c b/test/links.c
index 71d1e02..7a3a4c0 100644
--- a/test/links.c
+++ b/test/links.c
@@ -307,7 +307,7 @@ cklinks(hid_t fapl, hbool_t new_format)
puts(" expected file location.");
TEST_ERROR
}
- if (H5Lget_val(file, "grp1/soft", sizeof linkval, linkval, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) TEST_ERROR
if (HDstrcmp(linkval, "/d1")) {
H5_FAILED();
puts(" Soft link test failed. Wrong link value");
@@ -1602,7 +1602,7 @@ external_link_root(hid_t fapl, hbool_t new_format)
puts(" Unexpected object type - should have been an external link");
goto error;
}
- if(H5Lget_val(fid, "ext_link", sizeof(objname), objname, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR
if(H5Lunpack_elink_val(objname, sb.linklen, &file, &path) < 0) TEST_ERROR
if(HDstrcmp(file, filename1))
{
@@ -2626,7 +2626,7 @@ external_link_query(hid_t fapl, hbool_t new_format)
}
/* Get information for external link. It should be two strings right after each other */
- if(H5Lget_val(fid, "src", (size_t)NAME_BUF_SIZE, query_buf, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_val(fid, "src", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
/* Extract the file and object names from the buffer */
if(H5Lunpack_elink_val(query_buf, li.u.link_size, &file_name, &object_name) < 0) TEST_ERROR
@@ -4745,7 +4745,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format)
if(li.u.link_size != 0) TEST_ERROR
/* ...but fail when we try to write data to the buffer itself*/
H5E_BEGIN_TRY {
- if(H5Lget_val(fid, "ud_link", (size_t)NAME_BUF_SIZE, query_buf, H5P_DEFAULT) >=0) TEST_ERROR
+ if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) >=0) TEST_ERROR
} H5E_END_TRY
/* Register a new class */
@@ -4754,7 +4754,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format)
/* Now querying should succeed */
if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.u.link_size != 8) TEST_ERROR
- if(H5Lget_val(fid, "ud_link", (size_t)NAME_BUF_SIZE, query_buf, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
if(HDstrcmp(query_buf, "succeed") != 0) TEST_ERROR
/* Moving and copying should both succeed */
@@ -4928,7 +4928,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format)
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
+ if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR
if(H5Lget_info(fid, "soft17", NULL, plist) < 0) TEST_ERROR
/* H5Lcreate_external and H5Lcreate_ud */
@@ -5921,19 +5921,33 @@ error:
*/
static int
link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n,
- hbool_t use_index)
+ hbool_t hard_link, hbool_t use_index)
{
char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ char valname[NAME_BUF_SIZE]; /* Link value name */
+ char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
H5L_info_t linfo; /* Link info struct */
+ /* Make link value for increasing/native order queries */
+ sprintf(valname, "value %02u", (unsigned)n);
+
/* Verify the link information for first link, in increasing creation order */
+ HDmemset(&linfo, 0, sizeof(linfo));
if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != 0) TEST_ERROR
/* Verify the link information for new link, in increasing creation order */
+ HDmemset(&linfo, 0, sizeof(linfo));
if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != (int64_t)n) TEST_ERROR
+ /* Verify value for new soft link, in increasing creation order */
+ if(!hard_link) {
+ HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_val_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end if */
+
/* Verify the name for new link, in increasing creation order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
if(H5Lget_name_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
@@ -5945,27 +5959,45 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n,
*/
if(use_index) {
/* Verify the link information for first link, in native creation order (which is increasing) */
+ HDmemset(&linfo, 0, sizeof(linfo));
if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != 0) TEST_ERROR
/* Verify the link information for new link, in native creation order (which is increasing) */
+ HDmemset(&linfo, 0, sizeof(linfo));
if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != (int64_t)n) TEST_ERROR
- /* Verify the name for new link, in increasing creation order */
+ /* Verify value for new soft link, in native creation order (which is increasing) */
+ if(!hard_link) {
+ HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_val_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end if */
+
+ /* Verify the name for new link, in native creation order (which is increasing) */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
if(H5Lget_name_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
if(HDstrcmp(linkname, tmpname)) TEST_ERROR
} /* end if */
/* Verify the link information for first link, in decreasing creation order */
+ HDmemset(&linfo, 0, sizeof(linfo));
if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != 0) TEST_ERROR
/* Verify the link information for new link, in decreasing creation order */
+ HDmemset(&linfo, 0, sizeof(linfo));
if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != (int64_t)n) TEST_ERROR
+ /* Verify value for new soft link, in decreasing creation order */
+ if(!hard_link) {
+ HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_val_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end if */
+
/* Verify the name for new link, in decreasing creation order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
if(H5Lget_name_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
@@ -5973,13 +6005,22 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n,
/* Verify the link information for first link, in increasing link name order */
+ HDmemset(&linfo, 0, sizeof(linfo));
if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != 0) TEST_ERROR
/* Verify the link information for new link, in increasing link name order */
+ HDmemset(&linfo, 0, sizeof(linfo));
if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != (int64_t)n) TEST_ERROR
+ /* Verify value for new soft link, in increasing link name order */
+ if(!hard_link) {
+ HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_val_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end if */
+
/* Verify the name for new link, in increasing link name order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
if(H5Lget_name_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
@@ -5990,13 +6031,22 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n,
*/
/* Verify the link information for first link, in decreasing link name order */
+ HDmemset(&linfo, 0, sizeof(linfo));
if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != 0) TEST_ERROR
/* Verify the link information for new link, in decreasing link name order */
+ HDmemset(&linfo, 0, sizeof(linfo));
if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != (int64_t)n) TEST_ERROR
+ /* Verify value for new soft link, in decreasing link name order */
+ if(!hard_link) {
+ HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_val_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end if */
+
/* Verify the name for new link, in decreasing link name order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
if(H5Lget_name_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
@@ -6026,105 +6076,153 @@ error:
*-------------------------------------------------------------------------
*/
static int
-link_info_by_idx(hid_t fapl, hbool_t use_index)
+link_info_by_idx(hid_t fapl)
{
hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */
+ hid_t group_id = (-1); /* Group ID */
hid_t gcpl_id = (-1); /* Group creation property list ID */
+ hbool_t hard_link; /* Create hard or soft link? */
+ hbool_t use_index; /* Use index on creation order values */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
H5L_info_t linfo; /* Link info struct */
char objname[NAME_BUF_SIZE]; /* Object name */
+ char valname[NAME_BUF_SIZE]; /* Link value name */
char filename[NAME_BUF_SIZE];/* File name */
char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
unsigned u; /* Local index variable */
herr_t ret; /* Generic return value */
- if(use_index)
- TESTING("querying info by index w/creation order index")
- else
- TESTING("querying info by index w/o creation order index")
-
- /* Create file */
- /* (with creation order tracking for the root group) */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
-
- /* Set creation order tracking & indexing on group */
- if(use_index)
- if(H5Pset_creation_order_index(gcpl_id, TRUE) < 0) TEST_ERROR
- if(H5Pset_creation_order_tracking(gcpl_id, TRUE) < 0) TEST_ERROR
-
- /* Create group with creation order indexing & tracking on */
- if((group_id = H5Gcreate_expand(file_id, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Llink(file_id, CORDER_GROUP_NAME, group_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
-
- /* Check for query on empty group */
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5Lget_name_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
-
- /* Create several links, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
- sprintf(objname, "filler %02u", u);
- if((group_id2 = H5Gcreate(group_id, objname, (size_t)0)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
-
- /* Verify link information for new link */
- if(link_info_by_idx_check(group_id, objname, (hsize_t)u, use_index) < 0) TEST_ERROR
- } /* end for */
-
- /* Verify state of group */
- if(H5G_has_links_test(group_id, NULL) != TRUE) TEST_ERROR
-
- /* Check for out of bound offset queries */
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5Lget_name_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
-
- /* Create more links, to push group into dense form */
- for(; u < (max_compact * 2); u++) {
- sprintf(objname, "filler %02u", u);
- if((group_id2 = H5Gcreate(group_id, objname, (size_t)0)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ /* Loop over creating hard or soft links */
+ for(hard_link = FALSE; hard_link <= TRUE; hard_link++) {
+ /* Loop over using index for creation order value */
+ for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ if(hard_link) {
+ if(use_index)
+ TESTING("querying info by index w/creation order index, using hard links")
+ else
+ TESTING("querying info by index w/o creation order index, using hard links")
+ } /* end if */
+ else {
+ if(use_index)
+ TESTING("querying info by index w/creation order index, using soft links")
+ else
+ TESTING("querying info by index w/o creation order index, using soft links")
+ } /* end else */
+
+ /* Create file */
+ /* (with creation order tracking for the root group) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create group creation property list */
+ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+
+ /* Set creation order tracking & indexing on group */
+ if(use_index)
+ if(H5Pset_creation_order_index(gcpl_id, TRUE) < 0) TEST_ERROR
+ if(H5Pset_creation_order_tracking(gcpl_id, TRUE) < 0) TEST_ERROR
+
+ /* Create group with creation order indexing & tracking on */
+ if((group_id = H5Gcreate_expand(file_id, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Llink(file_id, CORDER_GROUP_NAME, group_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Query the group creation properties */
+ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+
+ /* Check for query on empty group */
+ H5E_BEGIN_TRY {
+ ret = H5Lget_info_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY {
+ ret = H5Lget_name_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Create several links, up to limit of compact form */
+ for(u = 0; u < max_compact; u++) {
+ /* Make name for link */
+ sprintf(objname, "filler %02u", u);
+
+ /* Check for creating hard or soft link */
+ if(hard_link) {
+ hid_t group_id2; /* Group ID */
+
+ /* Create hard link, with group object */
+ if((group_id2 = H5Gcreate(group_id, objname, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+ } /* end if */
+ else {
+ /* Make value for link */
+ sprintf(valname, "value %02u", u);
+
+ /* Create soft link */
+ if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ } /* end else */
+
+ /* Verify link information for new link */
+ if(link_info_by_idx_check(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR
+ } /* end for */
+
+ /* Verify state of group */
+ if(H5G_has_links_test(group_id, NULL) != TRUE) TEST_ERROR
+
+ /* Check for out of bound offset queries */
+ H5E_BEGIN_TRY {
+ ret = H5Lget_info_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY {
+ ret = H5Lget_info_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY {
+ ret = H5Lget_name_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Create more links, to push group into dense form */
+ for(; u < (max_compact * 2); u++) {
+ /* Make name for link */
+ sprintf(objname, "filler %02u", u);
+
+ /* Check for creating hard or soft link */
+ if(hard_link) {
+ hid_t group_id2; /* Group ID */
+
+ /* Create hard link, with group object */
+ if((group_id2 = H5Gcreate(group_id, objname, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+ } /* end if */
+ else {
+ /* Make value for link */
+ sprintf(valname, "value %02u", u);
+
+ /* Create soft link */
+ if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ } /* end else */
+
+ /* Verify state of group */
+ if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR
+
+ /* Verify link information for new link */
+ if(link_info_by_idx_check(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR
+ } /* end for */
+
+ /* Close the group */
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Close the group creation property list */
+ if(H5Pclose(gcpl_id) < 0) TEST_ERROR
- /* Verify state of group */
- if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ /* Close the file */
+ if(H5Fclose(file_id) < 0) TEST_ERROR
- /* Verify link information for new link */
- if(link_info_by_idx_check(group_id, objname, (hsize_t)u, use_index) < 0) TEST_ERROR
+ PASSED();
+ } /* end for */
} /* end for */
- /* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
-
- /* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
-
- /* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
-
- PASSED();
return 0;
error:
@@ -6156,95 +6254,147 @@ link_info_by_idx_old(hid_t fapl)
{
hid_t file_id = (-1); /* File ID */
hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */
+ hbool_t hard_link; /* Create hard or soft link? */
H5L_info_t linfo; /* Link info struct */
char objname[NAME_BUF_SIZE]; /* Object name */
+ char valname[NAME_BUF_SIZE]; /* Link value name */
char filename[NAME_BUF_SIZE];/* File name */
haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */
- char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
unsigned u; /* Local index variable */
herr_t ret; /* Generic return value */
- TESTING("querying info by index in old-style group")
+ /* Loop over creating hard or soft links */
+ for(hard_link = FALSE; hard_link <= TRUE; hard_link++) {
+ if(hard_link)
+ TESTING("querying info by index in old-style group, using hard links")
+ else
+ TESTING("querying info by index in old-style group, using soft links")
- /* Create file */
- /* (with creation order tracking for the root group) */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ /* Create file */
+ /* (with creation order tracking for the root group) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- /* Create group with creation order indexing & tracking on */
- if((group_id = H5Gcreate(file_id, CORDER_GROUP_NAME, (size_t)0)) < 0) TEST_ERROR
+ /* Create group with creation order indexing & tracking on */
+ if((group_id = H5Gcreate(file_id, CORDER_GROUP_NAME, (size_t)0)) < 0) TEST_ERROR
- /* Create several links */
- for(u = 0; u < CORDER_NLINKS; u++) {
- H5G_stat_t sb; /* Buffer for querying object's info */
+ /* Create several links */
+ for(u = 0; u < CORDER_NLINKS; u++) {
+ /* Make name for link */
+ sprintf(objname, "filler %02u", u);
- sprintf(objname, "filler %02u", u);
- if((group_id2 = H5Gcreate(group_id, objname, (size_t)0)) < 0) TEST_ERROR
- if(H5Gget_objinfo(group_id2, ".", FALSE, &sb) < 0) TEST_ERROR
+ /* Check for creating hard or soft link */
+ if(hard_link) {
+ H5G_stat_t sb; /* Buffer for querying object's info */
+
+ /* Create group */
+ if((group_id2 = H5Gcreate(group_id, objname, (size_t)0)) < 0) TEST_ERROR
+
+ /* Retrieve group's address on disk */
+ if(H5Gget_objinfo(group_id2, ".", FALSE, &sb) < 0) TEST_ERROR
#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
- objno[u] = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long)));
+ objno[u] = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long)));
#else
- objno[u] = (haddr_t)sb.objno[0];
+ objno[u] = (haddr_t)sb.objno[0];
#endif
- if(H5Gclose(group_id2) < 0) TEST_ERROR
- } /* end for */
+ /* Close group */
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+ } /* end if */
+ else {
+ /* Make value for link */
+ sprintf(valname, "value %02u", u);
- /* Verify link information for created links */
- for(u = 0; u < CORDER_NLINKS; u++) {
- unsigned dec_u = CORDER_NLINKS - (u + 1); /* Decreasing mapped index */
+ /* Create soft link */
+ if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ } /* end else */
+ } /* end for */
- /* Make link name for increasing/native order queries */
- sprintf(objname, "filler %02u", u);
+ /* Verify link information for created links */
+ for(u = 0; u < CORDER_NLINKS; u++) {
+ unsigned dec_u = CORDER_NLINKS - (u + 1); /* Decreasing mapped index */
- /* Verify link information (in increasing order) */
- if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR
+ /* Make link name for increasing/native order queries */
+ sprintf(objname, "filler %02u", u);
- /* Verify link name (in increasing order) */
- if(H5Lget_name_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ /* Make link value for increasing/native order queries */
+ sprintf(valname, "value %02u", u);
- /* Verify link information (in native order - native is increasing) */
- if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR
+ /* Verify link information (in increasing order) */
+ if(hard_link) {
+ if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR
+ } /* end if */
+ else {
+ if(H5Lget_val_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end else */
- /* Verify link name (in native order - native is increasing) */
- if(H5Lget_name_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ /* Verify link name (in increasing order) */
+ if(H5Lget_name_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(objname, tmpname)) TEST_ERROR
- /* Make link name for decreasing order queries */
- sprintf(objname, "filler %02u", dec_u);
- /* Verify link information (in decreasing order) */
- if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR
+ /* Verify link information (in native order - native is increasing) */
+ if(hard_link) {
+ if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR
+ } /* end if */
+ else {
+ if(H5Lget_val_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end else */
- /* Verify link name (in decreasing order) */
- if(H5Lget_name_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
- } /* end for */
+ /* Verify link name (in native order - native is increasing) */
+ if(H5Lget_name_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(objname, tmpname)) TEST_ERROR
- /* Check for creation order index queries */
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5Lget_name_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- /* Verify state of group */
- if(H5G_has_stab_test(group_id) != TRUE) TEST_ERROR
+ /* Make link name for decreasing order queries */
+ sprintf(objname, "filler %02u", dec_u);
- /* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ /* Make link value for decreasing order queries */
+ sprintf(valname, "value %02u", dec_u);
- /* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ /* Verify link information (in decreasing order) */
+ if(hard_link) {
+ if(H5Lget_info_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR
+ } /* end if */
+ else {
+ if(H5Lget_val_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end else */
+
+ /* Verify link name (in decreasing order) */
+ if(H5Lget_name_by_idx(group_id, ".", H5L_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ } /* end for */
+
+ /* Check for creation order index queries */
+ H5E_BEGIN_TRY {
+ ret = H5Lget_info_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY {
+ ret = H5Lget_name_by_idx(group_id, ".", H5L_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Verify state of group */
+ if(H5G_has_stab_test(group_id) != TRUE) TEST_ERROR
+
+ /* Close the group */
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ PASSED();
+ } /* end for */
- PASSED();
return 0;
error:
@@ -6359,8 +6509,7 @@ main(void)
nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0;
nerrors += corder_transition(fapl2) < 0 ? 1 : 0;
nerrors += corder_delete(fapl2) < 0 ? 1 : 0;
- nerrors += link_info_by_idx(fapl2, TRUE) < 0 ? 1 : 0;
- nerrors += link_info_by_idx(fapl2, FALSE) < 0 ? 1 : 0;
+ nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0;
} /* end if */
else {
/* Test new API calls on old-style groups */
@@ -6377,11 +6526,11 @@ main(void)
nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0;
nerrors += corder_transition(fapl2) < 0 ? 1 : 0;
nerrors += corder_delete(fapl2) < 0 ? 1 : 0;
- nerrors += link_info_by_idx(fapl2, TRUE) < 0 ? 1 : 0;
- nerrors += link_info_by_idx(fapl2, FALSE) < 0 ? 1 : 0;
+ nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0;
/* Test new API calls on old-style groups */
nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0;
+HDfprintf(stderr, "Uncomment tests!\n");
#endif /* QAK */
/* Close 2nd FAPL */
diff --git a/test/objcopy.c b/test/objcopy.c
index 2f5433d..507c881 100755
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -1144,8 +1144,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth)
char linkname2[NAME_BUF_SIZE]; /* Link value */
/* Check link values */
- if(H5Lget_val(gid, objname, (size_t)NAME_BUF_SIZE, linkname, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_val(gid2, objname2, (size_t)NAME_BUF_SIZE, linkname2, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_val(gid, objname, linkname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_val(gid2, objname2, linkname2, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
if(HDstrcmp(linkname, linkname2)) TEST_ERROR
}
break;
@@ -1199,8 +1199,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth)
if(linfo.u.link_size != linfo2.u.link_size) TEST_ERROR
/* Get link udata */
- if(H5Lget_val(gid, objname, (size_t)NAME_BUF_SIZE, linkval, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_val(gid2, objname2, (size_t)NAME_BUF_SIZE, linkval2, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_val(gid, objname, linkval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_val(gid2, objname2, linkval2, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
/* Compare link udata */
if(HDmemcmp(linkval, linkval2, objstat.linklen)) TEST_ERROR
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 45e90b7..c362776 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -1456,7 +1456,7 @@ dump_all(hid_t group, const char *name, void * op_data)
indentation(indent + COL);
}
- if (H5Lget_val(group, name, statbuf.linklen, targbuf, H5P_DEFAULT) < 0) {
+ if (H5Lget_val(group, name, targbuf, statbuf.linklen, H5P_DEFAULT) < 0) {
error_msg(progname, "unable to get link value\n");
d_status = EXIT_FAILURE;
ret = FAIL;
@@ -1555,7 +1555,7 @@ dump_all(hid_t group, const char *name, void * op_data)
begin_obj(dump_header_format->extlinkbegin, name,
dump_header_format->extlinkblockbegin);
}
- if (H5Lget_val(group, name, statbuf.linklen, targbuf, H5P_DEFAULT) < 0) {
+ if (H5Lget_val(group, name, targbuf, statbuf.linklen, H5P_DEFAULT) < 0) {
error_msg(progname, "unable to get external link value\n");
d_status = EXIT_FAILURE;
ret = FAIL;
@@ -3227,7 +3227,7 @@ handle_links(hid_t fid, char *links, void UNUSED * data)
dump_header_format->softlinkblockbegin);
indentation(COL);
- if(H5Lget_val(fid, links, statbuf.linklen, buf, H5P_DEFAULT) >= 0) {
+ if(H5Lget_val(fid, links, buf, statbuf.linklen, H5P_DEFAULT) >= 0) {
printf("LINKTARGET \"%s\"\n", buf);
} else {
error_msg(progname, "h5dump error: unable to get link value for \"%s\"\n",
@@ -3247,7 +3247,7 @@ handle_links(hid_t fid, char *links, void UNUSED * data)
case H5L_TYPE_EXTERNAL:
begin_obj(dump_header_format->extlinkbegin, links,
dump_header_format->extlinkblockbegin);
- if(H5Lget_val(fid, links, statbuf.linklen, buf, H5P_DEFAULT) >= 0) {
+ if(H5Lget_val(fid, links, buf, statbuf.linklen, H5P_DEFAULT) >= 0) {
if(H5Lunpack_elink_val(buf, statbuf.linklen, &elink_file, &elink_path)>=0) {
indentation(COL);
printf("LINKCLASS %d\n", linfo.type);
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 46d4bf3..d23f410 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1724,7 +1724,7 @@ slink_open(hid_t location, const char *name)
{
char buf[64];
- if(H5Lget_val(location, name, sizeof(buf), buf, H5P_DEFAULT) < 0)
+ if(H5Lget_val(location, name, buf, sizeof(buf), H5P_DEFAULT) < 0)
return -1;
if(NULL == HDmemchr(buf, 0, sizeof(buf)))
HDstrcpy(buf + sizeof(buf) - 4, "...");
@@ -1768,7 +1768,7 @@ udlink_open(hid_t location, const char *name)
case H5L_TYPE_EXTERNAL:
if((buf = HDmalloc(linfo.u.link_size)) == NULL)
goto error;
- if(H5Lget_val(location, name, sizeof(buf), buf, H5P_DEFAULT) < 0)
+ if(H5Lget_val(location, name, buf, sizeof(buf), H5P_DEFAULT) < 0)
goto error;
if(H5Lunpack_elink_val(buf, linfo.u.link_size, &filename, &path) < 0) goto error;
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 7070898..7907d38 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -1090,12 +1090,12 @@ hsize_t diff (hid_t file1_id,
buf1 = HDmalloc (li1.u.link_size);
buf2 = HDmalloc (li2.u.link_size);
- if(H5Lget_val(file1_id, path1, li1.u.link_size, buf1, H5P_DEFAULT) < 0)
+ if(H5Lget_val(file1_id, path1, buf1, li1.u.link_size, H5P_DEFAULT) < 0)
{
HDfree (buf1); HDfree (buf2);
goto out;
}
- if(H5Lget_val(file2_id, path2, li2.u.link_size, buf2, H5P_DEFAULT) < 0)
+ if(H5Lget_val(file2_id, path2, buf2, li2.u.link_size, H5P_DEFAULT) < 0)
{
HDfree (buf1); HDfree (buf2);
goto out;
@@ -1104,12 +1104,12 @@ hsize_t diff (hid_t file1_id,
/* If the buffers are the same size, compare them */
if(li1.u.link_size == li2.u.link_size)
{
- if(H5Lget_val(file1_id, path1, li1.u.link_size, buf1, H5P_DEFAULT) < 0)
+ if(H5Lget_val(file1_id, path1, buf1, li1.u.link_size, H5P_DEFAULT) < 0)
{
HDfree (buf1); HDfree (buf2);
goto out;
}
- if(H5Lget_val(file2_id, path2, li2.u.link_size, buf2, H5P_DEFAULT) < 0)
+ if(H5Lget_val(file2_id, path2, buf2, li2.u.link_size, H5P_DEFAULT) < 0)
{
HDfree (buf1); HDfree (buf2);
goto out;