diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2020-01-16 21:29:34 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2020-01-16 21:29:34 (GMT) |
commit | a92c735c9b57049e8c4037d3490f7e10f8eef4d6 (patch) | |
tree | 74da25151de6d1e32329dfcd62e17c863e2e3de1 /tools/src/h5ls | |
parent | 024f7ba09250110c19b070c9699cfbc0f9dc2b96 (diff) | |
download | hdf5-a92c735c9b57049e8c4037d3490f7e10f8eef4d6.zip hdf5-a92c735c9b57049e8c4037d3490f7e10f8eef4d6.tar.gz hdf5-a92c735c9b57049e8c4037d3490f7e10f8eef4d6.tar.bz2 |
Squashed commit of the token_refactoring branch:
Diffstat (limited to 'tools/src/h5ls')
-rw-r--r-- | tools/src/h5ls/h5ls.c | 32 |
1 files changed, 22 insertions, 10 deletions
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 */ |