summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2019-08-19 02:36:06 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2019-08-19 02:36:06 (GMT)
commit798c580fc34675011e94df77e1b876b7285fd327 (patch)
tree67ca7eb8687bf008660d8a2fce0974805b0586f7
parente96815ebd83748a4886bf8ef2e80e82df16b9740 (diff)
parentdcf084aff42d3abafaa82b356493a2d1585afb85 (diff)
downloadhdf5-798c580fc34675011e94df77e1b876b7285fd327.zip
hdf5-798c580fc34675011e94df77e1b876b7285fd327.tar.gz
hdf5-798c580fc34675011e94df77e1b876b7285fd327.tar.bz2
Merge pull request #18 in ~VCHOI/my_third_fork from develop to bugfix/HDFFV-10585-investigate-slowness-of-regular
* commit 'dcf084aff42d3abafaa82b356493a2d1585afb85': (25 commits) Changes based on PR feedback. Correct name of folder Mostly whitespace in testpar, addl changes for tmp dir Whitespace cleanup Added public H5Sselect_adjust_u and H5Shyper_adjust_s calls. Some refactoring prior to implementing new H5P MPI functions. * Macro cleanup and obvious warning fixes in parallel code. * Moved H5FD comm and info dup/free wrapper code to a new H5mpi.c file and separated it to deal with each MPI type separately. Fix compiler warnings with diabled ROS3 and HDFS VFDs. Fix misuse of [HD]strncpy and [HD]snprintf. Minor formatting changes. Fix test cleanup issue with java groups example. Changed the directory name left out from the previous commit. Changed the name of the temporary directory from 'tmp' to a special name to avoid possible conflicts. Fix H5F_get_file_id and H5F__get_file_id to take app_ref parameter HDFFV-10879 fix test varname Fix for HDFFV-10813 H5Fset_metadata_read_retry_info() test fails on jelly with PGI/19. Added map API build status to libhdf5.settings. Updated h5trav.c to emit output that doesn't require ddl changes for map support. HDFFV-10879 set default API version Fixed Map API CMake option Renamed H5Mdelete_key to H5Mdelete and H5Mset to H5Mput. Remove old code Correct error test spelling and use Added ifdef for intel compilers, __GNUC__ has to be defined for header files which use it to work with intel compilers. This gives a warning for intel compiler about fallthrough, so added a check not to include fallthrough if using intel compilers. ...
-rw-r--r--CMakeLists.txt32
-rw-r--r--MANIFEST8
-rwxr-xr-xbin/trace1
-rw-r--r--config/cmake/H5pubconf.h.in3
-rw-r--r--configure.ac26
-rw-r--r--java/examples/groups/JavaGroupExample.sh.in14
-rw-r--r--release_docs/INSTALL_CMake.txt17
-rw-r--r--release_docs/RELEASE.txt30
-rw-r--r--src/CMakeLists.txt17
-rw-r--r--src/H5.c3
-rw-r--r--src/H5ACmpio.c6
-rw-r--r--src/H5FDhdfs.c484
-rw-r--r--src/H5FDmpi.c109
-rw-r--r--src/H5FDmpio.c637
-rw-r--r--src/H5FDprivate.h3
-rw-r--r--src/H5FDros3.c392
-rw-r--r--src/H5FDs3comms.c863
-rw-r--r--src/H5FDs3comms.h2
-rw-r--r--src/H5Fint.c22
-rw-r--r--src/H5Fmpi.c86
-rw-r--r--src/H5Fpkg.h2
-rw-r--r--src/H5Fprivate.h2
-rw-r--r--src/H5Gdeprec.c3
-rw-r--r--src/H5Gloc.c3
-rw-r--r--src/H5Gname.c6
-rw-r--r--src/H5Gtest.c3
-rw-r--r--src/H5I.c7
-rw-r--r--src/H5Ipublic.h1
-rw-r--r--src/H5M.c1032
-rw-r--r--src/H5Mmodule.h31
-rw-r--r--src/H5Mpkg.h51
-rw-r--r--src/H5Mprivate.h80
-rw-r--r--src/H5Mpublic.h126
-rw-r--r--src/H5O.c1
-rw-r--r--src/H5Oflush.c3
-rw-r--r--src/H5Oint.c3
-rw-r--r--src/H5Opublic.h1
-rw-r--r--src/H5Pencdec.c2
-rw-r--r--src/H5Pint.c34
-rw-r--r--src/H5Pmapl.c217
-rw-r--r--src/H5Pmcpl.c115
-rw-r--r--src/H5Pprivate.h5
-rw-r--r--src/H5Ppublic.h14
-rw-r--r--src/H5Rint.c3
-rw-r--r--src/H5Shyper.c41
-rw-r--r--src/H5Spublic.h2
-rw-r--r--src/H5Sselect.c39
-rw-r--r--src/H5T.c1
-rw-r--r--src/H5VLcallback.c111
-rw-r--r--src/H5VLconnector.h2
-rw-r--r--src/H5VLint.c4
-rw-r--r--src/H5VLnative_file.c3
-rw-r--r--src/H5VLprivate.h3
-rw-r--r--src/H5err.txt1
-rw-r--r--src/H5mpi.c198
-rw-r--r--src/H5private.h13
-rw-r--r--src/H5trace.c14
-rw-r--r--src/Makefile.am10
-rw-r--r--src/hdf5.h1
-rw-r--r--src/libhdf5.settings.in1
-rw-r--r--test/CMakeTests.cmake48
-rw-r--r--test/Makefile.am3
-rw-r--r--test/err_compat.c196
-rw-r--r--test/hdfs.c443
-rw-r--r--test/links.c204
-rw-r--r--test/links_env.c78
-rw-r--r--test/objcopy.c11
-rw-r--r--test/ros3.c170
-rw-r--r--test/s3comms.c215
-rw-r--r--test/testfiles/err_compat_22
-rw-r--r--test/testfiles/error_test_22
-rw-r--r--test/testlinks_env.sh.in12
-rw-r--r--test/testvds_env.sh.in8
-rw-r--r--test/tfile.c3
-rw-r--r--test/vds.c2
-rw-r--r--test/vds_env.c2
-rw-r--r--testpar/t_chunk_alloc.c159
-rw-r--r--testpar/testphdf5.c366
-rw-r--r--tools/lib/h5tools_str.c1
-rw-r--r--tools/lib/h5tools_utils.c1
-rw-r--r--tools/lib/h5trav.c1
-rw-r--r--tools/src/h5dump/h5dump.c4
-rw-r--r--tools/src/h5dump/h5dump_ddl.c3
-rw-r--r--tools/src/h5dump/h5dump_xml.c1
-rw-r--r--tools/src/h5ls/h5ls.c4
-rw-r--r--tools/src/h5stat/h5stat.c9
-rw-r--r--tools/test/perform/perf.c12
-rw-r--r--tools/test/perform/sio_engine.c12
-rw-r--r--tools/test/perform/sio_perf.c2
89 files changed, 4665 insertions, 2253 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dc6a94f..a9a759f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -642,45 +642,42 @@ if (H5_HAVE_PARALLEL)
endif ()
endif ()
-set (DEFAULT_API_VERSION "v110")
+#option (DEFAULT_API_VERSION "Enable v1.12 API (v16, v18, v110, v112)" "v112")
+set (DEFAULT_API_VERSION "v112" CACHE STRING "Enable v1.12 API (v16, v18, v110, v112)")
+set_property (CACHE DEFAULT_API_VERSION PROPERTY STRINGS v16 v18 v110 v112)
#-----------------------------------------------------------------------------
# Option to use 1.6.x API
#-----------------------------------------------------------------------------
-option (HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF)
set (H5_USE_16_API_DEFAULT 0)
-if (HDF5_USE_16_API_DEFAULT)
+if (DEFAULT_API_VERSION MATCHES "v16")
set (H5_USE_16_API_DEFAULT 1)
- set (DEFAULT_API_VERSION "v16")
endif ()
#-----------------------------------------------------------------------------
# Option to use 1.8.x API
#-----------------------------------------------------------------------------
-option (HDF5_USE_18_API_DEFAULT "Use the HDF5 1.8.x API by default" OFF)
set (H5_USE_18_API_DEFAULT 0)
-if (HDF5_USE_18_API_DEFAULT)
+if (DEFAULT_API_VERSION MATCHES "v18")
set (H5_USE_18_API_DEFAULT 1)
- set (DEFAULT_API_VERSION "v18")
endif ()
#-----------------------------------------------------------------------------
# Option to use 1.10.x API
#-----------------------------------------------------------------------------
-option (HDF5_USE_110_API_DEFAULT "Use the HDF5 1.10.x API by default" OFF)
set (H5_USE_110_API_DEFAULT 0)
-if (HDF5_USE_110_API_DEFAULT)
+if (DEFAULT_API_VERSION MATCHES "v110")
set (H5_USE_110_API_DEFAULT 1)
- set (DEFAULT_API_VERSION "v110")
endif ()
#-----------------------------------------------------------------------------
# Option to use 1.12.x API
#-----------------------------------------------------------------------------
-option (HDF5_USE_112_API_DEFAULT "Use the HDF5 1.12.x API by default" ON)
+if (NOT DEFAULT_API_VERSION)
+ set (DEFAULT_API_VERSION "v112")
+endif ()
set (H5_USE_112_API_DEFAULT 0)
-if (HDF5_USE_112_API_DEFAULT)
+if (DEFAULT_API_VERSION MATCHES "v112")
set (H5_USE_112_API_DEFAULT 1)
- set (DEFAULT_API_VERSION "v112")
endif ()
#-----------------------------------------------------------------------------
@@ -709,6 +706,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED)
endif ()
endif ()
endif ()
+
#-----------------------------------------------------------------------------
# Option to use threadsafe
#-----------------------------------------------------------------------------
@@ -763,6 +761,14 @@ if (HDF5_ENABLE_THREADSAFE)
endif ()
#-----------------------------------------------------------------------------
+# Option to build the map API
+#-----------------------------------------------------------------------------
+option (HDF5_ENABLE_MAP_API "Build the map API" OFF)
+if (HDF5_ENABLE_MAP_API)
+ set (H5_HAVE_MAP_API 1)
+endif ()
+
+#-----------------------------------------------------------------------------
# Add the HDF5 Library Target to the build
#-----------------------------------------------------------------------------
add_subdirectory (src)
diff --git a/MANIFEST b/MANIFEST
index 83c03a5..1232411 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -481,6 +481,7 @@
./src/H5err.txt
./src/H5detect.c
./src/H5make_libsettings.c
+./src/H5mpi.c
./src/H5overflow.txt
./src/H5private.h
./src/H5public.h
@@ -749,6 +750,11 @@
./src/H5Lpkg.h
./src/H5Lprivate.h
./src/H5Lpublic.h
+./src/H5M.c
+./src/H5Mmodule.h
+./src/H5Mpkg.h
+./src/H5Mprivate.h
+./src/H5Mpublic.h
./src/H5MF.c
./src/H5MFaggr.c
./src/H5MFdbg.c
@@ -820,6 +826,8 @@
./src/H5Pint.c
./src/H5Plapl.c
./src/H5Plcpl.c
+./src/H5Pmapl.c
+./src/H5Pmcpl.c
./src/H5Pmodule.h
./src/H5Pocpl.c
./src/H5Pocpypl.c
diff --git a/bin/trace b/bin/trace
index 241c69c..54b6f8f 100755
--- a/bin/trace
+++ b/bin/trace
@@ -150,6 +150,7 @@ $Source = "";
"H5L_class_t" => "x",
"H5L_elink_traverse_t" => "x",
"H5L_iterate_t" => "x",
+ "H5M_iterate_t" => 'x',
"H5MM_allocate_t" => "x",
"H5MM_free_t" => "x",
"H5O_info_t" => "x",
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in
index cb05974..120c023 100644
--- a/config/cmake/H5pubconf.h.in
+++ b/config/cmake/H5pubconf.h.in
@@ -267,6 +267,9 @@
/* Define to 1 if you have the <mach/mach_time.h> header file. */
#cmakedefine H5_HAVE_MACH_MACH_TIME_H @H5_HAVE_MACH_MACH_TIME_H@
+/* Define if the map API (H5M) should be compiled */
+#cmakedefine H5_HAVE_MAP_API @H5_HAVE_MAP_API@
+
/* Define to 1 if you have the <memory.h> header file. */
#cmakedefine H5_HAVE_MEMORY_H @H5_HAVE_MEMORY_H@
diff --git a/configure.ac b/configure.ac
index 3d6ab10..7f1f0dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2766,6 +2766,32 @@ if test -n "$PARALLEL"; then
fi
## ----------------------------------------------------------------------
+## Check if the map API is enabled by --enable-map-api
+##
+AC_SUBST([MAP_API])
+
+## Default is no map API
+MAP_API=no
+
+AC_MSG_CHECKING([if the map API (H5M) is enabled])
+
+AC_ARG_ENABLE([map-api],
+ [AS_HELP_STRING([--enable-map-api],
+ [Build the map API (H5M).
+ This is not yet supported in the native file format
+ and requires a VOL connector that supports it.
+ [default=no]])],
+ [MAP_API=$enableval], [MAP_API=no])
+
+if test "X$MAP_API" = "Xyes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_MAP_API], [1],
+ [Define if the map API (H5M) should be compiled])
+else
+ AC_MSG_RESULT([no])
+fi
+
+## ----------------------------------------------------------------------
## Check if Direct I/O driver is enabled by --enable-direct-vfd
##
AC_SUBST([DIRECT_VFD])
diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in
index 9d4673f..acc606f 100644
--- a/java/examples/groups/JavaGroupExample.sh.in
+++ b/java/examples/groups/JavaGroupExample.sh.in
@@ -179,17 +179,9 @@ COPY_DATAFILES_TO_BLDDIR()
CLEAN_DATAFILES_AND_BLDDIR()
{
- $RM $BLDDIR/examples.groups.H5Ex_G_*.txt
- $RM $BLDDIR/H5Ex_G_*.out
- $RM $BLDDIR/H5Ex_G_*.h5
- $RM $BLDDIR/h5ex_g_*.h5
- SDIR=`$DIRNAME $tstfile`
- INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
- INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'`
- if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then SDIR=`$DIRNAME $tstfile`
- $RM $BLDDIR/h5ex_g_iterate.h5
- $RM $BLDDIR/h5ex_g_visit.h5
- fi
+ $RM $BLDDIR/examples.groups.H5Ex_G_*.txt
+ $RM $BLDDIR/H5Ex_G_*.out
+ $RM $BLDDIR/H5Ex_G_*.h5
}
COPY_ITERFILES="$LIST_ITER_FILES"
diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt
index 4bba5e8..49fef76 100644
--- a/release_docs/INSTALL_CMake.txt
+++ b/release_docs/INSTALL_CMake.txt
@@ -652,10 +652,7 @@ HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks"
HDF_TEST_EXPRESS "Control testing framework (0-3)" "0"
HDF5_TEST_VFD "Execute tests with different VFDs" OFF
HDF5_TEST_PASSTHROUGH_VOL "Execute tests with different passthrough VOL connectors" OFF
-HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF
-HDF5_USE_18_API_DEFAULT "Use the HDF5 1.8.x API by default" OFF
-HDF5_USE_110_API_DEFAULT "Use the HDF5 1.10.x API by default" OFF
-HDF5_USE_112_API_DEFAULT "Use the HDF5 1.12.x API by default" ON
+DEFAULT_API_VERSION "Enable default API (v16, v18, v110, v112)" "v112"
HDF5_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON
HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON
HDF5_WANT_DCONV_EXCEPTION "exception handling functions is checked during data conversions" ON
@@ -668,13 +665,13 @@ if (HDF5_TEST_VFD)
HDF5_TEST_FHEAP_VFD "Execute fheap test with different VFDs" ON
---------------- External Library Options ---------------------
-HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building" "NO"
-HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF
-HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" OFF
-ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 0
-SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 0
+HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO"
+HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF
+HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" OFF
+ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 0
+SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 0
if (HDF5_ENABLE_SZIP_SUPPORT)
- HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF
+ HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF
if (WINDOWS)
H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%/hdf5/lib/plugin"
else ()
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index b4fa11c..b940095 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -191,6 +191,11 @@ New Features
Library:
--------
+ - Add new API H5M for map objects. Currently not supported by native
+ library, can be supported by VOL connectors.
+
+ (NAF - 2019/03/01)
+
- Improved the performance of virtual dataset I/O
Refactored the internal dataspace routines used by the virtual dataset
@@ -321,6 +326,23 @@ Bug Fixes since HDF5-1.10.3 release
Library
-------
+ - Fixed the test failure from test_metadata_read_retry_info() in
+ test/swmr.c
+
+ The test failure is due to the incorrect number of bins returned for
+ retry info (info.nbins). The # of bins expected for 101 read attempts
+ is 3 instead of 2. The routine H5F_set_retries() in src/H5Fint.c
+ calculates the # of bins by first obtaining the log10 value for
+ (read attempts - 1). For PGI/19, the log10 value for 100 read attempts
+ is 1.9999999999999998 instead of 2.00000. When casting the log10 value
+ to unsigned later on, the decimal part is chopped off causing the test
+ failure.
+
+ This was fixed by obtaining the rounded integer value (HDceil) for the
+ log10 value of read attempts first before casting the result to unsigned.
+
+ (VC - 2019/8/14, HDFFV-10813)
+
- Fixed an issue where creating a file with non-default file space info
together with library high bound setting to H5F_LIBVER_V18.
@@ -492,7 +514,13 @@ Bug Fixes since HDF5-1.10.3 release
Configuration
-------------
- -
+ - Correct option for default API version
+
+ CMake options for default API version are not mutually exclusive.
+ Change the multiple BOOL options to a single STRING option with the
+ strings; v16, v18, v110, v112.
+
+ (ADB - 2019/08/12, HDFFV-10879)
Performance
-------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2b693bd..313d231 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -8,6 +8,7 @@ set (H5_SOURCES
${HDF5_SRC_DIR}/H5.c
${HDF5_SRC_DIR}/H5checksum.c
${HDF5_SRC_DIR}/H5dbg.c
+ ${HDF5_SRC_DIR}/H5mpi.c
${HDF5_SRC_DIR}/H5system.c
${HDF5_SRC_DIR}/H5timer.c
${HDF5_SRC_DIR}/H5trace.c
@@ -393,6 +394,15 @@ set (H5L_HDRS
IDE_GENERATED_PROPERTIES ("H5L" "${H5L_HDRS}" "${H5L_SOURCES}" )
+set (H5M_SOURCES
+ ${HDF5_SRC_DIR}/H5M.c
+)
+set (H5M_HDRS
+ ${HDF5_SRC_DIR}/H5Mpublic.h
+)
+IDE_GENERATED_PROPERTIES ("H5M" "${H5M_HDRS}" "${H5M_SOURCES}")
+
+
set (H5MF_SOURCES
${HDF5_SRC_DIR}/H5MF.c
${HDF5_SRC_DIR}/H5MFaggr.c
@@ -483,6 +493,8 @@ set (H5P_SOURCES
${HDF5_SRC_DIR}/H5Pint.c
${HDF5_SRC_DIR}/H5Plapl.c
${HDF5_SRC_DIR}/H5Plcpl.c
+ ${HDF5_SRC_DIR}/H5Pmapl.c
+ ${HDF5_SRC_DIR}/H5Pmcpl.c
${HDF5_SRC_DIR}/H5Pocpl.c
${HDF5_SRC_DIR}/H5Pocpypl.c
${HDF5_SRC_DIR}/H5Pstrcpl.c
@@ -716,6 +728,7 @@ set (common_SRCS
${H5HP_SOURCES}
${H5I_SOURCES}
${H5L_SOURCES}
+ ${H5M_SOURCES}
${H5MF_SOURCES}
${H5MM_SOURCES}
${H5MP_SOURCES}
@@ -759,6 +772,7 @@ set (H5_PUBLIC_HEADERS
${H5HL_HDRS}
${H5I_HDRS}
${H5L_HDRS}
+ ${H5M_HDRS}
${H5MF_HDRS}
${H5MM_HDRS}
${H5MP_HDRS}
@@ -845,6 +859,9 @@ set (H5_PRIVATE_HEADERS
${HDF5_SRC_DIR}/H5Lpkg.h
${HDF5_SRC_DIR}/H5Lprivate.h
+ ${HDF5_SRC_DIR}/H5Mpkg.h
+ ${HDF5_SRC_DIR}/H5Mprivate.h
+
${HDF5_SRC_DIR}/H5MFprivate.h
${HDF5_SRC_DIR}/H5MMprivate.h
diff --git a/src/H5.c b/src/H5.c
index 104c9fd..16c12cb 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -166,6 +166,7 @@ H5_init_library(void)
H5_debug_g.pkg[H5_PKG_HG].name = "hg";
H5_debug_g.pkg[H5_PKG_HL].name = "hl";
H5_debug_g.pkg[H5_PKG_I].name = "i";
+ H5_debug_g.pkg[H5_PKG_M].name = "m";
H5_debug_g.pkg[H5_PKG_MF].name = "mf";
H5_debug_g.pkg[H5_PKG_MM].name = "mm";
H5_debug_g.pkg[H5_PKG_O].name = "o";
@@ -312,6 +313,7 @@ H5_term_library(void)
pending += DOWN(A_top);
pending += DOWN(D_top);
pending += DOWN(G_top);
+ pending += DOWN(M_top);
pending += DOWN(R_top);
pending += DOWN(S_top);
pending += DOWN(T_top);
@@ -337,6 +339,7 @@ H5_term_library(void)
pending += DOWN(A);
pending += DOWN(D);
pending += DOWN(G);
+ pending += DOWN(M);
pending += DOWN(R);
pending += DOWN(S);
pending += DOWN(T);
diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c
index b60b933..e4b81fa 100644
--- a/src/H5ACmpio.c
+++ b/src/H5ACmpio.c
@@ -821,9 +821,8 @@ H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr)
{
H5AC_t * cache_ptr;
H5AC_aux_t * aux_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(entry_ptr);
@@ -853,8 +852,7 @@ H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr)
/* Decrement the dirty byte count */
aux_ptr->dirty_bytes -= entry_ptr->size;
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5AC__log_cleaned_entry() */
diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c
index e3e11b2..83d0202 100644
--- a/src/H5FDhdfs.c
+++ b/src/H5FDhdfs.c
@@ -130,6 +130,8 @@ typedef struct {
#endif /* HDFS_STATS */
+#ifdef H5_HAVE_LIBHDFS
+
/* "unique" identifier for `hdfs_t` structures.
* Randomly generated by unweighted dice rolls.
*/
@@ -143,7 +145,7 @@ typedef struct {
* Purpose:
*
* Contain/retain information associated with a file hosted on Hadoop
- * Distributed File System (HDFS). Instantiated and populated via
+ * Distributed File System (HDFS). Instantiated and populated via
* `H5FD_hdfs_handle_open()` and cleaned up via `H5FD_hdfs_handle_close()`.
*
*
@@ -179,14 +181,11 @@ typedef struct {
*/
typedef struct {
unsigned long magic;
-#ifdef H5_HAVE_LIBHDFS
hdfsFS filesystem;
hdfsFileInfo *fileinfo;
- hdfsFile file;
-#endif
+ hdfsFile file;
} hdfs_t;
-#ifdef H5_HAVE_LIBHDFS
/*--------------------------------------------------------------------------
* Function: H5FD_hdfs_handle_open
@@ -274,7 +273,7 @@ H5FD_hdfs_handle_open(
"hdfsGetPathInfo failed")
}
handle->file = hdfsOpenFile(
- handle->filesystem,
+ handle->filesystem,
path,
O_RDONLY,
stream_buffer_size,
@@ -292,18 +291,18 @@ done:
/* error; clean up */
HDassert(handle->magic == HDFS_HDFST_MAGIC);
handle->magic++;
- if (handle->file != NULL) {
+ if (handle->file != NULL) {
if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) {
- HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL,
+ HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL,
"unable to close hdfs file handle")
}
}
- if (handle->fileinfo != NULL) {
+ if (handle->fileinfo != NULL) {
hdfsFreeFileInfo(handle->fileinfo, 1);
}
- if (handle->filesystem != NULL) {
+ if (handle->filesystem != NULL) {
if (FAIL == (hdfsDisconnect(handle->filesystem))) {
- HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL,
+ HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL,
"unable to disconnect from hdfs")
}
}
@@ -351,18 +350,18 @@ H5FD_hdfs_handle_close(hdfs_t *handle)
}
handle->magic++;
- if (handle->file != NULL) {
+ if (handle->file != NULL) {
if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) {
- HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL,
+ HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL,
"unable to close hdfs file handle")
}
}
- if (handle->fileinfo != NULL) {
+ if (handle->fileinfo != NULL) {
hdfsFreeFileInfo(handle->fileinfo, 1);
}
- if (handle->filesystem != NULL) {
+ if (handle->filesystem != NULL) {
if (FAIL == (hdfsDisconnect(handle->filesystem))) {
- HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL,
+ HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL,
"unable to disconnect hdfs file system")
}
}
@@ -373,6 +372,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FD_hdfs_close() */
+
#endif /* H5_HAVE_LIBHDFS */
@@ -382,9 +382,9 @@ done:
*
* Purpose:
*
- * H5FD_hdfs_t is a structure used to store all information needed to
+ * H5FD_hdfs_t is a structure used to store all information needed to
* maintain R/O access to a single HDF5 file in an HDFS file system.
- * This structure is created when such a file is "opened" and
+ * This structure is created when such a file is "opened" and
* discarded when it is "closed".
*
*
@@ -396,7 +396,7 @@ done:
*
* `fa` (H5FD_hdfs_fapl_t)
*
- * Instance of `H5FD_hdfs_fapl_t` containing the HDFS configuration data
+ * Instance of `H5FD_hdfs_fapl_t` containing the HDFS configuration data
* needed to "open" the HDF5 file.
*
* `eoa` (haddr_t)
@@ -405,9 +405,9 @@ done:
* equal the file size.
*
* `hdfs_handle` (hdfs_t *)
- *
+ *
* Instance of HDFS Request handle associated with the target resource.
- * Responsible for communicating with remote host and presenting file
+ * Responsible for communicating with remote host and presenting file
* contents as indistinguishable from a file on the local filesystem.
*
* *** present only if HDFS_SATS is flagged to enable stats collection ***
@@ -456,10 +456,13 @@ typedef struct H5FD_hdfs_t {
* ADDR_OVERFLOW: Checks whether a file address of type `haddr_t'
* is too large to be represented by the second argument
* of the file seek function.
+ * Only included if HDFS code should compile.
*
*/
#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1)
+#ifdef H5_HAVE_LIBHDFS
#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR))
+#endif /* H5_HAVE_LIBHDFS */
/* Prototypes */
static herr_t H5FD_hdfs_term(void);
@@ -474,13 +477,13 @@ static herr_t H5FD_hdfs_query(const H5FD_t *_f1, unsigned long *flags);
static haddr_t H5FD_hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
static haddr_t H5FD_hdfs_get_eof(const H5FD_t *_file, H5FD_mem_t type);
-static herr_t H5FD_hdfs_get_handle(H5FD_t *_file, hid_t fapl,
+static herr_t H5FD_hdfs_get_handle(H5FD_t *_file, hid_t fapl,
void** file_handle);
-static herr_t H5FD_hdfs_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id,
+static herr_t H5FD_hdfs_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id,
haddr_t addr, size_t size, void *buf);
-static herr_t H5FD_hdfs_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id,
+static herr_t H5FD_hdfs_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id,
haddr_t addr, size_t size, const void *buf);
-static herr_t H5FD_hdfs_truncate(H5FD_t *_file, hid_t dxpl_id,
+static herr_t H5FD_hdfs_truncate(H5FD_t *_file, hid_t dxpl_id,
hbool_t closing);
static herr_t H5FD_hdfs_lock(H5FD_t *_file, hbool_t rw);
static herr_t H5FD_hdfs_unlock(H5FD_t *_file);
@@ -521,8 +524,10 @@ static const H5FD_class_t H5FD_hdfs_g = {
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
+#ifdef H5_HAVE_LIBHDFS
/* Declare a free list to manage the H5FD_hdfs_t struct */
H5FL_DEFINE_STATIC(H5FD_hdfs_t);
+#endif /* H5_HAVE_LIBHDFS */
/*-------------------------------------------------------------------------
@@ -545,7 +550,7 @@ H5FD__init_package(void)
FUNC_ENTER_STATIC
if (H5FD_hdfs_init() < 0) {
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL,
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL,
"unable to initialize hdfs VFD")
}
@@ -643,8 +648,8 @@ H5FD_hdfs_term(void)
* Function: H5Pset_fapl_hdfs
*
* Purpose: Modify the file access property list to use the H5FD_HDFS
- * driver defined in this source file. All driver specfic
- * properties are passed in as a pointer to a suitably
+ * driver defined in this source file. All driver specfic
+ * properties are passed in as a pointer to a suitably
* initialized instance of H5FD_hdfs_fapl_t
*
* Return: SUCCEED/FAIL
@@ -658,7 +663,7 @@ H5FD_hdfs_term(void)
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_fapl_hdfs(hid_t fapl_id,
+H5Pset_fapl_hdfs(hid_t fapl_id,
H5FD_hdfs_fapl_t *fa)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
@@ -674,7 +679,7 @@ H5Pset_fapl_hdfs(hid_t fapl_id,
#endif
plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS);
- if (plist == NULL) {
+ if (plist == NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, \
"not a file access property list")
}
@@ -699,12 +704,12 @@ done:
* contains internally consistant data. Return SUCCEED if so,
* and FAIL otherwise.
*
- * Note the difference between internally consistant and
- * correct. As we will have to try to access the target
+ * Note the difference between internally consistant and
+ * correct. As we will have to try to access the target
* object to determine whether the supplied data is correct,
* we will settle for internal consistancy at this point
*
- * Return: SUCCEED if instance of H5FD_hdfs_fapl_t contains internally
+ * Return: SUCCEED if instance of H5FD_hdfs_fapl_t contains internally
* consistant data, FAIL otherwise.
*
* Programmer: Jacob Smith
@@ -761,7 +766,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_fapl_hdfs(hid_t fapl_id,
+H5Pget_fapl_hdfs(hid_t fapl_id,
H5FD_hdfs_fapl_t *fa_out)
{
const H5FD_hdfs_fapl_t *fa = NULL;
@@ -832,7 +837,7 @@ H5FD_hdfs_fapl_get(H5FD_t *_file)
fa = (H5FD_hdfs_fapl_t *)H5MM_calloc(sizeof(H5FD_hdfs_fapl_t));
if (fa == NULL) {
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed")
}
@@ -878,7 +883,7 @@ H5FD_hdfs_fapl_copy(const void *_old_fa)
new_fa = (H5FD_hdfs_fapl_t *)H5MM_malloc(sizeof(H5FD_hdfs_fapl_t));
if (new_fa == NULL) {
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed")
}
@@ -916,7 +921,7 @@ H5FD_hdfs_fapl_free(void *_fa)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- HDassert(fa != NULL); /* sanity check */
+ HDassert(fa != NULL); /* sanity check */
H5MM_xfree(fa);
@@ -994,11 +999,11 @@ done:
* Create and/or opens a file as an HDF5 file.
*
* Any flag except H5F_ACC_RDONLY will cause an error.
- *
+ *
* Return:
*
- * Success: A pointer to a new file data structure.
- * The public fields will be initialized by the caller, which is
+ * Success: A pointer to a new file data structure.
+ * The public fields will be initialized by the caller, which is
* always H5FD_open().
*
* Failure: NULL
@@ -1010,26 +1015,21 @@ done:
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_LIBHDFS
static H5FD_t *
H5FD_hdfs_open(
- const char *path,
- unsigned flags,
- hid_t fapl_id,
+ const char *path,
+ unsigned flags,
+ hid_t fapl_id,
haddr_t maxaddr)
{
H5FD_t *ret_value = NULL;
-#ifdef H5_HAVE_LIBHDFS
H5FD_hdfs_t *file = NULL;
hdfs_t *handle = NULL;
H5FD_hdfs_fapl_t fa;
-#endif
FUNC_ENTER_NOAPI_NOINIT
-#ifndef H5_HAVE_LIBHDFS
- HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL,
- "Illegal open of unsupported virtual file (hdfs)");
-#else
#if HDFS_DEBUG
HDfprintf(stdout, "H5FD_hdfs_open() called.\n");
#endif /* HDFS_DEBUG */
@@ -1078,11 +1078,11 @@ H5FD_hdfs_open(
HDassert(handle->magic == HDFS_HDFST_MAGIC);
- /* create new file struct
+ /* create new file struct
*/
file = H5FL_CALLOC(H5FD_hdfs_t);
if (file == NULL) {
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
"unable to allocate file struct")
}
file->hdfs_handle = handle;
@@ -1090,33 +1090,53 @@ H5FD_hdfs_open(
#if HDFS_STATS
if (FAIL == hdfs_reset_stats(file)) {
- HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL,
+ HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL,
"unable to reset file statistics")
}
#endif /* HDFS_STATS */
ret_value = (H5FD_t*)file;
-#endif /* H5_HAVE_LIBHDFS */
done:
-#ifdef H5_HAVE_LIBHDFS
if (ret_value == NULL) {
- if (handle != NULL) {
+ if (handle != NULL) {
if (FAIL == H5FD_hdfs_handle_close(handle)) {
- HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL,
+ HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL,
"unable to close HDFS file handle")
}
}
if (file != NULL) {
file = H5FL_FREE(H5FD_hdfs_t, file);
}
- } /* if null return value (error) */
-#endif /* H5_HAVE_LIBHDFS */
+ } /* end if null return value (error) */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+
+} /* H5FD_hdfs_open() */
+
+#else /* H5_HAVE_LIBHDFS not defined */
+
+static H5FD_t *
+H5FD_hdfs_open(
+ const char H5_ATTR_UNUSED *path,
+ unsigned H5_ATTR_UNUSED flags,
+ hid_t H5_ATTR_UNUSED fapl_id,
+ haddr_t H5_ATTR_UNUSED maxaddr)
+{
+ H5FD_t *ret_value = NULL;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL,
+ "Illegal open of unsupported virtual file (hdfs)");
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FD_hdfs_open() */
+#endif /* H5_HAVE_LIBHDFS */
+
#if HDFS_STATS
/*----------------------------------------------------------------------------
@@ -1124,7 +1144,7 @@ done:
* Function: hdfs_fprint_stats()
*
* Purpose:
- *
+ *
* Tabulate and pretty-print statistics for this virtual file.
*
* Should be called upon file close.
@@ -1145,17 +1165,17 @@ done:
* - max (largest size read)
* 2. tabulation of "bins", sepraring reads into exponentially-larger
* ranges of size.
- * - columns for number of reads, total bytes, and average size, with
+ * - columns for number of reads, total bytes, and average size, with
* separate sub-colums for raw- and metadata reads.
* - each row represents one bin, identified by the top of its range
- *
+ *
* Bin ranges can be modified with pound-defines at the top of this file.
*
* Bins without any reads in their bounds are not printed.
*
* An "overflow" bin is also present, to catch "big" reads.
*
- * Output for all bins (and range ceiling and average size report)
+ * Output for all bins (and range ceiling and average size report)
* is divied by powers of 1024. By corollary, four digits before the decimal
* is valid.
*
@@ -1216,36 +1236,6 @@ hdfs_fprint_stats(
"hdfs handle has invalid magic")
}
- /* TODO: See what libhdfs exposes to us. */
-
-#if 0
- if (file->s3r_handle->purl == NULL) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "parsed url structure cannot be null")
- }
- purl = file->s3r_handle->purl;
-
- /******************
- * PRINT FILENAME *
- ******************/
-
- HDfprintf(stream, "stats for %s://%s", purl->scheme, purl->host);
- if (purl->port != NULL && purl->port[0] != '\0') {
- HDfprintf(stream, ":%s", purl->port);
- }
- if (purl->query != NULL && purl->query[0] != '\0') {
- if (purl->path != NULL && purl->path[0] != '\0') {
- HDfprintf(stream, "/%s", purl->path);
- } else {
- HDfprintf(stream, "/");
- }
- HDfprintf(stream, "?%s", purl->query);
- } else if (purl->path != NULL && purl->path[0] != '\0') {
- HDfprintf(stream, "/%s", purl->path);
- }
- HDfprintf(stream, "\n");
-#endif
-
/*******************
* AGGREGATE STATS *
*******************/
@@ -1254,18 +1244,22 @@ hdfs_fprint_stats(
const hdfs_statsbin *r = &file->raw[i];
const hdfs_statsbin *m = &file->meta[i];
- if (m->min < min_meta) min_meta = m->min;
- if (r->min < min_raw) min_raw = r->min;
- if (m->max > max_meta) max_meta = m->max;
- if (r->max > max_raw) max_raw = r->max;
+ if (m->min < min_meta) { min_meta = m->min; }
+ if (r->min < min_raw) { min_raw = r->min; }
+ if (m->max > max_meta) { max_meta = m->max; }
+ if (r->max > max_raw) { max_raw = r->max; }
count_raw += r->count;
count_meta += m->count;
bytes_raw += r->bytes;
bytes_meta += m->bytes;
}
- if (count_raw > 0) average_raw = (double)bytes_raw / (double)count_raw;
- if (count_meta > 0) average_meta = (double)bytes_meta / (double)count_meta;
+ if (count_raw > 0) {
+ average_raw = (double)bytes_raw / (double)count_raw;
+ }
+ if (count_meta > 0) {
+ average_meta = (double)bytes_meta / (double)count_meta;
+ }
/******************
* PRINT OVERVIEW *
@@ -1342,9 +1336,9 @@ hdfs_fprint_stats(
* PRINT INDIVIDUAL BIN STATS *
******************************/
- HDfprintf(stream,
+ HDfprintf(stream,
"BINS # of reads total bytes average size\n");
- HDfprintf(stream,
+ HDfprintf(stream,
" up-to meta raw meta raw meta raw\n");
for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) {
@@ -1414,7 +1408,7 @@ hdfs_fprint_stats(
HDassert(suffix_i < sizeof(suffixes));
HDfprintf(
- stream,
+ stream,
" %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n",
re_dub, suffixes[suffix_i], /* bin ceiling */
m->count, /* metadata reads */
@@ -1428,7 +1422,6 @@ hdfs_fprint_stats(
done:
FUNC_LEAVE_NOAPI(ret_value);
-
} /* hdfs_fprint_stats */
#endif /* HDFS_STATS */
@@ -1442,7 +1435,7 @@ done:
* Close an HDF5 file.
*
* Return:
- *
+ *
* SUCCEED/FAIL
*
* Programmer: Jacob Smith
@@ -1452,35 +1445,31 @@ done:
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_LIBHDFS
+
static herr_t
H5FD_hdfs_close(H5FD_t *_file)
{
herr_t ret_value = SUCCEED;
-#ifdef H5_HAVE_LIBHDFS
H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file;
-#endif
FUNC_ENTER_NOAPI_NOINIT
-#ifndef H5_HAVE_LIBHDFS
- HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL,
- "Illegal close of unsupported Virtual File (hdfs)")
-#else
#if HDFS_DEBUG
HDfprintf(stdout, "H5FD_hdfs_close() called.\n");
#endif
- /* Sanity checks
+ /* Sanity checks
*/
HDassert(file != NULL);
HDassert(file->hdfs_handle != NULL);
HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC);
- /* Close the underlying request handle
+ /* Close the underlying request handle
*/
- if (file->hdfs_handle != NULL) {
+ if (file->hdfs_handle != NULL) {
if (FAIL == H5FD_hdfs_handle_close(file->hdfs_handle)) {
- HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL,
+ HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL,
"unable to close HDFS file handle")
}
}
@@ -1488,21 +1477,37 @@ H5FD_hdfs_close(H5FD_t *_file)
#if HDFS_STATS
/* TODO: mechanism to re-target stats printout */
if (FAIL == hdfs_fprint_stats(stdout, file)) {
- HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL,
+ HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL,
"problem while writing file statistics")
}
#endif /* HDFS_STATS */
- /* Release the file info
+ /* Release the file info
*/
file = H5FL_FREE(H5FD_hdfs_t, file);
-#endif /* H5_HAVE_LIBHDFS */
done:
FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_hdfs_close() */
+
+#else /* H5_HAVE_LIBHDFS not defined */
+
+static herr_t
+H5FD_hdfs_close(H5FD_t H5_ATTR_UNUSED *_file)
+{
+ herr_t ret_value = SUCCEED;
+ FUNC_ENTER_NOAPI_NOINIT
+
+ HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL,
+ "Illegal close of unsupported Virtual File (hdfs)")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_hdfs_close() */
+#endif /* H5_HAVE_LIBHDFS */
+
/*-------------------------------------------------------------------------
*
@@ -1527,21 +1532,21 @@ done:
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_LIBHDFS
+
static int
-H5FD_hdfs_cmp(const H5FD_t *_f1,
- const H5FD_t *_f2)
+H5FD_hdfs_cmp(
+ const H5FD_t *_f1,
+ const H5FD_t *_f2)
{
int ret_value = 0;
-#ifdef H5_HAVE_LIBHDFS
const H5FD_hdfs_t *f1 = (const H5FD_hdfs_t *)_f1;
const H5FD_hdfs_t *f2 = (const H5FD_hdfs_t *)_f2;
hdfsFileInfo *finfo1 = NULL;
hdfsFileInfo *finfo2 = NULL;
-#endif /* H5_HAVE_LIBHDFS */
FUNC_ENTER_NOAPI_NOINIT_NOERR
-#ifdef H5_HAVE_LIBHDFS
#if HDFS_DEBUG
HDfprintf(stdout, "H5FD_hdfs_cmp() called.\n");
#endif /* HDFS_DEBUG */
@@ -1556,23 +1561,37 @@ H5FD_hdfs_cmp(const H5FD_t *_f1,
HDassert(finfo1 != NULL);
HDassert(finfo2 != NULL);
- if (finfo1->mKind != finfo2->mKind) HGOTO_DONE(-1);
- if (finfo1->mName != finfo2->mName) HGOTO_DONE(-1);
- if (finfo1->mLastMod != finfo2->mLastMod) HGOTO_DONE(-1);
- if (finfo1->mSize != finfo2->mSize) HGOTO_DONE(-1);
- if (finfo1->mReplication != finfo2->mReplication) HGOTO_DONE(-1);
- if (finfo1->mBlockSize != finfo2->mBlockSize) HGOTO_DONE(-1);
- if (strcmp(finfo1->mOwner, finfo2->mOwner)) HGOTO_DONE(-1);
- if (strcmp(finfo1->mGroup, finfo2->mGroup)) HGOTO_DONE(-1);
- if (finfo1->mPermissions != finfo2->mPermissions) HGOTO_DONE(-1);
- if (finfo1->mLastAccess != finfo2->mLastAccess) HGOTO_DONE(-1);
-#endif /* H5_HAVE_LIBHDFS */
+ if (finfo1->mKind != finfo2->mKind) { HGOTO_DONE(-1); }
+ if (finfo1->mName != finfo2->mName) { HGOTO_DONE(-1); }
+ if (finfo1->mLastMod != finfo2->mLastMod) { HGOTO_DONE(-1); }
+ if (finfo1->mSize != finfo2->mSize) { HGOTO_DONE(-1); }
+ if (finfo1->mReplication != finfo2->mReplication) { HGOTO_DONE(-1); }
+ if (finfo1->mBlockSize != finfo2->mBlockSize) { HGOTO_DONE(-1); }
+ if (strcmp(finfo1->mOwner, finfo2->mOwner)) { HGOTO_DONE(-1); }
+ if (strcmp(finfo1->mGroup, finfo2->mGroup)) { HGOTO_DONE(-1); }
+ if (finfo1->mPermissions != finfo2->mPermissions) { HGOTO_DONE(-1); }
+ if (finfo1->mLastAccess != finfo2->mLastAccess) { HGOTO_DONE(-1); }
done:
FUNC_LEAVE_NOAPI(ret_value)
+} /* H5FD_hdfs_cmp() */
+
+#else /* H5_HAVE_LIBHDFS not defined */
+
+static int
+H5FD_hdfs_cmp(
+ const H5FD_t H5_ATTR_UNUSED *_f1,
+ const H5FD_t H5_ATTR_UNUSED *_f2)
+{
+ int ret_value = 0;
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5FD_hdfs_cmp() */
+#endif /* H5_HAVE_LIBHDFS */
+
/*-------------------------------------------------------------------------
* Function: H5FD_hdfs_query
@@ -1580,7 +1599,7 @@ done:
* Purpose: Set the flags that this VFL driver is capable of supporting.
* (listed in H5FDpublic.h)
*
- * Note that since the HDFS VFD is read only, most flags
+ * Note that since the HDFS VFD is read only, most flags
* are irrelevant.
*
* The term "set" is highly misleading...
@@ -1595,7 +1614,7 @@ done:
*/
static herr_t
H5FD_hdfs_query(
- const H5FD_t H5_ATTR_UNUSED *_file,
+ const H5FD_t H5_ATTR_UNUSED *_file,
unsigned long *flags) /* out variable */
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1606,11 +1625,10 @@ H5FD_hdfs_query(
if (flags) {
*flags = 0;
- *flags |= H5FD_FEAT_DATA_SIEVE;
+ *flags |= H5FD_FEAT_DATA_SIEVE;
}
FUNC_LEAVE_NOAPI(SUCCEED)
-
} /* H5FD_hdfs_query() */
@@ -1635,14 +1653,14 @@ H5FD_hdfs_query(
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_LIBHDFS
+
static haddr_t
H5FD_hdfs_get_eoa(
- const H5FD_t *_file,
+ const H5FD_t *_file,
H5FD_mem_t H5_ATTR_UNUSED type)
{
-#ifdef H5_HAVE_LIBHDFS
const H5FD_hdfs_t *file = (const H5FD_hdfs_t *)_file;
-#endif /* H5_HAVE_LIBHDFS */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1650,14 +1668,27 @@ H5FD_hdfs_get_eoa(
HDfprintf(stdout, "H5FD_hdfs_get_eoa() called.\n");
#endif
-#ifdef H5_HAVE_LIBHDFS
FUNC_LEAVE_NOAPI(file->eoa)
-#else
- FUNC_LEAVE_NOAPI(0)
-#endif /* H5_HAVE_LIBHDFS */
+} /* end H5FD_hdfs_get_eoa() */
+
+#else /* H5_HAVE_LIBHDFS not defined */
+
+static haddr_t
+H5FD_hdfs_get_eoa(
+ const H5FD_t H5_ATTR_UNUSED *_file,
+ H5FD_mem_t H5_ATTR_UNUSED type)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+#if HDFS_DEBUG
+ HDfprintf(stdout, "H5FD_hdfs_get_eoa() called.\n");
+#endif
+
+ FUNC_LEAVE_NOAPI(0)
} /* end H5FD_hdfs_get_eoa() */
+#endif /* H5_HAVE_LIBHDFS */
+
/*-------------------------------------------------------------------------
*
@@ -1678,15 +1709,15 @@ H5FD_hdfs_get_eoa(
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_LIBHDFS
+
static herr_t
H5FD_hdfs_set_eoa(
- H5FD_t *_file,
- H5FD_mem_t H5_ATTR_UNUSED type,
+ H5FD_t *_file,
+ H5FD_mem_t H5_ATTR_UNUSED type,
haddr_t addr)
{
-#ifdef H5_HAVE_LIBHDFS
H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file;
-#endif /* H5_HAVE_LIBHDFS */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1694,16 +1725,30 @@ H5FD_hdfs_set_eoa(
HDfprintf(stdout, "H5FD_hdfs_set_eoa() called.\n");
#endif
-#ifdef H5_HAVE_LIBHDFS
file->eoa = addr;
FUNC_LEAVE_NOAPI(SUCCEED)
-#else
- FUNC_LEAVE_NOAPI(FAIL)
-#endif /* H5_HAVE_LIBHDFS */
+} /* H5FD_hdfs_set_eoa() */
+
+#else /* H5_HAVE_LIBHDFS not defined */
+
+static herr_t
+H5FD_hdfs_set_eoa(
+ H5FD_t H5_ATTR_UNUSED *_file,
+ H5FD_mem_t H5_ATTR_UNUSED type,
+ haddr_t H5_ATTR_UNUSED addr)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+#if HDFS_DEBUG
+ HDfprintf(stdout, "H5FD_hdfs_set_eoa() called.\n");
+#endif
+
+ FUNC_LEAVE_NOAPI(FAIL)
} /* H5FD_hdfs_set_eoa() */
+#endif /* H5_HAVE_LIBHDFS */
+
/*-------------------------------------------------------------------------
*
@@ -1715,7 +1760,7 @@ H5FD_hdfs_set_eoa(
*
* Return:
*
- * EOF: the first address past the end of the "file", either the
+ * EOF: the first address past the end of the "file", either the
* filesystem file or the HDF5 file.
*
* Programmer: Jacob Smith
@@ -1723,14 +1768,14 @@ H5FD_hdfs_set_eoa(
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_LIBHDFS
+
static haddr_t
H5FD_hdfs_get_eof(
- const H5FD_t *_file,
+ const H5FD_t *_file,
H5FD_mem_t H5_ATTR_UNUSED type)
{
-#ifdef H5_HAVE_LIBHDFS
const H5FD_hdfs_t *file = (const H5FD_hdfs_t *)_file;
-#endif /* H5_HAVE_LIBHDFS */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1738,17 +1783,30 @@ H5FD_hdfs_get_eof(
HDfprintf(stdout, "H5FD_hdfs_get_eof() called.\n");
#endif
-#ifdef H5_HAVE_LIBHDFS
HDassert(file->hdfs_handle != NULL);
HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC);
FUNC_LEAVE_NOAPI((size_t) file->hdfs_handle->fileinfo->mSize)
-#else
- FUNC_LEAVE_NOAPI((size_t)0)
-#endif /* H5_HAVE_LIBHDFS */
+} /* end H5FD_hdfs_get_eof() */
+
+#else /* H5_HAVE_LIBHDFS not defined */
+
+static haddr_t
+H5FD_hdfs_get_eof(
+ const H5FD_t H5_ATTR_UNUSED *_file,
+ H5FD_mem_t H5_ATTR_UNUSED type)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+#if HDFS_DEBUG
+ HDfprintf(stdout, "H5FD_hdfs_get_eof() called.\n");
+#endif
+
+ FUNC_LEAVE_NOAPI((size_t)0)
} /* end H5FD_hdfs_get_eof() */
+#endif /* H5_HAVE_LIBHDFS */
+
/*-------------------------------------------------------------------------
*
@@ -1769,16 +1827,16 @@ H5FD_hdfs_get_eof(
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_LIBHDFS
+
static herr_t
H5FD_hdfs_get_handle(
- H5FD_t *_file,
- hid_t H5_ATTR_UNUSED fapl,
+ H5FD_t *_file,
+ hid_t H5_ATTR_UNUSED fapl,
void **file_handle)
{
herr_t ret_value = SUCCEED;
-#ifdef H5_HAVE_LIBHDFS
H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file;
-#endif
FUNC_ENTER_NOAPI_NOINIT
@@ -1786,29 +1844,48 @@ H5FD_hdfs_get_handle(
HDfprintf(stdout, "H5FD_hdfs_get_handle() called.\n");
#endif /* HDFS_DEBUG */
-#ifdef H5_HAVE_LIBHDFS
if (!file_handle) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"file handle not valid")
}
*file_handle = file->hdfs_handle;
-#else
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_hdfs_get_handle() */
+
+#else /* H5_HAVE_LIBHDFS not defined */
+
+static herr_t
+H5FD_hdfs_get_handle(
+ H5FD_t H5_ATTR_UNUSED *_file,
+ hid_t H5_ATTR_UNUSED fapl,
+ void H5_ATTR_UNUSED **file_handle)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if HDFS_DEBUG
+ HDfprintf(stdout, "H5FD_hdfs_get_handle() called.\n");
+#endif /* HDFS_DEBUG */
+
HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL,
"Illegal get-handle of unsupported virtual file (hdfs)");
-#endif /* H5_HAVE_LIBHDFS */
done:
FUNC_LEAVE_NOAPI(ret_value)
-
} /* end H5FD_hdfs_get_handle() */
+#endif /* H5_HAVE_LIBHDFS */
+
/*-------------------------------------------------------------------------
*
* Function: H5FD_hdfs_read()
*
- * Purpose:
+ * Purpose:
*
* Reads SIZE bytes of data from FILE beginning at address ADDR
* into buffer BUF according to data transfer properties in DXPL_ID.
@@ -1828,20 +1905,20 @@ done:
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_LIBHDFS
+
static herr_t
H5FD_hdfs_read(
- H5FD_t *_file,
- H5FD_mem_t H5_ATTR_UNUSED type,
+ H5FD_t *_file,
+ H5FD_mem_t H5_ATTR_UNUSED type,
hid_t H5_ATTR_UNUSED dxpl_id,
haddr_t addr, /* start offset */
size_t size, /* length of read */
void *buf) /* out */
{
herr_t ret_value = SUCCEED;
-#if H5_HAVE_LIBHDFS
H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file;
size_t filesize = 0;
-#endif /* H5_HAVE_LIBHDFS */
#if HDFS_STATS
/* working variables for storing stats */
hdfs_statsbin *bin = NULL;
@@ -1854,10 +1931,6 @@ H5FD_hdfs_read(
HDfprintf(stdout, "H5FD_hdfs_read() called.\n");
#endif /* HDFS_DEBUG */
-#ifndef H5_HAVE_LIBHDFS
- HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL,
- "Illegal get-handle of unsupported virtual file (hdfs)");
-#else
HDassert(file != NULL);
HDassert(file->hdfs_handle != NULL);
HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC);
@@ -1894,37 +1967,64 @@ H5FD_hdfs_read(
? &file->raw[bin_i]
: &file->meta[bin_i];
- /* Store collected stats in appropriate bin
+ /* Store collected stats in appropriate bin
*/
if (bin->count == 0) {
bin->min = size;
bin->max = size;
- } else {
- if (size < bin->min) bin->min = size;
- if (size > bin->max) bin->max = size;
+ }
+ else {
+ if (size < bin->min) { bin->min = size; }
+ if (size > bin->max) { bin->max = size; }
}
bin->count++;
bin->bytes += (unsigned long long)size;
#endif /* HDFS_STATS */
-#endif /* H5_HAVE_LIBHDFS */
done:
FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_hdfs_read() */
+
+#else /* H5_HAVE_LIBHDFS not defined */
+
+static herr_t
+H5FD_hdfs_read(
+ H5FD_t H5_ATTR_UNUSED *_file,
+ H5FD_mem_t H5_ATTR_UNUSED type,
+ hid_t H5_ATTR_UNUSED dxpl_id,
+ haddr_t H5_ATTR_UNUSED addr,
+ size_t H5_ATTR_UNUSED size,
+ void H5_ATTR_UNUSED *buf)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if HDFS_DEBUG
+ HDfprintf(stdout, "H5FD_hdfs_read() called.\n");
+#endif /* HDFS_DEBUG */
+
+ HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL,
+ "Illegal get-handle of unsupported virtual file (hdfs)");
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_hdfs_read() */
+#endif /* H5_HAVE_LIBHDFS */
+
/*-------------------------------------------------------------------------
*
* Function: H5FD_hdfs_write()
*
- * Purpose:
+ * Purpose:
*
* Write bytes to file.
* UNSUPPORTED IN READ-ONLY HDFS VFD.
*
- * Return:
+ * Return:
*
* FAIL (Not possible with Read-Only S3 file.)
*
@@ -1937,11 +2037,11 @@ done:
*/
static herr_t
H5FD_hdfs_write(
- H5FD_t H5_ATTR_UNUSED *_file,
- H5FD_mem_t H5_ATTR_UNUSED type,
+ H5FD_t H5_ATTR_UNUSED *_file,
+ H5FD_mem_t H5_ATTR_UNUSED type,
hid_t H5_ATTR_UNUSED dxpl_id,
- haddr_t H5_ATTR_UNUSED addr,
- size_t H5_ATTR_UNUSED size,
+ haddr_t H5_ATTR_UNUSED addr,
+ size_t H5_ATTR_UNUSED size,
const void H5_ATTR_UNUSED *buf)
{
herr_t ret_value = FAIL;
@@ -1957,7 +2057,6 @@ H5FD_hdfs_write(
done:
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5FD_hdfs_write() */
@@ -1985,8 +2084,8 @@ done:
*/
static herr_t
H5FD_hdfs_truncate(
- H5FD_t H5_ATTR_UNUSED *_file,
- hid_t H5_ATTR_UNUSED dxpl_id,
+ H5FD_t H5_ATTR_UNUSED *_file,
+ hid_t H5_ATTR_UNUSED dxpl_id,
hbool_t H5_ATTR_UNUSED closing)
{
herr_t ret_value = SUCCEED;
@@ -2002,7 +2101,6 @@ H5FD_hdfs_truncate(
done:
FUNC_LEAVE_NOAPI(ret_value)
-
} /* end H5FD_hdfs_truncate() */
@@ -2031,12 +2129,11 @@ done:
*/
static herr_t
H5FD_hdfs_lock(
- H5FD_t H5_ATTR_UNUSED *_file,
+ H5FD_t H5_ATTR_UNUSED *_file,
hbool_t H5_ATTR_UNUSED rw)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_LEAVE_NOAPI(SUCCEED)
-
} /* end H5FD_hdfs_lock() */
@@ -2065,6 +2162,5 @@ H5FD_hdfs_unlock(H5FD_t H5_ATTR_UNUSED *_file)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_LEAVE_NOAPI(SUCCEED)
-
} /* end H5FD_hdfs_unlock() */
diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c
index 7d58b7a..b2959a5 100644
--- a/src/H5FDmpi.c
+++ b/src/H5FDmpi.c
@@ -267,115 +267,6 @@ H5FD_mpi_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/)
FUNC_LEAVE_NOAPI(ret_value)
}
-
-/*-------------------------------------------------------------------------
- * Function: H5FD_mpi_comm_info_dup
- *
- * Purpose: Make duplicates of communicator and Info object.
- * If the Info object is in fact MPI_INFO_NULL, no duplicate
- * is made but the same value assigned to the new Info object
- * handle.
- *
- * Return: Success: Non-negative. The new communicator and Info
- * object handles are returned via comm_new and
- * info_new pointers.
- *
- * Failure: Negative.
- *
- * Programmer: Albert Cheng
- * Jan 8, 2003
- *
- * Modifications:
- *-------------------------------------------------------------------------
- */
-herr_t
-H5FD_mpi_comm_info_dup(MPI_Comm comm, MPI_Info info, MPI_Comm *comm_new, MPI_Info *info_new)
-{
- herr_t ret_value=SUCCEED;
- MPI_Comm comm_dup=MPI_COMM_NULL;
- MPI_Info info_dup=MPI_INFO_NULL;
- int mpi_code;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check arguments */
- if (MPI_COMM_NULL == comm)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "not a valid argument")
- if (!comm_new || !info_new)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "bad pointers")
-
- /* Dup them. Using temporary variables for error recovery cleanup. */
- if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(comm, &comm_dup)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code)
- if (MPI_INFO_NULL != info){
- if (MPI_SUCCESS != (mpi_code=MPI_Info_dup(info, &info_dup)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code)
- }else{
- /* No dup, just copy it. */
- info_dup = info;
- }
-
- /* Set MPI_ERRORS_RETURN on comm_dup so that MPI failures are not fatal,
- and return codes can be checked and handled. May 23, 2017 FTW */
- if (MPI_SUCCESS != (mpi_code = MPI_Comm_set_errhandler(comm_dup, MPI_ERRORS_RETURN)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Errhandler_set failed", mpi_code)
-
- /* copy them to the return arguments */
- *comm_new = comm_dup;
- *info_new = info_dup;
-
-done:
- if (FAIL == ret_value){
- /* need to free anything created here */
- if (MPI_COMM_NULL != comm_dup)
- MPI_Comm_free(&comm_dup);
- if (MPI_INFO_NULL != info_dup)
- MPI_Info_free(&info_dup);
- }
-
- FUNC_LEAVE_NOAPI(ret_value)
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5FD_mpi_comm_info_free
- *
- * Purpose: Free the communicator and Info object.
- * If comm or info is in fact MPI_COMM_NULL or MPI_INFO_NULL
- * respectively, no action occurs to it.
- *
- * Return: Success: Non-negative. The values the pointers refer
- * to will be set to the corresponding NULL
- * handles.
- *
- * Failure: Negative.
- *
- * Programmer: Albert Cheng
- * Jan 8, 2003
- *
- * Modifications:
- *-------------------------------------------------------------------------
- */
-herr_t
-H5FD_mpi_comm_info_free(MPI_Comm *comm, MPI_Info *info)
-{
- herr_t ret_value=SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check arguments */
- if (!comm || !info)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "not a valid argument")
-
- if (MPI_COMM_NULL != *comm)
- MPI_Comm_free(comm);
- if (MPI_INFO_NULL != *info)
- MPI_Info_free(info);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-}
-
#ifdef NOT_YET
/*-------------------------------------------------------------------------
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index d5aa170..6ca7aa4 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -167,7 +167,7 @@ USAGE
herr_t H5FD__init_package()
RETURNS
- Non-negative on success/Negative on failure
+ SUCCEED/FAIL
DESCRIPTION
Initializes any interface-specific data or routines. (Just calls
@@ -249,9 +249,9 @@ done:
/*---------------------------------------------------------------------------
- * Function: H5FD__mpio_term
+ * Function: H5FD__mpio_term
*
- * Purpose: Shut down the VFD
+ * Purpose: Shut down the VFD
*
* Returns: Non-negative on success or negative on failure
*
@@ -263,7 +263,7 @@ done:
static herr_t
H5FD__mpio_term(void)
{
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Reset VFL ID */
H5FD_MPIO_g = 0;
@@ -273,40 +273,40 @@ H5FD__mpio_term(void)
/*-------------------------------------------------------------------------
- * Function: H5Pset_fapl_mpio
+ * Function: H5Pset_fapl_mpio
*
- * Purpose: Store the user supplied MPIO communicator comm and info in
- * the file access property list FAPL_ID which can then be used
- * to create and/or open the file. This function is available
- * only in the parallel HDF5 library and is not collective.
+ * Purpose: Store the user supplied MPIO communicator comm and info in
+ * the file access property list FAPL_ID which can then be used
+ * to create and/or open the file. This function is available
+ * only in the parallel HDF5 library and is not collective.
*
- * comm is the MPI communicator to be used for file open as
- * defined in MPI_FILE_OPEN of MPI-2. This function makes a
- * duplicate of comm. Any modification to comm after this function
- * call returns has no effect on the access property list.
+ * comm is the MPI communicator to be used for file open as
+ * defined in MPI_FILE_OPEN of MPI-2. This function makes a
+ * duplicate of comm. Any modification to comm after this function
+ * call returns has no effect on the access property list.
*
- * info is the MPI Info object to be used for file open as
- * defined in MPI_FILE_OPEN of MPI-2. This function makes a
- * duplicate of info. Any modification to info after this
- * function call returns has no effect on the access property
- * list.
+ * info is the MPI Info object to be used for file open as
+ * defined in MPI_FILE_OPEN of MPI-2. This function makes a
+ * duplicate of info. Any modification to info after this
+ * function call returns has no effect on the access property
+ * list.
*
* If fapl_id has previously set comm and info values, they
* will be replaced and the old communicator and Info object
* are freed.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Albert Cheng
- * Feb 3, 1998
+ * Programmer: Albert Cheng
+ * Feb 3, 1998
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info)
{
- H5FD_mpio_fapl_t fa;
+ H5FD_mpio_fapl_t fa;
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value;
@@ -319,7 +319,7 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info)
if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list")
if(MPI_COMM_NULL == comm)
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator")
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator")
/* Initialize driver specific properties */
HDmemset(&fa, 0, sizeof(H5FD_mpio_fapl_t));
@@ -335,25 +335,25 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pget_fapl_mpio
- *
- * Purpose: If the file access property list is set to the H5FD_MPIO
- * driver then this function returns duplicates of the MPI
- * communicator and Info object stored through the comm and
- * info pointers. It is the responsibility of the application
- * to free the returned communicator and Info object.
- *
- * Return: Success: Non-negative with the communicator and
- * Info object returned through the comm and
- * info arguments if non-null. Since they are
- * duplicates of the stored objects, future
- * modifications to the access property list do
- * not affect them and it is the responsibility
- * of the application to free them.
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Thursday, February 26, 1998
+ * Function: H5Pget_fapl_mpio
+ *
+ * Purpose: If the file access property list is set to the H5FD_MPIO
+ * driver then this function returns duplicates of the MPI
+ * communicator and Info object stored through the comm and
+ * info pointers. It is the responsibility of the application
+ * to free the returned communicator and Info object.
+ *
+ * Return: Success: Non-negative with the communicator and
+ * Info object returned through the comm and
+ * info arguments if non-null. Since they are
+ * duplicates of the stored objects, future
+ * modifications to the access property list do
+ * not affect them and it is the responsibility
+ * of the application to free them.
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Thursday, February 26, 1998
*
*-------------------------------------------------------------------------
*/
@@ -362,9 +362,9 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
const H5FD_mpio_fapl_t *fa; /* MPIO fapl info */
- MPI_Comm comm_tmp = MPI_COMM_NULL;
+ MPI_Comm comm_tmp = MPI_COMM_NULL;
hbool_t comm_copied = FALSE; /* MPI Comm has been duplicated */
- int mpi_code; /* MPI return code */
+ int mpi_code; /* MPI return code */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -381,19 +381,19 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/)
/* Store the duplicated communicator in a temporary variable for error */
/* recovery in case the INFO duplication fails. */
if(comm) {
- if(MPI_SUCCESS != (mpi_code = MPI_Comm_dup(fa->comm, &comm_tmp)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code)
+ if(MPI_SUCCESS != (mpi_code = MPI_Comm_dup(fa->comm, &comm_tmp)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code)
comm_copied = TRUE;
} /* end if */
if(info) {
- if(MPI_INFO_NULL != fa->info) {
- if(MPI_SUCCESS != (mpi_code = MPI_Info_dup(fa->info, info)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code)
- } /* end if */
+ if(MPI_INFO_NULL != fa->info) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Info_dup(fa->info, info)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code)
+ } /* end if */
else
- /* do not dup it */
- *info = MPI_INFO_NULL;
+ /* do not dup it */
+ *info = MPI_INFO_NULL;
} /* end if */
/* Store the copied communicator, now that the Info object has been
@@ -404,33 +404,33 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/)
done:
if(ret_value < 0)
- /* need to free anything created here */
- if(comm_copied)
- MPI_Comm_free(&comm_tmp);
+ /* need to free anything created here */
+ if(comm_copied)
+ MPI_Comm_free(&comm_tmp);
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_fapl_mpio() */
/*-------------------------------------------------------------------------
- * Function: H5Pset_dxpl_mpio
+ * Function: H5Pset_dxpl_mpio
*
- * Purpose: Set the data transfer property list DXPL_ID to use transfer
- * mode XFER_MODE. The property list can then be used to control
- * the I/O transfer mode during data I/O operations. The valid
- * transfer modes are:
+ * Purpose: Set the data transfer property list DXPL_ID to use transfer
+ * mode XFER_MODE. The property list can then be used to control
+ * the I/O transfer mode during data I/O operations. The valid
+ * transfer modes are:
*
- * H5FD_MPIO_INDEPENDENT:
- * Use independent I/O access (the default).
+ * H5FD_MPIO_INDEPENDENT:
+ * Use independent I/O access (the default).
*
- * H5FD_MPIO_COLLECTIVE:
- * Use collective I/O access.
+ * H5FD_MPIO_COLLECTIVE:
+ * Use collective I/O access.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Albert Cheng
- * April 2, 1998
+ * Programmer: Albert Cheng
+ * April 2, 1998
*
*-------------------------------------------------------------------------
*/
@@ -461,18 +461,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pget_dxpl_mpio
+ * Function: H5Pget_dxpl_mpio
*
- * Purpose: Queries the transfer mode current set in the data transfer
- * property list DXPL_ID. This is not collective.
+ * Purpose: Queries the transfer mode current set in the data transfer
+ * property list DXPL_ID. This is not collective.
*
- * Return: Success: Non-negative, with the transfer mode returned
- * through the XFER_MODE argument if it is
- * non-null.
- * Failure: Negative
+ * Return: Success: Non-negative, with the transfer mode returned
+ * through the XFER_MODE argument if it is
+ * non-null.
+ * Failure: Negative
*
- * Programmer: Albert Cheng
- * April 2, 1998
+ * Programmer: Albert Cheng
+ * April 2, 1998
*
*-------------------------------------------------------------------------
*/
@@ -500,21 +500,20 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pset_dxpl_mpio_collective_opt
+ * Function: H5Pset_dxpl_mpio_collective_opt
*
- * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O
- * without involving decision-making inside HDF5
+ * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O
+ * without involving decision-making inside HDF5
*
- * Note: The library will do linked chunk I/O or multi-chunk I/O without
- * involving communications for decision-making process.
- * The library won't behave as it asks for only when we find
- * that the low-level MPI-IO package doesn't support this.
+ * Note: The library will do linked chunk I/O or multi-chunk I/O without
+ * involving communications for decision-making process.
+ * The library won't behave as it asks for only when we find
+ * that the low-level MPI-IO package doesn't support this.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Kent Yang
- * ? ?, ?
+ * Programmer: Kent Yang
*
*-------------------------------------------------------------------------
*/
@@ -543,21 +542,20 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pset_dxpl_mpio_chunk_opt
+ * Function: H5Pset_dxpl_mpio_chunk_opt
*
- * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O
- * without involving decision-making inside HDF5
+ * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O
+ * without involving decision-making inside HDF5
*
- * Note: The library will do linked chunk I/O or multi-chunk I/O without
- * involving communications for decision-making process.
- * The library won't behave as it asks for only when we find
- * that the low-level MPI-IO package doesn't support this.
+ * Note: The library will do linked chunk I/O or multi-chunk I/O without
+ * involving communications for decision-making process.
+ * The library won't behave as it asks for only when we find
+ * that the low-level MPI-IO package doesn't support this.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Kent Yang
- * ? ?, ?
+ * Programmer: Kent Yang
*
*-------------------------------------------------------------------------
*/
@@ -586,19 +584,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pset_dxpl_mpio_chunk_opt_num
+ * Function: H5Pset_dxpl_mpio_chunk_opt_num
*
- * Purpose: To set a threshold for doing linked chunk IO
+ * Purpose: To set a threshold for doing linked chunk IO
*
- * Note: If the number is greater than the threshold set by the user,
- * the library will do linked chunk I/O; otherwise, I/O will be
- * done for every chunk.
+ * Note: If the number is greater than the threshold set by the user,
+ * the library will do linked chunk I/O; otherwise, I/O will be
+ * done for every chunk.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Kent Yang
- * ? ?, ?
+ * Programmer: Kent Yang
*
*-------------------------------------------------------------------------
*/
@@ -627,22 +624,21 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pset_dxpl_mpio_chunk_opt_ratio
+ * Function: H5Pset_dxpl_mpio_chunk_opt_ratio
*
- * Purpose: To set a threshold for doing collective I/O for each chunk
+ * Purpose: To set a threshold for doing collective I/O for each chunk
*
- * Note: The library will calculate the percentage of the number of
- * process holding selections at each chunk. If that percentage
- * of number of process in the individual chunk is greater than
- * the threshold set by the user, the library will do collective
- * chunk I/O for this chunk; otherwise, independent I/O will be
- * done for this chunk.
+ * Note: The library will calculate the percentage of the number of
+ * process holding selections at each chunk. If that percentage
+ * of number of process in the individual chunk is greater than
+ * the threshold set by the user, the library will do collective
+ * chunk I/O for this chunk; otherwise, independent I/O will be
+ * done for this chunk.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Kent Yang
- * ? ?, ?
+ * Programmer: Kent Yang
*
*-------------------------------------------------------------------------
*/
@@ -671,16 +667,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD__mpio_fapl_get
+ * Function: H5FD__mpio_fapl_get
*
- * Purpose: Returns a file access property list which could be used to
- * create another file the same as this one.
+ * Purpose: Returns a file access property list which could be used to
+ * create another file the same as this one.
*
- * Return: Success: Ptr to new file access property list with all
- * fields copied from the file pointer.
- * Failure: NULL
+ * Return: Success: Ptr to new file access property list with all
+ * fields copied from the file pointer.
+ * Failure: NULL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, August 13, 1999
*
*-------------------------------------------------------------------------
@@ -688,9 +684,9 @@ done:
static void *
H5FD__mpio_fapl_get(H5FD_t *_file)
{
- H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
- H5FD_mpio_fapl_t *fa = NULL;
- void *ret_value; /* Return value */
+ H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
+ H5FD_mpio_fapl_t *fa = NULL;
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -701,28 +697,38 @@ H5FD__mpio_fapl_get(H5FD_t *_file)
/* Check arguments */
if(NULL == (fa = (H5FD_mpio_fapl_t *)H5MM_calloc(sizeof(H5FD_mpio_fapl_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ fa->comm = MPI_COMM_NULL;
+ fa->info = MPI_INFO_NULL;
- /* Duplicate communicator and Info object. */
- if(FAIL == H5FD_mpi_comm_info_dup(file->comm, file->info, &fa->comm, &fa->info))
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed")
+ /* Duplicate MPI communicator and info */
+ if(FAIL == H5_mpi_comm_dup(file->comm, &fa->comm))
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "communicator duplicate failed")
+ if(FAIL == H5_mpi_info_dup(file->info, &fa->info))
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "info duplicate failed")
/* Set return value */
ret_value = fa;
done:
+ /* Clean up badness if we're failing */
+ if(NULL == ret_value && fa) {
+ H5_mpi_comm_free(&fa->comm);
+ H5_mpi_info_free(&fa->info);
+ H5MM_xfree(fa);
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__mpio_fapl_get() */
/*-------------------------------------------------------------------------
- * Function: H5FD__mpio_fapl_copy
+ * Function: H5FD__mpio_fapl_copy
*
- * Purpose: Copies the mpio-specific file access properties.
+ * Purpose: Copies the mpio-specific file access properties.
*
- * Return: Success: Ptr to a new property list
- * Failure: NULL
+ * Return: Success: Ptr to a new property list
+ * Failure: NULL
*
- * Programmer: Albert Cheng
+ * Programmer: Albert Cheng
* Jan 8, 2003
*
*-------------------------------------------------------------------------
@@ -730,9 +736,9 @@ done:
static void *
H5FD__mpio_fapl_copy(const void *_old_fa)
{
- const H5FD_mpio_fapl_t *old_fa = (const H5FD_mpio_fapl_t*)_old_fa;
- H5FD_mpio_fapl_t *new_fa = NULL;
- void *ret_value = NULL;
+ const H5FD_mpio_fapl_t *old_fa = (const H5FD_mpio_fapl_t*)_old_fa;
+ H5FD_mpio_fapl_t *new_fa = NULL;
+ void *ret_value = NULL;
FUNC_ENTER_STATIC
@@ -747,18 +753,22 @@ if(H5FD_mpio_Debug[(int)'t'])
/* Copy the general information */
H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_mpio_fapl_t));
- /* Duplicate communicator and Info object. */
- if(H5FD_mpi_comm_info_dup(old_fa->comm, old_fa->info, &new_fa->comm, &new_fa->info) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed")
+ /* Duplicate MPI communicator and info */
+ if(H5_mpi_comm_dup(old_fa->comm, &new_fa->comm) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "communicator duplicate failed")
+ if(H5_mpi_info_dup(old_fa->info, &new_fa->info) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "info duplicate failed")
/* Set return value */
ret_value = new_fa;
done:
- if(NULL == ret_value)
- /* cleanup */
- if(new_fa)
- H5MM_xfree(new_fa);
+ /* Clean up badness if we're failing */
+ if(NULL == ret_value && new_fa) {
+ H5_mpi_comm_free(&new_fa->comm);
+ H5_mpi_info_free(&new_fa->info);
+ H5MM_xfree(new_fa);
+ }
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
@@ -770,14 +780,13 @@ if(H5FD_mpio_Debug[(int)'t'])
/*-------------------------------------------------------------------------
- * Function: H5FD__mpio_fapl_free
+ * Function: H5FD__mpio_fapl_free
*
- * Purpose: Frees the mpio-specific file access properties.
+ * Purpose: Frees the mpio-specific file access properties.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: SUCCEED/FAIL
*
- * Programmer: Albert Cheng
+ * Programmer: Albert Cheng
* Jan 8, 2003
*
*-------------------------------------------------------------------------
@@ -785,10 +794,9 @@ if(H5FD_mpio_Debug[(int)'t'])
static herr_t
H5FD__mpio_fapl_free(void *_fa)
{
- H5FD_mpio_fapl_t *fa = (H5FD_mpio_fapl_t*)_fa;
- herr_t ret_value = SUCCEED;
+ H5FD_mpio_fapl_t *fa = (H5FD_mpio_fapl_t*)_fa;
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
@@ -800,7 +808,8 @@ if(H5FD_mpio_Debug[(int)'t'])
/* Free the internal communicator and INFO object */
HDassert(MPI_COMM_NULL != fa->comm);
- H5FD_mpi_comm_info_free(&fa->comm, &fa->info);
+ H5_mpi_comm_free(&fa->comm);
+ H5_mpi_info_free(&fa->info);
H5MM_xfree(fa);
#ifdef H5FDmpio_DEBUG
@@ -808,21 +817,19 @@ if(H5FD_mpio_Debug[(int)'t'])
HDfprintf(stderr, "%s: leaving\n", FUNC);
#endif
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD__mpio_fapl_free() */
/*-------------------------------------------------------------------------
- * Function: H5FD_set_mpio_atomicity
- *
- * Purpose: Sets the atomicity mode
+ * Function: H5FD_set_mpio_atomicity
*
- * Return: Success: Non-negative
+ * Purpose: Sets the atomicity mode
*
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
- * Programmer: Mohamad Chaarawi
- * Feb 14, 2012
+ * Programmer: Mohamad Chaarawi
+ * Feb 14, 2012
*
*-------------------------------------------------------------------------
*/
@@ -838,7 +845,7 @@ H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag)
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ HDfprintf(stdout, "%s: Entering\n", FUNC);
#endif
if(FALSE == flag)
@@ -853,7 +860,7 @@ H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag)
done:
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ HDfprintf(stdout, "%s: Leaving\n", FUNC);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -861,16 +868,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_get_mpio_atomicity
- *
- * Purpose: Returns the atomicity mode
+ * Function: H5FD_get_mpio_atomicity
*
- * Return: Success: Non-negative
+ * Purpose: Returns the atomicity mode
*
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
- * Programmer: Mohamad Chaarawi
- * Feb 14, 2012
+ * Programmer: Mohamad Chaarawi
+ * Feb 14, 2012
*
*-------------------------------------------------------------------------
*/
@@ -886,7 +891,7 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag)
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ HDfprintf(stdout, "%s: Entering\n", FUNC);
#endif
/* Get atomicity value */
@@ -901,7 +906,7 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag)
done:
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ HDfprintf(stdout, "%s: Leaving\n", FUNC);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -912,14 +917,14 @@ done:
* Function: H5FD__mpio_open
*
* Purpose: Opens a file with name NAME. The FLAGS are a bit field with
- * purpose similar to the second argument of open(2) and which
- * are defined in H5Fpublic.h. The file access property list
- * FAPL_ID contains the properties driver properties and MAXADDR
- * is the largest address which this file will be expected to
- * access. This is collective.
+ * purpose similar to the second argument of open(2) and which
+ * are defined in H5Fpublic.h. The file access property list
+ * FAPL_ID contains the properties driver properties and MAXADDR
+ * is the largest address which this file will be expected to
+ * access. This is collective.
*
- * Return: Success: A new file pointer.
- * Failure: NULL
+ * Return: Success: A new file pointer
+ * Failure: NULL
*
* Programmer: Robert Kim Yates
* January 30, 1998
@@ -943,30 +948,32 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id,
H5P_genplist_t *plist; /* Property list pointer */
MPI_Comm comm_dup = MPI_COMM_NULL;
MPI_Info info_dup = MPI_INFO_NULL;
- H5FD_t *ret_value; /* Return value */
+ H5FD_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", FUNC, name, flags, (int)fapl_id, (unsigned long)maxaddr);
+ HDfprintf(stdout, "%s: Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", FUNC, name, flags, (int)fapl_id, (unsigned long)maxaddr);
#endif
/* Obtain a pointer to mpio-specific file access properties */
if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
if(H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MPIO != H5P_peek_driver(plist)) {
- _fa.comm = MPI_COMM_SELF; /*default*/
- _fa.info = MPI_INFO_NULL; /*default*/
- fa = &_fa;
+ _fa.comm = MPI_COMM_SELF; /*default*/
+ _fa.info = MPI_INFO_NULL; /*default*/
+ fa = &_fa;
} /* end if */
else
if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_peek_driver_info(plist)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
- /* Duplicate communicator and Info object for use by this file. */
- if(FAIL == H5FD_mpi_comm_info_dup(fa->comm, fa->info, &comm_dup, &info_dup))
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed")
+ /* Duplicate MPI communicator and info */
+ if(FAIL == H5_mpi_comm_dup(fa->comm, &comm_dup))
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "communicator duplicate failed")
+ if(FAIL == H5_mpi_info_dup(fa->info, &info_dup))
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "info duplicate failed")
/* convert HDF5 flags to MPI-IO flags */
/* some combinations are illegal; let MPI-IO figure it out */
@@ -1046,12 +1053,10 @@ done:
if(ret_value == NULL) {
if(file_opened)
MPI_File_close(&fh);
- if(MPI_COMM_NULL != comm_dup)
- MPI_Comm_free(&comm_dup);
- if(MPI_INFO_NULL != info_dup)
- MPI_Info_free(&info_dup);
- if(file)
- H5MM_xfree(file);
+ MPI_Comm_free(&comm_dup);
+ MPI_Info_free(&info_dup);
+ if(file)
+ H5MM_xfree(file);
} /* end if */
#ifdef H5FDmpio_DEBUG
@@ -1068,8 +1073,7 @@ done:
*
* Purpose: Closes a file. This is collective.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Unknown
* January 30, 1998
@@ -1079,15 +1083,15 @@ done:
static herr_t
H5FD__mpio_close(H5FD_t *_file)
{
- H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
- int mpi_code; /* MPI return code */
+ H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
+ int mpi_code; /* MPI return code */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ HDfprintf(stdout, "%s: Entering\n", FUNC);
#endif
/* Sanity checks */
@@ -1099,13 +1103,14 @@ H5FD__mpio_close(H5FD_t *_file)
HMPI_GOTO_ERROR(FAIL, "MPI_File_close failed", mpi_code)
/* Clean up other stuff */
- H5FD_mpi_comm_info_free(&file->comm, &file->info);
+ H5_mpi_comm_free(&file->comm);
+ H5_mpi_info_free(&file->info);
H5MM_xfree(file);
done:
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ HDfprintf(stdout, "%s: Leaving\n", FUNC);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -1113,15 +1118,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD__mpio_query
+ * Function: H5FD__mpio_query
*
- * Purpose: Set the flags that this VFL driver is capable of supporting.
+ * Purpose: Set the flags that this VFL driver is capable of supporting.
* (listed in H5FDpublic.h)
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Friday, August 25, 2000
*
*-------------------------------------------------------------------------
@@ -1129,7 +1133,7 @@ done:
static herr_t
H5FD__mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out */)
{
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Set the VFL feature flags that this driver supports */
if(flags) {
@@ -1146,16 +1150,16 @@ H5FD__mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out
/*-------------------------------------------------------------------------
- * Function: H5FD__mpio_get_eoa
+ * Function: H5FD__mpio_get_eoa
*
- * Purpose: Gets the end-of-address marker for the file. The EOA marker
- * is the first address past the last byte allocated in the
- * format address space.
+ * Purpose: Gets the end-of-address marker for the file. The EOA marker
+ * is the first address past the last byte allocated in the
+ * format address space.
*
- * Return: Success: The end-of-address marker.
- * Failure: HADDR_UNDEF
+ * Return: Success: The end-of-address marker
+ * Failure: HADDR_UNDEF
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, August 6, 1999
*
*-------------------------------------------------------------------------
@@ -1163,9 +1167,9 @@ H5FD__mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out
static haddr_t
H5FD__mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
{
- const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
+ const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(file);
@@ -1176,16 +1180,15 @@ H5FD__mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
/*-------------------------------------------------------------------------
- * Function: H5FD__mpio_set_eoa
+ * Function: H5FD__mpio_set_eoa
*
- * Purpose: Set the end-of-address marker for the file. This function is
- * called shortly after an existing HDF5 file is opened in order
- * to tell the driver where the end of the HDF5 data is located.
+ * Purpose: Set the end-of-address marker for the file. This function is
+ * called shortly after an existing HDF5 file is opened in order
+ * to tell the driver where the end of the HDF5 data is located.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: SUCCEED/FAIL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, August 6, 1999
*
*-------------------------------------------------------------------------
@@ -1193,9 +1196,9 @@ H5FD__mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
static herr_t
H5FD__mpio_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr)
{
- H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
+ H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(file);
@@ -1208,27 +1211,27 @@ H5FD__mpio_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr)
/*-------------------------------------------------------------------------
- * Function: H5FD__mpio_get_eof
+ * Function: H5FD__mpio_get_eof
*
- * Purpose: Gets the end-of-file marker for the file. The EOF marker
- * is the real size of the file.
+ * Purpose: Gets the end-of-file marker for the file. The EOF marker
+ * is the real size of the file.
*
- * The MPIO driver doesn't bother keeping this field updated
- * since that's a relatively expensive operation. Fortunately
- * the library only needs the EOF just after the file is opened
- * in order to determine whether the file is empty, truncated,
- * or okay. Therefore, any MPIO I/O function will set its value
- * to HADDR_UNDEF which is the error return value of this
- * function.
+ * The MPIO driver doesn't bother keeping this field updated
+ * since that's a relatively expensive operation. Fortunately
+ * the library only needs the EOF just after the file is opened
+ * in order to determine whether the file is empty, truncated,
+ * or okay. Therefore, any MPIO I/O function will set its value
+ * to HADDR_UNDEF which is the error return value of this
+ * function.
*
* Keeping the EOF updated (during write calls) is expensive
* because any process may extend the physical end of the
* file. -QAK
*
- * Return: Success: The end-of-address marker.
- * Failure: HADDR_UNDEF
+ * Return: Success: The end-of-file marker
+ * Failure: HADDR_UNDEF
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, August 6, 1999
*
*-------------------------------------------------------------------------
@@ -1236,9 +1239,9 @@ H5FD__mpio_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr)
static haddr_t
H5FD__mpio_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
{
- const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
+ const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(file);
@@ -1253,7 +1256,7 @@ H5FD__mpio_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
*
* Purpose: Returns the file handle of MPIO file driver.
*
- * Returns: Non-negative if succeed or negative if fails.
+ * Returns: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Sept. 16, 2002
@@ -1283,13 +1286,11 @@ done:
*
* Purpose: Returns the file info of MPIO file driver.
*
- * Returns: Non-negative if succeed or negative if fails.
+ * Returns: SUCCEED/FAIL
*
* Programmer: John Mainzer
* April 4, 2017
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1312,23 +1313,23 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD__mpio_read
+ * Function: H5FD__mpio_read
*
- * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR
- * into buffer BUF according to data transfer properties in
- * DXPL_ID using potentially complex file and buffer types to
- * effect the transfer.
+ * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR
+ * into buffer BUF according to data transfer properties in
+ * DXPL_ID using potentially complex file and buffer types to
+ * effect the transfer.
*
- * Reading past the end of the MPI file returns zeros instead of
- * failing. MPI is able to coalesce requests from different
- * processes (collective or independent).
+ * Reading past the end of the MPI file returns zeros instead of
+ * failing. MPI is able to coalesce requests from different
+ * processes (collective or independent).
*
- * Return: Success: Zero. Result is stored in caller-supplied
- * buffer BUF.
+ * Return: Success: SUCCEED. Result is stored in caller-supplied
+ * buffer BUF.
*
- * Failure: -1, Contents of buffer BUF are undefined.
+ * Failure: FAIL. Contents of buffer BUF are undefined.
*
- * Programmer: rky, 1998-01-30
+ * Programmer: rky, 1998-01-30
*
*-------------------------------------------------------------------------
*/
@@ -1531,22 +1532,22 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD__mpio_write
+ * Function: H5FD__mpio_write
*
- * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR
- * from buffer BUF according to data transfer properties in
- * DXPL_ID using potentially complex file and buffer types to
- * effect the transfer.
+ * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR
+ * from buffer BUF according to data transfer properties in
+ * DXPL_ID using potentially complex file and buffer types to
+ * effect the transfer.
*
- * MPI is able to coalesce requests from different processes
- * (collective and independent).
+ * MPI is able to coalesce requests from different processes
+ * (collective and independent).
*
- * Return: Success: Zero. USE_TYPES and OLD_USE_TYPES in the
- * access params are altered.
- * Failure: -1, USE_TYPES and OLD_USE_TYPES in the
- * access params may be altered.
+ * Return: Success: SUCCEED. USE_TYPES and OLD_USE_TYPES in the
+ * access params are altered.
+ * Failure: FAIL. USE_TYPES and OLD_USE_TYPES in the
+ * access params may be altered.
*
- * Programmer: Robert Kim Yates
+ * Programmer: Robert Kim Yates
* January 30, 1998
*
*-------------------------------------------------------------------------
@@ -1555,13 +1556,13 @@ static herr_t
H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
haddr_t addr, size_t size, const void *buf)
{
- H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
- MPI_Offset mpi_off;
- MPI_Status mpi_stat; /* Status from I/O operation */
- MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */
- int mpi_code; /* MPI return code */
+ H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
+ MPI_Offset mpi_off;
+ MPI_Status mpi_stat; /* Status from I/O operation */
+ MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */
+ int mpi_code; /* MPI return code */
#if MPI_VERSION >= 3
- MPI_Count bytes_written;
+ MPI_Count bytes_written;
MPI_Count type_size; /* MPI datatype used for I/O's size */
MPI_Count io_size; /* Actual number of bytes requested */
#else
@@ -1570,15 +1571,15 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
int io_size; /* Actual number of bytes requested */
#endif
int size_i;
- hbool_t use_view_this_time = FALSE;
+ hbool_t use_view_this_time = FALSE;
H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ HDfprintf(stdout, "%s: Entering\n", FUNC);
#endif
/* Sanity checks */
@@ -1615,7 +1616,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
* could mean "use MPI_BYTE" by convention).
*/
if(xfer_mode == H5FD_MPIO_COLLECTIVE) {
- MPI_Datatype file_type;
+ MPI_Datatype file_type;
/* Remember that views are used */
use_view_this_time = TRUE;
@@ -1713,7 +1714,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
done:
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value );
+ HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value );
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -1725,9 +1726,7 @@ done:
*
* Purpose: Makes sure that all data is on disk. This is collective.
*
- * Return: Success: Non-negative
- *
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* January 30, 1998
@@ -1737,15 +1736,15 @@ done:
static herr_t
H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
{
- H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
- int mpi_code; /* mpi return code */
- herr_t ret_value = SUCCEED;
+ H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
+ int mpi_code; /* mpi return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ HDfprintf(stdout, "%s: Entering\n", FUNC);
#endif
/* Sanity checks */
@@ -1760,7 +1759,7 @@ H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
done:
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ HDfprintf(stdout, "%s: Leaving\n", FUNC);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -1782,8 +1781,7 @@ done:
* only call MPI_File_set_size() if this value disagrees
* with the current eoa.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* January 31, 2008
@@ -1793,14 +1791,14 @@ done:
static herr_t
H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing)
{
- H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
+ H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ HDfprintf(stdout, "%s: Entering\n", FUNC);
#endif
/* Sanity checks */
@@ -1869,7 +1867,7 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR
done:
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ HDfprintf(stdout, "%s: Leaving\n", FUNC);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -1877,14 +1875,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD__mpio_mpi_rank
+ * Function: H5FD__mpio_mpi_rank
*
- * Purpose: Returns the MPI rank for a process
+ * Purpose: Returns the MPI rank for a process
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: non-negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, May 16, 2002
*
*-------------------------------------------------------------------------
@@ -1892,9 +1890,9 @@ done:
static int
H5FD__mpio_mpi_rank(const H5FD_t *_file)
{
- const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
+ const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(file);
@@ -1905,14 +1903,14 @@ H5FD__mpio_mpi_rank(const H5FD_t *_file)
/*-------------------------------------------------------------------------
- * Function: H5FD__mpio_mpi_size
+ * Function: H5FD__mpio_mpi_size
*
- * Purpose: Returns the number of MPI processes
+ * Purpose: Returns the number of MPI processes
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: non-negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, May 16, 2002
*
*-------------------------------------------------------------------------
@@ -1920,9 +1918,9 @@ H5FD__mpio_mpi_rank(const H5FD_t *_file)
static int
H5FD__mpio_mpi_size(const H5FD_t *_file)
{
- const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
+ const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(file);
@@ -1933,15 +1931,14 @@ H5FD__mpio_mpi_size(const H5FD_t *_file)
/*-------------------------------------------------------------------------
- * Function: H5FD__mpio_communicator
- *
- * Purpose: Returns the MPI communicator for the file.
+ * Function: H5FD__mpio_communicator
*
- * Return: Success: The communicator
+ * Purpose: Returns the MPI communicator for the file.
*
- * Failure: NULL
+ * Return: Success: The communicator
+ * Failure: Can't fail
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, August 9, 1999
*
*-------------------------------------------------------------------------
@@ -1949,9 +1946,9 @@ H5FD__mpio_mpi_size(const H5FD_t *_file)
static MPI_Comm
H5FD__mpio_communicator(const H5FD_t *_file)
{
- const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
+ const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(file);
@@ -1971,8 +1968,6 @@ H5FD__mpio_communicator(const H5FD_t *_file)
* Programmer: John Mainzer
* April 4, 2017
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index c79d676..0db66af 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -160,9 +160,6 @@ H5_DLL herr_t H5FD_set_paged_aggr(H5FD_t *file, hbool_t paged);
/* General routines */
H5_DLL haddr_t H5FD_mpi_MPIOff_to_haddr(MPI_Offset mpi_off);
H5_DLL herr_t H5FD_mpi_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/);
-H5_DLL herr_t H5FD_mpi_comm_info_dup(MPI_Comm comm, MPI_Info info,
- MPI_Comm *comm_new, MPI_Info *info_new);
-H5_DLL herr_t H5FD_mpi_comm_info_free(MPI_Comm *comm, MPI_Info *info);
#ifdef NOT_YET
H5_DLL herr_t H5FD_mpio_wait_for_left_neighbor(H5FD_t *file);
H5_DLL herr_t H5FD_mpio_signal_right_neighbor(H5FD_t *file);
diff --git a/src/H5FDros3.c b/src/H5FDros3.c
index 86642aa..18f1f91 100644
--- a/src/H5FDros3.c
+++ b/src/H5FDros3.c
@@ -11,12 +11,12 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Read-Only S3 Virtual File Driver (VFD)
+ * Read-Only S3 Virtual File Driver (VFD)
*
* Programmer: Jacob Smith <jake.smith@hdfgroup.org>
* 2017-10-13
*
- * Purpose:
+ * Purpose:
*
* Provide read-only access to files hosted on Amazon's S3 service.
* Relies on "s3comms" utility layer to implement the AWS REST API.
@@ -137,9 +137,9 @@ typedef struct {
*
* Purpose:
*
- * H5FD_ros3_t is a structure used to store all information needed to
+ * H5FD_ros3_t is a structure used to store all information needed to
* maintain R/O access to a single HDF5 file that has been stored as a
- * S3 object. This structure is created when such a file is "opened" and
+ * S3 object. This structure is created when such a file is "opened" and
* discarded when it is "closed".
*
* Presents an S3 object as a file to the HDF5 library.
@@ -154,7 +154,7 @@ typedef struct {
*
* `fa` (H5FD_ros3_fapl_t)
*
- * Instance of `H5FD_ros3_fapl_t` containing the S3 configuration data
+ * Instance of `H5FD_ros3_fapl_t` containing the S3 configuration data
* needed to "open" the HDF5 file.
*
* `eoa` (haddr_t)
@@ -163,9 +163,9 @@ typedef struct {
* equal the file size.
*
* `s3r_handle` (s3r_t *)
- *
+ *
* Instance of S3 Request handle associated with the target resource.
- * Responsible for communicating with remote host and presenting file
+ * Responsible for communicating with remote host and presenting file
* contents as indistinguishable from a file on the local filesystem.
*
* *** present only if ROS3_SATS is flagged to enable stats collection ***
@@ -211,10 +211,13 @@ typedef struct H5FD_ros3_t {
* ADDR_OVERFLOW: Checks whether a file address of type `haddr_t'
* is too large to be represented by the second argument
* of the file seek function.
+ * Only included if it may be used -- ROS3 VFD is enabled.
*
*/
#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1)
+#ifdef H5_HAVE_ROS3_VFD
#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR))
+#endif /* H5_HAVE_ROS3_VFD */
/* Prototypes */
static herr_t H5FD_ros3_term(void);
@@ -229,13 +232,13 @@ static herr_t H5FD_ros3_query(const H5FD_t *_f1, unsigned long *flags);
static haddr_t H5FD_ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_ros3_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
static haddr_t H5FD_ros3_get_eof(const H5FD_t *_file, H5FD_mem_t type);
-static herr_t H5FD_ros3_get_handle(H5FD_t *_file, hid_t fapl,
+static herr_t H5FD_ros3_get_handle(H5FD_t *_file, hid_t fapl,
void** file_handle);
-static herr_t H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id,
+static herr_t H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id,
haddr_t addr, size_t size, void *buf);
-static herr_t H5FD_ros3_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id,
+static herr_t H5FD_ros3_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id,
haddr_t addr, size_t size, const void *buf);
-static herr_t H5FD_ros3_truncate(H5FD_t *_file, hid_t dxpl_id,
+static herr_t H5FD_ros3_truncate(H5FD_t *_file, hid_t dxpl_id,
hbool_t closing);
static herr_t H5FD_ros3_lock(H5FD_t *_file, hbool_t rw);
static herr_t H5FD_ros3_unlock(H5FD_t *_file);
@@ -276,8 +279,10 @@ static const H5FD_class_t H5FD_ros3_g = {
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
+#ifdef H5_HAVE_ROS3_VFD
/* Declare a free list to manage the H5FD_ros3_t struct */
H5FL_DEFINE_STATIC(H5FD_ros3_t);
+#endif /* H5_HAVE_ROS3_VFD */
/*-------------------------------------------------------------------------
@@ -300,14 +305,14 @@ H5FD__init_package(void)
FUNC_ENTER_STATIC
if (H5FD_ros3_init() < 0) {
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL,
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL,
"unable to initialize ros3 VFD")
}
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FD__init_package() */
+} /* end H5FD__init_package() */
/*-------------------------------------------------------------------------
@@ -330,7 +335,7 @@ done:
hid_t
H5FD_ros3_init(void)
{
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_NOAPI(FAIL)
@@ -388,6 +393,7 @@ H5FD_ros3_term(void)
H5FD_ROS3_g = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
+
} /* end H5FD_ros3_term() */
@@ -395,8 +401,8 @@ H5FD_ros3_term(void)
* Function: H5Pset_fapl_ros3
*
* Purpose: Modify the file access property list to use the H5FD_ROS3
- * driver defined in this source file. All driver specfic
- * properties are passed in as a pointer to a suitably
+ * driver defined in this source file. All driver specfic
+ * properties are passed in as a pointer to a suitably
* initialized instance of H5FD_ros3_fapl_t
*
* Return: SUCCEED/FAIL
@@ -407,14 +413,12 @@ H5FD_ros3_term(void)
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_fapl_ros3(hid_t fapl_id,
+H5Pset_fapl_ros3(hid_t fapl_id,
H5FD_ros3_fapl_t *fa)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = FAIL;
-
-
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", fapl_id, fa);
@@ -425,21 +429,21 @@ H5Pset_fapl_ros3(hid_t fapl_id,
#endif
plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS);
- if (plist == NULL) {
+ if (plist == NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, \
"not a file access property list")
}
- if (FAIL == H5FD_ros3_validate_config(fa))
+ if (FAIL == H5FD_ros3_validate_config(fa)) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid ros3 config")
+ }
ret_value = H5P_set_driver(plist, H5FD_ROS3, (void *)fa);
done:
-
FUNC_LEAVE_API(ret_value)
-} /* H5Pset_fapl_ros3() */
+} /* end H5Pset_fapl_ros3() */
/*-------------------------------------------------------------------------
@@ -449,12 +453,12 @@ done:
* contains internally consistant data. Return SUCCEED if so,
* and FAIL otherwise.
*
- * Note the difference between internally consistant and
- * correct. As we will have to try to access the target
+ * Note the difference between internally consistant and
+ * correct. As we will have to try to access the target
* object to determine whether the supplied data is correct,
* we will settle for internal consistancy at this point
*
- * Return: SUCCEED if instance of H5FD_ros3_fapl_t contains internally
+ * Return: SUCCEED if instance of H5FD_ros3_fapl_t contains internally
* consistant data, FAIL otherwise.
*
* Programmer: Jacob Smith
@@ -494,7 +498,7 @@ H5FD_ros3_validate_config(const H5FD_ros3_fapl_t * fa)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FD_ros3_validate_config() */
+} /* end H5FD_ros3_validate_config() */
/*-------------------------------------------------------------------------
@@ -515,12 +519,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_fapl_ros3(hid_t fapl_id,
+H5Pget_fapl_ros3(hid_t fapl_id,
H5FD_ros3_fapl_t *fa_out)
{
- const H5FD_ros3_fapl_t *fa;
- H5P_genplist_t *plist = NULL; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5FD_ros3_fapl_t *fa = NULL;
+ H5P_genplist_t *plist = NULL;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", fapl_id, fa_out);
@@ -529,8 +533,9 @@ H5Pget_fapl_ros3(hid_t fapl_id,
HDfprintf(stdout, "H5Pget_fapl_ros3() called.\n");
#endif
- if (fa_out == NULL)
+ if (fa_out == NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL")
+ }
plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS);
if (plist == NULL) {
@@ -552,7 +557,7 @@ H5Pget_fapl_ros3(hid_t fapl_id,
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Pget_fapl_ros3() */
+} /* end H5Pget_fapl_ros3() */
/*-------------------------------------------------------------------------
@@ -583,7 +588,7 @@ H5FD_ros3_fapl_get(H5FD_t *_file)
fa = (H5FD_ros3_fapl_t *)H5MM_calloc(sizeof(H5FD_ros3_fapl_t));
if (fa == NULL) {
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed")
}
@@ -595,12 +600,13 @@ H5FD_ros3_fapl_get(H5FD_t *_file)
done:
if (ret_value == NULL) {
- if (fa != NULL)
- H5MM_xfree(fa);
+ if (fa != NULL) {
+ H5MM_xfree(fa);
+ }
}
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FD_ros3_fapl_get() */
+} /* end H5FD_ros3_fapl_get() */
/*-------------------------------------------------------------------------
@@ -624,13 +630,13 @@ H5FD_ros3_fapl_copy(const void *_old_fa)
{
const H5FD_ros3_fapl_t *old_fa = (const H5FD_ros3_fapl_t*)_old_fa;
H5FD_ros3_fapl_t *new_fa = NULL;
- void *ret_value = NULL; /* Return value */
+ void *ret_value = NULL;
FUNC_ENTER_NOAPI_NOINIT
new_fa = (H5FD_ros3_fapl_t *)H5MM_malloc(sizeof(H5FD_ros3_fapl_t));
if (new_fa == NULL) {
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
@@ -639,12 +645,13 @@ H5FD_ros3_fapl_copy(const void *_old_fa)
done:
if (ret_value == NULL) {
- if (new_fa != NULL)
+ if (new_fa != NULL) {
H5MM_xfree(new_fa);
+ }
}
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FD_ros3_fapl_copy() */
+} /* end H5FD_ros3_fapl_copy() */
/*-------------------------------------------------------------------------
@@ -668,13 +675,13 @@ H5FD_ros3_fapl_free(void *_fa)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- HDassert(fa != NULL); /* sanity check */
+ HDassert(fa != NULL); /* sanity check */
H5MM_xfree(fa);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5FD_ros3_fapl_free() */
+} /* end H5FD_ros3_fapl_free() */
#if ROS3_STATS
@@ -707,7 +714,6 @@ ros3_reset_stats(H5FD_ros3_t *file)
unsigned i = 0;
herr_t ret_value = SUCCEED;
-
FUNC_ENTER_NOAPI_NOINIT
#if ROS3_DEBUG
@@ -734,7 +740,8 @@ ros3_reset_stats(H5FD_ros3_t *file)
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* ros3_reset_stats */
+} /* end ros3_reset_stats() */
+
#endif /* ROS3_STATS */
@@ -747,10 +754,10 @@ done:
* Create and/or opens a file as an HDF5 file.
*
* Any flag except H5F_ACC_RDONLY will cause an error.
- *
+ *
* Name (as received from `H5FD_open()`) must conform to web url:
* NAME :: HTTP "://" DOMAIN [PORT] ["/" [URI] [QUERY] ]
- * HTTP :: "http" [ "s" ]
+ * HTTP :: "http" [ "s" ]
* DOMAIN :: e.g., "mybucket.host.org"
* PORT :: ":" <number> (e.g., ":9000" )
* URI :: <string> (e.g., "path/to/resource.hd5" )
@@ -758,8 +765,8 @@ done:
*
* Return:
*
- * Success: A pointer to a new file data structure.
- * The public fields will be initialized by the caller, which is
+ * Success: A pointer to a new file data structure.
+ * The public fields will be initialized by the caller, which is
* always H5FD_open().
*
* Failure: NULL
@@ -771,32 +778,31 @@ done:
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_ROS3_VFD
+
static H5FD_t *
-H5FD_ros3_open(const char *url,
- unsigned flags,
- hid_t fapl_id,
- haddr_t maxaddr)
+H5FD_ros3_open(
+ const char *url,
+ unsigned flags,
+ hid_t fapl_id,
+ haddr_t maxaddr)
{
-#ifdef H5_HAVE_ROS3_VFD
H5FD_ros3_t *file = NULL;
struct tm *now = NULL;
char iso8601now[ISO8601_SIZE];
unsigned char signing_key[SHA256_DIGEST_LENGTH];
s3r_t *handle = NULL;
H5FD_ros3_fapl_t fa;
-#endif
H5FD_t *ret_value = NULL;
FUNC_ENTER_NOAPI_NOINIT
-#ifdef H5_HAVE_ROS3_VFD
#if ROS3_DEBUG
HDfprintf(stdout, "H5FD_ros3_open() called.\n");
#endif
-
/* Sanity check on file offsets */
HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t));
@@ -837,7 +843,7 @@ H5FD_ros3_open(const char *url,
if (FAIL == H5FD_s3comms_signing_key(signing_key,
(const char *)fa.secret_key,
(const char *)fa.aws_region,
- (const char *)iso8601now) )
+ (const char *)iso8601now) )
{
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL,
"problem while computing signing key")
@@ -854,17 +860,17 @@ H5FD_ros3_open(const char *url,
if (handle == NULL) {
/* If we want to check CURL's say on the matter in a controlled
- * fashion, this is the place to do it, but would need to make a
+ * fashion, this is the place to do it, but would need to make a
* few minor changes to s3comms `s3r_t` and `s3r_read()`.
- */
+ */
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "could not open");
}
- /* create new file struct
+ /* create new file struct
*/
file = H5FL_CALLOC(H5FD_ros3_t);
if (file == NULL) {
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
"unable to allocate file struct")
}
@@ -873,7 +879,7 @@ H5FD_ros3_open(const char *url,
#if ROS3_STATS
if (FAIL == ros3_reset_stats(file)) {
- HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL,
+ HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL,
"unable to reset file statistics")
}
#endif /* ROS3_STATS */
@@ -882,9 +888,9 @@ H5FD_ros3_open(const char *url,
done:
if (ret_value == NULL) {
- if (handle != NULL) {
+ if (handle != NULL) {
if (FAIL == H5FD_s3comms_s3r_close(handle)) {
- HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL,
+ HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL,
"unable to close s3 file handle")
}
}
@@ -892,13 +898,28 @@ done:
file = H5FL_FREE(H5FD_ros3_t, file);
}
curl_global_cleanup(); /* early cleanup because open failed */
- } /* if null return value (error) */
-#endif /* H5_HAVE_ROS3_VFD */
+ } /* end if null return value (error) */
FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_ros3_open() */
+
+#else /* H5_HAVE_ROS3_VFD not defined */
+
+static H5FD_t *
+H5FD_ros3_open(
+ const char H5_ATTR_UNUSED *url,
+ unsigned H5_ATTR_UNUSED flags,
+ hid_t H5_ATTR_UNUSED fapl_id,
+ haddr_t H5_ATTR_UNUSED maxaddr)
+{
+ H5FD_t *ret_value = NULL;
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5FD_ros3_open() */
+#endif /* H5_HAVE_ROS3_VFD */
+
#if ROS3_STATS
/*----------------------------------------------------------------------------
@@ -906,7 +927,7 @@ done:
* Function: ros3_fprint_stats()
*
* Purpose:
- *
+ *
* Tabulate and pretty-print statistics for this virtual file.
*
* Should be called upon file close.
@@ -927,17 +948,17 @@ done:
* - max (largest size read)
* 2. tabulation of "bins", sepraring reads into exponentially-larger
* ranges of size.
- * - columns for number of reads, total bytes, and average size, with
+ * - columns for number of reads, total bytes, and average size, with
* separate sub-colums for raw- and metadata reads.
* - each row represents one bin, identified by the top of its range
- *
+ *
* Bin ranges can be modified with pound-defines at the top of this file.
*
* Bins without any reads in their bounds are not printed.
*
* An "overflow" bin is also present, to catch "big" reads.
*
- * Output for all bins (and range ceiling and average size report)
+ * Output for all bins (and range ceiling and average size report)
* is divied by powers of 1024. By corollary, four digits before the decimal
* is valid.
*
@@ -1050,7 +1071,7 @@ ros3_fprint_stats(FILE *stream,
HDfprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n",
bytes_raw + bytes_meta, bytes_meta, bytes_raw);
- if (count_raw + count_meta == 0)
+ if (count_raw + count_meta == 0)
goto done;
/*************************
@@ -1109,9 +1130,9 @@ ros3_fprint_stats(FILE *stream,
* PRINT INDIVIDUAL BIN STATS *
******************************/
- HDfprintf(stream,
+ HDfprintf(stream,
"BINS # of reads total bytes average size\n");
- HDfprintf(stream,
+ HDfprintf(stream,
" up-to meta raw meta raw meta raw\n");
for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) {
@@ -1129,7 +1150,7 @@ ros3_fprint_stats(FILE *stream,
m = &file->meta[i];
r = &file->raw[i];
- if (r->count == 0 && m->count == 0)
+ if (r->count == 0 && m->count == 0)
continue;
range_end = ros3_stats_boundaries[i];
@@ -1172,7 +1193,7 @@ ros3_fprint_stats(FILE *stream,
re_dub /= 1024.0;
HDassert(suffix_i < sizeof(suffixes));
- HDfprintf(stream,
+ HDfprintf(stream,
" %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n",
re_dub, suffixes[suffix_i], /* bin ceiling */
m->count, /* metadata reads */
@@ -1187,7 +1208,7 @@ ros3_fprint_stats(FILE *stream,
done:
FUNC_LEAVE_NOAPI(ret_value);
-
+
} /* ros3_fprint_stats */
#endif /* ROS3_STATS */
@@ -1201,7 +1222,7 @@ done:
* Close an HDF5 file.
*
* Return:
- *
+ *
* SUCCEED/FAIL
*
* Programmer: Jacob Smith
@@ -1211,57 +1232,63 @@ done:
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_ROS3_VFD
+
static herr_t
-H5FD_ros3_close(H5FD_t *_file)
+H5FD_ros3_close(H5FD_t H5_ATTR_UNUSED *_file)
{
-#ifdef H5_HAVE_ROS3_VFD
H5FD_ros3_t *file = (H5FD_ros3_t *)_file;
herr_t ret_value = SUCCEED;
-#else
- herr_t ret_value = FAIL;
-#endif
-
-
FUNC_ENTER_NOAPI_NOINIT
-#ifdef H5_HAVE_ROS3_VFD
#if ROS3_DEBUG
HDfprintf(stdout, "H5FD_ros3_close() called.\n");
#endif
- /* Sanity checks
+ /* Sanity checks
*/
HDassert(file != NULL);
HDassert(file->s3r_handle != NULL);
- /* Close the underlying request handle
+ /* Close the underlying request handle
*/
if (FAIL == H5FD_s3comms_s3r_close(file->s3r_handle)) {
- HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL,
+ HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL,
"unable to close S3 request handle")
}
#if ROS3_STATS
/* TODO: mechanism to re-target stats printout */
- if (FAIL == ros3_fprint_stats(stdout, file)) {
- HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL,
+ if (ros3_fprint_stats(stdout, file) == FAIL) {
+ HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL,
"problem while writing file statistics")
}
#endif /* ROS3_STATS */
- /* Release the file info
+ /* Release the file info
*/
file = H5FL_FREE(H5FD_ros3_t, file);
done:
curl_global_cleanup(); /* cleanup to answer init on open */
-#endif /* H5_HAVE_ROS3_VFD */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_ros3_close() */
+#else /* H5_HAVE_ROS3_VFD not defined */
+
+static herr_t
+H5FD_ros3_close(H5FD_t H5_ATTR_UNUSED *_file)
+{
+ herr_t ret_value = FAIL;
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_ros3_close() */
+
+#endif /* H5_HAVE_ROS3_VFD */
+
/*-------------------------------------------------------------------------
*
@@ -1269,7 +1296,7 @@ done:
*
* Purpose:
*
- * Compares two files belonging to this driver using an arbitrary
+ * Compares two files belonging to this driver using an arbitrary
* (but consistent) ordering:
*
* + url scheme
@@ -1284,7 +1311,7 @@ done:
* tl;dr -> check URL, check crentials
*
* Return:
- *
+ *
* - Equivalent: 0
* - Not Equivalent: -1
*
@@ -1300,22 +1327,20 @@ done:
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_ROS3_VFD
+
static int
-H5FD_ros3_cmp(const H5FD_t *_f1,
- const H5FD_t *_f2)
+H5FD_ros3_cmp(
+ const H5FD_t *_f1,
+ const H5FD_t *_f2)
{
-#ifdef H5_HAVE_ROS3_VFD
const H5FD_ros3_t *f1 = (const H5FD_ros3_t *)_f1;
const H5FD_ros3_t *f2 = (const H5FD_ros3_t *)_f2;
const parsed_url_t *purl1 = NULL;
const parsed_url_t *purl2 = NULL;
-#endif
int ret_value = 0;
-
-
FUNC_ENTER_NOAPI_NOINIT_NOERR
-#ifdef H5_HAVE_ROS3_VFD
#if ROS3_DEBUG
HDfprintf(stdout, "H5FD_ros3_cmp() called.\n");
@@ -1334,71 +1359,124 @@ H5FD_ros3_cmp(const H5FD_t *_f1,
HDassert(purl2->host != NULL);
/* URL: SCHEME */
- if (HDstrcmp(purl1->scheme, purl2->scheme)) HGOTO_DONE(-1);
+ if (HDstrcmp(purl1->scheme, purl2->scheme)) {
+ HGOTO_DONE(-1);
+ }
/* URL: HOST */
- if (HDstrcmp(purl1->host, purl2->host)) HGOTO_DONE(-1);
+ if (HDstrcmp(purl1->host, purl2->host)) {
+ HGOTO_DONE(-1);
+ }
/* URL: PORT */
if (purl1->port && purl2->port) {
- if (HDstrcmp(purl1->port, purl2->port)) HGOTO_DONE(-1);
- } else if (purl1->port) {
+ if (HDstrcmp(purl1->port, purl2->port)) {
+ HGOTO_DONE(-1);
+ }
+ }
+ else
+ if (purl1->port) {
HGOTO_DONE(-1);
- } else if (purl2->port) {
+ }
+ else
+ if (purl2->port) {
HGOTO_DONE(-1);
}
/* URL: PATH */
if (purl1->path && purl2->path) {
- if (HDstrcmp(purl1->path, purl2->path)) HGOTO_DONE(-1);
- } else if (purl1->path && !purl2->path) {
+ if (HDstrcmp(purl1->path, purl2->path)) {
+ HGOTO_DONE(-1);
+ }
+ }
+ else
+ if (purl1->path && !purl2->path) {
HGOTO_DONE(-1);
- } else if (purl2->path && !purl1->path) {
+ }
+ else
+ if (purl2->path && !purl1->path) {
HGOTO_DONE(-1);
}
/* URL: QUERY */
if (purl1->query && purl2->query) {
- if (HDstrcmp(purl1->query, purl2->query)) HGOTO_DONE(-1);
- } else if (purl1->query && !purl2->query) {
+ if (HDstrcmp(purl1->query, purl2->query)) {
+ HGOTO_DONE(-1);
+ }
+ }
+ else
+ if (purl1->query && !purl2->query) {
HGOTO_DONE(-1);
- } else if (purl2->query && !purl1->query) {
+ }
+ else
+ if (purl2->query && !purl1->query) {
HGOTO_DONE(-1);
}
/* FAPL: AWS_REGION */
if (f1->fa.aws_region[0] != '\0' && f1->fa.aws_region[0] != '\0') {
- if (HDstrcmp(f1->fa.aws_region, f2->fa.aws_region)) HGOTO_DONE(-1);
- } else if (f1->fa.aws_region[0] != '\0') {
+ if (HDstrcmp(f1->fa.aws_region, f2->fa.aws_region)) {
+ HGOTO_DONE(-1);
+ }
+ }
+ else
+ if (f1->fa.aws_region[0] != '\0') {
HGOTO_DONE(-1);
- } else if (f2->fa.aws_region[0] != '\0') {
+ }
+ else
+ if (f2->fa.aws_region[0] != '\0') {
HGOTO_DONE(-1);
}
/* FAPL: SECRET_ID */
if (f1->fa.secret_id[0] != '\0' && f1->fa.secret_id[0] != '\0') {
- if (HDstrcmp(f1->fa.secret_id, f2->fa.secret_id)) HGOTO_DONE(-1);
- } else if (f1->fa.secret_id[0] != '\0') {
+ if (HDstrcmp(f1->fa.secret_id, f2->fa.secret_id)) {
+ HGOTO_DONE(-1);
+ }
+ }
+ else
+ if (f1->fa.secret_id[0] != '\0') {
HGOTO_DONE(-1);
- } else if (f2->fa.secret_id[0] != '\0') {
+ }
+ else
+ if (f2->fa.secret_id[0] != '\0') {
HGOTO_DONE(-1);
}
/* FAPL: SECRET_KEY */
if (f1->fa.secret_key[0] != '\0' && f1->fa.secret_key[0] != '\0') {
- if (HDstrcmp(f1->fa.secret_key, f2->fa.secret_key)) HGOTO_DONE(-1);
- } else if (f1->fa.secret_key[0] != '\0') {
+ if (HDstrcmp(f1->fa.secret_key, f2->fa.secret_key)) {
+ HGOTO_DONE(-1);
+ }
+ }
+ else
+ if (f1->fa.secret_key[0] != '\0') {
HGOTO_DONE(-1);
- } else if (f2->fa.secret_key[0] != '\0') {
+ }
+ else
+ if (f2->fa.secret_key[0] != '\0') {
HGOTO_DONE(-1);
}
-#endif /* H5_HAVE_ROS3_VFD */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FD_ros3_cmp() */
+#else /* H5_HAVE_ROS3_VFD not defined */
+
+static int
+H5FD_ros3_cmp(
+ const H5FD_t H5_ATTR_UNUSED *_f1,
+ const H5FD_t H5_ATTR_UNUSED *_f2)
+{
+ int ret_value = 0;
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5FD_ros3_cmp() */
+
+#endif /* H5_HAVE_ROS3_VFD */
+
/*-------------------------------------------------------------------------
* Function: H5FD_ros3_query
@@ -1406,7 +1484,7 @@ done:
* Purpose: Set the flags that this VFL driver is capable of supporting.
* (listed in H5FDpublic.h)
*
- * Note that since the ROS3 VFD is read only, most flags
+ * Note that since the ROS3 VFD is read only, most flags
* are irrelevant.
*
* The term "set" is highly misleading...
@@ -1420,7 +1498,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file,
+H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file,
unsigned long *flags /* out */)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1433,7 +1511,7 @@ H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file,
if (flags) {
*flags = 0;
/* OK to perform data sieving for faster raw data reads & writes */
- *flags |= H5FD_FEAT_DATA_SIEVE;
+ *flags |= H5FD_FEAT_DATA_SIEVE;
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -1463,7 +1541,7 @@ H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file,
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_ros3_get_eoa(const H5FD_t *_file,
+H5FD_ros3_get_eoa(const H5FD_t *_file,
H5FD_mem_t H5_ATTR_UNUSED type)
{
const H5FD_ros3_t *file = (const H5FD_ros3_t *)_file;
@@ -1499,8 +1577,8 @@ H5FD_ros3_get_eoa(const H5FD_t *_file,
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_ros3_set_eoa(H5FD_t *_file,
- H5FD_mem_t H5_ATTR_UNUSED type,
+H5FD_ros3_set_eoa(H5FD_t *_file,
+ H5FD_mem_t H5_ATTR_UNUSED type,
haddr_t addr)
{
H5FD_ros3_t *file = (H5FD_ros3_t *)_file;
@@ -1528,7 +1606,7 @@ H5FD_ros3_set_eoa(H5FD_t *_file,
*
* Return:
*
- * EOF: the first address past the end of the "file", either the
+ * EOF: the first address past the end of the "file", either the
* filesystem file or the HDF5 file.
*
* Programmer: Jacob Smith
@@ -1537,7 +1615,7 @@ H5FD_ros3_set_eoa(H5FD_t *_file,
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_ros3_get_eof(const H5FD_t *_file,
+H5FD_ros3_get_eof(const H5FD_t *_file,
H5FD_mem_t H5_ATTR_UNUSED type)
{
const H5FD_ros3_t *file = (const H5FD_ros3_t *)_file;
@@ -1573,8 +1651,8 @@ H5FD_ros3_get_eof(const H5FD_t *_file,
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_ros3_get_handle(H5FD_t *_file,
- hid_t H5_ATTR_UNUSED fapl,
+H5FD_ros3_get_handle(H5FD_t *_file,
+ hid_t H5_ATTR_UNUSED fapl,
void **file_handle)
{
H5FD_ros3_t *file = (H5FD_ros3_t *)_file;
@@ -1586,8 +1664,9 @@ H5FD_ros3_get_handle(H5FD_t *_file,
HDfprintf(stdout, "H5FD_ros3_get_handle() called.\n");
#endif
- if(!file_handle)
+ if (!file_handle) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid")
+ }
*file_handle = file->s3r_handle;
@@ -1601,7 +1680,7 @@ done:
*
* Function: H5FD_ros3_read()
*
- * Purpose:
+ * Purpose
*
* Reads SIZE bytes of data from FILE beginning at address ADDR
* into buffer BUF according to data transfer properties in DXPL_ID.
@@ -1622,8 +1701,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_ros3_read(H5FD_t *_file,
- H5FD_mem_t H5_ATTR_UNUSED type,
+H5FD_ros3_read(H5FD_t *_file,
+ H5FD_mem_t H5_ATTR_UNUSED type,
hid_t H5_ATTR_UNUSED dxpl_id,
haddr_t addr, /* start offset */
size_t size, /* length of read */
@@ -1631,13 +1710,13 @@ H5FD_ros3_read(H5FD_t *_file,
{
H5FD_ros3_t *file = (H5FD_ros3_t *)_file;
size_t filesize = 0;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED;
#if ROS3_STATS
/* working variables for storing stats */
ros3_statsbin *bin = NULL;
unsigned bin_i = 0;
#endif /* ROS3_STATS */
-
+
FUNC_ENTER_NOAPI_NOINIT
@@ -1655,7 +1734,7 @@ H5FD_ros3_read(H5FD_t *_file,
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "range exceeds file address")
}
- if (FAIL == H5FD_s3comms_s3r_read(file->s3r_handle, addr, size, buf) ) {
+ if (H5FD_s3comms_s3r_read(file->s3r_handle, addr, size, buf) == FAIL) {
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to execute read")
}
@@ -1664,30 +1743,33 @@ H5FD_ros3_read(H5FD_t *_file,
/* Find which "bin" this read fits in. Can be "overflow" bin.
*/
for (bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) {
- if ((unsigned long long)size < ros3_stats_boundaries[bin_i])
+ if ((unsigned long long)size < ros3_stats_boundaries[bin_i]) {
break;
+ }
}
bin = (type == H5FD_MEM_DRAW)
? &file->raw[bin_i]
: &file->meta[bin_i];
- /* Store collected stats in appropriate bin
+ /* Store collected stats in appropriate bin
*/
if (bin->count == 0) {
bin->min = size;
bin->max = size;
- } else {
- if (size < bin->min)
+ }
+ else {
+ if (size < bin->min) {
bin->min = size;
- if (size > bin->max)
+ }
+ if (size > bin->max) {
bin->max = size;
+ }
}
bin->count++;
bin->bytes += (unsigned long long)size;
#endif /* ROS3_STATS */
-
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1698,12 +1780,12 @@ done:
*
* Function: H5FD_ros3_write()
*
- * Purpose:
+ * Purpose:
*
* Write bytes to file.
* UNSUPPORTED IN READ-ONLY ROS3 VFD.
*
- * Return:
+ * Return:
*
* FAIL (Not possible with Read-Only S3 file.)
*
@@ -1715,11 +1797,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_ros3_write(H5FD_t H5_ATTR_UNUSED *_file,
- H5FD_mem_t H5_ATTR_UNUSED type,
+H5FD_ros3_write(H5FD_t H5_ATTR_UNUSED *_file,
+ H5FD_mem_t H5_ATTR_UNUSED type,
hid_t H5_ATTR_UNUSED dxpl_id,
- haddr_t H5_ATTR_UNUSED addr,
- size_t H5_ATTR_UNUSED size,
+ haddr_t H5_ATTR_UNUSED addr,
+ size_t H5_ATTR_UNUSED size,
const void H5_ATTR_UNUSED *buf)
{
herr_t ret_value = FAIL;
@@ -1762,8 +1844,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_ros3_truncate(H5FD_t H5_ATTR_UNUSED *_file,
- hid_t H5_ATTR_UNUSED dxpl_id,
+H5FD_ros3_truncate(H5FD_t H5_ATTR_UNUSED *_file,
+ hid_t H5_ATTR_UNUSED dxpl_id,
hbool_t H5_ATTR_UNUSED closing)
{
herr_t ret_value = SUCCEED;
@@ -1807,7 +1889,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_ros3_lock(H5FD_t H5_ATTR_UNUSED *_file,
+H5FD_ros3_lock(H5FD_t H5_ATTR_UNUSED *_file,
hbool_t H5_ATTR_UNUSED rw)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c
index 8c0515d..42b281f 100644
--- a/src/H5FDs3comms.c
+++ b/src/H5FDs3comms.c
@@ -11,7 +11,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*****************************************************************************
- * Read-Only S3 Virtual File Driver (VFD)
+ * Read-Only S3 Virtual File Driver (VFD)
*
* Source for S3 Communications module
*
@@ -51,6 +51,8 @@
*/
#define S3COMMS_DEBUG 0
+#ifdef H5_HAVE_ROS3_VFD
+
/* manipulate verbosity of CURL output
* operates separately from S3COMMS_DEBUG
*
@@ -65,6 +67,8 @@
*/
#define S3COMMS_MAX_RANGE_STRING_SIZE 128
+#endif /* H5_HAVE_ROS3_VFD */
+
/******************/
/* Local Typedefs */
/******************/
@@ -111,7 +115,7 @@ herr_t H5FD_s3comms_s3r_getsize(s3r_t *handle);
/* Functions */
/*************/
-
+
/*----------------------------------------------------------------------------
*
* Function: curlwritecallback()
@@ -147,8 +151,9 @@ curlwritecallback(char *ptr,
size_t product = (size * nmemb);
size_t written = 0;
- if (sds->magic != S3COMMS_CALLBACK_DATASTRUCT_MAGIC)
+ if (sds->magic != S3COMMS_CALLBACK_DATASTRUCT_MAGIC) {
return written;
+ }
if (size > 0) {
HDmemcpy(&(sds->data[sds->size]), ptr, product);
@@ -158,9 +163,9 @@ curlwritecallback(char *ptr,
return written;
-} /* curlwritecallback */
-
+} /* end curlwritecallback() */
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_hrb_node_set()
@@ -223,9 +228,10 @@ curlwritecallback(char *ptr,
*----------------------------------------------------------------------------
*/
herr_t
-H5FD_s3comms_hrb_node_set(hrb_node_t **L,
- const char *name,
- const char *value)
+H5FD_s3comms_hrb_node_set(
+ hrb_node_t **L,
+ const char *name,
+ const char *value)
{
size_t i = 0;
char *valuecpy = NULL;
@@ -238,8 +244,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L,
hbool_t is_looking = TRUE;
herr_t ret_value = SUCCEED;
-
-
FUNC_ENTER_NOAPI_NOINIT
#if S3COMMS_DEBUG
@@ -247,8 +251,9 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L,
HDprintf("NAME: %s\n", name);
HDprintf("VALUE: %s\n", value);
HDprintf("LIST:\n->");
- for (node_ptr = (*L); node_ptr != NULL; node_ptr = node_ptr->next)
+ for (node_ptr = (*L); node_ptr != NULL; node_ptr = node_ptr->next) {
HDfprintf(stdout, "{%s}\n->", node_ptr->cat);
+ }
HDprintf("(null)\n");
fflush(stdout);
node_ptr = NULL;
@@ -281,34 +286,37 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L,
* copies
*/
if (value != NULL) {
- size_t valuelen = HDstrlen(value);
- size_t catlen = namelen + valuelen + 2; /* HDstrlen(": ") -> +2 */
- int sprint_ret = 0;
+ int ret = 0;
+ size_t valuelen = HDstrlen(value);
+ size_t catlen = namelen + valuelen + 2; /* +2 from ": " */
+ size_t catwrite = catlen + 3; /* 3 not 1 to quiet compiler warning */
+
namecpy = (char *)H5MM_malloc(sizeof(char) * (namelen + 1));
if (namecpy == NULL) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"cannot make space for name copy.\n");
}
- HDmemcpy(namecpy, name, namelen + 1);
+ HDmemcpy(namecpy, name, (namelen + 1));
valuecpy = (char *)H5MM_malloc(sizeof(char) * (valuelen + 1));
if (valuecpy == NULL) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"cannot make space for value copy.\n");
}
- HDmemcpy(valuecpy, value, valuelen + 1);
+ HDmemcpy(valuecpy, value, (valuelen + 1));
- nvcat = (char *)H5MM_malloc(sizeof(char) * (catlen + 1));
+ nvcat = (char *)H5MM_malloc(sizeof(char) * catwrite);
if (nvcat == NULL) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"cannot make space for concatenated string.\n");
}
- sprint_ret = HDsnprintf(nvcat, (catlen + 1), "%s: %s", name, value);
- if (sprint_ret <= 0)
+ ret = HDsnprintf(nvcat, catwrite, "%s: %s", name, value);
+ if (ret < 0 || (size_t)ret > catlen) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "error while concatenating `%s: %s", name, value);
- HDassert( catlen == (size_t)sprint_ret );
+ "cannot concatenate `%s: %s", name, value);
+ }
+ HDassert( catlen == HDstrlen(nvcat) );
/* create new_node, should we need it
*/
@@ -334,7 +342,8 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L,
if (value == NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"trying to remove node from empty list");
- } else {
+ }
+ else {
#if S3COMMS_DEBUG
HDprintf("CREATE NEW\n"); fflush(stdout);
#endif
@@ -406,7 +415,8 @@ HDprintf("FREEING POINTER\n"); fflush(stdout);
HDprintf("FREEING WORKING LOWERNAME\n"); fflush(stdout);
#endif
H5MM_xfree(lowername); lowername = NULL;
- } else {
+ }
+ else {
#if S3COMMS_DEBUG
HDprintf("MODIFY HEAD\n"); fflush(stdout);
#endif
@@ -428,14 +438,17 @@ HDprintf("MODIFY HEAD\n"); fflush(stdout);
H5MM_xfree(new_node);
new_node = NULL;
}
- } else if (strcmp(lowername, node_ptr->lowername) < 0) {
+ }
+ else
+ if (strcmp(lowername, node_ptr->lowername) < 0) {
is_looking = FALSE;
if (value == NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"trying to remove a node 'before' head");
- } else {
+ }
+ else {
#if S3COMMS_DEBUG
HDprintf("PREPEND NEW HEAD\n"); fflush(stdout);
#endif
@@ -464,7 +477,8 @@ HDprintf("PREPEND NEW HEAD\n"); fflush(stdout);
if (value == NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"trying to remove absent node");
- } else {
+ }
+ else {
#if S3COMMS_DEBUG
HDprintf("APPEND A NODE\n"); fflush(stdout);
#endif
@@ -479,14 +493,17 @@ HDprintf("APPEND A NODE\n"); fflush(stdout);
new_node->cat = nvcat;
node_ptr->next = new_node;
}
- } else if (strcmp(lowername, node_ptr->next->lowername) < 0) {
+ }
+ else
+ if (strcmp(lowername, node_ptr->next->lowername) < 0) {
is_looking = FALSE;
if (value == NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"trying to remove absent node");
- } else {
+ }
+ else {
#if S3COMMS_DEBUG
HDprintf("INSERT A NODE\n"); fflush(stdout);
#endif
@@ -502,7 +519,9 @@ HDprintf("INSERT A NODE\n"); fflush(stdout);
new_node->next = node_ptr->next;
node_ptr->next = new_node;
}
- } else if (strcmp(lowername, node_ptr->next->lowername) == 0) {
+ }
+ else
+ if (strcmp(lowername, node_ptr->next->lowername) == 0) {
is_looking = FALSE;
@@ -528,7 +547,8 @@ HDprintf("REMOVE A NODE\n"); fflush(stdout);
H5MM_xfree(lowername);
lowername = NULL;
- } else {
+ }
+ else {
#if S3COMMS_DEBUG
HDprintf("MODIFY A NODE\n"); fflush(stdout);
#endif
@@ -552,23 +572,24 @@ HDprintf("MODIFY A NODE\n"); fflush(stdout);
node_ptr->value = valuecpy;
node_ptr->cat = nvcat;
}
- } else {
+ }
+ else {
/****************
* KEEP LOOKING *
****************/
node_ptr = node_ptr->next;
}
- }
+ } /* end while is_looking */
done:
if (ret_value == FAIL) {
/* clean up
*/
- if (nvcat != NULL) H5MM_xfree(nvcat);
- if (namecpy != NULL) H5MM_xfree(namecpy);
- if (lowername != NULL) H5MM_xfree(lowername);
- if (valuecpy != NULL) H5MM_xfree(valuecpy);
+ if (nvcat != NULL) { H5MM_xfree(nvcat); }
+ if (namecpy != NULL) { H5MM_xfree(namecpy); }
+ if (lowername != NULL) { H5MM_xfree(lowername); }
+ if (valuecpy != NULL) { H5MM_xfree(valuecpy); }
if (new_node != NULL) {
HDassert( new_node->magic == S3COMMS_HRB_NODE_MAGIC );
new_node->magic += 1ul;
@@ -577,11 +598,9 @@ done:
}
FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5FD_s3comms_hrb_node_set() */
-} /* H5FD_s3comms_hrb_node_set */
-
-
-
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_hrb_destroy()
@@ -637,8 +656,6 @@ H5FD_s3comms_hrb_destroy(hrb_t **_buf)
hrb_t *buf = NULL;
herr_t ret_value = SUCCEED;
-
-
FUNC_ENTER_NOAPI_NOINIT
#if S3COMMS_DEBUG
@@ -658,12 +675,11 @@ H5FD_s3comms_hrb_destroy(hrb_t **_buf)
buf->magic += 1ul;
H5MM_xfree(buf);
*_buf = NULL;
- }
+ } /* end if `_buf` has some value */
done:
FUNC_LEAVE_NOAPI(ret_value)
-
-} /* H5FD_s3comms_hrb_destroy */
+} /* end H5FD_s3comms_hrb_destroy() */
/*----------------------------------------------------------------------------
@@ -728,8 +744,6 @@ H5FD_s3comms_hrb_init_request(const char *_verb,
char *vrsn = NULL;
size_t vrsnlen = 0;
-
-
FUNC_ENTER_NOAPI_NOINIT
#if S3COMMS_DEBUG
@@ -743,11 +757,13 @@ H5FD_s3comms_hrb_init_request(const char *_verb,
/* populate valid NULLs with defaults
*/
- if (_verb == NULL)
+ if (_verb == NULL) {
_verb = "GET";
+ }
- if (_http_version == NULL)
+ if (_http_version == NULL) {
_http_version = "HTTP/1.1";
+ }
/* malloc space for and prepare structure
*/
@@ -765,28 +781,26 @@ H5FD_s3comms_hrb_init_request(const char *_verb,
/* malloc and copy strings for the structure
*/
+ reslen = HDstrlen(_resource);
+
if (_resource[0] == '/') {
- reslen = HDstrlen(_resource) + 1;
- res = (char *)H5MM_malloc(sizeof(char) * reslen);
+ res = (char *)H5MM_malloc(sizeof(char) * (reslen+1));
if (res == NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL,
"no space for resource string");
}
- HDstrncpy(res, _resource, reslen);
- } else {
- int sprint_ret = 0;
- reslen = HDstrlen(_resource) + 2;
- res = (char *)H5MM_malloc(sizeof(char) * reslen);
+ HDmemcpy(res, _resource, (reslen+1));
+ }
+ else {
+ res = (char *)H5MM_malloc(sizeof(char) * (reslen+2));
if (res == NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL,
- "no space for resource string");
+ "no space for resource string");
}
- sprint_ret = HDsnprintf(res, reslen, "/%s", _resource);
- if (sprint_ret <= 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL,
- "errro while appending resource string %s", _resource);
- HDassert( (reslen - 1) == (size_t)sprint_ret );
- } /* start resource string with '/' */
+ *res = '/';
+ HDmemcpy((&res[1]), _resource, (reslen+1));
+ HDassert( (reslen+1) == HDstrlen(res) );
+ } /* end if (else resource string not starting with '/') */
verblen = HDstrlen(_verb) + 1;
verb = (char *)H5MM_malloc(sizeof(char) * verblen);
@@ -815,7 +829,6 @@ H5FD_s3comms_hrb_init_request(const char *_verb,
ret_value = request;
done:
-
/* if there is an error, clean up after ourselves
*/
if (ret_value == NULL) {
@@ -826,8 +839,7 @@ done:
}
FUNC_LEAVE_NOAPI(ret_value)
-
-} /* H5FD_s3comms_hrb_init_request */
+} /* end H5FD_s3comms_hrb_init_request() */
@@ -835,7 +847,60 @@ done:
* S3R FUNCTIONS
****************************************************************************/
+#ifndef H5_HAVE_ROS3_VFD
+/* No-op, auto-fail, unused-variable implementations if ROS3 is not enabled */
+
+herr_t
+H5FD_s3comms_s3r_close(s3r_t H5_ATTR_UNUSED *handle)
+{
+ herr_t ret_value = SUCCEED;
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_s3comms_s3r_close() */
+
+size_t
+H5FD_s3comms_s3r_get_filesize(s3r_t H5_ATTR_UNUSED *handle)
+{
+ size_t ret_value = 0;
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_s3comms_s3r_get_filesize() */
+
+herr_t
+H5FD_s3comms_s3r_getsize(s3r_t H5_ATTR_UNUSED *handle)
+{
+ herr_t ret_value = FAIL;
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5FD_s3comms_s3r_getsize() */
+
+s3r_t *
+H5FD_s3comms_s3r_open(
+ const char H5_ATTR_UNUSED *url,
+ const char H5_ATTR_UNUSED *region,
+ const char H5_ATTR_UNUSED *id,
+ const unsigned char H5_ATTR_UNUSED *signing_key)
+{
+ s3r_t *ret_value = NULL;
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_s3comms_s3r_open() */
+herr_t
+H5FD_s3comms_s3r_read(
+ s3r_t H5_ATTR_UNUSED *handle,
+ haddr_t H5_ATTR_UNUSED offset,
+ size_t H5_ATTR_UNUSED len,
+ void H5_ATTR_UNUSED *dest)
+{
+ herr_t ret_value = FAIL;
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5FD_s3comms_s3r_read() */
+
+#else
+
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_s3r_close()
@@ -876,11 +941,8 @@ H5FD_s3comms_s3r_close(s3r_t *handle)
{
herr_t ret_value = SUCCEED;
-
-
FUNC_ENTER_NOAPI_NOINIT
-#ifdef H5_HAVE_ROS3_VFD
#if S3COMMS_DEBUG
HDfprintf(stdout, "called H5FD_s3comms_s3r_close.\n");
#endif
@@ -910,14 +972,11 @@ H5FD_s3comms_s3r_close(s3r_t *handle)
H5MM_xfree(handle);
-#endif /* H5_HAVE_ROS3_VFD */
-
done:
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5FD_s3comms_s3r_close */
-
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_s3r_get_filesize()
@@ -941,22 +1000,20 @@ done:
*----------------------------------------------------------------------------
*/
size_t
-H5FD_s3comms_s3r_get_filesize(s3r_t *handle) {
-
+H5FD_s3comms_s3r_get_filesize(s3r_t *handle)
+{
size_t ret_value = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
-#ifdef H5_HAVE_ROS3_VFD
- if (handle != NULL)
+ if (handle != NULL) {
ret_value = handle->filesize;
-#endif /* H5_HAVE_ROS3_VFD */
+ }
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5FD_s3comms_s3r_get_filesize */
-
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_s3r_getsize()
@@ -1143,7 +1200,7 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle)
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "content_length overflows size_t\n");
}
- if (content_length == 0 ||
+ if (content_length == 0 ||
errno == ERANGE) /* errno set by strtoumax*/
{
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
@@ -1187,7 +1244,7 @@ done:
} /* H5FD_s3comms_s3r_getsize */
-
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_s3r_open()
@@ -1463,7 +1520,7 @@ done:
} /* H5FD_s3comms_s3r_open */
-
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_s3r_read()
@@ -1621,7 +1678,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle,
if (len > 0) {
rangebytesstr = (char *)H5MM_malloc(sizeof(char) * \
- S3COMMS_MAX_RANGE_STRING_SIZE );
+ (S3COMMS_MAX_RANGE_STRING_SIZE+1) );
if (rangebytesstr == NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL,
"could not malloc range format string.\n");
@@ -1631,12 +1688,12 @@ H5FD_s3comms_s3r_read(s3r_t *handle,
"bytes="H5_PRINTF_HADDR_FMT"-"H5_PRINTF_HADDR_FMT,
offset,
offset + len - 1);
- if (ret == 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE)
+ if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"unable to format HTTP Range value");
} else if (offset > 0) {
rangebytesstr = (char *)H5MM_malloc(sizeof(char) * \
- S3COMMS_MAX_RANGE_STRING_SIZE);
+ (S3COMMS_MAX_RANGE_STRING_SIZE+1));
if (rangebytesstr == NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL,
"could not malloc range format string.\n");
@@ -1645,7 +1702,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle,
(S3COMMS_MAX_RANGE_STRING_SIZE),
"bytes="H5_PRINTF_HADDR_FMT"-",
offset);
- if (ret == 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE)
+ if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"unable to format HTTP Range value");
}
@@ -1679,7 +1736,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle,
} else {
/* authenticate request
*/
- char authorization[512];
+ char authorization[512+1];
/* 512 := approximate max length...
* 67 <len("AWS4-HMAC-SHA256 Credential=///s3/aws4_request,"
* "SignedHeaders=,Signature=")>
@@ -1689,10 +1746,10 @@ H5FD_s3comms_s3r_read(s3r_t *handle,
* + 20 <max? len(region)>
* + 128 <max? len(signed_headers)>
*/
- char buffer1[512]; /* -> Canonical Request -> Signature */
- char buffer2[256]; /* -> String To Sign -> Credential */
+ char buffer1[512+1]; /* -> Canonical Request -> Signature */
+ char buffer2[256+1]; /* -> String To Sign -> Credential */
char iso8601now[ISO8601_SIZE];
- char signed_headers[48];
+ char signed_headers[48+1];
/* should be large enough for nominal listing:
* "host;range;x-amz-content-sha256;x-amz-date"
* + '\0', with "range;" possibly absent
@@ -1821,8 +1878,11 @@ H5FD_s3comms_s3r_read(s3r_t *handle,
/**** COMPUTE AUTHORIZATION ****/
if (FAIL == /* buffer1 -> canonical request */
- H5FD_s3comms_aws_canonical_request(buffer1,
+ H5FD_s3comms_aws_canonical_request(
+ buffer1,
+ 512,
signed_headers,
+ 48,
request) )
{
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
@@ -1858,23 +1918,25 @@ H5FD_s3comms_s3r_read(s3r_t *handle,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"unable to format aws4 credential string");
- ret = HDsnprintf(authorization,
+ ret = HDsnprintf(
+ authorization,
512,
"AWS4-HMAC-SHA256 Credential=%s,SignedHeaders=%s,Signature=%s",
buffer2,
signed_headers,
buffer1);
- if (ret == 0 || ret >= 512)
+ if (ret <= 0 || ret >= 512) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"unable to format aws4 authorization string");
+ }
/* append authorization header to http request buffer
*/
- if (FAIL ==
- H5FD_s3comms_hrb_node_set(
- &headers,
- "Authorization",
- (const char *)authorization) )
+ if (H5FD_s3comms_hrb_node_set(
+ &headers,
+ "Authorization",
+ (const char *)authorization)
+ == FAIL)
{
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"unable to set Authorization header")
@@ -1914,17 +1976,18 @@ H5FD_s3comms_s3r_read(s3r_t *handle,
/* finally, set http headers in curl handle
*/
- if (CURLE_OK !=
- curl_easy_setopt(curlh,
- CURLOPT_HTTPHEADER,
- curlheaders) )
+ if (curl_easy_setopt(
+ curlh,
+ CURLOPT_HTTPHEADER,
+ curlheaders)
+ != CURLE_OK)
{
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"error while setting CURL option "
"(CURLOPT_HTTPHEADER). (placeholder flags)");
}
- } /* if should authenticate (info provided) */
+ } /* end if should authenticate (info provided) */
/*******************
* PERFORM REQUEST *
@@ -1983,14 +2046,16 @@ H5FD_s3comms_s3r_read(s3r_t *handle,
HDfprintf(stderr, "CHECKING FOR BUFFER OVERFLOW\n");
if (sds == NULL) {
HDfprintf(stderr, "sds is NULL!\n");
- } else {
+ }
+ else {
HDfprintf(stderr, "sds: 0x%lx\n", (long long)sds);
HDfprintf(stderr, "sds->size: %d\n", (int)sds->size);
if (len > sds->size) {
HDfprintf(stderr, "buffer overwrite\n");
}
}
- } else {
+ }
+ else {
HDfprintf(stderr, "performed on entire file\n");
}
#endif
@@ -2028,29 +2093,30 @@ done:
if (curlh != NULL) {
/* clear any Range */
- if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_RANGE, NULL) )
+ if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_RANGE, NULL) ) {
HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"cannot unset CURLOPT_RANGE")
+ }
/* clear headers */
- if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTPHEADER, NULL) )
+ if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTPHEADER, NULL) ) {
HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"cannot unset CURLOPT_HTTPHEADER")
+ }
}
#endif /* H5_HAVE_ROS3_VFD */
FUNC_LEAVE_NOAPI(ret_value);
-
} /* H5FD_s3comms_s3r_read */
-
+#endif /* H5_HAVE_ROS3_VFD */
/****************************************************************************
* MISCELLANEOUS FUNCTIONS
****************************************************************************/
-
+
/*----------------------------------------------------------------------------
*
* Function: gmnow()
@@ -2079,14 +2145,14 @@ gmnow(void)
struct tm *ret_value = NULL;
/* Doctor assert, checks against error in time() */
- if ( (time_t)(-1) != time(now_ptr) )
+ if ( (time_t)(-1) != time(now_ptr) ) {
ret_value = gmtime(now_ptr);
+ }
HDassert( ret_value != NULL );
return ret_value;
-
-} /* gmnow */
+} /* end gmnow() */
/*----------------------------------------------------------------------------
@@ -2131,16 +2197,23 @@ gmnow(void)
*----------------------------------------------------------------------------
*/
herr_t
-H5FD_s3comms_aws_canonical_request(char *canonical_request_dest,
- char *signed_headers_dest,
- hrb_t *http_request)
+H5FD_s3comms_aws_canonical_request(
+ char *canonical_request_dest,
+ int _cr_size,
+ char *signed_headers_dest,
+ int _sh_size,
+ hrb_t *http_request)
{
hrb_node_t *node = NULL;
const char *query_params = ""; /* unused at present */
herr_t ret_value = SUCCEED;
- int ret = 0; /* return value of HDsnprintf */
- size_t len = 0; /* working string length variable */
- char tmpstr[256];
+ int ret = 0;
+ size_t cr_size = (size_t)_cr_size;
+ size_t sh_size = (size_t)_sh_size;
+ size_t cr_len = 0; /* working length of canonical request str */
+ size_t sh_len = 0; /* working length of signed headers str */
+ char tmpstr[256+1];
+ tmpstr[256] = 0; /* terminating NULL */
/* "query params" refers to the optional element in the URL, e.g.
* http://bucket.aws.com/myfile.txt?max-keys=2&prefix=J
@@ -2152,8 +2225,6 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest,
* VFD use-cases.
*/
-
-
FUNC_ENTER_NOAPI_NOINIT
#if S3COMMS_DEBUG
@@ -2178,55 +2249,71 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest,
/* HTTP verb, resource path, and query string lines
*/
- len = (HDstrlen(http_request->verb) +
+ cr_len = (HDstrlen(http_request->verb) +
HDstrlen(http_request->resource) +
HDstrlen(query_params) +
- 3 );
- ret = HDsnprintf(canonical_request_dest,
- len + 1,
- "%s\n%s\n%s\n",
- http_request->verb,
- http_request->resource,
- query_params);
- if (ret == 0 || (size_t)ret > len)
+ (size_t)3); /* three newline chars */
+ if (cr_len >= cr_size) {
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "not enough space in canonical request");
+ }
+ ret = HDsnprintf( /* TODO: compiler warning */
+ canonical_request_dest,
+ (cr_size-1),
+ "%s\n%s\n%s\n",
+ http_request->verb,
+ http_request->resource,
+ query_params);
+ if (ret < 0 || (size_t)ret >= cr_size) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"unable to compose canonical request first line");
+ }
/* write in canonical headers, building signed headers concurrently
*/
- node = http_request->first_header; /* assumed at first sorted */
+ node = http_request->first_header; /* assumed sorted */
while (node != NULL) {
- size_t join_len = 0; /* string len of joined header-value */
-
- HDassert( node->magic == S3COMMS_HRB_NODE_MAGIC );
-
- len = HDstrlen(node->lowername);
- join_len = HDstrlen(node->value) + len + 2; /* +2 <- ":\n" */
- ret = HDsnprintf(tmpstr,
- join_len + 1, /* +1 for null terminator */
- "%s:%s\n",
- node->lowername,
- node->value);
- if (ret == 0 || (size_t)ret > join_len)
+
+ HDassert(node->magic == S3COMMS_HRB_NODE_MAGIC);
+
+ ret = HDsnprintf(
+ tmpstr,
+ 256,
+ "%s:%s\n",
+ node->lowername,
+ node->value);
+ if (ret < 0 || ret >= 256) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"unable to concatenate HTTP header %s:%s",
node->lowername,
node->value);
+ }
+ cr_len += HDstrlen(tmpstr);
+ if (cr_len + 1 > cr_size) {
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "not enough space in canonical request");
+ }
strcat(canonical_request_dest, tmpstr);
- len += 1; /* semicolon */
- ret = HDsnprintf(tmpstr,
- len + 1,
- "%s;",
- node->lowername);
- if (ret == 0 || (size_t)ret > len)
+ ret = HDsnprintf(
+ tmpstr,
+ 256,
+ "%s;",
+ node->lowername);
+ if (ret < 0 || ret >= 256) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "unable to append signed header %s",
+ "unable to append semicolon to lowername %s",
node->lowername);
+ }
+ sh_len += HDstrlen(tmpstr);
+ if (sh_len + 1 > sh_size) {
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "not enough space in signed headers");
+ }
strcat(signed_headers_dest, tmpstr);
node = node->next;
- }
+ } /* end while node is not NULL */
/* remove tailing ';' from signed headers sequence
*/
@@ -2243,10 +2330,9 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest,
done:
FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5FD_s3comms_aws_canonical_request() */
-} /* H5FD_s3comms_aws_canonical_request */
-
-
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_bytes_to_hex()
@@ -2293,16 +2379,15 @@ done:
*----------------------------------------------------------------------------
*/
herr_t
-H5FD_s3comms_bytes_to_hex(char *dest,
- const unsigned char *msg,
- size_t msg_len,
- hbool_t lowercase)
+H5FD_s3comms_bytes_to_hex(
+ char *dest,
+ const unsigned char *msg,
+ size_t msg_len,
+ hbool_t lowercase)
{
size_t i = 0;
herr_t ret_value = SUCCEED;
-
-
FUNC_ENTER_NOAPI_NOINIT
#if S3COMMS_DEBUG
@@ -2319,24 +2404,23 @@ H5FD_s3comms_bytes_to_hex(char *dest,
}
for (i = 0; i < msg_len; i++) {
- int chars_written =
- HDsnprintf(&(dest[i * 2]),
- 3, /* 'X', 'X', '\n' */
- (lowercase == TRUE) ? "%02x"
- : "%02X",
- msg[i]);
- if (chars_written != 2)
+ int chars_written = HDsnprintf(&(dest[i * 2]),
+ 3, /* 'X', 'X', '\n' */
+ (lowercase == TRUE) ? "%02x" : "%02X",
+ msg[i]);
+ if (chars_written != 2) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"problem while writing hex chars for %c",
msg[i]);
+ }
}
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* H5FD_s3comms_bytes_to_hex */
-
+} /* end H5FD_s3comms_bytes_to_hex() */
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_free_purl()
@@ -2369,19 +2453,19 @@ H5FD_s3comms_free_purl(parsed_url_t *purl)
if (purl != NULL) {
HDassert( purl->magic == S3COMMS_PARSED_URL_MAGIC );
- if (purl->scheme != NULL) H5MM_xfree(purl->scheme);
- if (purl->host != NULL) H5MM_xfree(purl->host);
- if (purl->port != NULL) H5MM_xfree(purl->port);
- if (purl->path != NULL) H5MM_xfree(purl->path);
- if (purl->query != NULL) H5MM_xfree(purl->query);
+ if (purl->scheme != NULL) { H5MM_xfree(purl->scheme); }
+ if (purl->host != NULL) { H5MM_xfree(purl->host); }
+ if (purl->port != NULL) { H5MM_xfree(purl->port); }
+ if (purl->path != NULL) { H5MM_xfree(purl->path); }
+ if (purl->query != NULL) { H5MM_xfree(purl->query); }
purl->magic += 1ul;
H5MM_xfree(purl);
}
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5FD_s3comms_free_purl */
-
+} /* end H5FD_s3comms_free_purl() */
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_HMAC_SHA256()
@@ -2424,27 +2508,22 @@ H5FD_s3comms_free_purl(parsed_url_t *purl)
*
*----------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_ROS3_VFD
+
herr_t
-H5FD_s3comms_HMAC_SHA256(const unsigned char *key,
- size_t key_len,
- const char *msg,
- size_t msg_len,
- char *dest)
+H5FD_s3comms_HMAC_SHA256(
+ const unsigned char *key,
+ size_t key_len,
+ const char *msg,
+ size_t msg_len,
+ char *dest)
{
-#ifdef H5_HAVE_ROS3_VFD
unsigned char md[SHA256_DIGEST_LENGTH];
unsigned int md_len = SHA256_DIGEST_LENGTH;
herr_t ret_value = SUCCEED;
-#else
- herr_t ret_value = FAIL;
-#endif /* H5_HAVE_ROS3_VFD */
-
-
FUNC_ENTER_NOAPI_NOINIT
-#ifdef H5_HAVE_ROS3_VFD
-
#if S3COMMS_DEBUG
HDfprintf(stdout, "called H5FD_s3comms_HMAC_SHA256.\n");
#endif
@@ -2462,24 +2541,39 @@ H5FD_s3comms_HMAC_SHA256(const unsigned char *key,
md,
&md_len);
- if (FAIL ==
- H5FD_s3comms_bytes_to_hex(dest,
- (const unsigned char *)md,
- (size_t)md_len,
- true))
+ if (H5FD_s3comms_bytes_to_hex(
+ dest,
+ (const unsigned char *)md,
+ (size_t)md_len,
+ true)
+ == FAIL)
{
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"could not convert to hex string.");
}
-#endif /* H5_HAVE_ROS3_VFD */
-
done:
FUNC_LEAVE_NOAPI(ret_value);
-
} /* H5FD_s3comms_HMAC_SHA256 */
+#else /* H5_HAVE_ROS3_VFD not defined */
+
+herr_t
+H5FD_s3comms_HMAC_SHA256(
+ const unsigned char H5_ATTR_UNUSED *key,
+ size_t H5_ATTR_UNUSED key_len,
+ const char H5_ATTR_UNUSED *msg,
+ size_t H5_ATTR_UNUSED msg_len,
+ char H5_ATTR_UNUSED *dest)
+{
+ herr_t ret_value = FAIL;
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5FD_s3comms_HMAC_SHA256() */
+
+#endif /* H5_HAVE_ROS3_VFD */
+
/*-----------------------------------------------------------------------------
*
* Function: H5FD__s3comms_load_aws_creds_from_file()
@@ -2565,85 +2659,98 @@ H5FD__s3comms_load_aws_creds_from_file(
#endif
/* format target line for start of profile */
- if (32 < HDsnprintf(profile_line, 32, "[%s]", profile_name))
+ if (32 < HDsnprintf(profile_line, 32, "[%s]", profile_name)) {
HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL,
"unable to format profile label")
+ }
/* look for start of profile */
do {
/* clear buffer */
- for (buffer_i=0; buffer_i < 128; buffer_i++) buffer[buffer_i] = 0;
+ for (buffer_i=0; buffer_i < 128; buffer_i++) {
+ buffer[buffer_i] = 0;
+ }
line_buffer = fgets(line_buffer, 128, file);
- if (line_buffer == NULL) /* reached end of file */
+ if (line_buffer == NULL) { /* reached end of file */
goto done;
+ }
} while (strncmp(line_buffer, profile_line, HDstrlen(profile_line)));
/* extract credentials from lines */
do {
- size_t setting_name_len = 0;
- const char *setting_name = NULL;
- char line_prefix[128];
-
/* clear buffer */
- for (buffer_i=0; buffer_i < 128; buffer_i++) buffer[buffer_i] = 0;
+ for (buffer_i=0; buffer_i < 128; buffer_i++) {
+ buffer[buffer_i] = 0;
+ }
/* collect a line from file */
line_buffer = fgets(line_buffer, 128, file);
- if (line_buffer == NULL)
+ if (line_buffer == NULL) {
goto done; /* end of file */
+ }
/* loop over names to see if line looks like assignment */
for (setting_i = 0; setting_i < setting_count; setting_i++) {
+ size_t setting_name_len = 0;
+ const char *setting_name = NULL;
+ char line_prefix[128];
+
setting_name = setting_names[setting_i];
setting_name_len = HDstrlen(setting_name);
- if (128 < HDsnprintf(
- line_prefix,
- setting_name_len+2,
- "%s=",
- setting_name))
+ if (HDsnprintf(line_prefix, 128, "%s=", setting_name) < 0) {
HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL,
"unable to format line prefix")
+ }
/* found a matching name? */
if (!HDstrncmp(line_buffer, line_prefix, setting_name_len + 1)) {
found_setting = 1;
/* skip NULL destination buffer */
- if (setting_pointers[setting_i] == NULL)
+ if (setting_pointers[setting_i] == NULL) {
break;
+ }
/* advance to end of name in string */
do {
line_buffer++;
} while (*line_buffer != 0 && *line_buffer != '=');
- if (*line_buffer == 0 || *(line_buffer+1) == 0)
+ if (*line_buffer == 0 || *(line_buffer+1) == 0) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"incomplete assignment in file")
+ }
line_buffer++; /* was pointing at '='; advance */
/* copy line buffer into out pointer */
- HDstrncpy(setting_pointers[setting_i], (const char *)line_buffer,
- HDstrlen(line_buffer));
+ if (HDstrncpy(
+ setting_pointers[setting_i],
+ (const char *)line_buffer,
+ HDstrlen(line_buffer))
+ == NULL)
+ {
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL,
+ "unable to copy line into pointer")
+ }
/* "trim" tailing whitespace by replacing with null terminator*/
buffer_i = 0;
- while (!isspace(setting_pointers[setting_i][buffer_i]))
+ while (!isspace(setting_pointers[setting_i][buffer_i])) {
buffer_i++;
+ }
setting_pointers[setting_i][buffer_i] = '\0';
break; /* have read setting; don't compare with others */
- }
- }
+ } /* end if possible name match */
+ } /* end for each setting name */
} while (found_setting);
done:
FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5FD__s3comms_load_aws_creds_from_file() */
-} /* H5FD__s3comms_load_aws_creds_from_file */
-
-
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_load_aws_profile()
@@ -2688,6 +2795,7 @@ H5FD_s3comms_load_aws_profile(const char *profile_name,
FILE *credfile = NULL;
char awspath[117];
char filepath[128];
+ int ret = 0;
FUNC_ENTER_NOAPI_NOINIT
@@ -2696,47 +2804,61 @@ H5FD_s3comms_load_aws_profile(const char *profile_name,
#endif
/* TODO: Windows and other path gotchas */
- if (117 < HDsnprintf(awspath, 117, "%s/.aws/", getenv("HOME")))
+ ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("HOME")) ;
+ if (ret < 0 || (size_t)ret >= 117) {
HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL,
"unable to format home-aws path")
- if (128 < HDsnprintf(filepath, 128, "%s%s", awspath, "credentials"))
+ }
+ ret = HDsnprintf(filepath, 128, "%s%s", awspath, "credentials");
+ if (ret < 0 || (size_t)ret >= 128) {
HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL,
"unable to format credentials path")
+ }
credfile = fopen(filepath, "r");
if (credfile != NULL) {
- if (FAIL == H5FD__s3comms_load_aws_creds_from_file(
+ if (H5FD__s3comms_load_aws_creds_from_file(
credfile,
profile_name,
key_id_out,
secret_access_key_out,
- aws_region_out))
+ aws_region_out)
+ == FAIL)
+ {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"unable to load from aws credentials")
- if (EOF == fclose(credfile))
+ }
+ if (fclose(credfile) == EOF) {
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL,
"unable to close credentials file")
+ }
credfile = NULL;
- }
+ } /* end if credential file opened */
- if (128 < HDsnprintf(filepath, 128, "%s%s", awspath, "config"))
+ ret = HDsnprintf(filepath, 128, "%s%s", awspath, "config");
+ if (ret < 0 || (size_t)ret >= 128) {
HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL,
"unable to format config path")
+ }
credfile = fopen(filepath, "r");
if (credfile != NULL) {
- if (FAIL == H5FD__s3comms_load_aws_creds_from_file(
+ if (H5FD__s3comms_load_aws_creds_from_file(
credfile,
profile_name,
(*key_id_out == 0) ? key_id_out : NULL,
(*secret_access_key_out == 0) ? secret_access_key_out : NULL,
- (*aws_region_out == 0) ? aws_region_out : NULL))
+ (*aws_region_out == 0) ? aws_region_out : NULL)
+ == FAIL)
+ {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"unable to load from aws config")
- if (EOF == fclose(credfile))
+ }
+ if (fclose(credfile) == EOF) {
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL,
"unable to close config file")
+ }
credfile = NULL;
- }
+ } /* end if credential file opened */
/* fail if not all three settings were loaded */
if (*key_id_out == 0 ||
@@ -2748,16 +2870,15 @@ H5FD_s3comms_load_aws_profile(const char *profile_name,
done:
if (credfile != NULL) {
- if (EOF == fclose(credfile))
+ if (fclose(credfile) == EOF) {
HDONE_ERROR(H5E_ARGS, H5E_ARGS, FAIL,
"problem error-closing aws configuration file")
+ }
}
-
FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5FD_s3comms_load_aws_profile() */
-} /* H5FD_s3comms_load_aws_profile */
-
-
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_nlowercase()
@@ -2787,9 +2908,10 @@ done:
*----------------------------------------------------------------------------
*/
herr_t
-H5FD_s3comms_nlowercase(char *dest,
- const char *s,
- size_t len)
+H5FD_s3comms_nlowercase(
+ char *dest,
+ const char *s,
+ size_t len)
{
herr_t ret_value = SUCCEED;
@@ -2814,10 +2936,9 @@ H5FD_s3comms_nlowercase(char *dest,
done:
FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5FD_s3comms_nlowercase() */
-} /* H5FD_s3comms_nlowercase */
-
-
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_parse_url()
@@ -2852,8 +2973,9 @@ done:
*----------------------------------------------------------------------------
*/
herr_t
-H5FD_s3comms_parse_url(const char *str,
- parsed_url_t **_purl)
+H5FD_s3comms_parse_url(
+ const char *str,
+ parsed_url_t **_purl)
{
parsed_url_t *purl = NULL; /* pointer to new structure */
const char *tmpstr = NULL; /* working pointer in string */
@@ -2863,8 +2985,6 @@ H5FD_s3comms_parse_url(const char *str,
unsigned int i = 0;
herr_t ret_value = FAIL;
-
-
FUNC_ENTER_NOAPI_NOINIT;
#if S3COMMS_DEBUG
@@ -2946,7 +3066,8 @@ H5FD_s3comms_parse_url(const char *str,
tmpstr++;
}
tmpstr++;
- } else {
+ } /* end if (IPv6) */
+ else {
while (0 != *tmpstr) {
if (':' == *tmpstr ||
'/' == *tmpstr ||
@@ -2956,12 +3077,14 @@ H5FD_s3comms_parse_url(const char *str,
}
tmpstr++;
}
- } /* if IPv4 or IPv6 */
+ } /* end else (IPv4) */
len = tmpstr - curstr;
if (len == 0) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"HOST substring cannot be empty");
- } else if (len > urllen) {
+ }
+ else
+ if (len > urllen) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"problem with length of HOST substring");
}
@@ -2990,7 +3113,9 @@ H5FD_s3comms_parse_url(const char *str,
if (len == 0) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"PORT element cannot be empty");
- } else if (len > urllen) {
+ }
+ else
+ if (len > urllen) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"problem with length of PORT substring");
}
@@ -3005,12 +3130,12 @@ H5FD_s3comms_parse_url(const char *str,
*/
purl->port = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1));
if (purl->port == NULL) { /* cannot malloc */
- HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL,
- "can't allocate space for PORT");
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL,
+ "can't allocate space for PORT");
}
(void)HDstrncpy(purl->port, curstr, (size_t)len);
purl->port[len] = 0;
- } /* if PORT element */
+ } /* end if PORT element */
/*************
* READ PATH *
@@ -3040,7 +3165,7 @@ H5FD_s3comms_parse_url(const char *str,
(void)HDstrncpy(purl->path, curstr, (size_t)len);
purl->path[len] = 0;
}
- } /* if PATH element */
+ } /* end if PATH element */
/**************
* READ QUERY *
@@ -3067,9 +3192,7 @@ H5FD_s3comms_parse_url(const char *str,
} /* cannot malloc path pointer */
(void)HDstrncpy(purl->query, curstr, (size_t)len);
purl->query[len] = 0;
- } /* if QUERY exists */
-
-
+ } /* end if QUERY exists */
*_purl = purl;
ret_value = SUCCEED;
@@ -3079,10 +3202,9 @@ done:
H5FD_s3comms_free_purl(purl);
}
FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5FD_s3comms_parse_url() */
-} /* H5FD_s3comms_parse_url */
-
-
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_percent_encode_char()
@@ -3129,15 +3251,12 @@ done:
*----------------------------------------------------------------------------
*/
herr_t
-H5FD_s3comms_percent_encode_char(char *repr,
- const unsigned char c,
- size_t *repr_len)
+H5FD_s3comms_percent_encode_char(
+ char *repr,
+ const unsigned char c,
+ size_t *repr_len)
{
- unsigned int acc = 0;
unsigned int i = 0;
- unsigned int k = 0;
- unsigned int stack[4] = {0, 0, 0, 0};
- unsigned int stack_size = 0;
int chars_written = 0;
herr_t ret_value = SUCCEED;
#if S3COMMS_DEBUG
@@ -3145,8 +3264,6 @@ H5FD_s3comms_percent_encode_char(char *repr,
unsigned char hex[3] = {0, 0, 0};
#endif
-
-
FUNC_ENTER_NOAPI_NOINIT
#if S3COMMS_DEBUG
@@ -3172,13 +3289,19 @@ H5FD_s3comms_percent_encode_char(char *repr,
#endif
*repr_len = 3;
chars_written = HDsnprintf(repr, 4, "%%%02X", c);
- if (chars_written != 3)
+ if (chars_written < 0) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"cannot write char %c",
c);
- } else {
+ }
+ } /* end if single-byte unicode char */
+ else {
/* multi-byte, multi-percent representation
*/
+ unsigned int acc = 0; /* byte accumulator */
+ unsigned int k = 0; /* uint character representation */
+ unsigned int stack_size = 0;
+ unsigned char stack[4] = {0, 0, 0, 0};
#if S3COMMS_DEBUG
HDfprintf(stdout, " MULTI-BYTE\n");
#endif
@@ -3191,21 +3314,22 @@ H5FD_s3comms_percent_encode_char(char *repr,
acc = k;
acc >>= 6; /* cull least */
acc <<= 6; /* six bits */
- stack[stack_size++] = k - acc; /* max six-bit number */
+ stack[stack_size++] = (unsigned char)(k - acc);
k = acc >> 6;
} while (k > 0);
- /* now have "stack" of two to four six-bit numbers
- * to be put into UTF-8 byte fields
+ /* `stack` now has two to four six-bit 'numbers' to be put into
+ * UTF-8 byte fields.
*/
#if S3COMMS_DEBUG
HDfprintf(stdout, " STACK:\n {\n");
for (i = 0; i < stack_size; i++) {
- H5FD_s3comms_bytes_to_hex((char *)hex,
- (unsigned char *)(&stack[i]),
- 1,
- FALSE);
+ H5FD_s3comms_bytes_to_hex(
+ (char *)hex,
+ (&stack[i]),
+ 1,
+ FALSE);
hex[2] = 0;
HDfprintf(stdout, " %s,\n", hex);
}
@@ -3218,15 +3342,20 @@ H5FD_s3comms_percent_encode_char(char *repr,
/* prepend 11[1[1]]0 to first byte */
/* 110xxxxx, 1110xxxx, or 11110xxx */
- acc = 0xC0; /* 2^7 + 2^6 -> 11000000 */
- acc += (stack_size > 2) ? 0x20 : 0;
- acc += (stack_size > 3) ? 0x10 : 0;
- stack_size -= 1;
- chars_written = HDsnprintf(repr, 4, "%%%02X", acc + stack[stack_size]);
- if (chars_written != 3)
+ acc = 0xC0; /* 0x11000000 */
+ acc += (stack_size > 2) ? 0x20 : 0; /* 0x00100000 */
+ acc += (stack_size > 3) ? 0x10 : 0; /* 0x00010000 */
+ stack_size--;
+ chars_written = HDsnprintf(
+ repr,
+ 4,
+ "%%%02X",
+ (unsigned char)(acc + stack[stack_size]));
+ if (chars_written < 0) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"cannot write char %c",
c);
+ }
*repr_len += 3;
/************************
@@ -3235,25 +3364,27 @@ H5FD_s3comms_percent_encode_char(char *repr,
/* 10xxxxxx */
for (i = 0; i < stack_size; i++) {
- chars_written = HDsnprintf(&repr[i*3 + 3],
- 4,
- "%%%02X",
- 128 + stack[stack_size - 1 - i]);
- if (chars_written != 3)
+ chars_written = HDsnprintf(
+ &repr[i*3 + 3],
+ 4,
+ "%%%02X",
+ (unsigned char)(0x80 + stack[stack_size - 1 - i]));
+ if (chars_written < 0) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"cannot write char %c",
c);
+ }
*repr_len += 3;
- }
- }
+ } /* end for each continuation byte */
+ } /* end else (multi-byte) */
+
*(repr + *repr_len) = '\0';
done:
FUNC_LEAVE_NOAPI(ret_value);
-
} /* H5FD_s3comms_percent_encode_char */
-
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_signing_key()
@@ -3301,13 +3432,15 @@ done:
*
*----------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_ROS3_VFD
+
herr_t
-H5FD_s3comms_signing_key(unsigned char *md,
- const char *secret,
- const char *region,
- const char *iso8601now)
+H5FD_s3comms_signing_key(
+ unsigned char *md,
+ const char *secret,
+ const char *region,
+ const char *iso8601now)
{
-#ifdef H5_HAVE_ROS3_VFD
char *AWS4_secret = NULL;
size_t AWS4_secret_len = 0;
unsigned char datekey[SHA256_DIGEST_LENGTH];
@@ -3315,16 +3448,9 @@ H5FD_s3comms_signing_key(unsigned char *md,
unsigned char dateregionservicekey[SHA256_DIGEST_LENGTH];
int ret = 0; /* return value of HDsnprintf */
herr_t ret_value = SUCCEED;
-#else
- herr_t ret_value = SUCCEED;
-#endif /* H5_HAVE_ROS3_VFD */
-
-
FUNC_ENTER_NOAPI_NOINIT
-#ifdef H5_HAVE_ROS3_VFD
-
#if S3COMMS_DEBUG
HDfprintf(stdout, "called H5FD_s3comms_signing_key.\n");
#endif
@@ -3356,10 +3482,11 @@ H5FD_s3comms_signing_key(unsigned char *md,
/* prepend "AWS4" to start of the secret key
*/
ret = HDsnprintf(AWS4_secret, AWS4_secret_len,"%s%s", "AWS4", secret);
- if ((size_t)ret != (AWS4_secret_len - 1))
+ if ((size_t)ret != (AWS4_secret_len - 1)) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"problem writing AWS4+secret `%s`",
secret);
+ }
/* hash_func, key, len(key), msg, len(msg), digest_dest, digest_len_dest
* we know digest length, so ignore via NULL
@@ -3396,13 +3523,26 @@ H5FD_s3comms_signing_key(unsigned char *md,
done:
H5MM_xfree(AWS4_secret);
-#endif /* H5_HAVE_ROS3_VFD */
-
FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5FD_s3comms_signing_key() */
+
+#else /* H5_HAVE_ROS3_VFD not defined */
-} /* H5FD_s3comms_signing_key */
+herr_t
+H5FD_s3comms_signing_key(
+ unsigned char H5_ATTR_UNUSED *md,
+ const char H5_ATTR_UNUSED *secret,
+ const char H5_ATTR_UNUSED *region,
+ const char H5_ATTR_UNUSED *iso8601now)
+{
+ herr_t ret_value = SUCCEED;
+ FUNC_ENTER_NOAPI_NOINIT_NOERR;
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5FD_s3comms_signing_key() */
+#endif /* H5_HAVE_ROS3_VFD */
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_tostringtosign()
@@ -3450,13 +3590,14 @@ done:
*
*----------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_ROS3_VFD
herr_t
-H5FD_s3comms_tostringtosign(char *dest,
- const char *req,
- const char *now,
- const char *region)
+H5FD_s3comms_tostringtosign(
+ char *dest,
+ const char *req,
+ const char *now,
+ const char *region)
{
-#ifdef H5_HAVE_ROS3_VFD
unsigned char checksum[SHA256_DIGEST_LENGTH * 2 + 1];
size_t d = 0;
char day[9];
@@ -3465,15 +3606,9 @@ H5FD_s3comms_tostringtosign(char *dest,
int ret = 0; /* HDsnprintf return value */
herr_t ret_value = SUCCEED;
char tmp[128];
-#else
- herr_t ret_value = FAIL;
-#endif /* H5_HAVE_ROS3_VFD */
-
FUNC_ENTER_NOAPI_NOINIT
-#ifdef H5_HAVE_ROS3_VFD
-
#if S3COMMS_DEBUG
HDfprintf(stdout, "called H5FD_s3comms_tostringtosign.\n");
#endif
@@ -3495,8 +3630,6 @@ H5FD_s3comms_tostringtosign(char *dest,
"Region cannot be NULL.\n")
}
-
-
for (i = 0; i < 128; i++) {
tmp[i] = '\0';
}
@@ -3507,11 +3640,10 @@ H5FD_s3comms_tostringtosign(char *dest,
HDstrncpy(day, now, 8);
day[8] = '\0';
ret = HDsnprintf(tmp, 127, "%s/%s/s3/aws4_request", day, region);
- if (ret <= 0 || ret >= 127)
+ if (ret <= 0 || ret >= 127) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"problem adding day and region to string")
-
-
+ }
HDmemcpy((dest + d), "AWS4-HMAC-SHA256\n", 17);
d = 17;
@@ -3528,11 +3660,12 @@ H5FD_s3comms_tostringtosign(char *dest,
HDstrlen(req),
checksum);
- if (FAIL ==
- H5FD_s3comms_bytes_to_hex(hexsum,
- (const unsigned char *)checksum,
- SHA256_DIGEST_LENGTH,
- true))
+ if (H5FD_s3comms_bytes_to_hex(
+ hexsum,
+ (const unsigned char *)checksum,
+ SHA256_DIGEST_LENGTH,
+ true)
+ == FAIL)
{
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"could not create hex string");
@@ -3544,14 +3677,27 @@ H5FD_s3comms_tostringtosign(char *dest,
dest[d] = '\0';
-#endif /* H5_HAVE_ROS3_VFD */
-
done:
FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5ros3_tostringtosign() */
+
+#else /* H5_HAVE_ROS3_VFD not defined */
-} /* H5ros3_tostringtosign */
+herr_t
+H5FD_s3comms_tostringtosign(
+ char H5_ATTR_UNUSED *dest,
+ const char H5_ATTR_UNUSED *req,
+ const char H5_ATTR_UNUSED *now,
+ const char H5_ATTR_UNUSED *region)
+{
+ herr_t ret_value = FAIL;
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5ros3_tostringtosign() */
+#endif /* H5_HAVE_ROS3_VFD */
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_trim()
@@ -3594,9 +3740,7 @@ H5FD_s3comms_trim(char *dest,
size_t s_len,
size_t *n_written)
{
- herr_t ret_value = SUCCEED;
-
-
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
@@ -3612,8 +3756,6 @@ H5FD_s3comms_trim(char *dest,
s_len = 0;
}
-
-
if (s_len > 0) {
/* Find first non-whitespace character from start;
* reduce total length per character.
@@ -3645,10 +3787,9 @@ H5FD_s3comms_trim(char *dest,
done:
FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_s3comms_trim() */
-} /* H5FD_s3comms_trim */
-
-
+
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_uriencode()
@@ -3698,11 +3839,12 @@ done:
*----------------------------------------------------------------------------
*/
herr_t
-H5FD_s3comms_uriencode(char *dest,
- const char *s,
- size_t s_len,
- hbool_t encode_slash,
- size_t *n_written)
+H5FD_s3comms_uriencode(
+ char *dest,
+ const char *s,
+ size_t s_len,
+ hbool_t encode_slash,
+ size_t *n_written)
{
char c = 0;
size_t dest_off = 0;
@@ -3712,20 +3854,20 @@ H5FD_s3comms_uriencode(char *dest,
herr_t ret_value = SUCCEED;
size_t s_off = 0;
-
-
FUNC_ENTER_NOAPI_NOINIT
#if S3COMMS_DEBUG
HDfprintf(stdout, "H5FD_s3comms_uriencode called.\n");
#endif
- if (s == NULL)
+ if (s == NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"source string cannot be NULL");
- if (dest == NULL)
+ }
+ if (dest == NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"destination cannot be NULL");
+ }
/* Write characters to destination, converting to percent-encoded
* "hex-utf-8" strings if necessary.
@@ -3741,12 +3883,14 @@ H5FD_s3comms_uriencode(char *dest,
(c == '/' && encode_slash == FALSE))
{
dest[dest_off++] = c;
- } else {
+ }
+ else {
hex_off = 0;
- if (FAIL ==
- H5FD_s3comms_percent_encode_char(hex_buffer,
- (const unsigned char)c,
- &hex_len))
+ if (H5FD_s3comms_percent_encode_char(
+ hex_buffer,
+ (const unsigned char)c,
+ &hex_len)
+ == FAIL)
{
hex_buffer[0] = c;
hex_buffer[1] = 0;
@@ -3758,8 +3902,8 @@ H5FD_s3comms_uriencode(char *dest,
for (hex_off = 0; hex_off < hex_len; hex_off++) {
dest[dest_off++] = hex_buffer[hex_off];
}
- }
- }
+ } /* end else (not a regular character) */
+ } /* end for each character */
if (dest_off < s_len)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
@@ -3769,7 +3913,6 @@ H5FD_s3comms_uriencode(char *dest,
done:
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5FD_s3comms_uriencode */
diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h
index 93a5a81..16f6a8b 100644
--- a/src/H5FDs3comms.h
+++ b/src/H5FDs3comms.h
@@ -577,7 +577,9 @@ H5_DLL herr_t H5FD_s3comms_s3r_read(s3r_t *handle,
H5_DLL struct tm * gmnow(void);
herr_t H5FD_s3comms_aws_canonical_request(char *canonical_request_dest,
+ int cr_size,
char *signed_headers_dest,
+ int sh_size,
hrb_t *http_request);
H5_DLL herr_t H5FD_s3comms_bytes_to_hex(char *dest,
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 7ed3ca8..29f017e 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -498,6 +498,9 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
oloc = NULL;
break;
+ case H5I_MAP:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "maps not supported in native VOL connector")
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_FILE:
@@ -2989,8 +2992,10 @@ H5F_set_retries(H5F_t *f)
/* Initialize the # of bins for retries */
f->shared->retries_nbins = 0;
if(f->shared->read_attempts > 1) {
- tmp = HDlog10((double)(f->shared->read_attempts - 1));
- f->shared->retries_nbins = (unsigned)tmp + 1;
+ /* Use HDceil to ensure that the log10 value is rounded up to the
+ nearest integer before casting to unsigned */
+ tmp = HDceil(HDlog10((double)f->shared->read_attempts));
+ f->shared->retries_nbins = (unsigned)tmp;
}
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -3600,6 +3605,9 @@ H5F__get_file(void *obj, H5I_type_t type)
oloc = H5A_oloc((H5A_t *)obj);
break;
+ case H5I_MAP:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "maps not supported in native VOL connector")
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_DATASPACE:
@@ -3641,7 +3649,7 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5F__get_file_id(H5F_t *file)
+H5F__get_file_id(H5F_t *file, hbool_t app_ref)
{
hid_t file_id = H5I_INVALID_HID; /* File ID */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -3654,13 +3662,13 @@ H5F__get_file_id(H5F_t *file)
/* If the ID does not exist, register it with the VOL connector */
if(H5I_INVALID_HID == file_id) {
- if((file_id = H5VL_wrap_register(H5I_FILE, file, TRUE)) < 0)
+ if((file_id = H5VL_wrap_register(H5I_FILE, file, app_ref)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
file->id_exists = TRUE;
} /* end if */
else {
/* Increment ref count on existing ID */
- if(H5I_inc_ref(file_id, TRUE) < 0)
+ if(H5I_inc_ref(file_id, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed")
} /* end else */
@@ -3684,7 +3692,7 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5F_get_file_id(hid_t obj_id, H5I_type_t type)
+H5F_get_file_id(hid_t obj_id, H5I_type_t type, hbool_t app_ref)
{
H5VL_object_t *vol_obj; /* File info */
hid_t file_id = H5I_INVALID_HID; /* File ID for object */
@@ -3697,7 +3705,7 @@ H5F_get_file_id(hid_t obj_id, H5I_type_t type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier")
/* Get the file through the VOL */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FILE_ID, (int)type, &file_id) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FILE_ID, (int)type, (int)app_ref, &file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file ID")
if(H5I_INVALID_HID == file_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file ID through the VOL")
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c
index 5bbd717..12bcbc0 100644
--- a/src/H5Fmpi.c
+++ b/src/H5Fmpi.c
@@ -90,14 +90,14 @@ herr_t
H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle)
{
herr_t ret_value = SUCCEED;
- hid_t fapl = -1;
+ hid_t fapl_id = H5I_INVALID_HID;
FUNC_ENTER_NOAPI(FAIL)
HDassert(f && f->shared);
/* Dispatch to driver */
- if ((ret_value = H5FD_get_vfd_handle(f->shared->lf, fapl, (void **)f_handle)) < 0)
+ if ((ret_value = H5FD_get_vfd_handle(f->shared->lf, fapl_id, (void **)f_handle)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file handle")
done:
@@ -106,33 +106,31 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_mpi_get_rank
+ * Function: H5F_mpi_get_rank
*
- * Purpose: Retrieves the rank of an MPI process.
+ * Purpose: Retrieves the rank of an MPI process.
*
- * Return: Success: The rank (non-negative)
+ * Return: Success: The rank (non-negative)
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Friday, January 30, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
H5F_mpi_get_rank(const H5F_t *f)
{
- int ret_value;
+ int ret_value = -1;
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI((-1))
HDassert(f && f->shared);
/* Dispatch to driver */
- if ((ret_value=H5FD_mpi_get_rank(f->shared->lf)) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_rank request failed")
+ if ((ret_value = H5FD_mpi_get_rank(f->shared->lf)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "driver get_rank request failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -140,32 +138,30 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_mpi_get_comm
+ * Function: H5F_mpi_get_comm
*
- * Purpose: Retrieves the file's communicator
+ * Purpose: Retrieves the file's communicator
*
- * Return: Success: The communicator (non-negative)
+ * Return: Success: The communicator (non-negative)
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Friday, January 30, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
MPI_Comm
H5F_mpi_get_comm(const H5F_t *f)
{
- MPI_Comm ret_value;
+ MPI_Comm ret_value = MPI_COMM_NULL;
FUNC_ENTER_NOAPI(MPI_COMM_NULL)
HDassert(f && f->shared);
/* Dispatch to driver */
- if ((ret_value=H5FD_mpi_get_comm(f->shared->lf))==MPI_COMM_NULL)
+ if ((ret_value = H5FD_mpi_get_comm(f->shared->lf)) == MPI_COMM_NULL)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, MPI_COMM_NULL, "driver get_comm request failed")
done:
@@ -185,22 +181,20 @@ done:
* Programmer: John Mainzer
* Friday, May 6, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
H5F_mpi_get_size(const H5F_t *f)
{
- int ret_value;
+ int ret_value = -1;
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI((-1))
HDassert(f && f->shared);
/* Dispatch to driver */
- if ((ret_value=H5FD_mpi_get_size(f->shared->lf)) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_size request failed")
+ if ((ret_value = H5FD_mpi_get_size(f->shared->lf)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "driver get_size request failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -208,16 +202,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fset_mpi_atomicity
+ * Function: H5Fset_mpi_atomicity
*
- * Purpose: Sets the atomicity mode
+ * Purpose: Sets the atomicity mode
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Mohamad Chaarawi
- * Feb 14, 2012
+ * Programmer: Mohamad Chaarawi
+ * Feb 14, 2012
*
*-------------------------------------------------------------------------
*/
@@ -248,16 +242,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_mpi_atomicity
+ * Function: H5Fget_mpi_atomicity
*
- * Purpose: Returns the atomicity mode
+ * Purpose: Returns the atomicity mode
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Mohamad Chaarawi
- * Feb 14, 2012
+ * Programmer: Mohamad Chaarawi
+ * Feb 14, 2012
*
*-------------------------------------------------------------------------
*/
@@ -288,18 +282,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_mpi_retrieve_comm
+ * Function: H5F_mpi_retrieve_comm
*
- * Purpose: Retrieves an MPI communicator from the file the location ID
+ * Purpose: Retrieves an MPI communicator from the file the location ID
* is in. If the loc_id is invalid, the fapl_id is used to
* retrieve the communicator.
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Mohamad Chaarawi
- * Feb 14, 2012
+ * Programmer: Mohamad Chaarawi
+ * Feb 14, 2012
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 1dd07c1..dbf68c3 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -408,7 +408,7 @@ H5_DLL herr_t H5F__start_swmr_write(H5F_t *f);
H5_DLL herr_t H5F__close(H5F_t *f);
H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high);
H5_DLL H5F_t *H5F__get_file(void *obj, H5I_type_t type);
-H5_DLL hid_t H5F__get_file_id(H5F_t *file);
+H5_DLL hid_t H5F__get_file_id(H5F_t *file, hbool_t app_ref);
/* File mount related routines */
H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index a8ac158..838fa28 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -718,7 +718,7 @@ typedef enum H5F_prefix_open_t {
/* Private functions */
H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/);
-H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type);
+H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type, hbool_t app_ref);
/* Functions that retrieve values from the file struct */
H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f);
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index 95627d2..5acb378 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -131,6 +131,9 @@ H5G_map_obj_type(H5O_type_t obj_type)
ret_value = H5G_TYPE;
break;
+ case H5O_TYPE_MAP:
+ /* Maps not supported in native VOL connector */
+
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index e47d3be..40d56c6 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -213,6 +213,9 @@ H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc)
case H5I_DATASPACE:
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of dataspace")
+ case H5I_MAP:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maps not supported in native VOL connector")
+
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of property list")
diff --git a/src/H5Gname.c b/src/H5Gname.c
index 16c1ca7..86a0c2f 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -816,6 +816,9 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
obj_path = H5T_nameof((H5T_t *)obj_ptr);
break;
+ case H5I_MAP:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector")
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_FILE:
@@ -1112,6 +1115,9 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file,
search_datatype = TRUE;
break;
+ case H5O_TYPE_MAP:
+ HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector")
+
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
/* Search and replace names through datatype IDs */
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index 0b431b1..f9ab6f2 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -604,6 +604,9 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign
obj_path = H5T_nameof((H5T_t *)obj_ptr);
break;
+ case H5I_MAP:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector")
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_FILE:
diff --git a/src/H5I.c b/src/H5I.c
index 6b5210d..ab68e38 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -2219,7 +2219,7 @@ H5Iget_file_id(hid_t obj_id)
/* Call internal function */
if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) {
- if ((ret_value = H5F_get_file_id(obj_id, type)) < 0)
+ if ((ret_value = H5F_get_file_id(obj_id, type, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID")
} /* end if */
else
@@ -2371,6 +2371,11 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
break;
}
+ /* TODO: Maps will have to be added when they are supported in the
+ * native VOL connector.
+ */
+ case H5I_MAP:
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_FILE:
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index def785f..34a408f 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -38,6 +38,7 @@ typedef enum H5I_type_t {
H5I_DATATYPE, /* type ID for Datatype objects */
H5I_DATASPACE, /* type ID for Dataspace objects */
H5I_DATASET, /* type ID for Dataset objects */
+ H5I_MAP, /* type ID for Map objects */
H5I_ATTR, /* type ID for Attribute objects */
H5I_VFL, /* type ID for virtual file layer */
H5I_VOL, /* type ID for virtual object layer */
diff --git a/src/H5M.c b/src/H5M.c
new file mode 100644
index 0000000..adb4df0
--- /dev/null
+++ b/src/H5M.c
@@ -0,0 +1,1032 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Mmodule.h" /* This source code file is part of the H5M module */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Mpkg.h" /* Maps */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+static herr_t H5M__close_cb(H5VL_object_t *map_vol_obj);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Map ID class */
+static const H5I_class_t H5I_MAP_CLS[1] = {{
+ H5I_MAP, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5M__close_cb /* Callback routine for closing objects of this class */
+}};
+
+/* Flag indicating "top" of interface has been initialized */
+static hbool_t H5M_top_package_initialize_s = FALSE;
+
+
+
+/*-------------------------------------------------------------------------
+NAME
+ H5M__init_package -- Initialize interface-specific information
+USAGE
+ herr_t H5M__init_package()
+
+RETURNS
+ Non-negative on success/Negative on failure
+DESCRIPTION
+ Initializes any interface-specific data or routines.
+---------------------------------------------------------------------------
+*/
+herr_t
+H5M__init_package(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Initialize the atom group for the map IDs */
+ if(H5I_register_type(H5I_MAP_CLS) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, FAIL, "unable to initialize interface")
+
+ /* Mark "top" of interface as initialized, too */
+ H5M_top_package_initialize_s = TRUE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5M__init_package() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5M_top_term_package
+ *
+ * Purpose: Close the "top" of the interface, releasing IDs, etc.
+ *
+ * Return: Success: Positive if anything was done that might
+ * affect other interfaces; zero otherwise.
+ * Failure: Negative.
+ *-------------------------------------------------------------------------
+ */
+int
+H5M_top_term_package(void)
+{
+ int n = 0;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ if(H5M_top_package_initialize_s) {
+ if(H5I_nmembers(H5I_MAP) > 0) {
+ (void)H5I_clear_type(H5I_MAP, FALSE, FALSE);
+ n++; /*H5I*/
+ } /* end if */
+
+ /* Mark closed */
+ if(0 == n)
+ H5M_top_package_initialize_s = FALSE;
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(n)
+} /* end H5M_top_term_package() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5M_term_package
+ *
+ * Purpose: Terminate this interface.
+ *
+ * Note: Finishes shutting down the interface, after
+ * H5M_top_term_package() is called
+ *
+ * Return: Success: Positive if anything was done that might
+ * affect other interfaces; zero otherwise.
+ * Failure: Negative.
+ *-------------------------------------------------------------------------
+ */
+int
+H5M_term_package(void)
+{
+ int n = 0;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ if(H5_PKG_INIT_VAR) {
+ /* Sanity checks */
+ HDassert(0 == H5I_nmembers(H5I_MAP));
+ HDassert(FALSE == H5M_top_package_initialize_s);
+
+ /* Destroy the dataset object id group */
+ n += (H5I_dec_type_ref(H5I_MAP) > 0);
+
+ /* Mark closed */
+ if(0 == n)
+ H5_PKG_INIT_VAR = FALSE;
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(n)
+} /* end H5M_term_package() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5M__close_cb
+ *
+ * Purpose: Called when the ref count reaches zero on the map's ID
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5M__close_cb(H5VL_object_t *map_vol_obj)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(map_vol_obj);
+
+ /* Close the map */
+ if(H5VL_optional(map_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CLOSEERROR, FAIL, "unable to close map");
+
+ /* Free the VOL object */
+ if(H5VL_free_object(map_vol_obj) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "unable to free VOL object");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5M__close_cb() */
+
+#ifdef H5_HAVE_MAP_API
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Mcreate
+ *
+ * Purpose: Creates a new map object for storing key-value pairs. The
+ * in-file datatype for keys is defined by KEY_TYPE_ID and
+ * the in-file datatype for values is defined by VAL_TYPE_ID.
+ * LOC_ID specifies the location to create the map object and
+ * NAME specifies the name of the link to the object
+ * (relative to LOC_ID). Other options can be specified
+ * through the property lists LCPL_ID, MCPL_ID, and MAPL_ID.
+ *
+ * Return: Success: The object ID of the new map.
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id,
+ hid_t lcpl_id, hid_t mcpl_id, hid_t mapl_id)
+{
+ void *map = NULL; /* New map's info */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE7("i", "i*siiiii", loc_id, name, key_type_id, val_type_id, lcpl_id,
+ mcpl_id, mapl_id);
+
+ /* Check arguments */
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
+
+ /* Get link creation property list */
+ if(H5P_DEFAULT == lcpl_id)
+ lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "lcpl_id is not a link creation property list")
+
+ /* Get map creation property list */
+ if(H5P_DEFAULT == mcpl_id)
+ mcpl_id = H5P_MAP_CREATE_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(mcpl_id, H5P_MAP_CREATE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "mcpl_id is not a map create property list ID")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&mapl_id, H5P_CLS_MACC, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+
+ /* Get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Create the map */
+ if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CREATE, &loc_params, name, lcpl_id,
+ key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map")
+
+ /* Get an atom for the map */
+ if((ret_value = H5VL_register(H5I_MAP, map, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize map handle")
+
+done:
+ /* Cleanup on failure */
+ if(H5I_INVALID_HID == ret_value)
+ if(map && H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Mcreate() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Mcreate_anon
+ *
+ * Purpose: Creates a new map object for storing key-value pairs. The
+ * in-file datatype for keys is defined by KEY_TYPE_ID and
+ * the in-file datatype for values is defined by VAL_TYPE_ID.
+ * LOC_ID specifies the file to create the map object, but no
+ * link to the object is created. Other options can be
+ * specified through the property lists LCPL_ID, MCPL_ID, and
+ * MAPL_ID.
+ *
+ * The resulting ID should be linked into the file with
+ * H5Olink or it will be deleted when closed.
+ *
+ * Return: Success: The object ID of the new map. The map should
+ * be linked into the group hierarchy before being closed or
+ * it will be deleted. The dataset should be
+ * closed when the caller is no longer interested
+ * in it.
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id,
+ hid_t mcpl_id, hid_t mapl_id)
+{
+ void *map = NULL; /* map token from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE5("i", "iiiii", loc_id, key_type_id, val_type_id, mcpl_id, mapl_id);
+
+ /* Check arguments */
+ if(H5P_DEFAULT == mcpl_id)
+ mcpl_id = H5P_MAP_CREATE_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(mcpl_id, H5P_MAP_CREATE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not map create property list ID")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&mapl_id, H5P_CLS_MACC, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Create the map */
+ if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CREATE, &loc_params, NULL, H5P_LINK_CREATE_DEFAULT,
+ key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map")
+
+ /* Get an atom for the map */
+ if((ret_value = H5VL_register(H5I_MAP, map, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register map")
+
+done:
+ /* Cleanup on failure */
+ if(H5I_INVALID_HID == ret_value)
+ if(map && H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Mcreate_anon() */
+
+
+/*------------------------------------------------------------------------
+ * Function: H5Mopen
+ *
+ * Purpose: Finds a map named NAME at LOC_ID, opens it, and returns
+ * its ID. The map should be close when the caller is no
+ * longer interested in it.
+ *
+ * Takes a map access property list
+ *
+ * Return: Success: Object ID of the map
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id)
+{
+ void *map = NULL; /* map token from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE3("i", "i*si", loc_id, name, mapl_id);
+
+ /* Check args */
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&mapl_id, H5P_CLS_MACC, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Set the location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Open the map */
+ if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_OPEN, &loc_params, name, mapl_id, &map) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open map")
+
+ /* Register an atom for the map */
+ if((ret_value = H5VL_register(H5I_MAP, map, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register map atom")
+
+done:
+ /* Cleanup on failure */
+ if(H5I_INVALID_HID == ret_value)
+ if(map && H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Mopen() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Mclose
+ *
+ * Purpose: Closes access to a map and releases resources used by it.
+ * It is illegal to subsequently use that same map ID in
+ * calls to other map functions.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Mclose(hid_t map_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "i", map_id);
+
+ /* Check args */
+ if(H5I_MAP != H5I_get_type(map_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a map ID")
+
+ /* Decrement the counter on the map. It will be freed if the count
+ * reaches zero.
+ */
+ if(H5I_dec_app_ref_always_close(map_id) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "can't decrement count on map ID")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Mclose() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Mget_key_type
+ *
+ * Purpose: Returns a copy of the key datatype for a map.
+ *
+ * Return: Success: ID for a copy of the datatype. The data
+ * type should be released by calling
+ * H5Tclose().
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Mget_key_type(hid_t map_id)
+{
+ H5VL_object_t *vol_obj; /* Map structure */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE1("i", "i", map_id);
+
+ /* Check args */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
+
+ /* get the datatype */
+ if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_KEY_TYPE, &ret_value) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Mget_key_type() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Mget_val_type
+ *
+ * Purpose: Returns a copy of the value datatype for a map.
+ *
+ * Return: Success: ID for a copy of the datatype. The data
+ * type should be released by calling
+ * H5Tclose().
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Mget_val_type(hid_t map_id)
+{
+ H5VL_object_t *vol_obj; /* Map structure */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE1("i", "i", map_id);
+
+ /* Check args */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
+
+ /* get the datatype */
+ if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_VAL_TYPE, &ret_value) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Mget_val_type() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Mget_create_plist
+ *
+ * Purpose: Returns a copy of the map creation property list.
+ *
+ * Return: Success: ID for a copy of the map creation
+ * property list. The template should be
+ * released by calling H5P_close().
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Mget_create_plist(hid_t map_id)
+{
+ H5VL_object_t *vol_obj; /* Map structure */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE1("i", "i", map_id);
+
+ /* Check args */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
+
+ /* Get the map creation property list */
+ if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_MCPL, &ret_value) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map creation properties")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Mget_create_plist() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Mget_access_plist
+ *
+ * Purpose: Returns a copy of the map access property list.
+ *
+ * Description: H5Mget_access_plist returns the map access property
+ * list identifier of the specified map.
+ *
+ * Return: Success: ID for a copy of the map access
+ * property list. The template should be
+ * released by calling H5Pclose().
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Mget_access_plist(hid_t map_id)
+{
+ H5VL_object_t *vol_obj; /* Map structure */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE1("i", "i", map_id);
+
+ /* Check args */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
+
+ /* Get the map access property list */
+ if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_MAPL, &ret_value) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Mget_access_plist() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Mget_count
+ *
+ * Purpose: Returns the number of key-value pairs stored in the map.
+ *
+ * Description: H5Mget_count returns the number of key-value pairs stored
+ * in the specified map.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Mget_count(hid_t map_id, hsize_t *count, hid_t dxpl_id)
+{
+ H5VL_object_t *vol_obj; /* Map structure */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE3("e", "i*hi", map_id, count, dxpl_id);
+
+ /* Check args */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
+
+ /* Get the default dataset transfer property list if the user didn't provide one */
+ if (H5P_DEFAULT == dxpl_id)
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ else
+ if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
+
+ /* Set DXPL for operation */
+ H5CX_set_dxpl(dxpl_id);
+
+ /* Get the number of key-value pairs stored in the map */
+ if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_COUNT, count) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Mget_count() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Mput
+ *
+ * Purpose: H5Mput adds a key-value pair to the Map specified by
+ * MAP_ID, or updates the value for the specified key if one
+ * was set previously. KEY_MEM_TYPE_ID and VAL_MEM_TYPE_ID
+ * specify the datatypes for the provided KEY and VALUE
+ * buffers, and if different from those used to create the
+ * map object, the key and value will be internally converted
+ * to the datatypes for the map object. Any further options
+ * can be specified through the property list DXPL_ID.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Mput(hid_t map_id, hid_t key_mem_type_id, const void *key,
+ hid_t val_mem_type_id, const void *value, hid_t dxpl_id)
+{
+ H5VL_object_t *vol_obj = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE6("e", "ii*xi*xi", map_id, key_mem_type_id, key, val_mem_type_id, value,
+ dxpl_id);
+
+ /* Check arguments */
+ if (key_mem_type_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID")
+ if (val_mem_type_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid value memory datatype ID")
+
+ /* Get map pointer */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID")
+
+ /* Get the default dataset transfer property list if the user didn't provide one */
+ if (H5P_DEFAULT == dxpl_id)
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ else
+ if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
+
+ /* Set DXPL for operation */
+ H5CX_set_dxpl(dxpl_id);
+
+ /* Set the key/value pair */
+ if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_PUT, key_mem_type_id, key, val_mem_type_id, value) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to put key/value pair")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Mput() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Mget
+ *
+ * Purpose: H5Mget retrieves, from the Map specified by MAP_ID, the
+ * value associated with the provided key. KEY_MEM_TYPE_ID
+ * and VAL_MEM_TYPE_ID specify the datatypes for the provided
+ * KEY and VALUE buffers. If KEY_MEM_TYPE_ID is different
+ * from that used to create the map object, the key will be
+ * internally converted to the datatype for the map object
+ * for the query, and if VAL_MEM_TYPE_ID is different from
+ * that used to create the map object, the returned value
+ * will be converted to VAL_MEM_TYPE_ID before the function
+ * returns. Any further options can be specified through the
+ * property list DXPL_ID.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Mget(hid_t map_id, hid_t key_mem_type_id, const void *key,
+ hid_t val_mem_type_id, void *value, hid_t dxpl_id)
+{
+ H5VL_object_t *vol_obj = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE6("e", "ii*xi*xi", map_id, key_mem_type_id, key, val_mem_type_id, value,
+ dxpl_id);
+
+ /* Check arguments */
+ if (key_mem_type_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID")
+ if (val_mem_type_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid value memory datatype ID")
+
+ /* Get map pointer */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID")
+
+ /* Get the default dataset transfer property list if the user didn't provide one */
+ if (H5P_DEFAULT == dxpl_id)
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ else
+ if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
+
+ /* Set DXPL for operation */
+ H5CX_set_dxpl(dxpl_id);
+
+ /* Get the value for the key */
+ if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_GET_VAL, key_mem_type_id, key, val_mem_type_id, value) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Mget() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Mexists
+ *
+ * Purpose: H5Mexists checks if the provided key is stored in the map
+ * specified by MAP_ID. If KEY_MEM_TYPE_ID is different from
+ * that used to create the map object the key will be
+ * internally converted to the datatype for the map object
+ * for the query.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists,
+ hid_t dxpl_id)
+{
+ H5VL_object_t *vol_obj = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE5("e", "ii*x*bi", map_id, key_mem_type_id, key, exists, dxpl_id);
+
+ /* Check arguments */
+ if (key_mem_type_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID")
+
+ /* Get map pointer */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID")
+
+ /* Get the default dataset transfer property list if the user didn't provide one */
+ if (H5P_DEFAULT == dxpl_id)
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ else
+ if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
+
+ /* Set DXPL for operation */
+ H5CX_set_dxpl(dxpl_id);
+
+ /* Check if key exists */
+ if((ret_value = H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_EXISTS, key_mem_type_id, key, exists)) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTGET, ret_value, "unable to check if key exists")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Mexists() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Miterate
+ *
+ * Purpose: H5Miterate iterates over all key-value pairs stored in the
+ * map specified by MAP_ID, making the callback specified by
+ * OP for each. The IDX parameter is an in/out parameter that
+ * may be used to restart a previously interrupted iteration.
+ * At the start of iteration IDX should be set to 0, and to
+ * restart iteration at the same location on a subsequent
+ * call to H5Miterate, IDX should be the same value as
+ * returned by the previous call.
+ *
+ * H5M_iterate_t is defined as:
+ * herr_t (*H5M_iterate_t)(hid_t map_id, const void *key,
+ * void *ctx)
+ *
+ * The KEY parameter is the buffer for the key for this
+ * iteration, converted to the datatype specified by
+ * KEY_MEM_TYPE_ID. The OP_DATA parameter is a simple pass
+ * through of the value passed to H5Miterate, which can be
+ * used to store application-defined data for iteration. A
+ * negative return value from this function will cause
+ * H5Miterate to issue an error, while a positive return
+ * value will cause H5Miterate to stop iterating and return
+ * this value without issuing an error. A return value of
+ * zero allows iteration to continue.
+ *
+ * Return: Last value returned by op
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op,
+ void *op_data, hid_t dxpl_id)
+{
+ H5VL_object_t *vol_obj = NULL;
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE6("e", "i*hix*xi", map_id, idx, key_mem_type_id, op, op_data, dxpl_id);
+
+ /* Check arguments */
+ if (key_mem_type_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID")
+ if (!op)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
+
+ /* Get map pointer */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID")
+
+ /* Get the default dataset transfer property list if the user didn't provide one */
+ if (H5P_DEFAULT == dxpl_id)
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ else
+ if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
+
+ /* Set DXPL for operation */
+ H5CX_set_dxpl(dxpl_id);
+
+ /* Set location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(map_id);
+
+ /* Iterate over keys */
+ if((ret_value = H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to ierate over keys")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Miterate() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Miterate_by_name
+ *
+ * Purpose: H5Miterate_by_name iterates over all key-value pairs
+ * stored in the map specified by MAP_ID, making the callback
+ * specified by OP for each. The IDX parameter is an in/out
+ * parameter that may be used to restart a previously
+ * interrupted iteration. At the start of iteration IDX
+ * should be set to 0, and to restart iteration at the same
+ * location on a subsequent call to H5Miterate, IDX should be
+ * the same value as returned by the previous call.
+ *
+ * H5M_iterate_t is defined as:
+ * herr_t (*H5M_iterate_t)(hid_t map_id, const void *key,
+ * void *ctx)
+ *
+ * The KEY parameter is the buffer for the key for this
+ * iteration, converted to the datatype specified by
+ * KEY_MEM_TYPE_ID. The OP_DATA parameter is a simple pass
+ * through of the value passed to H5Miterate, which can be
+ * used to store application-defined data for iteration. A
+ * negative return value from this function will cause
+ * H5Miterate to issue an error, while a positive return
+ * value will cause H5Miterate to stop iterating and return
+ * this value without issuing an error. A return value of
+ * zero allows iteration to continue.
+ *
+ * Return: Last value returned by op
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx,
+ hid_t key_mem_type_id, H5M_iterate_t op, void *op_data, hid_t dxpl_id,
+ hid_t lapl_id)
+{
+ H5VL_object_t *vol_obj = NULL;
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE8("e", "i*s*hix*xii", loc_id, map_name, idx, key_mem_type_id, op,
+ op_data, dxpl_id, lapl_id);
+
+ /* Check arguments */
+ if(!map_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "map_name parameter cannot be NULL")
+ if(!*map_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "map_name parameter cannot be an empty string")
+ if (key_mem_type_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID")
+ if (!op)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
+
+ /* Get the location object */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get the default dataset transfer property list if the user didn't provide one */
+ if (H5P_DEFAULT == dxpl_id)
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ else
+ if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
+
+ /* Set DXPL for operation */
+ H5CX_set_dxpl(dxpl_id);
+
+ /* Set location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.loc_data.loc_by_name.name = map_name;
+ loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+
+ /* Iterate over keys */
+ if((ret_value = H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to ierate over keys")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Miterate_by_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Mdelete
+ *
+ * Purpose: H5Mdelete deletes a key-value pair from the Map
+ * specified by MAP_ID. KEY_MEM_TYPE_ID specifies the
+ * datatype for the provided key buffers, and if different
+ * from that used to create the Map object, the key will be
+ * internally converted to the datatype for the map object.
+ * Any further options can be specified through the property
+ * list DXPL_ID.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key,
+ hid_t dxpl_id)
+{
+ H5VL_object_t *vol_obj = NULL;
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "ii*xi", map_id, key_mem_type_id, key, dxpl_id);
+
+ /* Check arguments */
+ if (key_mem_type_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID")
+
+ /* Get map pointer */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID")
+
+ /* Get the default dataset transfer property list if the user didn't provide one */
+ if (H5P_DEFAULT == dxpl_id)
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ else
+ if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
+
+ /* Set DXPL for operation */
+ H5CX_set_dxpl(dxpl_id);
+
+ /* Set location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(map_id);
+
+ /* Delete the key/value pair */
+ if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_DELETE, key_mem_type_id, key) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to delete key/value pair")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Mdelete() */
+
+#endif /* H5_HAVE_MAP_API */
+
diff --git a/src/H5Mmodule.h b/src/H5Mmodule.h
new file mode 100644
index 0000000..00a586f
--- /dev/null
+++ b/src/H5Mmodule.h
@@ -0,0 +1,31 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: This file contains declarations which define macros for the
+ * H5M package. Including this header means that the source file
+ * is part of the H5M package.
+ */
+#ifndef _H5Mmodule_H
+#define _H5Mmodule_H
+
+/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
+ * reporting macros.
+ */
+#define H5M_MODULE
+#define H5_MY_PKG H5M
+#define H5_MY_PKG_ERR H5E_MAP
+#define H5_MY_PKG_INIT YES
+
+#endif /* _H5Dmodule_H */
+
+
diff --git a/src/H5Mpkg.h b/src/H5Mpkg.h
new file mode 100644
index 0000000..86ff45c
--- /dev/null
+++ b/src/H5Mpkg.h
@@ -0,0 +1,51 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: This file contains declarations which are visible only within
+ * the H5M package. Source files outside the H5M package should
+ * include H5Mprivate.h instead.
+ */
+#if !(defined H5M_FRIEND || defined H5M_MODULE)
+#error "Do not include this file outside the H5M package!"
+#endif
+
+#ifndef _H5Mpkg_H
+#define _H5Mpkg_H
+
+/* Get package's private header */
+#include "H5Mprivate.h"
+
+/* Other private headers needed by this file */
+
+/**************************/
+/* Package Private Macros */
+/**************************/
+
+
+/****************************/
+/* Package Private Typedefs */
+/****************************/
+
+
+/*****************************/
+/* Package Private Variables */
+/*****************************/
+
+
+/******************************/
+/* Package Private Prototypes */
+/******************************/
+
+#endif /*_H5Dpkg_H*/
+
diff --git a/src/H5Mprivate.h b/src/H5Mprivate.h
new file mode 100644
index 0000000..c841e75
--- /dev/null
+++ b/src/H5Mprivate.h
@@ -0,0 +1,80 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * This file contains private information about the H5M module
+ */
+#ifndef _H5Mprivate_H
+#define _H5Mprivate_H
+
+/* Include package's public header */
+#include "H5Mpublic.h"
+
+/* Private headers needed by this file */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Sprivate.h" /* Dataspaces */
+#include "H5Zprivate.h" /* Data filters */
+
+
+/**************************/
+/* Library Private Macros */
+/**************************/
+
+/*
+ * Feature: Define H5M_DEBUG on the compiler command line if you want to
+ * debug maps. NDEBUG must not be defined in order for this
+ * to have any effect.
+ */
+#ifdef NDEBUG
+# undef H5M_DEBUG
+#endif
+
+/* ======== Map creation property names ======== */
+
+/* ======== Map access property names ======== */
+#define H5M_ACS_KEY_PREFETCH_SIZE_NAME "key_prefetch_size" /* Number of keys to prefetch during map iteration */
+#define H5M_ACS_KEY_ALLOC_SIZE_NAME "key_alloc_size" /* Initial allocation size for keys prefetched during map iteration */
+
+/* Default temporary buffer size */
+#define H5D_TEMP_BUF_SIZE (1024 * 1024)
+
+/* Default I/O vector size */
+#define H5D_IO_VECTOR_SIZE 1024
+
+/* Default VL allocation & free info */
+#define H5D_VLEN_ALLOC NULL
+#define H5D_VLEN_ALLOC_INFO NULL
+#define H5D_VLEN_FREE NULL
+#define H5D_VLEN_FREE_INFO NULL
+
+/* Default virtual dataset list size */
+#define H5D_VIRTUAL_DEF_LIST_SIZE 8
+
+
+/****************************/
+/* Library Private Typedefs */
+/****************************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/******************************/
+/* Library Private Prototypes */
+/******************************/
+
+#endif /* _H5Mprivate_H */
+
diff --git a/src/H5Mpublic.h b/src/H5Mpublic.h
new file mode 100644
index 0000000..9cbdb32
--- /dev/null
+++ b/src/H5Mpublic.h
@@ -0,0 +1,126 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * This file contains public declarations for the H5M module.
+ *
+ * NOTE: This is an experimental API. Everything in the H5M package
+ * is subject to revision in a future release.
+ */
+#ifndef _H5Mpublic_H
+#define _H5Mpublic_H
+
+/* System headers needed by this file */
+
+/* Public headers needed by this file */
+#include "H5public.h"
+#include "H5Ipublic.h"
+
+
+/*****************/
+/* Public Macros */
+/*****************/
+
+/* Macros defining operation IDs for map VOL callbacks (implemented using the
+ * "optional" VOL callback) */
+#define H5VL_MAP_CREATE 1
+#define H5VL_MAP_OPEN 2
+#define H5VL_MAP_GET_VAL 3
+#define H5VL_MAP_EXISTS 4
+#define H5VL_MAP_PUT 5
+#define H5VL_MAP_GET 6
+#define H5VL_MAP_SPECIFIC 7
+#define H5VL_MAP_CLOSE 8
+
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
+/* types for map GET callback */
+typedef enum H5VL_map_get_t {
+ H5VL_MAP_GET_MAPL, /* map access property list */
+ H5VL_MAP_GET_MCPL, /* map creation property list */
+ H5VL_MAP_GET_KEY_TYPE, /* key type */
+ H5VL_MAP_GET_VAL_TYPE, /* value type */
+ H5VL_MAP_GET_COUNT /* key count */
+} H5VL_map_get_t;
+
+/* types for map SPECIFIC callback */
+typedef enum H5VL_map_specific_t {
+ H5VL_MAP_ITER, /* H5Miterate */
+ H5VL_MAP_DELETE /* H5Mdelete */
+} H5VL_map_specific_t;
+
+/* Callback for H5Miterate() */
+typedef herr_t (*H5M_iterate_t)(hid_t map_id, const void *key, void *op_data);
+
+
+/********************/
+/* Public Variables */
+/********************/
+
+
+/*********************/
+/* Public Prototypes */
+/*********************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* The map API is only built when requested since there's no support in
+ * the native file format at this time. It's only supported in a few VOL
+ * connectors.
+ */
+#ifdef H5_HAVE_MAP_API
+
+H5_DLL hid_t H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id,
+ hid_t val_type_id, hid_t lcpl_id, hid_t mcpl_id, hid_t mapl_id);
+H5_DLL hid_t H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id,
+ hid_t mcpl_id, hid_t mapl_id);
+H5_DLL hid_t H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id);
+H5_DLL herr_t H5Mclose(hid_t map_id);
+H5_DLL hid_t H5Mget_key_type(hid_t map_id);
+H5_DLL hid_t H5Mget_val_type(hid_t map_id);
+H5_DLL hid_t H5Mget_create_plist(hid_t map_id);
+H5_DLL hid_t H5Mget_access_plist(hid_t map_id);
+H5_DLL herr_t H5Mget_count(hid_t map_id, hsize_t *count, hid_t dxpl_id);
+H5_DLL herr_t H5Mput(hid_t map_id, hid_t key_mem_type_id, const void *key,
+ hid_t val_mem_type_id, const void *value, hid_t dxpl_id);
+H5_DLL herr_t H5Mget(hid_t map_id, hid_t key_mem_type_id, const void *key,
+ hid_t val_mem_type_id, void *value, hid_t dxpl_id);
+H5_DLL herr_t H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key,
+ hbool_t *exists, hid_t dxpl_id);
+H5_DLL herr_t H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id,
+ H5M_iterate_t op, void *op_data, hid_t dxpl_id);
+H5_DLL herr_t H5Miterate_by_name(hid_t loc_id, const char *map_name,
+ hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op, void *op_data,
+ hid_t dxpl_id, hid_t lapl_id);
+H5_DLL herr_t H5Mdelete(hid_t map_id, hid_t key_mem_type_id,
+ const void *key, hid_t dxpl_id);
+
+/* Symbols defined for compatibility with previous versions of the HDF5 API.
+ *
+ * Use of these symbols is deprecated.
+ */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+#endif /* H5_HAVE_MAP_API */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H5Mpublic_H */
+
diff --git a/src/H5O.c b/src/H5O.c
index 093d429..e7351fc 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1084,6 +1084,7 @@ H5Oclose(hid_t object_id)
case H5I_GROUP:
case H5I_DATATYPE:
case H5I_DATASET:
+ case H5I_MAP:
if(H5I_object(object_id) == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object")
if(H5I_dec_app_ref(object_id) < 0)
diff --git a/src/H5Oflush.c b/src/H5Oflush.c
index f5ede4a..a03cfa1 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -479,6 +479,9 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_connector
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to finish refresh for dataset")
break;
+ case H5I_MAP:
+ HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector")
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_FILE:
diff --git a/src/H5Oint.c b/src/H5Oint.c
index 45a8046..e37eea5 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -1836,6 +1836,9 @@ H5O_get_loc(hid_t object_id)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from datatype ID")
break;
+ case H5I_MAP:
+ HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "maps not supported in native VOL connector")
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_FILE:
diff --git a/src/H5Opublic.h b/src/H5Opublic.h
index c868e72..234f4f0 100644
--- a/src/H5Opublic.h
+++ b/src/H5Opublic.h
@@ -94,6 +94,7 @@ typedef enum H5O_type_t {
H5O_TYPE_GROUP, /* Object is a group */
H5O_TYPE_DATASET, /* Object is a dataset */
H5O_TYPE_NAMED_DATATYPE, /* Object is a named data type */
+ H5O_TYPE_MAP, /* Object is a map */
H5O_TYPE_NTYPES /* Number of different object types (must be last!) */
} H5O_type_t;
diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c
index 8b9962f..2a07a67 100644
--- a/src/H5Pencdec.c
+++ b/src/H5Pencdec.c
@@ -722,7 +722,7 @@ H5P__decode(const void *buf)
/* Get the type of the property list */
type = (H5P_plist_type_t)*p++;
- if(type <= H5P_TYPE_USER || type > H5P_TYPE_LINK_ACCESS)
+ if(type <= H5P_TYPE_USER || type >= H5P_TYPE_MAX_TYPE)
HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "bad type of encoded information: %u", (unsigned)type)
/* Create new property list of the specified type */
diff --git a/src/H5Pint.c b/src/H5Pint.c
index 5683403..36367d7 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -151,6 +151,10 @@ hid_t H5P_CLS_DATATYPE_CREATE_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_DATATYPE_CREATE_g = NULL;
hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g = NULL;
+hid_t H5P_CLS_MAP_CREATE_ID_g = H5I_INVALID_HID;
+H5P_genclass_t *H5P_CLS_MAP_CREATE_g = NULL;
+hid_t H5P_CLS_MAP_ACCESS_ID_g = H5I_INVALID_HID;
+H5P_genclass_t *H5P_CLS_MAP_ACCESS_g = NULL;
hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g = NULL;
hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g = H5I_INVALID_HID;
@@ -180,6 +184,8 @@ hid_t H5P_LST_GROUP_CREATE_ID_g = H5I_INVALID_HID;
hid_t H5P_LST_GROUP_ACCESS_ID_g = H5I_INVALID_HID;
hid_t H5P_LST_DATATYPE_CREATE_ID_g = H5I_INVALID_HID;
hid_t H5P_LST_DATATYPE_ACCESS_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_MAP_CREATE_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_MAP_ACCESS_ID_g = H5I_INVALID_HID;
hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = H5I_INVALID_HID;
hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g = H5I_INVALID_HID;
hid_t H5P_LST_OBJECT_COPY_ID_g = H5I_INVALID_HID;
@@ -314,6 +320,7 @@ H5_DLLVAR const H5P_libclass_t H5P_CLS_STRCRT[1]; /* String create */
H5_DLLVAR const H5P_libclass_t H5P_CLS_GCRT[1]; /* Group create */
H5_DLLVAR const H5P_libclass_t H5P_CLS_FCRT[1]; /* File creation */
H5_DLLVAR const H5P_libclass_t H5P_CLS_DCRT[1]; /* Dataset creation */
+H5_DLLVAR const H5P_libclass_t H5P_CLS_MCRT[1]; /* Map creation */
H5_DLLVAR const H5P_libclass_t H5P_CLS_DXFR[1]; /* Data transfer */
H5_DLLVAR const H5P_libclass_t H5P_CLS_FMNT[1]; /* File mount */
H5_DLLVAR const H5P_libclass_t H5P_CLS_ACRT[1]; /* Attribute creation */
@@ -352,6 +359,8 @@ static H5P_libclass_t const * const init_class[] = {
H5P_CLS_FMNT, /* File mount */
H5P_CLS_TCRT, /* Datatype creation */
H5P_CLS_TACC, /* Datatype access */
+ H5P_CLS_MCRT, /* Map creation */
+ H5P_CLS_MACC, /* Map access */
H5P_CLS_ACRT, /* Attribute creation */
H5P_CLS_AACC, /* Attribute access */
H5P_CLS_LCRT, /* Link creation */
@@ -431,7 +440,7 @@ H5P__init_package(void)
FUNC_ENTER_PACKAGE
/* Sanity check */
- HDcompile_assert(H5P_TYPE_VOL_INITIALIZE == (H5P_TYPE_MAX_TYPE - 1));
+ HDcompile_assert(H5P_TYPE_MAP_ACCESS == (H5P_TYPE_MAX_TYPE - 1));
/*
* Initialize the Generic Property class & object groups.
@@ -442,8 +451,8 @@ H5P__init_package(void)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
/* Repeatedly pass over the list of property list classes for the library,
- * initializing each class if it's parent class is initialized, until no
- * more progress is made.
+ * initializing each class if its parent class is initialized, until no
+ * more progress is made.
*/
tot_init = 0;
do {
@@ -547,6 +556,8 @@ H5P_term_package(void)
H5P_LST_GROUP_ACCESS_ID_g =
H5P_LST_DATATYPE_CREATE_ID_g =
H5P_LST_DATATYPE_ACCESS_ID_g =
+ H5P_LST_MAP_CREATE_ID_g =
+ H5P_LST_MAP_ACCESS_ID_g =
H5P_LST_ATTRIBUTE_CREATE_ID_g =
H5P_LST_ATTRIBUTE_ACCESS_ID_g =
H5P_LST_OBJECT_COPY_ID_g =
@@ -574,6 +585,8 @@ H5P_term_package(void)
H5P_CLS_GROUP_ACCESS_g =
H5P_CLS_DATATYPE_CREATE_g =
H5P_CLS_DATATYPE_ACCESS_g =
+ H5P_CLS_MAP_CREATE_g =
+ H5P_CLS_MAP_ACCESS_g =
H5P_CLS_STRING_CREATE_g =
H5P_CLS_ATTRIBUTE_CREATE_g =
H5P_CLS_ATTRIBUTE_ACCESS_g =
@@ -594,6 +607,8 @@ H5P_term_package(void)
H5P_CLS_GROUP_ACCESS_ID_g =
H5P_CLS_DATATYPE_CREATE_ID_g =
H5P_CLS_DATATYPE_ACCESS_ID_g =
+ H5P_CLS_MAP_CREATE_ID_g =
+ H5P_CLS_MAP_ACCESS_ID_g =
H5P_CLS_STRING_CREATE_ID_g =
H5P_CLS_ATTRIBUTE_CREATE_ID_g =
H5P_CLS_ATTRIBUTE_ACCESS_ID_g =
@@ -5437,8 +5452,9 @@ H5P__new_plist_of_type(H5P_plist_type_t type)
FUNC_ENTER_PACKAGE
- /* Sanity check */
- HDassert(type >= H5P_TYPE_USER && type < H5P_TYPE_MAX_TYPE);
+ /* Sanity checks */
+ HDcompile_assert(H5P_TYPE_MAP_ACCESS == (H5P_TYPE_MAX_TYPE - 1));
+ HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_MAP_ACCESS);
/* Check arguments */
if(type == H5P_TYPE_USER)
@@ -5492,6 +5508,14 @@ H5P__new_plist_of_type(H5P_plist_type_t type)
class_id = H5P_CLS_DATATYPE_ACCESS_ID_g;
break;
+ case H5P_TYPE_MAP_CREATE:
+ class_id = H5P_CLS_MAP_CREATE_ID_g;
+ break;
+
+ case H5P_TYPE_MAP_ACCESS:
+ class_id = H5P_CLS_MAP_ACCESS_ID_g;
+ break;
+
case H5P_TYPE_STRING_CREATE:
class_id = H5P_CLS_STRING_CREATE_ID_g;
break;
diff --git a/src/H5Pmapl.c b/src/H5Pmapl.c
new file mode 100644
index 0000000..fe5be0f
--- /dev/null
+++ b/src/H5Pmapl.c
@@ -0,0 +1,217 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Purpose: Map access property list class routines
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Pmodule.h" /* This source code file is part of the H5P module */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Mprivate.h" /* Maps */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Ppkg.h" /* Property lists */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+/* ========= Map Access properties ============ */
+/* Definitions for key prefetch size */
+#define H5M_ACS_KEY_PREFETCH_SIZE_SIZE sizeof(size_t)
+#define H5M_ACS_KEY_PREFETCH_SIZE_DEF (size_t)(16 * 1024)
+#define H5M_ACS_KEY_PREFETCH_SIZE_ENC H5P__encode_size_t
+#define H5M_ACS_KEY_PREFETCH_SIZE_DEC H5P__decode_size_t
+/* Definition for key prefetch buffer size */
+#define H5M_ACS_KEY_ALLOC_SIZE_SIZE sizeof(size_t)
+#define H5M_ACS_KEY_ALLOC_SIZE_DEF (size_t)(1024 * 1024)
+#define H5M_ACS_KEY_ALLOC_SIZE_ENC H5P__encode_size_t
+#define H5M_ACS_KEY_ALLOC_SIZE_DEC H5P__decode_size_t
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/* Property class callbacks */
+static herr_t H5P__macc_reg_prop(H5P_genclass_t *pclass);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Map access property list class library initialization object */
+const H5P_libclass_t H5P_CLS_MACC[1] = {{
+ "map access", /* Class name for debugging */
+ H5P_TYPE_MAP_ACCESS, /* Class type */
+
+ &H5P_CLS_LINK_ACCESS_g, /* Parent class */
+ &H5P_CLS_MAP_ACCESS_g, /* Pointer to class */
+ &H5P_CLS_MAP_ACCESS_ID_g, /* Pointer to class ID */
+ &H5P_LST_MAP_ACCESS_ID_g, /* Pointer to default property list ID */
+ H5P__macc_reg_prop, /* Default property registration routine */
+
+ NULL, /* Class creation callback */
+ NULL, /* Class creation callback info */
+ NULL, /* Class copy callback */
+ NULL, /* Class copy callback info */
+ NULL, /* Class close callback */
+ NULL /* Class close callback info */
+}};
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__macc_reg_prop
+ *
+ * Purpose: Register the map access property list class's
+ * properties
+ *
+ * Return: Non-negative on success/Negative on failure
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__macc_reg_prop(H5P_genclass_t *pclass)
+{
+ size_t key_prefetch_size = H5M_ACS_KEY_PREFETCH_SIZE_DEF; /* Default key prefetch size for iteration */
+ size_t key_alloc_size = H5M_ACS_KEY_ALLOC_SIZE_DEF; /* Default key prefetch allocation size for iteration */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Register the key prefetch size for iteration */
+ if(H5P__register_real(pclass, H5M_ACS_KEY_PREFETCH_SIZE_NAME, H5M_ACS_KEY_PREFETCH_SIZE_SIZE, &key_prefetch_size,
+ NULL, NULL, NULL, H5M_ACS_KEY_PREFETCH_SIZE_ENC, H5M_ACS_KEY_PREFETCH_SIZE_DEC, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+ /* Register the key prefetch allocation size for iteration */
+ if(H5P__register_real(pclass, H5M_ACS_KEY_ALLOC_SIZE_NAME, H5M_ACS_KEY_ALLOC_SIZE_SIZE, &key_alloc_size,
+ NULL, NULL, NULL, H5M_ACS_KEY_ALLOC_SIZE_ENC, H5M_ACS_KEY_ALLOC_SIZE_DEC, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__macc_reg_prop() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_map_iterate_hints
+ *
+ * Purpose: H5Pset_map_iterate_hints adjusts the behavior of
+ * H5Miterate when prefetching keys for iteration. The
+ * KEY_PREFETCH_SIZE parameter specifies the number of keys
+ * to prefetch at a time during iteration. The KEY_ALLOC_SIZE
+ * parameter specifies the initial size of the buffer
+ * allocated to hold these prefetched keys. If this buffer is
+ * too small it will be reallocated to a larger size, though
+ * this may result in an additional I/O.
+ *
+ * Move to DAOS VOL code? DSINC
+ *
+ * Return: Non-negative on success/Negative on failure
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_map_iterate_hints(hid_t mapl_id, size_t key_prefetch_size, size_t key_alloc_size)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "izz", mapl_id, key_prefetch_size, key_alloc_size);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(mapl_id, H5P_MAP_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set sizes */
+ if(H5P_set(plist, H5M_ACS_KEY_PREFETCH_SIZE_NAME, &key_prefetch_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set key prefetch size");
+ if(H5P_set(plist, H5M_ACS_KEY_ALLOC_SIZE_NAME, &key_alloc_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set key allocation size");
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_map_iterate_hints() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_map_iterate_hints
+ *
+ * Purpose: Returns the map iterate hints, KEY_PREFETCH_SIZE and
+ * KEY_ALLOC_SIZE, as set by H5Pset_map_iterate_hints.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size, size_t *key_alloc_size)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "i*z*z", mapl_id, key_prefetch_size, key_alloc_size);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(mapl_id, H5P_MAP_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get the properties */
+ if(key_prefetch_size) {
+ if(H5P_get(plist, H5M_ACS_KEY_PREFETCH_SIZE_NAME, key_prefetch_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get key prefetch size");
+ } /* end if */
+ if(key_alloc_size) {
+ if(H5P_get(plist, H5M_ACS_KEY_ALLOC_SIZE_NAME, key_alloc_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get key allocation size");
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_map_iterate_hints() */
+
diff --git a/src/H5Pmcpl.c b/src/H5Pmcpl.c
new file mode 100644
index 0000000..41a6659
--- /dev/null
+++ b/src/H5Pmcpl.c
@@ -0,0 +1,115 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5Pmcpl.c
+ *
+ * Purpose: Map creation property list class routines
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Pmodule.h" /* This source code file is part of the H5P module */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Mprivate.h" /* Maps */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Ppkg.h" /* Property lists */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/* Property class callbacks */
+static herr_t H5P__mcrt_reg_prop(H5P_genclass_t *pclass);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Map create property list class library initialization object */
+const H5P_libclass_t H5P_CLS_MCRT[1] = {{
+ "map create", /* Class name for debugging */
+ H5P_TYPE_MAP_CREATE, /* Class type */
+
+ &H5P_CLS_OBJECT_CREATE_g, /* Parent class */
+ &H5P_CLS_MAP_CREATE_g, /* Pointer to class */
+ &H5P_CLS_MAP_CREATE_ID_g, /* Pointer to class ID */
+ &H5P_LST_MAP_CREATE_ID_g, /* Pointer to default property list ID */
+ H5P__mcrt_reg_prop, /* Default property registration routine */
+
+ NULL, /* Class creation callback */
+ NULL, /* Class creation callback info */
+ NULL, /* Class copy callback */
+ NULL, /* Class copy callback info */
+ NULL, /* Class close callback */
+ NULL /* Class close callback info */
+}};
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/***************************/
+/* Local Private Variables */
+/***************************/
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__mcrt_reg_prop
+ *
+ * Purpose: Register the map creation property list class's properties
+ *
+ * Return: Non-negative on success/Negative on failure
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__mcrt_reg_prop(H5P_genclass_t H5_ATTR_UNUSED *pclass)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__mcrt_reg_prop() */
+
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 07910c3..9fc1acc 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -79,6 +79,8 @@ typedef enum H5P_plist_type_t {
H5P_TYPE_LINK_ACCESS = 17,
H5P_TYPE_ATTRIBUTE_ACCESS = 18,
H5P_TYPE_VOL_INITIALIZE = 19,
+ H5P_TYPE_MAP_CREATE = 20,
+ H5P_TYPE_MAP_ACCESS = 21,
H5P_TYPE_MAX_TYPE
} H5P_plist_type_t;
@@ -125,6 +127,8 @@ H5_DLLVAR H5P_genclass_t *H5P_CLS_GROUP_CREATE_g;
H5_DLLVAR H5P_genclass_t *H5P_CLS_GROUP_ACCESS_g;
H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_CREATE_g;
H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_MAP_CREATE_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_MAP_ACCESS_g;
H5_DLLVAR H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g;
H5_DLLVAR H5P_genclass_t *H5P_CLS_ATTRIBUTE_ACCESS_g;
H5_DLLVAR H5P_genclass_t *H5P_CLS_OBJECT_COPY_g;
@@ -139,6 +143,7 @@ H5_DLLVAR const struct H5P_libclass_t H5P_CLS_AACC[1]; /* Attribute access */
H5_DLLVAR const struct H5P_libclass_t H5P_CLS_DACC[1]; /* Dataset access */
H5_DLLVAR const struct H5P_libclass_t H5P_CLS_GACC[1]; /* Group access */
H5_DLLVAR const struct H5P_libclass_t H5P_CLS_TACC[1]; /* Named datatype access */
+H5_DLLVAR const struct H5P_libclass_t H5P_CLS_MACC[1]; /* Map access */
H5_DLLVAR const struct H5P_libclass_t H5P_CLS_FACC[1]; /* File access */
H5_DLLVAR const struct H5P_libclass_t H5P_CLS_OCPY[1]; /* Object copy */
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index cad2071..43e477a 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -62,6 +62,8 @@
#define H5P_GROUP_ACCESS (H5OPEN H5P_CLS_GROUP_ACCESS_ID_g)
#define H5P_DATATYPE_CREATE (H5OPEN H5P_CLS_DATATYPE_CREATE_ID_g)
#define H5P_DATATYPE_ACCESS (H5OPEN H5P_CLS_DATATYPE_ACCESS_ID_g)
+#define H5P_MAP_CREATE (H5OPEN H5P_CLS_MAP_CREATE_ID_g)
+#define H5P_MAP_ACCESS (H5OPEN H5P_CLS_MAP_ACCESS_ID_g)
#define H5P_STRING_CREATE (H5OPEN H5P_CLS_STRING_CREATE_ID_g)
#define H5P_ATTRIBUTE_CREATE (H5OPEN H5P_CLS_ATTRIBUTE_CREATE_ID_g)
#define H5P_ATTRIBUTE_ACCESS (H5OPEN H5P_CLS_ATTRIBUTE_ACCESS_ID_g)
@@ -83,6 +85,8 @@
#define H5P_GROUP_ACCESS_DEFAULT (H5OPEN H5P_LST_GROUP_ACCESS_ID_g)
#define H5P_DATATYPE_CREATE_DEFAULT (H5OPEN H5P_LST_DATATYPE_CREATE_ID_g)
#define H5P_DATATYPE_ACCESS_DEFAULT (H5OPEN H5P_LST_DATATYPE_ACCESS_ID_g)
+#define H5P_MAP_CREATE_DEFAULT (H5OPEN H5P_LST_MAP_CREATE_ID_g)
+#define H5P_MAP_ACCESS_DEFAULT (H5OPEN H5P_LST_MAP_ACCESS_ID_g)
#define H5P_ATTRIBUTE_CREATE_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_CREATE_ID_g)
#define H5P_ATTRIBUTE_ACCESS_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_ACCESS_ID_g)
#define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_ID_g)
@@ -191,6 +195,8 @@ H5_DLLVAR hid_t H5P_CLS_GROUP_CREATE_ID_g;
H5_DLLVAR hid_t H5P_CLS_GROUP_ACCESS_ID_g;
H5_DLLVAR hid_t H5P_CLS_DATATYPE_CREATE_ID_g;
H5_DLLVAR hid_t H5P_CLS_DATATYPE_ACCESS_ID_g;
+H5_DLLVAR hid_t H5P_CLS_MAP_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_CLS_MAP_ACCESS_ID_g;
H5_DLLVAR hid_t H5P_CLS_STRING_CREATE_ID_g;
H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g;
H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g;
@@ -211,6 +217,8 @@ H5_DLLVAR hid_t H5P_LST_GROUP_CREATE_ID_g;
H5_DLLVAR hid_t H5P_LST_GROUP_ACCESS_ID_g;
H5_DLLVAR hid_t H5P_LST_DATATYPE_CREATE_ID_g;
H5_DLLVAR hid_t H5P_LST_DATATYPE_ACCESS_ID_g;
+H5_DLLVAR hid_t H5P_LST_MAP_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_LST_MAP_ACCESS_ID_g;
H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g;
H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g;
H5_DLLVAR hid_t H5P_LST_OBJECT_COPY_ID_g;
@@ -491,6 +499,12 @@ H5_DLL herr_t H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /*
H5_DLL herr_t H5Pset_link_creation_order(hid_t plist_id, unsigned crt_order_flags);
H5_DLL herr_t H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_flags /* out */);
+/* Map access property list (MAPL) routines */
+#ifdef H5_HAVE_MAP_API
+H5_DLL herr_t H5Pset_map_iterate_hints(hid_t mapl_id, size_t key_prefetch_size, size_t key_alloc_size);
+H5_DLL herr_t H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size /*out*/, size_t *key_alloc_size /*out*/);
+#endif /* H5_HAVE_MAP_API */
+
/* String creation property list (STRCPL) routines */
H5_DLL herr_t H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding);
H5_DLL herr_t H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding /*out*/);
diff --git a/src/H5Rint.c b/src/H5Rint.c
index 2355ec1..07efae2 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -472,6 +472,9 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, const void *_r
break;
}
+ case H5O_TYPE_MAP:
+ HGOTO_ERROR(H5E_REFERENCE, H5E_BADTYPE, H5I_INVALID_HID, "maps not supported in native VOL connector")
+
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 492cd9e..153f4be 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -7025,6 +7025,47 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_hyper_adjust_s() */
+/*--------------------------------------------------------------------------
+ NAME
+ H5Shyper_adjust_s
+ PURPOSE
+ Adjust a hyperslab selection by subtracting an offset
+ USAGE
+ herr_t H5Shyper_adjust_s(space_id,offset)
+ hid_t space_id; IN: ID of the dataspace to adjust
+ const hssize_t *offset; IN: Offset to subtract
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Moves a hyperslab selection by subtracting an offset from it.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5Shyper_adjust_s(hid_t space_id, const hssize_t *offset)
+{
+ H5S_t *space;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*Hs", space_id, offset);
+
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection")
+ if(NULL == offset)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "NULL offset pointer")
+
+ if(H5S_hyper_adjust_s(space, offset) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Shyper_adjust_s() */
+
/*--------------------------------------------------------------------------
NAME
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 9e76b4b..a04f3c1 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -143,6 +143,7 @@ H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid);
H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id);
H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
+H5_DLL herr_t H5Sselect_adjust_u(hid_t spaceid, const hsize_t *offset);
H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[],
hsize_t end[]);
H5_DLL htri_t H5Sselect_shape_same(hid_t space1_id, hid_t space2_id);
@@ -170,6 +171,7 @@ H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[],
H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
hsize_t numblocks, hsize_t buf[/*numblocks*/]);
+H5_DLL herr_t H5Shyper_adjust_s(hid_t space_id, const hssize_t *offset);
/* Operations on dataspace selection iterators */
H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags);
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index e632b11..1a13f2c 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -971,6 +971,45 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_adjust_u() */
+/*--------------------------------------------------------------------------
+ NAME
+ H5Sselect_adjust_u
+ PURPOSE
+ Adjust a selection by subtracting an offset
+ USAGE
+ herr_t H5Sselect_adjust_u(space_id, offset)
+ hid_t space_id; IN: ID of dataspace to adjust
+ const hsize_t *offset; IN: Offset to subtract
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Moves a selection by subtracting an offset from it.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5Sselect_adjust_u(hid_t space_id, const hsize_t *offset)
+{
+ H5S_t *space;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*h", space_id, offset);
+
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(NULL == offset)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "NULL offset pointer")
+
+ if(H5S_select_adjust_u(space, offset) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection");
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Sselect_adjust_u() */
+
/*--------------------------------------------------------------------------
NAME
diff --git a/src/H5T.c b/src/H5T.c
index 8eada62..6ef9478 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -1740,6 +1740,7 @@ H5Tcopy(hid_t obj_id)
case H5I_GROUP:
case H5I_DATASPACE:
case H5I_ATTR:
+ case H5I_MAP:
case H5I_VFL:
case H5I_VOL:
case H5I_GENPROP_CLS:
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index 696ccab..0131f0e 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -6562,3 +6562,114 @@ done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5VLrequest_free() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->optional)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'optional' method")
+
+ /* Call the corresponding VOL callback */
+ if((ret_value = (cls->optional)(obj, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id,
+ void **req, ...)
+{
+ va_list arguments; /* Argument list passed from the API call */
+ hbool_t arg_started = FALSE; /* Whether the va_list has been started */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ HDva_start(arguments, req);
+ arg_started = TRUE;
+ if((ret_value = H5VL__optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute optional callback")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, ret_value, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLoptional
+ *
+ * Purpose: Performs an optional connector-specific operation
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLoptional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if((ret_value = H5VL__optional(obj, cls, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLoptional() */
+
diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h
index 9de518f..98bc521 100644
--- a/src/H5VLconnector.h
+++ b/src/H5VLconnector.h
@@ -314,7 +314,7 @@ typedef struct H5VL_group_class_t {
/* H5L routines */
typedef struct H5VL_link_class_t {
herr_t (*create)(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
- hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list argumenmts);
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1,
void *dst_obj, const H5VL_loc_params_t *loc_params2,
hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req);
diff --git a/src/H5VLint.c b/src/H5VLint.c
index 884b2f6..f9262f4 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -552,7 +552,8 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t
HDassert(vol_connector);
/* Make sure type number is valid */
- if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE && type != H5I_FILE && type != H5I_GROUP)
+ if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE
+ && type != H5I_FILE && type != H5I_GROUP && type != H5I_MAP)
HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, NULL, "invalid type number")
/* Create the new VOL object */
@@ -1408,6 +1409,7 @@ H5VL__object(hid_t id, H5I_type_t obj_type)
case H5I_DATASET:
case H5I_FILE:
case H5I_ATTR:
+ case H5I_MAP:
/* get the object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier")
diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c
index eeaade6..0ac70e3 100644
--- a/src/H5VLnative_file.c
+++ b/src/H5VLnative_file.c
@@ -562,11 +562,12 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR
case H5VL_NATIVE_FILE_GET_FILE_ID:
{
H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
+ hbool_t app_ref = (hbool_t)HDva_arg(arguments, int);
hid_t *file_id = HDva_arg(arguments, hid_t *);
if(NULL == (f = H5F__get_file(obj, type)))
HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file or file object")
- if((*file_id = H5F__get_file_id(f)) < 0)
+ if((*file_id = H5F__get_file_id(f, app_ref)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file ID")
break;
}
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index 91fa762..1752b0c 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -193,5 +193,8 @@ H5_DLL herr_t H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_s
H5_DLL herr_t H5VL_request_optional(const H5VL_object_t *vol_obj, ...);
H5_DLL herr_t H5VL_request_free(const H5VL_object_t *vol_obj);
+/* Generic functions */
+H5_DLL herr_t H5VL_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id,void **req, ...);
+
#endif /* _H5VLprivate_H */
diff --git a/src/H5err.txt b/src/H5err.txt
index d4edfba..9fec521 100644
--- a/src/H5err.txt
+++ b/src/H5err.txt
@@ -78,6 +78,7 @@ MAJOR, H5E_FARRAY, Fixed Array
MAJOR, H5E_PLUGIN, Plugin for dynamically loaded library
MAJOR, H5E_PAGEBUF, Page Buffering
MAJOR, H5E_CONTEXT, API Context
+MAJOR, H5E_MAP, Map
MAJOR, H5E_NONE_MAJOR, No error
# Sections (for grouping minor errors)
diff --git a/src/H5mpi.c b/src/H5mpi.c
new file mode 100644
index 0000000..ea6b33f
--- /dev/null
+++ b/src/H5mpi.c
@@ -0,0 +1,198 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Common MPI routines
+ *
+ */
+
+
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FDmpi.h" /* Common MPI file driver */
+#include "H5Pprivate.h" /* Property lists */
+
+#ifdef H5_HAVE_PARALLEL
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpi_comm_dup
+ *
+ * Purpose: Duplicate an MPI communicator.
+ *
+ * The new communicator is returned via the comm_new pointer.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5_mpi_comm_dup(MPI_Comm comm, MPI_Comm *comm_new)
+{
+ herr_t ret_value = SUCCEED;
+ MPI_Comm comm_dup = MPI_COMM_NULL;
+ int mpi_code;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ if (!comm_new)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "comm_new cannot be NULL")
+ if (MPI_COMM_NULL == comm)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't duplicate MPI_COMM_NULL")
+
+ /* Duplicate the MPI communicator */
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_dup(comm, &comm_dup)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code)
+
+ /* Set MPI_ERRORS_RETURN on comm_dup so that MPI failures are not fatal,
+ * and return codes can be checked and handled.
+ */
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_set_errhandler(comm_dup, MPI_ERRORS_RETURN)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Errhandler_set failed", mpi_code)
+
+ /* Copy the new communicator to the return argument */
+ *comm_new = comm_dup;
+
+done:
+ if (FAIL == ret_value) {
+ /* need to free anything created here */
+ if (MPI_COMM_NULL != comm_dup)
+ MPI_Comm_free(&comm_dup);
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5_mpi_comm_dup() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpi_info_dup
+ *
+ * Purpose: Duplicate an MPI info.
+ *
+ * If the info object is MPI_INFO_NULL, no duplicate
+ * is made but the same value assigned to the new info object
+ * handle.
+ *
+ * The new info is returned via the info_new pointer.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5_mpi_info_dup(MPI_Info info, MPI_Info *info_new)
+{
+ herr_t ret_value = SUCCEED;
+ MPI_Info info_dup = MPI_INFO_NULL;
+ int mpi_code;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ if (!info_new)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "info_new cannot be NULL")
+
+ /* Duplicate the MPI info */
+ if (info == MPI_INFO_NULL) {
+ /* Don't duplicate MPI_INFO_NULL. Just copy it. */
+ info_dup = info;
+ }
+ else {
+ /* Duplicate the info */
+ if (MPI_SUCCESS != (mpi_code = MPI_Info_dup(info, &info_dup)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code)
+ }
+
+ /* Copy the new info to the return argument */
+ *info_new = info_dup;
+
+done:
+ if (FAIL == ret_value) {
+ /* need to free anything created here */
+ if (MPI_INFO_NULL != info_dup)
+ MPI_Info_free(&info_dup);
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5_mpi_info_dup() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpi_comm_free
+ *
+ * Purpose: Free an MPI communicator.
+ *
+ * If comm is MPI_COMM_NULL this call does nothing.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5_mpi_comm_free(MPI_Comm *comm)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ if (!comm)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "comm pointer cannot be NULL")
+
+ /* Free the communicator */
+ if (MPI_COMM_NULL != *comm)
+ MPI_Comm_free(comm);
+
+ *comm = MPI_COMM_NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* End H5_mpi_comm_free() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpi_info_free
+ *
+ * Purpose: Free the MPI info.
+ *
+ * If info is MPI_INFO_NULL this call does nothing.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5_mpi_info_free(MPI_Info *info)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ if (!info)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "info pointer cannot be NULL")
+
+ /* Free the info */
+ if (MPI_INFO_NULL != *info)
+ MPI_Info_free(info);
+
+ *info = MPI_INFO_NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* End H5_mpi_info_free() */
+
+#endif /* H5_HAVE_PARALLEL */
+
diff --git a/src/H5private.h b/src/H5private.h
index 00b7a07..18b52a0 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -317,7 +317,7 @@
# define H5_ATTR_NORETURN __attribute__((noreturn))
# define H5_ATTR_CONST __attribute__((const))
# define H5_ATTR_PURE __attribute__((pure))
-#if defined(__GNUC__) && __GNUC__ >= 7
+#if defined(__GNUC__) && __GNUC__ >= 7 && !defined(__INTEL_COMPILER)
# define H5_ATTR_FALLTHROUGH __attribute__((fallthrough));
#else
# define H5_ATTR_FALLTHROUGH /*void*/
@@ -1721,6 +1721,7 @@ typedef enum {
H5_PKG_HG, /* Global heaps */
H5_PKG_HL, /* Local heaps */
H5_PKG_I, /* IDs */
+ H5_PKG_M, /* Maps */
H5_PKG_MF, /* File memory management */
H5_PKG_MM, /* Core memory management */
H5_PKG_O, /* Object headers */
@@ -2637,6 +2638,8 @@ H5_DLL int H5G_term_package(void);
H5_DLL int H5G_top_term_package(void);
H5_DLL int H5I_term_package(void);
H5_DLL int H5L_term_package(void);
+H5_DLL int H5M_term_package(void);
+H5_DLL int H5M_top_term_package(void);
H5_DLL int H5P_term_package(void);
H5_DLL int H5PL_term_package(void);
H5_DLL int H5R_term_package(void);
@@ -2665,6 +2668,14 @@ H5_DLL double H5_get_time(void);
H5_DLL herr_t H5_build_extpath(const char *name, char **extpath /*out*/);
H5_DLL herr_t H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/);
+#ifdef H5_HAVE_PARALLEL
+/* Generic MPI functions */
+H5_DLL herr_t H5_mpi_comm_dup(MPI_Comm comm, MPI_Comm *comm_new);
+H5_DLL herr_t H5_mpi_info_dup(MPI_Info info, MPI_Info *info_new);
+H5_DLL herr_t H5_mpi_comm_free(MPI_Comm *comm);
+H5_DLL herr_t H5_mpi_info_free(MPI_Info *info);
+#endif /* H5_HAVE_PARALLEL */
+
/* Functions for debugging */
H5_DLL herr_t H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf,
const uint8_t *marker, size_t buf_offset, size_t buf_size);
diff --git a/src/H5trace.c b/src/H5trace.c
index c5d14f5..de761f8 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -1359,6 +1359,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "%ld (attr)", (long)obj);
break;
+ case H5I_MAP:
+ HDfprintf(out, "%ld (map)", (long)obj);
+ break;
+
case H5I_VFL:
HDfprintf(out, "%ld (file driver)", (long)obj);
break;
@@ -1544,6 +1548,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "H5I_ATTR");
break;
+ case H5I_MAP:
+ HDfprintf(out, "H5I_MAP");
+ break;
+
case H5I_VFL:
HDfprintf(out, "H5I_VFL");
break;
@@ -1799,8 +1807,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "H5O_TYPE_NAMED_DATATYPE");
break;
+ case H5O_TYPE_MAP:
+ HDfprintf(out, "H5O_TYPE_MAP");
+ break;
+
case H5O_TYPE_NTYPES:
- HDfprintf(out, "H5O_TYPE_TYPES");
+ HDfprintf(out, "H5O_TYPE_NTYPES");
break;
default:
diff --git a/src/Makefile.am b/src/Makefile.am
index f737d5d..1e1273c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -78,6 +78,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c \
H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c\
H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c \
+ H5M.c \
H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \
H5MM.c H5MP.c H5MPtest.c \
H5O.c H5Odeprec.c H5Oainfo.c H5Oalloc.c H5Oattr.c \
@@ -95,8 +96,9 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \
H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \
H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \
- H5Pgcpl.c H5Pint.c \
- H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \
+ H5Pgcpl.c H5Pint.c H5Plapl.c H5Plcpl.c \
+ H5Pmapl.c H5Pmcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c \
+ H5Ptest.c \
H5PB.c \
H5PL.c H5PLint.c H5PLpath.c H5PLplugin_cache.c \
H5R.c H5Rint.c H5Rdeprec.c \
@@ -124,7 +126,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
# Only compile parallel sources if necessary
if BUILD_PARALLEL_CONDITIONAL
- libhdf5_la_SOURCES += H5ACmpio.c H5Cmpio.c H5Dmpio.c H5Fmpi.c H5FDmpi.c H5FDmpio.c H5Smpio.c
+ libhdf5_la_SOURCES += H5mpi.c H5ACmpio.c H5Cmpio.c H5Dmpio.c H5Fmpi.c H5FDmpi.c H5FDmpio.c H5Smpio.c
endif
# Only compile the direct VFD if necessary
@@ -141,7 +143,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers
H5FDfamily.h H5FDhdfs.h H5FDlog.h H5FDmpi.h H5FDmpio.h \
H5FDmulti.h H5FDros3.h H5FDsec2.h H5FDstdio.h H5FDwindows.h \
H5Gpublic.h H5Ipublic.h H5Lpublic.h \
- H5MMpublic.h H5Opublic.h H5Ppublic.h \
+ H5Mpublic.h H5MMpublic.h H5Opublic.h H5Ppublic.h \
H5PLextern.h H5PLpublic.h \
H5Rpublic.h H5Spublic.h H5Tpublic.h \
H5VLconnector.h H5VLconnector_passthru.h \
diff --git a/src/hdf5.h b/src/hdf5.h
index 2201e9e..8367122 100644
--- a/src/hdf5.h
+++ b/src/hdf5.h
@@ -29,6 +29,7 @@
#include "H5Gpublic.h" /* Groups */
#include "H5Ipublic.h" /* ID management */
#include "H5Lpublic.h" /* Links */
+#include "H5Mpublic.h" /* Maps */
#include "H5MMpublic.h" /* Memory management */
#include "H5Opublic.h" /* Object headers */
#include "H5Ppublic.h" /* Property lists */
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index baa99ea..1591bed 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -78,6 +78,7 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@
With deprecated public symbols: @DEPRECATED_SYMBOLS@
I/O filters (external): @EXTERNAL_FILTERS@
MPE: @MPE@
+ Map (H5M) API: @MAP_API@
Direct VFD: @DIRECT_VFD@
(Read-Only) S3 VFD: @ROS3_VFD@
(Read-Only) HDFS VFD: @HAVE_LIBHDFS@
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index cc166ec..b7eaa56 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -444,7 +444,7 @@ set (test_CLEANFILES
cache_logging.out
vds_swmr.h5
vds_swmr_src_*.h5
- tmp/vds_src_2.h5
+ tmp_vds_env/vds_src_2.h5
direct_chunk.h5
native_vol_test.h5
)
@@ -613,7 +613,7 @@ else ()
-D "TEST_PROGRAM=$<TARGET_FILE:vds_env>"
-D "TEST_ARGS:STRING="
-D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX"
- -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp"
+ -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp_vds_env"
-D "TEST_EXPECT=0"
-D "TEST_SKIP_COMPARE=TRUE"
-D "TEST_OUTPUT=vds_env.txt"
@@ -776,15 +776,43 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS AND NOT MINGW)
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
+else ()
+ add_test (NAME H5TEST-err_compat COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:err_compat>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_MASK_ERROR=true"
+ -D "ERROR_APPEND=1"
+ -D "TEST_OUTPUT=err_compat.txt"
+ -D "TEST_REFERENCE=err_compat_2"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5TEST-err_compat PROPERTIES
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+ )
endif ()
#-- Adding test for error_test
-if (HDF5_USE_16_API_DEFAULT OR MINGW)
- add_test (
- NAME H5TEST-error_test
- COMMAND ${CMAKE_COMMAND} -E echo "SKIP $<TARGET_FILE:error_test>"
+if (DEFAULT_API_VERSION MATCHES "v16" OR MINGW)
+ add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:error_test>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_MASK_ERROR=true"
+ -D "ERROR_APPEND=1"
+ -D "TEST_OUTPUT=error_test.txt"
+ -D "TEST_REFERENCE=error_test_2"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5TEST-error_test PROPERTIES
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
- set_property(TEST H5TEST-error_test PROPERTY DISABLED)
else ()
add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
@@ -809,7 +837,7 @@ add_test (NAME H5TEST-links_env-clear-objects
COMMAND ${CMAKE_COMMAND} -E remove
extlinks_env0.h5
extlinks_env1.h5
- tmp/extlinks_env1.h5
+ tmp_links_env/extlinks_env1.h5
WORKING_DIRECTORY
${HDF5_TEST_BINARY_DIR}/H5TEST
)
@@ -822,7 +850,7 @@ else ()
-D "TEST_PROGRAM=$<TARGET_FILE:links_env>"
-D "TEST_ARGS:STRING="
#-D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX"
- #-D "TEST_ENV_VALUE:STRING=.:tmp"
+ #-D "TEST_ENV_VALUE:STRING=.:tmp_links_env"
-D "TEST_EXPECT=0"
-D "TEST_OUTPUT=links_env.txt"
-D "TEST_REFERENCE=links_env.out"
@@ -832,7 +860,7 @@ else ()
endif ()
set_tests_properties (H5TEST-links_env PROPERTIES
FIXTURES_REQUIRED clear_links_env
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_EXT_PREFIX=.:tmp"
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_EXT_PREFIX=.:tmp_links_env"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
diff --git a/test/Makefile.am b/test/Makefile.am
index aa6afee..ff6d1c6 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -184,7 +184,8 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse
sys_file1 tfile[1-7].h5 th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 \
stab.h5 extern_[1-5].h5 extern_[1-4][rw].raw gheap[0-4].h5 \
ohdr_min_a.h5 ohdr_min_b.h5 min_dset_ohdr_testfile.h5\
- dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \
+ dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 \
+ tmp tmp_links tmp2_links tmp_links_env tmp_vds_env \
big.data big[0-9][0-9][0-9][0-9][0-9].h5 \
stdio.h5 sec2.h5 dtypes[0-9].h5 dtypes1[0].h5 dt_arith[1-2].h5 tattr.h5 \
tselect.h5 mtime.h5 unlink.h5 unicode.h5 coord.h5 \
diff --git a/test/err_compat.c b/test/err_compat.c
index 4860a3c..ed85524 100644
--- a/test/err_compat.c
+++ b/test/err_compat.c
@@ -12,17 +12,17 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* October 14, 2001
*
- * Purpose: Tests Error API
+ * Purpose: Tests Error API
*/
#include "h5test.h"
#ifdef H5_NO_DEPRECATED_SYMBOLS
int main(void)
{
- printf("Test skipped because backward compatability with v1.6 is NOT configured in\n");
+ printf("Test skipped because backward compatibility with v1.6 is NOT configured in\n");
return 0;
}
#else /* H5_NO_DEPRECATED_SYMBOLS */
@@ -35,7 +35,7 @@ const char *FILENAME[] = {
#define DIM0 100
#define DIM1 200
-int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1];
+int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1];
#define DSET_NAME "a_dataset"
#define FAKE_ID (hid_t)-1
@@ -43,17 +43,17 @@ int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1];
herr_t custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data);
herr_t custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data);
-
+
/*-------------------------------------------------------------------------
- * Function: user_print1
+ * Function: user_print1
*
- * Purpose: This function is a user-defined old-style printing function.
- * This is just a convenience function for H5Ewalk1() with a
+ * Purpose: This function is a user-defined old-style printing function.
+ * This is just a convenience function for H5Ewalk1() with a
* function that prints error messages.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 4 October 2010
*
*-------------------------------------------------------------------------
@@ -73,17 +73,17 @@ user_print1(FILE *stream)
}
-
+
/*-------------------------------------------------------------------------
- * Function: user_print2
+ * Function: user_print2
*
- * Purpose: This function is a user-defined new-style printing function.
- * This is just a convenience function for H5Ewalk2() with a
+ * Purpose: This function is a user-defined new-style printing function.
+ * This is just a convenience function for H5Ewalk2() with a
* function that prints error messages.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 4 October 2010
*
*-------------------------------------------------------------------------
@@ -103,18 +103,18 @@ user_print2(hid_t err_stack, FILE *stream)
}
-
+
/*-------------------------------------------------------------------------
* Function: custom_print_cb1
*
- * Purpose: Callback function to print error stack in customized way
+ * Purpose: Callback function to print error stack in customized way
* for H5Ewalk1.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 4 October 2010
*
* Modifications:
@@ -124,10 +124,10 @@ user_print2(hid_t err_stack, FILE *stream)
herr_t
custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data)
{
- FILE *stream = (FILE *)client_data;
+ FILE *stream = (FILE *)client_data;
char *maj = NULL;
char *min = NULL;
- const int indent = 4;
+ const int indent = 4;
if(NULL == (min = H5Eget_minor(err_desc->min_num)))
TEST_ERROR;
@@ -136,9 +136,9 @@ custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data)
TEST_ERROR;
fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n",
- indent, "", n, err_desc->file_name,
- err_desc->func_name, err_desc->line);
-
+ indent, "", n, err_desc->file_name,
+ err_desc->func_name, err_desc->line);
+
fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj);
fprintf(stream, "%*sminor: %s\n", indent * 2, "", min);
@@ -152,22 +152,22 @@ error:
H5free_memory(maj);
if(min)
H5free_memory(min);
-
+
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: custom_print_cb2
*
- * Purpose: Callback function to print error stack in customized way
+ * Purpose: Callback function to print error stack in customized way
* for H5Ewalk1.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 4 October 2010
*
* Modifications:
@@ -177,10 +177,10 @@ error:
herr_t
custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data)
{
- FILE *stream = (FILE *)client_data;
+ FILE *stream = (FILE *)client_data;
char *maj = NULL;
char *min = NULL;
- const int indent = 4;
+ const int indent = 4;
if(NULL == (min = H5Eget_minor(err_desc->min_num)))
TEST_ERROR;
@@ -189,9 +189,9 @@ custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data)
TEST_ERROR;
fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n",
- indent, "", n, err_desc->file_name,
- err_desc->func_name, err_desc->line);
-
+ indent, "", n, err_desc->file_name,
+ err_desc->func_name, err_desc->line);
+
fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj);
fprintf(stream, "%*sminor: %s\n", indent * 2, "", min);
@@ -205,22 +205,22 @@ error:
H5free_memory(maj);
if(min)
H5free_memory(min);
-
+
return -1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_error1
+ * Function: test_error1
*
- * Purpose: Test the backward compatibility of H5Eset/get_auto.
+ * Purpose: Test the backward compatibility of H5Eset/get_auto.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * 17 September 2010
+ * Programmer: Raymond Lu
+ * 17 September 2010
*
*
* Modifications:
@@ -230,8 +230,8 @@ error:
static herr_t
test_error1(void)
{
- hid_t dataset, space;
- hsize_t dims[2];
+ hid_t dataset, space;
+ hsize_t dims[2];
H5E_auto1_t old_func1;
H5E_auto2_t old_func2;
void *old_data;
@@ -245,48 +245,48 @@ test_error1(void)
dims[1] = DIM1;
if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR;
- /* Use H5Eget_auto2 to query the default printing function. The library
+ /* Use H5Eget_auto2 to query the default printing function. The library
*should indicate H5Eprint2 as the default. */
if (H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data)<0)
- TEST_ERROR;
+ TEST_ERROR;
if (old_data != NULL)
- TEST_ERROR;
+ TEST_ERROR;
if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2)
- TEST_ERROR;
+ TEST_ERROR;
/* This function sets the default printing function to be H5Eprint2. */
if(H5Eset_auto2(H5E_DEFAULT, old_func2, old_data)<0)
TEST_ERROR;
- /* Try the printing function. Dataset creation should fail because the file
+ /* Try the printing function. Dataset creation should fail because the file
* doesn't exist. */
- dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT,
+ dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT,
H5P_DEFAULT, H5P_DEFAULT);
- if(dataset >= 0)
+ if(dataset >= 0)
TEST_ERROR;
/* This call should work. It simply returns H5Eprint1. */
if((ret = H5Eget_auto1(&old_func1, &old_data))<0)
TEST_ERROR;
if (old_data != NULL)
- TEST_ERROR;
+ TEST_ERROR;
if (!old_func1 || (H5E_auto1_t)H5Eprint1 != old_func1)
- TEST_ERROR;
+ TEST_ERROR;
/* This function changes the old-style printing function to be user_print1. */
if(H5Eset_auto1((H5E_auto1_t)user_print1, stderr)<0)
TEST_ERROR;
- /* Try the printing function. Dataset creation should fail because the file
+ /* Try the printing function. Dataset creation should fail because the file
* doesn't exist. */
- dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT,
+ dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT,
H5P_DEFAULT, H5P_DEFAULT);
- if(dataset >= 0)
+ if(dataset >= 0)
TEST_ERROR;
- /* This call should fail because the test mixes H5Eget_auto2 with H5Eset_auto1.
- * Once the H5Eset_auto1 is called with a user-defined printing function,
- * a call to H5Eget_auto2 will fail. But keep in mind the printing function is
+ /* This call should fail because the test mixes H5Eget_auto2 with H5Eset_auto1.
+ * Once the H5Eset_auto1 is called with a user-defined printing function,
+ * a call to H5Eget_auto2 will fail. But keep in mind the printing function is
* user_print1. */
if((ret = H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data))>=0)
TEST_ERROR;
@@ -295,44 +295,44 @@ test_error1(void)
if(H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)user_print2, stderr)<0)
TEST_ERROR;
- /* Try the printing function. Dataset creation should fail because the file
+ /* Try the printing function. Dataset creation should fail because the file
* doesn't exist. */
- dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT,
+ dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT,
H5P_DEFAULT, H5P_DEFAULT);
- if(dataset >= 0)
+ if(dataset >= 0)
TEST_ERROR;
/* This function changes the new-style printing function back to the default H5Eprint2. */
if(H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)H5Eprint2, NULL)<0)
TEST_ERROR;
- /* This call should work because the H5Eset_auto2 above restored the default printing
+ /* This call should work because the H5Eset_auto2 above restored the default printing
* function H5Eprint2. It simply returns user_print1. */
if((ret = H5Eget_auto1(&old_func1, &old_data))<0)
TEST_ERROR;
if (old_data != NULL)
- TEST_ERROR;
+ TEST_ERROR;
if (!old_func1 || (H5E_auto1_t)user_print1 != old_func1)
- TEST_ERROR;
+ TEST_ERROR;
/* This function changes the new-style printing function back to the default H5Eprint1. */
if(H5Eset_auto1((H5E_auto1_t)H5Eprint1, NULL)<0)
TEST_ERROR;
- /* This call should work because the H5Eset_auto1 above restored the default printing
+ /* This call should work because the H5Eset_auto1 above restored the default printing
* function H5Eprint1. It simply returns H5Eprint2. */
if((ret = H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data))<0)
TEST_ERROR;
if (old_data != NULL)
- TEST_ERROR;
+ TEST_ERROR;
if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2)
- TEST_ERROR;
+ TEST_ERROR;
- /* Try the printing function. Dataset creation should fail because the file
+ /* Try the printing function. Dataset creation should fail because the file
* doesn't exist. */
- dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT,
+ dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT,
H5P_DEFAULT, H5P_DEFAULT);
- if(dataset >= 0)
+ if(dataset >= 0)
TEST_ERROR;
return 0;
@@ -341,18 +341,18 @@ test_error1(void)
return -1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_error2
+ * Function: test_error2
*
- * Purpose: Test error API functions, mainly on H5Epush1.
+ * Purpose: Test error API functions, mainly on H5Epush1.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * July 10, 2003
+ * Programmer: Raymond Lu
+ * July 10, 2003
*
*
* Modifications:
@@ -362,8 +362,8 @@ test_error1(void)
static herr_t
test_error2(hid_t file)
{
- hid_t dataset, space;
- hsize_t dims[2];
+ hid_t dataset, space;
+ hsize_t dims[2];
const char *FUNC_test_error="test_error2";
TESTING("error API based on data I/O");
@@ -381,7 +381,7 @@ test_error2(hid_t file)
/* Create the dataset */
if ((dataset = H5Dcreate2(file, DSET_NAME, H5T_STD_I32BE, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5Epush1(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_CANTCREATE,
"H5Dcreate2 failed");
goto error;
@@ -411,18 +411,18 @@ test_error2(hid_t file)
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: dump_error
*
- * Purpose: Prints error stack in default and customized ways.
+ * Purpose: Prints error stack in default and customized ways.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * July 17, 2003
+ * Programmer: Raymond Lu
+ * July 17, 2003
*
*
* Modifications:
@@ -449,14 +449,14 @@ dump_error(void)
}
-
+
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Test error API.
+ * Purpose: Test error API.
*
- * Programmer: Raymond Lu
- * July 10, 2003
+ * Programmer: Raymond Lu
+ * July 10, 2003
*
* Modifications:
*
@@ -465,8 +465,8 @@ dump_error(void)
int
main(void)
{
- hid_t file, fapl;
- char filename[1024];
+ hid_t file, fapl;
+ char filename[1024];
const char *FUNC_main="main";
fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n");
@@ -474,7 +474,7 @@ main(void)
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR ;
+ TEST_ERROR ;
/* Test error stack */
diff --git a/test/hdfs.c b/test/hdfs.c
index 57dbac9..ab39da6 100644
--- a/test/hdfs.c
+++ b/test/hdfs.c
@@ -11,9 +11,9 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Read-Only HDFS Virtual File Driver (VFD)
+ * Read-Only HDFS Virtual File Driver (VFD)
*
- * Purpose:
+ * Purpose:
*
* Verify behavior for Read-Only HDFS VFD.
*
@@ -27,11 +27,10 @@
#include "H5FDhdfs.h" /* this file driver's utilities */
+#ifdef H5_HAVE_LIBHDFS
#define HDFS_TEST_DEBUG 0
#define HDFS_TEST_MAX_BUF_SIZE 256
-#if 0
-#define S3_TEST_MAX_URL_SIZE 256
-#endif /* s3comms relic */
+#endif /* H5_HAVE_LIBHDFS */
/*****************************************************************************
*
@@ -39,7 +38,7 @@
*
* Purpose:
*
- * 1) Upon test failure, goto-jump to single-location teardown in test
+ * 1) Upon test failure, goto-jump to single-location teardown in test
* function. E.g., `error:` (consistency with HDF corpus) or
* `failed:` (reflects purpose).
* >>> using "error", in part because `H5E_BEGIN_TRY` expects it.
@@ -48,22 +47,22 @@
* requires reading of entire line to know whether this if/call is
* part of the test setup, test operation, or a test unto itself.
* 3) Provide testing macros with optional user-supplied failure message;
- * if not supplied (NULL), generate comparison output in the spirit of
+ * if not supplied (NULL), generate comparison output in the spirit of
* test-driven development. E.g., "expected 5 but was -3"
* User messages clarify test's purpose in code, encouraging description
* without relying on comments.
* 4) Configurable expected-actual order in generated comparison strings.
- * Some prefer `VERIFY(expected, actual)`, others
+ * Some prefer `VERIFY(expected, actual)`, others
* `VERIFY(actual, expected)`. Provide preprocessor ifdef switch
* to satifsy both parties, assuming one paradigm per test file.
* (One could #undef and redefine the flag through the file as desired,
* but _why_.)
*
- * Provided as courtesy, per consideration for inclusion in the library
+ * Provided as courtesy, per consideration for inclusion in the library
* proper.
*
* Macros:
- *
+ *
* JSVERIFY_EXP_ACT - ifdef flag, configures comparison order
* FAIL_IF() - check condition
* FAIL_UNLESS() - check _not_ condition
@@ -80,8 +79,8 @@
/*----------------------------------------------------------------------------
*
* ifdef flag: JSVERIFY_EXP_ACT
- *
- * JSVERIFY macros accept arguments as (EXPECTED, ACTUAL[, reason])
+ *
+ * JSVERIFY macros accept arguments as (EXPECTED, ACTUAL[, reason])
* default, if this is undefined, is (ACTUAL, EXPECTED[, reason])
*
*----------------------------------------------------------------------------
@@ -114,10 +113,10 @@
*
* Macro: FAIL_IF()
*
- * Purpose:
+ * Purpose:
*
* Make tests more accessible and less cluttered than
- * `if (thing == otherthing()) TEST_ERROR`
+ * `if (thing == otherthing()) TEST_ERROR`
* paradigm.
*
* The following lines are roughly equivalent:
@@ -148,7 +147,7 @@ if (condition) { \
*
* TEST_ERROR wrapper to reduce cognitive overhead from "negative tests",
* e.g., "a != b".
- *
+ *
* Opposite of FAIL_IF; fails if the given condition is _not_ true.
*
* `FAIL_IF( 5 != my_op() )`
@@ -254,10 +253,10 @@ if (!(condition)) { \
*
* Macro: JSVERIFY()
*
- * Purpose:
+ * Purpose:
*
* Verify that two long integers are equal.
- * If unequal, print failure message
+ * If unequal, print failure message
* (with `reason`, if not NULL; expected/actual if NULL)
* and jump to `error` at end of function
*
@@ -277,10 +276,10 @@ if ((long)(actual) != (long)(expected)) { \
*
* Macro: JSVERIFY_NOT()
*
- * Purpose:
+ * Purpose:
*
* Verify that two long integers are _not_ equal.
- * If equal, print failure message
+ * If equal, print failure message
* (with `reason`, if not NULL; expected/actual if NULL)
* and jump to `error` at end of function
*
@@ -300,10 +299,10 @@ if ((long)(actual) == (long)(expected)) { \
*
* Macro: JSVERIFY_STR()
*
- * Purpose:
+ * Purpose:
*
* Verify that two strings are equal.
- * If unequal, print failure message
+ * If unequal, print failure message
* (with `reason`, if not NULL; expected/actual if NULL)
* and jump to `error` at end of function
*
@@ -319,8 +318,8 @@ if (strcmp((actual), (expected)) != 0) { \
} /* JSVERIFY_STR */
-#else
-/* JSVERIFY_EXP_ACT not defined
+#else
+/* JSVERIFY_EXP_ACT not defined
*
* Repeats macros above, but with actual/expected parameters reversed.
*/
@@ -373,23 +372,30 @@ if (strcmp((actual), (expected)) != 0) { \
* OTHER MACROS AND DEFINITIONS *
********************************/
-/* copied from src/hdfs.c
+/* copied from src/hdfs.c
*/
+#ifdef H5_HAVE_LIBHDFS
#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1)
-#define MAX_HDFS_NAMENODE_NAME 128
+#endif /* H5_HAVE_LIBHDFS */
+
+#define HDFS_NAMENODE_NAME_MAX_SIZE 128
/*******************************
* FILE-LOCAL GLOBAL VARIABLES *
*******************************/
+
+#ifdef H5_HAVE_LIBHDFS
static const char filename_missing[] = "/tmp/missing.txt";
static const char filename_bard[] = "/tmp/t8.shakespeare.txt";
static const char filename_raven[] = "/tmp/Poe_Raven.txt";
static const char filename_example_h5[] = "/tmp/t.h5";
+#endif /* H5_HAVE_LIBHDFS */
+
static H5FD_hdfs_fapl_t default_fa = {
1, /* fa version */
"localhost", /* namenode name */
0, /* namenode port */
- "", /* user name */
+ "", /* user name */
"", /* kerberos path */
1024, /* buffer size */
};
@@ -403,7 +409,7 @@ static H5FD_hdfs_fapl_t default_fa = {
*
* Function: test_fapl_config_validation()
*
- * Purpose:
+ * Purpose:
*
* Test data consistency of fapl configuration.
* Tests `H5FD_hdfs_validate_config` indirectly through `H5Pset_fapl_hdfs`.
@@ -522,7 +528,7 @@ test_fapl_config_validation(void)
for (i = 0; i < ncases; i++) {
/*---------------
- * per-test setup
+ * per-test setup
*---------------
*/
case_ptr = &cases_arr[i];
@@ -535,7 +541,7 @@ test_fapl_config_validation(void)
*-----------------------------------
*/
H5E_BEGIN_TRY {
- /* `H5FD_hdfs_validate_config(...)` is static/private
+ /* `H5FD_hdfs_validate_config(...)` is static/private
* to src/hdfs.c and cannot (and should not?) be tested directly?
* Instead, validate config through public api.
*/
@@ -543,7 +549,7 @@ test_fapl_config_validation(void)
} H5E_END_TRY;
JSVERIFY( case_ptr->expected, success, case_ptr->msg )
-
+
/* Make sure we can get back what we put in.
* Only valid if the fapl configuration does not result in error.
*/
@@ -566,7 +572,7 @@ test_fapl_config_validation(void)
"streambuffer size mismatch" )
JSVERIFY_STR( config.namenode_name,
fa_fetch.namenode_name,
- NULL )
+ NULL )
JSVERIFY_STR( config.user_name,
fa_fetch.user_name,
NULL )
@@ -599,7 +605,7 @@ error:
}
return 1;
-} /* test_fapl_config_validation */
+} /* end test_fapl_config_validation() */
/*-------------------------------------------------------------------------
@@ -608,7 +614,7 @@ error:
*
* Purpose: Tests the file handle interface for the HDFS driver.
*
- * For now, test only fapl & flags. Extend as the
+ * For now, test only fapl & flags. Extend as the
* work on the VFD continues.
*
* Return: Success: 0
@@ -642,7 +648,7 @@ test_hdfs_fapl(void)
TESTING("HDFS fapl ");
- /* Set property list and file name for HDFS driver.
+ /* Set property list and file name for HDFS driver.
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
FAIL_IF( fapl_id < 0 )
@@ -654,12 +660,12 @@ test_hdfs_fapl(void)
/****************
* Check that the VFD feature flags are correct
- * SPEC MAY CHANGE
+ * SPEC MAY CHANGE
******************/
FAIL_IF( H5FDdriver_query(driver_id, &driver_flags) < 0 )
- JSVERIFY_NOT( 0, (driver_flags & H5FD_FEAT_DATA_SIEVE),
+ JSVERIFY_NOT( 0, (driver_flags & H5FD_FEAT_DATA_SIEVE),
"bit(s) in `driver_flags` must align with "
"H5FD_FEAT_DATA_SIEVE" )
@@ -676,14 +682,14 @@ error:
return 1;
-} /* test_hdfs_fapl() */
+} /* end test_hdfs_fapl() */
/*---------------------------------------------------------------------------
*
* Function: test_vfd_open()
*
- * Purpose:
+ * Purpose:
*
* Demonstrate/specify VFD-level "Open" failure cases
*
@@ -700,6 +706,16 @@ error:
static int
test_vfd_open(void)
{
+
+#ifndef H5_HAVE_LIBHDFS
+ TESTING("HDFS VFD-level open");
+ SKIPPED();
+ puts(" HDFS VFD is not enabled");
+ fflush(stdout);
+ return 0;
+
+#else
+
/*********************
* test-local macros *
*********************/
@@ -709,7 +725,6 @@ test_vfd_open(void)
#define FAPL_UNCONFIGURED -3 /* H5P_FILE_ACCESS */
#define FAPL_HDFS -4
-#ifdef H5_HAVE_LIBHDFS
/*************************
* test-local structures *
*************************/
@@ -799,21 +814,14 @@ test_vfd_open(void)
FALSE,
},
};
-#endif /* H5_HAVE_LIBHDFS */
+ unsigned i = 0;
+ unsigned failing_conditions_count = 10;
H5FD_t *fd = NULL;
hid_t fapl_hdfs = -1;
hid_t fapl_unconfigured = -1;
- unsigned i = 0;
- unsigned failing_conditions_count = 10;
TESTING("HDFS VFD-level open");
-#ifndef H5_HAVE_LIBHDFS
- SKIPPED();
- puts(" HDFS VFD is not enabled");
- fflush(stdout);
- return 0;
-#else
fapl_unconfigured = H5Pcreate(H5P_FILE_ACCESS);
FAIL_IF( fapl_unconfigured < 0 )
@@ -833,10 +841,13 @@ test_vfd_open(void)
fd = NULL;
- if (T.which_fapl == FAPL_UNCONFIGURED)
+ if (T.which_fapl == FAPL_UNCONFIGURED) {
fapl_id = fapl_unconfigured;
- else if (T.which_fapl == FAPL_HDFS)
+ }
+ else
+ if (T.which_fapl == FAPL_HDFS) {
fapl_id = fapl_hdfs;
+ }
#if HDFS_TEST_DEBUG
HDfprintf(stderr, "testing: %s\n", T.message);
@@ -852,10 +863,11 @@ test_vfd_open(void)
HDfprintf(stderr, "\n!!!!! WARNING !!!!!\n" \
" Successful open of file on local system " \
"with non-HDFS VFD.\n");
- JSVERIFY(SUCCEED, H5FDclose(fd),
+ JSVERIFY(SUCCEED, H5FDclose(fd),
"unable to close errant open");
fd = NULL;
- } else {
+ }
+ else {
JSVERIFY(1, 0, T.message); /* print message and fail */
}
}
@@ -867,14 +879,14 @@ test_vfd_open(void)
HDfprintf(stderr, "nominal open\n");
#endif /* HDFS_TEST_DEBUG */
- /* finally, show that a file can be opened
+ /* finally, show that a file can be opened
*/
fd = H5FDopen(
- filename_bard,
- H5F_ACC_RDONLY,
- fapl_hdfs,
+ filename_bard,
+ H5F_ACC_RDONLY,
+ fapl_hdfs,
MAXADDR);
- FAIL_IF( NULL == fd )
+ FAIL_IF( NULL == fd )
/************
* TEARDOWN *
@@ -895,20 +907,23 @@ test_vfd_open(void)
PASSED();
return 0;
-#endif /* H5_HAVE_LIBHDFS */
error:
+
/***********
* CLEANUP *
***********/
- if (fd)
- (void)H5FDclose(fd);
+ if (fd) {
+ (void)H5FDclose(fd);
+ }
H5E_BEGIN_TRY {
- if (fapl_hdfs >= 0)
+ if (fapl_hdfs >= 0) {
(void)H5Pclose(fapl_hdfs);
- if (fapl_unconfigured >= 0)
+ }
+ if (fapl_unconfigured >= 0) {
(void)H5Pclose(fapl_unconfigured);
+ }
} H5E_END_TRY;
return 1;
@@ -917,14 +932,16 @@ error:
#undef FAPL_UNCONFIGURED
#undef FAPL_HDFS
-} /* test_vfd_open */
+#endif /* H5_HAVE_LIBHDFS */
+
+} /* end test_vfd_open() */
/*---------------------------------------------------------------------------
*
* Function: test_eof_eoa()
*
- * Purpose:
+ * Purpose:
*
* Demonstrate behavior of get_eof, get_eoa, and set_eoa.
*
@@ -941,6 +958,15 @@ error:
static int
test_eof_eoa(void)
{
+#ifndef H5_HAVE_LIBHDFS
+ TESTING("HDFS eof/eoa gets and sets");
+ SKIPPED();
+ puts(" HDFS VFD is not enabled");
+ fflush(stdout);
+ return 0;
+
+#else
+
/*********************
* test-local macros *
*********************/
@@ -958,16 +984,10 @@ test_eof_eoa(void)
TESTING("HDFS eof/eoa gets and sets");
-#ifndef H5_HAVE_LIBHDFS
- SKIPPED();
- puts(" HDFS VFD is not enabled");
- fflush(stdout);
- return 0;
-#else
/*********
* SETUP *
*********/
-
+
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
FAIL_IF( 0 > fapl_id )
FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) )
@@ -990,31 +1010,31 @@ test_eof_eoa(void)
H5FDget_eof(fd_shakespeare, H5FD_MEM_DRAW),
"mismatch between DEFAULT and RAW memory types" )
JSVERIFY( 0,
- H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
+ H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
"EoA should be unset by H5FDopen" )
/* set EoA below EoF
*/
- JSVERIFY( SUCCEED,
- H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 44442202),
+ JSVERIFY( SUCCEED,
+ H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 44442202),
"unable to set EoA (lower)" )
- JSVERIFY( 5458199,
- H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
+ JSVERIFY( 5458199,
+ H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
"EoF changed" )
- JSVERIFY( 44442202,
- H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
+ JSVERIFY( 44442202,
+ H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
"EoA unchanged" )
/* set EoA above EoF
*/
- JSVERIFY( SUCCEED,
- H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 6789012),
+ JSVERIFY( SUCCEED,
+ H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 6789012),
"unable to set EoA (higher)" )
- JSVERIFY( 5458199,
- H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
+ JSVERIFY( 5458199,
+ H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
"EoF changed" )
- JSVERIFY( 6789012,
- H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
+ JSVERIFY( 6789012,
+ H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
"EoA unchanged" )
/************
@@ -1029,9 +1049,9 @@ test_eof_eoa(void)
PASSED();
return 0;
-#endif /* H5_HAVE_LIBHDFS */
error:
+
/***********
* CLEANUP *
***********/
@@ -1039,7 +1059,7 @@ error:
if (fd_shakespeare != NULL) {
(void)H5FDclose(fd_shakespeare);
}
- if (fapl_id >= 0) {
+ if (fapl_id >= 0) {
H5E_BEGIN_TRY {
(void)H5Pclose(fapl_id);
} H5E_END_TRY;
@@ -1047,15 +1067,17 @@ error:
return 1;
-} /* test_eof_eoa */
+#endif /* H5_HAVE_LIBHDFS */
+
+} /* end test_eof_eoa() */
/*-----------------------------------------------------------------------------
*
* Function: test_H5FDread_without_eoa_set_fails()
- *
+ *
* Purpose:
- *
+ *
* Demonstrate a not-obvious constraint by the library, preventing
* file read before EoA is set
*
@@ -1067,26 +1089,27 @@ error:
static int
test_H5FDread_without_eoa_set_fails(void)
{
-#ifdef H5_HAVE_LIBHDFS
+#ifndef H5_HAVE_LIBHDFS
+ TESTING("HDFS VFD read-eoa temporal coupling library limitation");
+ SKIPPED();
+ puts(" HDFS VFD is not enabled");
+ fflush(stdout);
+ return 0;
+
+#else
+
char buffer[HDFS_TEST_MAX_BUF_SIZE];
unsigned int i = 0;
-#endif /* H5_HAVE_LIBHDFS */
H5FD_t *file_shakespeare = NULL;
hid_t fapl_id = -1;
TESTING("HDFS VFD read-eoa temporal coupling library limitation");
-#ifndef H5_HAVE_LIBHDFS
- SKIPPED();
- puts(" HDFS VFD is not enabled");
- fflush(stdout);
- return 0;
-#else
/*********
* SETUP *
*********/
- /* create HDFS fapl
+ /* create HDFS fapl
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
FAIL_IF( fapl_id < 0 )
@@ -1137,9 +1160,9 @@ test_H5FDread_without_eoa_set_fails(void)
PASSED();
return 0;
-#endif /* H5_HAVE_LIBHDFS */
error:
+
/***********
* CLEANUP *
***********/
@@ -1155,7 +1178,9 @@ error:
return 1;
-} /* test_H5FDread_without_eoa_set_fails */
+#endif /* H5_HAVE_LIBHDFS */
+
+} /* end test_H5FDread_without_eoa_set_fails() */
@@ -1163,7 +1188,7 @@ error:
*
* Function: test_read()
*
- * Purpose:
+ * Purpose:
*
* Return:
*
@@ -1178,11 +1203,19 @@ error:
static int
test_read(void)
{
+#ifndef H5_HAVE_LIBHDFS
+ TESTING("HDFS VFD read/range-gets");
+ SKIPPED();
+ puts(" HDFS VFD is not enabled");
+ fflush(stdout);
+ return 0;
+
+#else
+
/*********************
* test-local macros *
*********************/
-#ifdef H5_HAVE_LIBHDFS
/*************************
* test-local structures *
*************************/
@@ -1248,23 +1281,16 @@ test_read(void)
herr_t open_return = FAIL;
char buffer[HDFS_TEST_MAX_BUF_SIZE];
unsigned int i = 0;
-#endif /* H5_HAVE_LIBHDFS */
H5FD_t *file_raven = NULL;
hid_t fapl_id = -1;
TESTING("HDFS VFD read/range-gets");
-#ifndef H5_HAVE_LIBHDFS
- SKIPPED();
- puts(" HDFS VFD is not enabled");
- fflush(stdout);
- return 0;
-#else
/*********
* SETUP *
*********/
- /* create HDFS fapl
+ /* create HDFS fapl
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
FAIL_IF( fapl_id < 0 )
@@ -1275,7 +1301,7 @@ test_read(void)
buffer[i] = 0;
}
- /* open file
+ /* open file
*/
file_raven = H5FDopen(
filename_raven,
@@ -1301,7 +1327,7 @@ test_read(void)
FAIL_IF( HDFS_TEST_MAX_BUF_SIZE < test.len ) /* buffer too small! */
- FAIL_IF( FAIL ==
+ FAIL_IF( FAIL ==
H5FDset_eoa( file_raven, H5FD_MEM_DEFAULT, test.eoa_set) )
/* zero buffer contents */
@@ -1345,15 +1371,16 @@ test_read(void)
PASSED();
return 0;
-#endif /* H5_HAVE_LIBHDFS */
error:
+
/***********
* CLEANUP *
***********/
- if (file_raven != 0)
+ if (file_raven != 0) {
(void)H5FDclose(file_raven);
+ }
if (fapl_id >= 0) {
H5E_BEGIN_TRY {
(void)H5Pclose(fapl_id);
@@ -1362,14 +1389,16 @@ error:
return 1;
-} /* test_read */
+#endif /* H5_HAVE_LIBHDFS */
+
+} /* end test_read() */
/*---------------------------------------------------------------------------
*
* Function: test_noops_and_autofails()
*
- * Purpose:
+ * Purpose:
*
* Demonstrate the unavailable and do-nothing routines unique to
* Read-Only VFD.
@@ -1391,6 +1420,15 @@ error:
static int
test_noops_and_autofails(void)
{
+#ifndef H5_HAVE_LIBHDFS
+ TESTING("HDFS VFD always-fail and no-op routines");
+ SKIPPED();
+ puts(" HDFS VFD is not enabled");
+ fflush(stdout);
+ return 0;
+
+#else
+
/*********************
* test-local macros *
*********************/
@@ -1413,13 +1451,7 @@ test_noops_and_autofails(void)
* SETUP *
*********/
-#ifndef H5_HAVE_LIBHDFS
- SKIPPED();
- puts(" HDFS VFD is not enabled");
- fflush(stdout);
- return 0;
-#else
- /* create HDFS fapl
+ /* create HDFS fapl
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
FAIL_IF( fapl_id < 0 )
@@ -1441,7 +1473,7 @@ test_noops_and_autofails(void)
/* auto-fail calls to write and truncate
*/
H5E_BEGIN_TRY {
- JSVERIFY( FAIL,
+ JSVERIFY( FAIL,
H5FDwrite(file, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data),
"write must fail" )
} H5E_END_TRY;
@@ -1485,9 +1517,9 @@ test_noops_and_autofails(void)
PASSED();
return 0;
-#endif /* H5_HAVE_LIBHDFS */
error:
+
/***********
* CLEANUP *
***********/
@@ -1503,14 +1535,16 @@ error:
return 1;
-} /* test_noops_and_autofails*/
+#endif /* H5_HAVE_LIBHDFS */
+
+} /* end test_noops_and_autofails() */
/*---------------------------------------------------------------------------
*
* Function: test_cmp()
*
- * Purpose:
+ * Purpose:
*
* Verify "file comparison" behavior.
*
@@ -1527,117 +1561,6 @@ error:
static int
test_cmp(void)
{
-#if 0
- /*********************
- * test-local macros *
- *********************/
-
- /*************************
- * test-local structures *
- *************************/
-
- /************************
- * test-local variables *
- ************************/
-
- H5FD_t *fd_raven = NULL;
- H5FD_t *fd_shakes = NULL;
- H5FD_t *fd_raven_2 = NULL;
- hbool_t curl_ready = FALSE;
- hid_t fapl_id = -1;
-
-
-
- TESTING("HDFS cmp (comparison)");
-
- if (s3_test_credentials_loaded == 0) {
- SKIPPED();
- puts(" s3 credentials are not loaded");
- fflush(stdout);
- return 0;
- }
-
- /*********
- * SETUP *
- *********/
-
- FAIL_IF( CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT) )
- curl_ready = TRUE;
-
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( 0 > fapl_id )
- JSVERIFY( SUCCEED, H5Pset_fapl_hdfs(fapl_id, &restricted_access_fa), NULL )
-
- fd_raven = H5FDopen(
- url_text_public,
- H5F_ACC_RDONLY,
- fapl_id,
- HADDR_UNDEF);
- FAIL_IF( NULL == fd_raven )
-
- fd_shakes = H5FDopen(
- url_text_restricted,
- H5F_ACC_RDONLY,
- fapl_id,
- HADDR_UNDEF);
- FAIL_IF( NULL == fd_shakes )
-
- fd_raven_2 = H5FDopen(
- url_text_public,
- H5F_ACC_RDONLY,
- fapl_id,
- HADDR_UNDEF);
- FAIL_IF( NULL == fd_raven_2 )
-
- /*********
- * TESTS *
- *********/
-
- JSVERIFY( 0, H5FDcmp(fd_raven, fd_raven_2), NULL )
- JSVERIFY( -1, H5FDcmp(fd_raven, fd_shakes), NULL )
- JSVERIFY( 1, H5FDcmp(fd_shakes, fd_raven_2), NULL )
-
- /************
- * TEARDOWN *
- ************/
-
- FAIL_IF( FAIL == H5FDclose(fd_raven) )
- fd_raven = NULL;
- FAIL_IF( FAIL == H5FDclose(fd_shakes) )
- fd_shakes = NULL;
- FAIL_IF( FAIL == H5FDclose(fd_raven_2) )
- fd_raven_2 = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
- fapl_id = -1;
-
- curl_global_cleanup();
- curl_ready = FALSE;
-
- PASSED();
- return 0;
-
-error:
- /***********
- * CLEANUP *
- ***********/
-
- if (fd_raven != NULL) (void)H5FDclose(fd_raven);
- if (fd_raven_2 != NULL) (void)H5FDclose(fd_raven_2);
- if (fd_shakes != NULL) (void)H5FDclose(fd_shakes);
- if (TRUE == curl_ready) curl_global_cleanup();
- if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
- }
-
-#else
- /*
- JSFAILED_AT()
- HDprintf("TODO\n");
- return 1;
- */
-
TESTING("HDFS cmp (comparison)");
SKIPPED();
HDfprintf(
@@ -1645,16 +1568,15 @@ error:
" TODO: Distinct valid fapls to open the same file.\n");
return 0;
-#endif /* s3comms relic */
-} /* test_cmp */
+} /* end test_cmp() */
/*---------------------------------------------------------------------------
*
* Function: test_H5F_integration()
*
- * Purpose:
+ * Purpose:
*
* Demonstrate H5F (File interface) behavior with files on HDFS.
*
@@ -1675,6 +1597,15 @@ error:
static int
test_H5F_integration(void)
{
+#ifndef H5_HAVE_LIBHDFS
+ TESTING("HDFS file access through HD5F library (H5F API)");
+ SKIPPED();
+ puts(" HDFS VFD is not enabled");
+ fflush(stdout);
+ return 0;
+
+#else
+
/*********************
* test-local macros *
*********************/
@@ -1696,12 +1627,6 @@ test_H5F_integration(void)
* SETUP *
*********/
-#ifndef H5_HAVE_LIBHDFS
- SKIPPED();
- puts(" HDFS VFD is not enabled");
- fflush(stdout);
- return 0;
-#else
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
FAIL_IF( 0 > fapl_id )
FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) )
@@ -1749,7 +1674,6 @@ test_H5F_integration(void)
PASSED();
return 0;
-#endif /* H5_HAVE_LIBHDFS */
error:
/***********
@@ -1771,6 +1695,8 @@ error:
return 1;
+#endif /* H5_HAVE_LIBHDFS */
+
} /* test_H5F_integration */
@@ -1796,15 +1722,19 @@ main(void)
/******************
* commence tests *
******************/
-
- static char hdfs_namenode_name[MAX_HDFS_NAMENODE_NAME] = "";
+
+ static char hdfs_namenode_name[HDFS_NAMENODE_NAME_MAX_SIZE] = "";
const char *hdfs_namenode_name_env = NULL;
hdfs_namenode_name_env = HDgetenv("HDFS_TEST_NAMENODE_NAME");
if (hdfs_namenode_name_env == NULL || hdfs_namenode_name_env[0] == '\0') {
- HDstrncpy(hdfs_namenode_name, "localhost", 9);
- } else {
- HDstrncpy(default_fa.namenode_name, hdfs_namenode_name_env, MAX_HDFS_NAMENODE_NAME);
+ HDstrncpy(hdfs_namenode_name, "localhost", HDFS_NAMENODE_NAME_MAX_SIZE);
+ }
+ else {
+ HDstrncpy( /* TODO: error-check? */
+ default_fa.namenode_name,
+ hdfs_namenode_name_env,
+ HDFS_NAMENODE_NAME_MAX_SIZE);
}
h5_reset();
@@ -1823,14 +1753,15 @@ main(void)
if (nerrors > 0) {
HDprintf("***** %d hdfs TEST%s FAILED! *****\n",
- nerrors,
+ nerrors,
nerrors > 1 ? "S" : "");
nerrors = 1;
- } else {
+ }
+ else {
HDprintf("All hdfs tests passed.\n");
}
return nerrors; /* 0 if no errors, 1 if any errors */
-} /* main() */
+} /* end main() */
diff --git a/test/links.c b/test/links.c
index f8be2b5..cd44433 100644
--- a/test/links.c
+++ b/test/links.c
@@ -39,8 +39,8 @@
/* File for external link test. Created with gen_udlinks.c */
#define LINKED_FILE "be_extlink2.h5"
-#define TMPDIR "tmp/"
-#define TMPDIR2 "tmp2/"
+#define TMPDIR "tmp_links/"
+#define TMPDIR2 "tmp2_links/"
/* Symlinks for external link symlink test */
#define SYMLINK1 TMPDIR "sym1.h5"
@@ -106,7 +106,7 @@ const char *FILENAME[] = {
#define CORE_INCREMENT 1024
#define NUM40 40
-/* do not do check_all_closed() for "ext*" files and "tmp/ext*" */
+/* do not do check_all_closed() for "ext*" files and "tmp_links/ext*" */
#define EXTSTOP 12
#define LINK_BUF_SIZE 1024
@@ -2562,9 +2562,9 @@ error:
*
* Purpose: 1. target link: "extlinks2"
* 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks2"
- * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp"
- * Should be able to access the target file in tmp directory via the prefix set
+ * 3. target file: "tmp_links/extlinks2"
+ * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp_links"
+ * Should be able to access the target file in tmp_links directory via the prefix set
* by H5Pset_elink_prefix()
*
*
@@ -2592,11 +2592,11 @@ external_link_prefix(hid_t fapl, hbool_t new_format)
/* set up name for external linked target file: "extlinks2" */
h5_fixname(FILENAME[16], fapl, filename2, sizeof filename2);
- /* create tmp directory and get current working directory path */
+ /* create tmp_links directory and get current working directory path */
if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
- /* set up name for target file: "tmp/extlinks2" */
+ /* set up name for target file: "tmp_links/extlinks2" */
h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3);
/* Create the target file */
@@ -2626,7 +2626,7 @@ external_link_prefix(hid_t fapl, hbool_t new_format)
/* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */
if (gid < 0) {
H5_FAILED();
- HDputs(" Should have found the file in tmp directory.");
+ HDputs(" Should have found the file in tmp_links directory.");
goto error;
}
@@ -2650,8 +2650,8 @@ error:
* Function: external_link_abs_mainpath: test 3
*
* Purpose: 1. target link: "extlinks3"
- * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: "<cur drive>:/CWD/tmp/extlinks0"
- * 3. target file: "tmp/extlinks3"
+ * 2. main file: Linux:"/CWD/tmp_links/extlinks0"; Windows: "<cur drive>:/CWD/tmp_links/extlinks0"
+ * 3. target file: "tmp_links/extlinks3"
* Should be able to access the target file via the main file's absolute path
*
* Return: Success: 0
@@ -2676,17 +2676,17 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
/* set up name for external linked target file: "extlinks3" */
h5_fixname(FILENAME[18], fapl, filename2, sizeof filename2);
- /* set up name for target file: "tmp/extlinks3" */
+ /* set up name for target file: "tmp_links/extlinks3" */
h5_fixname(FILENAME[19], fapl, filename3, sizeof filename3);
- /* create tmp directory and get current working directory path */
+ /* create tmp_links directory and get current working directory path */
if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
* set up name for main file:
- * Linux: "/CWD/tmp/extlinks0"
- * Window: "<cur drive>:/CWD/tmp/extlinks0"
+ * Linux: "/CWD/tmp_links/extlinks0"
+ * Window: "<cur drive>:/CWD/tmp_links/extlinks0"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[13]);
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
@@ -2714,7 +2714,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
/* should be able to find the target file from absolute path set for main file */
if(gid < 0) {
H5_FAILED();
- HDputs(" Should have found the file in tmp directory.");
+ HDputs(" Should have found the file in tmp_links directory.");
goto error;
}
@@ -2738,8 +2738,8 @@ error:
* Function: external_link_rel_mainpath: test 4
*
* Purpose: 1. target link: "extlinks4"
- * 2. main file: "tmp/extlinks0"
- * 3. target file: "tmp/extlinks4"
+ * 2. main file: "tmp_links/extlinks0"
+ * 3. target file: "tmp_links/extlinks4"
* Should be able to access the target file via the main file's CWD+relative path
*
* Return: Success: 0
@@ -2766,9 +2766,9 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format)
if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
- /* set up name for main file: "tmp/extlinks0" */
+ /* set up name for main file: "tmp_links/extlinks0" */
h5_fixname(FILENAME[13], fapl, filename1, sizeof filename1);
- /* set up name for target file: "tmp/extlinks4" */
+ /* set up name for target file: "tmp_links/extlinks4" */
h5_fixname(FILENAME[21], fapl, filename3, sizeof filename3);
/* Create the target file */
@@ -2817,7 +2817,7 @@ error:
* Function: external_link_cwd: test 5
*
* Purpose: 1. target link: "extlinks5"
- * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: "<cur drive>:/CWD/tmp/extlinks0"
+ * 2. main file: Linux:"/CWD/tmp_links/extlinks0"; Window: "<cur drive>:/CWD/tmp_links/extlinks0"
* 3. target file: "extlinks5"
* Should be able to access the target file in the current working directory
*
@@ -2849,8 +2849,8 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
/*
* set up name for main file:
- * Linux: "/CWD/tmp/extlinks0"
- * Windows: "<cur drive>:/CWD/tmp/extlinks0"
+ * Linux: "/CWD/tmp_links/extlinks0"
+ * Windows: "<cur drive>:/CWD/tmp_links/extlinks0"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[13]);
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
@@ -2901,9 +2901,9 @@ error:
/*-------------------------------------------------------------------------
* Function: external_link_abstar: test 6
*
- * Purpose: 1. target link: Linux:"/CWD/tmp/extlinks6"; Windows:"<cur drive>:/CWD/tmp/extlinks6"
+ * Purpose: 1. target link: Linux:"/CWD/tmp_links/extlinks6"; Windows:"<cur drive>:/CWD/tmp_links/extlinks6"
* 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks6"
+ * 3. target file: "tmp_links/extlinks6"
* Should be able to access the target file's absolute path
*
* Return: Success: 0
@@ -2929,19 +2929,19 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* create tmp directory and get current working directory path */
+ /* create tmp_links directory and get current working directory path */
if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
* set up name for external linked target file:
- * Linux: "/CWD/tmp/extlinks6"
- * Windows: "<cur drive>:/CWD/tmp/extlinks6"
+ * Linux: "/CWD/tmp_links/extlinks6"
+ * Windows: "<cur drive>:/CWD/tmp_links/extlinks6"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[23]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
- /* set up name for target file: "tmp/extlinks6" */
+ /* set up name for target file: "tmp_links/extlinks6" */
h5_fixname(FILENAME[23], fapl, filename3, sizeof filename3);
/* Create the target file */
@@ -2966,7 +2966,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
/* should be able to find the target file with abolute path */
if(gid < 0) {
H5_FAILED();
- HDputs(" Should have found the file in tmp directory.");
+ HDputs(" Should have found the file in tmp_links directory.");
goto error;
}
@@ -2988,7 +2988,7 @@ error:
/*-------------------------------------------------------------------------
* Function: external_link_abstar_cur: test 7
*
- * Purpose: 1. target link: Linux: "/CWD/tmp/extlinks7"; Windows: "<cur drive>:/CWD/tmp/extlinks7"
+ * Purpose: 1. target link: Linux: "/CWD/tmp_links/extlinks7"; Windows: "<cur drive>:/CWD/tmp_links/extlinks7"
* 2. main file: "extlinks0"
* 3. target file: "extlinks7"
* Should be able to access the target file via the main file's CWD.
@@ -3019,14 +3019,14 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
/* set up name for target file name: "extlinks7" */
h5_fixname(FILENAME[24], fapl, filename3, sizeof filename3);
- /* create tmp directory and get current working directory path */
+ /* create tmp_links directory and get current working directory path */
if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
* set up name for external linked target file:
- * Linux: "/CWD/tmp/extlinks7"
- * Windows: "<cur drive>:/CWD/tmp/extlinks7"
+ * Linux: "/CWD/tmp_links/extlinks7"
+ * Windows: "<cur drive>:/CWD/tmp_links/extlinks7"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[25]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
@@ -3076,9 +3076,9 @@ error:
/*-------------------------------------------------------------------------
* Function: external_link_reltar: test 8
*
- * Purpose: 1. target link: Linux:"tmp/extlinks8"
+ * Purpose: 1. target link: Linux:"tmp_links/extlinks8"
* 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks8"
+ * 3. target file: "tmp_links/extlinks8"
* Should be able to access the target file via the main file's CWD+ target's relative path
*
* Return: Success: 0
@@ -3101,11 +3101,11 @@ external_link_reltar(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* create tmp directory */
+ /* create tmp_links directory */
if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR
- /* set up name for target file name: "tmp/extlinks8" */
- /* set up name for external linked target file: "tmp/extlinks8" */
+ /* set up name for target file name: "tmp_links/extlinks8" */
+ /* set up name for external linked target file: "tmp_links/extlinks8" */
h5_fixname(FILENAME[26], fapl, filename2, sizeof filename2);
/* Create the target file */
@@ -3126,7 +3126,7 @@ external_link_reltar(hid_t fapl, hbool_t new_format)
/* Open object through external link */
if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) {
H5_FAILED();
- HDputs(" Should have found the file in tmp directory.");
+ HDputs(" Should have found the file in tmp_links directory.");
goto error;
} /* end if */
@@ -3152,8 +3152,8 @@ error:
* Purpose:
* 1. target link: "extlinks9"
* 2. main file: "extlinks0"
- * 3. target file" "tmp/extlinks9"
- * 3. chdir "tmp"
+ * 3. target file" "tmp_links/extlinks9"
+ * 3. chdir "tmp_links"
* Should be able to access the target file in current working directory
*
* Return: Success: 0
@@ -3179,10 +3179,10 @@ external_link_chdir(hid_t fapl, hbool_t new_format)
/* set up name for external linked target file ("extlinks9") */
h5_fixname(FILENAME[27], fapl, filename2, sizeof filename2);
- /* create tmp directory */
+ /* create tmp_links directory */
if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR
- /* set up name for target file name ("tmp/extlinks9") */
+ /* set up name for target file name ("tmp_links/extlinks9") */
h5_fixname(FILENAME[28], fapl, filename3, sizeof filename3);
/* Create the target file */
@@ -3215,7 +3215,7 @@ external_link_chdir(hid_t fapl, hbool_t new_format)
*/
if (gid < 0) {
H5_FAILED();
- HDputs(" Should have found the file in tmp directory.");
+ HDputs(" Should have found the file in tmp_links directory.");
goto error;
}
@@ -3243,7 +3243,7 @@ error:
*
* 1. target link: "extlinks16"
* 2. target file: "extlinks16"
- * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: "<cur drive>:/CWD/tmp/extlinks0"
+ * 3. main file: Linux:"/CWD/tmp_links/extlinks0"; Window: "<cur drive>:/CWD/tmp_links/extlinks0"
* 4. Create target file A to be a "family" file: extlinks16A
* 4. Create target file B to be a "multi" file: extlinks16B
* 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A
@@ -3285,8 +3285,8 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
/*
* set up name for main file:
- * Linux: "/CWD/tmp/extlinks0"
- * Windows: "<cur drive>:/CWD/tmp/extlinks0"
+ * Linux: "/CWD/tmp_links/extlinks0"
+ * Windows: "<cur drive>:/CWD/tmp_links/extlinks0"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[13]);
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
@@ -3435,7 +3435,7 @@ error:
*
* 1. target link: "extlinks17"
* 2. target file: "extlinks17"
- * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: "<cur drive>:/CWD/tmp/extlinks0"
+ * 3. main file: Linux:"/CWD/tmp_links/extlinks0"; Window: "<cur drive>:/CWD/tmp_links/extlinks0"
* 4. Create target file to be a "core" file:/A/Dataset
* 5. Create external link from main file to target file:ext_link->target file:/A/Dataset
* 6. Set the file access property list of the link access to use "core" file without
@@ -3474,8 +3474,8 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
/*
* set up name for main file:
- * Linux: "/CWD/tmp/extlinks0"
- * Windows: "<cur drive>:/CWD/tmp/extlinks0"
+ * Linux: "/CWD/tmp_links/extlinks0"
+ * Windows: "<cur drive>:/CWD/tmp_links/extlinks0"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[13]);
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
@@ -4108,7 +4108,7 @@ error:
* Function: external_link_win1
*
* Purpose:
- * 1. target link: "/CWD/tmp/extlinks10"
+ * 1. target link: "/CWD/tmp_links/extlinks10"
* 2. main file: "extlinks0"
* 3. target file: "extlinks10"
* Should be able to find the target file via main file's current drive/rel path
@@ -4139,7 +4139,7 @@ external_link_win1(hid_t fapl, hbool_t new_format)
if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
- /* set up name for target link: "/CWD/tmp/extlinks10" */
+ /* set up name for target link: "/CWD/tmp_links/extlinks10" */
HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it rel drive but absolute path */
HDstrcat(tmpname, "/");
HDstrcat(tmpname, FILENAME[30]);
@@ -4194,9 +4194,9 @@ error:
* Function: external_link_win2
*
* Purpose:
- * 1. target link: "/CWD/tmp/extlinks11"
+ * 1. target link: "/CWD/tmp_links/extlinks11"
* 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks11"
+ * 3. target file: "tmp_links/extlinks11"
* Should be able to access the target file directly (rel drive/abs path)
*
* Return: Success: 0
@@ -4222,17 +4222,17 @@ external_link_win2(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* create tmp directory and get current working directory path */
+ /* create tmp_links directory and get current working directory path */
if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
- /* set up name for target link: "/CWD/tmp/extlinks11" */
+ /* set up name for target link: "/CWD/tmp_links/extlinks11" */
HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it relative drive but absolute path */
HDstrcat(tmpname, "/");
HDstrcat(tmpname, FILENAME[31]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
- /* set up name for target file: "tmp/extlinks11" */
+ /* set up name for target file: "tmp_links/extlinks11" */
h5_fixname(FILENAME[31], fapl, filename3, sizeof filename3);
/* Create the target file */
@@ -4258,7 +4258,7 @@ external_link_win2(hid_t fapl, hbool_t new_format)
/* should be able to find the target file directly */
if(gid < 0) {
H5_FAILED();
- HDputs(" Should have found the file in tmp.");
+ HDputs(" Should have found the file in tmp_links.");
goto error;
}
@@ -4282,9 +4282,9 @@ error:
* Function: external_link_win3
*
* Purpose:
- * 1. target link: "<cur drive>:tmp/extlinks12"
+ * 1. target link: "<cur drive>:tmp_links/extlinks12"
* 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks12"
+ * 3. target file: "tmp_links/extlinks12"
* Should be able to access the target file directly (abs drive/rel path)
*
* Return: Success: 0
@@ -4310,16 +4310,16 @@ external_link_win3(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* create tmp directory */
+ /* create tmp_links directory */
if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
- /* set up name for target link: "<drive-letter>:tmp/extlinks12" */
+ /* set up name for target link: "<drive-letter>:tmp_links/extlinks12" */
drive = HDgetdrive();
HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[32]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
- /* set up name for target file: "tmp/extlinks12" */
+ /* set up name for target file: "tmp_links/extlinks12" */
h5_fixname(FILENAME[32], fapl, filename3, sizeof filename3);
/* Create the target file */
@@ -4345,7 +4345,7 @@ external_link_win3(hid_t fapl, hbool_t new_format)
/* should be able to find the target file directly */
if (gid < 0) {
H5_FAILED();
- HDputs(" Should have found the file in tmp.");
+ HDputs(" Should have found the file in tmp_links.");
goto error;
}
@@ -4369,8 +4369,8 @@ external_link_win3(hid_t fapl, hbool_t new_format)
*
* Purpose:
* 1. target link: "<cur drive>:extlinks13"
- * 2. main file: "<cur-drive>:tmp/extlinks0"
- * 3. target file: tmp/extlinks13
+ * 2. main file: "<cur-drive>:tmp_links/extlinks0"
+ * 3. target file: tmp_links/extlinks13
* Should be able to access the target file via main file's abs drive/rel path
*
* Return: Success: 0
@@ -4393,7 +4393,7 @@ external_link_win4(hid_t fapl, hbool_t new_format)
else
TESTING("external links via main file's abs drive/rel path (windows)")
- /* set up name for main file: "<drive-letter>:tmp/extlinks0" */
+ /* set up name for main file: "<drive-letter>:tmp_links/extlinks0" */
drive = HDgetdrive();
HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[13]);
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
@@ -4402,7 +4402,7 @@ external_link_win4(hid_t fapl, hbool_t new_format)
HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[33]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
- /* set up name for target file: "tmp/extlinks13" */
+ /* set up name for target file: "tmp_links/extlinks13" */
h5_fixname(FILENAME[34], fapl, filename3, sizeof filename3);
/* Create the target file */
@@ -4451,9 +4451,9 @@ error:
* Function: external_link_win5
*
* Purpose:
- * 1. target link: "<cur drive+1>:tmp/extlinks14"
+ * 1. target link: "<cur drive+1>:tmp_links/extlinks14"
* 2. main file: "/CWD/extlinks0"
- * 3. target file: "tmp/extlinks14"
+ * 3. target file: "tmp_links/extlinks14"
* Should be able to access the target file via main file's relative drive/absolute path
*
* Return: Success: 0
@@ -4491,11 +4491,11 @@ external_link_win5(hid_t fapl, hbool_t new_format)
HDstrcat(tmpname, FILENAME[12]);
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
- /* set up name for target link: "<drive-letter+1>:tmp/extlinks14" */
+ /* set up name for target link: "<drive-letter+1>:tmp_links/extlinks14" */
HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[35]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
- /* set up name for target file: "tmp/extlinks14" */
+ /* set up name for target file: "tmp_links/extlinks14" */
h5_fixname(FILENAME[35], fapl, filename3, sizeof filename3);
/* Create the target file */
@@ -4544,9 +4544,9 @@ error:
* Function: external_link_win6
*
* Purpose:
- * 1. target link: "<cur drive+1>:tmp/extlinks15"
+ * 1. target link: "<cur drive+1>:tmp_links/extlinks15"
* 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks15"
+ * 3. target file: "tmp_links/extlinks15"
* Should be able to access the target file via target's current drive/rel path
*
* Return: Success: 0
@@ -4569,7 +4569,7 @@ external_link_win6(hid_t fapl, hbool_t new_format)
else
TESTING("external links via target's current drive/rel path (windows)")
- /* create tmp directory */
+ /* create tmp_links directory */
if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
drive = HDgetdrive();
@@ -4581,7 +4581,7 @@ external_link_win6(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* set up name for target link: "<drive-letter+1>:tmp/extlinks15" */
+ /* set up name for target link: "<drive-letter+1>:tmp_links/extlinks15" */
HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[36]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
@@ -4610,7 +4610,7 @@ external_link_win6(hid_t fapl, hbool_t new_format)
/* should be able to find the target file via target file's rel path in current drive */
if (gid < 0) {
H5_FAILED();
- HDputs(" Should have found the file in tmp.");
+ HDputs(" Should have found the file in tmp_links.");
goto error;
}
@@ -4634,7 +4634,7 @@ error:
* Function: external_link_win7
*
* Purpose:
- * 1. UNC target link: "\\127.0.01\c$/tmp/extlinks10"
+ * 1. UNC target link: "\\127.0.01\c$/tmp_links/extlinks10"
* 2. main file: "extlinks0"
* 3. target file: "extlinks15"
* Should be able to find the target file via main file's local host/main drive/rel path
@@ -4665,7 +4665,7 @@ external_link_win7(hid_t fapl, hbool_t new_format)
if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
- /* set up name for target link: "\\127.0.0.1\c$/tmp/extlinks10" */
+ /* set up name for target link: "\\127.0.0.1\c$/tmp_links/extlinks10" */
HDstrcpy(tmpname, "\\\\127.0.0.1\\c$"); /* absolute path */
HDstrcat(tmpname, "/");
HDstrcat(tmpname, FILENAME[30]);
@@ -4752,7 +4752,7 @@ external_link_win8(hid_t fapl, hbool_t new_format)
if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR
- /* create tmp directory */
+ /* create tmp_links directory */
if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR
/* set up name for target link: "<drive-letter>:\CWD\extlinks10" */
@@ -4785,7 +4785,7 @@ external_link_win8(hid_t fapl, hbool_t new_format)
/* should be able to find the target file directly */
if(gid < 0) {
H5_FAILED();
- HDputs(" Should have found the file in tmp.");
+ HDputs(" Should have found the file in tmp_links.");
goto error;
}
@@ -4809,7 +4809,7 @@ error:
* Function: external_link_win9
*
* Purpose:
- * 1. Long UNC target link: "\\?\UNC\127.0.01\c$/tmp/extlinks10"
+ * 1. Long UNC target link: "\\?\UNC\127.0.01\c$/tmp_links/extlinks10"
* 2. main file: "extlinks0"
* 3. target file: "extlinks15"
* Should be able to find the target file via main file's local host/main drive/rel path
@@ -4839,7 +4839,7 @@ external_link_win9(hid_t fapl, hbool_t new_format)
if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR
- /* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp/extlinks10" */
+ /* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp_links/extlinks10" */
HDstrcpy(tmpname, "\\\\?\\UNC\127.0.0.1\\c$"); /* absolute path */
HDstrcat(tmpname, "/");
HDstrcat(tmpname, FILENAME[30]);
@@ -6087,7 +6087,7 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks21A" */
h5_fixname(FILENAME[45], fapl, filename1, sizeof(filename1));
- /* create tmp directory and get current working directory path */
+ /* create tmp_links directory and get current working directory path */
if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST)
@@ -6097,29 +6097,29 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* Set up names for files in the subdirectories */
- /* set up names for file #2 in temporary directory #2: "tmp2/extlinks21B" */
+ /* set up names for file #2 in temporary directory #2: "tmp2_links/extlinks21B" */
h5_fixname(FILENAME[46], fapl, filename2a, sizeof(filename2a));
fix_ext_filename(tmpname, cwdpath, FILENAME[46]);
h5_fixname(tmpname, fapl, filename2b, sizeof(filename2b));
/* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */
- /* (i.e. tmp/sym1.h5 -> <full path to>/tmp2/extlinks21B.h5) */
+ /* (i.e. tmp_links/sym1.h5 -> <full path to>/tmp2_links/extlinks21B.h5) */
if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR
- /* set up name for file #3 in temporary directory #2: "tmp2/extlinks21C" */
+ /* set up name for file #3 in temporary directory #2: "tmp2_links/extlinks21C" */
h5_fixname(FILENAME[47], fapl, filename3a, sizeof(filename3a));
h5_fixname(FILENAME[48], fapl, filename3b, sizeof(filename3b));
- /* set up name for file #4 in temporary directory #1: "tmp/extlinks21D" */
+ /* set up name for file #4 in temporary directory #1: "tmp_links/extlinks21D" */
h5_fixname(FILENAME[49], fapl, filename4a, sizeof(filename4a));
fix_ext_filename(tmpname, cwdpath, FILENAME[49]);
h5_fixname(tmpname, fapl, filename4b, sizeof(filename4b));
/* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */
- /* (i.e. tmp2/sym2.h5 -> <full path to>/tmp/extlinks21D.h5) */
+ /* (i.e. tmp2_links/sym2.h5 -> <full path to>/tmp_links/extlinks21D.h5) */
if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR
- /* set up name for file #5 in temporary directory #1: "tmp/extlinks21E" */
+ /* set up name for file #5 in temporary directory #1: "tmp_links/extlinks21E" */
h5_fixname(FILENAME[50], fapl, filename5a, sizeof(filename5a));
h5_fixname(FILENAME[51], fapl, filename5b, sizeof(filename5b));
@@ -6132,11 +6132,11 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* Close file #1 */
if(H5Fclose(file1) < 0) TEST_ERROR
- /* Create file #2 in tmp directory #2 */
+ /* Create file #2 in tmp_links directory #2 */
if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
if(H5Fclose(file2) < 0) TEST_ERROR
- /* Re-open file #2 in tmp directory through symlink */
+ /* Re-open file #2 in tmp_links directory through symlink */
if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
/* Create group in file #2 in temporary directory */
@@ -7108,6 +7108,9 @@ done:
ret_value = -1;
break;
+ case H5I_MAP:
+ /* TODO: Not supported in native file format yet */
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_FILE:
@@ -7197,6 +7200,9 @@ done:
ret_value = -1;
break;
+ case H5I_MAP:
+ /* TODO: Not supported in native file format yet */
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_FILE:
@@ -9148,7 +9154,7 @@ static size_t link_filter_filter(unsigned int flags, size_t cd_nelmts,
if(flags & H5Z_FLAG_REVERSE) {
if(link_filter_state != LFS_ENCODED) return 0;
link_filter_state = LFS_DECODED;
- }
+ }
else {
if(link_filter_state < LFS_SET_LOCAL_CALLED) return 0;
link_filter_state = LFS_ENCODED;
@@ -13931,7 +13937,7 @@ main(void)
HDprintf("\n-Testing with minimzed dataset object headers-\n");
dcpl_g = H5Pcreate(H5P_DATASET_CREATE);
if (0 > dcpl_g) TEST_ERROR
- }
+ }
else {
HDprintf("\n-Testing with unminimzed dataset object headers-\n");
dcpl_g = H5P_DEFAULT;
@@ -13944,7 +13950,7 @@ main(void)
if(new_format) {
my_fapl = fapl2;
HDprintf("\n--Testing with 'new format'--\n");
- }
+ }
else {
my_fapl = fapl;
HDprintf("\n--Testing with 'old format'--\n");
@@ -13971,7 +13977,7 @@ main(void)
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* tests for external link */
- /* Test external file cache first, so it sees the default efc setting on the fapl
+ /* Test external file cache first, so it sees the default efc setting on the fapl
*/
nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0;
@@ -13981,7 +13987,7 @@ main(void)
nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0;
/* This test cannot run with the EFC because the EFC cannot currently
- * reopen a cached file with a different intent
+ * reopen a cached file with a different intent
*/
nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0;
@@ -14127,7 +14133,7 @@ main(void)
HDremove(SYMLINK1);
HDremove(SYMLINK2);
- /* clean up tmp directory created by external link tests */
+ /* clean up tmp_links and tmp2_links directory created by external link tests */
HDrmdir(TMPDIR);
HDrmdir(TMPDIR2);
diff --git a/test/links_env.c b/test/links_env.c
index 0cd690a..dff185c 100644
--- a/test/links_env.c
+++ b/test/links_env.c
@@ -12,39 +12,39 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Purpose: Tests hard, soft (symbolic) & external links.
+ * Purpose: Tests hard, soft (symbolic) & external links.
*/
-#define H5G_FRIEND /*suppress error about including H5Gpkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
#define H5G_TESTING
#include "h5test.h"
-#include "H5Gpkg.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
-#define TMPDIR "tmp/"
+#define TMPDIR "tmp_links_env/"
#define NAME_BUF_SIZE 1024
const char *FILENAME[] = {
- "extlinks_env0", /* 0: main file */
- "extlinks_env1", /* 1: target file */
+ "extlinks_env0", /* 0: main file */
+ "extlinks_env1", /* 1: target file */
TMPDIR "extlinks_env1", /* 2 */
NULL
};
static int external_link_env(hid_t fapl, hbool_t new_format);
-
+
/*-------------------------------------------------------------------------
* Function: external_link_env (moved from links.c)
*
- * Purpose: Verify that the target file is found successfully in "tmp" directory
- * via searching the pathnames set in the environment variable HDF5_EXT_PREFIX.
- * 1. Target link: "extlinks_env1"
- * 2. Main file: "extlinks_env0"
- * 3. Target file is created in: "tmp/extlinks_env1"
- * 4. The environment variable "HDF5_EXT_PREFIX" is set to ".:tmp"
+ * Purpose: Verify that the target file is found successfully in "tmp_links_env" directory
+ * via searching the pathnames set in the environment variable HDF5_EXT_PREFIX.
+ * 1. Target link: "extlinks_env1"
+ * 2. Main file: "extlinks_env0"
+ * 3. Target file is created in: "tmp_links_env/extlinks_env1"
+ * 4. The environment variable "HDF5_EXT_PREFIX" is set to ".:tmp_links_env"
*
* Return: Success: 0
* Failure: -1
@@ -59,12 +59,12 @@ static int external_link_env(hid_t fapl, hbool_t new_format);
static int
external_link_env(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- const char *envval = NULL; /* Pointer to environment variable */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE]; /* Holders for filename */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group IDs */
+ const char *envval = NULL; /* Pointer to environment variable */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE]; /* Holders for filename */
if(new_format)
TESTING("external links via environment variable (w/new group format)")
@@ -73,7 +73,7 @@ external_link_env(hid_t fapl, hbool_t new_format)
if ((envval = HDgetenv("HDF5_EXT_PREFIX")) == NULL)
envval = "nomatch";
- if (HDstrcmp(envval, ".:tmp")) TEST_ERROR
+ if (HDstrcmp(envval, ".:tmp_links_env")) TEST_ERROR
/* Set up name for main file:"extlinks_env0" */
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
@@ -81,14 +81,14 @@ external_link_env(hid_t fapl, hbool_t new_format)
/* Set up name for external linked target file: "extlinks_env1" */
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
- /* Create "tmp" directory */
+ /* Create "tmp_links_env" directory */
if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
+ TEST_ERROR
- /* Set up name (location) for the target file: "tmp/extlinks1" */
+ /* Set up name (location) for the target file: "tmp_links_env/extlinks1" */
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
- /* Create the target file in "tmp" directory */
+ /* Create the target file in "tmp_links_env" directory */
if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -110,9 +110,9 @@ external_link_env(hid_t fapl, hbool_t new_format)
/* Should be able to find the target file from pathnames set via HDF5_EXT_PREFIX */
if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in tmp directory.");
- goto error;
+ H5_FAILED();
+ puts(" Should have found the file in tmp_links_env directory.");
+ goto error;
}
/* closing for main file */
@@ -124,30 +124,30 @@ external_link_env(hid_t fapl, hbool_t new_format)
error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
return -1;
} /* end external_link_env() */
-
+
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Test external link with environment variable HDF5_EXT_PREFIX
+ * Purpose: Test external link with environment variable HDF5_EXT_PREFIX
*
- * Return: Success: exit(EXIT_SUCCESS)
- * Failure: exit(EXIT_FAILURE)
+ * Return: Success: exit(EXIT_SUCCESS)
+ * Failure: exit(EXIT_FAILURE)
*
- * Programmer: Vailin Choi; Nov 2010
+ * Programmer: Vailin Choi; Nov 2010
*
*-------------------------------------------------------------------------
*/
int
main(void)
{
- hid_t fapl; /* File access property lists */
- int nerrors = 0; /* Error from tests */
+ hid_t fapl; /* File access property lists */
+ int nerrors = 0; /* Error from tests */
h5_reset();
fapl = h5_fileaccess();
@@ -172,7 +172,7 @@ main(void)
}
HDprintf("All external Link (HDF5_EXT_PREFIX) tests passed.\n");
- /* clean up tmp directory created by external link tests */
+ /* clean up tmp_links_env directory created by external link tests */
HDrmdir(TMPDIR);
return 0;
diff --git a/test/objcopy.c b/test/objcopy.c
index 47a1065..489d6dd 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -1080,6 +1080,9 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
break;
+ case H5O_TYPE_MAP:
+ /* Maps not supported in native VOL connector */
+
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
@@ -1138,6 +1141,9 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
break;
+ case H5O_TYPE_MAP:
+ /* Maps not supported in native VOL connector */
+
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
@@ -1454,10 +1460,13 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
if(H5Tequal(oid, oid2) != TRUE) TEST_ERROR
break;
+ case H5O_TYPE_MAP:
+ HDassert(0 && "maps not supported in native VOL connector");
+
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
-HDassert(0 && "Unknown type of object");
+ HDassert(0 && "Unknown type of object");
break;
} /* end switch */
diff --git a/test/ros3.c b/test/ros3.c
index 60d3932..6d58af0 100644
--- a/test/ros3.c
+++ b/test/ros3.c
@@ -11,7 +11,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Read-Only S3 Virtual File Driver (VFD)
+ * Read-Only S3 Virtual File Driver (VFD)
*
* Purpose:
*
@@ -32,6 +32,9 @@
+/* only include the testing macros if needed */
+#ifdef H5_HAVE_ROS3_VFD
+
/*****************************************************************************
*
* FILE-LOCAL TESTING MACROS
@@ -368,15 +371,16 @@ if (strcmp((actual), (expected)) != 0) { \
#endif /* ifdef/else JSVERIFY_EXP_ACT */
+#endif /* H5_HAVE_ROS3_VFD */
+
/********************************
* OTHER MACROS AND DEFINITIONS *
********************************/
-/* copied from src/ros3.c
- */
+#ifdef H5_HAVE_ROS3_VFD
+
#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1)
-#ifdef H5_HAVE_ROS3_VFD
#define S3_TEST_PROFILE_NAME "ros3_vfd_test"
#define S3_TEST_MAX_URL_SIZE 256
@@ -440,6 +444,15 @@ H5FD_ros3_fapl_t anonymous_fa = {
static int
test_fapl_config_validation(void)
{
+#ifndef H5_HAVE_ROS3_VFD
+ TESTING("ROS3 fapl configuration validation");
+ SKIPPED();
+ puts(" ROS3 VFD not enabled");
+ fflush(stdout);
+ return 0;
+
+#else /* H5_HAVE_ROS3_VFD defined */
+
/*********************
* test-local macros *
*********************/
@@ -458,7 +471,6 @@ test_fapl_config_validation(void)
* test-local variables *
************************/
-#ifdef H5_HAVE_ROS3_VFD
hid_t fapl_id = -1; /* file access property list ID */
H5FD_ros3_fapl_t config;
H5FD_ros3_fapl_t fa_fetch;
@@ -544,21 +556,12 @@ test_fapl_config_validation(void)
},
};
-#endif /* H5_HAVE_ROS3_VFD */
-
TESTING("ROS3 fapl configuration validation");
/*********
* TESTS *
*********/
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD not enabled");
- fflush(stdout);
- return 0;
-#else
-
if (FALSE == s3_test_bucket_defined) {
SKIPPED();
puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined");
@@ -655,7 +658,7 @@ error:
* Purpose: Tests the file handle interface for the ROS3 driver
*
* As the ROS3 driver is 1) read only, 2) requires access
- * to an S3 server (minio for now), this test is quite
+ * to an S3 server, this test is quite
* different from the other tests.
*
* For now, test only fapl & flags. Extend as the
@@ -675,11 +678,19 @@ error:
static int
test_ros3_fapl(void)
{
+#ifndef H5_HAVE_ROS3_VFD
+ TESTING("ROS3 fapl ");
+ SKIPPED();
+ puts(" ROS3 VFD not enabled");
+ fflush(stdout);
+ return 0;
+
+#else /* H5_HAVE_ROS3 defined */
+
/************************
* test-local variables *
************************/
-#ifdef H5_HAVE_ROS3_VFD
hid_t fapl_id = -1; /* file access property list ID */
hid_t driver_id = -1; /* ID for this VFD */
unsigned long driver_flags = 0; /* VFD feature flags */
@@ -690,16 +701,9 @@ test_ros3_fapl(void)
"", /* secret_id */
"plugh", /* secret_key */
};
-#endif /* H5_HAVE_ROS3_VFD */
TESTING("ROS3 fapl ");
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD not enabled");
- fflush(stdout);
- return 0;
-#else
/* Set property list and file name for ROS3 driver.
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -759,11 +763,19 @@ error:
static int
test_vfd_open(void)
{
+#ifndef H5_HAVE_ROS3_VFD
+ TESTING("ROS3 VFD-level open");
+ SKIPPED();
+ puts(" ROS3 VFD not enabled");
+ fflush(stdout);
+ return 0;
+
+#else /* H5_HAVE_ROS3_VFD defined */
+
/*********************
* test-local macros *
*********************/
-#ifdef H5_HAVE_ROS3_VFD
#define FAPL_H5P_DEFAULT -2
#define FAPL_FILE_ACCESS -3
@@ -853,17 +865,9 @@ test_vfd_open(void)
hid_t fapl_file_access = -1;
unsigned i = 0;
unsigned tests_count = 10;
-#endif /* H5_HAVE_ROS3_VFD */
TESTING("ROS3 VFD-level open");
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD not enabled");
- fflush(stdout);
- return 0;
-#else
-
if (FALSE == s3_test_bucket_defined) {
SKIPPED();
puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined");
@@ -989,6 +993,15 @@ error:
static int
test_eof_eoa(void)
{
+#ifndef H5_HAVE_ROS3_VFD
+ TESTING("ROS3 eof/eoa gets and sets");
+ SKIPPED();
+ puts(" ROS3 VFD not enabled");
+ fflush(stdout);
+ return 0;
+
+#else /* H5_HAVE_ROS3_VFD defined */
+
/*********************
* test-local macros *
*********************/
@@ -1001,20 +1014,12 @@ test_eof_eoa(void)
* test-local variables *
************************/
-#ifdef H5_HAVE_ROS3_VFD
H5FD_t *fd_shakespeare = NULL;
hbool_t curl_ready = FALSE;
hid_t fapl_id = -1;
-#endif /* H5_HAVE_ROS3_VFD */
TESTING("ROS3 eof/eoa gets and sets");
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD not enabled");
- fflush(stdout);
- return 0;
-#else
if (s3_test_credentials_loaded == 0) {
SKIPPED();
puts(" s3 credentials are not loaded");
@@ -1136,21 +1141,22 @@ error:
static int
test_H5FDread_without_eoa_set_fails(void)
{
-#ifdef H5_HAVE_ROS3_VFD
+#ifndef H5_HAVE_ROS3_VFD
+ TESTING("ROS3 VFD read-eoa temporal coupling library limitation ");
+ SKIPPED();
+ puts(" ROS3 VFD not enabled");
+ fflush(stdout);
+ return 0;
+
+#else /* H5_HAVE_ROS3_VFD defined */
+
char buffer[256];
unsigned int i = 0;
H5FD_t *file_shakespeare = NULL;
hid_t fapl_id = -1;
-#endif /* H5_HAVE_ROS3_VFD */
TESTING("ROS3 VFD read-eoa temporal coupling library limitation ");
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD not enabled");
- fflush(stdout);
- return 0;
-#else
if (s3_test_credentials_loaded == 0) {
SKIPPED();
puts(" s3 credentials are not loaded");
@@ -1256,6 +1262,15 @@ error:
static int
test_read(void)
{
+#ifndef H5_HAVE_ROS3_VFD
+ TESTING("ROS3 VFD read/range-gets");
+ SKIPPED();
+ puts(" ROS3 VFD not enabled");
+ fflush(stdout);
+ return 0;
+
+#else /* H5_HAVE_ROS3_VFD defined */
+
/*********************
* test-local macros *
*********************/
@@ -1275,7 +1290,6 @@ test_read(void)
/************************
* test-local variables *
************************/
-#ifdef H5_HAVE_ROS3_VFD
struct testcase cases[] = {
{ "successful range-get",
6464,
@@ -1328,16 +1342,9 @@ test_read(void)
unsigned int i = 0;
H5FD_t *file_raven = NULL;
hid_t fapl_id = -1;
-#endif /* H5_HAVE_ROS3_VFD */
TESTING("ROS3 VFD read/range-gets");
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD not enabled");
- fflush(stdout);
- return 0;
-#else
if (s3_test_credentials_loaded == 0) {
SKIPPED();
puts(" s3 credentials are not loaded");
@@ -1471,6 +1478,15 @@ error:
static int
test_noops_and_autofails(void)
{
+#ifndef H5_HAVE_ROS3_VFD
+ TESTING("ROS3 VFD always-fail and no-op routines");
+ SKIPPED();
+ puts(" ROS3 VFD not enabled");
+ fflush(stdout);
+ return 0;
+
+#else
+
/*********************
* test-local macros *
*********************/
@@ -1483,21 +1499,13 @@ test_noops_and_autofails(void)
* test-local variables *
************************/
-#ifdef H5_HAVE_ROS3_VFD
hbool_t curl_ready = FALSE;
hid_t fapl_id = -1;
H5FD_t *file = NULL;
const char data[36] = "The Force shall be with you, always";
-#endif /* H5_HAVE_ROS3_VFD */
TESTING("ROS3 VFD always-fail and no-op routines");
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD not enabled");
- fflush(stdout);
- return 0;
-#else
if (FALSE == s3_test_bucket_defined) {
SKIPPED();
@@ -1624,6 +1632,15 @@ error:
static int
test_cmp(void)
{
+#ifndef H5_HAVE_ROS3_VFD
+ TESTING("ROS3 cmp (comparison)");
+ SKIPPED();
+ puts(" ROS3 VFD not enabled");
+ fflush(stdout);
+ return 0;
+
+#else
+
/*********************
* test-local macros *
*********************/
@@ -1636,22 +1653,14 @@ test_cmp(void)
* test-local variables *
************************/
-#ifdef H5_HAVE_ROS3_VFD
H5FD_t *fd_raven = NULL;
H5FD_t *fd_shakes = NULL;
H5FD_t *fd_raven_2 = NULL;
hbool_t curl_ready = FALSE;
hid_t fapl_id = -1;
-#endif /* H5_HAVE_ROS3_VFD */
TESTING("ROS3 cmp (comparison)");
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD not enabled");
- fflush(stdout);
- return 0;
-#else
if (s3_test_credentials_loaded == 0) {
SKIPPED();
puts(" s3 credentials are not loaded");
@@ -1767,6 +1776,15 @@ error:
static int
test_H5F_integration(void)
{
+#ifndef H5_HAVE_ROS3_VFD
+ TESTING("S3 file access through HD5F library (H5F API)");
+ SKIPPED();
+ puts(" ROS3 VFD not enabled");
+ fflush(stdout);
+ return 0;
+
+#else
+
/*********************
* test-local macros *
*********************/
@@ -1779,19 +1797,11 @@ test_H5F_integration(void)
* test-local variables *
************************/
-#ifdef H5_HAVE_ROS3_VFD
hid_t file = -1;
hid_t fapl_id = -1;
-#endif /* H5_HAVE_ROS3_VFD */
TESTING("S3 file access through HD5F library (H5F API)");
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD not enabled");
- fflush(stdout);
- return 0;
-#else
if (s3_test_credentials_loaded == 0) {
SKIPPED();
puts(" s3 credentials are not loaded");
diff --git a/test/s3comms.c b/test/s3comms.c
index a797e04..d636550 100644
--- a/test/s3comms.c
+++ b/test/s3comms.c
@@ -11,7 +11,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Read-Only S3 Virtual File Driver (VFD)
+ * Read-Only S3 Virtual File Driver (VFD)
*
* Purpose: Unit tests for the S3 Communications (s3comms) module.
*
@@ -386,7 +386,7 @@ static hbool_t s3_test_bucket_defined = FALSE;
#endif /* H5_HAVE_ROS3_VFD */
-
+
/*---------------------------------------------------------------------------
*
* Function: test_macro_format_credential()
@@ -408,7 +408,6 @@ test_macro_format_credential(void)
* test-local variables *
************************/
-#ifdef H5_HAVE_ROS3_VFD
char dest[256];
const char access[] = "AKIAIOSFODNN7EXAMPLE";
const char date[] = "20130524";
@@ -416,16 +415,9 @@ test_macro_format_credential(void)
const char service[] = "s3";
const char expected[] =
"AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/s3/aws4_request";
-#endif /* H5_HAVE_ROS3_VFD */
TESTING("test_macro_format_credential");
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD is not enabled");
- fflush(stdout);
- return 0;
-#else
FAIL_IF( S3COMMS_MAX_CREDENTIAL_SIZE <
S3COMMS_FORMAT_CREDENTIAL(dest, access, date, region, service) )
@@ -433,14 +425,13 @@ test_macro_format_credential(void)
PASSED();
return 0;
-#endif /* H5_HAVE_ROS3_VFD */
error:
return -1;
-} /* test_macro_format_credential */
-
+} /* end test_macro_format_credential() */
+
/*---------------------------------------------------------------------------
*
* Function: test_aws_canonical_request()
@@ -465,7 +456,6 @@ test_aws_canonical_request(void)
* test-local structures *
*************************/
-#ifdef H5_HAVE_ROS3_VFD
struct header {
const char *name;
const char *value;
@@ -520,16 +510,9 @@ test_aws_canonical_request(void)
hrb_node_t *node = NULL; /* http headers list pointer */
unsigned int n_cases = 3;
char sh_dest[64]; /* signed headers */
-#endif /* H5_HAVE_ROS3_VFD */
TESTING("test_aws_canonical_request");
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD is not enabled");
- fflush(stdout);
- return 0;
-#else
for (i = 0; i < n_cases; i++) {
/* pre-test bookkeeping
*/
@@ -559,16 +542,22 @@ test_aws_canonical_request(void)
/* test
*/
JSVERIFY( SUCCEED,
- H5FD_s3comms_aws_canonical_request(cr_dest, sh_dest, hrb),
+ H5FD_s3comms_aws_canonical_request(
+ cr_dest,
+ 512,
+ sh_dest,
+ 64,
+ hrb),
" unable to compose canonical request" )
JSVERIFY_STR( C->exp_headers, sh_dest, NULL )
JSVERIFY_STR( C->exp_request, cr_dest, NULL )
/* tear-down
*/
- while (node != NULL)
+ while (node != NULL) {
FAIL_IF( FAIL ==
H5FD_s3comms_hrb_node_set(&node, node->name, NULL));
+ }
HDassert(NULL == node);
FAIL_IF( FAIL == H5FD_s3comms_hrb_destroy(&hrb));
HDassert(NULL == hrb);
@@ -581,14 +570,29 @@ test_aws_canonical_request(void)
/* malformed hrb and/or node-list
*/
- JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(cr_dest, sh_dest, NULL),
+ JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(
+ cr_dest,
+ 20,
+ sh_dest,
+ 20,
+ NULL),
"http request object cannot be null" )
hrb = H5FD_s3comms_hrb_init_request("GET", "/", "HTTP/1.1");
- JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(NULL, sh_dest, hrb),
+ JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(
+ NULL,
+ 20,
+ sh_dest,
+ 20,
+ hrb),
"canonical request destination cannot be NULL" )
- JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(cr_dest, NULL, hrb),
+ JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(
+ cr_dest,
+ 20,
+ NULL,
+ 20,
+ hrb),
"signed headers destination cannot be null" )
FAIL_IF( FAIL == H5FD_s3comms_hrb_destroy(&hrb) )
@@ -604,15 +608,15 @@ error:
(void)H5FD_s3comms_hrb_node_set(&node, node->name, NULL);
HDassert( node == NULL );
}
- if (hrb != NULL)
+ if (hrb != NULL) {
(void)H5FD_s3comms_hrb_destroy(&hrb);
+ }
return -1;
-#endif /* H5_HAVE_ROS3_VFD */
-
-} /* test_aws_canonical_request */
+} /* end test_aws_canonical_request() */
+
/*---------------------------------------------------------------------------
*
* Function: test_bytes_to_hex
@@ -706,9 +710,9 @@ test_bytes_to_hex(void)
error:
return -1;
-} /* test_bytes_to_hex */
-
+} /* end test_bytes_to_hex() */
+
/*---------------------------------------------------------------------------
*
* Function: test_hrb_init_request()
@@ -725,7 +729,6 @@ error:
static herr_t
test_hrb_init_request(void)
{
-#ifdef H5_HAVE_ROS3_VFD
/*********************
* test-local macros *
*********************/
@@ -769,7 +772,7 @@ test_hrb_init_request(void)
"HTTP/1.1",
FALSE,
},
- { "slash prepented to resource path, if necessary",
+ { "slash prepended to resource path, if necessary",
NULL,
"MYPATH/MYFILE.tiff",
"/MYPATH/MYFILE.tiff",
@@ -788,29 +791,25 @@ test_hrb_init_request(void)
unsigned int i = 0;
unsigned int ncases = 5;
hrb_t *req = NULL;
-#endif /* H5_HAVE_ROS3_VFD */
TESTING("hrb_init_request");
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD is not enabled");
- fflush(stdout);
- return 0;
-#else
for (i = 0; i < ncases; i++) {
C = &cases[i];
- req = H5FD_s3comms_hrb_init_request(C->verb,
- C->resource,
- C->version);
+ req = H5FD_s3comms_hrb_init_request(
+ C->verb,
+ C->resource,
+ C->version);
if (cases[i].ret_null == TRUE) {
FAIL_IF( req != NULL );
- } else {
+ }
+ else {
FAIL_IF( req == NULL );
JSVERIFY( S3COMMS_HRB_MAGIC, req->magic, NULL )
if (C->verb == NULL) {
JSVERIFY_STR( "GET", req->verb, NULL )
- } else {
+ }
+ else {
JSVERIFY_STR( req->verb, C->verb, NULL )
}
JSVERIFY_STR( "HTTP/1.1", req->version, NULL )
@@ -823,7 +822,7 @@ test_hrb_init_request(void)
FAIL_IF( NULL != req ); /* should annull pointer as well as free */
}
- } /* for each testcase */
+ } /* end for each testcase */
PASSED();
return 0;
@@ -832,11 +831,10 @@ error:
(void)H5FD_s3comms_hrb_destroy(&req);
return -1;
-#endif /* H5_HAVE_ROS3_VFD */
-
-} /* test_hrb_init_request */
+} /* end test_hrb_init_request() */
+
/*---------------------------------------------------------------------------
*
* Function: test_hrb_node_set()
@@ -853,7 +851,6 @@ error:
static herr_t
test_hrb_node_set(void)
{
-#ifdef H5_HAVE_ROS3_VFD
/*************************
* test-local structures *
*************************/
@@ -1071,18 +1068,10 @@ test_hrb_node_set(void)
};
unsigned testcases_count = 16;
unsigned test_i = 0;
-
hrb_node_t *list = NULL;
-#endif /* H5_HAVE_ROS3_VFD */
- TESTING("test_hrb_node_t");
+ TESTING("hrb_node_t (test_hrb_node_set)");
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD is not enabled");
- fflush(stdout);
- return 0;
-#else
for (test_i = 0; test_i < testcases_count; test_i++) {
const hrb_node_t *node = NULL;
const testcase *test = &(cases[test_i]);
@@ -1137,21 +1126,22 @@ test_hrb_node_set(void)
FAIL_IF( SUCCEED !=
H5FD_s3comms_hrb_node_set(&list, list->name, NULL) )
}
- }
+ } /* end for each testcase */
PASSED();
return 0;
error:
- while (list != NULL)
+ while (list != NULL) {
(void)H5FD_s3comms_hrb_node_set(&list, list->name, NULL);
+ }
return -1;
-#endif /* H5_HAVE_ROS3_VFD */
-} /* test_hrb_node_t */
+} /* end test_hrb_node_t() */
+
/*---------------------------------------------------------------------------
*
* Function: test_HMAC_SHA256()
@@ -1265,13 +1255,13 @@ test_HMAC_SHA256(void)
dest);
TEST_ERROR;
}
-#else
+#else /* VERBOSE not defined */
/* simple pass/fail test
*/
JSVERIFY( 0,
strncmp(cases[i].exp, dest, HDstrlen(cases[i].exp)),
NULL);
-#endif
+#endif /* VERBOSE */
}
free(dest);
}
@@ -1284,9 +1274,9 @@ error:
return -1;
#endif /* H5_HAVE_ROS3_VFD */
-} /* test_HMAC_SHA256 */
-
+} /* end test_HMAC_SHA256() */
+
/*----------------------------------------------------------------------------
*
* Function: test_nlowercase()
@@ -1307,7 +1297,6 @@ test_nlowercase(void)
* test-local structures *
*************************/
-#ifdef H5_HAVE_ROS3_VFD
struct testcase {
const char *in;
size_t len;
@@ -1338,16 +1327,9 @@ test_nlowercase(void)
char *dest = NULL;
int i = 0;
int n_cases = 3;
-#endif /* H5_HAVE_ROS3_VFD */
TESTING("nlowercase");
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD is not enabled");
- fflush(stdout);
- return 0;
-#else
for (i = 0; i < n_cases; i++) {
dest = (char *)HDmalloc(sizeof(char) * 16);
@@ -1360,7 +1342,7 @@ test_nlowercase(void)
JSVERIFY( 0, strncmp(dest, cases[i].exp, cases[i].len), NULL )
}
free(dest);
- }
+ } /* end for each testcase */
JSVERIFY( FAIL,
H5FD_s3comms_nlowercase(NULL,
@@ -1374,11 +1356,10 @@ test_nlowercase(void)
error:
free(dest);
return -1;
-#endif /* H5_HAVE_ROS3_VFD */
-
-} /* test_nlowercase */
+} /* end test_nlowercase() */
+
/*---------------------------------------------------------------------------
*
* Function: test_parse_url()
@@ -1399,7 +1380,6 @@ test_parse_url(void)
* test-local structures *
*************************/
-#ifdef H5_HAVE_ROS3_VFD
typedef struct {
const char *scheme;
const char *host;
@@ -1540,16 +1520,9 @@ test_parse_url(void)
"non-decimal PORT (01a3)",
},
};
-#endif /* H5_HAVE_ROS3_VFD */
TESTING("url-parsing functionality");
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD is not enabled");
- fflush(stdout);
- return 0;
-#else
/*********
* TESTS *
*********/
@@ -1564,7 +1537,8 @@ test_parse_url(void)
if (cases[i].exp_ret == FAIL) {
/* on FAIL, `purl` should be untouched--remains NULL */
FAIL_UNLESS( purl == NULL )
- } else {
+ }
+ else {
/* on SUCCEED, `purl` should be set */
FAIL_IF( purl == NULL )
@@ -1612,7 +1586,7 @@ test_parse_url(void)
} else {
FAIL_UNLESS( NULL == purl->query )
}
- } /* if parse-url return SUCCEED/FAIL */
+ } /* end if parse-url return SUCCEED/FAIL */
/* per-test cleanup
* well-behaved, even if `purl` is NULL
@@ -1620,7 +1594,7 @@ test_parse_url(void)
FAIL_IF( FAIL == H5FD_s3comms_free_purl(purl) )
purl = NULL;
- } /* for each testcase */
+ } /* end for each testcase */
PASSED();
return 0;
@@ -1632,11 +1606,10 @@ error:
(void)H5FD_s3comms_free_purl(purl);
return -1;
-#endif /* H5_HAVE_ROS3_VFD */
-
-} /* test_parse_url */
+} /* end test_parse_url() */
+
/*---------------------------------------------------------------------------
*
* Function: test_percent_encode_char()
@@ -1662,7 +1635,6 @@ test_percent_encode_char(void)
* test-local structures *
*************************/
-#ifdef H5_HAVE_ROS3_VFD
struct testcase {
const char c;
const char *exp;
@@ -1692,16 +1664,9 @@ test_percent_encode_char(void)
size_t dest_len = 0;
int i = 0;
int n_cases = 5;
-#endif /* H5_HAVE_ROS3_VFD */
TESTING("percent encode characters");
-#ifndef H5_HAVE_ROS3_VFD
- SKIPPED();
- puts(" ROS3 VFD is not enabled");
- fflush(stdout);
- return 0;
-#else
for (i = 0; i < n_cases; i++) {
JSVERIFY( SUCCEED,
H5FD_s3comms_percent_encode_char(
@@ -1726,11 +1691,9 @@ test_percent_encode_char(void)
error:
return -1;
-#endif /* H5_HAVE_ROS3_VFD */
-
-} /* test_percent_encode_char */
-
+} /* end test_percent_encode_char() */
+
/*---------------------------------------------------------------------------
* Function: test_s3r_open()
*
@@ -1798,9 +1761,9 @@ error:
return -1;
#endif /* H5_HAVE_ROS3_VFD */
-} /* test_s3r_get_filesize */
-
+} /* end test_s3r_get_filesize() */
+
/*---------------------------------------------------------------------------
* Function: test_s3r_open()
*
@@ -2039,9 +2002,9 @@ error:
return -1;
#endif /* H5_HAVE_ROS3_VFD */
-} /* test_s3r_open */
-
+} /* end test_s3r_open() */
+
/*---------------------------------------------------------------------------
*
* Function: test_s3r_read()
@@ -2265,7 +2228,7 @@ error:
#undef S3COMMS_TEST_BUFFER_SIZE
#endif /* H5_HAVE_ROS3_VFD */
-} /* test_s3r_read */
+} /* end test_s3r_read() */
/*---------------------------------------------------------------------------
@@ -2404,9 +2367,9 @@ error:
return -1;
#endif /* H5_HAVE_ROS3_VFD */
-} /* test_signing_key */
-
+} /* end test_signing_key() */
+
/*---------------------------------------------------------------------------
*
* Function: test_tostringtosign()
@@ -2476,9 +2439,9 @@ error :
return -1;
#endif /* H5_HAVE_ROS3_VFD */
-} /* test_tostringtosign */
-
+} /* end test_tostringtosign() */
+
/*----------------------------------------------------------------------------
*
* Function: test_trim()
@@ -2563,7 +2526,7 @@ test_trim(void)
}
free(str);
str = NULL;
- }
+ } /* end for each testcase */
JSVERIFY( SUCCEED, H5FD_s3comms_trim(dest, NULL, 3, &dest_len),
"should not fail when trimming a null string" );
@@ -2582,13 +2545,14 @@ test_trim(void)
return 0;
error:
- if (str != NULL)
+ if (str != NULL) {
free(str);
+ }
return -1;
-} /* test_trim */
-
+} /* end test_trim() */
+
/*----------------------------------------------------------------------------
*
* Function: test_uriencode()
@@ -2685,7 +2649,7 @@ test_uriencode(void)
free(dest);
dest = NULL;
- }
+ } /* end for each testcase */
/***************
* ERROR CASES *
@@ -2713,11 +2677,11 @@ error:
}
return -1;
-} /* test_uriencode */
-
+} /* end test_uriencode() */
+
/*-------------------------------------------------------------------------
* Function: main()
*
@@ -2774,7 +2738,8 @@ main(void)
if (bucket_url_env == NULL || bucket_url_env[0] == '\0') {
HDprintf("WARNING: S3 bucket url is not defined in enviornment " \
"variable 'HDF5_ROS3_TEST_BUCKET_URL'!\n");
- } else {
+ }
+ else {
HDstrncpy(s3_test_bucket_url, bucket_url_env, S3_TEST_MAX_URL_SIZE);
s3_test_bucket_defined = TRUE;
}
@@ -2799,12 +2764,12 @@ main(void)
nerrors += test_s3r_get_filesize() < 0 ? 1 : 0;
nerrors += test_s3r_read() < 0 ? 1 : 0;
- if(nerrors) {
+ if (nerrors) {
HDprintf("***** %d S3comms TEST%s FAILED! *****\n",
nerrors,
nerrors > 1 ? "S" : "");
return 1;
- } /* end if */
+ }
HDprintf("All S3comms tests passed.\n");
diff --git a/test/testfiles/err_compat_2 b/test/testfiles/err_compat_2
index 75e8769..467ba4c 100644
--- a/test/testfiles/err_compat_2
+++ b/test/testfiles/err_compat_2
@@ -1 +1 @@
-Test skipped because backward compatbility with v1.6 is NOT configured in
+Test skipped because backward compatibility with v1.6 is NOT configured in
diff --git a/test/testfiles/error_test_2 b/test/testfiles/error_test_2
index 6852f6f..85bc2e7 100644
--- a/test/testfiles/error_test_2
+++ b/test/testfiles/error_test_2
@@ -1 +1 @@
-Test skipped because backward compatbility with v1.6 is configured in
+Test skipped because backward compatibility with v1.6 is configured in
diff --git a/test/testlinks_env.sh.in b/test/testlinks_env.sh.in
index 94e6c7e..3d6b3ce 100644
--- a/test/testlinks_env.sh.in
+++ b/test/testlinks_env.sh.in
@@ -19,15 +19,15 @@ nerrors=0
##############################################################################
##############################################################################
-### T H E T E S T S ###
+### T H E T E S T S ###
##############################################################################
##############################################################################
# test for external links with HDF5_EXT_PREFIX
echo "Testing external link with HDF5_EXT_PREFIX"
-TEST_NAME=links_env # The test name
-TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary
-ENVCMD="env HDF5_EXT_PREFIX=.:tmp" # The environment variable & value
+TEST_NAME=links_env # The test name
+TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary
+ENVCMD="env HDF5_EXT_PREFIX=.:tmp_links_env" # The environment variable & value
#
# Run the test
echo "$ENVCMD $RUNSERIAL $TEST_BIN"
@@ -36,7 +36,7 @@ exitcode=$?
if [ $exitcode -eq 0 ]; then
echo "Test for HDF5_EXT_PREFIX PASSED"
else
- nerrors="`expr $nerrors + 1`"
- echo "***Error encountered for HDF5_EXT_PREFIX test***"
+ nerrors="`expr $nerrors + 1`"
+ echo "***Error encountered for HDF5_EXT_PREFIX test***"
fi
exit $nerrors
diff --git a/test/testvds_env.sh.in b/test/testvds_env.sh.in
index 894e52e..e9a27da 100644
--- a/test/testvds_env.sh.in
+++ b/test/testvds_env.sh.in
@@ -19,7 +19,7 @@ nerrors=0
##############################################################################
##############################################################################
-### T H E T E S T S ###
+### T H E T E S T S ###
##############################################################################
##############################################################################
@@ -27,7 +27,7 @@ nerrors=0
echo "Testing basic virtual dataset I/O via H5Pset_vds_prefix(): all selection with ENV prefix"
TEST_NAME=vds_env # The test name
TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary
-ENVCMD="env HDF5_VDS_PREFIX=\${ORIGIN}/tmp" # Set the environment variable & value
+ENVCMD="env HDF5_VDS_PREFIX=\${ORIGIN}/tmp_vds_env" # Set the environment variable & value
UNENVCMD="unset HDF5_VDS_PREFIX" # Unset the environment variable & value
#
# Run the test
@@ -37,8 +37,8 @@ exitcode=$?
if [ $exitcode -eq 0 ]; then
echo "Test prefix for HDF5_VDS_PREFIX PASSED"
else
- nerrors="`expr $nerrors + 1`"
- echo "***Error encountered for HDF5_VDS_PREFIX test***"
+ nerrors="`expr $nerrors + 1`"
+ echo "***Error encountered for HDF5_VDS_PREFIX test***"
fi
$UNENVCMD
exit $nerrors
diff --git a/test/tfile.c b/test/tfile.c
index 9e17c34..0fc391e 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -1434,6 +1434,9 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1,
VERIFY(oid_list[i], did, "H5Fget_obj_ids");
break;
+ case H5I_MAP:
+ /* TODO: Not supported in native VOL connector yet */
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_DATATYPE:
diff --git a/test/vds.c b/test/vds.c
index 25d7a0e..c98bc12 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -55,7 +55,7 @@ const char *FILENAME[] = {
#define FILENAME_BUF_SIZE 1024
-#define TMPDIR "tmp/"
+#define TMPDIR "tmp_vds/"
/*-------------------------------------------------------------------------
diff --git a/test/vds_env.c b/test/vds_env.c
index b2ca9d0..19b2d96 100644
--- a/test/vds_env.c
+++ b/test/vds_env.c
@@ -34,7 +34,7 @@ const char *FILENAME[] = {
#define FILENAME_BUF_SIZE 1024
-#define TMPDIR "tmp/"
+#define TMPDIR "tmp_vds_env/"
/*-------------------------------------------------------------------------
* Function: test_vds_prefix_second
diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c
index 2340ae0..bfa0bfe 100644
--- a/testpar/t_chunk_alloc.c
+++ b/testpar/t_chunk_alloc.c
@@ -20,23 +20,23 @@
*/
#include "testphdf5.h"
-static int mpi_size, mpi_rank;
+static int mpi_size, mpi_rank;
#define DSET_NAME "ExtendibleArray"
-#define CHUNK_SIZE 1000 /* #elements per chunk */
-#define CHUNK_FACTOR 200 /* default dataset size in terms of chunks */
+#define CHUNK_SIZE 1000 /* #elements per chunk */
+#define CHUNK_FACTOR 200 /* default dataset size in terms of chunks */
#define CLOSE 1
#define NO_CLOSE 0
static MPI_Offset
get_filesize(const char *filename)
{
- int mpierr;
- MPI_File fd;
- MPI_Offset filesize;
+ int mpierr;
+ MPI_File fd;
+ MPI_Offset filesize;
mpierr = MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_RDONLY,
- MPI_INFO_NULL, &fd);
+ MPI_INFO_NULL, &fd);
VRFY((mpierr == MPI_SUCCESS), "");
mpierr = MPI_File_get_size(fd, &filesize);
@@ -85,8 +85,8 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_
long nchunks;
herr_t hrc;
- MPI_Offset filesize, /* actual file size */
- est_filesize; /* estimated file size */
+ MPI_Offset filesize, /* actual file size */
+ est_filesize; /* estimated file size */
/* set up MPI parameters */
MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
@@ -95,34 +95,33 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_
/* Only MAINPROCESS should create the file. Others just wait. */
if (MAINPROCESS){
nchunks=chunk_factor*mpi_size;
- dims[0]=nchunks*CHUNK_SIZE;
- /* Create the data space with unlimited dimensions. */
- dataspace = H5Screate_simple (1, dims, maxdims);
- VRFY((dataspace >= 0), "");
+ dims[0]=nchunks*CHUNK_SIZE;
+ /* Create the data space with unlimited dimensions. */
+ dataspace = H5Screate_simple (1, dims, maxdims);
+ VRFY((dataspace >= 0), "");
- memspace = H5Screate_simple(1, chunk_dims, NULL);
- VRFY((memspace >= 0), "");
+ memspace = H5Screate_simple(1, chunk_dims, NULL);
+ VRFY((memspace >= 0), "");
- /* Create a new file. If file exists its contents will be overwritten. */
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
- H5P_DEFAULT);
- VRFY((file_id >= 0), "H5Fcreate");
+ /* Create a new file. If file exists its contents will be overwritten. */
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ VRFY((file_id >= 0), "H5Fcreate");
- /* Modify dataset creation properties, i.e. enable chunking */
- cparms = H5Pcreate(H5P_DATASET_CREATE);
- VRFY((cparms >= 0), "");
+ /* Modify dataset creation properties, i.e. enable chunking */
+ cparms = H5Pcreate(H5P_DATASET_CREATE);
+ VRFY((cparms >= 0), "");
- hrc = H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY);
- VRFY((hrc >= 0), "");
+ hrc = H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY);
+ VRFY((hrc >= 0), "");
- hrc = H5Pset_chunk(cparms, 1, chunk_dims);
- VRFY((hrc >= 0), "");
+ hrc = H5Pset_chunk(cparms, 1, chunk_dims);
+ VRFY((hrc >= 0), "");
- /* Create a new dataset within the file using cparms creation properties. */
- dataset = H5Dcreate2(file_id, DSET_NAME, H5T_NATIVE_UCHAR, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
- VRFY((dataset >= 0), "");
+ /* Create a new dataset within the file using cparms creation properties. */
+ dataset = H5Dcreate2(file_id, DSET_NAME, H5T_NATIVE_UCHAR, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ VRFY((dataset >= 0), "");
- if(write_pattern == sec_last) {
+ if(write_pattern == sec_last) {
HDmemset(buffer, 100, CHUNK_SIZE);
count[0] = 1;
@@ -138,28 +137,28 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_
VRFY((hrc >= 0), "H5Dwrite");
} /* end if */
- /* Close resources */
- hrc = H5Dclose (dataset);
- VRFY((hrc >= 0), "");
- dataset = -1;
+ /* Close resources */
+ hrc = H5Dclose (dataset);
+ VRFY((hrc >= 0), "");
+ dataset = -1;
- hrc = H5Sclose (dataspace);
- VRFY((hrc >= 0), "");
+ hrc = H5Sclose (dataspace);
+ VRFY((hrc >= 0), "");
- hrc = H5Sclose (memspace);
- VRFY((hrc >= 0), "");
+ hrc = H5Sclose (memspace);
+ VRFY((hrc >= 0), "");
- hrc = H5Pclose (cparms);
- VRFY((hrc >= 0), "");
+ hrc = H5Pclose (cparms);
+ VRFY((hrc >= 0), "");
- hrc = H5Fclose (file_id);
- VRFY((hrc >= 0), "");
- file_id = -1;
+ hrc = H5Fclose (file_id);
+ VRFY((hrc >= 0), "");
+ file_id = -1;
- /* verify file size */
- filesize = get_filesize(filename);
- est_filesize = nchunks * CHUNK_SIZE * sizeof(unsigned char);
- VRFY((filesize >= est_filesize), "file size check");
+ /* verify file size */
+ filesize = get_filesize(filename);
+ est_filesize = nchunks * CHUNK_SIZE * sizeof(unsigned char);
+ VRFY((filesize >= est_filesize), "file size check");
}
@@ -200,8 +199,8 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti
int i;
long nchunks;
/* MPI Gubbins */
- MPI_Offset filesize, /* actual file size */
- est_filesize; /* estimated file size */
+ MPI_Offset filesize, /* actual file size */
+ est_filesize; /* estimated file size */
/* Initialize MPI */
MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
@@ -241,19 +240,19 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti
/* all chunks are written by all the processes in an interleaved way*/
case write_all:
- memset(buffer, mpi_rank+1, CHUNK_SIZE);
- count[0] = 1;
- stride[0] = 1;
- block[0] = chunk_dims[0];
- for (i=0; i<nchunks/mpi_size; i++){
- offset[0] = (i*mpi_size+mpi_rank)*chunk_dims[0];
+ HDmemset(buffer, mpi_rank+1, CHUNK_SIZE);
+ count[0] = 1;
+ stride[0] = 1;
+ block[0] = chunk_dims[0];
+ for (i=0; i<nchunks/mpi_size; i++) {
+ offset[0] = (i*mpi_size+mpi_rank)*chunk_dims[0];
- hrc = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block);
- VRFY((hrc >= 0), "");
+ hrc = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block);
+ VRFY((hrc >= 0), "");
- /* Write the buffer out */
- hrc = H5Dwrite(*dataset, H5T_NATIVE_UCHAR, memspace, dataspace, H5P_DEFAULT, buffer);
- VRFY((hrc >= 0), "H5Dwrite");
+ /* Write the buffer out */
+ hrc = H5Dwrite(*dataset, H5T_NATIVE_UCHAR, memspace, dataspace, H5P_DEFAULT, buffer);
+ VRFY((hrc >= 0), "H5Dwrite");
}
break;
@@ -318,7 +317,7 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti
* interleaved pattern.
*/
static void
-verify_data(const char *filename, int chunk_factor, write_type write_pattern, int vclose,
+verify_data(const char *filename, int chunk_factor, write_type write_pattern, int vclose,
hid_t *file_id, hid_t *dataset)
{
/* HDF5 gubbins */
@@ -372,8 +371,8 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in
stride[0] = 1;
block[0] = chunk_dims[0];
for (i=0; i<nchunks; i++){
- /* reset buffer values */
- memset(buffer, -1, CHUNK_SIZE);
+ /* reset buffer values */
+ HDmemset(buffer, -1, CHUNK_SIZE);
offset[0] = i*chunk_dims[0];
@@ -385,22 +384,22 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in
VRFY((hrc >= 0), "H5Dread");
/* set expected value according the write pattern */
- switch (write_pattern) {
- case all:
- value = i%mpi_size + 1;
- break;
- case none:
- value = 0;
- break;
- case sec_last:
- if (i==nchunks-2)
- value = 100;
- else
- value = 0;
+ switch (write_pattern) {
+ case all:
+ value = i%mpi_size + 1;
+ break;
+ case none:
+ value = 0;
+ break;
+ case sec_last:
+ if (i==nchunks-2)
+ value = 100;
+ else
+ value = 0;
break;
default:
HDassert(0);
- }
+ }
/* verify content of the chunk */
for (index_l = 0; index_l < CHUNK_SIZE; index_l++)
@@ -408,10 +407,10 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in
}
hrc = H5Sclose (dataspace);
- VRFY((hrc >= 0), "");
+ VRFY((hrc >= 0), "");
- hrc = H5Sclose (memspace);
- VRFY((hrc >= 0), "");
+ hrc = H5Sclose (memspace);
+ VRFY((hrc >= 0), "");
/* Can close some plists */
hrc = H5Pclose(access_plist);
@@ -469,7 +468,7 @@ test_chunk_alloc(void)
filename = (const char*)GetTestParameters();
if (VERBOSE_MED)
- printf("Extend Chunked allocation test on file %s\n", filename);
+ HDprintf("Extend Chunked allocation test on file %s\n", filename);
/* Case 1 */
/* Create chunked dataset without writing anything.*/
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index e1ccbed..b89c790 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -29,7 +29,7 @@ int chunkdim1;
int nerrors = 0; /* errors count */
int ndatasets = 300; /* number of datasets to create*/
int ngroups = 512; /* number of groups to create in root
- * group. */
+ * group. */
int facc_type = FACC_MPIO; /*Test file access type */
int dxfer_coll_type = DXFER_COLLECTIVE_IO;
@@ -79,15 +79,15 @@ void pause_proc(void)
MPI_Get_processor_name(mpi_name, &mpi_namelen);
if (MAINPROCESS)
- while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop){
- if (!loops++){
- printf("Proc %d (%*s, %d): to debug, attach %d\n",
- mpi_rank, mpi_namelen, mpi_name, pid, pid);
- }
- printf("waiting(%ds) for file %s ...\n", time_int, greenlight);
- fflush(stdout);
+ while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop){
+ if (!loops++){
+ HDprintf("Proc %d (%*s, %d): to debug, attach %d\n",
+ mpi_rank, mpi_namelen, mpi_name, pid, pid);
+ }
+ HDprintf("waiting(%ds) for file %s ...\n", time_int, greenlight);
+ HDfflush(stdout);
HDsleep(time_int);
- }
+ }
MPI_Barrier(MPI_COMM_WORLD);
}
@@ -108,18 +108,18 @@ int MPI_Init(int *argc, char ***argv)
static void
usage(void)
{
- printf(" [-r] [-w] [-m<n_datasets>] [-n<n_groups>] "
- "[-o] [-f <prefix>] [-d <dim0> <dim1>]\n");
- printf("\t-m<n_datasets>"
- "\tset number of datasets for the multiple dataset test\n");
- printf("\t-n<n_groups>"
- "\tset number of groups for the multiple group test\n");
- printf("\t-f <prefix>\tfilename prefix\n");
- printf("\t-2\t\tuse Split-file together with MPIO\n");
- printf("\t-d <factor0> <factor1>\tdataset dimensions factors. Defaults (%d,%d)\n",
- ROW_FACTOR, COL_FACTOR);
- printf("\t-c <dim0> <dim1>\tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n");
- printf("\n");
+ HDprintf(" [-r] [-w] [-m<n_datasets>] [-n<n_groups>] "
+ "[-o] [-f <prefix>] [-d <dim0> <dim1>]\n");
+ HDprintf("\t-m<n_datasets>"
+ "\tset number of datasets for the multiple dataset test\n");
+ HDprintf("\t-n<n_groups>"
+ "\tset number of groups for the multiple group test\n");
+ HDprintf("\t-f <prefix>\tfilename prefix\n");
+ HDprintf("\t-2\t\tuse Split-file together with MPIO\n");
+ HDprintf("\t-d <factor0> <factor1>\tdataset dimensions factors. Defaults (%d,%d)\n",
+ ROW_FACTOR, COL_FACTOR);
+ HDprintf("\t-c <dim0> <dim1>\tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n");
+ HDprintf("\n");
}
@@ -140,44 +140,44 @@ parse_options(int argc, char **argv)
chunkdim1 = (dim1+9)/10;
while (--argc){
- if (**(++argv) != '-'){
- break;
- }else{
- switch(*(*argv+1)){
- case 'm': ndatasets = atoi((*argv+1)+1);
- if (ndatasets < 0){
+ if (**(++argv) != '-'){
+ break;
+ }else{
+ switch(*(*argv+1)){
+ case 'm': ndatasets = atoi((*argv+1)+1);
+ if (ndatasets < 0){
nerrors++;
return(1);
- }
- break;
+ }
+ break;
case 'n': ngroups = atoi((*argv+1)+1);
- if (ngroups < 0){
- nerrors++;
- return(1);
- }
- break;
- case 'f': if (--argc < 1) {
+ if (ngroups < 0){
nerrors++;
return(1);
- }
- if (**(++argv) == '-') {
+ }
+ break;
+ case 'f': if (--argc < 1) {
nerrors++;
return(1);
- }
- paraprefix = *argv;
- break;
- case 'i': /* Collective MPI-IO access with independent IO */
+ }
+ if (**(++argv) == '-') {
+ nerrors++;
+ return(1);
+ }
+ paraprefix = *argv;
+ break;
+ case 'i': /* Collective MPI-IO access with independent IO */
dxfer_coll_type = DXFER_INDEPENDENT_IO;
break;
- case '2': /* Use the split-file driver with MPIO access */
+ case '2': /* Use the split-file driver with MPIO access */
/* Can use $HDF5_METAPREFIX to define the */
/* meta-file-prefix. */
facc_type = FACC_MPIO | FACC_SPLIT;
break;
- case 'd': /* dimensizes */
+ case 'd': /* dimensizes */
if (--argc < 2){
- nerrors++;
- return(1);
+ nerrors++;
+ return(1);
}
dim0 = atoi(*(++argv))*mpi_size;
argc--;
@@ -186,61 +186,61 @@ parse_options(int argc, char **argv)
chunkdim0 = (dim0+9)/10;
chunkdim1 = (dim1+9)/10;
break;
- case 'c': /* chunk dimensions */
+ case 'c': /* chunk dimensions */
if (--argc < 2){
- nerrors++;
- return(1);
+ nerrors++;
+ return(1);
}
chunkdim0 = atoi(*(++argv));
argc--;
chunkdim1 = atoi(*(++argv));
break;
- case 'h': /* print help message--return with nerrors set */
- return(1);
- default: printf("Illegal option(%s)\n", *argv);
- nerrors++;
+ case 'h': /* print help message--return with nerrors set */
return(1);
+ default: HDprintf("Illegal option(%s)\n", *argv);
+ nerrors++;
+ return(1);
+ }
}
- }
} /*while*/
/* check validity of dimension and chunk sizes */
if (dim0 <= 0 || dim1 <= 0){
- printf("Illegal dim sizes (%d, %d)\n", dim0, dim1);
- nerrors++;
- return(1);
+ HDprintf("Illegal dim sizes (%d, %d)\n", dim0, dim1);
+ nerrors++;
+ return(1);
}
if (chunkdim0 <= 0 || chunkdim1 <= 0){
- printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1);
- nerrors++;
- return(1);
+ HDprintf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1);
+ nerrors++;
+ return(1);
}
/* Make sure datasets can be divided into equal portions by the processes */
if ((dim0 % mpi_size) || (dim1 % mpi_size)){
- if (MAINPROCESS)
- printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n",
- dim0, dim1, mpi_size);
- nerrors++;
- return(1);
+ if (MAINPROCESS)
+ HDprintf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n",
+ dim0, dim1, mpi_size);
+ nerrors++;
+ return(1);
}
/* compose the test filenames */
{
- int i, n;
+ int i, n;
- n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */
+ n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */
- for (i=0; i < n; i++)
- if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i]))
- == NULL){
- printf("h5_fixname failed\n");
- nerrors++;
- return(1);
- }
- printf("Test filenames are:\n");
- for (i=0; i < n; i++)
- printf(" %s\n", filenames[i]);
+ for (i=0; i < n; i++)
+ if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i]))
+ == NULL){
+ HDprintf("h5_fixname failed\n");
+ nerrors++;
+ return(1);
+ }
+ HDprintf("Test filenames are:\n");
+ for (i=0; i < n; i++)
+ HDprintf(" %s\n", filenames[i]);
}
return(0);
@@ -264,36 +264,36 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type)
VRFY((ret_pl >= 0), "H5P_FILE_ACCESS");
if (l_facc_type == FACC_DEFAULT)
- return (ret_pl);
+ return (ret_pl);
if (l_facc_type == FACC_MPIO){
- /* set Parallel access with communicator */
- ret = H5Pset_fapl_mpio(ret_pl, comm, info);
- VRFY((ret >= 0), "");
+ /* set Parallel access with communicator */
+ ret = H5Pset_fapl_mpio(ret_pl, comm, info);
+ VRFY((ret >= 0), "");
ret = H5Pset_all_coll_metadata_ops(ret_pl, TRUE);
- VRFY((ret >= 0), "");
+ VRFY((ret >= 0), "");
ret = H5Pset_coll_metadata_write(ret_pl, TRUE);
- VRFY((ret >= 0), "");
- return(ret_pl);
+ VRFY((ret >= 0), "");
+ return(ret_pl);
}
if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){
- hid_t mpio_pl;
-
- mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((mpio_pl >= 0), "");
- /* set Parallel access with communicator */
- ret = H5Pset_fapl_mpio(mpio_pl, comm, info);
- VRFY((ret >= 0), "");
-
- /* setup file access template */
- ret_pl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((ret_pl >= 0), "");
- /* set Parallel access with communicator */
- ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl);
- VRFY((ret >= 0), "H5Pset_fapl_split succeeded");
- H5Pclose(mpio_pl);
- return(ret_pl);
+ hid_t mpio_pl;
+
+ mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
+ VRFY((mpio_pl >= 0), "");
+ /* set Parallel access with communicator */
+ ret = H5Pset_fapl_mpio(mpio_pl, comm, info);
+ VRFY((ret >= 0), "");
+
+ /* setup file access template */
+ ret_pl = H5Pcreate (H5P_FILE_ACCESS);
+ VRFY((ret_pl >= 0), "");
+ /* set Parallel access with communicator */
+ ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl);
+ VRFY((ret >= 0), "H5Pset_fapl_split succeeded");
+ H5Pclose(mpio_pl);
+ return(ret_pl);
}
/* unknown file access types */
@@ -323,18 +323,18 @@ int main(int argc, char **argv)
dim1 = COL_FACTOR*mpi_size;
if (MAINPROCESS){
- printf("===================================\n");
- printf("PHDF5 TESTS START\n");
- printf("===================================\n");
+ HDprintf("===================================\n");
+ HDprintf("PHDF5 TESTS START\n");
+ HDprintf("===================================\n");
}
/* Attempt to turn off atexit post processing so that in case errors
- * happen during the test and the process is aborted, it will not get
- * hang in the atexit post processing in which it may try to make MPI
- * calls. By then, MPI calls may not work.
- */
+ * happen during the test and the process is aborted, it will not get
+ * hang in the atexit post processing in which it may try to make MPI
+ * calls. By then, MPI calls may not work.
+ */
if (H5dont_atexit() < 0){
- printf("Failed to turn off atexit processing. Continue.\n");
+ HDprintf("Failed to turn off atexit processing. Continue.\n");
};
H5open();
h5_show_hostname();
@@ -344,10 +344,10 @@ int main(int argc, char **argv)
/* Tests are generally arranged from least to most complexity... */
AddTest("mpiodup", test_fapl_mpio_dup, NULL,
- "fapl_mpio duplicate", NULL);
+ "fapl_mpio duplicate", NULL);
AddTest("split", test_split_comm_access, NULL,
- "dataset using split communicators", PARATESTFILE);
+ "dataset using split communicators", PARATESTFILE);
#ifdef PB_OUT /* temporary: disable page buffering when parallel */
AddTest("page_buffer", test_page_buffer_access, NULL,
@@ -355,57 +355,57 @@ int main(int argc, char **argv)
#endif
AddTest("props", test_file_properties, NULL,
- "Coll Metadata file property settings", PARATESTFILE);
+ "Coll Metadata file property settings", PARATESTFILE);
AddTest("idsetw", dataset_writeInd, NULL,
- "dataset independent write", PARATESTFILE);
+ "dataset independent write", PARATESTFILE);
AddTest("idsetr", dataset_readInd, NULL,
- "dataset independent read", PARATESTFILE);
+ "dataset independent read", PARATESTFILE);
AddTest("cdsetw", dataset_writeAll, NULL,
- "dataset collective write", PARATESTFILE);
+ "dataset collective write", PARATESTFILE);
AddTest("cdsetr", dataset_readAll, NULL,
- "dataset collective read", PARATESTFILE);
+ "dataset collective read", PARATESTFILE);
AddTest("eidsetw", extend_writeInd, NULL,
- "extendible dataset independent write", PARATESTFILE);
+ "extendible dataset independent write", PARATESTFILE);
AddTest("eidsetr", extend_readInd, NULL,
- "extendible dataset independent read", PARATESTFILE);
+ "extendible dataset independent read", PARATESTFILE);
AddTest("ecdsetw", extend_writeAll, NULL,
- "extendible dataset collective write", PARATESTFILE);
+ "extendible dataset collective write", PARATESTFILE);
AddTest("ecdsetr", extend_readAll, NULL,
- "extendible dataset collective read", PARATESTFILE);
+ "extendible dataset collective read", PARATESTFILE);
AddTest("eidsetw2", extend_writeInd2, NULL,
- "extendible dataset independent write #2", PARATESTFILE);
+ "extendible dataset independent write #2", PARATESTFILE);
AddTest("selnone", none_selection_chunk, NULL,
"chunked dataset with none-selection", PARATESTFILE);
AddTest("calloc", test_chunk_alloc, NULL,
"parallel extend Chunked allocation on serial file", PARATESTFILE);
AddTest("fltread", test_filter_read, NULL,
- "parallel read of dataset written serially with filters", PARATESTFILE);
+ "parallel read of dataset written serially with filters", PARATESTFILE);
#ifdef H5_HAVE_FILTER_DEFLATE
AddTest("cmpdsetr", compress_readAll, NULL,
- "compressed dataset collective read", PARATESTFILE);
+ "compressed dataset collective read", PARATESTFILE);
#endif /* H5_HAVE_FILTER_DEFLATE */
AddTest("zerodsetr", zero_dim_dset, NULL,
- "zero dim dset", PARATESTFILE);
+ "zero dim dset", PARATESTFILE);
ndsets_params.name = PARATESTFILE;
ndsets_params.count = ndatasets;
AddTest("ndsetw", multiple_dset_write, NULL,
- "multiple datasets write", &ndsets_params);
+ "multiple datasets write", &ndsets_params);
ngroups_params.name = PARATESTFILE;
ngroups_params.count = ngroups;
AddTest("ngrpw", multiple_group_write, NULL,
- "multiple groups write", &ngroups_params);
+ "multiple groups write", &ngroups_params);
AddTest("ngrpr", multiple_group_read, NULL,
- "multiple groups read", &ngroups_params);
+ "multiple groups read", &ngroups_params);
AddTest("compact", compact_dataset, NULL,
- "compact dataset test", PARATESTFILE);
+ "compact dataset test", PARATESTFILE);
collngroups_params.name = PARATESTFILE;
collngroups_params.count = ngroups;
@@ -417,79 +417,79 @@ int main(int argc, char **argv)
AddTest("bigdset", big_dataset, NULL,
"big dataset test", PARATESTFILE);
#else
- printf("big dataset test will be skipped on Windows (JIRA HDDFV-8064)\n");
+ HDprintf("big dataset test will be skipped on Windows (JIRA HDDFV-8064)\n");
#endif
AddTest("fill", dataset_fillvalue, NULL,
- "dataset fill value", PARATESTFILE);
+ "dataset fill value", PARATESTFILE);
AddTest("cchunk1",
- coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE);
+ coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE);
AddTest("cchunk2",
- coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE);
+ coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE);
AddTest("cchunk3",
- coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE);
+ coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE);
AddTest("cchunk4",
- coll_chunk4,NULL, "collective chunk io with partial non-selection ",PARATESTFILE);
+ coll_chunk4,NULL, "collective chunk io with partial non-selection ",PARATESTFILE);
if((mpi_size < 3)&& MAINPROCESS ) {
- printf("Collective chunk IO optimization APIs ");
- printf("needs at least 3 processes to participate\n");
- printf("Collective chunk IO API tests will be skipped \n");
+ HDprintf("Collective chunk IO optimization APIs ");
+ HDprintf("needs at least 3 processes to participate\n");
+ HDprintf("Collective chunk IO API tests will be skipped \n");
}
AddTest((mpi_size <3)? "-cchunk5":"cchunk5" ,
- coll_chunk5,NULL,
- "linked chunk collective IO without optimization",PARATESTFILE);
+ coll_chunk5,NULL,
+ "linked chunk collective IO without optimization",PARATESTFILE);
AddTest((mpi_size < 3)? "-cchunk6" : "cchunk6",
- coll_chunk6,NULL,
- "multi-chunk collective IO with direct request",PARATESTFILE);
+ coll_chunk6,NULL,
+ "multi-chunk collective IO with direct request",PARATESTFILE);
AddTest((mpi_size < 3)? "-cchunk7" : "cchunk7",
- coll_chunk7,NULL,
- "linked chunk collective IO with optimization",PARATESTFILE);
+ coll_chunk7,NULL,
+ "linked chunk collective IO with optimization",PARATESTFILE);
AddTest((mpi_size < 3)? "-cchunk8" : "cchunk8",
- coll_chunk8,NULL,
- "linked chunk collective IO transferring to multi-chunk",PARATESTFILE);
+ coll_chunk8,NULL,
+ "linked chunk collective IO transferring to multi-chunk",PARATESTFILE);
AddTest((mpi_size < 3)? "-cchunk9" : "cchunk9",
- coll_chunk9,NULL,
- "multiple chunk collective IO with optimization",PARATESTFILE);
+ coll_chunk9,NULL,
+ "multiple chunk collective IO with optimization",PARATESTFILE);
AddTest((mpi_size < 3)? "-cchunk10" : "cchunk10",
- coll_chunk10,NULL,
- "multiple chunk collective IO transferring to independent IO",PARATESTFILE);
+ coll_chunk10,NULL,
+ "multiple chunk collective IO transferring to independent IO",PARATESTFILE);
-/* irregular collective IO tests*/
+ /* irregular collective IO tests*/
AddTest("ccontw",
- coll_irregular_cont_write,NULL,
- "collective irregular contiguous write",PARATESTFILE);
+ coll_irregular_cont_write,NULL,
+ "collective irregular contiguous write",PARATESTFILE);
AddTest("ccontr",
- coll_irregular_cont_read,NULL,
- "collective irregular contiguous read",PARATESTFILE);
+ coll_irregular_cont_read,NULL,
+ "collective irregular contiguous read",PARATESTFILE);
AddTest("cschunkw",
- coll_irregular_simple_chunk_write,NULL,
- "collective irregular simple chunk write",PARATESTFILE);
+ coll_irregular_simple_chunk_write,NULL,
+ "collective irregular simple chunk write",PARATESTFILE);
AddTest("cschunkr",
- coll_irregular_simple_chunk_read,NULL,
- "collective irregular simple chunk read",PARATESTFILE);
+ coll_irregular_simple_chunk_read,NULL,
+ "collective irregular simple chunk read",PARATESTFILE);
AddTest("ccchunkw",
- coll_irregular_complex_chunk_write,NULL,
- "collective irregular complex chunk write",PARATESTFILE);
+ coll_irregular_complex_chunk_write,NULL,
+ "collective irregular complex chunk write",PARATESTFILE);
AddTest("ccchunkr",
- coll_irregular_complex_chunk_read,NULL,
- "collective irregular complex chunk read",PARATESTFILE);
+ coll_irregular_complex_chunk_read,NULL,
+ "collective irregular complex chunk read",PARATESTFILE);
AddTest("null", null_dataset, NULL,
- "null dataset test", PARATESTFILE);
+ "null dataset test", PARATESTFILE);
io_mode_confusion_params.name = PARATESTFILE;
io_mode_confusion_params.count = 0; /* value not used */
AddTest("I/Omodeconf", io_mode_confusion, NULL,
- "I/O mode confusion test -- hangs quickly on failure",
+ "I/O mode confusion test -- hangs quickly on failure",
&io_mode_confusion_params);
if((mpi_size < 3) && MAINPROCESS) {
- printf("rr_obj_hdr_flush_confusion test needs at least 3 processes.\n");
- printf("rr_obj_hdr_flush_confusion test will be skipped \n");
+ HDprintf("rr_obj_hdr_flush_confusion test needs at least 3 processes.\n");
+ HDprintf("rr_obj_hdr_flush_confusion test will be skipped \n");
}
if(mpi_size > 2) {
rr_obj_flush_confusion_params.name = PARATESTFILE;
@@ -523,21 +523,21 @@ int main(int argc, char **argv)
PARATESTFILE);
AddTest("edpl", test_plist_ed, NULL,
- "encode/decode Property Lists", NULL);
+ "encode/decode Property Lists", NULL);
if((mpi_size < 2) && MAINPROCESS) {
- printf("File Image Ops daisy chain test needs at least 2 processes.\n");
- printf("File Image Ops daisy chain test will be skipped \n");
+ HDprintf("File Image Ops daisy chain test needs at least 2 processes.\n");
+ HDprintf("File Image Ops daisy chain test will be skipped \n");
}
AddTest((mpi_size < 2)? "-fiodc" : "fiodc", file_image_daisy_chain_test, NULL,
"file image ops daisy chain", NULL);
if((mpi_size < 2)&& MAINPROCESS ) {
- printf("Atomicity tests need at least 2 processes to participate\n");
- printf("8 is more recommended.. Atomicity tests will be skipped \n");
+ HDprintf("Atomicity tests need at least 2 processes to participate\n");
+ HDprintf("8 is more recommended.. Atomicity tests will be skipped \n");
}
else if (facc_type != FACC_MPIO && MAINPROCESS) {
- printf("Atomicity tests will not work with a non MPIO VFD\n");
+ HDprintf("Atomicity tests will not work with a non MPIO VFD\n");
}
else if(mpi_size >= 2 && facc_type == FACC_MPIO){
AddTest("atomicity", dataset_atomicity, NULL,
@@ -545,7 +545,7 @@ int main(int argc, char **argv)
}
AddTest("denseattr", test_dense_attr, NULL,
- "Store Dense Attributes", PARATESTFILE);
+ "Store Dense Attributes", PARATESTFILE);
AddTest("noselcollmdread", test_partial_no_selection_coll_md_read, NULL,
"Collective Metadata read with some ranks having no selection", PARATESTFILE);
@@ -565,9 +565,9 @@ int main(int argc, char **argv)
TestParseCmdLine(argc, argv);
if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS){
- printf("===================================\n"
- " Using Independent I/O with file set view to replace collective I/O \n"
- "===================================\n");
+ HDprintf("===================================\n"
+ " Using Independent I/O with file set view to replace collective I/O \n"
+ "===================================\n");
}
@@ -575,8 +575,8 @@ int main(int argc, char **argv)
PerformTests();
/* make sure all processes are finished before final report, cleanup
- * and exit.
- */
+ * and exit.
+ */
MPI_Barrier(MPI_COMM_WORLD);
/* Display test summary, if requested */
@@ -592,16 +592,16 @@ int main(int argc, char **argv)
{
int temp;
MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
- nerrors=temp;
+ nerrors=temp;
}
if (MAINPROCESS){ /* only process 0 reports */
- printf("===================================\n");
- if (nerrors)
- printf("***PHDF5 tests detected %d errors***\n", nerrors);
- else
- printf("PHDF5 tests finished with no errors\n");
- printf("===================================\n");
+ HDprintf("===================================\n");
+ if (nerrors)
+ HDprintf("***PHDF5 tests detected %d errors***\n", nerrors);
+ else
+ HDprintf("PHDF5 tests finished with no errors\n");
+ HDprintf("===================================\n");
}
/* close HDF5 library */
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 17e3f18..5921609 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -1140,6 +1140,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
h5tools_str_append(str, H5_TOOLS_DATATYPE);
break;
+ case H5O_TYPE_MAP:
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index a3cd7d9..e140fff 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -763,6 +763,7 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
} /* end if */
break;
+ case H5O_TYPE_MAP:
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 5519437..78240db 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -914,6 +914,7 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo,
printf(" %-10s %s", "datatype", path);
break;
+ case H5O_TYPE_MAP:
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index 347c189..5df701a 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -24,6 +24,7 @@ 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 */
@@ -31,7 +32,9 @@ static H5FD_ros3_fapl_t ros3_fa = {
"", /* 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 */
@@ -40,6 +43,7 @@ static H5FD_hdfs_fapl_t hdfs_fa = {
"", /* 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"
diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c
index 5c47abd..821d2c7 100644
--- a/tools/src/h5dump/h5dump_ddl.c
+++ b/tools/src/h5dump/h5dump_ddl.c
@@ -393,6 +393,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
}
break;
+ case H5O_TYPE_MAP:
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
@@ -1404,6 +1405,7 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al
handle_datatypes(handle_data->fid, path, NULL, 0, NULL);
break;
+ case H5O_TYPE_MAP:
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
@@ -2143,6 +2145,7 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
handle_datatypes(group, linkname, NULL, 0, objname);
break;
+ case H5O_TYPE_MAP:
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index 2fa9fd0..fc56433 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -346,6 +346,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
}
break;
+ case H5O_TYPE_MAP:
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index 2364f23..7e2a431 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -2612,6 +2612,7 @@ main(int argc, const char *argv[])
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 */
@@ -2620,7 +2621,9 @@ main(int argc, const char *argv[])
"", /* 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 */
@@ -2630,6 +2633,7 @@ main(int argc, const char *argv[])
"", /* user name */
2048, /* stream buffer size */
};
+#endif /* H5_HAVE_LIBHDFS */
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index 5f0452c..75d325a 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -120,6 +120,7 @@ typedef struct iter_t {
static const char *drivername = "";
+#ifdef H5_HAVE_ROS3_VFD
/* default "anonymous" s3 configuration
*/
static H5FD_ros3_fapl_t ros3_fa = {
@@ -129,7 +130,9 @@ static H5FD_ros3_fapl_t ros3_fa = {
"", /* 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 = {
@@ -140,6 +143,7 @@ static H5FD_hdfs_fapl_t hdfs_fa = {
"", /* user name */
2048, /* stream buffer size */
};
+#endif /* H5_HAVE_LIBHDFS */
static int display_all = TRUE;
@@ -544,8 +548,8 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats() failed");
/* Get storage info */
- if((storage = H5Dget_storage_size(did)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_storage_size() failed");
+ /* Failure 0 indistinguishable from no-data-stored 0 */
+ storage = H5Dget_storage_size(did);
/* Gather layout statistics */
if((dcpl = H5Dget_create_plist(did)) < 0)
@@ -758,6 +762,7 @@ obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "datatype_stats failed");
break;
+ case H5O_TYPE_MAP:
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c
index 1d52471..34b8a2d 100644
--- a/tools/test/perform/perf.c
+++ b/tools/test/perform/perf.c
@@ -64,13 +64,13 @@
#define H5FATAL 1
#define VRFY(val, mesg, fatal) do { \
if (!val) { \
- printf("Proc %d: ", mynod); \
+ printf("Proc %d: ", mynod); \
printf("*** Assertion failed (%s) at line %4d in %s\n", \
- mesg, (int)__LINE__, __FILE__); \
- if (fatal){ \
- fflush(stdout); \
- goto die_jar_jar_die; \
- } \
+ mesg, (int)__LINE__, __FILE__); \
+ if (fatal){ \
+ fflush(stdout); \
+ goto die_jar_jar_die; \
+ } \
} \
} while(0)
#define RANK 1
diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c
index ed15fa5..aefd2b3 100644
--- a/tools/test/perform/sio_engine.c
+++ b/tools/test/perform/sio_engine.c
@@ -264,7 +264,7 @@ done:
case HDF5:
if (fd.h5fd != -1)
hrc = do_fclose(iot, &fd);
- break;
+ break;
default:
/* unknown request */
HDassert(0 && "Unknown IO type");
@@ -685,7 +685,7 @@ dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer)
VRFY((hrc >= 0), "H5Dwrite");
break;
-
+
default:
/* unknown request */
HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
@@ -863,7 +863,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer)
GOTOERROR(FAIL);
}
break;
-
+
default:
/* unknown request */
HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
@@ -987,7 +987,7 @@ dset_read(int local_dim, file_descr *fd, parameters *parms, void *buffer,
h5dset_space_id, h5dxpl, buffer);
VRFY((hrc >= 0), "H5Dread");
break;
-
+
default:
/* unknown request */
HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
@@ -1114,7 +1114,7 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
GOTOERROR(FAIL);
}
break;
-
+
default:
/* unknown request */
HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)param->io_type);
@@ -1242,7 +1242,7 @@ do_fclose(iotype iot, file_descr *fd /*out*/)
fd->h5fd = -1;
break;
-
+
default:
/* unknown request */
HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c
index e77b99e..731be47 100644
--- a/tools/test/perform/sio_perf.c
+++ b/tools/test/perform/sio_perf.c
@@ -98,7 +98,7 @@ static const char *progname = "h5perf_serial";
* It seems that only the options that accept additional information
* such as dataset size (-e) require the colon next to it.
*/
-static const char *s_opts = "a:A:B:b:c:Cd:D:e:F:G:ghi:Imno:p:P:r:stT:v:wx:X:";
+static const char *s_opts = "a:A:B:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:v:wx:X:";
static struct long_options l_opts[] = {
{ "align", require_arg, 'a' },
{ "alig", require_arg, 'a' },