summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
Diffstat (limited to 'tools/src')
-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/h5import/h5import.c41
-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
12 files changed, 251 insertions, 180 deletions
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 9340e44..d9f1f67 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
@@ -2288,8 +2300,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.
@@ -2312,7 +2324,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;
@@ -2326,12 +2338,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);
@@ -2348,7 +2360,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;
@@ -2431,7 +2443,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;
@@ -2512,13 +2524,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);
@@ -2536,7 +2548,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;
@@ -2549,8 +2561,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;
@@ -2568,8 +2580,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;
@@ -2592,7 +2604,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;
@@ -2606,8 +2618,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;
@@ -2647,9 +2659,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);
@@ -2660,9 +2678,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--;
@@ -2684,15 +2702,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);
@@ -2729,9 +2747,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);
@@ -2742,9 +2766,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--;
@@ -2786,8 +2810,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 */
@@ -2818,13 +2841,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;
@@ -2833,19 +2854,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));
@@ -2896,6 +2915,8 @@ xml_print_refs(hid_t did, int source)
}
ctx.indent_level--;
+ H5Rdestroy(refbuf);
+
refbuf++;
}
@@ -3285,7 +3306,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;
@@ -3319,6 +3340,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) {
/* ????? */
@@ -3605,8 +3628,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/h5import/h5import.c b/tools/src/h5import/h5import.c
index 81f9a32..0c0e0fb 100644
--- a/tools/src/h5import/h5import.c
+++ b/tools/src/h5import/h5import.c
@@ -72,7 +72,7 @@ uint64_t swap_uint64(uint64_t val);
int main(int argc, char *argv[])
{
- struct Options opt;
+ struct Options *opt;
int outfile_named = FALSE;
int token;
int i;
@@ -99,8 +99,8 @@ int main(int argc, char *argv[])
(void) HDsetvbuf(stderr, (char *) NULL, _IOLBF, 0);
(void) HDsetvbuf(stdout, (char *) NULL, _IOLBF, 0);
- /* Initialize the file structure to 0 */
- HDmemset(&opt, 0, sizeof(struct Options));
+ if((opt = (struct Options *)HDcalloc(1, sizeof(struct Options))) == NULL)
+ goto err;
if (argv[1] && (HDstrcmp("-V", argv[1]) == 0)) {
print_version(PROGRAMNAME);
@@ -130,12 +130,12 @@ int main(int argc, char *argv[])
switch (state) {
case 1: /* counting input files */
- if (opt.fcount < 29) {
- (void) HDstrcpy(opt.infiles[opt.fcount].datafile, argv[i]);
- in = &(opt.infiles[opt.fcount].in);
- opt.infiles[opt.fcount].config = 0;
- setDefaultValues(in, opt.fcount);
- opt.fcount++;
+ if (opt->fcount < 29) {
+ (void) HDstrcpy(opt->infiles[opt->fcount].datafile, argv[i]);
+ in = &(opt->infiles[opt->fcount].in);
+ opt->infiles[opt->fcount].config = 0;
+ setDefaultValues(in, opt->fcount);
+ opt->fcount++;
}
else {
(void) HDfprintf(stderr, err9, argv[i]);
@@ -148,8 +148,8 @@ int main(int argc, char *argv[])
break;
case 3: /* get configfile name */
- (void) HDstrcpy(opt.infiles[opt.fcount-1].configfile, argv[i]);
- opt.infiles[opt.fcount - 1].config = 1;
+ (void) HDstrcpy(opt->infiles[opt->fcount-1].configfile, argv[i]);
+ opt->infiles[opt->fcount - 1].config = 1;
break;
case 4: /* -o found; look for outfile */
@@ -160,7 +160,7 @@ int main(int argc, char *argv[])
(void) HDfprintf(stderr, err10, argv[i]);
goto err;
}
- (void) HDstrcpy(opt.outfile, argv[i]);
+ (void) HDstrcpy(opt->outfile, argv[i]);
outfile_named = TRUE;
break;
@@ -232,11 +232,11 @@ int main(int argc, char *argv[])
goto err;
}
- if (process(&opt) == -1)
+ if (process(opt) == -1)
goto err;
- for (i = 0; i < opt.fcount; i++) {
- in = &(opt.infiles[i].in);
+ for (i = 0; i < opt->fcount; i++) {
+ in = &(opt->infiles[i].in);
if (in->sizeOfDimension)
HDfree(in->sizeOfDimension);
if (in->sizeOfChunk)
@@ -248,12 +248,13 @@ int main(int argc, char *argv[])
if (in->data)
HDfree(in->data);
}
+ HDfree(opt);
- return (EXIT_SUCCESS);
+ return EXIT_SUCCESS;
err:
(void) HDfprintf(stderr, "%s", err4);
- for (i = 0; i < opt.fcount; i++) {
- in = &(opt.infiles[i].in);
+ for (i = 0; i < opt->fcount; i++) {
+ in = &(opt->infiles[i].in);
if (in->sizeOfDimension)
HDfree(in->sizeOfDimension);
if (in->sizeOfChunk)
@@ -265,7 +266,9 @@ err:
if (in->data)
HDfree(in->data);
}
- return (EXIT_FAILURE);
+ HDfree(opt);
+
+ return EXIT_FAILURE;
}
static int gtoken(char *s)
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index a926e0c..8f8272c 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;