summaryrefslogtreecommitdiffstats
path: root/tools/src/h5dump
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2019-12-24 21:12:08 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2019-12-24 21:12:08 (GMT)
commit5b9cf732caab9daa6ed1e00f2df4f5a792340196 (patch)
tree4c01c9bd71ba5e7d8d11b474f6896e6ffbf0416d /tools/src/h5dump
parent646fc294078f560fc9bef784cb1c4e27cdc51f5b (diff)
parente0fa36bfe008c03365ce8ea94d705f8fdebccdf0 (diff)
downloadhdf5-5b9cf732caab9daa6ed1e00f2df4f5a792340196.zip
hdf5-5b9cf732caab9daa6ed1e00f2df4f5a792340196.tar.gz
hdf5-5b9cf732caab9daa6ed1e00f2df4f5a792340196.tar.bz2
Merge pull request #2203 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:1.10/master to 1.10/masterhdf5-1_10_6
* commit 'e0fa36bfe008c03365ce8ea94d705f8fdebccdf0': (166 commits) Update release date strings in README.txt and release_docs/RELEASE.txt Add release note about using ompio instead of romio when collective writes fail with OpenMPI. Fixed typos, grammatical errors, etc. Expanded entry for S3 and HDFS VFDs. Moved Mac 10.11 and 10.12 from Supported Platforms to More Platforms Tested. Add qualification to RELEASE.txt regarding performance improvements Standalone doesn't use h5test implementation. Add missing note Update COPYING file with new HDF5 license. Update bin/config.guess and config.sub to current version available from git.savannah.gnu.org. Fix include to correct memory calls - big-endian issue. Revert BLDLIBDIR value in junit.sh.in. Corrections to CMake functions Update version for HDF5 1.10.6 release. Remove autom4te.cache directory that shouldn't have been added. Remove duplicate instance Fix merge issue HDFFV-10979 - fix global name clash Correct clang search and java include Latest date first in RELEASE.txt Update RELEASE.txt with performance improvements and Steven Varga's bugfix. Update version numbers for shared lib files according to api compatibility report. Created hdf5_1_10_6 branch for HDF5 1.10.6 release preparation. Set version to 1.10.6-pre1. Switched default maintainer mode to disabled and default build mode to production. Added files produced by autogen.sh to commit except for src/H5config.h.in~ and src/H5public.h~. ...
Diffstat (limited to 'tools/src/h5dump')
-rw-r--r--tools/src/h5dump/CMakeLists.txt26
-rw-r--r--tools/src/h5dump/Makefile.in9
-rw-r--r--tools/src/h5dump/h5dump.c469
-rw-r--r--tools/src/h5dump/h5dump_ddl.c12
-rw-r--r--tools/src/h5dump/h5dump_xml.c14
5 files changed, 249 insertions, 281 deletions
diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt
index 25166c7..383b04e 100644
--- a/tools/src/h5dump/CMakeLists.txt
+++ b/tools/src/h5dump/CMakeLists.txt
@@ -4,18 +4,20 @@ project (HDF5_TOOLS_SRC_H5DUMP C)
# --------------------------------------------------------------------
# Add the h5dump executables
# --------------------------------------------------------------------
-add_executable (h5dump
- ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c
- ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c
- ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c
-)
-target_include_directories(h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5dump STATIC)
-target_link_libraries (h5dump PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
-set_target_properties (h5dump PROPERTIES FOLDER tools)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump")
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h5dump
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c
+ )
+ target_include_directories (h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5dump STATIC)
+ target_link_libraries (h5dump PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (h5dump PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump")
-set (H5_DEP_EXECUTABLES h5dump)
+ set (H5_DEP_EXECUTABLES h5dump)
+endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5dump-shared
@@ -23,7 +25,7 @@ if (BUILD_SHARED_LIBS)
${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c
${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c
)
- target_include_directories(h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5dump-shared SHARED)
target_link_libraries (h5dump-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5dump-shared PROPERTIES FOLDER tools)
diff --git a/tools/src/h5dump/Makefile.in b/tools/src/h5dump/Makefile.in
index 30d0b02..3bca706 100644
--- a/tools/src/h5dump/Makefile.in
+++ b/tools/src/h5dump/Makefile.in
@@ -485,7 +485,6 @@ FC_VERSION = @FC_VERSION@
FGREP = @FGREP@
FORTRAN_C_LONG_DOUBLE_IS_UNIQUE = @FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@
FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@
-FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@
FSEARCH_DIRS = @FSEARCH_DIRS@
Fortran_COMPILER_ID = @Fortran_COMPILER_ID@
GREP = @GREP@
@@ -508,9 +507,12 @@ H5_VERSION = @H5_VERSION@
HADDR_T = @HADDR_T@
HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
+HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
HDF5_HL = @HDF5_HL@
HDF5_INTERFACES = @HDF5_INTERFACES@
+HDF5_TESTS = @HDF5_TESTS@
+HDF5_TOOLS = @HDF5_TOOLS@
HDF_CXX = @HDF_CXX@
HDF_FORTRAN = @HDF_FORTRAN@
HDF_JAVA = @HDF_JAVA@
@@ -537,6 +539,7 @@ JAVA_JUNIT = @JAVA_JUNIT@
JAVA_PATH_NAME = @JAVA_PATH_NAME@
JAVA_VERSION = @JAVA_VERSION@
JNIFLAGS = @JNIFLAGS@
+JNI_LDFLAGS = @JNI_LDFLAGS@
JUNIT = @JUNIT@
LARGE_PARALLEL_IO = @LARGE_PARALLEL_IO@
LD = @LD@
@@ -591,6 +594,7 @@ PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
+ROS3_VFD = @ROS3_VFD@
RUNPARALLEL = @RUNPARALLEL@
RUNSERIAL = @RUNSERIAL@
R_INTEGER = @R_INTEGER@
@@ -615,7 +619,6 @@ UNAME_INFO = @UNAME_INFO@
USE_FILTER_DEFLATE = @USE_FILTER_DEFLATE@
USE_FILTER_SZIP = @USE_FILTER_SZIP@
USINGMEMCHECKER = @USINGMEMCHECKER@
-UUDECODE = @UUDECODE@
VERSION = @VERSION@
WORDS_BIGENDIAN = @WORDS_BIGENDIAN@
_ACJNI_JAVAC = @_ACJNI_JAVAC@
@@ -1294,7 +1297,7 @@ all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
# make install-doc doesn't do anything outside of doc directory, but
# Makefiles should recognize it.
# UPDATE: docs no longer reside in this build tree, so this target
-# is depreciated.
+# is deprecated.
install-doc uninstall-doc:
@echo "Nothing to be done."
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index b9e37e8..19ed013 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' }
};
@@ -198,12 +221,6 @@ static struct long_options l_opts[] = {
* Purpose: Shutdown MPI & HDF5 and call exit()
*
* Return: Does not return
- *
- * Programmer: Quincey Koziol
- * Saturday, 31. January 2004
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -241,6 +258,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");
@@ -368,17 +395,11 @@ usage(const char *prog)
/*-------------------------------------------------------------------------
- * Function: table_list_add
- *
- * Purpose: Add a new set of tables
- *
- * Return: index of added table on success, -1 on failure
- *
- * Programmer: Neil Fortner, nfortne2@hdfgroup.org
- * Adapted from trav_addr_add in h5trav.c by Quincey Koziol
+ * Function: table_list_add
*
- * Date: October 13, 2008
+ * Purpose: Add a new set of tables
*
+ * Return: index of added table on success, -1 on failure
*-------------------------------------------------------------------------
*/
ssize_t
@@ -405,8 +426,7 @@ table_list_add(hid_t oid, unsigned long file_no)
table_list.nused--;
return -1;
}
- if(init_objs(oid, &info, &table_list.tables[idx].group_table,
- &table_list.tables[idx].dset_table, &table_list.tables[idx].type_table) < 0) {
+ if(init_objs(oid, &info, &table_list.tables[idx].group_table, &table_list.tables[idx].dset_table, &table_list.tables[idx].type_table) < 0) {
H5Idec_ref(oid);
table_list.nused--;
return -1;
@@ -421,17 +441,11 @@ table_list_add(hid_t oid, unsigned long file_no)
/*-------------------------------------------------------------------------
- * Function: table_list_visited
+ * Function: table_list_visited
*
- * Purpose: Check if a table already exists for the specified fileno
- *
- * Return: The index of the matching table, or -1 if no matches found
- *
- * Programmer: Neil Fortner, nfortne2@hdfgroup.org
- * Adapted from trav_addr_visited in h5trav.c by Quincey Koziol
- *
- * Date: October 13, 2008
+ * Purpose: Check if a table already exists for the specified fileno
*
+ * Return: The index of the matching table, or -1 if no matches found
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE ssize_t
@@ -451,16 +465,11 @@ table_list_visited(unsigned long file_no)
/*-------------------------------------------------------------------------
- * Function: table_list_free
- *
- * Purpose: Frees the table list
- *
- * Return: void
+ * Function: table_list_free
*
- * Programmer: Neil Fortner, nfortne2@hdfgroup.org
- *
- * Date: October 13, 2008
+ * Purpose: Frees the table list
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void
@@ -492,16 +501,10 @@ table_list_free(void)
/*-------------------------------------------------------------------------
* Function: set_binary_form
*
- * Purpose: set the binary form of output by translating from a string input
- * parameter to a integer return value
- *
- * Return: integer form of binary output or -1 if none found
- *
- * Programmer: Pedro Vicente Nunes
- * June 28, 2006
- *
- * Modifications:
+ * Purpose: set the binary form of output by translating from a string input
+ * parameter to a integer return value
*
+ * Return: integer form of binary output or -1 if none found
*-------------------------------------------------------------------------
*/
static int
@@ -526,17 +529,11 @@ set_binary_form(const char *form)
/*-------------------------------------------------------------------------
* Function: set_sort_by
*
- * Purpose: set the "by" form of sorting by translating from a string input
- * parameter to a H5_index_t return value
- * current sort values are [creation_order | name]
- *
- * Return: H5_index_t form of sort or H5_INDEX_UNKNOWN if none found
- *
- * Programmer: Pedro Vicente Nunes
- * October 1, 2007
- *
- * Modifications:
+ * Purpose: set the "by" form of sorting by translating from a string input
+ * parameter to a H5_index_t return value
+ * current sort values are [creation_order | name]
*
+ * Return: H5_index_t form of sort or H5_INDEX_UNKNOWN if none found
*-------------------------------------------------------------------------
*/
static H5_index_t
@@ -555,17 +552,11 @@ set_sort_by(const char *form)
/*-------------------------------------------------------------------------
* Function: set_sort_order
*
- * Purpose: set the order of sorting by translating from a string input
- * parameter to a H5_iter_order_t return value
- * current order values are [ascending | descending ]
- *
- * Return: H5_iter_order_t form of order or H5_ITER_UNKNOWN if none found
- *
- * Programmer: Pedro Vicente Nunes
- * October 1, 2007
- *
- * Modifications:
+ * Purpose: set the order of sorting by translating from a string input
+ * parameter to a H5_iter_order_t return value
+ * current order values are [ascending | descending ]
*
+ * Return: H5_iter_order_t form of order or H5_ITER_UNKNOWN if none found
*-------------------------------------------------------------------------
*/
static H5_iter_order_t
@@ -594,10 +585,6 @@ set_sort_order(const char *form)
* either commas (,) or white spaces.
*
* Return: <none>
- *
- * Programmer: Bill Wendling
- * Tuesday, 6. February 2001
- *
*-------------------------------------------------------------------------
*/
static void
@@ -652,12 +639,6 @@ parse_hsize_list(const char *h_list, subset_d *d)
*
* Return: Success: struct subset_t object
* Failure: NULL
- *
- * Programmer: Bill Wendling
- * Tuesday, 6. February 2001
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static struct subset_t *
@@ -675,21 +656,24 @@ parse_subset_params(char *dset)
while (*brace && *brace != ';')
brace++;
- if (*brace) brace++;
+ if (*brace)
+ brace++;
parse_hsize_list(brace, &s->stride);
while (*brace && *brace != ';')
brace++;
- if (*brace) brace++;
+ if (*brace)
+ brace++;
parse_hsize_list(brace, &s->count);
while (*brace && *brace != ';')
brace++;
- if (*brace) brace++;
+ if (*brace)
+ brace++;
parse_hsize_list(brace, &s->block);
}
@@ -705,9 +689,7 @@ parse_subset_params(char *dset)
* should be at the start of the list you want to parse.
*
* Return: Success: SUCCEED
- *
* Failure: FAIL
- *
*-------------------------------------------------------------------------
*/
static int
@@ -826,12 +808,6 @@ parse_mask_list(const char *h_list)
* to free
*
* Return: Nothing
- *
- * Programmer: Bill Wendling
- * Tuesday, 20. February 2001
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -874,15 +850,7 @@ free_handler(struct handler_t *hand, int len)
* Return: Success: A pointer to an array of handler_t structures.
* These contain all the information needed to dump
* the necessary object.
- *
* Failure: Exits program with EXIT_FAILURE value.
- *
- * Programmer: Bill Wendling
- * Tuesday, 20. February 2001
- *
- * Modifications:
- * pvn June, 1, 2006. Add a switch for binary output
- *
*-------------------------------------------------------------------------
*/
static struct handler_t *
@@ -1282,6 +1250,110 @@ 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());
@@ -1317,36 +1389,6 @@ error:
*
* Return: Success: 0
* Failure: 1
- *
- * Programmer: Ruey-Hsia Li
- *
- * Modifications:
- * Albert Cheng
- * 30. September 2000
- * Add the -o option--output file for datasets raw data
- *
- * REMcG
- * November 2000
- * Changes to support XML.
- *
- * Bill Wendling
- * Wednesday, 10. January 2001
- * Modified the way command line parameters are interpreted. They go
- * through one function call now (get_option).
- *
- * Bill Wendling
- * Tuesday, 20. February 2001
- * Moved command line parsing to separate function. Made various
- * "display_*" flags global.
- *
- * REMcG
- * August 2003
- * Major upgrade to XML support.
- *
- * Pedro Vicente
- * September 2007
- * list objects in requested order (creation order or alphabetically)
- *
*-------------------------------------------------------------------------
*/
int
@@ -1354,6 +1396,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;
@@ -1399,8 +1442,7 @@ main(int argc, const char *argv[])
/* Check for conflicting options */
if (doxml) {
if (!display_all) {
- error_msg("option \"%s\" not available for XML\n",
- "to display selected objects");
+ error_msg("option \"%s\" not available for XML\n", "to display selected objects");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
@@ -1440,10 +1482,54 @@ 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;
+ }
+ /* driver guaranteed "ros3" or "hdfs" */
+ /* conf_fa appropriate to driver */
+ if (0 == h5tools_set_configured_fapl(fapl_id, driver, conf_fa)) {
+ 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);
@@ -1515,8 +1601,7 @@ main(int argc, const char *argv[])
/* alternative first element, depending on schema or DTD. */
if (useschema) {
if (HDstrcmp(xmlnsprefix,"") == 0) {
- PRINTSTREAM(rawoutstream, "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"%s\">\n",
- xml_dtd_uri);
+ PRINTSTREAM(rawoutstream, "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"%s\">\n", xml_dtd_uri);
}
else {
/* TO DO: make -url option work in this case (may need new option) */
@@ -1525,7 +1610,8 @@ main(int argc, const char *argv[])
ns = HDstrdup(xmlnsprefix);
indx = HDstrrchr(ns,(int)':');
- if (indx) *indx = '\0';
+ if (indx)
+ *indx = '\0';
PRINTSTREAM(rawoutstream, "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\" "
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
@@ -1624,6 +1710,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 +1736,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;
- sprintf(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/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c
index 5c47abd..4fb8398 100644
--- a/tools/src/h5dump/h5dump_ddl.c
+++ b/tools/src/h5dump/h5dump_ddl.c
@@ -864,7 +864,7 @@ dump_group(hid_t gid, const char *name)
if(!type_table->objs[u].recorded) {
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -1941,9 +1941,6 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT
break;
case H5L_TYPE_EXTERNAL:
- begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin);
- PRINTVALSTREAM(rawoutstream, "\n");
- indentation(COL);
begin_obj(h5tools_dump_header_format->extlinkbegin, links, h5tools_dump_header_format->extlinkblockbegin);
PRINTVALSTREAM(rawoutstream, "\n");
if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
@@ -1952,8 +1949,6 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT
if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &elink_file, &elink_path)>=0) {
indentation(COL);
- PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type);
- indentation(COL);
PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file);
indentation(COL);
PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path);
@@ -1977,9 +1972,6 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT
begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin);
PRINTVALSTREAM(rawoutstream, "\n");
indentation(COL);
- begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin);
- PRINTVALSTREAM(rawoutstream, "\n");
- indentation(COL);
PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type);
end_obj(h5tools_dump_header_format->udlinkend, h5tools_dump_header_format->udlinkblockend);
break;
@@ -2022,7 +2014,7 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe
if(!type_table->objs[idx].recorded) {
/* unamed datatype */
- sprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno);
+ HDsprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno);
if(!HDstrcmp(name, real_name))
break;
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index ec76511..fdbdd40 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -587,7 +587,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
if (objno == HADDR_UNDEF) {
if (gen) {
objno = ref_path_table_gen_fake(str);
- sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
return 0;
}
else {
@@ -598,7 +598,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
else {
if (gen) {
objno = ref_path_table_gen_fake(str);
- sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
return 0;
}
else {
@@ -607,7 +607,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
}
}
- sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
return(0);
}
@@ -2685,7 +2685,7 @@ xml_dump_group(hid_t gid, const char *name)
if(!type_table->objs[u].recorded) {
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -2767,7 +2767,7 @@ xml_dump_group(hid_t gid, const char *name)
if(!type_table->objs[u].recorded) {
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -2881,7 +2881,7 @@ xml_print_refs(hid_t did, int source)
goto error;
}
- refbuf = (hobj_ref_t *) buf;
+ refbuf = (hobj_ref_t *)((void *)buf);
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -3057,7 +3057,7 @@ xml_print_strs(hid_t did, int source)
for (i = 0; i < (hsize_t)ssiz; i++) {
if (is_vlstr) {
- onestring = *(char **) bp;
+ onestring = *(char **)((void *)bp);
if (onestring)
str_size = HDstrlen(onestring);
}