summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-04-06 19:13:27 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-04-06 19:13:27 (GMT)
commitfd18d013f18914051df55ceb0f425ced2f40dbf8 (patch)
treef06d0005a6fb95d5bf4789f54bfecb35d192e993 /tools/src
parent55299ab2ce62ab8b2c25b0712a416885465d987e (diff)
parent4830a1796441abbb5a4fbd2cff9a651f2a0d066e (diff)
downloadhdf5-fd18d013f18914051df55ceb0f425ced2f40dbf8.zip
hdf5-fd18d013f18914051df55ceb0f425ced2f40dbf8.tar.gz
hdf5-fd18d013f18914051df55ceb0f425ced2f40dbf8.tar.bz2
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit '4830a1796441abbb5a4fbd2cff9a651f2a0d066e': Updated tools dump output when dataset offset is undefined. Added checks for native optional call support in some of the tools. Misc changes for h5dump VOL changes.
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/h5dump/h5dump_ddl.c16
-rw-r--r--tools/src/h5ls/h5ls.c70
-rw-r--r--tools/src/h5repack/h5repack.c4
3 files changed, 59 insertions, 31 deletions
diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c
index 9414f5b..e97ab7e 100644
--- a/tools/src/h5dump/h5dump_ddl.c
+++ b/tools/src/h5dump/h5dump_ddl.c
@@ -1136,6 +1136,22 @@ dump_fcpl(hid_t fid)
unsigned sym_ik; /* symbol table B-tree internal 'K' value */
unsigned istore_ik; /* indexed storage B-tree internal 'K' value */
+ void *obj = NULL;
+ hid_t connector_id = H5I_INVALID_HID;
+ hbool_t supported = FALSE;
+
+ /* Dumping the information here only makes sense for the native
+ * VOL connector. The only VOL call here is H5Fget_info(), so we'll
+ * use that as a proxy for "native-ness". If that isn't supported, we'll
+ * just return.
+ */
+ obj = H5VLobject(fid);
+ connector_id = H5VLget_connector_id(fid);
+ H5VLintrospect_opt_query(obj, connector_id, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_GET_INFO, &supported);
+ H5VLclose(connector_id);
+ if (!supported)
+ return;
+
fcpl=H5Fget_create_plist(fid);
H5Fget_info2(fid, &finfo);
H5Pget_userblock(fcpl,&userblock);
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index d954367..f82827c 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -2334,13 +2334,13 @@ list_obj(const char *name, const H5O_info2_t *oinfo, const char *first_seen, voi
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
} /* end if */
else {
- hid_t obj = H5I_INVALID_HID; /* ID of object opened */
+ hid_t obj_id = H5I_INVALID_HID; /* ID of object opened */
/* Open the object. Not all objects can be opened. If this is the case
* then return right away.
*/
H5TOOLS_DEBUG("Open object name=%s", name);
- if (obj_type >= 0 && (obj = H5Oopen(iter->fid, name, H5P_DEFAULT)) < 0) {
+ if (obj_type >= 0 && (obj_id = H5Oopen(iter->fid, name, H5P_DEFAULT)) < 0) {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " *ERROR*\n");
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
@@ -2350,7 +2350,7 @@ list_obj(const char *name, const H5O_info2_t *oinfo, const char *first_seen, voi
/* List the first line of information for the object. */
H5TOOLS_DEBUG("Object type:%d", obj_type);
if (obj_type >= 0 && dispatch_g[obj_type].list1)
- (dispatch_g[obj_type].list1)(obj);
+ (dispatch_g[obj_type].list1)(obj_id);
if (!iter->symlink_target || (verbose_g > 0)) {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\n");
@@ -2362,23 +2362,26 @@ list_obj(const char *name, const H5O_info2_t *oinfo, const char *first_seen, voi
if (verbose_g > 0) {
size_t buf_size = 0;
char* comment = NULL;
- char* obj_addr_str = NULL;
+ char* obj_tok_str = NULL;
ssize_t cmt_bufsize = -1;
+ void *obj = NULL;
+ hid_t connector_id = H5I_INVALID_HID;
+ hbool_t supported = FALSE;
/* Display attributes */
H5TOOLS_DEBUG("Display attributes");
if (obj_type >= 0)
- H5Aiterate2(obj, H5_INDEX_NAME, H5_ITER_INC, NULL, list_attr, NULL);
+ H5Aiterate2(obj_id, H5_INDEX_NAME, H5_ITER_INC, NULL, list_attr, NULL);
/* Object location & reference count */
- H5Otoken_to_str(obj, &oinfo->token, &obj_addr_str);
+ H5Otoken_to_str(obj_id, &oinfo->token, &obj_tok_str);
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, " %-10s %lu:%s\n", "Location:", oinfo->fileno, obj_addr_str);
+ h5tools_str_append(&buffer, " %-10s %lu:%s\n", "Location:", oinfo->fileno, obj_tok_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);
+ H5free_memory(obj_tok_str);
/* Modification time */
if (oinfo->mtime > 0) {
@@ -2397,36 +2400,45 @@ list_obj(const char *name, const H5O_info2_t *oinfo, const char *first_seen, voi
} /* end if */
} /* end if */
- /* Object comment */
- cmt_bufsize = H5Oget_comment(obj, comment, buf_size);
-
- /* if the actual length of the comment is longer than cmt_bufsize, then call
- * H5Oget_comment again with the correct value.
- * If the call to H5Oget_comment returned an error, skip this block */
- if (cmt_bufsize > 0) {
- comment = (char *)HDmalloc((size_t)cmt_bufsize + 1); /* new_size including null terminator */
- if (comment) {
- cmt_bufsize = H5Oget_comment(obj, comment, (size_t)cmt_bufsize);
- if (cmt_bufsize > 0) {
- comment[cmt_bufsize] = 0;
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, " %-10s \"", "Comment:");
- print_string(&buffer, comment, FALSE);
- h5tools_str_append(&buffer, "\"\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
- } /* end if */
- HDfree(comment);
+ /* Only emit comments if the VOL connector supports that */
+ obj = H5VLobject(obj_id);
+ connector_id = H5VLget_connector_id(obj_id);
+ H5VLintrospect_opt_query(obj, connector_id, H5VL_SUBCLS_OBJECT, H5VL_NATIVE_OBJECT_GET_COMMENT, &supported);
+ H5VLclose(connector_id);
+
+ if (supported) {
+
+ /* Object comment */
+ cmt_bufsize = H5Oget_comment(obj_id, comment, buf_size);
+
+ /* if the actual length of the comment is longer than cmt_bufsize, then call
+ * H5Oget_comment again with the correct value.
+ */
+ if (cmt_bufsize > 0) {
+ comment = (char *)HDmalloc((size_t)cmt_bufsize + 1); /* new_size including null terminator */
+ if (comment) {
+ cmt_bufsize = H5Oget_comment(obj_id, comment, (size_t)cmt_bufsize);
+ if (cmt_bufsize > 0) {
+ comment[cmt_bufsize] = 0;
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, " %-10s \"", "Comment:");
+ print_string(&buffer, comment, FALSE);
+ h5tools_str_append(&buffer, "\"\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ } /* end if */
+ HDfree(comment);
+ }
}
}
} /* end if */
/* Detailed list for object */
if (obj_type >= 0 && dispatch_g[obj_type].list2)
- (dispatch_g[obj_type].list2)(obj, name);
+ (dispatch_g[obj_type].list2)(obj_id, name);
/* Close the object. */
if (obj_type >= 0)
- H5Oclose(obj);
+ H5Oclose(obj_id);
} /* end else */
done:
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 081bdcd..b2cb02b 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -259,7 +259,7 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t
dt->next = *named_dt_head_p;
*named_dt_head_p = dt;
- /* Update the address and id */
+ /* Update the token/address and id */
HDmemcpy(&dt->obj_token, &travt->objs[i].obj_token, sizeof(H5O_token_t));
dt->id_out = H5I_INVALID_HID;
@@ -282,7 +282,7 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t
dt_ret->next = *named_dt_head_p;
*named_dt_head_p = dt_ret;
- /* Update the address and id */
+ /* Update the token/address and id */
HDmemcpy(&dt_ret->obj_token, &oinfo.token, sizeof(H5O_token_t));
dt_ret->id_out = H5I_INVALID_HID;
} /* end if requested datatype not found */