summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-01-16 21:29:34 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-01-19 04:02:16 (GMT)
commit2b1709f6ff9a8fcfc1e6d5128b24501d927e21a7 (patch)
tree995755018d754f98b7ecf4c53452d7aaebba34e1 /tools
parentdbb0ccc31db5d6a2b87ce859380043a0e7e66bd7 (diff)
downloadhdf5-2b1709f6ff9a8fcfc1e6d5128b24501d927e21a7.zip
hdf5-2b1709f6ff9a8fcfc1e6d5128b24501d927e21a7.tar.gz
hdf5-2b1709f6ff9a8fcfc1e6d5128b24501d927e21a7.tar.bz2
Squashed commit of the token_refactoring branch:
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5diff.c46
-rw-r--r--tools/lib/h5diff_array.c24
-rw-r--r--tools/lib/h5diff_attr.c11
-rw-r--r--tools/lib/h5tools.c22
-rw-r--r--tools/lib/h5tools_dump.c23
-rw-r--r--tools/lib/h5tools_ref.c148
-rw-r--r--tools/lib/h5tools_ref.h8
-rw-r--r--tools/lib/h5tools_str.c46
-rw-r--r--tools/lib/h5tools_str.h2
-rw-r--r--tools/lib/h5tools_utils.c73
-rw-r--r--tools/lib/h5tools_utils.h15
-rw-r--r--tools/lib/h5trav.c117
-rw-r--r--tools/lib/h5trav.h15
-rw-r--r--tools/src/h5dump/h5dump.c4
-rw-r--r--tools/src/h5dump/h5dump_ddl.c67
-rw-r--r--tools/src/h5dump/h5dump_xml.c171
-rw-r--r--tools/src/h5format_convert/h5format_convert.c2
-rw-r--r--tools/src/h5ls/h5ls.c32
-rw-r--r--tools/src/h5repack/h5repack.c36
-rw-r--r--tools/src/h5repack/h5repack.h2
-rw-r--r--tools/src/h5repack/h5repack_copy.c2
-rw-r--r--tools/src/h5repack/h5repack_refs.c15
-rw-r--r--tools/src/h5repack/h5repack_verify.c6
-rw-r--r--tools/src/h5stat/h5stat.c53
-rw-r--r--tools/test/h5dump/errfiles/tdset-2.err2
-rw-r--r--tools/test/h5dump/errfiles/tperror.err2
-rw-r--r--tools/test/h5dump/errfiles/tqmarkfile.err2
27 files changed, 570 insertions, 376 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index d7fc991..870c256 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -276,7 +276,7 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
H5TOOLS_DEBUG("build_match_list start - errstat:%d", opts->err_stat);
/* init */
- trav_table_init(&table);
+ trav_table_init(info1->fid, &table);
if (table == NULL) {
H5TOOLS_INFO("Cannot create traverse table");
H5TOOLS_GOTO_DONE_NO_RET();
@@ -314,10 +314,20 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
trav_table_addflags(infile, path1_lp, info1->paths[curr1].type, table);
/* if the two point to the same target object,
* mark that in table */
- if (info1->paths[curr1].fileno == info2->paths[curr2].fileno &&
- info1->paths[curr1].objno == info2->paths[curr2].objno) {
- idx = table->nobjs - 1;
- table->objs[idx].is_same_trgobj = 1;
+ if(info1->paths[curr1].fileno == info2->paths[curr2].fileno) {
+ int token_cmp;
+
+ if(H5Otoken_cmp(info1->fid, &info1->paths[curr1].obj_token,
+ &info2->paths[curr2].obj_token, &token_cmp) < 0) {
+ H5TOOLS_INFO("Failed to compare object tokens");
+ opts->err_stat = H5DIFF_ERR;
+ H5TOOLS_GOTO_DONE_NO_RET();
+ }
+
+ if(!token_cmp) {
+ idx = table->nobjs - 1;
+ table->objs[idx].is_same_trgobj = 1;
+ }
}
}
curr1++;
@@ -382,7 +392,7 @@ done:
* Purpose: Call back function from h5trav_visit().
*------------------------------------------------------------------------*/
static herr_t
-trav_grp_objs(const char *path, const H5O_info_t *oinfo,
+trav_grp_objs(const char *path, const H5O_info2_t *oinfo,
const char *already_visited, void *udata)
{
trav_info_visit_obj(path, oinfo, already_visited, udata);
@@ -397,7 +407,7 @@ trav_grp_objs(const char *path, const H5O_info_t *oinfo,
* Track and extra checkings while visiting all symbolic-links.
*------------------------------------------------------------------------*/
static herr_t
-trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata)
+trav_grp_symlinks(const char *path, const H5L_info2_t *linfo, void *udata)
{
trav_info_t *tinfo = (trav_info_t *)udata;
diff_opt_t *opts = (diff_opt_t *)tinfo->opts;
@@ -523,7 +533,7 @@ h5diff(const char *fname1,
h5trav_type_t obj1type = H5TRAV_TYPE_GROUP;
h5trav_type_t obj2type = H5TRAV_TYPE_GROUP;
/* for single object */
- H5O_info_t oinfo1, oinfo2; /* object info */
+ H5O_info2_t oinfo1, oinfo2; /* object info */
trav_info_t *info1_obj = NULL;
trav_info_t *info2_obj = NULL;
/* for group object */
@@ -533,8 +543,8 @@ h5diff(const char *fname1,
trav_info_t *info1_lp = NULL;
trav_info_t *info2_lp = NULL;
/* link info from specified object */
- H5L_info_t src_linfo1;
- H5L_info_t src_linfo2;
+ H5L_info2_t src_linfo1;
+ H5L_info2_t src_linfo2;
/* link info from member object */
h5tool_link_info_t trg_linfo1;
h5tool_link_info_t trg_linfo2;
@@ -635,7 +645,7 @@ h5diff(const char *fname1,
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Object could not be found");
}
/* get info from link */
- if(H5Lget_info(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0) {
+ if(H5Lget_info2(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0) {
parallel_print("Unable to get link info from <%s>\n", obj1fullname);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Lget_info failed");
}
@@ -651,14 +661,14 @@ h5diff(const char *fname1,
/* optional data pass */
info1_obj->opts = (diff_opt_t*)opts;
- if(H5Oget_info_by_name2(file1_id, obj1fullname, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(file1_id, obj1fullname, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
parallel_print("Error: Could not get file contents\n");
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Could not get file contents");
}
obj1type = (h5trav_type_t)oinfo1.type;
trav_info_add(info1_obj, obj1fullname, obj1type);
idx = info1_obj->nused - 1;
- info1_obj->paths[idx].objno = oinfo1.addr;
+ HDmemcpy(&info1_obj->paths[idx].obj_token, &oinfo1.token, sizeof(H5O_token_t));
info1_obj->paths[idx].fileno = oinfo1.fileno;
}
else if (src_linfo1.type == H5L_TYPE_SOFT) {
@@ -685,7 +695,7 @@ h5diff(const char *fname1,
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Object could not be found");
}
/* get info from link */
- if(H5Lget_info(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0) {
+ if(H5Lget_info2(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0) {
parallel_print("Unable to get link info from <%s>\n", obj2fullname);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Lget_info failed");
}
@@ -701,14 +711,14 @@ h5diff(const char *fname1,
/* optional data pass */
info2_obj->opts = (diff_opt_t*)opts;
- if(H5Oget_info_by_name2(file2_id, obj2fullname, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(file2_id, obj2fullname, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
parallel_print("Error: Could not get file contents\n");
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Could not get file contents");
}
obj2type = (h5trav_type_t)oinfo2.type;
trav_info_add(info2_obj, obj2fullname, obj2type);
idx = info2_obj->nused - 1;
- info2_obj->paths[idx].objno = oinfo2.addr;
+ HDmemcpy(&info2_obj->paths[idx].obj_token, &oinfo2.token, sizeof(H5O_token_t));
info2_obj->paths[idx].fileno = oinfo2.fileno;
}
else if (src_linfo2.type == H5L_TYPE_SOFT) {
@@ -778,8 +788,8 @@ h5diff(const char *fname1,
size_t idx = info1_lp->nused - 1;
H5TOOLS_DEBUG("h5diff ... ... ... info1_obj not null");
+ HDmemcpy(&info1_lp->paths[idx].obj_token, &trg_linfo1.obj_token, sizeof(H5O_token_t));
info1_lp->paths[idx].type = (h5trav_type_t)trg_linfo1.trg_type;
- info1_lp->paths[idx].objno = trg_linfo1.objno;
info1_lp->paths[idx].fileno = trg_linfo1.fileno;
}
H5TOOLS_DEBUG("h5diff check symbolic link (object1) finished");
@@ -818,8 +828,8 @@ h5diff(const char *fname1,
size_t idx = info2_lp->nused - 1;
H5TOOLS_DEBUG("h5diff ... ... ... info2_obj not null");
+ HDmemcpy(&info2_lp->paths[idx].obj_token, &trg_linfo2.obj_token, sizeof(H5O_token_t));
info2_lp->paths[idx].type = (h5trav_type_t)trg_linfo2.trg_type;
- info2_lp->paths[idx].objno = trg_linfo2.objno;
info2_lp->paths[idx].fileno = trg_linfo2.fileno;
}
H5TOOLS_DEBUG("h5diff check symbolic link (object1) finished");
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index f671b06..8321a98 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -746,8 +746,8 @@ static hsize_t diff_datum(
/* if (type_size == H5R_STD_REF_SIZE) */
hid_t region1_id = H5I_INVALID_HID;
hid_t region2_id = H5I_INVALID_HID;
- H5R_ref_t *ref1_buf = (const H5R_ref_t *)_mem1;
- H5R_ref_t *ref2_buf = (const H5R_ref_t *)_mem2;
+ H5R_ref_t *ref1_buf = (H5R_ref_t *)_mem1;
+ H5R_ref_t *ref2_buf = (H5R_ref_t *)_mem2;
H5O_type_t obj1_type = -1; /* Object type */
H5O_type_t obj2_type = -1; /* Object type */
H5R_type_t ref_type; /* Reference type */
@@ -920,7 +920,7 @@ static hsize_t diff_datum(
/* if (obj_id < 0) - could mean that no reference was written do not throw failure */
obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT);
obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT);
- if((obj1_id < 0) || (obj1_id < 0)) {
+ if((obj1_id < 0) || (obj2_id < 0)) {
H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 failed");
}
else {
@@ -979,7 +979,7 @@ static hsize_t diff_datum(
H5TOOLS_INFO("H5Ropen_attr object 2 failed");
}
- if((obj1_id < 0) || (obj1_id < 0)) {
+ if((obj1_id < 0) || (obj2_id < 0)) {
H5TOOLS_INFO("H5Ropen_attr H5R_ATTR failed");
}
else {
@@ -2394,14 +2394,22 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
/* print differences if found */
if (nfound_b && opts->m_verbose) {
- H5O_info_t oi1, oi2;
+ H5O_info2_t oi1, oi2;
+ char *obj1_str = NULL, *obj2_str = NULL;
- H5Oget_info2(obj1_id, &oi1, H5O_INFO_BASIC);
- H5Oget_info2(obj2_id, &oi2, H5O_INFO_BASIC);
+ H5Oget_info3(obj1_id, &oi1, H5O_INFO_BASIC);
+ H5Oget_info3(obj2_id, &oi2, H5O_INFO_BASIC);
- parallel_print("Referenced dataset %lu %lu\n", (unsigned long) oi1.addr, (unsigned long) oi2.addr);
+ /* Convert object tokens into printable output */
+ H5Otoken_to_str(obj1_id, &oi1.token, &obj1_str);
+ H5Otoken_to_str(obj2_id, &oi2.token, &obj2_str);
+
+ parallel_print("Referenced dataset %s %s\n", obj1_str, obj2_str);
parallel_print( "------------------------------------------------------------\n");
+ H5free_memory(obj1_str);
+ H5free_memory(obj2_str);
+
parallel_print("Region blocks\n");
for (i = 0; i < nblocks1; i++) {
parallel_print("block #%d", i);
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index e92e141..d1b4697 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -140,7 +140,7 @@ static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *ta
static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t ** table_out, diff_opt_t *opts)
{
table_attrs_t *table_lp = NULL;
- H5O_info_t oinfo1, oinfo2; /* Object info */
+ H5O_info2_t oinfo1, oinfo2; /* Object info */
hid_t attr1_id = H5I_INVALID_HID; /* attr ID */
hid_t attr2_id = H5I_INVALID_HID; /* attr ID */
size_t curr1 = 0;
@@ -155,14 +155,14 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
H5TOOLS_DEBUG("build_match_list_attrs start - errstat:%d", opts->err_stat);
- if(H5Oget_info2(loc1_id, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) {
+ if(H5Oget_info3(loc1_id, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) {
H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info first object failed");
}
- H5TOOLS_DEBUG("H5Oget_info2 loc1id=%d", oinfo1.num_attrs);
- if(H5Oget_info2(loc2_id, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) {
+ H5TOOLS_DEBUG("H5Oget_info3 loc1id=%d", oinfo1.num_attrs);
+ if(H5Oget_info3(loc2_id, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) {
H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info second object failed");
}
- H5TOOLS_DEBUG("H5Oget_info2 loc2id=%d", oinfo2.num_attrs);
+ H5TOOLS_DEBUG("H5Oget_info3 loc2id=%d", oinfo2.num_attrs);
table_attrs_init(&table_lp);
if (table_lp == NULL)
@@ -336,7 +336,6 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const
hsize_t dims2[H5S_MAX_RANK]; /* dimensions of dataset */
char np1[512];
char np2[512];
- unsigned u; /* Local index variable */
hsize_t nfound = 0;
int j;
diff_err_t ret_value = opts->err_stat;
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 7aa2419..cb9b92c 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -1480,8 +1480,6 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
break;
} /* end switch */
-done:
-
CATCH
H5TOOLS_ENDDEBUG("exit");
return ret_value;
@@ -1806,21 +1804,27 @@ hbool_t
h5tools_is_obj_same(hid_t loc_id1, const char *name1,
hid_t loc_id2, const char *name2)
{
- H5O_info_t oinfo1, oinfo2;
+ H5O_info2_t oinfo1, oinfo2;
hbool_t ret_val = FALSE;
if ( name1 && HDstrcmp(name1, "."))
- H5Oget_info_by_name2(loc_id1, name1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT);
+ H5Oget_info_by_name3(loc_id1, name1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT);
else
- H5Oget_info2(loc_id1, &oinfo1, H5O_INFO_BASIC);
+ H5Oget_info3(loc_id1, &oinfo1, H5O_INFO_BASIC);
if ( name2 && HDstrcmp(name2, "."))
- H5Oget_info_by_name2(loc_id2, name2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
+ H5Oget_info_by_name3(loc_id2, name2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
else
- H5Oget_info2(loc_id2, &oinfo2, H5O_INFO_BASIC);
+ H5Oget_info3(loc_id2, &oinfo2, H5O_INFO_BASIC);
+
+ if (oinfo1.fileno == oinfo2.fileno) {
+ int token_cmp_val;
- if (oinfo1.fileno == oinfo2.fileno && oinfo1.addr==oinfo2.addr)
- ret_val = TRUE;
+ H5Otoken_cmp(loc_id1, &oinfo1.token, &oinfo2.token, &token_cmp_val);
+
+ if(!token_cmp_val)
+ ret_val = TRUE;
+ }
return ret_val;
}
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 3af2bd8..79802c3 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -2088,15 +2088,20 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
if((type_class = H5Tget_class(type)) < 0)
H5TOOLS_THROW((-1), "H5Tget_class failed");
if (object_search && H5Tcommitted(type) > 0) {
- H5O_info_t oinfo;
- obj_t *obj = NULL; /* Found object */
+ H5O_info2_t oinfo;
+ obj_t *obj = NULL; /* Found object */
- H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
- obj = search_obj(h5dump_type_table, oinfo.addr);
+ H5Oget_info3(type, &oinfo, H5O_INFO_BASIC);
+ obj = search_obj(h5dump_type_table, &oinfo.token);
if(obj) {
- if(!obj->recorded)
- h5tools_str_append(buffer,"\"/#"H5_PRINTF_HADDR_FMT"\"", obj->objno);
+ if(!obj->recorded) {
+ char *obj_addr_str = NULL;
+
+ H5Otoken_to_str(type, &oinfo.token, &obj_addr_str);
+ h5tools_str_append(buffer,"\"/#%s\"", obj_addr_str);
+ H5free_memory(obj_addr_str);
+ }
else
h5tools_str_append(buffer, "\"%s\"", obj->objname);
}
@@ -2629,8 +2634,6 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
break;
}
-done:
-
CATCH
H5TOOLS_ENDDEBUG("exit");
return ret_value;
@@ -4052,7 +4055,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
init_acc_pos(&datactx, total_size);
datactx.need_prefix = TRUE;
- if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), ndims))) {
+ if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)ndims))) {
if(obj_data) {
if(H5Dread(obj_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_buf) < 0) {
HDfree(ref_buf);
@@ -4067,7 +4070,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
H5TOOLS_GOTO_DONE_NO_RET();
}
}
- for(i = 0; i < ndims; i++, datactx.cur_elmt++, elmt_counter++) {
+ for(i = 0; i < (size_t)ndims; i++, datactx.cur_elmt++, elmt_counter++) {
H5O_type_t obj_type = -1; /* Object type */
H5R_type_t ref_type; /* Reference type */
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index e98a8e2..0e1fa03 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -17,6 +17,7 @@
#include "h5tools.h"
#include "h5tools_utils.h"
#include "h5trav.h"
+#include "H5VLnative_private.h"
/*
@@ -34,14 +35,14 @@
*/
typedef struct {
- haddr_t objno; /* Object ID (i.e. address) */
- char *path; /* Object path */
+ H5O_token_t obj_token; /* Object token */
+ char *path; /* Object path */
} ref_path_node_t;
static H5SL_t *ref_path_table = NULL; /* the "table" (implemented with a skip list) */
static hid_t thefile = (-1);
-static int ref_path_table_put(const char *, haddr_t objno);
+static int ref_path_table_put(const char *, const H5O_token_t *token);
/*-------------------------------------------------------------------------
* Function: free_ref_path_info
@@ -80,19 +81,47 @@ free_ref_path_info(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op
*-------------------------------------------------------------------------
*/
static herr_t
-init_ref_path_cb(const char *obj_name, const H5O_info_t *oinfo,
+init_ref_path_cb(const char *obj_name, const H5O_info2_t *oinfo,
const char *already_seen, void H5_ATTR_UNUSED *_udata)
{
/* Check if the object is already in the path table */
if(NULL == already_seen) {
/* Insert the object into the path table */
- ref_path_table_put(obj_name, oinfo->addr);
+ ref_path_table_put(obj_name, &oinfo->token);
} /* end if */
return 0;
}
/*-------------------------------------------------------------------------
+ * Function: ref_path_table_cmp
+ *
+ * Purpose: Skip list key comparison function which compares two
+ * H5O_token_t objects.
+ *
+ * Return: Negative (if token2 is greater than token1)
+ * 0 (if tokens are equal)
+ * or
+ * Positive (if token1 is greater than token2)
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+ref_path_table_cmp(const void *key1, const void *key2)
+{
+ const H5O_token_t *token1 = (const H5O_token_t *)key1;
+ const H5O_token_t *token2 = (const H5O_token_t *)key2;
+ int cmp_value = 0;
+
+ if(thefile > 0)
+ H5Otoken_cmp(thefile, token1, token2, &cmp_value);
+ else
+ cmp_value = HDmemcmp(token1, token2, sizeof(H5O_token_t));
+
+ return cmp_value;
+}
+
+/*-------------------------------------------------------------------------
* Function: init_ref_path_table
*
* Purpose: Initalize the reference path table
@@ -109,7 +138,7 @@ init_ref_path_table(void)
/* Sanity check */
if(thefile > 0) {
/* Create skip list to store reference path information */
- if((ref_path_table = H5SL_create(H5SL_TYPE_HADDR, NULL))==NULL)
+ if((ref_path_table = H5SL_create(H5SL_TYPE_GENERIC, ref_path_table_cmp)) == NULL)
return (-1);
/* Iterate over objects in this file */
@@ -153,8 +182,10 @@ term_ref_path_table(void)
* Purpose: Looks up a table entry given a path name.
* Used during construction of the table.
*
- * Return: The table entre (pte) or NULL if not in the
- * table.
+ * Return: Negative on failure, Non-negative on success. The object
+ * token for the table entry is returned through the token
+ * parameter if the table entry is found by the given path
+ * name.
*
* Programmer: REMcG
*
@@ -162,33 +193,35 @@ term_ref_path_table(void)
*
*-------------------------------------------------------------------------
*/
-haddr_t
-ref_path_table_lookup(const char *thepath)
+int
+ref_path_table_lookup(const char *thepath, H5O_token_t *token)
{
- H5O_info_t oi;
+ H5O_info2_t oi;
if((thepath == NULL) || (HDstrlen(thepath) == 0))
- return HADDR_UNDEF;
+ return -1;
/* Allow lookups on the root group, even though it doesn't have any link info */
if(HDstrcmp(thepath, "/")) {
- H5L_info_t li;
+ H5L_info2_t li;
/* Check for external link first, so we don't return the OID of an object in another file */
- if(H5Lget_info(thefile, thepath, &li, H5P_DEFAULT) < 0)
- return HADDR_UNDEF;
+ if(H5Lget_info2(thefile, thepath, &li, H5P_DEFAULT) < 0)
+ return -1;
/* UD links can't be followed, so they always "dangle" like soft links. */
if(li.type >= H5L_TYPE_UD_MIN)
- return HADDR_UNDEF;
+ return -1;
} /* end if */
/* Get the object info now */
/* (returns failure for dangling soft links) */
- if(H5Oget_info_by_name2(thefile, thepath, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
- return HADDR_UNDEF;
+ if(H5Oget_info_by_name3(thefile, thepath, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ return -1;
- /* Return OID */
- return(oi.addr);
+ /* Return object token through parameter */
+ HDmemcpy(token, &oi.token, sizeof(H5O_token_t));
+
+ return 0;
}
/*-------------------------------------------------------------------------
@@ -211,7 +244,7 @@ ref_path_table_lookup(const char *thepath)
*-------------------------------------------------------------------------
*/
static int
-ref_path_table_put(const char *path, haddr_t objno)
+ref_path_table_put(const char *path, const H5O_token_t *token)
{
ref_path_node_t *new_node;
@@ -219,10 +252,10 @@ ref_path_table_put(const char *path, haddr_t objno)
if((new_node = (ref_path_node_t *)HDmalloc(sizeof(ref_path_node_t))) == NULL)
return(-1);
- new_node->objno = objno;
+ HDmemcpy(&new_node->obj_token, token, sizeof(H5O_token_t));
new_node->path = HDstrdup(path);
- return(H5SL_insert(ref_path_table, new_node, &(new_node->objno)));
+ return(H5SL_insert(ref_path_table, new_node, &(new_node->obj_token)));
}
else
return (-1);
@@ -239,46 +272,50 @@ int get_next_xid(void) {
/*
* This counter is used to create fake object ID's
- * The idea is to set it to the largest possible offest, which
+ * The idea is to set it to the largest possible offset, which
* minimizes the chance of collision with a real object id.
*
*/
haddr_t fake_xid = HADDR_MAX;
-haddr_t
-get_fake_xid (void) {
- return (fake_xid--);
+
+void
+get_fake_token(H5O_token_t *token) {
+ if(thefile > 0) {
+ /* TODO: potential for this to be called with non-native connector objects */
+ if(H5VLnative_addr_to_token(thefile, fake_xid, token) < 0)
+ *token = H5O_TOKEN_UNDEF;
+ fake_xid--;
+ }
+ else
+ *token = H5O_TOKEN_UNDEF;
}
/*
- * for an object that does not have an object id (e.g., soft link),
- * create a table entry with a fake object id as the key.
+ * for an object that does not have an object token (e.g., soft link),
+ * create a table entry with a fake object token as the key.
*
* Assumes 'path' is for an object that is not in the table.
*
*/
-haddr_t
-ref_path_table_gen_fake(const char *path)
+void
+ref_path_table_gen_fake(const char *path, H5O_token_t *token)
{
- haddr_t fake_objno;
-
- /* Generate fake ID for string */
- fake_objno = get_fake_xid();
+ /* Generate fake object token for string */
+ get_fake_token(token);
/* Create ref path table, if it hasn't already been created */
if(ref_path_table == NULL)
init_ref_path_table();
/* Insert "fake" object into table */
- ref_path_table_put(path, fake_objno);
-
- return(fake_objno);
+ ref_path_table_put(path, token);
}
/*-------------------------------------------------------------------------
* Function: lookup_ref_path
*
- * Purpose: Lookup the path to the object with refernce 'ref'.
+ * Purpose: Lookup the path to the object with the reference 'refbuf'.
*
* Return: Return a path to the object, or NULL if not found.
*
@@ -289,19 +326,48 @@ ref_path_table_gen_fake(const char *path)
*-------------------------------------------------------------------------
*/
const char *
-lookup_ref_path(haddr_t ref)
+lookup_ref_path(H5R_ref_t refbuf)
{
+ H5O_info2_t oinfo;
+ H5R_type_t ref_type;
+ hid_t ref_object;
ref_path_node_t *node;
/* Be safer for h5ls */
if(thefile < 0)
return(NULL);
+ /* Retrieve reference type */
+ if(H5R_BADTYPE == (ref_type = H5Rget_type(&refbuf)))
+ return(NULL);
+
+ /* Open the referenced object */
+ switch (ref_type) {
+ case H5R_OBJECT1:
+ case H5R_OBJECT2:
+ if((ref_object = H5Ropen_object(&refbuf, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ return(NULL);
+ break;
+
+ /* Invalid referenced object type */
+ case H5R_DATASET_REGION1:
+ case H5R_DATASET_REGION2:
+ case H5R_ATTR:
+ case H5R_MAXTYPE:
+ case H5R_BADTYPE:
+ default:
+ return(NULL);
+ }
+
+ /* Retrieve info about the referenced object */
+ if(H5Oget_info3(ref_object, &oinfo, H5O_INFO_ALL) < 0)
+ return(NULL);
+
/* Create ref path table, if it hasn't already been created */
if(ref_path_table == NULL)
init_ref_path_table();
- node = (ref_path_node_t *)H5SL_search(ref_path_table, &ref);
+ node = (ref_path_node_t *)H5SL_search(ref_path_table, &oinfo.token);
return(node ? node->path : NULL);
}
diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h
index b7bd9a3..debbea1 100644
--- a/tools/lib/h5tools_ref.h
+++ b/tools/lib/h5tools_ref.h
@@ -21,11 +21,11 @@ extern "C" {
#endif
H5TOOLS_DLL herr_t fill_ref_path_table(hid_t fid);
-H5TOOLS_DLL const char *lookup_ref_path(haddr_t ref);
+H5TOOLS_DLL const char *lookup_ref_path(H5R_ref_t refbuf);
H5TOOLS_DLL int get_next_xid(void);
-H5TOOLS_DLL haddr_t get_fake_xid(void);
-H5TOOLS_DLL haddr_t ref_path_table_lookup(const char *);
-H5TOOLS_DLL haddr_t ref_path_table_gen_fake(const char *);
+H5TOOLS_DLL void get_fake_token(H5O_token_t *token);
+H5TOOLS_DLL int ref_path_table_lookup(const char *thepath, H5O_token_t *token);
+H5TOOLS_DLL void ref_path_table_gen_fake(const char *path, H5O_token_t *token);
H5TOOLS_DLL int term_ref_path_table(void);
#ifdef __cplusplus
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 0aa5152..c9e7e94 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -1091,7 +1091,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
if (H5Tequal(type, H5T_STD_REF)) {
H5O_type_t obj_type = -1; /* Object type */
H5R_type_t ref_type; /* Reference type */
- const H5R_ref_t *ref_vp = (const H5R_ref_t *)vp;
+ H5R_ref_t *ref_vp = (H5R_ref_t *)vp;
H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF");
ref_type = H5Rget_type(ref_vp);
@@ -1100,13 +1100,13 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
case H5R_OBJECT1:
{
/* Object references -- show the type and OID of the referenced object. */
- H5O_info_t oi;
+ H5O_info2_t oi;
+ char *obj_addr_str = NULL;
H5TOOLS_DEBUG("ref_type is H5R_OBJECT1");
if((obj = H5Ropen_object(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- H5Oget_info2(obj, &oi, H5O_INFO_BASIC);
- if(H5Oclose(obj) < 0)
- H5TOOLS_ERROR(NULL, "H5Oclose H5R_OBJECT1 failed");
+ H5Oget_info3(obj, &oi, H5O_INFO_BASIC);
+ H5Otoken_to_str(obj, &oi.token, &obj_addr_str);
}
else
H5TOOLS_ERROR(NULL, "H5Ropen_object H5R_OBJECT1 failed");
@@ -1132,20 +1132,30 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
h5tools_str_append(str, "%u-%s", (unsigned) oi.type, H5_TOOLS_UNKNOWN);
break;
} /* end switch */
- H5Oclose(obj);
- h5tools_str_sprint_reference(str, info, container, ref_vp);
+
+ h5tools_str_sprint_reference(str, ref_vp);
/* Print OID */
if(info->obj_hidefileno)
- h5tools_str_append(str, info->obj_format, oi.addr);
+ h5tools_str_append(str, info->obj_format, obj_addr_str);
else
- h5tools_str_append(str, info->obj_format, oi.fileno, oi.addr);
+ h5tools_str_append(str, info->obj_format, oi.fileno, obj_addr_str);
+
+ if(obj_addr_str) {
+ H5free_memory(obj_addr_str);
+ obj_addr_str = NULL;
}
+
+ if(obj >= 0)
+ if(H5Oclose(obj) < 0)
+ H5TOOLS_ERROR(NULL, "H5Oclose H5R_OBJECT1 failed");
+ }
+
break;
case H5R_DATASET_REGION1:
H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1");
h5tools_str_append(str, H5_TOOLS_DATASET);
- h5tools_str_sprint_reference(str, info, container, ref_vp);
+ h5tools_str_sprint_reference(str, ref_vp);
break;
case H5R_OBJECT2:
H5TOOLS_DEBUG("ref_type is H5R_OBJECT2");
@@ -1169,17 +1179,17 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
h5tools_str_append(str, H5_TOOLS_UNKNOWN);
break;
} /* end switch */
- h5tools_str_sprint_reference(str, info, container, ref_vp);
+ h5tools_str_sprint_reference(str, ref_vp);
break;
case H5R_DATASET_REGION2:
H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2");
h5tools_str_append(str, H5_TOOLS_DATASET);
- h5tools_str_sprint_reference(str, info, container, ref_vp);
+ h5tools_str_sprint_reference(str, ref_vp);
break;
case H5R_ATTR:
H5TOOLS_DEBUG("ref_type is H5R_ATTR");
h5tools_str_append(str, H5_TOOLS_ATTRIBUTE);
- h5tools_str_sprint_reference(str, info, container, ref_vp);
+ h5tools_str_sprint_reference(str, ref_vp);
break;
case H5R_BADTYPE:
case H5R_MAXTYPE:
@@ -1334,7 +1344,6 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
} /* end switch */
}
-done:
ret_value = h5tools_str_fmt(str, start, OPT(info->elmt_fmt, "%s"));
H5TOOLS_ENDDEBUG("exit with %s", ret_value);
@@ -1351,8 +1360,7 @@ done:
*-------------------------------------------------------------------------
*/
void
-h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info,
- hid_t container, H5R_ref_t *ref_vp)
+h5tools_str_sprint_reference(h5tools_str_t *str, H5R_ref_t *ref_vp)
{
ssize_t buf_size;
@@ -1363,7 +1371,7 @@ h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info,
H5TOOLS_DEBUG("buf_size=%ld", buf_size);
if (buf_size) {
char *file_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1);
- if (H5Rget_file_name(ref_vp, file_name, buf_size + 1) >= 0) {
+ if (H5Rget_file_name(ref_vp, file_name, (size_t)buf_size + 1) >= 0) {
file_name[buf_size] = '\0';
H5TOOLS_DEBUG("name=%s", file_name);
h5tools_str_append(str, "%s", file_name);
@@ -1375,7 +1383,7 @@ h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info,
H5TOOLS_DEBUG("buf_size=%ld", buf_size);
if (buf_size) {
char *obj_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1);
- if (H5Rget_obj_name(ref_vp, H5P_DEFAULT, obj_name, buf_size + 1) >= 0) {
+ if (H5Rget_obj_name(ref_vp, H5P_DEFAULT, obj_name, (size_t)buf_size + 1) >= 0) {
obj_name[buf_size] = '\0';
H5TOOLS_DEBUG("name=%s", obj_name);
h5tools_str_append(str, "%s", obj_name);
@@ -1388,7 +1396,7 @@ h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info,
H5TOOLS_DEBUG("buf_size=%ld", buf_size);
if (buf_size) {
char *attr_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1);
- if (H5Rget_attr_name(ref_vp, attr_name, buf_size + 1) >= 0) {
+ if (H5Rget_attr_name(ref_vp, attr_name, (size_t)buf_size + 1) >= 0) {
attr_name[buf_size] = '\0';
H5TOOLS_DEBUG("name=%s", attr_name);
h5tools_str_append(str, "/%s", attr_name);
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index 6fdf36a..02bfe40 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -41,7 +41,7 @@ H5TOOLS_DLL char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_
H5TOOLS_DLL void h5tools_str_dump_space_slabs(h5tools_str_t *, hid_t, const h5tool_format_t *, h5tools_context_t *ctx);
H5TOOLS_DLL void h5tools_str_dump_space_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *);
H5TOOLS_DLL void h5tools_str_dump_space_points(h5tools_str_t *, hid_t, const h5tool_format_t *);
-H5TOOLS_DLL void h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info, hid_t container, H5R_ref_t *vp);
+H5TOOLS_DLL void h5tools_str_sprint_reference(h5tools_str_t *str, H5R_ref_t *vp);
H5TOOLS_DLL char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info,
hid_t container, hid_t type, void *vp,
h5tools_context_t *ctx);
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 323c9b3..45e436c 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -53,11 +53,11 @@ unsigned outBuffOffset;
FILE* overflow_file = NULL;
/* local functions */
-static void init_table(table_t **tbl);
+static void init_table(hid_t fid, table_t **tbl);
#ifdef H5DUMP_DEBUG
-static void dump_table(char* tablename, table_t *table);
+static void dump_table(hid_t fid, char* tablename, table_t *table);
#endif /* H5DUMP_DEBUG */
-static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t recorded);
+static void add_obj(table_t *table, const H5O_token_t *obj_token, const char *objname, hbool_t recorded);
/*-------------------------------------------------------------------------
* Function: parallel_print
@@ -599,10 +599,11 @@ print_version(const char *progname)
*-------------------------------------------------------------------------
*/
static void
-init_table(table_t **tbl)
+init_table(hid_t fid, table_t **tbl)
{
table_t *table = (table_t *)HDmalloc(sizeof(table_t));
+ table->fid = fid;
table->size = 20;
table->nobjs = 0;
table->objs = (obj_t *)HDmalloc(table->size * sizeof(obj_t));
@@ -644,15 +645,21 @@ free_table(table_t *table)
*-------------------------------------------------------------------------
*/
static void
-dump_table(char* tablename, table_t *table)
+dump_table(hid_t fid, char* tablename, table_t *table)
{
unsigned u;
+ char *obj_addr_str = NULL;
PRINTSTREAM(rawoutstream,"%s: # of entries = %d\n", tablename,table->nobjs);
- for (u = 0; u < table->nobjs; u++)
- PRINTSTREAM(rawoutstream,"%a %s %d %d\n", table->objs[u].objno,
+ for (u = 0; u < table->nobjs; u++) {
+ H5VLconnector_token_to_str(fid, table->objs[u].obj_token, &obj_addr_str);
+
+ PRINTSTREAM(rawoutstream,"%s %s %d %d\n", obj_addr_str,
table->objs[u].objname,
table->objs[u].displayed, table->objs[u].recorded);
+
+ H5VLfree_token_str(fid, obj_addr_str);
+ }
}
@@ -667,9 +674,9 @@ dump_table(char* tablename, table_t *table)
void
dump_tables(find_objs_t *info)
{
- dump_table("group_table", info->group_table);
- dump_table("dset_table", info->dset_table);
- dump_table("type_table", info->type_table);
+ dump_table(info->fid, "group_table", info->group_table);
+ dump_table(info->fid, "dset_table", info->dset_table);
+ dump_table(info->fid, "type_table", info->type_table);
}
#endif /* H5DUMP_DEBUG */
@@ -685,13 +692,17 @@ dump_tables(find_objs_t *info)
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE obj_t *
-search_obj(table_t *table, haddr_t objno)
+search_obj(table_t *table, const H5O_token_t *obj_token)
{
unsigned u;
+ int token_cmp;
- for(u = 0; u < table->nobjs; u++)
- if(table->objs[u].objno == objno)
+ for(u = 0; u < table->nobjs; u++) {
+ if(H5Otoken_cmp(table->fid, &table->objs[u].obj_token, obj_token, &token_cmp) < 0)
+ return NULL;
+ if(!token_cmp)
return &(table->objs[u]);
+ }
return NULL;
}
@@ -708,7 +719,7 @@ search_obj(table_t *table, haddr_t objno)
*-------------------------------------------------------------------------
*/
static herr_t
-find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen, void *op_data)
+find_objs_cb(const char *name, const H5O_info2_t *oinfo, const char *already_seen, void *op_data)
{
find_objs_t *info = (find_objs_t*)op_data;
herr_t ret_value = 0;
@@ -716,7 +727,7 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
switch(oinfo->type) {
case H5O_TYPE_GROUP:
if(NULL == already_seen)
- add_obj(info->group_table, oinfo->addr, name, TRUE);
+ add_obj(info->group_table, &oinfo->token, name, TRUE);
break;
case H5O_TYPE_DATASET:
@@ -724,18 +735,18 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
hid_t dset = H5I_INVALID_HID;
/* Add the dataset to the list of objects */
- add_obj(info->dset_table, oinfo->addr, name, TRUE);
+ add_obj(info->dset_table, &oinfo->token, name, TRUE);
/* Check for a dataset that uses a named datatype */
if((dset = H5Dopen2(info->fid, name, H5P_DEFAULT)) >= 0) {
hid_t type = H5Dget_type(dset);
if(H5Tcommitted(type) > 0) {
- H5O_info_t type_oinfo;
+ H5O_info2_t type_oinfo;
- H5Oget_info2(type, &type_oinfo, H5O_INFO_BASIC);
- if(search_obj(info->type_table, type_oinfo.addr) == NULL)
- add_obj(info->type_table, type_oinfo.addr, name, FALSE);
+ H5Oget_info3(type, &type_oinfo, H5O_INFO_BASIC);
+ if(search_obj(info->type_table, &type_oinfo.token) == NULL)
+ add_obj(info->type_table, &type_oinfo.token, name, FALSE);
} /* end if */
H5Tclose(type);
@@ -750,8 +761,8 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
if(NULL == already_seen) {
obj_t *found_obj;
- if((found_obj = search_obj(info->type_table, oinfo->addr)) == NULL)
- add_obj(info->type_table, oinfo->addr, name, TRUE);
+ if((found_obj = search_obj(info->type_table, &oinfo->token)) == NULL)
+ add_obj(info->type_table, &oinfo->token, name, TRUE);
else {
/* Use latest version of name */
HDfree(found_obj->objname);
@@ -791,9 +802,9 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
herr_t ret_value = SUCCEED;
/* Initialize the tables */
- init_table(group_table);
- init_table(dset_table);
- init_table(type_table);
+ init_table(fid, group_table);
+ init_table(fid, dset_table);
+ init_table(fid, type_table);
/* Init the find_objs_t */
info->fid = fid;
@@ -829,7 +840,7 @@ done:
*-------------------------------------------------------------------------
*/
static void
-add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record)
+add_obj(table_t *table, const H5O_token_t *obj_token, const char *objname, hbool_t record)
{
size_t u;
@@ -843,7 +854,7 @@ add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record)
u = table->nobjs++;
/* Set information about object */
- table->objs[u].objno = objno;
+ HDmemcpy(&table->objs[u].obj_token, obj_token, sizeof(H5O_token_t));
table->objs[u].objname = HDstrdup(objname);
table->objs[u].recorded = record;
table->objs[u].displayed = 0;
@@ -893,7 +904,7 @@ int
H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info, hbool_t get_obj_type)
{
htri_t l_ret;
- H5O_info_t trg_oinfo;
+ H5O_info2_t trg_oinfo;
hid_t fapl = H5P_DEFAULT;
hid_t lapl = H5P_DEFAULT;
int ret_value = -1; /* init to fail */
@@ -915,7 +926,7 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_
} /* end if */
/* get info from link */
- if(H5Lget_info(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0) {
+ if(H5Lget_info2(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0) {
if(link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to get link info from <%s>\n",linkpath);
H5TOOLS_GOTO_DONE(FAIL);
@@ -971,7 +982,7 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_
}
/* get target object info */
- if(H5Oget_info_by_name2(file_id, linkpath, &trg_oinfo, H5O_INFO_BASIC, lapl) < 0) {
+ if(H5Oget_info_by_name3(file_id, linkpath, &trg_oinfo, H5O_INFO_BASIC, lapl) < 0) {
if(link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to get object information for <%s>\n", linkpath);
H5TOOLS_GOTO_DONE(FAIL);
@@ -985,8 +996,8 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_
} /* end if */
/* set target obj type to return */
+ HDmemcpy(&link_info->obj_token, &trg_oinfo.token, sizeof(H5O_token_t));
link_info->trg_type = trg_oinfo.type;
- link_info->objno = trg_oinfo.addr;
link_info->fileno = trg_oinfo.fileno;
} /* end if */
else
diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h
index 17c16bf..366800a 100644
--- a/tools/lib/h5tools_utils.h
+++ b/tools/lib/h5tools_utils.h
@@ -95,14 +95,15 @@ H5TOOLS_DLL int get_option(int argc, const char **argv, const char *opt, const s
/*struct taken from the dumper. needed in table struct*/
typedef struct obj_t {
- haddr_t objno;
- char *objname;
- hbool_t displayed; /* Flag to indicate that the object has been displayed */
- hbool_t recorded; /* Flag for named datatypes to indicate they were found in the group hierarchy */
+ H5O_token_t obj_token;
+ char *objname;
+ hbool_t displayed; /* Flag to indicate that the object has been displayed */
+ hbool_t recorded; /* Flag for named datatypes to indicate they were found in the group hierarchy */
} obj_t;
/*struct for the tables that the find_objs function uses*/
typedef struct table_t {
+ hid_t fid;
size_t size;
size_t nobjs;
obj_t *objs;
@@ -131,7 +132,7 @@ H5TOOLS_DLL void free_table(table_t *table);
H5TOOLS_DLL void dump_tables(find_objs_t *info)
#endif /* H5DUMP_DEBUG */
H5TOOLS_DLL herr_t init_objs(hid_t fid, find_objs_t *info, table_t **group_table, table_t **dset_table, table_t **type_table);
-H5TOOLS_DLL obj_t *search_obj(table_t *temp, haddr_t objno);
+H5TOOLS_DLL obj_t *search_obj(table_t *temp, const H5O_token_t *obj_token);
#ifndef H5_HAVE_TMPFILE
H5TOOLS_DLL FILE *tmpfile(void);
#endif
@@ -158,9 +159,9 @@ typedef struct {
H5O_type_t trg_type; /* OUT: target type */
char *trg_path; /* OUT: target obj path. This must be freed
* when used with H5tools_get_symlink_info() */
- haddr_t objno; /* OUT: target object address */
+ H5O_token_t obj_token; /* OUT: target object token */
unsigned long fileno; /* OUT: File number that target object is located in */
- H5L_info_t linfo; /* OUT: link info */
+ H5L_info2_t linfo; /* OUT: link info */
h5tool_opt_t opt; /* IN: options */
} h5tool_link_info_t;
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index fb768a4..dc7e27d 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -21,7 +21,7 @@
*-------------------------------------------------------------------------
*/
typedef struct trav_addr_path_t {
- haddr_t addr;
+ H5O_token_t token;
char *path;
} trav_addr_path_t;
@@ -43,7 +43,7 @@ typedef struct {
hbool_t is_absolute; /* Whether the traversal has absolute paths */
const char *base_grp_name; /* Name of the group that serves as the base
* for iteration */
- unsigned fields; /* Fields needed in H5O_info_t struct */
+ unsigned fields; /* Fields needed in H5O_info2_t struct */
} trav_ud_traverse_t;
typedef struct {
@@ -65,10 +65,10 @@ typedef struct trav_path_op_data_t {
*/
static void trav_table_add(trav_table_t *table,
const char *objname,
- const H5O_info_t *oinfo);
+ const H5O_info2_t *oinfo);
static void trav_table_addlink(trav_table_t *table,
- haddr_t objno,
+ const H5O_token_t *obj_token,
const char *path);
/*-------------------------------------------------------------------------
@@ -116,15 +116,15 @@ h5trav_set_verbose(int print_verbose)
/*-------------------------------------------------------------------------
- * Function: trav_addr_add
+ * Function: trav_token_add
*
- * Purpose: Add a hardlink address to visited data structure
+ * Purpose: Add an object token to visited data structure
*
* Return: void
*-------------------------------------------------------------------------
*/
static void
-trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path)
+trav_token_add(trav_addr_t *visited, H5O_token_t *token, const char *path)
{
size_t idx; /* Index of address to use */
@@ -136,33 +136,37 @@ trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path)
/* Append it */
idx = visited->nused++;
- visited->objs[idx].addr = addr;
+ HDmemcpy(&visited->objs[idx].token, token, sizeof(H5O_token_t));
visited->objs[idx].path = HDstrdup(path);
-} /* end trav_addr_add() */
+} /* end trav_token_add() */
/*-------------------------------------------------------------------------
- * Function: trav_addr_visited
+ * Function: trav_token_visited
*
- * Purpose: Check if an address has already been visited
+ * Purpose: Check if an object token has already been seen
*
* Return: TRUE/FALSE
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE static const char *
-trav_addr_visited(trav_addr_t *visited, haddr_t addr)
+trav_token_visited(hid_t loc_id, trav_addr_t *visited, H5O_token_t *token)
{
size_t u; /* Local index variable */
+ int token_cmp;
/* Look for address */
- for(u = 0; u < visited->nused; u++)
+ for(u = 0; u < visited->nused; u++) {
/* Check for address already in array */
- if(visited->objs[u].addr == addr)
+ if(H5Otoken_cmp(loc_id, &visited->objs[u].token, token, &token_cmp) < 0)
+ return NULL;
+ if(!token_cmp)
return(visited->objs[u].path);
+ }
- /* Didn't find address */
+ /* Didn't find object token */
return(NULL);
-} /* end trav_addr_visited() */
+} /* end trav_token_visited() */
/*-------------------------------------------------------------------------
@@ -172,7 +176,7 @@ trav_addr_visited(trav_addr_t *visited, haddr_t addr)
*-------------------------------------------------------------------------
*/
static herr_t
-traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
+traverse_cb(hid_t loc_id, const char *path, const H5L_info2_t *linfo,
void *_udata)
{
trav_ud_traverse_t *udata = (trav_ud_traverse_t *)_udata; /* User data */
@@ -199,10 +203,10 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
/* Perform the correct action for different types of links */
if(linfo->type == H5L_TYPE_HARD) {
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
/* Get information about the object */
- if(H5Oget_info_by_name2(loc_id, path, &oinfo, udata->fields, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(loc_id, path, &oinfo, udata->fields, H5P_DEFAULT) < 0) {
if(new_name)
HDfree(new_name);
return(H5_ITER_ERROR);
@@ -212,8 +216,8 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
* already visited, if it isn't there already
*/
if(oinfo.rc > 1)
- if(NULL == (already_visited = trav_addr_visited(udata->seen, oinfo.addr)))
- trav_addr_add(udata->seen, oinfo.addr, full_name);
+ if(NULL == (already_visited = trav_token_visited(loc_id, udata->seen, &oinfo.token)))
+ trav_token_add(udata->seen, &oinfo.token, full_name);
/* Make 'visit object' callback */
if(udata->visitor->visit_obj)
@@ -254,11 +258,11 @@ static int
traverse(hid_t file_id, const char *grp_name, hbool_t visit_start,
hbool_t recurse, const trav_visitor_t *visitor, unsigned fields)
{
- H5O_info_t oinfo; /* Object info for starting group */
+ H5O_info2_t oinfo; /* Object info for starting group */
int ret_value = 0;
/* Get info for starting object */
- if(H5Oget_info_by_name2(file_id, grp_name, &oinfo, fields, H5P_DEFAULT) < 0)
+ if(H5Oget_info_by_name3(file_id, grp_name, &oinfo, fields, H5P_DEFAULT) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Oget_info_by_name failed");
/* Visit the starting object */
@@ -276,7 +280,7 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start,
/* Check for multiple links to top group */
if(oinfo.rc > 1)
- trav_addr_add(&seen, oinfo.addr, grp_name);
+ trav_token_add(&seen, &oinfo.token, grp_name);
/* Set up user data structure */
udata.seen = &seen;
@@ -288,12 +292,12 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start,
/* Check for iteration of links vs. visiting all links recursively */
if(recurse) {
/* Visit all links in group, recursively */
- if(H5Lvisit_by_name(file_id, grp_name, trav_index_by, trav_index_order, traverse_cb, &udata, H5P_DEFAULT) < 0)
+ if(H5Lvisit_by_name2(file_id, grp_name, trav_index_by, trav_index_order, traverse_cb, &udata, H5P_DEFAULT) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Lvisit_by_name failed");
} /* end if */
else {
/* Iterate over links in group */
- if(H5Literate_by_name(file_id, grp_name, trav_index_by, trav_index_order, NULL, traverse_cb, &udata, H5P_DEFAULT) < 0)
+ if(H5Literate_by_name2(file_id, grp_name, trav_index_by, trav_index_order, NULL, traverse_cb, &udata, H5P_DEFAULT) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Literate_by_name failed");
} /* end else */
@@ -338,7 +342,9 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type)
info->paths[idx].path = HDstrdup(path);
info->paths[idx].type = obj_type;
info->paths[idx].fileno = 0;
- info->paths[idx].objno = HADDR_UNDEF;
+
+ /* Set token to 'undefined' values */
+ info->paths[idx].obj_token = H5O_TOKEN_UNDEF;
}
} /* end trav_info_add() */
@@ -354,15 +360,15 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type)
void
trav_fileinfo_add(trav_info_t *info, hid_t loc_id)
{
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
size_t idx = info->nused - 1;
- if ( info->paths[idx].path && HDstrcmp(info->paths[idx].path, "."))
- H5Oget_info_by_name2(loc_id, info->paths[idx].path, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ if(info->paths[idx].path && HDstrcmp(info->paths[idx].path, "."))
+ H5Oget_info_by_name3(loc_id, info->paths[idx].path, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
else
- H5Oget_info2(loc_id, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(loc_id, &oinfo, H5O_INFO_BASIC);
- info->paths[idx].objno = oinfo.addr;
+ HDmemcpy(&info->paths[idx].obj_token, &oinfo.token, sizeof(H5O_token_t));
info->paths[idx].fileno = oinfo.fileno;
} /* end trav_fileinfo_add() */
@@ -377,7 +383,7 @@ trav_fileinfo_add(trav_info_t *info, hid_t loc_id)
*-------------------------------------------------------------------------
*/
int
-trav_info_visit_obj(const char *path, const H5O_info_t *oinfo,
+trav_info_visit_obj(const char *path, const H5O_info2_t *oinfo,
const char H5_ATTR_UNUSED *already_visited, void *udata)
{
size_t idx;
@@ -390,7 +396,7 @@ trav_info_visit_obj(const char *path, const H5O_info_t *oinfo,
/* set object addr and fileno. These are for checking same object */
info_p = (trav_info_t *) udata;
idx = info_p->nused - 1;
- info_p->paths[idx].objno = oinfo->addr;
+ HDmemcpy(&info_p->paths[idx].obj_token, &oinfo->token, sizeof(H5O_token_t));
info_p->paths[idx].fileno = oinfo->fileno;
return(0);
@@ -407,7 +413,7 @@ trav_info_visit_obj(const char *path, const H5O_info_t *oinfo,
*-------------------------------------------------------------------------
*/
int
-trav_info_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
+trav_info_visit_lnk(const char *path, const H5L_info2_t *linfo, void *udata)
{
/* Add the link to the 'info' struct */
trav_info_add((trav_info_t *)udata, path, ((linfo->type == H5L_TYPE_SOFT) ? H5TRAV_TYPE_LINK : H5TRAV_TYPE_UDLINK));
@@ -547,7 +553,7 @@ trav_info_free(trav_info_t *info)
*-------------------------------------------------------------------------
*/
static int
-trav_table_visit_obj(const char *path, const H5O_info_t *oinfo,
+trav_table_visit_obj(const char *path, const H5O_info2_t *oinfo,
const char *already_visited, void *udata)
{
trav_table_t *table = (trav_table_t *)udata;
@@ -558,7 +564,7 @@ trav_table_visit_obj(const char *path, const H5O_info_t *oinfo,
trav_table_add(table, path, oinfo);
else
/* Add alias for object to table */
- trav_table_addlink(table, oinfo->addr, path);
+ trav_table_addlink(table, &oinfo->token, path);
return 0;
} /* end trav_table_visit_obj() */
@@ -574,7 +580,7 @@ trav_table_visit_obj(const char *path, const H5O_info_t *oinfo,
*-------------------------------------------------------------------------
*/
static int
-trav_table_visit_lnk(const char *path, const H5L_info_t H5_ATTR_UNUSED *linfo, void *udata)
+trav_table_visit_lnk(const char *path, const H5L_info2_t H5_ATTR_UNUSED *linfo, void *udata)
{
/* Add the link to the 'table' struct */
trav_table_add((trav_table_t *)udata, path, NULL);
@@ -663,9 +669,7 @@ h5trav_getindext(const char *name, const trav_table_t *table)
*-------------------------------------------------------------------------
*/
static void
-trav_table_add(trav_table_t *table,
- const char *path,
- const H5O_info_t *oinfo)
+trav_table_add(trav_table_t *table, const char *path, const H5O_info2_t *oinfo)
{
size_t new_obj;
@@ -676,7 +680,11 @@ trav_table_add(trav_table_t *table,
} /* end if */
new_obj = table->nobjs++;
- table->objs[new_obj].objno = oinfo ? oinfo->addr : HADDR_UNDEF;
+ if(oinfo)
+ HDmemcpy(&table->objs[new_obj].obj_token, &oinfo->token, sizeof(H5O_token_t));
+ else
+ /* Set token to 'undefined' values */
+ table->objs[new_obj].obj_token = H5O_TOKEN_UNDEF;
table->objs[new_obj].flags[0] = table->objs[new_obj].flags[1] = 0;
table->objs[new_obj].is_same_trgobj = 0;
table->objs[new_obj].name = (char *)HDstrdup(path);
@@ -696,13 +704,16 @@ trav_table_add(trav_table_t *table,
*-------------------------------------------------------------------------
*/
static void
-trav_table_addlink(trav_table_t *table, haddr_t objno, const char *path)
+trav_table_addlink(trav_table_t *table, const H5O_token_t *obj_token, const char *path)
{
size_t i; /* Local index variable */
+ int token_cmp;
if(table) {
for(i = 0; i < table->nobjs; i++) {
- if(table->objs[i].objno == objno) {
+ if(H5Otoken_cmp(table->fid, &table->objs[i].obj_token, obj_token, &token_cmp) < 0)
+ return;
+ if(!token_cmp) {
size_t n;
/* already inserted? */
@@ -720,9 +731,9 @@ trav_table_addlink(trav_table_t *table, haddr_t objno, const char *path)
table->objs[i].links[n].new_name = (char *)HDstrdup(path);
return;
- } /* end for */
+ } /* end if */
} /* end for */
- }
+ } /* end if */
}
@@ -748,7 +759,10 @@ void trav_table_addflags(unsigned *flags,
} /* end if */
new_obj = table->nobjs++;
- table->objs[new_obj].objno = 0;
+
+ /* Set token to 'undefined' values */
+ table->objs[new_obj].obj_token = H5O_TOKEN_UNDEF;
+
table->objs[new_obj].flags[0] = flags[0];
table->objs[new_obj].flags[1] = flags[1];
table->objs[new_obj].is_same_trgobj = 0;
@@ -769,10 +783,11 @@ void trav_table_addflags(unsigned *flags,
* Return: void
*-------------------------------------------------------------------------
*/
-void trav_table_init(trav_table_t **tbl)
+void trav_table_init(hid_t fid, trav_table_t **tbl)
{
trav_table_t* table = (trav_table_t*) HDmalloc(sizeof(trav_table_t));
if(table) {
+ table->fid = fid;
table->size = 0;
table->nobjs = 0;
table->objs = NULL;
@@ -893,8 +908,8 @@ trav_attr(hid_t
*-------------------------------------------------------------------------
*/
static int
-trav_print_visit_obj(const char *path, const H5O_info_t *oinfo,
- const char *already_visited, void *udata)
+trav_print_visit_obj(const char *path, const H5O_info2_t *oinfo,
+ const char *already_visited, void *udata)
{
trav_print_udata_t *print_udata = (trav_print_udata_t *)udata;
/* Print the name of the object */
@@ -951,7 +966,7 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo,
*-------------------------------------------------------------------------
*/
static int
-trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
+trav_print_visit_lnk(const char *path, const H5L_info2_t *linfo, void *udata)
{
trav_print_udata_t *print_udata = (trav_print_udata_t *)udata;
diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h
index a1d33b7..88473ad 100644
--- a/tools/lib/h5trav.h
+++ b/tools/lib/h5trav.h
@@ -17,9 +17,9 @@
#include "hdf5.h"
/* Typedefs for visiting objects */
-typedef herr_t (*h5trav_obj_func_t)(const char *path_name, const H5O_info_t *oinfo,
+typedef herr_t (*h5trav_obj_func_t)(const char *path_name, const H5O_info2_t *oinfo,
const char *first_seen, void *udata);
-typedef herr_t (*h5trav_lnk_func_t)(const char *path_name, const H5L_info_t *linfo,
+typedef herr_t (*h5trav_lnk_func_t)(const char *path_name, const H5L_info2_t *linfo,
void *udata);
/*-------------------------------------------------------------------------
@@ -65,7 +65,7 @@ typedef struct symlink_trav_t {
typedef struct trav_path_t {
char *path;
h5trav_type_t type;
- haddr_t objno; /* object address */
+ H5O_token_t obj_token; /* object token */
unsigned long fileno; /* File number that object is located in */
} trav_path_t;
@@ -95,7 +95,7 @@ typedef struct trav_link_t {
*/
typedef struct trav_obj_t {
- haddr_t objno; /* object address */
+ H5O_token_t obj_token; /* object token */
unsigned flags[2]; /* h5diff.object is present or not in both files*/
hbool_t is_same_trgobj; /* same target object? no need to compare */
char *name; /* name */
@@ -112,6 +112,7 @@ typedef struct trav_obj_t {
*/
typedef struct trav_table_t {
+ hid_t fid;
size_t size;
size_t nobjs;
trav_obj_t *objs;
@@ -144,8 +145,8 @@ H5TOOLS_DLL hbool_t symlink_is_visited(symlink_trav_t *visited, H5L_type_t type,
*/
H5TOOLS_DLL int h5trav_getinfo(hid_t file_id, trav_info_t *info);
H5TOOLS_DLL ssize_t h5trav_getindex(const trav_info_t *info, const char *obj);
-H5TOOLS_DLL int trav_info_visit_obj (const char *path, const H5O_info_t *oinfo, const char *already_visited, void *udata);
-H5TOOLS_DLL int trav_info_visit_lnk (const char *path, const H5L_info_t *linfo, void *udata);
+H5TOOLS_DLL int trav_info_visit_obj(const char *path, const H5O_info2_t *oinfo, const char *already_visited, void *udata);
+H5TOOLS_DLL int trav_info_visit_lnk(const char *path, const H5L_info2_t *linfo, void *udata);
/*-------------------------------------------------------------------------
* "h5trav table" public functions
@@ -184,7 +185,7 @@ H5TOOLS_DLL void trav_fileinfo_add(trav_info_t *info, hid_t loc_id);
*-------------------------------------------------------------------------
*/
-H5TOOLS_DLL void trav_table_init(trav_table_t **table);
+H5TOOLS_DLL void trav_table_init(hid_t fid, trav_table_t **table);
H5TOOLS_DLL void trav_table_free(trav_table_t *table);
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index 731fcd7..d97fdc0 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -1398,7 +1398,7 @@ main(int argc, const char *argv[])
hid_t fapl_id = H5P_DEFAULT;
H5E_auto2_t func;
H5E_auto2_t tools_func;
- H5O_info_t oi;
+ H5O_info2_t oi;
struct handler_t *hand = NULL;
int i;
unsigned u;
@@ -1567,7 +1567,7 @@ main(int argc, const char *argv[])
}
/* Get object info for root group */
- if(H5Oget_info_by_name2(fid, "/", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(fid, "/", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c
index 2eb11fd..a410fda 100644
--- a/tools/src/h5dump/h5dump_ddl.c
+++ b/tools/src/h5dump/h5dump_ddl.c
@@ -31,7 +31,7 @@ typedef struct {
} trav_attr_udata_t;
/* callback function used by H5Literate() */
-static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void *op_data);
+static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void *op_data);
static int dump_extlink(hid_t group, const char *linkname, const char *objname);
/*-------------------------------------------------------------------------
@@ -152,7 +152,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *
*-------------------------------------------------------------------------
*/
static herr_t
-dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data)
+dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATTR_UNUSED *op_data)
{
hid_t obj;
hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
@@ -200,10 +200,10 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
HDstrcat(obj_path, name);
if(linfo->type == H5L_TYPE_HARD) {
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
/* Stat the object */
- if(H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("unable to get object information for \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
@@ -259,7 +259,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
if(oinfo.rc > 1 || hit_elink) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(dset_table, oinfo.addr);
+ found_obj = search_obj(dset_table, &oinfo.token);
if(found_obj == NULL) {
ctx.indent_level++;
@@ -596,9 +596,9 @@ link_iteration(hid_t gid, unsigned crt_order_flags)
/* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group, then, sort by creation order, otherwise by name */
if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL);
+ H5Literate2(gid, sort_by, sort_order, NULL, dump_all_cb, NULL);
else
- H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL);
+ H5Literate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL);
}
/*-------------------------------------------------------------------------
@@ -612,7 +612,7 @@ link_iteration(hid_t gid, unsigned crt_order_flags)
void
dump_named_datatype(hid_t tid, const char *name)
{
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
unsigned attr_crt_order_flags;
hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */
hsize_t curr_pos = 0; /* total data element position */
@@ -670,7 +670,7 @@ dump_named_datatype(hid_t tid, const char *name)
h5tools_dump_header_format->datatypeblockbegin);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC);
/* Must check for uniqueness of all objects if we've traversed an elink,
* otherwise only check if the reference count > 1.
@@ -678,7 +678,7 @@ dump_named_datatype(hid_t tid, const char *name)
if(oinfo.rc > 1 || hit_elink) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(type_table, oinfo.addr);
+ found_obj = search_obj(type_table, &oinfo.token);
if (found_obj == NULL) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
@@ -739,7 +739,7 @@ done:
void
dump_group(hid_t gid, const char *name)
{
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
hid_t dset;
hid_t type;
hid_t gcpl_id;
@@ -816,9 +816,15 @@ dump_group(hid_t gid, const char *name)
/* dump unamed type in root group */
for(u = 0; u < type_table->nobjs; u++)
if(!type_table->objs[u].recorded) {
+ char *obj_addr_str = NULL;
+
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+
+ H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_addr_str);
+ HDsprintf(type_name, "#%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
+
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -830,7 +836,7 @@ dump_group(hid_t gid, const char *name)
h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid);
- H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(gid, &oinfo, H5O_INFO_BASIC);
/* Must check for uniqueness of all objects if we've traversed an elink,
* otherwise only check if the reference count > 1.
@@ -838,7 +844,7 @@ dump_group(hid_t gid, const char *name)
if(oinfo.rc > 1 || hit_elink) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(group_table, oinfo.addr);
+ found_obj = search_obj(group_table, &oinfo.token);
if (found_obj == NULL) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
@@ -1251,8 +1257,13 @@ dump_fcontents(hid_t fid)
unsigned u;
for (u = 0; u < type_table->nobjs; u++) {
- if (!type_table->objs[u].recorded)
- PRINTSTREAM(rawoutstream, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno);
+ if (!type_table->objs[u].recorded) {
+ char *obj_addr_str = NULL;
+
+ H5Otoken_to_str(fid, &type_table->objs[u].obj_token, &obj_addr_str);
+ PRINTSTREAM(rawoutstream, " %-10s /#%s\n", "datatype", obj_addr_str);
+ H5free_memory(obj_addr_str);
+ }
}
}
@@ -1319,7 +1330,7 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a
} /* end attr_search() */
static herr_t
-obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data)
+obj_search(const char *path, const H5O_info2_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data)
{
trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data;
const char *op_name = handle_data->op_name;
@@ -1356,7 +1367,7 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al
} /* end obj_search() */
static herr_t
-lnk_search(const char *path, const H5L_info_t *li, void *_op_data)
+lnk_search(const char *path, const H5L_info2_t *li, void *_op_data)
{
size_t search_len;
size_t k;
@@ -1608,7 +1619,7 @@ error:
void
handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name)
{
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
hid_t dsetid;
hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
struct subset_t *sset = (struct subset_t *)data;
@@ -1719,11 +1730,11 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
} /* end if */
- H5Oget_info2(dsetid, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(dsetid, &oinfo, H5O_INFO_BASIC);
if(oinfo.rc > 1 || hit_elink) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(dset_table, oinfo.addr);
+ found_obj = search_obj(dset_table, &oinfo.token);
if(found_obj) {
if (found_obj->displayed) {
@@ -1812,9 +1823,9 @@ handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, c
void
handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
{
- H5L_info_t linfo;
+ H5L_info2_t linfo;
- if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) {
+ if(H5Lget_info2(fid, links, &linfo, H5P_DEFAULT) < 0) {
error_msg("unable to get link info from \"%s\"\n", links);
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1903,8 +1914,12 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe
char name[128];
if(!type_table->objs[idx].recorded) {
+ char *obj_addr_string = NULL;
+
/* unamed datatype */
- HDsprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno);
+ H5Otoken_to_str(fid, &type_table->objs[idx].obj_token, &obj_addr_string);
+ HDsprintf(name, "/#%s", obj_addr_string);
+ H5free_memory(obj_addr_string);
if(!HDstrcmp(name, real_name))
break;
@@ -1962,7 +1977,7 @@ static int
dump_extlink(hid_t group, const char *linkname, const char *objname)
{
hid_t oid;
- H5O_info_t oi;
+ H5O_info2_t oi;
table_t *old_group_table = group_table;
table_t *old_dset_table = dset_table;
table_t *old_type_table = type_table;
@@ -1974,7 +1989,7 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
goto fail;
/* Get object info */
- if (H5Oget_info2(oid, &oi, H5O_INFO_BASIC) < 0) {
+ if (H5Oget_info3(oid, &oi, H5O_INFO_BASIC) < 0) {
H5Oclose(oid);
goto fail;
}
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index c116da8..7a3ad80 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -106,7 +106,7 @@ static h5tool_format_t xml_dataformat = {
/* internal functions */
-static int xml_name_to_XID(const char *, char *, int , int );
+static int xml_name_to_XID(hid_t, const char *, char *, int, int);
/* internal functions used by XML option */
static void xml_print_datatype(hid_t, unsigned);
@@ -130,7 +130,7 @@ static char *xml_escape_the_name(const char *);
*-------------------------------------------------------------------------
*/
static herr_t
-xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data)
+xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATTR_UNUSED *op_data)
{
hid_t obj;
herr_t ret = SUCCEED;
@@ -177,10 +177,10 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
HDstrcat(obj_path, name);
if(linfo->type == H5L_TYPE_HARD) {
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
/* Stat the object */
- if(H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("unable to get object information for \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
@@ -225,7 +225,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
if(oinfo.rc > 1 || hit_elink) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(dset_table, oinfo.addr);
+ found_obj = search_obj(dset_table, &oinfo.token);
if(found_obj == NULL) {
ctx.indent_level++;
@@ -272,8 +272,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
char pointerxid[100];
/* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(obj_path, dsetxid, (int)sizeof(dsetxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+ xml_name_to_XID(obj, obj_path, dsetxid, (int)sizeof(dsetxid), 1);
+ xml_name_to_XID(obj, prefix, parentxid, (int)sizeof(parentxid), 1);
ctx.need_prefix = TRUE;
@@ -290,7 +290,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
t_prefix); /* H5ParentPaths */
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
+ xml_name_to_XID(obj, found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
ctx.indent_level++;
@@ -393,11 +393,11 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
} /* end else */
/* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+ xml_name_to_XID(group, t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(group, prefix, parentxid, (int)sizeof(parentxid), 1);
/* Try to create an OBJ-XID for the object pointed to */
- res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0);
+ res = xml_name_to_XID(group, t_link_path, targetxid, (int)sizeof(targetxid), 0);
if (res == 0) {
/* target obj found */
ctx.need_prefix = TRUE;
@@ -482,8 +482,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
char *t_targname = xml_escape_the_name(targname);
/* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+ xml_name_to_XID(group, t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(group, prefix, parentxid, (int)sizeof(parentxid), 1);
ctx.need_prefix = TRUE;
@@ -528,8 +528,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
char *t_obj_path = xml_escape_the_name(obj_path);
/* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+ xml_name_to_XID(group, t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(group, prefix, parentxid, (int)sizeof(parentxid), 1);
ctx.need_prefix = TRUE;
@@ -575,20 +575,26 @@ done:
* 1 - generate a fake entry and return fake id.
*/
int
-xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
+xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen)
{
- haddr_t objno; /* Object ID for object at path */
+ H5O_token_t obj_token;
+ char *obj_addr_str = NULL;
+ int lookup_ret;
if (outlen < 22) return 1;
- objno = ref_path_table_lookup(str);
- if (objno == HADDR_UNDEF) {
+ lookup_ret = ref_path_table_lookup(str, &obj_token);
+ if (lookup_ret < 0) {
if (HDstrlen(str) == 0) {
- objno = ref_path_table_lookup("/");
- if (objno == HADDR_UNDEF) {
+ lookup_ret = ref_path_table_lookup("/", &obj_token);
+ if (lookup_ret < 0) {
if (gen) {
- objno = ref_path_table_gen_fake(str);
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ ref_path_table_gen_fake(str, &obj_token);
+
+ H5Otoken_to_str(loc_id, &obj_token, &obj_addr_str);
+ HDsprintf(outstr, "xid_%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
+
return 0;
}
else {
@@ -598,8 +604,12 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
}
else {
if (gen) {
- objno = ref_path_table_gen_fake(str);
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ ref_path_table_gen_fake(str, &obj_token);
+
+ H5Otoken_to_str(loc_id, &obj_token, &obj_addr_str);
+ HDsprintf(outstr, "xid_%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
+
return 0;
}
else {
@@ -608,7 +618,9 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
}
}
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ H5Otoken_to_str(loc_id, &obj_token, &obj_addr_str);
+ HDsprintf(outstr, "xid_%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
return 0;
}
@@ -878,12 +890,12 @@ xml_print_datatype(hid_t type, unsigned in_group)
outputformat = &string_dataformat;
if(!in_group && H5Tcommitted(type) > 0) {
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
obj_t *found_obj; /* Found object */
/* detect a shared datatype, output only once */
- H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
- found_obj = search_obj(type_table, oinfo.addr);
+ H5Oget_info3(type, &oinfo, H5O_INFO_BASIC);
+ found_obj = search_obj(type_table, &oinfo.token);
if(found_obj) {
/* This should be defined somewhere else */
@@ -891,7 +903,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
probably will have something different eventually */
char * dtxid = (char *)HDmalloc((size_t)100);
- xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
+ xml_name_to_XID(type, found_obj->objname, dtxid, 100, 1);
if (!found_obj->recorded) {
/* 'anonymous' NDT. Use it's object num.
as it's name. */
@@ -1531,19 +1543,19 @@ xml_dump_datatype(hid_t type)
dump_indent += COL;
if(H5Tcommitted(type) > 0) {
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
obj_t *found_obj; /* Found object */
/* Datatype is a shared or named datatype */
- H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
- found_obj = search_obj(type_table, oinfo.addr);
+ H5Oget_info3(type, &oinfo, H5O_INFO_BASIC);
+ found_obj = search_obj(type_table, &oinfo.token);
if(found_obj) {
/* Shared datatype, must be entered as an object */
/* These 2 cases are the same now, but may change */
char *dtxid = (char *)HDmalloc((size_t)100);
- xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
+ xml_name_to_XID(type, found_obj->objname, dtxid, 100, 1);
if (!found_obj->recorded) {
/* anonymous stored datatype:
following the dumper's current
@@ -2293,8 +2305,8 @@ xml_dump_named_datatype(hid_t type, const char *name)
t_prefix = xml_escape_the_name(prefix);
t_name = xml_escape_the_name(name);
- xml_name_to_XID(tmp, dtxid, 100, 1);
- xml_name_to_XID(prefix, parentxid, 100, 1);
+ xml_name_to_XID(type, tmp, dtxid, 100, 1);
+ xml_name_to_XID(type, prefix, parentxid, 100, 1);
if(HDstrncmp(name, "#", (size_t)1) == 0) {
/* Special: this is an 'anonymous' NDT, deleted but
still in use.
@@ -2317,7 +2329,7 @@ xml_dump_named_datatype(hid_t type, const char *name)
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
ctx.need_prefix = TRUE;
@@ -2331,12 +2343,12 @@ xml_dump_named_datatype(hid_t type, const char *name)
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* Check uniqueness of named datatype */
- H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(type, &oinfo, H5O_INFO_BASIC);
if(oinfo.rc > 1) {
obj_t *found_obj; /* Found object */
/* Group with more than one link to it... */
- found_obj = search_obj(type_table, oinfo.addr);
+ found_obj = search_obj(type_table, &oinfo.token);
if (found_obj == NULL) {
indentation(dump_indent);
@@ -2353,7 +2365,7 @@ xml_dump_named_datatype(hid_t type, const char *name)
ctx.indent_level++;
- xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
+ xml_name_to_XID(type, found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
ctx.need_prefix = TRUE;
@@ -2436,7 +2448,7 @@ done:
void
xml_dump_group(hid_t gid, const char *name)
{
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
hid_t gcpl_id;
hid_t dset, type;
unsigned crt_order_flags;
@@ -2517,13 +2529,13 @@ xml_dump_group(hid_t gid, const char *name)
}
}
- H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(gid, &oinfo, H5O_INFO_BASIC);
if(oinfo.rc > 1) {
obj_t *found_obj; /* Found object */
/* Group with more than one link to it... */
- found_obj = search_obj(group_table, oinfo.addr);
+ found_obj = search_obj(group_table, &oinfo.token);
if (found_obj == NULL) {
indentation(dump_indent);
@@ -2541,7 +2553,7 @@ xml_dump_group(hid_t gid, const char *name)
/* already seen: enter a groupptr */
if(isRoot) {
/* probably can't happen! */
- xml_name_to_XID("/", grpxid, 100, 1);
+ xml_name_to_XID(gid, "/", grpxid, 100, 1);
ctx.need_prefix = TRUE;
@@ -2554,8 +2566,8 @@ xml_dump_group(hid_t gid, const char *name)
else {
t_objname = xml_escape_the_name(found_obj->objname);
par_name = xml_escape_the_name(par);
- xml_name_to_XID(tmp, grpxid, 100, 1);
- xml_name_to_XID(par, parentxid, 100, 1);
+ xml_name_to_XID(gid, tmp, grpxid, 100, 1);
+ xml_name_to_XID(gid, par, parentxid, 100, 1);
ctx.need_prefix = TRUE;
@@ -2573,8 +2585,8 @@ xml_dump_group(hid_t gid, const char *name)
t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */
par_name = xml_escape_the_name(par);
- xml_name_to_XID(found_obj->objname, ptrstr, 100, 1);
- xml_name_to_XID(par, parentxid, 100, 1);
+ xml_name_to_XID(gid, found_obj->objname, ptrstr, 100, 1);
+ xml_name_to_XID(gid, par, parentxid, 100, 1);
ctx.need_prefix = TRUE;
@@ -2597,7 +2609,7 @@ xml_dump_group(hid_t gid, const char *name)
/* first time this group has been seen -- describe it */
if(isRoot) {
- xml_name_to_XID("/", grpxid, 100, 1);
+ xml_name_to_XID(gid, "/", grpxid, 100, 1);
ctx.need_prefix = TRUE;
@@ -2611,8 +2623,8 @@ xml_dump_group(hid_t gid, const char *name)
char *t_tmp = xml_escape_the_name(tmp);
par_name = xml_escape_the_name(par);
- xml_name_to_XID(tmp, grpxid, 100, 1);
- xml_name_to_XID(par, parentxid, 100, 1);
+ xml_name_to_XID(gid, tmp, grpxid, 100, 1);
+ xml_name_to_XID(gid, par, parentxid, 100, 1);
ctx.need_prefix = TRUE;
@@ -2652,9 +2664,15 @@ xml_dump_group(hid_t gid, const char *name)
/* Very special case: dump unamed type in root group */
for(u = 0; u < type_table->nobjs; u++) {
if(!type_table->objs[u].recorded) {
+ char *obj_addr_str = NULL;
+
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+
+ H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_addr_str);
+ HDsprintf(type_name, "#%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
+
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -2665,9 +2683,9 @@ xml_dump_group(hid_t gid, const char *name)
/* iterate through all the links */
if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
+ H5Literate2(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
else
- H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
+ H5Literate2(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
dump_indent -= COL;
ctx.indent_level--;
@@ -2689,15 +2707,15 @@ xml_dump_group(hid_t gid, const char *name)
h5tools_str_reset(&buffer);
if(isRoot) {
- xml_name_to_XID("/", grpxid, 100, 1);
+ xml_name_to_XID(gid, "/", grpxid, 100, 1);
h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, "/");
}
else {
char *t_tmp = xml_escape_the_name(tmp);
par_name = xml_escape_the_name(par);
- xml_name_to_XID(tmp, grpxid, 100, 1);
- xml_name_to_XID(par, parentxid, 100, 1);
+ xml_name_to_XID(gid, tmp, grpxid, 100, 1);
+ xml_name_to_XID(gid, par, parentxid, 100, 1);
h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
"Parents=\"%s\" H5ParentPaths=\"%s\" >",
xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name);
@@ -2734,9 +2752,15 @@ xml_dump_group(hid_t gid, const char *name)
/* Very special case: dump unamed type in root group */
for(u = 0; u < type_table->nobjs; u++) {
if(!type_table->objs[u].recorded) {
+ char *obj_addr_str = NULL;
+
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+
+ H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_addr_str);
+ HDsprintf(type_name, "#%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
+
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -2747,9 +2771,9 @@ xml_dump_group(hid_t gid, const char *name)
/* iterate through all the links */
if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
+ H5Literate2(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
else
- H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
+ H5Literate2(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
dump_indent -= COL;
ctx.indent_level--;
@@ -2791,8 +2815,7 @@ xml_print_refs(hid_t did, int source)
hid_t space = H5I_INVALID_HID;
hssize_t ssiz = -1;
hsize_t i;
- size_t tsiz;
- hobj_ref_t *refbuf = NULL;
+ H5R_ref_t *refbuf = NULL;
char *buf = NULL;
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
@@ -2823,13 +2846,11 @@ xml_print_refs(hid_t did, int source)
space = H5Dget_space(did);
if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
goto error;
- if ((tsiz = H5Tget_size(type)) == 0)
- goto error;
- buf = (char *) HDcalloc((size_t)ssiz, tsiz);
+ buf = (char *) HDcalloc((size_t)ssiz, sizeof(H5R_ref_t));
if (buf == NULL)
goto error;
- e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ e = H5Dread(did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
/* need to check result here */
if (e < 0)
goto error;
@@ -2838,19 +2859,17 @@ xml_print_refs(hid_t did, int source)
space = H5Aget_space(did);
if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
goto error;
- if ((tsiz = H5Tget_size(type)) == 0)
- goto error;
- buf = (char *) HDcalloc((size_t)ssiz, tsiz);
+ buf = (char *) HDcalloc((size_t)ssiz, sizeof(H5R_ref_t));
if (buf == NULL)
goto error;
- e = H5Aread(did, H5T_STD_REF_OBJ, buf);
+ e = H5Aread(did, H5T_STD_REF, buf);
/* need to check the result here */
if (e < 0)
goto error;
}
- refbuf = (hobj_ref_t *)((void *)buf);
+ refbuf = (H5R_ref_t *)((void *)buf);
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2901,6 +2920,8 @@ xml_print_refs(hid_t did, int source)
}
ctx.indent_level--;
+ H5Rdestroy(refbuf);
+
refbuf++;
}
@@ -3290,7 +3311,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
H5Pget_fill_value(dcpl, type, buf);
if (H5Tget_class(type) == H5T_REFERENCE) {
- const char * path = lookup_ref_path(*(hobj_ref_t *) buf);
+ const char * path = lookup_ref_path(*(H5R_ref_t *) buf);
ctx.need_prefix = TRUE;
@@ -3324,6 +3345,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ H5Rdestroy((H5R_ref_t *) buf);
}
else if (H5Tget_class(type) == H5T_STRING) {
/* ????? */
@@ -3610,8 +3633,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
string_dataformat.do_escape = display_escape;
outputformat = &string_dataformat;
- xml_name_to_XID(tmp, rstr, 100, 1);
- xml_name_to_XID(prefix, pstr, 100, 1);
+ xml_name_to_XID(did, tmp, rstr, 100, 1);
+ xml_name_to_XID(did, prefix, pstr, 100, 1);
ctx.need_prefix = TRUE;
diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c
index f5234f4..bb606ac 100644
--- a/tools/src/h5format_convert/h5format_convert.c
+++ b/tools/src/h5format_convert/h5format_convert.c
@@ -362,7 +362,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-convert_dsets_cb(const char *path, const H5O_info_t *oi, const char *already_visited, void *_fid)
+convert_dsets_cb(const char *path, const H5O_info2_t *oi, const char *already_visited, void *_fid)
{
hid_t fid = *(hid_t *)_fid;
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index e8a7a2b..88f1d2b 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -1260,10 +1260,17 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Shared? If so then print the type's OID */
if (H5Tcommitted(type)) {
- H5O_info_t oi;
+ H5O_info2_t oi;
- if (H5Oget_info2(type, &oi, H5O_INFO_BASIC) >= 0)
- h5tools_str_append(buffer,"shared-%lu:"H5_PRINTF_HADDR_FMT" ", oi.fileno, oi.addr);
+ if (H5Oget_info3(type, &oi, H5O_INFO_BASIC) >= 0) {
+ char *type_string = NULL;
+
+ H5Otoken_to_str(type, &oi.token, &type_string);
+
+ h5tools_str_append(buffer,"shared-%lu:%s", oi.fileno, type_string);
+
+ H5free_memory(type_string);
+ } /* end if */
else
h5tools_str_append(buffer,"shared ");
} /* end if */
@@ -2284,7 +2291,7 @@ datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name)
*-------------------------------------------------------------------------
*/
static herr_t
-list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void *_iter)
+list_obj(const char *name, const H5O_info2_t *oinfo, const char *first_seen, void *_iter)
{
H5O_type_t obj_type = oinfo->type; /* Type of the object */
iter_t *iter = (iter_t*)_iter;
@@ -2355,6 +2362,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
if (verbose_g > 0) {
size_t buf_size = 0;
char* comment = NULL;
+ char* obj_addr_str = NULL;
ssize_t cmt_bufsize = -1;
/* Display attributes */
@@ -2363,11 +2371,15 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
H5Aiterate2(obj, H5_INDEX_NAME, H5_ITER_INC, NULL, list_attr, NULL);
/* Object location & reference count */
+ H5Otoken_to_str(obj, &oinfo->token, &obj_addr_str);
+
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, " %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", oinfo->fileno, oinfo->addr);
+ h5tools_str_append(&buffer, " %-10s %lu:%s\n", "Location:", oinfo->fileno, obj_addr_str);
h5tools_str_append(&buffer, " %-10s %u\n", "Links:", (unsigned)oinfo->rc);
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ H5free_memory(obj_addr_str);
+
/* Modification time */
if (oinfo->mtime > 0) {
char buf[256];
@@ -2442,7 +2454,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
+list_lnk(const char *name, const H5L_info2_t *linfo, void *_iter)
{
char *buf = NULL;
iter_t *iter = (iter_t*)_iter;
@@ -2628,7 +2640,7 @@ static herr_t
visit_obj(hid_t file, const char *oname, iter_t *iter)
{
int retval = 0;
- H5O_info_t oi; /* Information for object */
+ H5O_info2_t oi; /* Information for object */
hsize_t curr_pos = 0; /* total data element position */
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
@@ -2640,7 +2652,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter)
h5tools_str_reset(&buffer);
/* Retrieve info for object to list */
- if (H5Oget_info_by_name2(file, oname, &oi, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name3(file, oname, &oi, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) {
if (iter->symlink_target) {
h5tools_str_append(&buffer, "{**NOT FOUND**}\n");
iter->symlink_target = FALSE;
@@ -3279,7 +3291,7 @@ main(int argc, const char *argv[])
* doesn't exist). */
show_file_name_g = (argc-argno > 1); /*show file names if more than one*/
while(argno < argc) {
- H5L_info_t li;
+ H5L_info2_t li;
iter_t iter;
symlink_trav_t symlink_list;
size_t u;
@@ -3360,7 +3372,7 @@ main(int argc, const char *argv[])
/* Check for root group as object name */
if (HDstrcmp(oname, root_name)) {
/* Check the type of link given */
- if (H5Lget_info(file_id, oname, &li, H5P_DEFAULT) < 0) {
+ if (H5Lget_info2(file_id, oname, &li, H5P_DEFAULT) < 0) {
hsize_t curr_pos = 0; /* total data element position */
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index b138896..8eeaa0e 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -222,18 +222,27 @@ h5repack_addlayout(const char *str, pack_opt_t *options)
hid_t
copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options)
{
- named_dt_t *dt = *named_dt_head_p; /* Stack pointer */
- named_dt_t *dt_ret = NULL; /* Datatype to return */
- H5O_info_t oinfo; /* Object info of input dtype */
- hid_t ret_value = H5I_INVALID_HID;
+ named_dt_t *dt = *named_dt_head_p; /* Stack pointer */
+ named_dt_t *dt_ret = NULL; /* Datatype to return */
+ H5O_info2_t oinfo; /* Object info of input dtype */
+ int token_cmp;
+ hid_t ret_value = H5I_INVALID_HID;
- if (H5Oget_info2(type_in, &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(type_in, &oinfo, H5O_INFO_BASIC) < 0)
H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "H5Oget_info failed");
if (*named_dt_head_p) {
+ if (H5Otoken_cmp(type_in, &dt->obj_token, &oinfo.token, &token_cmp) < 0)
+ H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to compare object tokens");
+
/* Stack already exists, search for the datatype */
- while (dt && dt->addr_in != oinfo.addr)
+ while (dt && token_cmp) {
dt = dt->next;
+
+ if (H5Otoken_cmp(type_in, &dt->obj_token, &oinfo.token, &token_cmp) < 0)
+ H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to compare object tokens");
+ }
+
dt_ret = dt;
}
else {
@@ -249,13 +258,14 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t
*named_dt_head_p = dt;
/* Update the address and id */
- dt->addr_in = travt->objs[i].objno;
+ HDmemcpy(&dt->obj_token, &travt->objs[i].obj_token, sizeof(H5O_token_t));
dt->id_out = H5I_INVALID_HID;
/* Check if this type is the one requested */
- if (oinfo.addr == dt->addr_in) {
+ if (H5Otoken_cmp(type_in, &oinfo.token, &dt->obj_token, &token_cmp) < 0)
+ H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to compare object tokens");
+ if (!token_cmp)
dt_ret = dt;
- }
} /* end if named datatype */
} /* end for each object in traversal table */
} /* end else (create the stack) */
@@ -271,7 +281,7 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t
*named_dt_head_p = dt_ret;
/* Update the address and id */
- dt_ret->addr_in = oinfo.addr;
+ HDmemcpy(&dt_ret->obj_token, &oinfo.token, sizeof(H5O_token_t));
dt_ret->id_out = H5I_INVALID_HID;
} /* end if requested datatype not found */
@@ -355,14 +365,14 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
htri_t is_named; /* Whether the datatype is named */
hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
char name[255];
- H5O_info_t oinfo; /* object info */
+ H5O_info2_t oinfo; /* object info */
int j;
unsigned u;
hbool_t is_ref = 0;
H5T_class_t type_class = -1;
int ret_value = 0;
- if (H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
+ if (H5Oget_info3(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Oget_info failed");
/*-------------------------------------------------------------------------
@@ -752,7 +762,7 @@ check_objects(const char* fname, pack_opt_t *options)
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
- trav_table_init(&travt);
+ trav_table_init(fid, &travt);
/* get the list of objects in the file */
if (h5trav_gettable(fid, travt) < 0)
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h
index a0e0387..52ecb0e 100644
--- a/tools/src/h5repack/h5repack.h
+++ b/tools/src/h5repack/h5repack.h
@@ -131,7 +131,7 @@ typedef struct {
typedef struct named_dt_t {
- haddr_t addr_in; /* Address of the named dtype in the in file */
+ H5O_token_t obj_token; /* Object token for the named dtype in the in file */
hid_t id_out; /* Open identifier for the dtype in the out file */
struct named_dt_t *next; /* Next dtype */
} named_dt_t;
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 7336125..1044244 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -316,7 +316,7 @@ print_user_block(fnamein, fidin);
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
- trav_table_init(&travt);
+ trav_table_init(fidin, &travt);
if (travt) {
/* get the list of objects in the file */
diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c
index 70204c8..e6a747d 100644
--- a/tools/src/h5repack/h5repack_refs.c
+++ b/tools/src/h5repack/h5repack_refs.c
@@ -439,7 +439,7 @@ static int copy_refs_attr(hid_t loc_in,
hsize_t nelmts; /* number of elements in dataset */
hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
char name[255];
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
unsigned u, i, j;
int rank;
H5T_class_t type_class = -1;
@@ -454,7 +454,7 @@ static int copy_refs_attr(hid_t loc_in,
int ref_comp_field_n = 0;
int ret_value = 0;
- if(H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
+ if(H5Oget_info3(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Oget_info failed");
for(u = 0; u < (unsigned)oinfo.num_attrs; u++) {
@@ -796,16 +796,19 @@ MapIdToName(hid_t refobj_id, trav_table_t *travt)
if(travt->objs[u].type == (h5trav_type_t)H5O_TYPE_DATASET ||
travt->objs[u].type == (h5trav_type_t)H5O_TYPE_GROUP ||
travt->objs[u].type == (h5trav_type_t)H5O_TYPE_NAMED_DATATYPE) {
- H5O_info_t ref_oinfo; /* Stat for the refobj id */
+ H5O_info2_t ref_oinfo; /* Stat for the refobj id */
+ int token_cmp;
/* obtain information to identify the referenced object uniquely */
- if(H5Oget_info2(refobj_id, &ref_oinfo, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(refobj_id, &ref_oinfo, H5O_INFO_BASIC) < 0)
goto out;
- if(ref_oinfo.addr == travt->objs[u].objno) {
+ if(H5Otoken_cmp(refobj_id, &ref_oinfo.token, &travt->objs[u].obj_token, &token_cmp) < 0)
+ goto out;
+ if(!token_cmp) {
ret = travt->objs[u].name;
goto out;
- } /* end if */
+ }
} /* end if */
} /* u */
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
index 84cbf60..683988c 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -95,7 +95,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* close
*-------------------------------------------------------------------------
*/
- if(H5Pclose(pid) < 0)
+ if (H5Pclose(pid) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Sclose(sid) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
@@ -114,7 +114,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
- trav_table_init(&travt);
+ trav_table_init(fidout, &travt);
/* get the list of objects in the file */
if(h5trav_gettable(fidout, travt) < 0)
@@ -386,7 +386,7 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2)
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
- trav_table_init(&trav);
+ trav_table_init(fid1, &trav);
if(h5trav_gettable(fid1, trav) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5trav_gettable failed");
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index f160671..adc905a 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -379,13 +379,13 @@ ceil_log10(unsigned long x)
*-------------------------------------------------------------------------
*/
static herr_t
-attribute_stats(iter_t *iter, const H5O_info_t *oi)
+attribute_stats(iter_t *iter, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
unsigned bin; /* "bin" the number of objects falls in */
/* Update dataset & attribute metadata info */
- iter->attrs_btree_storage_size += oi->meta_size.attr.index_size;
- iter->attrs_heap_storage_size += oi->meta_size.attr.heap_size;
+ iter->attrs_btree_storage_size += native_oi->meta_size.attr.index_size;
+ iter->attrs_heap_storage_size += native_oi->meta_size.attr.heap_size;
/* Update small # of attribute count & limits */
if(oi->num_attrs <= (hsize_t)sattrs_threshold)
@@ -440,7 +440,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi)
*-------------------------------------------------------------------------
*/
static herr_t
-group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
+group_stats(iter_t *iter, const char *name, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
H5G_info_t ginfo; /* Group information */
unsigned bin; /* "bin" the number of objects falls in */
@@ -450,8 +450,8 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->uniq_groups++;
/* Get object header information */
- iter->group_ohdr_info.total_size += oi->hdr.space.total;
- iter->group_ohdr_info.free_size += oi->hdr.space.free;
+ iter->group_ohdr_info.total_size += native_oi->hdr.space.total;
+ iter->group_ohdr_info.free_size += native_oi->hdr.space.free;
/* Get group information */
if((ret_value = H5Gget_info_by_name(iter->fid, name, &ginfo, H5P_DEFAULT)) < 0)
@@ -484,11 +484,11 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
(iter->group_bins[bin])++;
/* Update group metadata info */
- iter->groups_btree_storage_size += oi->meta_size.obj.index_size;
- iter->groups_heap_storage_size += oi->meta_size.obj.heap_size;
+ iter->groups_btree_storage_size += native_oi->meta_size.obj.index_size;
+ iter->groups_heap_storage_size += native_oi->meta_size.obj.heap_size;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
+ if((ret_value = attribute_stats(iter, oi, native_oi)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats failed");
done:
@@ -510,7 +510,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
+dataset_stats(iter_t *iter, const char *name, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
unsigned bin; /* "bin" the number of objects falls in */
hid_t did; /* Dataset ID */
@@ -533,18 +533,18 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->uniq_dsets++;
/* Get object header information */
- iter->dset_ohdr_info.total_size += oi->hdr.space.total;
- iter->dset_ohdr_info.free_size += oi->hdr.space.free;
+ iter->dset_ohdr_info.total_size += native_oi->hdr.space.total;
+ iter->dset_ohdr_info.free_size += native_oi->hdr.space.free;
if((did = H5Dopen2(iter->fid, name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen() failed");
/* Update dataset metadata info */
- iter->datasets_index_storage_size += oi->meta_size.obj.index_size;
- iter->datasets_heap_storage_size += oi->meta_size.obj.heap_size;
+ iter->datasets_index_storage_size += native_oi->meta_size.obj.index_size;
+ iter->datasets_heap_storage_size += native_oi->meta_size.obj.heap_size;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
+ if((ret_value = attribute_stats(iter, oi, native_oi)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats() failed");
/* Get storage info */
@@ -702,7 +702,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-datatype_stats(iter_t *iter, const H5O_info_t *oi)
+datatype_stats(iter_t *iter, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
herr_t ret_value = SUCCEED;
@@ -710,11 +710,11 @@ datatype_stats(iter_t *iter, const H5O_info_t *oi)
iter->uniq_dtypes++;
/* Get object header information */
- iter->dtype_ohdr_info.total_size += oi->hdr.space.total;
- iter->dtype_ohdr_info.free_size += oi->hdr.space.free;
+ iter->dtype_ohdr_info.total_size += native_oi->hdr.space.total;
+ iter->dtype_ohdr_info.free_size += native_oi->hdr.space.free;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
+ if((ret_value = attribute_stats(iter, oi, native_oi)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats() failed");
done:
return ret_value;
@@ -735,31 +735,36 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited,
+obj_stats(const char *path, const H5O_info2_t *oi, const char *already_visited,
void *_iter)
{
+ H5O_native_info_t native_info;
iter_t *iter = (iter_t *)_iter;
herr_t ret_value = SUCCEED;
/* If the object has already been seen then just return */
if(NULL == already_visited) {
+ /* Retrieve the native info for the object */
+ if(H5Oget_native_info_by_name(iter->fid, path, &native_info, H5O_NATIVE_INFO_ALL, H5P_DEFAULT) < 0)
+ H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_native_info_by_name failed");
+
/* Gather some general statistics about the object */
if(oi->rc > iter->max_links)
iter->max_links = oi->rc;
switch(oi->type) {
case H5O_TYPE_GROUP:
- if(group_stats(iter, path, oi) < 0)
+ if(group_stats(iter, path, oi, &native_info) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "group_stats failed");
break;
case H5O_TYPE_DATASET:
- if(dataset_stats(iter, path, oi) < 0)
+ if(dataset_stats(iter, path, oi, &native_info) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "dataset_stats failed");
break;
case H5O_TYPE_NAMED_DATATYPE:
- if(datatype_stats(iter, oi) < 0)
+ if(datatype_stats(iter, oi, &native_info) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "datatype_stats failed");
break;
@@ -792,7 +797,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-lnk_stats(const char H5_ATTR_UNUSED *path, const H5L_info_t *li, void *_iter)
+lnk_stats(const char H5_ATTR_UNUSED *path, const H5L_info2_t *li, void *_iter)
{
iter_t *iter = (iter_t *)_iter;
diff --git a/tools/test/h5dump/errfiles/tdset-2.err b/tools/test/h5dump/errfiles/tdset-2.err
index 2d70b35..39bbb0e 100644
--- a/tools/test/h5dump/errfiles/tdset-2.err
+++ b/tools/test/h5dump/errfiles/tdset-2.err
@@ -27,7 +27,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
major: Symbol table
minor: Object not found
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
- #000: (file name) line (number) in H5Lget_info(): unable to get link info
+ #000: (file name) line (number) in H5Lget_info2(): unable to get link info
major: Links
minor: Can't get value
#001: (file name) line (number) in H5VL_link_get(): link get failed
diff --git a/tools/test/h5dump/errfiles/tperror.err b/tools/test/h5dump/errfiles/tperror.err
index b0b908b..e2f24c1 100644
--- a/tools/test/h5dump/errfiles/tperror.err
+++ b/tools/test/h5dump/errfiles/tperror.err
@@ -27,7 +27,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
major: Symbol table
minor: Object not found
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
- #000: (file name) line (number) in H5Lget_info(): unable to get link info
+ #000: (file name) line (number) in H5Lget_info2(): unable to get link info
major: Links
minor: Can't get value
#001: (file name) line (number) in H5VL_link_get(): link get failed
diff --git a/tools/test/h5dump/errfiles/tqmarkfile.err b/tools/test/h5dump/errfiles/tqmarkfile.err
index 2c4f1ff..4c3b2ef 100644
--- a/tools/test/h5dump/errfiles/tqmarkfile.err
+++ b/tools/test/h5dump/errfiles/tqmarkfile.err
@@ -15,7 +15,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
major: Symbol table
minor: Object not found
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
- #000: (file name) line (number) in H5Lget_info(): unable to get link info
+ #000: (file name) line (number) in H5Lget_info2(): unable to get link info
major: Symbol table
minor: Object not found
#001: (file name) line (number) in H5L_get_info(): name doesn't exist