summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/CMakeLists.txt7
-rw-r--r--tools/lib/h5tools_utils.c485
-rw-r--r--tools/lib/h5tools_utils.h13
-rw-r--r--tools/src/h5dump/h5dump.c329
-rw-r--r--tools/src/h5ls/h5ls.c1160
-rw-r--r--tools/src/h5stat/h5stat.c186
-rw-r--r--tools/test/h5stat/testfiles/h5stat_help1.ddl10
-rw-r--r--tools/test/h5stat/testfiles/h5stat_help2.ddl10
-rw-r--r--tools/test/h5stat/testfiles/h5stat_nofile.ddl10
-rw-r--r--tools/testfiles/h5dump-help.txt10
-rw-r--r--tools/testfiles/help-1.ls9
-rw-r--r--tools/testfiles/help-2.ls9
-rw-r--r--tools/testfiles/help-3.ls9
-rw-r--r--tools/testfiles/pbits/tnofilename-with-packed-bits.ddl10
-rw-r--r--tools/testfiles/pbits/tpbitsIncomplete.ddl10
-rw-r--r--tools/testfiles/pbits/tpbitsLengthExceeded.ddl10
-rw-r--r--tools/testfiles/pbits/tpbitsLengthPositive.ddl10
-rw-r--r--tools/testfiles/pbits/tpbitsMaxExceeded.ddl10
-rw-r--r--tools/testfiles/pbits/tpbitsOffsetExceeded.ddl10
-rw-r--r--tools/testfiles/pbits/tpbitsOffsetNegative.ddl10
-rw-r--r--tools/testfiles/textlinksrc-nodangle-1.ls9
-rw-r--r--tools/testfiles/tgroup-1.ls9
22 files changed, 1672 insertions, 663 deletions
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 400039e..aa09aa6 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -9,4 +9,11 @@ add_subdirectory (src)
#-- Add the tests
if (BUILD_TESTING)
add_subdirectory (test)
+
+# --------------------------------------------------------------------
+# If S3 or HDFS enabled, then we need to test the tools library
+# --------------------------------------------------------------------
+ if (HDF5_ENABLE_ROS3_VFD OR HDF5_ENABLE_HDFS)
+ add_subdirectory (libtest)
+ endif ()
endif ()
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index d97b5c9..b733106 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -21,6 +21,10 @@
#include "H5private.h"
#include "h5trav.h"
+#ifdef H5_HAVE_ROS3_VFD
+#include "H5FDros3.h"
+#endif
+
/* global variables */
unsigned h5tools_nCols = 80;
/* ``get_option'' variables */
@@ -322,7 +326,229 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
return opt_opt;
}
-
+
+/*****************************************************************************
+ *
+ * Function: parse_tuple()
+ *
+ * Purpose:
+ *
+ * Create array of pointers to strings, identified as elements in a tuple
+ * of arbitrary length separated by provided character.
+ * ("tuple" because "nple" looks strange)
+ *
+ * * Receives pointer to start of tuple sequence string, '('.
+ * * Attempts to separate elements by token-character `sep`.
+ * * If the separator character is preceded by a backslash '\',
+ * the backslash is deleted and the separator is included in the
+ * element string as any other character.
+ * * To end an element with a backslash, escape the backslash, e.g.
+ * "(myelem\\,otherelem) -> {"myelem\", "otherelem"}
+ * * In all other cases, a backslash appearing not as part of "\\" or
+ * "\<sep>" digraph will be included berbatim.
+ * * Last two characters in the string MUST be ")\0".
+ *
+ * * Generates a copy of the input string `start`, (src..")\0"), replacing
+ * separators and close-paren with null charaters.
+ * * This string is allocated at runtime and should be freed when done.
+ * * Generates array of char pointers, and directs start of each element
+ * (each pointer) into this copy.
+ * * Each tuple element points to the start of its string (substring)
+ * and ends with a null terminator.
+ * * This array is allocated at runtime and should be freed when done.
+ * * Reallocates and expands elements array during parsing.
+ * * Initially allocated for 2 (plus one null entry), and grows by
+ * powers of 2.
+ * * The final 'slot' in the element array (elements[nelements], e.g.)
+ * always points to NULL.
+ * * The number of elements found and stored are passed out through pointer
+ * to unsigned, `nelems`.
+ *
+ * Return:
+ *
+ * FAIL If malformed--does not look like a tuple "(...)"
+ * or major error was encountered while parsing.
+ * or
+ * SUCCEED String looks properly formed "(...)" and no major errors.
+ *
+ * Stores number of elements through pointer `nelems`.
+ * Stores list of pointers to char (first char in each element
+ * string) through pointer `ptrs_out`.
+ * NOTE: `ptrs_out[nelems] == NULL` should be true.
+ * NOTE: list is malloc'd by function, and should be freed
+ * when done.
+ * Stores "source string" for element pointers through `cpy_out`.
+ * NOTE: Each element substring is null-terminated.
+ * NOTE: There may be extra characters after the last element
+ * (past its null terminator), but is guaranteed to
+ * be null-terminated.
+ * NOTE: `cpy_out` string is malloc'd by function,
+ * and should be freed when done.
+ *
+ * Programmer: Jacob Smith
+ * 2017-11-10
+ *
+ * Changes: None.
+ *
+ *****************************************************************************
+ */
+herr_t
+parse_tuple(const char *start,
+ int sep,
+ char **cpy_out,
+ unsigned *nelems,
+ char ***ptrs_out)
+{
+ char *elem_ptr = NULL;
+ char *dest_ptr = NULL;
+ unsigned elems_count = 0;
+ char **elems = NULL; /* more like *elems[], but complier... */
+ char **elems_re = NULL; /* temporary pointer, for realloc */
+ char *cpy = NULL;
+ herr_t ret_value = SUCCEED;
+ unsigned init_slots = 2;
+
+
+
+ /*****************
+ * SANITY-CHECKS *
+ *****************/
+
+ /* must start with "("
+ */
+ if (start[0] != '(') {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ /* must end with ")"
+ */
+ while (start[elems_count] != '\0') {
+ elems_count++;
+ }
+ if (start[elems_count - 1] != ')') {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ elems_count = 0;
+
+
+
+ /***********
+ * PREPARE *
+ ***********/
+
+ /* create list
+ */
+ elems = (char **)HDmalloc(sizeof(char *) * (init_slots + 1));
+ if (elems == NULL) { ret_value = FAIL; goto done; } /* CANTALLOC */
+
+ /* create destination string
+ */
+ start++; /* advance past opening paren '(' */
+ cpy = (char *)HDmalloc(sizeof(char) * (HDstrlen(start))); /* no +1; less '(' */
+ if (cpy == NULL) { ret_value = FAIL; goto done; } /* CANTALLOC */
+
+ /* set pointers
+ */
+ dest_ptr = cpy; /* start writing copy here */
+ elem_ptr = cpy; /* first element starts here */
+ elems[elems_count++] = elem_ptr; /* set first element pointer into list */
+
+
+
+ /*********
+ * PARSE *
+ *********/
+
+ while (*start != '\0') {
+ /* For each character in the source string...
+ */
+ if (*start == '\\') {
+ /* Possibly an escape digraph.
+ */
+ if ((*(start + 1) == '\\') ||
+ (*(start + 1) == sep) )
+ {
+ /* Valid escape digraph of "\\" or "\<sep>".
+ */
+ start++; /* advance past escape char '\' */
+ *(dest_ptr++) = *(start++); /* Copy subsequent char */
+ /* and advance pointers. */
+ } else {
+ /* Not an accepted escape digraph.
+ * Copy backslash character.
+ */
+ *(dest_ptr++) = *(start++);
+ }
+ } else if (*start == sep) {
+ /* Non-escaped separator.
+ * Terminate elements substring in copy, record element, advance.
+ * Expand elements list if appropriate.
+ */
+ *(dest_ptr++) = 0; /* Null-terminate elem substring in copy */
+ /* and advance pointer. */
+ start++; /* Advance src pointer past separator. */
+ elem_ptr = dest_ptr; /* Element pointer points to start of first */
+ /* character after null sep in copy. */
+ elems[elems_count++] = elem_ptr; /* Set elem pointer in list */
+ /* and increment count. */
+
+ /* Expand elements list, if necessary.
+ */
+ if (elems_count == init_slots) {
+ init_slots *= 2;
+ elems_re = (char **)realloc(elems, sizeof(char *) * \
+ (init_slots + 1));
+ if (elems_re == NULL) {
+ /* CANTREALLOC */
+ ret_value = FAIL;
+ goto done;
+ }
+ elems = elems_re;
+ }
+ } else if (*start == ')' && *(start + 1) == '\0') {
+ /* Found terminal, non-escaped close-paren. Last element.
+ * Write null terminator to copy.
+ * Advance source pointer to gently break from loop.
+ * Requred to prevent ")" from always being added to last element.
+ */
+ start++;
+ } else {
+ /* Copy character into destination. Advance pointers.
+ */
+ *(dest_ptr++) = *(start++);
+ }
+ }
+ *dest_ptr = '\0'; /* Null-terminate destination string. */
+ elems[elems_count] = NULL; /* Null-terminate elements list. */
+
+
+
+ /********************
+ * PASS BACK VALUES *
+ ********************/
+
+ *ptrs_out = elems;
+ *nelems = elems_count;
+ *cpy_out = cpy;
+
+done:
+ if (ret_value == FAIL) {
+ /* CLEANUP */
+ if (cpy) free(cpy);
+ if (elems) free(elems);
+ }
+
+ return ret_value;
+
+} /* parse_tuple */
+
+
+
+
+
/*-------------------------------------------------------------------------
* Function: indentation
*
@@ -841,3 +1067,260 @@ done:
return ret_value;
}
+
+/*----------------------------------------------------------------------------
+ *
+ * Function: h5tools_populate_ros3_fapl()
+ *
+ * Purpose:
+ *
+ * Set the values of a ROS3 fapl configuration object.
+ *
+ * If the values pointer is NULL, sets fapl target `fa` to a default
+ * (valid, current-version, non-authenticating) fapl config.
+ *
+ * If `values` pointer is _not_ NULL, expects `values` to contain at least
+ * three non-null pointers to null-terminated strings, corresponding to:
+ * { aws_region,
+ * secret_id,
+ * secret_key,
+ * }
+ * If all three strings are empty (""), the default fapl will be default.
+ * Both aws_region and secret_id values must be both empty or both
+ * populated. If
+ * Only secret_key is allowed to be empty (the empty string, "").
+ * All values are checked against overflow as defined in the ros3 vfd
+ * header file; if a value overruns the permitted space, FAIL is returned
+ * and the function aborts without resetting the fapl to values initially
+ * present.
+ *
+ * Return:
+ *
+ * 0 (failure) if...
+ * * Read-Only S3 VFD is not enabled.
+ * * NULL fapl pointer: (NULL, {...} )
+ * * Warning: In all cases below, fapl will be set as "default"
+ * before error occurs.
+ * * NULL value strings: (&fa, {NULL?, NULL? NULL?, ...})
+ * * Incomplete fapl info:
+ * * empty region, non-empty id, key either way
+ * * (&fa, {"", "...", "?"})
+ * * empty id, non-empty region, key either way
+ * * (&fa, {"...", "", "?"})
+ * * "non-empty key and either id or region empty
+ * * (&fa, {"", "", "...")
+ * * (&fa, {"", "...", "...")
+ * * (&fa, {"...", "", "...")
+ * * Any string would overflow allowed space in fapl definition.
+ * or
+ * 1 (success)
+ * * Sets components in fapl_t pointer, copying strings as appropriate.
+ * * "Default" fapl (valid version, authenticate->False, empty strings)
+ * * `values` pointer is NULL
+ * * (&fa, NULL)
+ * * first three strings in `values` are empty ("")
+ * * (&fa, {"", "", "", ...}
+ * * Authenticating fapl
+ * * region, id, and optional key provided
+ * * (&fa, {"...", "...", ""})
+ * * (&fa, {"...", "...", "..."})
+ *
+ * Programmer: Jacob Smith
+ * 2017-11-13
+ *
+ *----------------------------------------------------------------------------
+ */
+#ifdef H5_HAVE_ROS3_VFD
+int
+h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa,
+ const char **values)
+{
+ int show_progress = 0; /* set to 1 for debugging */
+ int ret_value = 1; /* 1 for success, 0 for failure */
+ /* e.g.? if (!populate()) { then failed } */
+
+ if (show_progress) {
+ HDprintf("called h5tools_populate_ros3_fapl\n");
+ }
+
+ if (fa == NULL) {
+ if (show_progress) {
+ HDprintf(" ERROR: null pointer to fapl_t\n");
+ }
+ ret_value = 0;
+ goto done;
+ }
+
+ if (show_progress) {
+ HDprintf(" preset fapl with default values\n");
+ }
+ fa->version = H5FD_CURR_ROS3_FAPL_T_VERSION;
+ fa->authenticate = FALSE;
+ *(fa->aws_region) = '\0';
+ *(fa->secret_id) = '\0';
+ *(fa->secret_key) = '\0';
+
+ /* sanity-check supplied values
+ */
+ if (values != NULL) {
+ if (values[0] == NULL) {
+ if (show_progress) {
+ HDprintf(" ERROR: aws_region value cannot be NULL\n");
+ }
+ ret_value = 0;
+ goto done;
+ }
+ if (values[1] == NULL) {
+ if (show_progress) {
+ HDprintf(" ERROR: secret_id value cannot be NULL\n");
+ }
+ ret_value = 0;
+ goto done;
+ }
+ if (values[2] == NULL) {
+ if (show_progress) {
+ HDprintf(" ERROR: secret_key value cannot be NULL\n");
+ }
+ ret_value = 0;
+ goto done;
+ }
+
+ /* if region and ID are supplied (key optional), write to fapl...
+ * fail if value would overflow
+ */
+ if (*values[0] != '\0' &&
+ *values[1] != '\0')
+ {
+ if (HDstrlen(values[0]) > H5FD_ROS3_MAX_REGION_LEN) {
+ if (show_progress) {
+ HDprintf(" ERROR: aws_region value too long\n");
+ }
+ ret_value = 0;
+ goto done;
+ }
+ HDmemcpy(fa->aws_region, values[0],
+ (HDstrlen(values[0]) + 1));
+ if (show_progress) {
+ HDprintf(" aws_region set\n");
+ }
+
+
+ if (HDstrlen(values[1]) > H5FD_ROS3_MAX_SECRET_ID_LEN) {
+ if (show_progress) {
+ HDprintf(" ERROR: secret_id value too long\n");
+ }
+ ret_value = 0;
+ goto done;
+ }
+ HDmemcpy(fa->secret_id,
+ values[1],
+ (HDstrlen(values[1]) + 1));
+ if (show_progress) {
+ HDprintf(" secret_id set\n");
+ }
+
+ if (HDstrlen(values[2]) > H5FD_ROS3_MAX_SECRET_KEY_LEN) {
+ if (show_progress) {
+ HDprintf(" ERROR: secret_key value too long\n");
+ }
+ ret_value = 0;
+ goto done;
+ }
+ HDmemcpy(fa->secret_key,
+ values[2],
+ (HDstrlen(values[2]) + 1));
+ if (show_progress) {
+ HDprintf(" secret_key set\n");
+ }
+
+ fa->authenticate = TRUE;
+ if (show_progress) {
+ HDprintf(" set to authenticate\n");
+ }
+
+ } else if (*values[0] != '\0' ||
+ *values[1] != '\0' ||
+ *values[2] != '\0')
+ {
+ if (show_progress) {
+ HDprintf(
+ " ERROR: invalid assortment of empty/non-empty values\n"
+ );
+ }
+ ret_value = 0;
+ goto done;
+ }
+ } /* values != NULL */
+
+done:
+ return ret_value;
+
+} /* h5tools_populate_ros3_fapl */
+#endif /* H5_HAVE_ROS3_VFD */
+
+
+/*-----------------------------------------------------------------------------
+ *
+ * Function: h5tools_set_configured_fapl
+ *
+ * Purpose: prepare fapl_id with the given property list, according to
+ * VFD prototype.
+ *
+ * Return: 0 on failure, 1 on success
+ *
+ * Programmer: Jacob Smith
+ * 2018-05-21
+ *
+ * Changes: None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+int
+h5tools_set_configured_fapl(hid_t fapl_id,
+ const char vfd_name[],
+ void *fapl_t_ptr)
+{
+ int ret_value = 1;
+
+ if (fapl_id < 0) {
+ return 0;
+ }
+
+ if (!strcmp("", vfd_name)) {
+ goto done;
+
+#ifdef H5_HAVE_ROS3_VFD
+ } else if (!strcmp("ros3", vfd_name)) {
+ if ((fapl_id == H5P_DEFAULT) ||
+ (fapl_t_ptr == NULL) ||
+ (FAIL == H5Pset_fapl_ros3(
+ fapl_id,
+ (H5FD_ros3_fapl_t *)fapl_t_ptr)))
+ {
+ ret_value = 0;
+ goto done;
+ }
+#endif /* H5_HAVE_ROS3_VFD */
+
+#ifdef H5_HAVE_LIBHDFS
+ } else if (!strcmp("hdfs", vfd_name)) {
+ if ((fapl_id == H5P_DEFAULT) ||
+ (fapl_t_ptr == NULL) ||
+ (FAIL == H5Pset_fapl_hdfs(
+ fapl_id,
+ (H5FD_hdfs_fapl_t *)fapl_t_ptr)))
+ {
+ ret_value = 0;
+ goto done;
+ }
+#endif /* H5_HAVE_LIBHDFS */
+
+ } else {
+ ret_value = 0; /* unrecognized fapl type "name" */
+ }
+
+done:
+ return ret_value;
+
+} /* h5tools_set_configured_fapl() */
+
diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h
index 4c2bf1e..0fa5250 100644
--- a/tools/lib/h5tools_utils.h
+++ b/tools/lib/h5tools_utils.h
@@ -123,6 +123,11 @@ H5TOOLS_DLLVAR unsigned h5tools_nCols; /*max number of columns for
H5TOOLS_DLL void indentation(unsigned);
H5TOOLS_DLL void print_version(const char *progname);
H5TOOLS_DLL void parallel_print(const char* format, ... );
+H5TOOLS_DLL herr_t parse_tuple(const char *start,
+ int sep,
+ char **cpy_out,
+ unsigned *nelems,
+ char ***ptrs_out);
H5TOOLS_DLL void error_msg(const char *fmt, ...);
H5TOOLS_DLL void warn_msg(const char *fmt, ...);
H5TOOLS_DLL void help_ref_msg(FILE *output);
@@ -174,6 +179,14 @@ H5TOOLS_DLL void h5tools_setprogname(const char*progname);
H5TOOLS_DLL int h5tools_getstatus(void);
H5TOOLS_DLL void h5tools_setstatus(int d_status);
H5TOOLS_DLL int h5tools_getenv_update_hyperslab_bufsize(void);
+H5TOOLS_DLL int h5tools_set_configured_fapl(hid_t fapl_id,
+ const char vfd_name[],
+ void *fapl_t_ptr);
+#ifdef H5_HAVE_ROS3_VFD
+H5TOOLS_DLL int h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa,
+ const char **values);
+#endif /* H5_HAVE_ROS3_VFD */
+
#ifdef __cplusplus
}
#endif
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index c93a2eb..b1e736a 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -24,6 +24,27 @@ static int doxml = 0;
static int useschema = 1;
static const char *xml_dtd_uri = NULL;
+#ifdef H5_HAVE_ROS3_VFD
+static H5FD_ros3_fapl_t ros3_fa = {
+ 1, /* version */
+ false, /* authenticate */
+ "", /* aws region */
+ "", /* access key id */
+ "", /* secret access key */
+};
+#endif /* H5_HAVE_ROS3_VFD */
+
+#ifdef H5_HAVE_LIBHDFS
+static H5FD_hdfs_fapl_t hdfs_fa = {
+ 1, /* fapl version */
+ "localhost", /* namenode name */
+ 0, /* namenode port */
+ "", /* kerberos ticket cache */
+ "", /* user name */
+ 2048, /* stream buffer size */
+};
+#endif /* H5_HAVE_LIBHDFS */
+
/* module-scoped variables for XML option */
#define DEFAULT_XSD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd"
#define DEFAULT_DTD "http://www.hdfgroup.org/HDF5/XML/DTD/HDF5-File.dtd"
@@ -188,6 +209,8 @@ static struct long_options l_opts[] = {
{ "any_path", require_arg, 'N' },
{ "vds-view-first-missing", no_arg, 'v' },
{ "vds-gap-size", require_arg, 'G' },
+ { "s3-cred", require_arg, '$' },
+ { "hdfs-attrs", require_arg, '#' },
{ NULL, 0, '\0' }
};
@@ -241,6 +264,16 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " -b B, --binary=B Binary file output, of form B\n");
PRINTVALSTREAM(rawoutstream, " -O F, --ddl=F Output ddl text into file F\n");
PRINTVALSTREAM(rawoutstream, " Use blank(empty) filename F to suppress ddl display\n");
+ PRINTVALSTREAM(rawoutstream, " --s3-cred=<cred> Supply S3 authentication information to \"ros3\" vfd.\n");
+ PRINTVALSTREAM(rawoutstream, " <cred> :: \"(<aws-region>,<access-id>,<access-key>)\"\n");
+ PRINTVALSTREAM(rawoutstream, " If absent or <cred> -> \"(,,)\", no authentication.\n");
+ PRINTVALSTREAM(rawoutstream, " Has no effect is filedriver is not `ros3'.\n");
+ PRINTVALSTREAM(rawoutstream, " --hdfs-attrs=<attrs> Supply configuration information for HDFS file access.\n");
+ PRINTVALSTREAM(rawoutstream, " For use with \"--filedriver=hdfs\"\n");
+ PRINTVALSTREAM(rawoutstream, " <attrs> :: (<namenode name>,<namenode port>,\n");
+ PRINTVALSTREAM(rawoutstream, " <kerberos cache path>,<username>,\n");
+ PRINTVALSTREAM(rawoutstream, " <buffer size>)\n");
+ PRINTVALSTREAM(rawoutstream, " Any absent attribute will use a default value.\n");
PRINTVALSTREAM(rawoutstream, "--------------- Object Options ---------------\n");
PRINTVALSTREAM(rawoutstream, " -a P, --attribute=P Print the specified attribute\n");
PRINTVALSTREAM(rawoutstream, " If an attribute name contains a slash (/), escape the\n");
@@ -1282,6 +1315,126 @@ end_collect:
hand = NULL;
h5tools_setstatus(EXIT_SUCCESS);
goto done;
+
+ case '$':
+#ifndef H5_HAVE_ROS3_VFD
+ error_msg("Read-Only S3 VFD not enabled.\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+#else
+ /* s3 credential */
+ {
+ char **s3_cred = NULL;
+ char *s3_cred_string = NULL;
+ const char *ccred[3];
+ unsigned nelems = 0;
+ if ( FAIL ==
+ parse_tuple(opt_arg, ',',
+ &s3_cred_string, &nelems, &s3_cred))
+ {
+ error_msg("unable to parse malformed s3 credentials\n");
+ usage(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand= NULL;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ if (nelems != 3) {
+ error_msg("s3 credentials expects 3 elements\n");
+ usage(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand= NULL;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ ccred[0] = (const char *)s3_cred[0];
+ ccred[1] = (const char *)s3_cred[1];
+ ccred[2] = (const char *)s3_cred[2];
+ if (0 == h5tools_populate_ros3_fapl(&ros3_fa, ccred)) {
+ error_msg("Invalid S3 credentials\n");
+ usage(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand= NULL;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ HDfree(s3_cred);
+ HDfree(s3_cred_string);
+ } /* s3 credential block */
+ break;
+#endif /* H5_HAVE_ROS3_VFD */
+
+ case '#':
+#ifndef H5_HAVE_LIBHDFS
+ error_msg("HDFS VFD is not enabled.\n");
+ goto error;
+#else
+ {
+ /* read hdfs properties tuple and store values in `hdfs_fa`
+ */
+ unsigned nelems = 0;
+ char *props_src = NULL;
+ char **props = NULL;
+ unsigned long k = 0;
+ if (FAIL == parse_tuple(
+ (const char *)opt_arg,
+ ',',
+ &props_src,
+ &nelems,
+ &props))
+ {
+ error_msg("unable to parse hdfs properties tuple\n");
+ goto error;
+ }
+ /* sanity-check tuple count
+ */
+ if (nelems != 5) {
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ }
+ /* Populate fapl configuration structure with given
+ * properties.
+ * WARNING: No error-checking is done on length of input
+ * strings... Silent overflow is possible, albeit
+ * unlikely.
+ */
+ if (strncmp(props[0], "", 1)) {
+ HDstrncpy(hdfs_fa.namenode_name,
+ (const char *)props[0],
+ HDstrlen(props[0]));
+ }
+ if (strncmp(props[1], "", 1)) {
+ k = strtoul((const char *)props[1], NULL, 0);
+ if (errno == ERANGE) {
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ }
+ hdfs_fa.namenode_port = (int32_t)k;
+ }
+ if (strncmp(props[2], "", 1)) {
+ HDstrncpy(hdfs_fa.kerberos_ticket_cache,
+ (const char *)props[2],
+ HDstrlen(props[2]));
+ }
+ if (strncmp(props[3], "", 1)) {
+ HDstrncpy(hdfs_fa.user_name,
+ (const char *)props[3],
+ HDstrlen(props[3]));
+ }
+ if (strncmp(props[4], "", 1)) {
+ k = strtoul((const char *)props[4], NULL, 0);
+ if (errno == ERANGE) {
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ }
+ hdfs_fa.stream_buffer_size = (int32_t)k;
+ }
+ HDfree(props);
+ HDfree(props_src);
+ }
+#endif /* H5_HAVE_LIBHDFS */
+ break;
+
case '?':
default:
usage(h5tools_getprogname());
@@ -1354,6 +1507,7 @@ main(int argc, const char *argv[])
{
hid_t fid = -1;
hid_t gid = -1;
+ hid_t fapl_id = H5P_DEFAULT;
H5E_auto2_t func;
H5E_auto2_t tools_func;
H5O_info_t oi;
@@ -1440,10 +1594,56 @@ main(int argc, const char *argv[])
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
+ if (driver != NULL) {
+ void *conf_fa = NULL;
+
+ if (!strcmp(driver, "ros3")) {
+#ifndef H5_HAVE_ROS3_VFD
+ error_msg("Read-Only S3 VFD not enabled.\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+#else
+ conf_fa = (void *)&ros3_fa;
+#endif /* H5_HAVE_ROS3_VFD */
+ } else if (!HDstrcmp(driver, "hdfs")) {
+#ifndef H5_HAVE_LIBHDFS
+ error_msg("HDFS VFD is not enabled.\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+#else
+ conf_fa = (void *)&hdfs_fa;
+#endif /* H5_HAVE_LIBHDFS */
+ }
+
+ if (conf_fa != NULL) {
+ fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ if (fapl_id < 0) {
+ error_msg("unable to create fapl entry\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ if (0 == h5tools_set_configured_fapl(
+ fapl_id,
+ driver, /* guaranteed "ros3" or "hdfs" */
+ conf_fa)) /* appropriate to driver */
+ {
+ error_msg("unable to set fapl\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ }
+ } /* driver defined */
+
while(opt_ind < argc) {
fname = HDstrdup(argv[opt_ind++]);
- fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, driver, NULL, 0);
+ if (fapl_id != H5P_DEFAULT) {
+ fid = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id);
+ }
+ else {
+ fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT,
+ driver, NULL, 0);
+ }
if (fid < 0) {
error_msg("unable to open file \"%s\"\n", fname);
@@ -1624,6 +1824,11 @@ done:
/* Free tables for objects */
table_list_free();
+ if (fapl_id != H5P_DEFAULT && 0 < H5Pclose(fapl_id)) {
+ error_msg("Can't close fapl entry\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
if(fid >=0)
if (H5Fclose(fid) < 0)
h5tools_setstatus(EXIT_FAILURE);
@@ -1645,127 +1850,7 @@ done:
H5Eset_auto2(H5E_DEFAULT, func, edata);
leave(h5tools_getstatus());
-}
-
-/*-------------------------------------------------------------------------
- * Function: h5_fileaccess
- *
- * Purpose: Returns a file access template which is the default template
- * but with a file driver set according to the constant or
- * environment variable HDF5_DRIVER
- *
- * Return: Success: A file access property list
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Thursday, November 19, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-h5_fileaccess(void)
-{
- static const char *multi_letters = "msbrglo";
- const char *val = NULL;
- const char *name;
- char s[1024];
- hid_t fapl = -1;
-
- /* First use the environment variable, then the constant */
- val = HDgetenv("HDF5_DRIVER");
-#ifdef HDF5_DRIVER
- if (!val) val = HDF5_DRIVER;
-#endif
-
- if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) return -1;
- if (!val || !*val) return fapl; /*use default*/
-
- HDstrncpy(s, val, sizeof s);
- s[sizeof(s)-1] = '\0';
- if (NULL==(name=HDstrtok(s, " \t\n\r"))) return fapl;
-
- if (!HDstrcmp(name, "sec2")) {
- /* Unix read() and write() system calls */
- if (H5Pset_fapl_sec2(fapl)<0) return -1;
- }
- else if (!HDstrcmp(name, "stdio")) {
- /* Standard C fread() and fwrite() system calls */
- if (H5Pset_fapl_stdio(fapl)<0) return -1;
- }
- else if (!HDstrcmp(name, "core")) {
- /* In-core temporary file with 1MB increment */
- if (H5Pset_fapl_core(fapl, 1024*1024, FALSE)<0) return -1;
- }
- else if (!HDstrcmp(name, "split")) {
- /* Split meta data and raw data each using default driver */
- if (H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0)
- return -1;
- }
- else if (!HDstrcmp(name, "multi")) {
- /* Multi-file driver, general case of the split driver */
- H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
- hid_t memb_fapl[H5FD_MEM_NTYPES];
- const char *memb_name[H5FD_MEM_NTYPES];
- char sv[H5FD_MEM_NTYPES][1024];
- haddr_t memb_addr[H5FD_MEM_NTYPES];
- H5FD_mem_t mt;
-
- HDmemset(memb_map, 0, sizeof memb_map);
- HDmemset(memb_fapl, 0, sizeof memb_fapl);
- HDmemset(memb_name, 0, sizeof memb_name);
- HDmemset(memb_addr, 0, sizeof memb_addr);
-
- if(HDstrlen(multi_letters)==H5FD_MEM_NTYPES) {
- for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
- memb_fapl[mt] = H5P_DEFAULT;
- memb_map[mt] = mt;
- HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
- memb_name[mt] = sv[mt];
- memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10);
- }
- }
- else {
- error_msg("Bad multi_letters list\n");
- return FAIL;
- }
-
- if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0)
- return -1;
- }
- else if (!HDstrcmp(name, "family")) {
- hsize_t fam_size = 100*1024*1024; /*100 MB*/
-
- /* Family of files, each 1MB and using the default driver */
- if ((val=HDstrtok(NULL, " \t\n\r")))
- fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024);
- if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0)
- return -1;
- }
- else if (!HDstrcmp(name, "log")) {
- long log_flags = H5FD_LOG_LOC_IO;
-
- /* Log file access */
- if ((val = HDstrtok(NULL, " \t\n\r")))
- log_flags = HDstrtol(val, NULL, 0);
-
- if (H5Pset_fapl_log(fapl, NULL, (unsigned)log_flags, 0) < 0)
- return -1;
- }
- else if (!HDstrcmp(name, "direct")) {
- /* Substitute Direct I/O driver with sec2 driver temporarily because
- * some output has sec2 driver as the standard. */
- if (H5Pset_fapl_sec2(fapl)<0) return -1;
- }
- else {
- /* Unknown driver */
- return -1;
- }
-
- return fapl;
-}
+} /* main */
/*-------------------------------------------------------------------------
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index 8dc4282..20a68e8 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -165,12 +165,6 @@ static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter);
* Purpose: Prints a usage message on stderr and then returns.
*
* Return: void
- *
- * Programmer: Robb Matzke
- * Thursday, July 16, 1998
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -216,6 +210,15 @@ usage (void)
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
PRINTVALSTREAM(rawoutstream, " --vfd=DRIVER Use the specified virtual file driver\n");
PRINTVALSTREAM(rawoutstream, " -x, --hexdump Show raw data in hexadecimal format\n");
+ PRINTVALSTREAM(rawoutstream, " --s3-cred=C Supply S3 authentication information to \"ros3\" vfd.\n");
+ PRINTVALSTREAM(rawoutstream, " Accepts tuple of \"(<aws-region>,<access-id>,<access-key>)\".\n");
+ PRINTVALSTREAM(rawoutstream, " If absent or C->\"(,,)\", defaults to no-authentication.\n");
+ PRINTVALSTREAM(rawoutstream, " Has no effect if vfd flag not set to \"ros3\".\n");
+ PRINTVALSTREAM(rawoutstream, " --hdfs-attrs=A Supply configuration information to Hadoop VFD.\n");
+ PRINTVALSTREAM(rawoutstream, " Accepts tuple of (<namenode name>,<namenode port>,\n");
+ PRINTVALSTREAM(rawoutstream, " ...<kerberos cache path>,<username>,<buffer size>)\n");
+ PRINTVALSTREAM(rawoutstream, " If absent or A == '(,,,,)', all default values are used.\n");
+ PRINTVALSTREAM(rawoutstream, " Has no effect if vfd flag is not 'hdfs'.\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " file/OBJECT\n");
PRINTVALSTREAM(rawoutstream, " Each object consists of an HDF5 file name optionally followed by a\n");
@@ -242,16 +245,9 @@ usage (void)
* Function: print_string
*
* Purpose: Print a string value by escaping unusual characters. If
- * STREAM is null then we only count how large the output would
- * be.
+ * STREAM is null then we only count how large the output would be.
*
* Return: Number of characters printed.
- *
- * Programmer: Robb Matzke
- * Thursday, November 5, 1998
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -262,27 +258,33 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces)
for (/*void*/; s && *s; s++) {
switch (*s) {
case '"':
- if (buffer) h5tools_str_append(buffer, "\\\"");
+ if (buffer)
+ h5tools_str_append(buffer, "\\\"");
nprint += 2;
break;
case '\\':
- if (buffer) h5tools_str_append(buffer, "\\\\");
+ if (buffer)
+ h5tools_str_append(buffer, "\\\\");
nprint += 2;
break;
case '\b':
- if (buffer) h5tools_str_append(buffer, "\\b");
+ if (buffer)
+ h5tools_str_append(buffer, "\\b");
nprint += 2;
break;
case '\f':
- if (buffer) h5tools_str_append(buffer, "\\f");
+ if (buffer)
+ h5tools_str_append(buffer, "\\f");
nprint += 2;
break;
case '\n':
- if (buffer) h5tools_str_append(buffer, "\\n");
+ if (buffer)
+ h5tools_str_append(buffer, "\\n");
nprint += 2;
break;
case '\r':
- if (buffer) h5tools_str_append(buffer, "\\r");
+ if (buffer)
+ h5tools_str_append(buffer, "\\r");
nprint += 2;
break;
case '\t':
@@ -291,21 +293,25 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces)
break;
case ' ':
if (escape_spaces) {
- if (buffer) h5tools_str_append(buffer, "\\ ");
+ if (buffer)
+ h5tools_str_append(buffer, "\\ ");
nprint += 2;
}
else {
- if (buffer) h5tools_str_append(buffer, " ");
+ if (buffer)
+ h5tools_str_append(buffer, " ");
nprint++;
}
break;
default:
if (isprint((int)*s)) {
- if (buffer) h5tools_str_append(buffer, "%c", *s);
+ if (buffer)
+ h5tools_str_append(buffer, "%c", *s);
nprint++;
}
else {
- if (buffer) h5tools_str_append(buffer, "\\%03o", *((const unsigned char*)s));
+ if (buffer)
+ h5tools_str_append(buffer, "\\%03o", *((const unsigned char*)s));
nprint += 4;
}
break;
@@ -321,14 +327,7 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces)
* Purpose: Print an object name and another string.
*
* Return: Success: TRUE
- *
- * Failure: FALSE, nothing printed
- *
- * Programmer: Quincey Koziol
- * Tuesday, November 6, 2007
- *
- * Modifications:
- *
+ * Failure: FALSE, nothing printed
*-------------------------------------------------------------------------
*/
static int
@@ -339,19 +338,19 @@ print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname,
const char *name = fullname; /* Pointer to buffer for printing */
int n;
- if(show_file_name_g)
+ if (show_file_name_g)
HDsnprintf(fullname, sizeof(fullname), "%s/%s", iter->fname, oname + iter->name_start);
else
name = oname + iter->name_start;
/* Print the object name, either full name or base name */
- if(fullname_g)
+ if (fullname_g)
n = print_string(buffer, name, TRUE);
else {
const char *last_sep; /* The location of the last group separator */
/* Find the last component of the path name */
- if(NULL == (last_sep = HDstrrchr(name, '/')))
+ if (NULL == (last_sep = HDstrrchr(name, '/')))
last_sep = name;
else {
last_sep++;
@@ -370,116 +369,151 @@ print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname,
* Purpose: Prints the name of a native C data type.
*
* Return: Success: TRUE
- *
- * Failure: FALSE, nothing printed.
- *
- * Programmer: Robb Matzke
- * Thursday, November 5, 1998
- *
- * Modifications:
- * Robb Matzke, 1999-06-11
- * Added the C9x types, but we still prefer to display the types
- * from the C language itself (like `int' vs. `int32_t').
- *
+ * Failure: FALSE, nothing printed.
*-------------------------------------------------------------------------
*/
static hbool_t
print_native_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- if(!simple_output_g) {
- if (H5Tequal(type, H5T_NATIVE_SCHAR)==TRUE) {
+ if (!simple_output_g) {
+ if (H5Tequal(type, H5T_NATIVE_SCHAR) == TRUE) {
h5tools_str_append(buffer, "native signed char");
- } else if (H5Tequal(type, H5T_NATIVE_UCHAR)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UCHAR) == TRUE) {
h5tools_str_append(buffer, "native unsigned char");
- } else if (H5Tequal(type, H5T_NATIVE_INT)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_INT) == TRUE) {
h5tools_str_append(buffer, "native int");
- } else if (H5Tequal(type, H5T_NATIVE_UINT)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UINT) == TRUE) {
h5tools_str_append(buffer, "native unsigned int");
- } else if (H5Tequal(type, H5T_NATIVE_SHORT)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_SHORT) == TRUE) {
h5tools_str_append(buffer, "native short");
- } else if (H5Tequal(type, H5T_NATIVE_USHORT)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_USHORT) == TRUE) {
h5tools_str_append(buffer, "native unsigned short");
- } else if (H5Tequal(type, H5T_NATIVE_LONG)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_LONG) == TRUE) {
h5tools_str_append(buffer, "native long");
- } else if (H5Tequal(type, H5T_NATIVE_ULONG)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_ULONG) == TRUE) {
h5tools_str_append(buffer, "native unsigned long");
- } else if (H5Tequal(type, H5T_NATIVE_LLONG)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_LLONG) == TRUE) {
h5tools_str_append(buffer, "native long long");
- } else if (H5Tequal(type, H5T_NATIVE_ULLONG)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_ULLONG) == TRUE) {
h5tools_str_append(buffer, "native unsigned long long");
- } else if (H5Tequal(type, H5T_NATIVE_FLOAT)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_FLOAT) == TRUE) {
h5tools_str_append(buffer, "native float");
- } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE) {
h5tools_str_append(buffer, "native double");
+ }
#if H5_SIZEOF_LONG_DOUBLE !=0
- } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)==TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE) {
h5tools_str_append(buffer, "native long double");
+ }
#endif
- } else if (H5Tequal(type, H5T_NATIVE_INT8)==TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_INT8) == TRUE) {
h5tools_str_append(buffer, "native int8_t");
- } else if (H5Tequal(type, H5T_NATIVE_UINT8)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UINT8) == TRUE) {
h5tools_str_append(buffer, "native uint8_t");
- } else if (H5Tequal(type, H5T_NATIVE_INT16)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_INT16) == TRUE) {
h5tools_str_append(buffer, "native int16_t");
- } else if (H5Tequal(type, H5T_NATIVE_UINT16)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UINT16) == TRUE) {
h5tools_str_append(buffer, "native uint16_t");
- } else if (H5Tequal(type, H5T_NATIVE_INT32)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_INT32) == TRUE) {
h5tools_str_append(buffer, "native int32_t");
- } else if (H5Tequal(type, H5T_NATIVE_UINT32)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UINT32) == TRUE) {
h5tools_str_append(buffer, "native uint32_t");
- } else if (H5Tequal(type, H5T_NATIVE_INT64)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_INT64) == TRUE) {
h5tools_str_append(buffer, "native int64_t");
- } else if (H5Tequal(type, H5T_NATIVE_UINT64)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UINT64) == TRUE) {
h5tools_str_append(buffer, "native uint64_t");
- } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST8)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_INT_LEAST8) == TRUE) {
h5tools_str_append(buffer, "native int_least8_t");
- } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST8)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST8) == TRUE) {
h5tools_str_append(buffer, "native uint_least8_t");
- } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST16)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_INT_LEAST16) == TRUE) {
h5tools_str_append(buffer, "native int_least16_t");
- } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST16)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST16) == TRUE) {
h5tools_str_append(buffer, "native uint_least16_t");
- } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST32)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_INT_LEAST32) == TRUE) {
h5tools_str_append(buffer, "native int_least32_t");
- } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST32)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST32) == TRUE) {
h5tools_str_append(buffer, "native uint_least32_t");
- } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST64)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_INT_LEAST64) == TRUE) {
h5tools_str_append(buffer, "native int_least64_t");
- } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST64)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST64) == TRUE) {
h5tools_str_append(buffer, "native uint_least64_t");
- } else if (H5Tequal(type, H5T_NATIVE_INT_FAST8)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_INT_FAST8) == TRUE) {
h5tools_str_append(buffer, "native int_fast8_t");
- } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST8)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UINT_FAST8) == TRUE) {
h5tools_str_append(buffer, "native uint_fast8_t");
- } else if (H5Tequal(type, H5T_NATIVE_INT_FAST16)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_INT_FAST16) == TRUE) {
h5tools_str_append(buffer, "native int_fast16_t");
- } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST16)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UINT_FAST16) == TRUE) {
h5tools_str_append(buffer, "native uint_fast16_t");
- } else if (H5Tequal(type, H5T_NATIVE_INT_FAST32)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_INT_FAST32) == TRUE) {
h5tools_str_append(buffer, "native int_fast32_t");
- } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST32)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UINT_FAST32) == TRUE) {
h5tools_str_append(buffer, "native uint_fast32_t");
- } else if (H5Tequal(type, H5T_NATIVE_INT_FAST64)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_INT_FAST64) == TRUE) {
h5tools_str_append(buffer, "native int_fast64_t");
- } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST64)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UINT_FAST64) == TRUE) {
h5tools_str_append(buffer, "native uint_fast64_t");
- } else if (H5Tequal(type, H5T_NATIVE_B8)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_B8) == TRUE) {
h5tools_str_append(buffer, "native 8-bit field");
- } else if (H5Tequal(type, H5T_NATIVE_B16)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_B16) == TRUE) {
h5tools_str_append(buffer, "native 16-bit field");
- } else if (H5Tequal(type, H5T_NATIVE_B32)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_B32) == TRUE) {
h5tools_str_append(buffer, "native 32-bit field");
- } else if (H5Tequal(type, H5T_NATIVE_B64)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_B64) == TRUE) {
h5tools_str_append(buffer, "native 64-bit field");
- } else if (H5Tequal(type, H5T_NATIVE_HSIZE)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_HSIZE) == TRUE) {
h5tools_str_append(buffer, "native hsize_t");
- } else if (H5Tequal(type, H5T_NATIVE_HSSIZE)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_HSSIZE) == TRUE) {
h5tools_str_append(buffer, "native hssize_t");
- } else if (H5Tequal(type, H5T_NATIVE_HERR)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_HERR) == TRUE) {
h5tools_str_append(buffer, "native herr_t");
- } else if (H5Tequal(type, H5T_NATIVE_HBOOL)==TRUE) {
+ }
+ else if (H5Tequal(type, H5T_NATIVE_HBOOL) == TRUE) {
h5tools_str_append(buffer, "native hbool_t");
- } else {
+ }
+ else {
return print_int_type(buffer, type, ind);
}
} else {
@@ -495,29 +529,22 @@ print_native_type(h5tools_str_t *buffer, hid_t type, int ind)
* Purpose: Print the name of an IEEE floating-point data type.
*
* Return: Success: TRUE
- *
- * Failure: FALSE, nothing printed
- *
- * Programmer: Robb Matzke
- * Thursday, November 5, 1998
- *
- * Modifications:
- *
+ * Failure: FALSE, nothing printed
*-------------------------------------------------------------------------
*/
static hbool_t
print_ieee_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- if (H5Tequal(type, H5T_IEEE_F32BE)==TRUE) {
+ if (H5Tequal(type, H5T_IEEE_F32BE) == TRUE) {
h5tools_str_append(buffer, "IEEE 32-bit big-endian float");
}
- else if (H5Tequal(type, H5T_IEEE_F32LE)==TRUE) {
+ else if (H5Tequal(type, H5T_IEEE_F32LE) == TRUE) {
h5tools_str_append(buffer, "IEEE 32-bit little-endian float");
}
- else if (H5Tequal(type, H5T_IEEE_F64BE)==TRUE) {
+ else if (H5Tequal(type, H5T_IEEE_F64BE) == TRUE) {
h5tools_str_append(buffer, "IEEE 64-bit big-endian float");
}
- else if (H5Tequal(type, H5T_IEEE_F64LE)==TRUE) {
+ else if (H5Tequal(type, H5T_IEEE_F64LE) == TRUE) {
h5tools_str_append(buffer, "IEEE 64-bit little-endian float");
}
else {
@@ -531,16 +558,10 @@ print_ieee_type(h5tools_str_t *buffer, hid_t type, int ind)
* Function: print_precision
*
* Purpose: Prints information on the next line about precision and
- * padding if the precision is less than the total data type
- * size.
+ * padding if the precision is less than the total data type
+ * size.
*
* Return: void
- *
- * Programmer: Robb Matzke
- * Thursday, November 5, 1998
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -555,13 +576,12 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind)
/* If the precision is less than the total size then show the precision
* and offset on the following line. Also display the padding
* information. */
- if(8 * H5Tget_size(type) != (prec = H5Tget_precision(type))) {
+ if (8 * H5Tget_size(type) != (prec = H5Tget_precision(type))) {
h5tools_str_append(buffer, "\n%*s(%lu bit%s of precision beginning at bit %lu)",
- ind, "", (unsigned long)prec, 1 == prec ? "" : "s",
- (unsigned long)H5Tget_offset(type));
+ ind, "", (unsigned long)prec, 1 == prec ? "" : "s", (unsigned long)H5Tget_offset(type));
H5Tget_pad(type, &plsb, &pmsb);
- if(H5Tget_offset(type) > 0) {
+ if (H5Tget_offset(type) > 0) {
switch(plsb) {
case H5T_PAD_ZERO:
plsb_s = "zero";
@@ -580,7 +600,7 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind)
break;
}
}
- if((unsigned)H5Tget_offset(type) + prec < 8 * H5Tget_size(type)) {
+ if ((unsigned)H5Tget_offset(type) + prec < 8 * H5Tget_size(type)) {
switch(pmsb) {
case H5T_PAD_ZERO:
pmsb_s = "zero";
@@ -603,15 +623,13 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind)
h5tools_str_append(buffer, "\n%*s(", ind, "");
if (plsb_s) {
nbits = (unsigned)H5Tget_offset(type);
- h5tools_str_append(buffer, "%lu %s bit%s at bit 0",
- (unsigned long)nbits, plsb_s, 1 == nbits ? "" : "s");
+ h5tools_str_append(buffer, "%lu %s bit%s at bit 0", (unsigned long)nbits, plsb_s, 1 == nbits ? "" : "s");
}
- if (plsb_s && pmsb_s) h5tools_str_append(buffer, ", ");
+ if (plsb_s && pmsb_s)
+ h5tools_str_append(buffer, ", ");
if (pmsb_s) {
nbits = (8 * H5Tget_size(type)) - ((unsigned)H5Tget_offset(type) + prec);
- h5tools_str_append(buffer, "%lu %s bit%s at bit %lu",
- (unsigned long)nbits, pmsb_s, 1 == nbits ? "" : "s",
- (unsigned long)(8 * H5Tget_size(type) - nbits));
+ h5tools_str_append(buffer, "%lu %s bit%s at bit %lu", (unsigned long)nbits, pmsb_s, 1 == nbits ? "" : "s", (unsigned long)(8 * H5Tget_size(type) - nbits));
}
h5tools_str_append(buffer, ")");
}
@@ -623,41 +641,35 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind)
* Function: print_int_type
*
* Purpose: Print the name of an integer data type. Common information
- * like number of bits, byte order, and sign scheme appear on
- * the first line. Additional information might appear in
- * parentheses on the following lines.
+ * like number of bits, byte order, and sign scheme appear on
+ * the first line. Additional information might appear in
+ * parentheses on the following lines.
*
* Return: Success: TRUE
- *
- * Failure: FALSE, nothing printed
- *
- * Programmer: Robb Matzke
- * Thursday, November 5, 1998
- *
- * Modifications:
- *
+ * Failure: FALSE, nothing printed
*-------------------------------------------------------------------------
*/
static hbool_t
print_int_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- H5T_order_t order; /* byte order value */
- const char *order_s=NULL; /* byte order string */
- H5T_sign_t sign; /* sign scheme value */
- const char *sign_s=NULL; /* sign scheme string */
+ H5T_order_t order; /* byte order value */
+ const char *order_s = NULL; /* byte order string */
+ H5T_sign_t sign; /* sign scheme value */
+ const char *sign_s = NULL; /* sign scheme string */
- if (H5T_INTEGER!=H5Tget_class(type)) return FALSE;
+ if (H5T_INTEGER != H5Tget_class(type))
+ return FALSE;
/* Byte order */
- if (H5Tget_size(type)>1) {
+ if (H5Tget_size(type) > 1) {
order = H5Tget_order(type);
- if (H5T_ORDER_LE==order) {
+ if (H5T_ORDER_LE == order) {
order_s = " little-endian";
}
- else if (H5T_ORDER_BE==order) {
+ else if (H5T_ORDER_BE == order) {
order_s = " big-endian";
}
- else if (H5T_ORDER_VAX==order) {
+ else if (H5T_ORDER_VAX == order) {
order_s = " mixed-endian";
}
else {
@@ -669,11 +681,11 @@ print_int_type(h5tools_str_t *buffer, hid_t type, int ind)
}
/* Sign */
- if ((sign=H5Tget_sign(type))>=0) {
- if (H5T_SGN_NONE==sign) {
+ if ((sign = H5Tget_sign(type)) >= 0) {
+ if (H5T_SGN_NONE == sign) {
sign_s = " unsigned";
}
- else if (H5T_SGN_2==sign) {
+ else if (H5T_SGN_2 == sign) {
sign_s = "";
}
else {
@@ -686,8 +698,7 @@ print_int_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Print size, order, and sign on first line, precision and padding
* information on the subsequent lines */
- h5tools_str_append(buffer, "%lu-bit%s%s integer",
- (unsigned long)(8*H5Tget_size(type)), order_s, sign_s);
+ h5tools_str_append(buffer, "%lu-bit%s%s integer", (unsigned long)(8*H5Tget_size(type)), order_s, sign_s);
print_precision(buffer, type, ind);
return TRUE;
}
@@ -699,14 +710,7 @@ print_int_type(h5tools_str_t *buffer, hid_t type, int ind)
* Purpose: Print info about a floating point data type.
*
* Return: Success: TRUE
- *
- * Failure: FALSE, nothing printed
- *
- * Programmer: Robb Matzke
- * Thursday, November 5, 1998
- *
- * Modifications:
- *
+ * Failure: FALSE, nothing printed
*-------------------------------------------------------------------------
*/
static hbool_t
@@ -723,18 +727,19 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind)
H5T_pad_t pad; /* internal padding value */
const char *pad_s=NULL; /* internal padding string */
- if (H5T_FLOAT!=H5Tget_class(type)) return FALSE;
+ if (H5T_FLOAT != H5Tget_class(type))
+ return FALSE;
/* Byte order */
- if (H5Tget_size(type)>1) {
+ if (H5Tget_size(type) > 1) {
order = H5Tget_order(type);
- if (H5T_ORDER_LE==order) {
+ if (H5T_ORDER_LE == order) {
order_s = " little-endian";
}
- else if (H5T_ORDER_BE==order) {
+ else if (H5T_ORDER_BE == order) {
order_s = " big-endian";
}
- else if (H5T_ORDER_VAX==order) {
+ else if (H5T_ORDER_VAX == order) {
order_s = " mixed-endian";
}
else {
@@ -747,8 +752,7 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Print size and byte order on first line, precision and padding on
* subsequent lines. */
- h5tools_str_append(buffer, "%lu-bit%s floating-point",
- (unsigned long)(8*H5Tget_size(type)), order_s);
+ h5tools_str_append(buffer, "%lu-bit%s floating-point", (unsigned long)(8*H5Tget_size(type)), order_s);
print_precision(buffer, type, ind);
/* Print sizes, locations, and other information about each field */
@@ -773,15 +777,13 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind)
break;
}
h5tools_str_append(buffer, "\n%*s(significant for %lu bit%s at bit %lu%s)", ind, "",
- (unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos,
- norm_s);
+ (unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos, norm_s);
h5tools_str_append(buffer, "\n%*s(exponent for %lu bit%s at bit %lu, bias is 0x%lx)",
- ind, "", (unsigned long)esize, 1==esize?"":"s",
- (unsigned long)epos, (unsigned long)ebias);
+ ind, "", (unsigned long)esize, 1==esize?"":"s", (unsigned long)epos, (unsigned long)ebias);
h5tools_str_append(buffer, "\n%*s(sign bit at %lu)", ind, "", (unsigned long)spos);
/* Display internal padding */
- if (1+esize+msize<H5Tget_precision(type)) {
+ if ((1 + esize + msize) < H5Tget_precision(type)) {
pad = H5Tget_inpad(type);
switch (pad) {
case H5T_PAD_ZERO:
@@ -813,12 +815,7 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind)
* Purpose: Print info about a compound data type.
*
* Return: Success: TRUE
- *
- * Failure: FALSE, nothing printed
- *
- * Programmer: Robb Matzke
- * Thursday, November 5, 1998
- *
+ * Failure: FALSE, nothing printed
*-------------------------------------------------------------------------
*/
static hbool_t
@@ -837,14 +834,12 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind)
return FALSE;
h5tools_str_append(buffer, "struct {");
- for(i = 0; i < (unsigned)nmembs; i++) {
-
+ for (i = 0; i < (unsigned)nmembs; i++) {
/* Name and offset */
name = H5Tget_member_name(type, i);
h5tools_str_append(buffer, "\n%*s\"", ind+4, "");
n = print_string(buffer, name, FALSE);
- h5tools_str_append(buffer, "\"%*s +%-4lu ", MAX(0, 16-n), "",
- (unsigned long)H5Tget_member_offset(type, i));
+ h5tools_str_append(buffer, "\"%*s +%-4lu ", MAX(0, 16-n), "", (unsigned long)H5Tget_member_offset(type, i));
H5free_memory(name);
/* Member's type */
@@ -853,8 +848,7 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind)
H5Tclose(subtype);
}
size = H5Tget_size(type);
- h5tools_str_append(buffer, "\n%*s} %lu byte%s",
- ind, "", (unsigned long)size, 1==size?"":"s");
+ h5tools_str_append(buffer, "\n%*s} %lu byte%s", ind, "", (unsigned long)size, 1==size?"":"s");
return TRUE;
}
@@ -866,14 +860,7 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind)
* Purpose: Print info about an enumeration data type.
*
* Return: Success: TRUE
- *
- * Failure: FALSE, nothing printed
- *
- * Programmer: Robb Matzke
- * Wednesday, December 23, 1998
- *
- * Modifications:
- *
+ * Failure: FALSE, nothing printed
*-------------------------------------------------------------------------
*/
static hbool_t
@@ -882,9 +869,9 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
int nmembs; /* number of members */
hid_t super; /* enum base integer type */
- if(H5T_ENUM != H5Tget_class(type))
+ if (H5T_ENUM != H5Tget_class(type))
return FALSE;
- if((nmembs = H5Tget_nmembers(type)) < 0)
+ if ((nmembs = H5Tget_nmembers(type)) < 0)
return FALSE;
super = H5Tget_super(type);
@@ -892,7 +879,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
print_type(buffer, super, ind + 4);
h5tools_str_append(buffer, " {");
- if(nmembs > 0) {
+ if (nmembs > 0) {
char **name; /* member names */
unsigned char *value; /* value array */
hid_t native = -1; /* native integer data type */
@@ -904,9 +891,9 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
* 1. long long -- the largest native signed integer
* 2. unsigned long long -- the largest native unsigned integer
* 3. raw format */
- if(H5Tget_size(type) <= sizeof(long long)) {
+ if (H5Tget_size(type) <= sizeof(long long)) {
dst_size = sizeof(long long);
- if(H5T_SGN_NONE == H5Tget_sign(type))
+ if (H5T_SGN_NONE == H5Tget_sign(type))
native = H5T_NATIVE_ULLONG;
else
native = H5T_NATIVE_LLONG;
@@ -917,16 +904,16 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Get the names and raw values of all members */
name = (char **)HDcalloc((size_t)nmembs, sizeof(char *));
value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size));
- for(i = 0; i < (unsigned)nmembs; i++) {
+ for (i = 0; i < (unsigned)nmembs; i++) {
name[i] = H5Tget_member_name(type, i);
H5Tget_member_value(type, i, value + i * H5Tget_size(type));
}
/* Convert values to native data type */
- if(native > 0)
- if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0) {
+ if (native > 0)
+ if (H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0) {
/* Release resources */
- for(i = 0; i < (unsigned)nmembs; i++)
+ for (i = 0; i < (unsigned)nmembs; i++)
H5free_memory(name[i]);
HDfree(name);
HDfree(value);
@@ -938,7 +925,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
/*not implemented yet*/
/* Print members */
- for(i = 0; i < (unsigned)nmembs; i++) {
+ for (i = 0; i < (unsigned)nmembs; i++) {
unsigned char *copy; /* a pointer to value array */
int nchars; /* number of output characters */
@@ -946,14 +933,14 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
nchars = print_string(buffer, name[i], TRUE);
h5tools_str_append(buffer, "%*s = ", MAX(0, 16 - nchars), "");
- if(native < 0) {
+ if (native < 0) {
size_t j;
h5tools_str_append(buffer, "0x");
- for(j = 0; j < dst_size; j++)
+ for (j = 0; j < dst_size; j++)
h5tools_str_append(buffer, "%02x", value[i*dst_size+j]);
}
- else if(H5T_SGN_NONE == H5Tget_sign(native)) {
+ else if (H5T_SGN_NONE == H5Tget_sign(native)) {
/*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
*strangely, unless use another pointer "copy".*/
copy = value + i * dst_size;
@@ -963,8 +950,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
/*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
*strangely, unless use another pointer "copy".*/
copy = value + i * dst_size;
- h5tools_str_append(buffer, "%"H5_PRINTF_LL_WIDTH"d",
- *((long long*)((void*)copy)));
+ h5tools_str_append(buffer, "%"H5_PRINTF_LL_WIDTH"d", *((long long*)((void*)copy)));
}
}
@@ -991,14 +977,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
* Purpose: Print information about a string data type.
*
* Return: Success: TRUE
- *
- * Failure: FALSE, nothing printed
- *
- * Programmer: Robb Matzke
- * Thursday, November 5, 1998
- *
- * Modifications:
- *
+ * Failure: FALSE, nothing printed
*-------------------------------------------------------------------------
*/
static hbool_t
@@ -1009,7 +988,8 @@ print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
H5T_cset_t cset;
const char *cset_s=NULL;
- if (H5T_STRING!=H5Tget_class(type)) return FALSE;
+ if (H5T_STRING != H5Tget_class(type))
+ return FALSE;
/* Padding */
pad = H5Tget_strpad(type);
@@ -1092,32 +1072,23 @@ print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
* Purpose: Prints information about a reference data type.
*
* Return: Success: TRUE
- *
- * Failure: FALSE, nothing printed
- *
- * Programmer: Robb Matzke
- * Thursday, November 5, 1998
- *
- * Modifications:
- * Robb Matzke, 1999-06-04
- * Knows about object and dataset region references.
- *
+ * Failure: FALSE, nothing printed
*-------------------------------------------------------------------------
*/
static hbool_t
print_reference_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
{
- if (H5T_REFERENCE!=H5Tget_class(type)) return FALSE;
+ if (H5T_REFERENCE != H5Tget_class(type))
+ return FALSE;
- if (H5Tequal(type, H5T_STD_REF_OBJ)==TRUE) {
+ if (H5Tequal(type, H5T_STD_REF_OBJ) == TRUE) {
h5tools_str_append(buffer, "object reference");
}
- else if (H5Tequal(type, H5T_STD_REF_DSETREG)==TRUE) {
+ else if (H5Tequal(type, H5T_STD_REF_DSETREG) == TRUE) {
h5tools_str_append(buffer, "dataset region reference");
}
else {
- h5tools_str_append(buffer, "%lu-byte unknown reference",
- (unsigned long)H5Tget_size(type));
+ h5tools_str_append(buffer, "%lu-byte unknown reference", (unsigned long)H5Tget_size(type));
}
return TRUE;
@@ -1130,14 +1101,7 @@ print_reference_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
* Purpose: Prints information about an opaque data type.
*
* Return: Success: TRUE
- *
- * Failure: FALSE, nothing printed
- *
- * Programmer: Robb Matzke
- * Monday, June 7, 1999
- *
- * Modifications:
- *
+ * Failure: FALSE, nothing printed
*-------------------------------------------------------------------------
*/
static hbool_t
@@ -1146,11 +1110,12 @@ print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind)
char *tag;
size_t size;
- if (H5T_OPAQUE!=H5Tget_class(type)) return FALSE;
+ if (H5T_OPAQUE != H5Tget_class(type))
+ return FALSE;
size = H5Tget_size(type);
h5tools_str_append(buffer, "%lu-byte opaque type", (unsigned long)size);
- if ((tag=H5Tget_tag(type))) {
+ if ((tag = H5Tget_tag(type))) {
h5tools_str_append(buffer, "\n%*s(tag = \"", ind, "");
print_string(buffer, tag, FALSE);
h5tools_str_append(buffer, "\")");
@@ -1166,13 +1131,7 @@ print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind)
* Purpose: Print information about a variable-length type
*
* Return: Success: TRUE
- *
* Failure: FALSE
- *
- * Programmer: Robb Matzke
- * Friday, December 1, 2000
- *
- * Modifications:
*-------------------------------------------------------------------------
*/
static hbool_t
@@ -1180,11 +1139,12 @@ print_vlen_type(h5tools_str_t *buffer, hid_t type, int ind)
{
hid_t super;
- if (H5T_VLEN!=H5Tget_class(type)) return FALSE;
+ if (H5T_VLEN != H5Tget_class(type))
+ return FALSE;
- h5tools_str_append(buffer, "variable length of\n%*s", ind+4, "");
+ h5tools_str_append(buffer, "variable length of\n%*s", ind + 4, "");
super = H5Tget_super(type);
- print_type(buffer, super, ind+4);
+ print_type(buffer, super, ind + 4);
H5Tclose(super);
return TRUE;
}
@@ -1194,13 +1154,7 @@ print_vlen_type(h5tools_str_t *buffer, hid_t type, int ind)
* Purpose: Print information about an array type
*
* Return: Success: TRUE
- *
* Failure: FALSE
- *
- * Programmer: Robb Matzke
- * Thursday, January 31, 2002
- *
- * Modifications:
*---------------------------------------------------------------------------
*/
static hbool_t
@@ -1210,7 +1164,7 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
int ndims, i;
hsize_t *dims=NULL;
- if (H5T_ARRAY!=H5Tget_class(type))
+ if (H5T_ARRAY != H5Tget_class(type))
return FALSE;
ndims = H5Tget_array_ndims(type);
if (ndims) {
@@ -1218,7 +1172,7 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
H5Tget_array_dims2(type, dims);
/* Print dimensions */
- for (i=0; i<ndims; i++)
+ for (i = 0; i < ndims; i++)
h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT , i?",":"[", dims[i]);
h5tools_str_append(buffer, "]");
@@ -1243,16 +1197,7 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
* Purpose: Print information about a bitfield type.
*
* Return: Success: TRUE
- *
- * Failure: FALSE, nothing printed
- *
- * Programmer: Pedro Vicente
- * Tuesday, May 20, 2003
- *
- * Modifications:
- * Robb Matzke, LLNL 2003-06-05
- * Generalized Pedro's original if/then/else. Also display
- * precision/offset information.
+ * Failure: FALSE, nothing printed
*-------------------------------------------------------------------------
*/
static hbool_t
@@ -1261,24 +1206,28 @@ print_bitfield_type(h5tools_str_t *buffer, hid_t type, int ind)
H5T_order_t order; /* byte order value */
const char *order_s=NULL; /* byte order string */
- if (H5T_BITFIELD!=H5Tget_class(type)) return FALSE;
+ if (H5T_BITFIELD != H5Tget_class(type))
+ return FALSE;
if (H5Tget_size(type)>1) {
order = H5Tget_order(type);
- if (H5T_ORDER_LE==order) {
+ if (H5T_ORDER_LE == order) {
order_s = " little-endian";
- } else if (H5T_ORDER_BE==order) {
+ }
+ else if (H5T_ORDER_BE == order) {
order_s = " big-endian";
- } else if (H5T_ORDER_VAX==order) {
+ }
+ else if (H5T_ORDER_VAX == order) {
order_s = " mixed-endian";
- } else {
+ }
+ else {
order_s = "unknown-byte-order";
}
- } else {
+ }
+ else {
order_s = "";
}
- h5tools_str_append(buffer, "%lu-bit%s bitfield",
- (unsigned long)(8*H5Tget_size(type)), order_s);
+ h5tools_str_append(buffer, "%lu-bit%s bitfield", (unsigned long)(8*H5Tget_size(type)), order_s);
print_precision(buffer, type, ind);
return TRUE;
}
@@ -1292,16 +1241,9 @@ print_bitfield_type(h5tools_str_t *buffer, hid_t type, int ind)
* there might be line-feeds inside the type definition). The
* first line is assumed to have IND characters before it on
* the same line (printed by the caller).
- *
- * Return: void
- *
- * Programmer: Robb Matzke
- * Thursday, November 5, 1998
- *
- * Modifications:
- * Robb Matzke, 1999-06-11
* Prints the OID of shared data types.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void
@@ -1310,24 +1252,23 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind)
H5T_class_t data_class = H5Tget_class(type);
/* Bad data type */
- if (type<0) {
+ if (type < 0) {
h5tools_str_append(buffer,"<ERROR>");
return;
}
/* Shared? If so then print the type's OID */
- if(H5Tcommitted(type)) {
+ if (H5Tcommitted(type)) {
H5O_info_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_info2(type, &oi, H5O_INFO_BASIC) >= 0)
+ h5tools_str_append(buffer,"shared-%lu:"H5_PRINTF_HADDR_FMT" ", oi.fileno, oi.addr);
else
h5tools_str_append(buffer,"shared ");
} /* end if */
/* Print the type */
- if(print_native_type(buffer, type, ind) ||
+ if (print_native_type(buffer, type, ind) ||
print_ieee_type(buffer, type, ind) ||
print_cmpd_type(buffer, type, ind) ||
print_enum_type(buffer, type, ind) ||
@@ -1340,8 +1281,7 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind)
return;
/* Unknown type */
- h5tools_str_append(buffer,"%lu-byte class-%u unknown",
- (unsigned long)H5Tget_size(type), (unsigned)data_class);
+ h5tools_str_append(buffer,"%lu-byte class-%u unknown", (unsigned long)H5Tget_size(type), (unsigned)data_class);
}
@@ -1351,14 +1291,6 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind)
* Purpose: Prints all values of a dataset.
*
* Return: void
- *
- * Programmer: Robb Matzke
- * Tuesday, July 21, 1998
- *
- * Modifications:
- * Robb Matzke, 1999-09-27
- * Understands the simple_output_g switch which causes data to
- * be displayed in a more machine-readable format.
*-------------------------------------------------------------------------
*/
static void
@@ -1398,7 +1330,8 @@ dump_dataset_values(hid_t dset)
}
outputformat.cmpd_sep = " ";
- if (label_g) outputformat.cmpd_name = "%s=";
+ if (label_g)
+ outputformat.cmpd_name = "%s=";
outputformat.elmt_suf1 = " ";
outputformat.str_locale = ESCAPE_HTML;
@@ -1441,7 +1374,7 @@ dump_dataset_values(hid_t dset)
* command line switch was given. */
outputformat.raw = TRUE;
}
- else if (string_g && 1==size && H5T_INTEGER==H5Tget_class(f_type)) {
+ else if (string_g && 1 == size && H5T_INTEGER == H5Tget_class(f_type)) {
/* Print 1-byte integer data as an ASCI character string instead of
* integers if the `-s' or `--string' command-line option was given. */
outputformat.ascii = TRUE;
@@ -1481,14 +1414,7 @@ dump_dataset_values(hid_t dset)
* Purpose: Prints information about attributes.
*
* Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Friday, June 5, 1998
- *
- * Modifications:
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1521,7 +1447,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
print_string(&buffer, attr_name, TRUE);
- if((attr = H5Aopen(obj, attr_name, H5P_DEFAULT))) {
+ if ((attr = H5Aopen(obj, attr_name, H5P_DEFAULT))) {
space = H5Aget_space(attr);
type = H5Aget_type(attr);
@@ -1538,7 +1464,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
case H5S_SIMPLE:
/* simple dataspace */
h5tools_str_append(&buffer, " {");
- for (i=0; i<ndims; i++) {
+ for (i = 0; i < ndims; i++) {
h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i?", ":"", size[i]);
nelmts *= size[i];
}
@@ -1570,7 +1496,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
/* Data */
outputformat = *info;
- if(nelmts < 5) {
+ if (nelmts < 5) {
outputformat.idx_fmt = "";
outputformat.line_1st = " Data: ";
outputformat.line_pre = " ";
@@ -1589,10 +1515,9 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
}
outputformat.line_ncols = (unsigned)width_g;
- if(label_g)
+ if (label_g)
outputformat.cmpd_name = "%s=";
- if(string_g && 1==H5Tget_size(type) &&
- H5T_INTEGER==H5Tget_class(type)) {
+ if (string_g && 1 == H5Tget_size(type) && H5T_INTEGER == H5Tget_class(type)) {
outputformat.ascii = TRUE;
outputformat.elmt_suf1 = "";
outputformat.elmt_suf2 = "";
@@ -1616,13 +1541,13 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
info = &outputformat;
- if(space_type != H5S_NULL && space_type != H5S_NO_CLASS) {
- if(hexdump_g)
+ if (space_type != H5S_NULL && space_type != H5S_NO_CLASS) {
+ if (hexdump_g)
p_type = H5Tcopy(type);
else
p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
- if(p_type >= 0) {
+ if (p_type >= 0) {
/* VL data special information */
unsigned int vl_data = 0; /* contains VL datatypes */
@@ -1671,14 +1596,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
* printed by the caller.
*
* Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Thursday, August 27, 1998
- *
- * Modifications:
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1706,17 +1624,19 @@ dataset_list1(hid_t dset)
space_type = H5Sget_simple_extent_type(space);
ndims = H5Sget_simple_extent_dims(space, cur_size, max_size);
h5tools_str_append(&buffer, " {");
- for (i=0; i<ndims; i++) {
+ for (i = 0; i < ndims; i++) {
h5tools_str_append(&buffer, "%s"HSIZE_T_FORMAT, i?", ":"", cur_size[i]);
if (max_size[i]==H5S_UNLIMITED) {
h5tools_str_append(&buffer, "/%s", "Inf");
}
- else if (max_size[i]!=cur_size[i] || verbose_g>0) {
+ else if (max_size[i] != cur_size[i] || verbose_g > 0) {
h5tools_str_append(&buffer, "/"HSIZE_T_FORMAT, max_size[i]);
}
}
- if (space_type==H5S_SCALAR) h5tools_str_append(&buffer, "SCALAR");
- else if (space_type==H5S_NULL) h5tools_str_append(&buffer, "NULL");
+ if (space_type == H5S_SCALAR)
+ h5tools_str_append(&buffer, "SCALAR");
+ else if (space_type == H5S_NULL)
+ h5tools_str_append(&buffer, "NULL");
h5tools_str_append(&buffer, "}");
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
H5Sclose (space);
@@ -1734,14 +1654,7 @@ dataset_list1(hid_t dset)
* information which is general to all objects.
*
* Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Thursday, August 27, 1998
- *
- * Modifications:
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1777,7 +1690,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
h5tools_str_reset(&buffer);
- if(verbose_g > 0) {
+ if (verbose_g > 0) {
dcpl = H5Dget_create_plist(dset);
space = H5Dget_space(dset);
type = H5Dget_type(dset);
@@ -1791,7 +1704,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
ndims = H5Pget_chunk(dcpl, (int)NELMTS(chsize), chsize/*out*/);
h5tools_str_append(&buffer, " %-10s {", "Chunks:");
total = H5Tget_size(type);
- for (i=0; i<ndims; i++) {
+ for (i = 0; i < ndims; i++) {
h5tools_str_append(&buffer, "%s"HSIZE_T_FORMAT, i?", ":"", chsize[i]);
total *= chsize[i];
}
@@ -1802,29 +1715,25 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
break;
case H5D_CONTIGUOUS:
/* Print information about external storage */
- if((nf = H5Pget_external_count(dcpl)) > 0) {
- for(i = 0, max_len = 0; i < nf; i++) {
- if(H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, NULL, NULL) < 0)
+ if ((nf = H5Pget_external_count(dcpl)) > 0) {
+ for (i = 0, max_len = 0; i < nf; i++) {
+ if (H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, NULL, NULL) < 0)
continue;
n = print_string(NULL, f_name, TRUE);
max_len = MAX(max_len, n);
} /* end for */
- h5tools_str_append(&buffer, " %-10s %d external file%s\n",
- "Extern:", nf, 1==nf?"":"s");
- h5tools_str_append(&buffer, " %4s %10s %10s %10s %s\n",
- "ID", "DSet-Addr", "File-Addr", "Bytes", "File");
- h5tools_str_append(&buffer, " %4s %10s %10s %10s ",
- "----", "----------", "----------", "----------");
- for (i=0; i<max_len; i++) h5tools_str_append(&buffer, "-");
+ h5tools_str_append(&buffer, " %-10s %d external file%s\n", "Extern:", nf, 1==nf?"":"s");
+ h5tools_str_append(&buffer, " %4s %10s %10s %10s %s\n", "ID", "DSet-Addr", "File-Addr", "Bytes", "File");
+ h5tools_str_append(&buffer, " %4s %10s %10s %10s ", "----", "----------", "----------", "----------");
+ for (i = 0; i < max_len; i++)
+ h5tools_str_append(&buffer, "-");
h5tools_str_append(&buffer, "\n");
- for (i=0, total=0; i<nf; i++) {
+ for (i = 0, total=0; i < nf; i++) {
if (H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, &f_offset, &f_size)<0) {
- h5tools_str_append(&buffer,
- " #%03d %10"H5_PRINTF_LL_WIDTH"u %10s %10s ***ERROR*** %s\n",
- i, total, "", "",
- i+1<nf?"Following addresses are incorrect":"");
+ h5tools_str_append(&buffer, " #%03d %10"H5_PRINTF_LL_WIDTH"u %10s %10s ***ERROR*** %s\n",
+ i, total, "", "", i+1<nf?"Following addresses are incorrect":"");
}
- else if (H5S_UNLIMITED==f_size) {
+ else if (H5S_UNLIMITED == f_size) {
h5tools_str_append(&buffer, " #%03d %10"H5_PRINTF_LL_WIDTH"u %10"H5_PRINTF_LL_WIDTH"u %10s ",
i, total, (hsize_t)f_offset, "INF");
print_string(&buffer, f_name, TRUE);
@@ -1837,9 +1746,8 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
h5tools_str_append(&buffer, "\n");
total += f_size;
}
- h5tools_str_append(&buffer, " %4s %10s %10s %10s ",
- "----", "----------", "----------", "----------");
- for (i=0; i<max_len; i++)
+ h5tools_str_append(&buffer, " %4s %10s %10s %10s ", "----", "----------", "----------", "----------");
+ for (i = 0; i < max_len; i++)
h5tools_str_append(&buffer, "-");
h5tools_str_append(&buffer, "\n");
} /* end if */
@@ -1881,16 +1789,13 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
used = H5Dget_storage_size(dset);
tclass = H5Tget_class(type);
h5tools_str_append(&buffer, " %-10s ", "Storage:");
- switch (tclass)
- {
-
+ switch (tclass) {
case H5T_VLEN:
h5tools_str_append(&buffer, "information not available");
break;
case H5T_REFERENCE:
- if ( H5Tequal(type, H5T_STD_REF_DSETREG))
- {
+ if (H5Tequal(type, H5T_STD_REF_DSETREG)) {
h5tools_str_append(&buffer, "information not available");
}
break;
@@ -1907,11 +1812,8 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
case H5T_ARRAY:
case H5T_NCLASSES:
default:
- h5tools_str_append(&buffer, HSIZE_T_FORMAT" logical byte%s, "HSIZE_T_FORMAT" allocated byte%s",
- total, 1==total?"":"s",
- used, 1==used?"":"s");
- if (used>0)
- {
+ h5tools_str_append(&buffer, HSIZE_T_FORMAT" logical byte%s, "HSIZE_T_FORMAT" allocated byte%s", total, 1==total?"":"s", used, 1==used?"":"s");
+ if (used>0) {
utilization = ((double)total * (double)100.0f) / (double)used;
h5tools_str_append(&buffer, ", %1.2f%% utilization", utilization);
}
@@ -1920,18 +1822,14 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
h5tools_str_append(&buffer, "\n");
/* Print information about raw data filters */
- if((nf = H5Pget_nfilters(dcpl)) > 0) {
- for(i = 0; i < nf; i++) {
+ if ((nf = H5Pget_nfilters(dcpl)) > 0) {
+ for (i = 0; i < nf; i++) {
cd_nelmts = NELMTS(cd_values);
- filt_id = H5Pget_filter2(dcpl, (unsigned)i, &filt_flags, &cd_nelmts,
- cd_values, sizeof(f_name), f_name, NULL);
+ filt_id = H5Pget_filter2(dcpl, (unsigned)i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_name), f_name, NULL);
f_name[sizeof(f_name) - 1] = '\0';
HDsnprintf(s, sizeof(s), "Filter-%d:", i);
- h5tools_str_append(&buffer, " %-10s %s-%u %s {", s,
- (f_name[0] ? f_name : "method"),
- (unsigned)filt_id,
- ((filt_flags & H5Z_FLAG_OPTIONAL) ? "OPT" : ""));
- for(cd_num = 0; cd_num < cd_nelmts; cd_num++)
+ h5tools_str_append(&buffer, " %-10s %s-%u %s {", s, (f_name[0] ? f_name : "method"), (unsigned)filt_id, ((filt_flags & H5Z_FLAG_OPTIONAL) ? "OPT" : ""));
+ for (cd_num = 0; cd_num < cd_nelmts; cd_num++)
h5tools_str_append(&buffer, "%s%u", (cd_num ? ", " : ""), cd_values[cd_num]);
h5tools_str_append(&buffer, "}\n");
} /* end for */
@@ -1944,7 +1842,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
/* Print address information */
- if(address_g)
+ if (address_g)
H5Ddebug(dset);
/* Close stuff */
@@ -1955,7 +1853,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
h5tools_str_close(&buffer);
- if(data_g)
+ if (data_g)
dump_dataset_values(dset);
return 0;
@@ -1969,20 +1867,13 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
* information which is general to all objects.
*
* Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Thursday, November 5, 1998
- *
- * Modifications:
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name)
{
- if (verbose_g>0) {
+ if (verbose_g > 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 */
@@ -2010,12 +1901,7 @@ datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name)
* Purpose: Prints information about an object
*
* Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Quincey Koziol
- * Tuesday, November 6, 2007
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2034,26 +1920,26 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
h5tools_str_reset(&buffer);
/* Print the link's name, either full name or base name */
- if(!iter->symlink_target)
+ if (!iter->symlink_target)
print_obj_name(&buffer, iter, name, "");
/* Check object information */
- if(oinfo->type < 0 || oinfo->type >= H5O_TYPE_NTYPES) {
+ if (oinfo->type < 0 || oinfo->type >= H5O_TYPE_NTYPES) {
h5tools_str_append(&buffer, "Unknown type(%d)", (int)oinfo->type);
obj_type = H5O_TYPE_UNKNOWN;
}
- if(iter->symlink_target)
+ if (iter->symlink_target)
h5tools_str_append(&buffer, "{");
- if(obj_type >= 0 && dispatch_g[obj_type].name)
+ if (obj_type >= 0 && dispatch_g[obj_type].name)
h5tools_str_append(&buffer, "%s", dispatch_g[obj_type].name);
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
/* Check if we've seen this object before */
- if(first_seen) {
+ if (first_seen) {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, ", same as ");
print_string(&buffer, first_seen, TRUE);
- if(!iter->symlink_target) {
+ if (!iter->symlink_target) {
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);
@@ -2064,7 +1950,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
/* Open the object. Not all objects can be opened. If this is the case
* then return right away.
*/
- if(obj_type >= 0 && (obj = H5Oopen(iter->fid, name, H5P_DEFAULT)) < 0) {
+ if (obj_type >= 0 && (obj = 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);
@@ -2072,9 +1958,9 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
} /* end if */
/* List the first line of information for the object. */
- if(obj_type >= 0 && dispatch_g[obj_type].list1)
+ if (obj_type >= 0 && dispatch_g[obj_type].list1)
(dispatch_g[obj_type].list1)(obj);
- if(!iter->symlink_target || (verbose_g > 0)) {
+ if (!iter->symlink_target || (verbose_g > 0)) {
h5tools_str_reset(&buffer);
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);
@@ -2082,13 +1968,13 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
/* Show detailed information about the object, beginning with information
* which is common to all objects. */
- if(verbose_g > 0) {
+ if (verbose_g > 0) {
size_t buf_size = 0;
char* comment = NULL;
ssize_t cmt_bufsize = -1;
/* Display attributes */
- if(obj_type >= 0)
+ if (obj_type >= 0)
H5Aiterate2(obj, H5_INDEX_NAME, H5_ITER_INC, NULL, list_attr, NULL);
/* Object location & reference count */
@@ -2098,7 +1984,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
/* Modification time */
- if(oinfo->mtime > 0) {
+ if (oinfo->mtime > 0) {
char buf[256];
struct tm *tm;
@@ -2106,7 +1992,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
tm = HDgmtime(&(oinfo->mtime));
else
tm = HDlocaltime(&(oinfo->mtime));
- if(tm) {
+ if (tm) {
HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " %-10s %s\n", "Modified:", buf);
@@ -2122,9 +2008,9 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
* 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) {
+ if (comment) {
cmt_bufsize = H5Oget_comment(obj, comment, (size_t)cmt_bufsize);
- if(cmt_bufsize > 0) {
+ if (cmt_bufsize > 0) {
comment[cmt_bufsize] = 0;
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " %-10s \"", "Comment:");
@@ -2138,16 +2024,16 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
} /* end if */
/* Detailed list for object */
- if(obj_type >= 0 && dispatch_g[obj_type].list2)
+ if (obj_type >= 0 && dispatch_g[obj_type].list2)
(dispatch_g[obj_type].list2)(obj, name);
/* Close the object. */
- if(obj_type >= 0)
+ if (obj_type >= 0)
H5Oclose(obj);
} /* end else */
done:
- if(iter->symlink_target) {
+ if (iter->symlink_target) {
h5tools_str_reset(&buffer);
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);
@@ -2159,19 +2045,13 @@ done:
} /* end list_obj() */
-
/*-------------------------------------------------------------------------
* Function: list_lnk
*
* Purpose: Prints information about a link
*
* Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Quincey Koziol
- * Thursday, November 8, 2007
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2218,15 +2098,13 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
h5tools_str_append(&buffer, buf);
h5tools_str_append(&buffer, "}");
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
- if(follow_symlink_g)
- {
+ if (follow_symlink_g) {
hbool_t orig_grp_literal = grp_literal_g;
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " ");
/* Check if we have already seen this softlink */
- if(symlink_is_visited(iter->symlink_list, linfo->type, NULL, buf))
- {
+ if (symlink_is_visited(iter->symlink_list, linfo->type, NULL, buf)) {
h5tools_str_append(&buffer, "{Already Visited}\n");
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
goto done;
@@ -2234,7 +2112,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
/* Add this link to the list of seen softlinks */
- if(symlink_visit_add(iter->symlink_list, linfo->type, NULL, buf) < 0)
+ if (symlink_visit_add(iter->symlink_list, linfo->type, NULL, buf) < 0)
goto done;
/* Adjust user data to specify that we are operating on the
@@ -2243,11 +2121,10 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
/* Prevent recursive listing of soft link target if
* recursive_g is off */
- if(!recursive_g)
+ if (!recursive_g)
grp_literal_g = TRUE;
/* Recurse through the soft link */
- if(visit_obj(iter->fid, name, iter) < 0)
- {
+ if (visit_obj(iter->fid, name, iter) < 0) {
grp_literal_g = orig_grp_literal;
goto done;
}
@@ -2279,7 +2156,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
else if (no_dangling_link_g && ret == 0)
iter->symlink_list->dangle_link = TRUE;
- if(H5Lunpack_elink_val(buf, linfo->u.val_size, NULL, &filename, &path) < 0)
+ if (H5Lunpack_elink_val(buf, linfo->u.val_size, NULL, &filename, &path) < 0)
goto done;
h5tools_str_append(&buffer, "External Link {");
@@ -2287,21 +2164,19 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
h5tools_str_append(&buffer, "/");
if(*path != '/')
h5tools_str_append(&buffer, "/");
- h5tools_str_append(&buffer, path);
+ h5tools_str_append(&buffer, path);
h5tools_str_append(&buffer, "}");
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
/* Recurse through the external link */
/* keep the follow_elink_g for backward compatibility with -E */
- if(follow_link)
- {
+ if (follow_link) {
hbool_t orig_grp_literal = grp_literal_g;
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " ");
/* Check if we have already seen this elink */
- if(symlink_is_visited(iter->symlink_list, linfo->type, filename, path))
- {
+ if (symlink_is_visited(iter->symlink_list, linfo->type, filename, path)) {
h5tools_str_append(&buffer, "{Already Visited}\n");
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
goto done;
@@ -2309,8 +2184,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
/* Add this link to the list of seen elinks */
- if(symlink_visit_add(iter->symlink_list, linfo->type, filename, path) < 0)
- {
+ if (symlink_visit_add(iter->symlink_list, linfo->type, filename, path) < 0) {
goto done;
}
@@ -2320,11 +2194,11 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
/* Prevent recursive listing of external link target if
* recursive_g is off */
- if(!recursive_g)
+ if (!recursive_g)
grp_literal_g = TRUE;
/* Recurse through the external link */
- if(visit_obj(iter->fid, name, iter) < 0) {
+ if (visit_obj(iter->fid, name, iter) < 0) {
grp_literal_g = orig_grp_literal;
goto done;
}
@@ -2362,11 +2236,6 @@ done:
* Return:
* Success: 0
* Failure: -1
- *
- * Programmer: Neil Fortner
- * Wednesday, August 21, 2008
- * Mostly copied from main()
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2385,8 +2254,8 @@ 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(iter->symlink_target) {
+ if (H5Oget_info_by_name2(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;
}
@@ -2398,9 +2267,9 @@ visit_obj(hid_t file, const char *oname, iter_t *iter)
} /* end if */
/* Check for group iteration */
- if(H5O_TYPE_GROUP == oi.type && !grp_literal_g) {
+ if (H5O_TYPE_GROUP == oi.type && !grp_literal_g) {
/* Get ID for group */
- if(!iter->symlink_target && (iter->gid = H5Gopen2(file, oname, H5P_DEFAULT)) < 0) {
+ if (!iter->symlink_target && (iter->gid = H5Gopen2(file, oname, H5P_DEFAULT)) < 0) {
h5tools_str_append(&buffer, "%s: unable to open '%s' as group\n", iter->fname, oname);
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
goto done; /* Previously "continue", when this code was in main().
@@ -2416,7 +2285,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter)
h5trav_visit(file, oname, (hbool_t) (display_root_g || iter->symlink_target), recursive_g, list_obj, list_lnk, iter, H5O_INFO_BASIC|H5O_INFO_TIME);
/* Close group */
- if(!iter->symlink_target)
+ if (!iter->symlink_target)
H5Gclose(iter->gid);
} /* end if */
else {
@@ -2443,14 +2312,7 @@ done:
* were borrowed from the GNU less(1).
*
* Return: Success: Number of columns.
- *
- * Failure: Some default number of columms.
- *
- * Programmer: Robb Matzke
- * Friday, November 6, 1998
- *
- * Modifications:
- *
+ * Failure: Some default number of columms.
*-------------------------------------------------------------------------
*/
static int
@@ -2461,7 +2323,7 @@ get_width(void)
/* Try to get it from the COLUMNS environment variable first since it's
* value is sometimes wrong. */
- if ((s=HDgetenv("COLUMNS")) && *s && isdigit((int)*s))
+ if ((s = HDgetenv("COLUMNS")) && *s && isdigit((int)*s))
width = (int)HDstrtol(s, NULL, 0);
#if defined(H5_HAVE_STRUCT_VIDEOCONFIG) && defined(H5_HAVE__GETVIDEOCONFIG)
@@ -2509,7 +2371,8 @@ get_width(void)
#endif
/* Set to at least 1 */
- if (width<1) width = 1;
+ if (width < 1)
+ width = 1;
return width;
}
@@ -2521,25 +2384,19 @@ get_width(void)
* Return:
* Success: TRUE (1)
* Failure: FALSE (0)
- *
- * Programmer:
- * Jonathan Kim (06/15/2010)
- *
*-------------------------------------------------------------------------*/
static hbool_t
is_valid_args(void)
{
hbool_t ret = TRUE;
- if(recursive_g && grp_literal_g)
- {
+ if (recursive_g && grp_literal_g) {
HDfprintf(rawerrorstream, "Error: 'recursive' option not compatible with 'group info' option!\n\n");
ret = FALSE;
goto out;
}
- if(no_dangling_link_g && !follow_symlink_g)
- {
+ if (no_dangling_link_g && !follow_symlink_g) {
HDfprintf(rawerrorstream, "Error: --no-dangling-links must be used along with --follow-symlinks option!\n\n");
ret = FALSE;
goto out;
@@ -2556,12 +2413,6 @@ out:
* Purpose: Close HDF5 and MPI and call exit()
*
* Return: Does not return
- *
- * Programmer: Quincey Koziol
- * Saturday, January 31, 2004
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -2579,28 +2430,45 @@ leave(int ret)
* Purpose: Opens a file and lists the specified group
*
* Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Robb Matzke
- * Monday, March 23, 1998
- *
- * Modifications:
- *
+ * Failure: 1
*-------------------------------------------------------------------------
*/
int
main(int argc, const char *argv[])
{
- hid_t file = -1;
- char *fname = NULL, *oname = NULL, *x;
+ hid_t file = -1;
+ char *fname = NULL, *oname = NULL, *x;
const char *s = NULL;
- char *rest;
- int argno;
+ char *rest;
+ int argno;
static char root_name[] = "/";
char drivername[50];
const char *preferred_driver = NULL;
- int err_exit = 0;
+ int err_exit = 0;
+ hid_t fapl_id = H5P_DEFAULT;
+
+#ifdef H5_HAVE_ROS3_VFD
+ /* default "anonymous" s3 configuration */
+ H5FD_ros3_fapl_t ros3_fa = {
+ 1, /* fapl version */
+ false, /* authenticate */
+ "", /* aws region */
+ "", /* access key id */
+ "", /* secret access key */
+ };
+#endif /* H5_HVAE_ROS3_VFD */
+
+#ifdef H5_HAVE_LIBHDFS
+ /* "default" HDFS configuration */
+ H5FD_hdfs_fapl_t hdfs_fa = {
+ 1, /* fapl version */
+ "localhost", /* namenode name */
+ 0, /* namenode port */
+ "", /* kerberos ticket cache */
+ "", /* user name */
+ 2048, /* stream buffer size */
+ };
+#endif /* H5_HAVE_LIBHDFS */
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -2617,90 +2485,258 @@ main(int argc, const char *argv[])
width_g = get_width();
/* Switches come before non-switch arguments */
- for(argno = 1; argno < argc && '-' == argv[argno][0]; argno++) {
- if(!HDstrcmp(argv[argno], "--")) {
+ for (argno = 1; argno < argc && '-' == argv[argno][0]; argno++) {
+ if (!HDstrcmp(argv[argno], "--")) {
/* Last switch */
argno++;
break;
- } else if(!HDstrcmp(argv[argno], "--help")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--help")) {
usage();
leave(EXIT_SUCCESS);
- } else if(!HDstrcmp(argv[argno], "--address")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--address")) {
address_g = TRUE;
- } else if(!HDstrcmp(argv[argno], "--data")) {
+ }
+ else if(!HDstrcmp(argv[argno], "--data")) {
data_g = TRUE;
- } else if(!HDstrcmp(argv[argno], "--enable-error-stack")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--enable-error-stack")) {
show_errors_g = TRUE;
/* deprecated --errors */
- } else if(!HDstrcmp(argv[argno], "--errors")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--errors")) {
show_errors_g = TRUE;
- } else if(!HDstrcmp(argv[argno], "--follow-symlinks")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--follow-symlinks")) {
follow_symlink_g = TRUE;
- } else if(!HDstrcmp(argv[argno], "--no-dangling-links")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--no-dangling-links")) {
no_dangling_link_g = TRUE;
- } else if(!HDstrcmp(argv[argno], "--external")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--external")) {
follow_elink_g = TRUE;
- } else if(!HDstrcmp(argv[argno], "--full")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--full")) {
fullname_g = TRUE;
- } else if(!HDstrcmp(argv[argno], "--group")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--group")) {
grp_literal_g = TRUE;
- } else if(!HDstrcmp(argv[argno], "--label")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--label")) {
label_g = TRUE;
- } else if(!HDstrcmp(argv[argno], "--recursive")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--recursive")) {
recursive_g = TRUE;
fullname_g = TRUE;
- } else if(!HDstrcmp(argv[argno], "--simple")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--simple")) {
simple_output_g = TRUE;
- } else if(!HDstrcmp(argv[argno], "--string")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--string")) {
string_g = TRUE;
- } else if(!HDstrncmp(argv[argno], "--vfd=", (size_t)6)) {
+ }
+ else if (!HDstrncmp(argv[argno], "--vfd=", (size_t)6)) {
preferred_driver = argv[argno]+6;
- } else if(!HDstrncmp(argv[argno], "--width=", (size_t)8)) {
+ }
+ else if (!HDstrncmp(argv[argno], "--width=", (size_t)8)) {
width_g = (int)HDstrtol(argv[argno]+8, &rest, 0);
- if(0 == width_g)
+ if (0 == width_g)
no_line_wrap_g = TRUE;
- else if(width_g < 0 || *rest) {
+ else if (width_g < 0 || *rest) {
usage();
leave(EXIT_FAILURE);
}
- } else if(!HDstrcmp(argv[argno], "--width")) {
- if((argno + 1) >= argc) {
+ }
+ else if (!HDstrcmp(argv[argno], "--width")) {
+ if ((argno + 1) >= argc) {
usage();
leave(EXIT_FAILURE);
- } else {
+ }
+ else {
s = argv[++argno];
}
width_g = (int)HDstrtol(s, &rest, 0);
- if(width_g <= 0 || *rest) {
+ if (width_g <= 0 || *rest) {
usage();
leave(EXIT_FAILURE);
}
- } else if(!HDstrcmp(argv[argno], "--verbose")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--verbose")) {
verbose_g++;
- } else if(!HDstrcmp(argv[argno], "--version")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--version")) {
print_version(h5tools_getprogname());
leave(EXIT_SUCCESS);
- } else if(!HDstrcmp(argv[argno], "--hexdump")) {
+ }
+ else if (!HDstrcmp(argv[argno], "--hexdump")) {
hexdump_g = TRUE;
- } else if(!HDstrncmp(argv[argno], "-w", (size_t)2)) {
- if(argv[argno][2]) {
+ }
+ else if (!HDstrncmp(argv[argno], "-w", (size_t)2)) {
+ if (argv[argno][2]) {
s = argv[argno] + 2;
- } else if((argno + 1) >= argc) {
+ }
+ else if ((argno + 1) >= argc) {
usage();
leave(EXIT_FAILURE);
- } else {
+ }
+ else {
s = argv[++argno];
}
width_g = (int)HDstrtol(s, &rest, 0);
- if(0 == width_g)
+ if(0 == width_g) {
no_line_wrap_g = TRUE;
+ }
else if(width_g < 0 || *rest) {
usage();
leave(EXIT_FAILURE);
}
- } else if('-'!=argv[argno][1]) {
+
+ } else if (!HDstrncmp(argv[argno], "--s3-cred=", (size_t)10)) {
+#ifndef H5_HAVE_ROS3_VFD
+ HDfprintf(rawerrorstream, "Error: Read-Only S3 VFD is not enabled\n\n");
+ usage();
+ leave(EXIT_FAILURE);
+#else
+ unsigned nelems = 0;
+ char *start = NULL;
+ char *s3cred_src = NULL;
+ char **s3cred = NULL;
+ char const *ccred[3];
+ /* try to parse s3 credentials tuple
+ */
+ start = strchr(argv[argno], '=');
+ if (start == NULL) {
+ HDfprintf(rawerrorstream,
+ "Error: Unable to parse null credentials tuple\n"
+ " For anonymous access, omit \"--s3-cred\" and use only \"--vfd=ros3\"\n\n");
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ start++;
+ if (FAIL == parse_tuple((const char *)start, ',', &s3cred_src, &nelems, &s3cred)) {
+ HDfprintf(rawerrorstream, "Error: Unable to parse S3 credentials\n\n");
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ /* sanity-check tuple count
+ */
+ if (nelems != 3) {
+ HDfprintf(rawerrorstream, "Error: Invalid S3 credentials\n\n");
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ ccred[0] = (const char *)s3cred[0];
+ ccred[1] = (const char *)s3cred[1];
+ ccred[2] = (const char *)s3cred[2];
+ if (0 == h5tools_populate_ros3_fapl(&ros3_fa, ccred)) {
+ HDfprintf(rawerrorstream, "Error: Invalid S3 credentials\n\n");
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ HDfree(s3cred);
+ HDfree(s3cred_src);
+#endif /* H5_HAVE_ROS3_VFD */
+
+ }
+ else if (!HDstrncmp(argv[argno], "--hdfs-attrs=", (size_t)13)) {
+#ifndef H5_HAVE_LIBHDFS
+ PRINTVALSTREAM(rawoutstream, "The HDFS VFD is not enabled.\n");
+ leave(EXIT_FAILURE);
+#else
+ /* Parse received configuration data and set fapl config struct */
+
+ hbool_t _debug = FALSE;
+ unsigned nelems = 0;
+ char const *start = NULL;
+ char *props_src = NULL;
+ char **props = NULL;
+ unsigned long k = 0;
+
+ /* try to parse tuple
+ */
+ if (_debug) {
+ HDfprintf(stderr, "configuring hdfs...\n");
+ }
+ start = argv[argno]+13; /* should never segfault: worst case of */
+ if (*start != '(') { /* null-termintor after '='. */
+
+ if (_debug) {
+ HDfprintf(stderr, " no tuple.\n");
+ }
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ if (FAIL == parse_tuple((const char *)start, ',', &props_src, &nelems, &props)) {
+ HDfprintf(stderr, " unable to parse tuple.\n");
+ usage();
+ leave(EXIT_FAILURE);
+ }
+
+ /* sanity-check tuple count
+ */
+ if (nelems != 5) {
+ HDfprintf(stderr, " expected 5-ple, got `%d`\n", nelems);
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ if (_debug) {
+ HDfprintf(stderr, " got hdfs-attrs tuple: `(%s,%s,%s,%s,%s)`\n",
+ props[0], props[1], props[2], props[3], props[4]);
+ }
+
+ /* Populate fapl configuration structure with given properties.
+ * WARNING: No error-checking is done on length of input strings...
+ * Silent overflow is possible, albeit unlikely.
+ */
+ if (HDstrncmp(props[0], "", 1)) {
+ if (_debug) {
+ HDfprintf(stderr, " setting namenode name: %s\n", props[0]);
+ }
+ HDstrncpy(hdfs_fa.namenode_name, (const char *)props[0], HDstrlen(props[0]));
+ }
+ if (HDstrncmp(props[1], "", 1)) {
+ k = strtoul((const char *)props[1], NULL, 0);
+ if (errno == ERANGE) {
+ HDfprintf(stderr, " supposed port number wasn't.\n");
+ leave(EXIT_FAILURE);
+ }
+ if (_debug) {
+ HDfprintf(stderr, " setting namenode port: %lu\n", k);
+ }
+ hdfs_fa.namenode_port = (int32_t)k;
+ }
+ if (HDstrncmp(props[2], "", 1)) {
+ if (_debug) {
+ HDfprintf(stderr, " setting kerb cache path: %s\n", props[2]);
+ }
+ HDstrncpy(hdfs_fa.kerberos_ticket_cache, (const char *)props[2], HDstrlen(props[2]));
+ }
+ if (HDstrncmp(props[3], "", 1)) {
+ if (_debug) {
+ HDfprintf(stderr, " setting username: %s\n", props[3]);
+ }
+ HDstrncpy(hdfs_fa.user_name, (const char *)props[3], HDstrlen(props[3]));
+ }
+ if (HDstrncmp(props[4], "", 1)) {
+ k = HDstrtoul((const char *)props[4], NULL, 0);
+ if (errno == ERANGE) {
+ HDfprintf(stderr, " supposed buffersize number wasn't.\n");
+ leave(EXIT_FAILURE);
+ }
+ if (_debug) {
+ HDfprintf(stderr, " setting stream buffer size: %lu\n", k);
+ }
+ hdfs_fa.stream_buffer_size = (int32_t)k;
+ }
+ HDfree(props);
+ HDfree(props_src);
+#endif /* H5_HAVE_LIBHDFS */
+
+ }
+ else if('-'!=argv[argno][1]) {
/* Single-letter switches */
for(s = argv[argno] + 1; *s; s++) {
switch(*s) {
@@ -2770,7 +2806,8 @@ main(int argc, const char *argv[])
leave(EXIT_FAILURE);
} /* end switch */
} /* end for */
- } else {
+ }
+ else {
HDfprintf(stderr, "Unknown argument: %s\n", argv[argno]);
usage();
leave(EXIT_FAILURE);
@@ -2779,18 +2816,54 @@ main(int argc, const char *argv[])
/* If no arguments remain then print a usage message (instead of doing
* absolutely nothing ;-) */
- if(argno >= argc) {
+ if (argno >= argc) {
usage();
leave(EXIT_FAILURE);
} /* end if */
/* Check for conflicting arguments */
- if (!is_valid_args())
- {
+ if (!is_valid_args()) {
usage();
leave(EXIT_FAILURE);
}
+ if (preferred_driver) {
+ void *conf_fa = NULL;
+
+ if (!HDstrcmp(preferred_driver, "ros3")) {
+#ifndef H5_HAVE_ROS3_VFD
+ HDfprintf(rawerrorstream, "Error: Read-Only S3 VFD not enabled.\n\n");
+ usage();
+ leave(EXIT_FAILURE);
+#else
+ conf_fa = (void *)&ros3_fa;
+#endif /* H5_HAVE_ROS3_VFD */
+
+ }
+ else if (!HDstrcmp(preferred_driver, "hdfs")) {
+#ifndef H5_HAVE_LIBHDFS
+ PRINTVALSTREAM(rawoutstream, "The HDFS VFD is not enabled.\n");
+ leave(EXIT_FAILURE);
+#else
+ conf_fa = (void *)&hdfs_fa;
+#endif /* H5_HAVE_LIBHDFS */
+ }
+
+ if (conf_fa != NULL) {
+ HDassert(fapl_id == H5P_DEFAULT);
+ fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ if (fapl_id < 0) {
+ HDfprintf(rawerrorstream, "Error: Unable to create fapl entry\n\n");
+ leave(EXIT_FAILURE);
+ }
+ if (0 == h5tools_set_configured_fapl(fapl_id, preferred_driver, conf_fa)) {
+ HDfprintf(rawerrorstream, "Error: Unable to set fapl\n\n");
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ }
+ } /* preferred_driver defined */
+
/* Turn off HDF5's automatic error printing unless you're debugging h5ls */
if(!show_errors_g)
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
@@ -2819,11 +2892,16 @@ main(int argc, const char *argv[])
oname = NULL;
file = -1;
- while(fname && *fname) {
- file = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername);
+ while (fname && *fname) {
+ if (fapl_id != H5P_DEFAULT) {
+ file = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id);
+ }
+ else {
+ file = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername);
+ }
- if(file >= 0) {
- if(verbose_g)
+ if (file >= 0) {
+ if (verbose_g)
PRINTSTREAM(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername);
break; /*success*/
} /* end if */
@@ -2831,27 +2909,27 @@ main(int argc, const char *argv[])
/* Shorten the file name; lengthen the object name */
x = oname;
oname = HDstrrchr(fname, '/');
- if(x)
+ if (x)
*x = '/';
- if(!oname)
+ if (!oname)
break;
*oname = '\0';
} /* end while */
- if(file < 0) {
+ if (file < 0) {
HDfprintf(rawerrorstream, "%s: unable to open file\n", argv[argno-1]);
HDfree(fname);
err_exit = 1;
continue;
} /* end if */
- if(oname) {
+ if (oname) {
/* Always use absolute paths to avoid confusion, keep track of where
* to begin path name output */
*oname = '/';
iter.base_len = HDstrlen(oname);
iter.base_len -= oname[iter.base_len-1] == '/';
x = oname;
- if(NULL == (oname = HDstrdup(oname))) {
+ if (NULL == (oname = HDstrdup(oname))) {
HDfprintf(rawerrorstream, "memory allocation failed\n");
leave(EXIT_FAILURE);
}
@@ -2860,9 +2938,9 @@ main(int argc, const char *argv[])
* is displayed if it is a link or non-group object */
iter.name_start = 1;
}
- if(!oname || !*oname) {
+ if (!oname || !*oname) {
oname = root_name;
- if(recursive_g)
+ if (recursive_g)
display_root_g = TRUE;
iter.base_len = 0;
iter.name_start = 0;
@@ -2883,9 +2961,9 @@ main(int argc, const char *argv[])
symlink_list.objs = NULL;
/* Check for root group as object name */
- if(HDstrcmp(oname, root_name)) {
+ if (HDstrcmp(oname, root_name)) {
/* Check the type of link given */
- if(H5Lget_info(file, oname, &li, H5P_DEFAULT) < 0) {
+ if (H5Lget_info(file, 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 */
@@ -2904,8 +2982,8 @@ main(int argc, const char *argv[])
li.type = H5L_TYPE_HARD;
/* Open the object and display it's information */
- if(li.type == H5L_TYPE_HARD) {
- if(visit_obj(file, oname, &iter) < 0)
+ if (li.type == H5L_TYPE_HARD) {
+ if (visit_obj(file, oname, &iter) < 0)
leave(EXIT_FAILURE);
} /* end if(li.type == H5L_TYPE_HARD) */
else {
@@ -2916,11 +2994,10 @@ main(int argc, const char *argv[])
}
H5Fclose(file);
HDfree(fname);
- if(x)
+ if (x)
HDfree(oname);
- for(u=0; u < symlink_list.nused; u++)
- {
+ for (u = 0; u < symlink_list.nused; u++) {
if (symlink_list.objs[u].type == H5L_TYPE_EXTERNAL)
HDfree(symlink_list.objs[u].file);
@@ -2933,6 +3010,13 @@ main(int argc, const char *argv[])
err_exit = 1;
} /* end while */
+ if (fapl_id != H5P_DEFAULT) {
+ if (0 < H5Pclose(fapl_id)) {
+ HDfprintf(rawerrorstream, "Error: Unable to set close fapl entry\n\n");
+ leave(EXIT_FAILURE);
+ }
+ }
+
if (err_exit)
leave(EXIT_FAILURE);
else
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index 5e9339f..5b47481 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -118,6 +118,33 @@ typedef struct iter_t {
} iter_t;
+static const char *drivername = "";
+
+#ifdef H5_HAVE_ROS3_VFD
+/* default "anonymous" s3 configuration
+ */
+static H5FD_ros3_fapl_t ros3_fa = {
+ 1, /* fapl version */
+ false, /* authenticate */
+ "", /* aws region */
+ "", /* access key id */
+ "", /* secret access key */
+};
+#endif /* H5_HAVE_ROS3_VFD */
+
+#ifdef H5_HAVE_LIBHDFS
+/* default HDFS access configuration
+ */
+static H5FD_hdfs_fapl_t hdfs_fa = {
+ 1, /* fapl version */
+ "localhost", /* namenode name */
+ 0, /* namenode port */
+ "", /* kerberos ticket cache */
+ "", /* user name */
+ 2048, /* stream buffer size */
+};
+#endif /* H5_HAVE_LIBHDFS */
+
static int display_all = TRUE;
/* Enable the printing of selected statistics */
@@ -146,7 +173,7 @@ struct handler_t {
char **obj;
};
-static const char *s_opts ="Aa:Ddm:EFfhGgl:sSTO:V";
+static const char *s_opts ="Aa:Ddm:EFfhGgl:sSTO:Vw:";
/* e.g. "filemetadata" has to precede "file"; "groupmetadata" has to precede "group" etc. */
static struct long_options l_opts[] = {
{"help", no_arg, 'h'},
@@ -246,6 +273,8 @@ static struct long_options l_opts[] = {
{ "summ", no_arg, 'S' },
{ "sum", no_arg, 'S' },
{ "su", no_arg, 'S' },
+ { "s3-cred", require_arg, 'w' },
+ { "hdfs-attrs", require_arg, 'H' },
{ NULL, 0, '\0' }
};
@@ -295,6 +324,16 @@ static void usage(const char *prog)
HDfprintf(stdout, " -s, --freespace Print free space information\n");
HDfprintf(stdout, " -S, --summary Print summary of file space information\n");
HDfprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n");
+ HDfprintf(stdout, " --s3-cred=<cred> Access file on S3, using provided credential\n");
+ HDfprintf(stdout, " <cred> :: (region,id,key)\n");
+ HDfprintf(stdout, " If <cred> == \"(,,)\", no authentication is used.\n");
+ HDfprintf(stdout, " --hdfs-attrs=<attrs> Access a file on HDFS with given configuration\n");
+ HDfprintf(stdout, " attributes.\n");
+ HDfprintf(stdout, " <attrs> :: (<namenode name>,<namenode port>,\n");
+ HDfprintf(stdout, " <kerberos cache path>,<username>,\n");
+ HDfprintf(stdout, " <buffer size>)\n");
+ HDfprintf(stdout, " If an attribute is empty, a default value will be\n");
+ HDfprintf(stdout, " used.\n");
}
@@ -1019,6 +1058,105 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
} /* end if */
break;
+ case 'w':
+#ifndef H5_HAVE_ROS3_VFD
+ error_msg("Read-Only S3 VFD not enabled.\n");
+ goto error;
+#else
+ {
+ char *cred_str = NULL;
+ unsigned nelems = 0;
+ char **cred = NULL;
+ char const *ccred[3];
+
+ if (FAIL == parse_tuple((const char *)opt_arg, ',', &cred_str, &nelems, &cred)) {
+ error_msg("Unable to parse s3 credential\n");
+ goto error;
+ }
+ if (nelems != 3) {
+ error_msg("s3 credential must have three elements\n");
+ goto error;
+ }
+ ccred[0] = (const char *)cred[0];
+ ccred[1] = (const char *)cred[1];
+ ccred[2] = (const char *)cred[2];
+ if (0 == h5tools_populate_ros3_fapl(&ros3_fa, ccred)) {
+ error_msg("Unable to set ros3 fapl config\n");
+ goto error;
+ }
+ HDfree(cred);
+ HDfree(cred_str);
+ } /* parse s3-cred block */
+ drivername = "ros3";
+ break;
+#endif /* H5_HAVE_ROS3_VFD */
+
+ case 'H':
+#ifndef H5_HAVE_LIBHDFS
+ error_msg("HDFS VFD is not enabled.\n");
+ goto error;
+#else
+ {
+ unsigned nelems = 0;
+ char *props_src = NULL;
+ char **props = NULL;
+ unsigned long k = 0;
+ if (FAIL == parse_tuple((const char *)opt_arg,
+ ',', &props_src, &nelems, &props)) {
+ error_msg("unable to parse hdfs properties tuple\n");
+ goto error;
+ }
+ /* sanity-check tuple count
+ */
+ if (nelems != 5) {
+ char str[64] = "";
+ HDsprintf(str,
+ "expected 5 elements in hdfs properties tuple "
+ "but found %u\n",
+ nelems);
+ HDfree(props);
+ HDfree(props_src);
+ error_msg(str);
+ goto error;
+ }
+ /* Populate fapl configuration structure with given
+ * properties.
+ * TODO/WARNING: No error-checking is done on length of
+ * input strings... Silent overflow is possible,
+ * albeit unlikely.
+ */
+ if (HDstrncmp(props[0], "", 1)) {
+ HDstrncpy(hdfs_fa.namenode_name,(const char *)props[0], HDstrlen(props[0]));
+ }
+ if (HDstrncmp(props[1], "", 1)) {
+ k = strtoul((const char *)props[1], NULL, 0);
+ if (errno == ERANGE) {
+ error_msg("supposed port number wasn't.\n");
+ goto error;
+ }
+ hdfs_fa.namenode_port = (int32_t)k;
+ }
+ if (HDstrncmp(props[2], "", 1)) {
+ HDstrncpy(hdfs_fa.kerberos_ticket_cache, (const char *)props[2], HDstrlen(props[2]));
+ }
+ if (HDstrncmp(props[3], "", 1)) {
+ HDstrncpy(hdfs_fa.user_name, (const char *)props[3], HDstrlen(props[3]));
+ }
+ if (strncmp(props[4], "", 1)) {
+ k = HDstrtoul((const char *)props[4], NULL, 0);
+ if (errno == ERANGE) {
+ error_msg("supposed buffersize number wasn't.\n");
+ goto error;
+ }
+ hdfs_fa.stream_buffer_size = (int32_t)k;
+ }
+ HDfree(props);
+ HDfree(props_src);
+ drivername = "hdfs";
+ }
+ break;
+#endif /* H5_HAVE_LIBHDFS */
+
default:
usage(h5tools_getprogname());
goto error;
@@ -1720,6 +1858,7 @@ main(int argc, const char *argv[])
void *edata;
void *tools_edata;
struct handler_t *hand = NULL;
+ hid_t fapl_id = H5P_DEFAULT;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -1740,6 +1879,42 @@ main(int argc, const char *argv[])
if(parse_command_line(argc, argv, &hand) < 0)
goto done;
+ /* if drivername is not null, probably need to set the fapl */
+ if (HDstrcmp(drivername, "")) {
+ void *conf_fa = NULL;
+
+ if (!HDstrcmp(drivername, "ros3")) {
+#ifndef H5_HAVE_ROS3_VFD
+ error_msg("Read-Only S3 VFD not enabled.\n\n");
+ goto done;
+#else
+ conf_fa = (void *)&ros3_fa;
+#endif /* H5_HAVE_ROS3_VFD */
+
+ }
+ else if (!HDstrcmp(drivername, "hdfs")) {
+#ifndef H5_HAVE_LIBHDFS
+ error_msg("HDFS VFD not enabled.\n\n");
+ goto done;
+#else
+ conf_fa = (void *)&hdfs_fa;
+#endif /* H5_HAVE_LIBHDFS */
+ }
+
+ if (conf_fa != NULL) {
+ HDassert(fapl_id == H5P_DEFAULT);
+ fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ if (fapl_id < 0) {
+ error_msg("Unable to create fapl entry\n");
+ goto done;
+ }
+ if (1 > h5tools_set_configured_fapl(fapl_id, drivername, conf_fa)) {
+ error_msg("Unable to set fapl\n");
+ goto done;
+ }
+ }
+ } /* drivername set */
+
fname = argv[opt_ind];
if(enable_error_stack > 0) {
@@ -1754,7 +1929,7 @@ main(int argc, const char *argv[])
HDprintf("Filename: %s\n", fname);
- fid = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT);
+ fid = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id);
if(fid < 0) {
error_msg("unable to open file \"%s\"\n", fname);
h5tools_setstatus(EXIT_FAILURE);
@@ -1837,6 +2012,13 @@ done:
/* Free iter structure */
iter_free(&iter);
+ if (fapl_id != H5P_DEFAULT) {
+ if (0 < H5Pclose(fapl_id)) {
+ error_msg("unable to close fapl entry\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ }
+
if(fid >= 0 && H5Fclose(fid) < 0) {
error_msg("unable to close file \"%s\"\n", fname);
h5tools_setstatus(EXIT_FAILURE);
diff --git a/tools/test/h5stat/testfiles/h5stat_help1.ddl b/tools/test/h5stat/testfiles/h5stat_help1.ddl
index 01e39af..2ba7772 100644
--- a/tools/test/h5stat/testfiles/h5stat_help1.ddl
+++ b/tools/test/h5stat/testfiles/h5stat_help1.ddl
@@ -23,3 +23,13 @@ Usage: h5stat [OPTIONS] file
-s, --freespace Print free space information
-S, --summary Print summary of file space information
--enable-error-stack Prints messages from the HDF5 error stack as they occur
+ --s3-cred=<cred> Access file on S3, using provided credential
+ <cred> :: (region,id,key)
+ If <cred> == "(,,)", no authentication is used.
+ --hdfs-attrs=<attrs> Access a file on HDFS with given configuration
+ attributes.
+ <attrs> :: (<namenode name>,<namenode port>,
+ <kerberos cache path>,<username>,
+ <buffer size>)
+ If an attribute is empty, a default value will be
+ used.
diff --git a/tools/test/h5stat/testfiles/h5stat_help2.ddl b/tools/test/h5stat/testfiles/h5stat_help2.ddl
index 01e39af..2ba7772 100644
--- a/tools/test/h5stat/testfiles/h5stat_help2.ddl
+++ b/tools/test/h5stat/testfiles/h5stat_help2.ddl
@@ -23,3 +23,13 @@ Usage: h5stat [OPTIONS] file
-s, --freespace Print free space information
-S, --summary Print summary of file space information
--enable-error-stack Prints messages from the HDF5 error stack as they occur
+ --s3-cred=<cred> Access file on S3, using provided credential
+ <cred> :: (region,id,key)
+ If <cred> == "(,,)", no authentication is used.
+ --hdfs-attrs=<attrs> Access a file on HDFS with given configuration
+ attributes.
+ <attrs> :: (<namenode name>,<namenode port>,
+ <kerberos cache path>,<username>,
+ <buffer size>)
+ If an attribute is empty, a default value will be
+ used.
diff --git a/tools/test/h5stat/testfiles/h5stat_nofile.ddl b/tools/test/h5stat/testfiles/h5stat_nofile.ddl
index 01e39af..2ba7772 100644
--- a/tools/test/h5stat/testfiles/h5stat_nofile.ddl
+++ b/tools/test/h5stat/testfiles/h5stat_nofile.ddl
@@ -23,3 +23,13 @@ Usage: h5stat [OPTIONS] file
-s, --freespace Print free space information
-S, --summary Print summary of file space information
--enable-error-stack Prints messages from the HDF5 error stack as they occur
+ --s3-cred=<cred> Access file on S3, using provided credential
+ <cred> :: (region,id,key)
+ If <cred> == "(,,)", no authentication is used.
+ --hdfs-attrs=<attrs> Access a file on HDFS with given configuration
+ attributes.
+ <attrs> :: (<namenode name>,<namenode port>,
+ <kerberos cache path>,<username>,
+ <buffer size>)
+ If an attribute is empty, a default value will be
+ used.
diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt
index 19de76f..95dfc3b 100644
--- a/tools/testfiles/h5dump-help.txt
+++ b/tools/testfiles/h5dump-help.txt
@@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
+ <cred> :: "(<aws-region>,<access-id>,<access-key>)"
+ If absent or <cred> -> "(,,)", no authentication.
+ Has no effect is filedriver is not `ros3'.
+ --hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
+ For use with "--filedriver=hdfs"
+ <attrs> :: (<namenode name>,<namenode port>,
+ <kerberos cache path>,<username>,
+ <buffer size>)
+ Any absent attribute will use a default value.
--------------- Object Options ---------------
-a P, --attribute=P Print the specified attribute
If an attribute name contains a slash (/), escape the
diff --git a/tools/testfiles/help-1.ls b/tools/testfiles/help-1.ls
index 491f696..396bed3 100644
--- a/tools/testfiles/help-1.ls
+++ b/tools/testfiles/help-1.ls
@@ -37,6 +37,15 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
-V, --version Print version number and exit
--vfd=DRIVER Use the specified virtual file driver
-x, --hexdump Show raw data in hexadecimal format
+ --s3-cred=C Supply S3 authentication information to "ros3" vfd.
+ Accepts tuple of "(<aws-region>,<access-id>,<access-key>)".
+ If absent or C->"(,,)", defaults to no-authentication.
+ Has no effect if vfd flag not set to "ros3".
+ --hdfs-attrs=A Supply configuration information to Hadoop VFD.
+ Accepts tuple of (<namenode name>,<namenode port>,
+ ...<kerberos cache path>,<username>,<buffer size>)
+ If absent or A == '(,,,,)', all default values are used.
+ Has no effect if vfd flag is not 'hdfs'.
file/OBJECT
Each object consists of an HDF5 file name optionally followed by a
diff --git a/tools/testfiles/help-2.ls b/tools/testfiles/help-2.ls
index 491f696..396bed3 100644
--- a/tools/testfiles/help-2.ls
+++ b/tools/testfiles/help-2.ls
@@ -37,6 +37,15 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
-V, --version Print version number and exit
--vfd=DRIVER Use the specified virtual file driver
-x, --hexdump Show raw data in hexadecimal format
+ --s3-cred=C Supply S3 authentication information to "ros3" vfd.
+ Accepts tuple of "(<aws-region>,<access-id>,<access-key>)".
+ If absent or C->"(,,)", defaults to no-authentication.
+ Has no effect if vfd flag not set to "ros3".
+ --hdfs-attrs=A Supply configuration information to Hadoop VFD.
+ Accepts tuple of (<namenode name>,<namenode port>,
+ ...<kerberos cache path>,<username>,<buffer size>)
+ If absent or A == '(,,,,)', all default values are used.
+ Has no effect if vfd flag is not 'hdfs'.
file/OBJECT
Each object consists of an HDF5 file name optionally followed by a
diff --git a/tools/testfiles/help-3.ls b/tools/testfiles/help-3.ls
index 491f696..396bed3 100644
--- a/tools/testfiles/help-3.ls
+++ b/tools/testfiles/help-3.ls
@@ -37,6 +37,15 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
-V, --version Print version number and exit
--vfd=DRIVER Use the specified virtual file driver
-x, --hexdump Show raw data in hexadecimal format
+ --s3-cred=C Supply S3 authentication information to "ros3" vfd.
+ Accepts tuple of "(<aws-region>,<access-id>,<access-key>)".
+ If absent or C->"(,,)", defaults to no-authentication.
+ Has no effect if vfd flag not set to "ros3".
+ --hdfs-attrs=A Supply configuration information to Hadoop VFD.
+ Accepts tuple of (<namenode name>,<namenode port>,
+ ...<kerberos cache path>,<username>,<buffer size>)
+ If absent or A == '(,,,,)', all default values are used.
+ Has no effect if vfd flag is not 'hdfs'.
file/OBJECT
Each object consists of an HDF5 file name optionally followed by a
diff --git a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl
index 19de76f..95dfc3b 100644
--- a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl
+++ b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl
@@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
+ <cred> :: "(<aws-region>,<access-id>,<access-key>)"
+ If absent or <cred> -> "(,,)", no authentication.
+ Has no effect is filedriver is not `ros3'.
+ --hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
+ For use with "--filedriver=hdfs"
+ <attrs> :: (<namenode name>,<namenode port>,
+ <kerberos cache path>,<username>,
+ <buffer size>)
+ Any absent attribute will use a default value.
--------------- Object Options ---------------
-a P, --attribute=P Print the specified attribute
If an attribute name contains a slash (/), escape the
diff --git a/tools/testfiles/pbits/tpbitsIncomplete.ddl b/tools/testfiles/pbits/tpbitsIncomplete.ddl
index 19de76f..95dfc3b 100644
--- a/tools/testfiles/pbits/tpbitsIncomplete.ddl
+++ b/tools/testfiles/pbits/tpbitsIncomplete.ddl
@@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
+ <cred> :: "(<aws-region>,<access-id>,<access-key>)"
+ If absent or <cred> -> "(,,)", no authentication.
+ Has no effect is filedriver is not `ros3'.
+ --hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
+ For use with "--filedriver=hdfs"
+ <attrs> :: (<namenode name>,<namenode port>,
+ <kerberos cache path>,<username>,
+ <buffer size>)
+ Any absent attribute will use a default value.
--------------- Object Options ---------------
-a P, --attribute=P Print the specified attribute
If an attribute name contains a slash (/), escape the
diff --git a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl
index 19de76f..95dfc3b 100644
--- a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl
+++ b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl
@@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
+ <cred> :: "(<aws-region>,<access-id>,<access-key>)"
+ If absent or <cred> -> "(,,)", no authentication.
+ Has no effect is filedriver is not `ros3'.
+ --hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
+ For use with "--filedriver=hdfs"
+ <attrs> :: (<namenode name>,<namenode port>,
+ <kerberos cache path>,<username>,
+ <buffer size>)
+ Any absent attribute will use a default value.
--------------- Object Options ---------------
-a P, --attribute=P Print the specified attribute
If an attribute name contains a slash (/), escape the
diff --git a/tools/testfiles/pbits/tpbitsLengthPositive.ddl b/tools/testfiles/pbits/tpbitsLengthPositive.ddl
index 19de76f..95dfc3b 100644
--- a/tools/testfiles/pbits/tpbitsLengthPositive.ddl
+++ b/tools/testfiles/pbits/tpbitsLengthPositive.ddl
@@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
+ <cred> :: "(<aws-region>,<access-id>,<access-key>)"
+ If absent or <cred> -> "(,,)", no authentication.
+ Has no effect is filedriver is not `ros3'.
+ --hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
+ For use with "--filedriver=hdfs"
+ <attrs> :: (<namenode name>,<namenode port>,
+ <kerberos cache path>,<username>,
+ <buffer size>)
+ Any absent attribute will use a default value.
--------------- Object Options ---------------
-a P, --attribute=P Print the specified attribute
If an attribute name contains a slash (/), escape the
diff --git a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl
index 19de76f..95dfc3b 100644
--- a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl
+++ b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl
@@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
+ <cred> :: "(<aws-region>,<access-id>,<access-key>)"
+ If absent or <cred> -> "(,,)", no authentication.
+ Has no effect is filedriver is not `ros3'.
+ --hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
+ For use with "--filedriver=hdfs"
+ <attrs> :: (<namenode name>,<namenode port>,
+ <kerberos cache path>,<username>,
+ <buffer size>)
+ Any absent attribute will use a default value.
--------------- Object Options ---------------
-a P, --attribute=P Print the specified attribute
If an attribute name contains a slash (/), escape the
diff --git a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl
index 19de76f..95dfc3b 100644
--- a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl
+++ b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl
@@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
+ <cred> :: "(<aws-region>,<access-id>,<access-key>)"
+ If absent or <cred> -> "(,,)", no authentication.
+ Has no effect is filedriver is not `ros3'.
+ --hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
+ For use with "--filedriver=hdfs"
+ <attrs> :: (<namenode name>,<namenode port>,
+ <kerberos cache path>,<username>,
+ <buffer size>)
+ Any absent attribute will use a default value.
--------------- Object Options ---------------
-a P, --attribute=P Print the specified attribute
If an attribute name contains a slash (/), escape the
diff --git a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl
index 19de76f..95dfc3b 100644
--- a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl
+++ b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl
@@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
+ <cred> :: "(<aws-region>,<access-id>,<access-key>)"
+ If absent or <cred> -> "(,,)", no authentication.
+ Has no effect is filedriver is not `ros3'.
+ --hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
+ For use with "--filedriver=hdfs"
+ <attrs> :: (<namenode name>,<namenode port>,
+ <kerberos cache path>,<username>,
+ <buffer size>)
+ Any absent attribute will use a default value.
--------------- Object Options ---------------
-a P, --attribute=P Print the specified attribute
If an attribute name contains a slash (/), escape the
diff --git a/tools/testfiles/textlinksrc-nodangle-1.ls b/tools/testfiles/textlinksrc-nodangle-1.ls
index 491f696..396bed3 100644
--- a/tools/testfiles/textlinksrc-nodangle-1.ls
+++ b/tools/testfiles/textlinksrc-nodangle-1.ls
@@ -37,6 +37,15 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
-V, --version Print version number and exit
--vfd=DRIVER Use the specified virtual file driver
-x, --hexdump Show raw data in hexadecimal format
+ --s3-cred=C Supply S3 authentication information to "ros3" vfd.
+ Accepts tuple of "(<aws-region>,<access-id>,<access-key>)".
+ If absent or C->"(,,)", defaults to no-authentication.
+ Has no effect if vfd flag not set to "ros3".
+ --hdfs-attrs=A Supply configuration information to Hadoop VFD.
+ Accepts tuple of (<namenode name>,<namenode port>,
+ ...<kerberos cache path>,<username>,<buffer size>)
+ If absent or A == '(,,,,)', all default values are used.
+ Has no effect if vfd flag is not 'hdfs'.
file/OBJECT
Each object consists of an HDF5 file name optionally followed by a
diff --git a/tools/testfiles/tgroup-1.ls b/tools/testfiles/tgroup-1.ls
index 491f696..396bed3 100644
--- a/tools/testfiles/tgroup-1.ls
+++ b/tools/testfiles/tgroup-1.ls
@@ -37,6 +37,15 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
-V, --version Print version number and exit
--vfd=DRIVER Use the specified virtual file driver
-x, --hexdump Show raw data in hexadecimal format
+ --s3-cred=C Supply S3 authentication information to "ros3" vfd.
+ Accepts tuple of "(<aws-region>,<access-id>,<access-key>)".
+ If absent or C->"(,,)", defaults to no-authentication.
+ Has no effect if vfd flag not set to "ros3".
+ --hdfs-attrs=A Supply configuration information to Hadoop VFD.
+ Accepts tuple of (<namenode name>,<namenode port>,
+ ...<kerberos cache path>,<username>,<buffer size>)
+ If absent or A == '(,,,,)', all default values are used.
+ Has no effect if vfd flag is not 'hdfs'.
file/OBJECT
Each object consists of an HDF5 file name optionally followed by a