Feature
@@ -59,7 +59,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix)
|
Create a file
|
-C Fortran C++ Java Python
+ | C Fortran C++ Java Python
|
|
@@ -67,7 +67,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix)
Create a dataset
|
-C Fortran C++ Java Python
+ | C Fortran C++ Java Python
|
|
@@ -75,7 +75,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix)
Read and write to a dataset
|
-C Fortran C++ Java Python
+ | C Fortran C++ Java Python
|
|
@@ -83,7 +83,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix)
Create an attribute
|
-C Fortran C++ Java Python
+ | C Fortran C++ Java Python
|
|
@@ -91,7 +91,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix)
Create a group
|
-C Fortran C++ Java Python
+ | C Fortran C++ Java Python
|
|
@@ -99,7 +99,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix)
Create groups in a file using absolute and relative paths
|
-C Fortran C++ Java Python
+ | C Fortran C++ Java Python
|
|
@@ -107,7 +107,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix)
Create datasets in a group
|
-C Fortran C++ Java Python
+ | C Fortran C++ Java Python
|
|
@@ -115,7 +115,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix)
Create a file and dataset and select/read a subset from the dataset
|
-C Fortran C++ Java Python
+ | C Fortran C++ Java Python
|
Also see examples to Write by row (and column) below.
|
@@ -123,7 +123,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix)
Create an extendible (unlimited dimension) dataset
|
-C Fortran C++ Java Python
+ | C Fortran C++ Java Python
|
Also see examples to Extend by row (and column) below
|
@@ -131,7 +131,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix)
Create a chunked and compressed dataset
|
-C Fortran C++ Java Python
+ | C Fortran C++ Java Python
|
|
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
deleted file mode 100644
index 43d7af223a4..00000000000
--- a/examples/CMakeLists.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-cmake_minimum_required (VERSION 3.18)
-project (HDF5_EXAMPLES C)
-
-#-----------------------------------------------------------------------------
-# Define Sources
-#-----------------------------------------------------------------------------
-set (examples
- h5_crtdat
- h5_rdwt
- h5_crtatt
- h5_crtgrp
- h5_crtgrpar
- h5_crtgrpd
- h5_cmprss
- h5_extend
- h5_subset
- h5_write
- h5_read
- h5_extend_write
- h5_chunk_read
- h5_compound
- h5_group
- h5_select
- h5_attribute
- h5_mount
- h5_ref_extern
- h5_ref_compat
- h5_reference_deprec
- h5_drivers
- h5_ref2reg_deprec
- h5_extlink
- h5_elink_unix2win
- h5_shared_mesg
- h5_debug_trace
-)
-
-foreach (example ${examples})
- add_executable (${example} ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c)
- target_include_directories (${example} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>")
- if (NOT BUILD_SHARED_LIBS)
- TARGET_C_PROPERTIES (${example} STATIC)
- target_link_libraries (${example} PRIVATE ${HDF5_LIB_TARGET})
- else ()
- TARGET_C_PROPERTIES (${example} SHARED)
- target_link_libraries (${example} PRIVATE ${HDF5_LIBSH_TARGET})
- endif ()
- set_target_properties (${example} PROPERTIES FOLDER examples)
-
- #-----------------------------------------------------------------------------
- # Add Target to clang-format
- #-----------------------------------------------------------------------------
- if (HDF5_ENABLE_FORMATTERS)
- clang_format (HDF5_EXAMPLES_${example}_FORMAT ${example})
- endif ()
-endforeach ()
-
-if (BUILD_TESTING AND HDF5_TEST_EXAMPLES)
- include (CMakeTests.cmake)
-endif ()
diff --git a/fortran/Makefile.am b/fortran/Makefile.am
index c17245ddba6..631d9edc888 100644
--- a/fortran/Makefile.am
+++ b/fortran/Makefile.am
@@ -32,7 +32,7 @@ else
TESTSERIAL_DIR=
endif
-# Subdirectories in build order, not including examples directory
+# Subdirectories in build order
## Only recurse into subdirectories if HDF5 is configured to use Fortran.
if BUILD_FORTRAN_CONDITIONAL
SUBDIRS=src $(TESTSERIAL_DIR) $(TESTPARALLEL_DIR)
@@ -40,22 +40,6 @@ if BUILD_FORTRAN_CONDITIONAL
endif
# All directories that have Makefiles
-DIST_SUBDIRS=src test testpar examples
-
-# Install examples
-install-examples uninstall-examples:
- @(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
-
-installcheck-local:
- @(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
-
-# Clean examples when check-clean is invoked
-check-clean ::
- @$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
- @for d in X $(SUBDIRS) examples; do \
- if test $$d != X && test $$d != .; then \
- (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
- fi; \
- done
+DIST_SUBDIRS=src test testpar
include $(top_srcdir)/config/conclude.am
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt
deleted file mode 100644
index ff3f299f583..00000000000
--- a/fortran/examples/CMakeLists.txt
+++ /dev/null
@@ -1,182 +0,0 @@
-cmake_minimum_required (VERSION 3.18)
-project (HDF5_F90_EXAMPLES C Fortran)
-# --------------------------------------------------------------------
-# Notes: When creating examples they should be prefixed
-# with "f90_ex_". This allows for easier filtering of the examples.
-# --------------------------------------------------------------------
-
-#-----------------------------------------------------------------------------
-# Define Sources
-#-----------------------------------------------------------------------------
-set (examples
- h5_cmprss
- h5_crtdat
- h5_rdwt
- h5_crtatt
- h5_crtgrp
- h5_crtgrpar
- h5_crtgrpd
- h5_extend
- h5_subset
- hyperslab
- selectele
- refobjexample
- refregexample
- mountexample
- compound
-)
-
-set (F2003_examples
- rwdset_fortran2003
- nested_derived_type
- compound_fortran2003
- compound_complex_fortran2003
-)
-
-foreach (example ${examples})
- add_executable (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- target_compile_options(f90_ex_${example}
- PRIVATE
- "${HDF5_CMAKE_Fortran_FLAGS}"
- "$<$:${WIN_COMPILE_FLAGS}>")
-# set_property(TARGET f90_ex_${example} APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>")
-# set_property(TARGET f90_ex_${example} APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>")
- if(MSVC)
- set_property(TARGET f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- if (NOT BUILD_SHARED_LIBS)
- target_include_directories (f90_ex_${example}
- PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/static"
- "${HDF5_SRC_INCLUDE_DIRS}"
- "${HDF5_SRC_BINARY_DIR}"
- "${HDF5_F90_BINARY_DIR}"
- "${HDF5_F90_BINARY_DIR}/static"
- )
- target_link_libraries (f90_ex_${example} PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET})
- set_target_properties (f90_ex_${example} PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER examples/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
- )
- else ()
- target_include_directories (f90_ex_${example}
- PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared"
- "${HDF5_SRC_INCLUDE_DIRS}"
- "${HDF5_SRC_BINARY_DIR}"
- "${HDF5_F90_BINARY_DIR}"
- "${HDF5_F90_BINARY_DIR}/shared"
- )
- target_link_libraries (f90_ex_${example} PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (f90_ex_${example} PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER examples/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
- )
- endif ()
-endforeach ()
-
-foreach (example ${F2003_examples})
- add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- target_compile_options(f03_ex_${example}
- PRIVATE
- "${HDF5_CMAKE_Fortran_FLAGS}"
- "$<$:${WIN_COMPILE_FLAGS}>")
-# set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>")
-# set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>")
- if(MSVC)
- set_property(TARGET f03_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- if (BUILD_STATIC_LIBS)
- target_include_directories (f03_ex_${example}
- PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/static"
- "${HDF5_SRC_INCLUDE_DIRS}"
- "${HDF5_SRC_BINARY_DIR}"
- "${HDF5_F90_BINARY_DIR}"
- "${HDF5_F90_BINARY_DIR}/static"
- )
- target_link_libraries (f03_ex_${example} PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET})
- set_target_properties (f03_ex_${example} PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER examples/fortran03
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
- )
- else ()
- target_include_directories (f03_ex_${example}
- PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared"
- "${HDF5_SRC_INCLUDE_DIRS}"
- "${HDF5_SRC_BINARY_DIR}"
- "${HDF5_F90_BINARY_DIR}"
- "${HDF5_F90_BINARY_DIR}/shared"
- )
- target_link_libraries (f03_ex_${example} PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (f03_ex_${example} PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER examples/fortran03
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
- )
- endif ()
-endforeach ()
-
-if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
- add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90)
- target_compile_options(f90_ex_ph5example
- PRIVATE
- "${HDF5_CMAKE_Fortran_FLAGS}"
- "$<$:${WIN_COMPILE_FLAGS}>")
-# set_property(TARGET f90_ex_ph5example APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>")
-# set_property(TARGET f90_ex_ph5example APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>")
- if(MSVC)
- set_property(TARGET f90_ex_ph5example PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- if (BUILD_STATIC_LIBS)
- target_include_directories (f90_ex_ph5example
- PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/static"
- "${HDF5_SRC_INCLUDE_DIRS}"
- "${HDF5_SRC_BINARY_DIR}"
- "${HDF5_F90_BINARY_DIR}"
- "${HDF5_F90_BINARY_DIR}/static"
- "$<$:${MPI_Fortran_INCLUDE_DIRS}>"
- )
- target_link_libraries (f90_ex_ph5example
- PRIVATE
- ${HDF5_F90_LIB_TARGET}
- ${HDF5_LIB_TARGET}
- "$<$:${MPI_Fortran_LIBRARIES}>"
- )
- set_target_properties (f90_ex_ph5example PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER examples/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
- )
- else ()
- target_include_directories (f90_ex_ph5example
- PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared"
- "${HDF5_SRC_INCLUDE_DIRS}"
- "${HDF5_SRC_BINARY_DIR}"
- "${HDF5_F90_BINARY_DIR}"
- "${HDF5_F90_BINARY_DIR}/shared"
- "$<$:${MPI_Fortran_INCLUDE_DIRS}>"
- )
- target_link_libraries (f90_ex_ph5example
- PRIVATE
- ${HDF5_F90_LIBSH_TARGET}
- ${HDF5_LIBSH_TARGET}
- "$<$:${MPI_Fortran_LIBRARIES}>"
- )
- set_target_properties (f90_ex_ph5example PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER examples/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
- )
- endif ()
-endif ()
-
-if (BUILD_TESTING AND HDF5_TEST_FORTRAN AND HDF5_TEST_EXAMPLES)
- include (CMakeTests.cmake)
-endif ()
diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake
deleted file mode 100644
index 26cbc4f061b..00000000000
--- a/fortran/examples/CMakeTests.cmake
+++ /dev/null
@@ -1,105 +0,0 @@
-#
-# 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://www.hdfgroup.org/licenses.
-# If you do not have access to either file, you may request a copy from
-# help@hdfgroup.org.
-#
-
-##############################################################################
-##############################################################################
-### T E S T I N G ###
-##############################################################################
-##############################################################################
-
-if (HDF5_TEST_SERIAL)
- set (test_ex_fortran_CLEANFILES
- compound.h5
- copy1.h5
- copy2.h5
- dsetf.h5
- extend.h5
- FORTRAN.h5
- groupf.h5
- groupsf.h5
- h5_cmprss.h5
- mount1.h5
- mount2.h5
- sdsf.h5
- subset.h5
- SDScompound.h5
- test.h5
- )
-
- # Remove any output file left over from previous test run
- add_test (
- NAME f90_ex-clear-objects
- COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_fortran_CLEANFILES}
- )
- set_tests_properties (f90_ex-clear-objects PROPERTIES
- FIXTURES_SETUP clear_f90_ex
- WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
- )
- add_test (
- NAME f90_ex-clean-objects
- COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_fortran_CLEANFILES}
- )
- set_tests_properties (f90_ex-clean-objects PROPERTIES
- FIXTURES_CLEANUP clear_f90_ex
- WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
- )
-
- foreach (example ${examples})
- if (HDF5_USING_ANALYSIS_TOOL)
- add_test (NAME f90_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $)
- else ()
- add_test (NAME f90_ex_${example} COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=f90_ex_${example}.txt"
- #-D "TEST_REFERENCE=f90_ex_${example}.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_DIR}/runTest.cmake"
- )
- endif ()
- set_tests_properties (f90_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex)
- if (last_test)
- set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "f90_ex_${example}")
- endforeach ()
-
- foreach (example ${F2003_examples})
- if (HDF5_USING_ANALYSIS_TOOL)
- add_test (NAME f03_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $)
- else ()
- add_test (NAME f03_ex_${example} COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=f03_ex_${example}.txt"
- #-D "TEST_REFERENCE=f03_ex_${example}.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_DIR}/runTest.cmake"
- )
- endif ()
- set_tests_properties (f03_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex)
- if (last_test)
- set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "f03_ex_${example}")
- endforeach ()
-endif ()
-
-if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL AND MPI_Fortran_FOUND)
- add_test (NAME MPI_TEST_f90_ex_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS})
-endif ()
diff --git a/fortran/examples/ph5example.f90 b/fortran/examples/ph5example.f90
deleted file mode 100644
index 29423b3f547..00000000000
--- a/fortran/examples/ph5example.f90
+++ /dev/null
@@ -1,138 +0,0 @@
-! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-! 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://www.hdfgroup.org/licenses. *
-! If you do not have access to either file, you may request a copy from *
-! help@hdfgroup.org. *
-! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-!
-! Fortran parallel example. Copied from Tutorial's example program of
-! dataset.f90.
-
- PROGRAM DATASET
-
- USE HDF5 ! This module contains all necessary modules
- USE MPI
-
- IMPLICIT NONE
-
- CHARACTER(LEN=10), PARAMETER :: default_fname = "sds.h5" ! Default name
- CHARACTER(LEN=8), PARAMETER :: dsetname = "IntArray" ! Dataset name
-
- CHARACTER(LEN=100) :: filename ! File name
- INTEGER :: fnamelen ! File name length
- INTEGER(HID_T) :: file_id ! File identifier
- INTEGER(HID_T) :: dset_id ! Dataset identifier
- INTEGER(HID_T) :: filespace ! Dataspace identifier in file
- INTEGER(HID_T) :: plist_id ! Property list identifier
-
- INTEGER(HSIZE_T), DIMENSION(2) :: dimsf = (/5,8/) ! Dataset dimensions.
-! INTEGER, DIMENSION(7) :: dimsfi = (/5,8,0,0,0,0,0/)
-! INTEGER(HSIZE_T), DIMENSION(2) :: dimsfi = (/5,8/)
- INTEGER(HSIZE_T), DIMENSION(2) :: dimsfi
-
- INTEGER, ALLOCATABLE :: data(:,:) ! Data to write
- INTEGER :: rank = 2 ! Dataset rank
-
- INTEGER :: error, error_n ! Error flags
- INTEGER :: i, j
- !
- ! MPI definitions and calls.
- !
- INTEGER :: mpierror ! MPI error flag
- INTEGER :: comm, info
- INTEGER :: mpi_size, mpi_rank
- comm = MPI_COMM_WORLD
- info = MPI_INFO_NULL
- CALL MPI_INIT(mpierror)
- CALL MPI_COMM_SIZE(comm, mpi_size, mpierror)
- CALL MPI_COMM_RANK(comm, mpi_rank, mpierror)
- !
- ! Initialize data buffer with trivial data.
- !
- ALLOCATE ( data(dimsf(1),dimsf(2)))
- do i = 1, dimsf(2)
- do j = 1, dimsf(1)
- data(j,i) = j - 1 + (i-1)*dimsf(1)
- enddo
- enddo
- !
- ! Initialize FORTRAN interface
- !
- CALL h5open_f(error)
-
- !
- ! Setup file access property list with parallel I/O access.
- !
- CALL h5pcreate_f(H5P_FILE_ACCESS_F, plist_id, error)
- CALL h5pset_fapl_mpio_f(plist_id, comm, info, error)
-
- !
- ! Figure out the filename to use.
- CALL get_environment_variable("HDF5_PARAPREFIX", filename)
- fnamelen = LEN_TRIM(filename)
- if ( fnamelen == 0 ) then
- filename = default_fname
- else
- filename = filename(1:fnamelen) // "/" // default_fname
- endif
- print *, "Using filename = ", filename
-
- !
- ! Create the file collectively.
- !
- CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error, access_prp = plist_id)
- CALL h5pclose_f(plist_id, error)
- !
- ! Create the data space for the dataset.
- !
- CALL h5screate_simple_f(rank, dimsf, filespace, error)
-
- !
- ! Create the dataset with default properties.
- !
- CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, filespace, &
- dset_id, error)
- !
- ! Create property list for collective dataset write
- !
- CALL h5pcreate_f(H5P_DATASET_XFER_F, plist_id, error)
- CALL h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, error)
- !
- ! For independent write use
- ! CALL h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_INDEPENDENT_F, error)
- !
-
- !
- ! Write the dataset collectively.
- !
- CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data, dimsfi, error, &
- xfer_prp = plist_id)
- !
- ! Deallocate data buffer.
- !
- DEALLOCATE(data)
-
- !
- ! Close resources.
- !
- CALL h5sclose_f(filespace, error)
- CALL h5dclose_f(dset_id, error)
- CALL h5pclose_f(plist_id, error)
- CALL h5fclose_f(file_id, error)
- ! Attempt to remove the data file. Remove the line if the compiler
- ! does not support it.
- !CALL unlink(filename)
-
- !
- ! Close FORTRAN interface
- !
- CALL h5close_f(error)
-
- CALL MPI_FINALIZE(mpierror)
-
- END PROGRAM DATASET
diff --git a/java/src/Makefile.am b/java/src/Makefile.am
index aaa40525285..d73cdf2370c 100644
--- a/java/src/Makefile.am
+++ b/java/src/Makefile.am
@@ -130,7 +130,4 @@ clean:
rm -f classhdf5_java.stamp
-# Clean examples when check-clean is invoked
-check-clean :: ;
-
#include $(top_srcdir)/config/conclude.am
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 39136813326..7b3578b692c 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -47,6 +47,12 @@ New Features
Configuration:
-------------
+ - Moved examples to the HDF5Examples folder in the source tree.
+
+ Moved the C++ and Fortran examples from the examples folder to the HDF5Examples
+ folder and renamed to TUTR, tutorial. This is referenced from the LearnBasics
+ doxygen page.
+
- Added support for using zlib-ng package as the zlib library:
CMake: HDF5_USE_ZLIB_NG
From f1baa96a2d9050f8e72440c0bfbad396e99c79d1 Mon Sep 17 00:00:00 2001
From: mattjala <124107509+mattjala@users.noreply.github.com>
Date: Wed, 12 Jun 2024 07:57:38 -0500
Subject: [PATCH 07/45] Document 'return-and-read' field in API context (#4560)
---
src/H5CX.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/H5CX.c b/src/H5CX.c
index f23c90486e3..be31f232bda 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -156,10 +156,10 @@
* application's (non-default) property list. Getting / setting these
* properties within the library does _not_ affect the application's
* property list. Note that the naming of these fields, and
- * _valid, is important for the H5CX_RETRIEVE_PROP_VALID ahd
- * H5CX_RETRIEVE_PROP_VALID_SET macros to work properly.
+ * _valid, is important for the H5CX_RETRIEVE_PROP_VALID
+ * macro to work properly.
*
- * - "Return-only"" properties that are returned to the application, mainly
+ * - "Return-only" properties that are returned to the application, mainly
* for sending out "introspection" information ("Why did collective I/O
* get broken for this operation?", "Which filters are set on the chunk I
* just directly read in?", etc) Setting these fields will cause the
@@ -167,6 +167,19 @@
* context is popped, when returning from the API routine. Note that the
* naming of these fields, and _set, is important for the
* H5CX_TEST_SET_PROP and H5CX_SET_PROP macros to work properly.
+ *
+ * - "Return-and-read" properties that are returned to the application to send out introspection information,
+ * but are also queried by the library internally. Internal queries always retrieve the original value
+ * from the property list, and update the context's value to match. These properties have both a 'valid'
+ * and 'set' flag. _valid is true if the field has ever been populated from its underlying property
+ * list. _set flag is true if this field has ever been set on the context for application
+ * introspection. The naming of these fields is important for the H5CX_RETRIEVE_PROP_VALID_SET macro to
+ * work properly.
+ *
+ * Note that if a set operation is followed by an internal read, it is possible for _set to be true
+ * while the value in the context matches the underlying property list, resulting in a redundant write to
+ * the property list when the context is popped. Similarly, if a field has been set on the context but
+ * never read internally, _valid will be false despite the context containing a meaningful value.
*/
typedef struct H5CX_t {
/* DXPL */
@@ -1082,7 +1095,7 @@ H5CX_restore_state(const H5CX_state_t *api_state)
/*-------------------------------------------------------------------------
* Function: H5CX_free_state
*
- * Purpose: Free a previously retrievedAPI context state
+ * Purpose: Free a previously retrieved API context state
*
* Return: Non-negative on success / Negative on failure
*
From 3b8c0dc5fb25c9e8244f7612e9398c1332fd0f47 Mon Sep 17 00:00:00 2001
From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Date: Wed, 12 Jun 2024 07:57:58 -0500
Subject: [PATCH 08/45] Add compression includes to tests needing zlib support
(#4561)
---
test/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 1d52ae42894..fe860d5ae77 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -480,7 +480,7 @@ endforeach ()
add_executable (chunk_info ${HDF5_TEST_SOURCE_DIR}/chunk_info.c)
target_compile_options(chunk_info PRIVATE "${HDF5_CMAKE_C_FLAGS}")
target_compile_definitions(chunk_info PRIVATE "${HDF5_TEST_COMPILE_DEFS_PRIVATE}")
-target_include_directories (chunk_info PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (chunk_info PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_COMP_INCLUDE_DIRECTORIES};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>")
if (NOT BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (chunk_info STATIC)
target_link_libraries (chunk_info PRIVATE ${HDF5_TEST_LIB_TARGET} ${LINK_COMP_LIBS})
@@ -501,7 +501,7 @@ endif ()
add_executable (direct_chunk ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c)
target_compile_options(direct_chunk PRIVATE "${HDF5_CMAKE_C_FLAGS}")
target_compile_definitions(direct_chunk PRIVATE "${HDF5_TEST_COMPILE_DEFS_PRIVATE}")
-target_include_directories (direct_chunk PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (direct_chunk PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_COMP_INCLUDE_DIRECTORIES};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>")
if (NOT BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (direct_chunk STATIC)
target_link_libraries (direct_chunk PRIVATE ${HDF5_TEST_LIB_TARGET} ${LINK_COMP_LIBS})
From 4a7f850b031a3cc2bac534733adae7c44406ae45 Mon Sep 17 00:00:00 2001
From: jhendersonHDF
Date: Thu, 13 Jun 2024 14:18:31 -0500
Subject: [PATCH 09/45] Allow usage of page buffering for serial file access
from parallel HDF5 builds (#4568)
---
release_docs/RELEASE.txt | 10 +++
src/H5Fint.c | 33 ++++++----
test/page_buffer.c | 133 ---------------------------------------
testpar/t_file.c | 37 ++++++++---
testpar/testphdf5.c | 2 -
5 files changed, 60 insertions(+), 155 deletions(-)
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 7b3578b692c..bf0d0daed89 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -527,6 +527,16 @@ Bug Fixes since HDF5-1.14.4 release
===================================
Library
-------
+ - Fixed library to allow usage of page buffering feature for serial file
+ access with parallel builds of HDF5
+
+ When HDF5 is built with parallel support enabled, the library would previously
+ disallow any usage of page buffering, even if a file was not opened with
+ parallel access. The library now allows usage of page buffering for serial
+ file access with parallel builds of HDF5. Usage of page buffering is still
+ disabled for any form of parallel file access, even if only 1 MPI process
+ is used.
+
- Fixed a leak of datatype IDs created internally during datatype conversion
Fixed an issue where the library could leak IDs that it creates internally
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 3c3c4cb8dd3..0cc48c82c9f 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -2008,15 +2008,6 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
if (H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &page_buf_size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get page buffer size");
if (page_buf_size) {
-#ifdef H5_HAVE_PARALLEL
- /* Collective metadata writes are not supported with page buffering */
- if (file->shared->coll_md_write)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL,
- "collective metadata writes are not supported with page buffering");
-
- /* Temporary: fail file create when page buffering feature is enabled for parallel */
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "page buffering is disabled for parallel");
-#endif /* H5_HAVE_PARALLEL */
/* Query for other page buffer cache properties */
if (H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &page_buf_min_meta_perc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get minimum metadata fraction of page buffer");
@@ -2029,14 +2020,30 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get evict on close value");
#ifdef H5_HAVE_PARALLEL
- /* Check for evict on close in parallel (currently unsupported) */
+ /* Check for unsupported settings in parallel */
assert(file->shared);
if (H5F_SHARED_HAS_FEATURE(file->shared, H5FD_FEAT_HAS_MPI)) {
int mpi_size = H5F_shared_mpi_get_size(file->shared);
- if ((mpi_size > 1) && evict_on_close)
- HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, NULL,
- "evict on close is currently not supported in parallel HDF5");
+ /*
+ * While there shouldn't be any problems in general with using page buffering
+ * with only 1 MPI process, there are still some testing issues to be fixed.
+ * Until then, page buffering is disabled for any form of parallel access.
+ */
+ if (page_buf_size) {
+ /* Collective metadata writes are not supported with page buffering */
+ if (file->shared->coll_md_write)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL,
+ "collective metadata writes are not supported with page buffering");
+
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "page buffering is disabled for parallel");
+ }
+
+ if (mpi_size > 1) {
+ if (evict_on_close)
+ HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, NULL,
+ "evict on close is currently not supported in parallel HDF5");
+ }
}
#endif
diff --git a/test/page_buffer.c b/test/page_buffer.c
index 05fa148a152..4523b2aa904 100644
--- a/test/page_buffer.c
+++ b/test/page_buffer.c
@@ -38,9 +38,6 @@
#define FILENAME_LEN 1024
/* test routines */
-#ifdef H5_HAVE_PARALLEL
-static unsigned verify_page_buffering_disabled(hid_t orig_fapl, const char *driver_name);
-#else
#define NUM_DSETS 5
#define NX 100
#define NY 50
@@ -54,12 +51,9 @@ static unsigned test_stats_collection(hid_t orig_fapl, const char *driver_name);
/* helper routines */
static unsigned create_file(char *filename, hid_t fcpl, hid_t fapl);
static unsigned open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size);
-#endif /* H5_HAVE_PARALLEL */
static const char *FILENAME[] = {"filepaged", NULL};
-#ifndef H5_HAVE_PARALLEL
-
/*-------------------------------------------------------------------------
* Function: create_file()
*
@@ -289,7 +283,6 @@ open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size
H5E_END_TRY
return 1;
}
-#endif /* H5_HAVE_PARALLEL */
/*
*
@@ -353,8 +346,6 @@ set_multi_split(const char *driver_name, hid_t fapl, hsize_t pagesize)
} /* set_multi_split() */
-#ifndef H5_HAVE_PARALLEL
-
/*-------------------------------------------------------------------------
* Function: test_args()
*
@@ -2043,121 +2034,6 @@ test_stats_collection(hid_t orig_fapl, const char *driver_name)
return 1;
} /* test_stats_collection */
-#endif /* #ifndef H5_HAVE_PARALLEL */
-
-/*-------------------------------------------------------------------------
- * Function: verify_page_buffering_disabled()
- *
- * Purpose: This function should only be called in parallel
- * builds.
- *
- * At present, page buffering should be disabled in parallel
- * builds. Verify this.
- *
- * Return: 0 if test is successful
- * 1 if test fails
- *
- *-------------------------------------------------------------------------
- */
-
-#ifdef H5_HAVE_PARALLEL
-static unsigned
-verify_page_buffering_disabled(hid_t orig_fapl, const char *driver_name)
-{
- char filename[FILENAME_LEN]; /* Filename to use */
- hid_t file_id = H5I_INVALID_HID; /* File ID */
- hid_t fcpl = H5I_INVALID_HID;
- hid_t fapl = H5I_INVALID_HID;
-
- TESTING("Page Buffering Disabled");
- h5_fixname(FILENAME[0], orig_fapl, filename, sizeof(filename));
-
- /* first, try to create a file with page buffering enabled */
-
- if ((fapl = H5Pcopy(orig_fapl)) < 0)
- TEST_ERROR;
-
- if (set_multi_split(driver_name, fapl, 4096) != 0)
- TEST_ERROR;
-
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- FAIL_STACK_ERROR;
-
- if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
- FAIL_STACK_ERROR;
-
- if (H5Pset_file_space_page_size(fcpl, 4096) < 0)
- FAIL_STACK_ERROR;
-
- if (H5Pset_page_buffer_size(fapl, 4096 * 8, 0, 0) < 0)
- FAIL_STACK_ERROR;
-
- /* try to create the file -- should fail */
- H5E_BEGIN_TRY
- {
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
- }
- H5E_END_TRY
-
- if (file_id >= 0)
- TEST_ERROR;
-
- /* now, create a file, close it, and then try to open it with page
- * buffering enabled.
- */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- FAIL_STACK_ERROR;
-
- if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
- FAIL_STACK_ERROR;
-
- if (H5Pset_file_space_page_size(fcpl, 4096) < 0)
- FAIL_STACK_ERROR;
-
- /* create the file */
- if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
-
- /* close the file */
- if (H5Fclose(file_id) < 0)
- FAIL_STACK_ERROR;
-
- /* try to open the file using the fapl prepared above which enables
- * page buffering. Should fail.
- */
- H5E_BEGIN_TRY
- {
- file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl);
- }
- H5E_END_TRY
-
- if (file_id >= 0)
- TEST_ERROR;
-
- if (H5Pclose(fcpl) < 0)
- FAIL_STACK_ERROR;
-
- if (H5Pclose(fapl) < 0)
- FAIL_STACK_ERROR;
-
- PASSED();
-
- return 0;
-
-error:
-
- H5E_BEGIN_TRY
- {
- H5Pclose(fapl);
- H5Pclose(fcpl);
- H5Fclose(file_id);
- }
- H5E_END_TRY
-
- return 1;
-
-} /* verify_page_buffering_disabled() */
-#endif /* H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------
* Function: main()
@@ -2203,13 +2079,6 @@ main(void)
FAIL_STACK_ERROR;
api_ctx_pushed = true;
-#ifdef H5_HAVE_PARALLEL
-
- puts("Page Buffering is disabled for parallel.");
- nerrors += verify_page_buffering_disabled(fapl, driver_name);
-
-#else /* H5_HAVE_PARALLEL */
-
nerrors += test_args(fapl, driver_name);
nerrors += test_raw_data_handling(fapl, driver_name);
nerrors += test_lru_processing(fapl, driver_name);
@@ -2217,8 +2086,6 @@ main(void)
nerrors += test_stats_collection(fapl, driver_name);
nerrors += test_pb_fapl_tolerance_at_open();
-#endif /* H5_HAVE_PARALLEL */
-
h5_clean_files(FILENAME, fapl);
if (nerrors)
diff --git a/testpar/t_file.c b/testpar/t_file.c
index 493e6d2d194..acfb45d30a8 100644
--- a/testpar/t_file.c
+++ b/testpar/t_file.c
@@ -33,13 +33,17 @@
#define H5MF_FRIEND /*suppress error about including H5MFpkg */
#include "H5MFpkg.h"
+#ifdef PB_OUT
#define NUM_DSETS 5
+#endif
int mpi_size, mpi_rank;
+#ifdef PB_OUT
static int create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_strategy);
static int open_file(const char *filename, hid_t fapl, int metadata_write_strategy, hsize_t page_size,
size_t page_buffer_size);
+#endif
/*
* test file access by communicator besides COMM_WORLD.
@@ -132,22 +136,29 @@ test_split_comm_access(void)
void
test_page_buffer_access(void)
{
+ const char *filename;
hid_t file_id = H5I_INVALID_HID; /* File ID */
hid_t fcpl, fapl;
- size_t page_count = 0;
- int i, num_elements = 200;
- haddr_t raw_addr, meta_addr;
- int *data;
- H5F_t *f = NULL;
herr_t ret; /* generic return value */
- const char *filename;
- bool api_ctx_pushed = false; /* Whether API context pushed */
+#ifdef PB_OUT
+ size_t page_count = 0;
+ int i, num_elements = 200;
+ haddr_t raw_addr, meta_addr;
+ int *data;
+ H5F_t *f = NULL;
+ bool api_ctx_pushed = false; /* Whether API context pushed */
+#endif
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
filename = (const char *)GetTestParameters();
+ /* Until page buffering is supported in parallel in some form (even if
+ * just for a single MPI process), this test just will just check to
+ * make sure that an error is thrown when page buffering is enabled
+ * with parallel access.
+ */
if (VERBOSE_MED)
printf("Page Buffer Usage in Parallel %s\n", filename);
@@ -175,6 +186,15 @@ test_page_buffer_access(void)
ret = H5Pset_coll_metadata_write(fapl, false);
VRFY((ret >= 0), "");
+ /* This should fail due to page buffering not being supported in parallel */
+ H5E_BEGIN_TRY
+ {
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
+ }
+ H5E_END_TRY
+ VRFY((file_id < 0), "H5Fcreate failed");
+
+#ifdef PB_OUT
ret = create_file(filename, fcpl, fapl, H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED);
VRFY((ret == 0), "");
ret = open_file(filename, fapl, H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED, sizeof(int) * 100,
@@ -442,8 +462,10 @@ test_page_buffer_access(void)
free(data);
data = NULL;
MPI_Barrier(MPI_COMM_WORLD);
+#endif
}
+#ifdef PB_OUT
static int
create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_strategy)
{
@@ -760,6 +782,7 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, hsize_t
return nerrors;
}
+#endif
/*
* NOTE: See HDFFV-10894 and add tests later to verify MPI-specific properties in the
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index 7de274fc230..992b8ee71af 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -402,9 +402,7 @@ main(int argc, char **argv)
AddTest("split", test_split_comm_access, NULL, "dataset using split communicators", PARATESTFILE);
AddTest("h5oflusherror", test_oflush, NULL, "H5Oflush failure", PARATESTFILE);
-#ifdef PB_OUT /* temporary: disable page buffering when parallel */
AddTest("page_buffer", test_page_buffer_access, NULL, "page buffer usage in parallel", PARATESTFILE);
-#endif
AddTest("props", test_file_properties, NULL, "Coll Metadata file property settings", PARATESTFILE);
From 942c3cdb51fdc2b7bc63875b8c636bc73bed3c63 Mon Sep 17 00:00:00 2001
From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Date: Fri, 14 Jun 2024 11:03:00 -0500
Subject: [PATCH 10/45] Remove old version of libaec (#4567)
---
CMakeFilters.cmake | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake
index 55dbd7ccc7b..cccf80b916a 100644
--- a/CMakeFilters.cmake
+++ b/CMakeFilters.cmake
@@ -133,14 +133,9 @@ if (HDF5_ENABLE_SZIP_SUPPORT)
if (NOT SZIP_USE_EXTERNAL)
set(libaec_USE_STATIC_LIBS ${HDF5_USE_LIBAEC_STATIC})
set(SZIP_FOUND FALSE)
- find_package (libaec 1.0.5 CONFIG)
- if (SZIP_FOUND)
- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${H5_SZIP_LIBRARIES})
- else ()
- find_package (SZIP NAMES ${LIBAEC_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
- if (NOT SZIP_FOUND)
- find_package (SZIP) # Legacy find
- endif ()
+ find_package (SZIP NAMES ${LIBAEC_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
+ if (NOT SZIP_FOUND)
+ find_package (SZIP) # Legacy find
endif ()
set(H5_SZIP_FOUND ${SZIP_FOUND})
if (H5_SZIP_FOUND)
From 372734543cd15faa5b1e56a88bfd4be6e3234316 Mon Sep 17 00:00:00 2001
From: mattjala <124107509+mattjala@users.noreply.github.com>
Date: Fri, 14 Jun 2024 11:04:49 -0500
Subject: [PATCH 11/45] Add property names to context field docs (#4563)
---
src/H5CX.c | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/src/H5CX.c b/src/H5CX.c
index be31f232bda..2a4a4f6eff1 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -222,15 +222,15 @@ typedef struct H5CX_t {
#endif /* H5_HAVE_PARALLEL */
/* Cached DXPL properties */
- size_t max_temp_buf; /* Maximum temporary buffer size */
+ size_t max_temp_buf; /* Maximum temporary buffer size (H5D_XFER_MAX_TEMP_BUF_NAME) .*/
bool max_temp_buf_valid; /* Whether maximum temporary buffer size is valid */
void *tconv_buf; /* Temporary conversion buffer (H5D_XFER_TCONV_BUF_NAME) */
bool tconv_buf_valid; /* Whether temporary conversion buffer is valid */
void *bkgr_buf; /* Background conversion buffer (H5D_XFER_BKGR_BUF_NAME) */
bool bkgr_buf_valid; /* Whether background conversion buffer is valid */
- H5T_bkg_t bkgr_buf_type; /* Background buffer type (H5D_XFER_BKGR_BUF_NAME) */
+ H5T_bkg_t bkgr_buf_type; /* Background buffer type (H5D_XFER_BKGR_BUF_TYPE_NAME) */
bool bkgr_buf_type_valid; /* Whether background buffer type is valid */
- double btree_split_ratio[3]; /* B-tree split ratios */
+ double btree_split_ratio[3]; /* B-tree split ratios (H5D_XFER_BTREE_SPLIT_RATIO_NAME) */
bool btree_split_ratio_valid; /* Whether B-tree split ratios are valid */
size_t vec_size; /* Size of hyperslab vector (H5D_XFER_HYPER_VECTOR_SIZE_NAME) */
bool vec_size_valid; /* Whether hyperslab vector is valid */
@@ -260,8 +260,8 @@ typedef struct H5CX_t {
bool dt_conv_cb_valid; /* Whether datatype conversion struct is valid */
H5D_selection_io_mode_t selection_io_mode; /* Selection I/O mode (H5D_XFER_SELECTION_IO_MODE_NAME) */
bool selection_io_mode_valid; /* Whether selection I/O mode is valid */
- bool modify_write_buf; /* Whether the library can modify write buffers */
- bool modify_write_buf_valid; /* Whether the modify_write_buf field is valid */
+ bool modify_write_buf; /* Whether the library can modify write buffers (H5D_XFER_MODIFY_WRITE_BUF_NAME)*/
+ bool modify_write_buf_valid; /* Whether the modify_write_buf field is valid */
/* Return-only DXPL properties to return to application */
#ifdef H5_HAVE_PARALLEL
@@ -318,32 +318,34 @@ typedef struct H5CX_t {
bool actual_selection_io_mode_valid; /* Whether actual selection I/O mode is valid */
/* Cached LCPL properties */
- H5T_cset_t encoding; /* Link name character encoding */
- bool encoding_valid; /* Whether link name character encoding is valid */
- unsigned intermediate_group; /* Whether to create intermediate groups */
- bool intermediate_group_valid; /* Whether create intermediate group flag is valid */
+ H5T_cset_t encoding; /* Link name character encoding (H5P_STRCRT_CHAR_ENCODING_NAME) */
+ bool encoding_valid; /* Whether link name character encoding is valid */
+ unsigned intermediate_group; /* Whether to create intermediate groups (H5L_CRT_INTERMEDIATE_GROUP_NAME) */
+ bool intermediate_group_valid; /* Whether create intermediate group flag is valid */
/* Cached LAPL properties */
size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
bool nlinks_valid; /* Whether number of soft / UD links to traverse is valid */
/* Cached DCPL properties */
- bool do_min_dset_ohdr; /* Whether to minimize dataset object header */
+ bool do_min_dset_ohdr; /* Whether to minimize dataset object header (H5D_CRT_MIN_DSET_HDR_SIZE_NAME) */
bool do_min_dset_ohdr_valid; /* Whether minimize dataset object header flag is valid */
- uint8_t ohdr_flags; /* Object header flags */
+ uint8_t ohdr_flags; /* Object header flags (H5O_CRT_OHDR_FLAGS_NAME) */
bool ohdr_flags_valid; /* Whether the object headers flags are valid */
/* Cached DAPL properties */
- const char *extfile_prefix; /* Prefix for external file */
+ const char *extfile_prefix; /* Prefix for external file (H5D_ACS_EFILE_PREFIX_NAME) */
bool extfile_prefix_valid; /* Whether the prefix for external file is valid */
- const char *vds_prefix; /* Prefix for VDS */
+ const char *vds_prefix; /* Prefix for VDS (H5D_ACS_VDS_PREFIX_NAME) */
bool vds_prefix_valid; /* Whether the prefix for VDS is valid */
/* Cached FAPL properties */
- H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds() */
- bool low_bound_valid; /* Whether low_bound property is valid */
- H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds */
- bool high_bound_valid; /* Whether high_bound property is valid */
+ H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds()
+ (H5F_ACS_LIBVER_LOW_BOUND_NAME) */
+ bool low_bound_valid; /* Whether low_bound property is valid */
+ H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds
+ (H5F_ACS_LIBVER_HIGH_BOUND_NAME) */
+ bool high_bound_valid; /* Whether high_bound property is valid */
/* Cached VOL settings */
H5VL_connector_prop_t vol_connector_prop; /* Property for VOL connector ID & info */
From 8f59301c2fcc6d7da01898df9a5767a320140f43 Mon Sep 17 00:00:00 2001
From: mattjala <124107509+mattjala@users.noreply.github.com>
Date: Fri, 14 Jun 2024 11:17:57 -0500
Subject: [PATCH 12/45] Document property shared name behavior (#4565)
---
src/H5Ppkg.h | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h
index 63baced637a..aed3c864322 100644
--- a/src/H5Ppkg.h
+++ b/src/H5Ppkg.h
@@ -58,11 +58,15 @@ typedef enum {
/* Define structure to hold property information */
typedef struct H5P_genprop_t {
/* Values for this property */
- char *name; /* Name of property */
- size_t size; /* Size of property value */
- void *value; /* Pointer to property value */
- H5P_prop_within_t type; /* Type of object the property is within */
- bool shared_name; /* Whether the name is shared or not */
+ char *name; /* Name of property */
+ size_t size; /* Size of property value */
+ void *value; /* Pointer to property value */
+ H5P_prop_within_t type; /* Type of object the property is within */
+ bool shared_name; /* Whether the name buffer is owned by a different property. Names are only shared when
+ duplicating a property from a class to a list, or when duplicating a property with a
+ shared name from one list to another. The property that owns the name frees it when
+ that property is closed. The name is guaranteed to stay allocated as long as other
+ properties share it due to reference counting on property lists classes. */
/* Callback function pointers & info */
H5P_prp_create_func_t create; /* Function to call when a property is created */
From 6edee58d8f4faa08a6cdd450abcd14db2044c757 Mon Sep 17 00:00:00 2001
From: mattjala <124107509+mattjala@users.noreply.github.com>
Date: Fri, 14 Jun 2024 11:18:25 -0500
Subject: [PATCH 13/45] Clarify H5CX macro documentation (#4569)
---
src/H5CX.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/H5CX.c b/src/H5CX.c
index 2a4a4f6eff1..d3d1ab3bed3 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -48,7 +48,7 @@
* be handled by the pthread library.
*
* In order for this macro to work, H5CX_get_my_context() must be preceded
- * by "H5CX_node_t *ctx =".
+ * by "H5CX_node_t **ctx =".
*/
#define H5CX_get_my_context() H5CX__get_context()
#else /* H5_HAVE_THREADSAFE */
@@ -84,14 +84,15 @@
/* Mark the field as valid */ \
(*head)->ctx.H5_GLUE(PROP_FIELD, _valid) = true;
-/* Macro for the duplicated code to retrieve properties from a property list */
+/* Macro for the duplicated code to retrieve a value from a plist if the context value is invalid */
#define H5CX_RETRIEVE_PROP_VALID(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
/* Check if the value has been retrieved already */ \
if (!(*head)->ctx.H5_GLUE(PROP_FIELD, _valid)) { \
H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
} /* end if */
-/* Macro for the duplicated code to retrieve possibly set properties from a property list */
+/* Macro for the duplicated code to retrieve a value from a plist if the context value is invalid, or the
+ * library has previously modified the context value for return */
#define H5CX_RETRIEVE_PROP_VALID_SET(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
/* Check if the value has been retrieved already */ \
if (!((*head)->ctx.H5_GLUE(PROP_FIELD, _valid) || (*head)->ctx.H5_GLUE(PROP_FIELD, _set))) { \
@@ -99,7 +100,7 @@
} /* end if */
#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_INSTRUMENTED_LIBRARY)
-/* Macro for the duplicated code to test and set properties for a property list */
+/* Macro for the duplicated code to set a context field that may not exist as a property */
#define H5CX_TEST_SET_PROP(PROP_NAME, PROP_FIELD) \
{ \
htri_t check_prop = 0; /* Whether the property exists in the API context's DXPL */ \
@@ -122,7 +123,7 @@
}
#endif /* defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_INSTRUMENTED_LIBRARY) */
-/* Macro for the duplicated code to test and set properties for a property list */
+/* Macro for the duplicated code to test and set properties for a property list from the context */
#define H5CX_SET_PROP(PROP_NAME, PROP_FIELD) \
if ((*head)->ctx.H5_GLUE(PROP_FIELD, _set)) { \
/* Retrieve the dataset transfer property list */ \
From 298c069f84f1c57b74dfc616d8e4ece9244c23dd Mon Sep 17 00:00:00 2001
From: mattjala <124107509+mattjala@users.noreply.github.com>
Date: Sat, 15 Jun 2024 12:45:12 -0500
Subject: [PATCH 14/45] Document H5Punregister modifying default properties
(#4570)
---
src/H5P.c | 8 +++++---
src/H5Ppkg.h | 4 ++--
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/H5P.c b/src/H5P.c
index b2d27bba997..f0ccc2fc4ef 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -1397,8 +1397,10 @@ H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name)
Returns non-negative on success, negative on failure.
DESCRIPTION
Removes a property from a property list class. Future property lists
- created of that class will not contain this property. Existing property
- lists containing this property are not affected.
+ created of that class will not contain this property. Existing property lists
+ which still use the default value for this property will have this property removed.
+ Existing property lists which have modified this property will not be affected.
+
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
@@ -1419,7 +1421,7 @@ H5Punregister(hid_t pclass_id, const char *name)
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name");
- /* Remove the property list from class */
+ /* Remove the property from property list class */
if ((ret_value = H5P__unregister(pclass, name)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to remove property from class");
diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h
index aed3c864322..0ff000ba96c 100644
--- a/src/H5Ppkg.h
+++ b/src/H5Ppkg.h
@@ -108,10 +108,10 @@ struct H5P_genclass_t {
struct H5P_genplist_t {
H5P_genclass_t *pclass; /* Pointer to class info */
hid_t plist_id; /* Copy of the property list ID (for use in close callback) */
- size_t nprops; /* Number of properties in class */
+ size_t nprops; /* Number of properties in this list */
bool class_init; /* Whether the class initialization callback finished successfully */
H5SL_t *del; /* Skip list containing names of deleted properties */
- H5SL_t *props; /* Skip list containing properties */
+ H5SL_t *props; /* Skip list containing properties modified from the parent class */
};
/* Property list/class iterator callback function pointer */
From 8d7ae0e2667f3330503fb52d8b38ed87eddda1ef Mon Sep 17 00:00:00 2001
From: "H. Joe Lee"
Date: Sat, 15 Jun 2024 13:04:42 -0500
Subject: [PATCH 15/45] Update NVHPC to 24.5 (#4171)
We don't test parallel in other GitHub actions, so this also converts the
NVHPC check to configure and build only while we discuss how we'll
test parallel HDF5 in GitHub.
There is a blocking GitHub issue to address the test failures for
HDF5 1.14.5 (#4571).
---
.github/workflows/nvhpc-auto.yml | 33 ++++++++++---------------------
.github/workflows/nvhpc-cmake.yml | 22 ++++++++-------------
2 files changed, 18 insertions(+), 37 deletions(-)
diff --git a/.github/workflows/nvhpc-auto.yml b/.github/workflows/nvhpc-auto.yml
index b29cf8f2f55..a73dbcb3c67 100644
--- a/.github/workflows/nvhpc-auto.yml
+++ b/.github/workflows/nvhpc-auto.yml
@@ -34,21 +34,21 @@ jobs:
curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg
echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list
sudo apt-get update -y
- sudo apt-get install -y nvhpc-23-9
+ sudo apt-get install -y nvhpc-24-5
echo "NVHPCSDK=/opt/nvidia/hpc_sdk" >> $GITHUB_ENV
- echo "OMPI_CXX=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc++" >> $GITHUB_ENV
- echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc" >> $GITHUB_ENV
- echo "OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvfortran" >> $GITHUB_ENV
- echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/comm_libs/openmpi4/bin/mpicc" >> $GITHUB_ENV
- echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/comm_libs/openmpi4/bin/mpifort" >> $GITHUB_ENV
- echo "LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/lib" >> $GITHUB_ENV
+ echo "OMPI_CXX=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin/nvc++" >> $GITHUB_ENV
+ echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin/nvc" >> $GITHUB_ENV
+ echo "OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin/nvfortran" >> $GITHUB_ENV
+ echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin/mpicc" >> $GITHUB_ENV
+ echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin/mpifort" >> $GITHUB_ENV
+ echo "LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/lib" >> $GITHUB_ENV
echo "DESTDIR=/tmp" >> $GITHUB_ENV
- name: Autotools Configure
shell: bash
run: |
export RUNPARALLEL="mpiexec -np 2"
- export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH
+ export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin:$PATH
sh ./autogen.sh
mkdir "${{ runner.workspace }}/build"
cd "${{ runner.workspace }}/build"
@@ -62,26 +62,13 @@ jobs:
- name: Autotools Build
shell: bash
run: |
- export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH
+ export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin:$PATH
make -j3
working-directory: ${{ runner.workspace }}/build
- - name: Autotools Run Tests
- shell: bash
- run: |
- export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH
- make check -j
- working-directory: ${{ runner.workspace }}/build
-
- name: Autotools Install
shell: bash
run: |
- export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH
+ export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin:$PATH
make install
working-directory: ${{ runner.workspace }}/build
-
-# - name: Autotools Verify Install
-# run: |
-# export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH
-# make check-install
-# working-directory: ${{ runner.workspace }}/build
diff --git a/.github/workflows/nvhpc-cmake.yml b/.github/workflows/nvhpc-cmake.yml
index e365bdab62f..4a99cfd6ac7 100644
--- a/.github/workflows/nvhpc-cmake.yml
+++ b/.github/workflows/nvhpc-cmake.yml
@@ -33,20 +33,20 @@ jobs:
curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg
echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list
sudo apt-get update -y
- sudo apt-get install -y nvhpc-23-9
+ sudo apt-get install -y nvhpc-24-5
echo "NVHPCSDK=/opt/nvidia/hpc_sdk" >> $GITHUB_ENV
- echo "OMPI_CXX=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc++" >> $GITHUB_ENV
- echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc" >> $GITHUB_ENV
- echo "OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvfortran" >> $GITHUB_ENV
- echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/comm_libs/openmpi4/bin/mpicc" >> $GITHUB_ENV
- echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/comm_libs/openmpi4/bin/mpifort" >> $GITHUB_ENV
- echo "LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/lib64:/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/lib" >> $GITHUB_ENV
+ echo "OMPI_CXX=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin/nvc++" >> $GITHUB_ENV
+ echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin/nvc" >> $GITHUB_ENV
+ echo "OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin/nvfortran" >> $GITHUB_ENV
+ echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin/mpicc" >> $GITHUB_ENV
+ echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin/mpifort" >> $GITHUB_ENV
+ echo "LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/cuda/12.3/lib64:/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/lib" >> $GITHUB_ENV
echo "DESTDIR=/tmp" >> $GITHUB_ENV
- name: CMake Configure
shell: bash
run: |
- export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH
+ export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin:$PATH
mkdir "${{ runner.workspace }}/build"
cd "${{ runner.workspace }}/build"
cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake -G Ninja \
@@ -67,9 +67,3 @@ jobs:
run: |
cmake --build . --parallel 3 --config ${{ inputs.build_mode }}
working-directory: ${{ runner.workspace }}/build
-
- - name: CMake Run Tests
- shell: bash
- run: |
- ctest . --parallel 2 -C ${{ inputs.build_mode }} -V -E "ph5_f90_hyperslab_by_chunk|ph5_f90_hyperslab_by_pattern"
- working-directory: ${{ runner.workspace }}/build
From abcbd9ee02d84789b363c513fb5c964e105c73e0 Mon Sep 17 00:00:00 2001
From: Dana Robinson <43805+derobins@users.noreply.github.com>
Date: Mon, 17 Jun 2024 11:00:22 -0700
Subject: [PATCH 16/45] Clean up comments in H5FDros3.c (#4572)
---
src/H5FDros3.c | 404 +++++++++++++++----------------------------------
1 file changed, 119 insertions(+), 285 deletions(-)
diff --git a/src/H5FDros3.c b/src/H5FDros3.c
index 9427409e4ed..d3fcd1536af 100644
--- a/src/H5FDros3.c
+++ b/src/H5FDros3.c
@@ -35,8 +35,7 @@
#ifdef H5_HAVE_ROS3_VFD
-/* toggle debugging; pick a level
- */
+/* Set debug output level */
#define ROS3_DEBUG_NONE 0
#define ROS3_DEBUG_TRACE_API 1
#define ROS3_DEBUG_TRACE_INTERNAL 2
@@ -49,19 +48,18 @@
/* Max size of the cache, in bytes */
#define ROS3_MAX_CACHE_SIZE 16777216
-/* The driver identification number, initialized at runtime
- */
+/* The driver identification number, initialized at runtime */
static hid_t H5FD_ROS3_g = 0;
-/* Session/security token property name
- */
+/* Session/security token property name */
#define ROS3_TOKEN_PROP_NAME "ros3_token_prop"
#if ROS3_STATS
-/* arbitrarily large value, such that any reasonable size read will be "less"
+/* Arbitrarily large value, such that any reasonable size read will be "less"
* than this value and set a true minimum
- * not 0 because that may be a valid recorded minimum in degenerate cases
+ *
+ * Not 0 because that may be a valid recorded minimum in degenerate cases
*/
#define ROS3_STATS_STARTING_MIN 0xfffffffful
@@ -77,8 +75,7 @@ static hid_t H5FD_ROS3_g = 0;
#define ROS3_STATS_START_POWER 10
#define ROS3_STATS_BIN_COUNT 16 /* MUST BE GREATER THAN 0 */
-/*
- * Calculate `BASE ^ (START_POWER + (INTERVAL * bin_i))`
+/* Calculate `BASE ^ (START_POWER + (INTERVAL * bin_i))`
* Stores result at `(unsigned long long *) out_ptr`.
* Used in computing boundaries between stats bins.
*/
@@ -94,19 +91,11 @@ static hid_t H5FD_ROS3_g = 0;
*(out_ptr) = donotshadowresult; \
}
-/* array to hold pre-computed boundaries for stats bins
- */
+/* Array to hold pre-computed boundaries for stats bins */
static unsigned long long ros3_stats_boundaries[ROS3_STATS_BIN_COUNT];
/***************************************************************************
- *
- * Structure: ros3_statsbin
- *
- * Purpose:
- *
- * Structure for storing per-file ros3 VFD usage statistics.
- *
- *
+ * Structure for storing per-file ros3 VFD usage statistics.
*
* `count` (unsigned long long)
*
@@ -123,7 +112,6 @@ static unsigned long long ros3_stats_boundaries[ROS3_STATS_BIN_COUNT];
* `max` (unsigned long long)
*
* Largest read size in this bin.
- *
***************************************************************************/
typedef struct {
unsigned long long count;
@@ -135,19 +123,8 @@ typedef struct {
#endif /* ROS3_STATS */
/***************************************************************************
- *
- * Structure: H5FD_ros3_t
- *
- * Purpose:
- *
- * 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
- * discarded when it is "closed".
- *
- * Presents an S3 object as a file to the HDF5 library.
- *
- *
+ * Stores all information needed to maintain access to a single HDF5 file
+ * that has been stored as a S3 object.
*
* `pub` (H5FD_t)
*
@@ -188,7 +165,6 @@ typedef struct {
* reserved for "big" reads, with no defined upper bound.
*
* *** end ROS3_STATS ***
- *
***************************************************************************/
typedef struct H5FD_ros3_t {
H5FD_t pub;
@@ -203,8 +179,7 @@ typedef struct H5FD_ros3_t {
#endif
} H5FD_ros3_t;
-/*
- * These macros check for overflow of various quantities. These macros
+/* These macros check for overflow of various quantities. These macros
* assume that HDoff_t is signed and haddr_t and size_t are unsigned.
*
* ADDR_OVERFLOW: Checks whether a file address of type `haddr_t'
@@ -294,9 +269,8 @@ H5FL_DEFINE_STATIC(H5FD_ros3_t);
* Purpose: Initialize this driver by registering the driver with the
* library.
*
- * Return: Success: The driver ID for the ros3 driver.
- * Failure: Negative
- *
+ * Return: Success: The driver ID for the ros3 driver
+ * Failure: H5I_INVALID_HID
*-------------------------------------------------------------------------
*/
hid_t
@@ -320,8 +294,7 @@ H5FD_ros3_init(void)
}
#if ROS3_STATS
- /* pre-compute statsbin boundaries */
- /* do it only during initial registration */
+ /* Pre-compute statsbin boundaries */
for (bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) {
unsigned long long value = 0;
@@ -343,7 +316,6 @@ H5FD_ros3_init(void)
* Purpose: Shut down the VFD
*
* Returns: SUCCEED (Can't fail)
- *
*---------------------------------------------------------------------------
*/
static herr_t
@@ -365,12 +337,9 @@ 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 specific
- * properties are passed in as a pointer to a suitably
- * initialized instance of H5FD_ros3_fapl_t
+ * driver defined in this source file.
*
* Return: SUCCEED/FAIL
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -401,20 +370,12 @@ H5Pset_fapl_ros3(hid_t fapl_id, const H5FD_ros3_fapl_t *fa)
} /* end H5Pset_fapl_ros3() */
/*-------------------------------------------------------------------------
- * Function: H5FD__ros3_validate_config()
+ * Function: H5FD__ros3_validate_config
*
* Purpose: Test to see if the supplied instance of H5FD_ros3_fapl_t
- * contains internally consistent data. Return SUCCEED if so,
- * and FAIL otherwise.
- *
- * Note the difference between internally consistent 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 consistency at this point
- *
- * Return: SUCCEED if instance of H5FD_ros3_fapl_t contains internally
- * consistent data, FAIL otherwise.
+ * contains internally consistent data.
*
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
static herr_t
@@ -429,7 +390,7 @@ H5FD__ros3_validate_config(const H5FD_ros3_fapl_t *fa)
if (fa->version != H5FD_CURR_ROS3_FAPL_T_VERSION)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown H5FD_ros3_fapl_t version");
- /* if set to authenticate, region and id cannot be empty strings */
+ /* if set to authenticate, region and secret_id cannot be empty strings */
if (fa->authenticate == true)
if ((fa->aws_region[0] == '\0') || (fa->secret_id[0] == '\0'))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Inconsistent authentication information");
@@ -441,13 +402,9 @@ H5FD__ros3_validate_config(const H5FD_ros3_fapl_t *fa)
/*-------------------------------------------------------------------------
* Function: H5Pget_fapl_ros3
*
- * Purpose: Returns information about the ros3 file access property
- * list though the function arguments.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
+ * Purpose: Queries properties set by the H5Pset_fapl_ros3() function.
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -490,10 +447,8 @@ H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_dst /*out*/)
* Purpose: Gets a file access property list which could be used to
* create an identical file.
*
- * Return: Success: Ptr to new file access property list value.
- *
- * Failure: NULL
- *
+ * Return: Success: Pointer to new file access property list value
+ * Failure: NULL
*-------------------------------------------------------------------------
*/
static void *
@@ -528,10 +483,8 @@ H5FD__ros3_fapl_get(H5FD_t *_file)
*
* Purpose: Copies the ros3-specific file access properties.
*
- * Return: Success: Ptr to a new property list
- *
- * Failure: NULL
- *
+ * Return: Success: Pointer to a new property list
+ * Failure: NULL
*-------------------------------------------------------------------------
*/
static void *
@@ -564,7 +517,6 @@ H5FD__ros3_fapl_copy(const void *_old_fa)
* Purpose: Frees the ros3-specific file access properties.
*
* Return: SUCCEED (cannot fail)
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -574,7 +526,7 @@ H5FD__ros3_fapl_free(void *_fa)
FUNC_ENTER_PACKAGE_NOERR
- assert(fa != NULL); /* sanity check */
+ assert(fa != NULL);
H5MM_xfree(fa);
@@ -587,13 +539,7 @@ H5FD__ros3_fapl_free(void *_fa)
* Purpose: Returns session/security token of the ros3 file access
* property list though the function arguments.
*
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Jan-Willem Blokland
- * 2023-05-26
- *
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -640,15 +586,11 @@ H5Pget_fapl_ros3_token(hid_t fapl_id, size_t size, char *token_dst /*out*/)
} /* end H5Pget_fapl_ros3_token() */
/*-------------------------------------------------------------------------
- * Function: H5FD__ros3_str_token_copy()
+ * Function: H5FD__ros3_str_token_copy
*
* Purpose: Create a copy of the token string.
*
* Return: SUCCEED/FAIL
- *
- * Programmer: Jan-Willem Blokland
- * 2023-05-26
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -672,17 +614,11 @@ H5FD__ros3_str_token_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED
} /* H5FD__ros3_str_token_copy() */
/*-------------------------------------------------------------------------
- * Function: H5FD__ros3_str_token_cmp()
+ * Function: H5FD__ros3_str_token_cmp
*
* Purpose: Compares two token strings with each other.
*
- * Return:
- * - Equivalent: 0
- * - Not Equivalent: non-zero value
- *
- * Programmer: Jan-Willem Blokland
- * 2023-05-26
- *
+ * Return: A value like strcmp()
*-------------------------------------------------------------------------
*/
static int
@@ -711,17 +647,13 @@ H5FD__ros3_str_token_cmp(const void *_value1, const void *_value2, size_t H5_ATT
} /* H5FD__ros3_str_token_cmp */
/*-------------------------------------------------------------------------
- * Function: H5FD__ros3_str_token_close()
+ * Function: H5FD__ros3_str_token_close
*
* Purpose: Closes/frees the memory associated to the token string.
* Currently, it is an empty implementation since there no
* additional treatment needed for this property.
*
* Return: SUCCEED/FAIL
- *
- * Programmer: Jan-Willem Blokland
- * 2023-05-26
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -739,7 +671,7 @@ H5FD__ros3_str_token_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE
} /* H5FD__ros3_str_token_close */
/*-------------------------------------------------------------------------
- * Function: H5FD__ros3_str_token_delete()
+ * Function: H5FD__ros3_str_token_delete
*
* Purpose: Deletes the property token from the property list and frees
* the memory associated to the token string.
@@ -747,10 +679,6 @@ H5FD__ros3_str_token_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE
* additional treatment needed for this property.
*
* Return: SUCCEED/FAIL
- *
- * Programmer: Jan-Willem Blokland
- * 2023-05-26
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -769,17 +697,13 @@ H5FD__ros3_str_token_delete(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNU
} /* H5FD__ros3_str_token_delete */
/*-------------------------------------------------------------------------
- * Function: H5Pset_fapl_ros3_token()
+ * Function: H5Pset_fapl_ros3_token
*
* Purpose: Modify the file access property list to use the H5FD_ROS3
* driver defined in this source file by adding or
* modifying the session/security token property.
*
- * Return: SUCCEED/FAIL
- *
- * Programmer: Jan-Willem Blokland
- * 2023-05-26
- *
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -832,21 +756,11 @@ H5Pset_fapl_ros3_token(hid_t fapl_id, const char *token)
#if ROS3_STATS
/*----------------------------------------------------------------------------
+ * Function: ros3_reset_stats
*
- * Function: ros3_reset_stats()
- *
- * Purpose:
- *
- * Reset the stats collection elements in this virtual file structure.
- *
- * Clears any set data in stats bins; initializes/zeroes values.
- *
- * Return:
- *
- * - SUCCESS: `SUCCEED`
- * - FAILURE: `FAIL`
- * - Occurs if the file is invalid somehow
+ * Purpose: Reset the collected statistics
*
+ * Return: SUCCEED/FAIL
*----------------------------------------------------------------------------
*/
static herr_t
@@ -882,16 +796,13 @@ ros3_reset_stats(H5FD_ros3_t *file)
#endif /* ROS3_STATS */
/*-------------------------------------------------------------------------
+ * Function: H5FD__ros3_open
*
- * Function: H5FD__ros3_open()
- *
- * Purpose:
- *
- * Create and/or opens a file as an HDF5 file.
+ * Purpose: Create and/or open 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:
+ * `url` param (as received from `H5FD_open()`) must conform to web url:
* NAME :: HTTP "://" DOMAIN [PORT] ["/" [URI] [QUERY] ]
* HTTP :: "http" [ "s" ]
* DOMAIN :: e.g., "mybucket.host.org"
@@ -899,14 +810,8 @@ ros3_reset_stats(H5FD_ros3_t *file)
* URI :: (e.g., "path/to/resource.hd5" )
* QUERY :: "?" (e.g., "arg1=param1&arg2=param2")
*
- * Return:
- *
- * 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
- *
+ * Return: Success: A pointer to a new file data structure
+ * Failure: NULL
*-------------------------------------------------------------------------
*/
static H5FD_t *
@@ -958,13 +863,14 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to get token value");
}
- /* open file; procedure depends on whether or not the fapl instructs to
+ /* Open file; procedure depends on whether or not the fapl instructs to
* authenticate requests or not.
*/
if (fa.authenticate == true) {
- /* compute signing key (part of AWS/S3 REST API)
- * can be re-used by user/key for 7 days after creation.
- * find way to reuse/share
+ /* Compute signing key (part of AWS/S3 REST API). Can be re-used by
+ * user/key for 7 days after creation.
+ *
+ * TODO: Find way to reuse/share?
*/
now = gmnow();
assert(now != NULL);
@@ -991,7 +897,7 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
*/
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, "unable to allocate file struct");
@@ -1002,7 +908,7 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
#if ROS3_STATS
if (FAIL == ros3_reset_stats(file))
HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, "unable to reset file statistics");
-#endif /* ROS3_STATS */
+#endif
/* Cache the initial bytes of the file */
{
@@ -1027,20 +933,17 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
H5MM_xfree(file->cache);
file = H5FL_FREE(H5FD_ros3_t, file);
}
- curl_global_cleanup(); /* early cleanup because open failed */
- } /* end if null return value (error) */
+ curl_global_cleanup();
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__ros3_open() */
#if ROS3_STATS
/*----------------------------------------------------------------------------
+ * Function: ros3_fprint_stats
*
- * Function: ros3_fprint_stats()
- *
- * Purpose:
- *
- * Tabulate and pretty-print statistics for this virtual file.
+ * Purpose: Tabulate and pretty-print statistics for this virtual file.
*
* Should be called upon file close.
*
@@ -1077,13 +980,7 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
* - 41080 bytes is represented by 40.177k, not 41.080k
* - 1004.831M represents approx. 1052642000 bytes
*
- * Return:
- *
- * - SUCCESS: `SUCCEED`
- * - FAILURE: `FAIL`
- * - occurs if the file passed in is invalid
- * - TODO: if stream is invalid? how can we check this?
- *
+ * Return: SUCCEED/FAIL
*----------------------------------------------------------------------------
*/
static herr_t
@@ -1293,13 +1190,13 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file)
assert(suffix_i < sizeof(suffixes));
fprintf(stream, " %8.3f%c %7llu %7llu %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub,
- suffixes[suffix_i], /* bin ceiling */
- m->count, /* metadata reads */
- r->count, /* raw data reads */
- bm_val, bm_suffix, /* metadata bytes */
- br_val, br_suffix, /* raw data bytes */
- am_val, am_suffix, /* metadata average */
- ar_val, ar_suffix); /* raw data average */
+ suffixes[suffix_i], /* Bin ceiling */
+ m->count, /* Metadata reads */
+ r->count, /* Raw data reads */
+ bm_val, bm_suffix, /* Metadata bytes */
+ br_val, br_suffix, /* Raw data bytes */
+ am_val, am_suffix, /* Metadata average */
+ ar_val, ar_suffix); /* Raw data average */
fflush(stream);
}
@@ -1311,17 +1208,11 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file)
#endif /* ROS3_STATS */
/*-------------------------------------------------------------------------
+ * Function: H5FD__ros3_close
*
- * Function: H5FD__ros3_close()
- *
- * Purpose:
- *
- * Close an HDF5 file.
- *
- * Return:
- *
- * SUCCEED/FAIL
+ * Purpose: Close the file.
*
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1336,7 +1227,6 @@ H5FD__ros3_close(H5FD_t H5_ATTR_UNUSED *_file)
fprintf(stdout, "H5FD__ros3_close() called.\n");
#endif
- /* Sanity checks */
assert(file != NULL);
assert(file->s3r_handle != NULL);
@@ -1344,10 +1234,9 @@ H5FD__ros3_close(H5FD_t H5_ATTR_UNUSED *_file)
/* TODO: mechanism to re-target stats printout */
if (ros3_fprint_stats(stdout, file) == FAIL)
HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, "problem while writing file statistics");
-#endif /* ROS3_STATS */
+#endif
- /* 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, "unable to close S3 request handle");
@@ -1356,36 +1245,31 @@ H5FD__ros3_close(H5FD_t H5_ATTR_UNUSED *_file)
file = H5FL_FREE(H5FD_ros3_t, file);
done:
- curl_global_cleanup(); /* cleanup to answer init on open */
+ curl_global_cleanup();
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__ros3_close() */
/*-------------------------------------------------------------------------
+ * Function: H5FD__ros3_cmp
*
- * Function: H5FD__ros3_cmp()
+ * Purpose: Compares two files belonging to this driver using an
+ * arbitrary (but consistent) ordering:
*
- * Purpose:
+ * + url scheme
+ * + url host
+ * + url port
+ * + url path
+ * + url query
+ * + fapl aws_region
+ * + fapl secret_id
+ * + fapl secret_key
*
- * Compares two files belonging to this driver using an arbitrary
- * (but consistent) ordering:
- *
- * + url scheme
- * + url host
- * + url port
- * + url path
- * + url query
- * + fapl aws_region
- * + fapl secret_id
- * + fapl secret_key
- *
- * tl;dr -> check URL, check credentials
- *
- * Return:
- *
- * - Equivalent: 0
- * - Not Equivalent: -1
+ * TODO: This should return -1/0/1 like the other VFDs
*
+ * Return: Equivalent: 0
+ * Not Equivalent: -1
+ * (Can't fail)
*-------------------------------------------------------------------------
*/
static int
@@ -1493,14 +1377,7 @@ H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
* 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
- * are irrelevant.
- *
- * The term "set" is highly misleading...
- * stores/copies the supported flags in the out-pointer `flags`.
- *
* Return: SUCCEED (Can't fail)
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1512,30 +1389,27 @@ H5FD__ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags)
fprintf(stdout, "H5FD__ros3_query() called.\n");
#endif
- /* Set the VFL feature flags that this driver supports */
+ /* Set the VFL feature flags that this driver supports
+ *
+ * Since the ros3 VFD is read-only, many flags are irrelevant.
+ */
if (flags) {
*flags = 0;
/* OK to perform data sieving for faster raw data reads & writes */
*flags |= H5FD_FEAT_DATA_SIEVE;
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5FD__ros3_query() */
/*-------------------------------------------------------------------------
+ * Function: H5FD__ros3_get_eoa
*
- * Function: H5FD__ros3_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.
- *
- * Return:
- *
- * The end-of-address marker.
+ * 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: The end-of-address marker (Can't fail)
*-------------------------------------------------------------------------
*/
static haddr_t
@@ -1553,17 +1427,11 @@ H5FD__ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
} /* end H5FD__ros3_get_eoa() */
/*-------------------------------------------------------------------------
+ * Function: H5FD__ros3_set_eoa
*
- * Function: H5FD__ros3_set_eoa()
- *
- * Purpose:
- *
- * Set the end-of-address marker for the file.
- *
- * Return:
- *
- * SUCCEED (can't fail)
+ * Purpose: Set the end-of-address marker for the file.
*
+ * Return: SUCCEED (can't fail)
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1583,18 +1451,12 @@ H5FD__ros3_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr)
} /* H5FD__ros3_set_eoa() */
/*-------------------------------------------------------------------------
+ * Function: H5FD__ros3_get_eof
*
- * Function: H5FD__ros3_get_eof()
- *
- * Purpose:
- *
- * Returns the end-of-file marker.
- *
- * Return:
- *
- * EOF: the first address past the end of the "file", either the
- * filesystem file or the HDF5 file.
+ * Purpose: Returns the end-of-file marker.
*
+ * Return: End of file address, the first address past the end of the
+ * "file". (Can't fail)
*-------------------------------------------------------------------------
*/
static haddr_t
@@ -1612,17 +1474,11 @@ H5FD__ros3_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
} /* end H5FD__ros3_get_eof() */
/*-------------------------------------------------------------------------
+ * Function: H5FD__ros3_get_handle
*
- * Function: H5FD__ros3_get_handle()
- *
- * Purpose:
- *
- * Returns the S3 Request handle (s3r_t) of ros3 file driver.
- *
- * Returns:
- *
- * SUCCEED/FAIL
+ * Purpose: Returns the S3 Request handle (s3r_t) of ros3 file driver.
*
+ * Returns: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1647,22 +1503,13 @@ H5FD__ros3_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_hand
} /* end H5FD__ros3_get_handle() */
/*-------------------------------------------------------------------------
+ * Function: H5FD__ros3_read
*
- * Function: H5FD__ros3_read()
- *
- * Purpose
- *
- * Reads SIZE bytes of data from FILE beginning at address ADDR
- * into buffer BUF according to data transfer properties in DXPL_ID.
- *
- * Return:
- *
- * Success: `SUCCEED`
- * - Result is stored in caller-supplied buffer BUF.
- * Failure: `FAIL`
- * - Unable to complete read.
- * - Contents of buffer `buf` are undefined.
+ * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR
+ * into buffer BUF according to data transfer properties in
+ * DXPL_ID.
*
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1676,7 +1523,7 @@ H5FD__ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
/* working variables for storing stats */
ros3_statsbin *bin = NULL;
unsigned bin_i = 0;
-#endif /* ROS3_STATS */
+#endif
FUNC_ENTER_PACKAGE
@@ -1705,7 +1552,6 @@ H5FD__ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to execute read");
#if ROS3_STATS
-
/* 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])
@@ -1725,8 +1571,7 @@ H5FD__ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
}
bin->count++;
bin->bytes += (unsigned long long)size;
-
-#endif /* ROS3_STATS */
+#endif
}
done:
@@ -1734,18 +1579,13 @@ H5FD__ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
} /* end H5FD__ros3_read() */
/*-------------------------------------------------------------------------
+ * Function: H5FD__ros3_write
*
- * Function: H5FD__ros3_write()
- *
- * Purpose:
- *
- * Write bytes to file.
- * UNSUPPORTED IN READ-ONLY ROS3 VFD.
+ * Purpose: Write bytes to file
*
- * Return:
- *
- * FAIL (Not possible with Read-Only S3 file.)
+ * UNSUPPORTED IN READ-ONLY ROS3 VFD.
*
+ * Return: FAIL (Not possible with Read-Only S3 file)
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1767,20 +1607,14 @@ H5FD__ros3_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, h
} /* H5FD__ros3_write() */
/*-------------------------------------------------------------------------
+ * Function: H5FD__ros3_truncate
*
- * Function: H5FD__ros3_truncate()
- *
- * Purpose:
- *
- * Makes sure that the true file size is the same (or larger)
- * than the end-of-address.
- *
- * NOT POSSIBLE ON READ-ONLY S3 FILES.
- *
- * Return:
+ * Purpose: Makes sure that the true file size is the same (or larger)
+ * than the end-of-address.
*
- * FAIL (Not possible on Read-Only S3 files.)
+ * NOT POSSIBLE ON READ-ONLY S3 FILES
*
+ * Return: FAIL (Not possible on Read-Only S3 files)
*-------------------------------------------------------------------------
*/
static herr_t
From 2f98dfe38da60606819f0299777a9d93d7322fd0 Mon Sep 17 00:00:00 2001
From: Dana Robinson <43805+derobins@users.noreply.github.com>
Date: Tue, 18 Jun 2024 10:05:16 -0700
Subject: [PATCH 17/45] Rename INSTALL_Auto.txt to INSTALL_Autotools.txt
(#4575)
---
release_docs/{INSTALL_Auto.txt => INSTALL_Autotools.txt} | 0
release_docs/INSTALL_CMake.txt | 2 +-
release_docs/INSTALL_Cygwin.txt | 2 +-
3 files changed, 2 insertions(+), 2 deletions(-)
rename release_docs/{INSTALL_Auto.txt => INSTALL_Autotools.txt} (100%)
diff --git a/release_docs/INSTALL_Auto.txt b/release_docs/INSTALL_Autotools.txt
similarity index 100%
rename from release_docs/INSTALL_Auto.txt
rename to release_docs/INSTALL_Autotools.txt
diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt
index 55761bc32c2..4000861da8e 100644
--- a/release_docs/INSTALL_CMake.txt
+++ b/release_docs/INSTALL_CMake.txt
@@ -1186,7 +1186,7 @@ See RELEASE.txt in the release_notes/ directory for the list of platforms
tested for this release.
Instructions for building and testing HDF5 using autotools can be found in the
-INSTALL_Auto.txt file found in this folder.
+INSTALL_Autotools.txt file found in this folder.
========================================================================
diff --git a/release_docs/INSTALL_Cygwin.txt b/release_docs/INSTALL_Cygwin.txt
index c246915d5d1..c1ca7e848a7 100644
--- a/release_docs/INSTALL_Cygwin.txt
+++ b/release_docs/INSTALL_Cygwin.txt
@@ -119,7 +119,7 @@ Build, Test and Install HDF5 on Cygwin
4. Configuring
- Notes: See detailed information in hdf5/release_docs/INSTALL_Auto.txt.
+ Notes: See detailed information in hdf5/release_docs/INSTALL_Autotools.txt.
The host configuration file for Cygwin is located
in the `config' directory and are based on architecture name,
From d73dcf77fdfa1416b08143e38c1978d089f57447 Mon Sep 17 00:00:00 2001
From: Dana Robinson <43805+derobins@users.noreply.github.com>
Date: Tue, 18 Jun 2024 11:50:27 -0700
Subject: [PATCH 18/45] Clean up ros3 VFD stats code (#4579)
* Removes printf debugging
* Simplifies and centralizes stats code
* Use #ifdef ROS3_STATS instead of #if
* Other misc tidying
---
src/H5FDros3.c | 1036 +++++++++++++++++++++---------------------------
1 file changed, 457 insertions(+), 579 deletions(-)
diff --git a/src/H5FDros3.c b/src/H5FDros3.c
index d3fcd1536af..108f240142a 100644
--- a/src/H5FDros3.c
+++ b/src/H5FDros3.c
@@ -13,10 +13,8 @@
/*
* Read-Only S3 Virtual File Driver (VFD)
*
- * Purpose:
- *
- * Provide read-only access to files hosted on Amazon's S3 service.
- * Relies on "s3comms" utility layer to implement the AWS REST API.
+ * Provides read-only access to files hosted on Amazon's S3 service.
+ * Relies on "s3comms" utility layer to implement the AWS REST API.
*/
#ifdef H5_HAVE_ROS3_VFD
@@ -35,15 +33,8 @@
#ifdef H5_HAVE_ROS3_VFD
-/* Set debug output level */
-#define ROS3_DEBUG_NONE 0
-#define ROS3_DEBUG_TRACE_API 1
-#define ROS3_DEBUG_TRACE_INTERNAL 2
-#define ROS3_DEBUG ROS3_DEBUG_NONE
-
-/* toggle stats collection and reporting
- */
-#define ROS3_STATS 0
+/* Define to turn on stats collection and reporting */
+#define ROS3_STATS
/* Max size of the cache, in bytes */
#define ROS3_MAX_CACHE_SIZE 16777216
@@ -54,71 +45,28 @@ static hid_t H5FD_ROS3_g = 0;
/* Session/security token property name */
#define ROS3_TOKEN_PROP_NAME "ros3_token_prop"
-#if ROS3_STATS
+#ifdef ROS3_STATS
-/* Arbitrarily large value, such that any reasonable size read will be "less"
- * than this value and set a true minimum
- *
- * Not 0 because that may be a valid recorded minimum in degenerate cases
+/* The ros3 VFD can collect some simple I/O stats on a per-file basis. These
+ * are stored in arrays of bins (one for data and one for metadata) in the the
+ * VFD's file structure. Each bin contains stats for I/O operations of a given
+ * I/O size range. The bin boundaries are kept in a global "bin boundaries"
+ * array that is initialized at VFD startup and does not change.
*/
-#define ROS3_STATS_STARTING_MIN 0xfffffffful
-/* Configuration definitions for stats collection and breakdown
- *
- * 2^10 = 1024
- * Reads up to 1024 bytes (1 kB) fall in bin 0
- * 2^(10+(1*16)) = 2^26 = 64MB
- * Reads of 64MB or greater fall in "overflow" bin[BIN_COUNT]
- */
-#define ROS3_STATS_BASE 2
-#define ROS3_STATS_INTERVAL 1
-#define ROS3_STATS_START_POWER 10
-#define ROS3_STATS_BIN_COUNT 16 /* MUST BE GREATER THAN 0 */
-
-/* Calculate `BASE ^ (START_POWER + (INTERVAL * bin_i))`
- * Stores result at `(unsigned long long *) out_ptr`.
- * Used in computing boundaries between stats bins.
- */
-#define ROS3_STATS_POW(bin_i, out_ptr) \
- { \
- unsigned long long donotshadowresult = 1; \
- unsigned donotshadowindex = 0; \
- for (donotshadowindex = 0; \
- donotshadowindex < (((bin_i)*ROS3_STATS_INTERVAL) + ROS3_STATS_START_POWER); \
- donotshadowindex++) { \
- donotshadowresult *= ROS3_STATS_BASE; \
- } \
- *(out_ptr) = donotshadowresult; \
- }
+/* Number of bins */
+#define ROS3_STATS_BIN_COUNT 16
/* Array to hold pre-computed boundaries for stats bins */
-static unsigned long long ros3_stats_boundaries[ROS3_STATS_BIN_COUNT];
+static uint64_t ros3_stats_boundaries_g[ROS3_STATS_BIN_COUNT];
-/***************************************************************************
- * Structure for storing per-file ros3 VFD usage statistics.
- *
- * `count` (unsigned long long)
- *
- * Number of reads with size in this bin's range.
- *
- * `bytes` (unsigned long long)
- *
- * Total number of bytes read through this bin.
- *
- * `min` (unsigned long long)
- *
- * Smallest read size in this bin.
- *
- * `max` (unsigned long long)
- *
- * Largest read size in this bin.
- ***************************************************************************/
-typedef struct {
- unsigned long long count;
- unsigned long long bytes;
- unsigned long long min;
- unsigned long long max;
-} ros3_statsbin;
+/* Structure for storing per-file usage statistics */
+typedef struct H5FD_ros3_stats_bin {
+ uint64_t count; /* # of reads with size in this bin's range */
+ uint64_t bytes; /* Total bytes read in this bin */
+ uint64_t min; /* Smallest read size in this bin */
+ uint64_t max; /* Largest read size in this bin */
+} H5FD_ros3_stats_bin_t;
#endif /* ROS3_STATS */
@@ -148,14 +96,13 @@ typedef struct {
* 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 ***
+ * *** present only if ROS3_SATS is set to enable stats collection ***
*
- * `meta` (ros3_statsbin[])
- * `raw` (ros3_statsbin[])
+ * `meta` (H5FD_ros3_stats_bin_t[])
+ * `raw` (H5FD_ros3_stats_bin_t[])
*
- * Only present if ros3 stats collection is enabled.
- *
- * Arrays of `ros3_statsbin` structures to record raw- and metadata reads.
+ * Arrays of `H5FD_ros3_stats_bin_t` structures to record raw- and
+ * metadata reads.
*
* Records count and size of reads performed by the VFD, and is used to
* print formatted usage statistics to stdout upon VFD shutdown.
@@ -173,9 +120,9 @@ typedef struct H5FD_ros3_t {
s3r_t *s3r_handle;
uint8_t *cache;
size_t cache_size;
-#if ROS3_STATS
- ros3_statsbin meta[ROS3_STATS_BIN_COUNT + 1];
- ros3_statsbin raw[ROS3_STATS_BIN_COUNT + 1];
+#ifdef ROS3_STATS
+ H5FD_ros3_stats_bin_t meta[ROS3_STATS_BIN_COUNT + 1];
+ H5FD_ros3_stats_bin_t raw[ROS3_STATS_BIN_COUNT + 1];
#endif
} H5FD_ros3_t;
@@ -217,6 +164,12 @@ static int H5FD__ros3_str_token_cmp(const void *_value1, const void *_value2,
static herr_t H5FD__ros3_str_token_close(const char *name, size_t size, void *_value);
static herr_t H5FD__ros3_str_token_delete(hid_t prop_id, const char *name, size_t size, void *_value);
+#ifdef ROS3_STATS
+static herr_t H5FD__ros3_reset_stats(H5FD_ros3_t *file);
+static herr_t H5FD__ros3_log_read_stats(H5FD_ros3_t *file, H5FD_mem_t type, uint64_t size);
+static herr_t H5FD__ros3_print_stats(FILE *stream, const H5FD_ros3_t *file);
+#endif
+
static const H5FD_class_t H5FD_ros3_g = {
H5FD_CLASS_VERSION, /* struct version */
H5FD_ROS3_VALUE, /* value */
@@ -277,30 +230,19 @@ hid_t
H5FD_ros3_init(void)
{
hid_t ret_value = H5I_INVALID_HID;
-#if ROS3_STATS
- unsigned int bin_i;
-#endif
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
-#if ROS3_DEBUG
- fprintf(stdout, "H5FD_ros3_init() called.\n");
-#endif
-
if (H5I_VFL != H5I_get_type(H5FD_ROS3_g)) {
H5FD_ROS3_g = H5FD_register(&H5FD_ros3_g, sizeof(H5FD_class_t), false);
if (H5I_INVALID_HID == H5FD_ROS3_g) {
HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register ros3");
}
-#if ROS3_STATS
- /* Pre-compute statsbin boundaries */
- for (bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) {
- unsigned long long value = 0;
-
- ROS3_STATS_POW(bin_i, &value)
- ros3_stats_boundaries[bin_i] = value;
- }
+#ifdef ROS3_STATS
+ /* Pre-compute stats bin boundaries on powers of 2 >= 10 */
+ for (int i = 0; i < ROS3_STATS_BIN_COUNT; i++)
+ ros3_stats_boundaries_g[i] = 1 << (10 + i);
#endif
}
@@ -323,10 +265,6 @@ H5FD__ros3_term(void)
{
FUNC_ENTER_PACKAGE_NOERR
-#if ROS3_DEBUG
- fprintf(stdout, "H5FD__ros3_term() called.\n");
-#endif
-
/* Reset VFL ID */
H5FD_ROS3_g = 0;
@@ -352,10 +290,6 @@ H5Pset_fapl_ros3(hid_t fapl_id, const H5FD_ros3_fapl_t *fa)
assert(fa != NULL);
-#if ROS3_DEBUG
- fprintf(stdout, "H5Pset_fapl_ros3() called.\n");
-#endif
-
plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS);
if (plist == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
@@ -416,10 +350,6 @@ H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_dst /*out*/)
FUNC_ENTER_API(FAIL)
-#if ROS3_DEBUG
- fprintf(stdout, "H5Pget_fapl_ros3() called.\n");
-#endif
-
if (fa_dst == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_dst is NULL");
@@ -553,10 +483,6 @@ H5Pget_fapl_ros3_token(hid_t fapl_id, size_t size, char *token_dst /*out*/)
FUNC_ENTER_API(FAIL)
-#if ROS3_DEBUG
- fprintf(stdout, "H5Pget_fapl_ros3_token() called.\n");
-#endif
-
if (size == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size cannot be zero.");
if (token_dst == NULL)
@@ -601,10 +527,6 @@ H5FD__ros3_str_token_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED
FUNC_ENTER_PACKAGE
-#if ROS3_DEBUG
- fprintf(stdout, "H5FD__ros3_str_token_copy() called.\n");
-#endif
-
if (*value)
if (NULL == (*value = strdup(*value)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't copy string property token");
@@ -716,10 +638,6 @@ H5Pset_fapl_ros3_token(hid_t fapl_id, const char *token)
FUNC_ENTER_API(FAIL)
-#if ROS3_DEBUG
- fprintf(stdout, "H5Pset_fapl_ros3_token() called.\n");
-#endif
-
if (fapl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list");
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
@@ -754,47 +672,6 @@ H5Pset_fapl_ros3_token(hid_t fapl_id, const char *token)
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_fapl_ros3_token() */
-#if ROS3_STATS
-/*----------------------------------------------------------------------------
- * Function: ros3_reset_stats
- *
- * Purpose: Reset the collected statistics
- *
- * Return: SUCCEED/FAIL
- *----------------------------------------------------------------------------
- */
-static herr_t
-ros3_reset_stats(H5FD_ros3_t *file)
-{
- unsigned i = 0;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_PACKAGE
-
-#if ROS3_DEBUG >= ROS3_DEBUG_TRACE_INTERNAL
- printf("ros3_reset_stats() called\n");
-#endif
-
- if (file == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file was null");
-
- for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) {
- file->raw[i].bytes = 0;
- file->raw[i].count = 0;
- file->raw[i].min = (unsigned long long)ROS3_STATS_STARTING_MIN;
- file->raw[i].max = 0;
-
- file->meta[i].bytes = 0;
- file->meta[i].count = 0;
- file->meta[i].min = (unsigned long long)ROS3_STATS_STARTING_MIN;
- file->meta[i].max = 0;
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end ros3_reset_stats() */
-#endif /* ROS3_STATS */
-
/*-------------------------------------------------------------------------
* Function: H5FD__ros3_open
*
@@ -830,10 +707,6 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
FUNC_ENTER_PACKAGE
-#if ROS3_DEBUG
- fprintf(stdout, "H5FD__ros3_open() called.\n");
-#endif
-
/* Sanity check on file offsets */
HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t));
@@ -905,8 +778,8 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
file->s3r_handle = handle;
H5MM_memcpy(&(file->fa), &fa, sizeof(H5FD_ros3_fapl_t));
-#if ROS3_STATS
- if (FAIL == ros3_reset_stats(file))
+#ifdef ROS3_STATS
+ if (FAIL == H5FD__ros3_reset_stats(file))
HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, "unable to reset file statistics");
#endif
@@ -939,383 +812,106 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__ros3_open() */
-#if ROS3_STATS
-/*----------------------------------------------------------------------------
- * Function: ros3_fprint_stats
- *
- * Purpose: Tabulate and pretty-print statistics for this virtual file.
- *
- * Should be called upon file close.
- *
- * Shows number of reads and bytes read, broken down by
- * "raw" (H5FD_MEM_DRAW)
- * or "meta" (any other flag)
- *
- * Prints filename and listing of total number of reads and bytes read,
- * both as a grand total and separate meta- and raw data reads.
- *
- * If any reads were done, prints out two tables:
- *
- * 1. overview of raw- and metadata reads
- * - min (smallest size read)
- * - average of size read
- * - k,M,G suffixes by powers of 1024 (2^10)
- * - 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
- * 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)
- * is divied by powers of 1024. By corollary, four digits before the decimal
- * is valid.
+/*-------------------------------------------------------------------------
+ * Function: H5FD__ros3_close
*
- * - 41080 bytes is represented by 40.177k, not 41.080k
- * - 1004.831M represents approx. 1052642000 bytes
+ * Purpose: Close the file.
*
* Return: SUCCEED/FAIL
- *----------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*/
static herr_t
-ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file)
+H5FD__ros3_close(H5FD_t H5_ATTR_UNUSED *_file)
{
- herr_t ret_value = SUCCEED;
- parsed_url_t *purl = NULL;
- unsigned i = 0;
- unsigned long count_meta = 0;
- unsigned long count_raw = 0;
- double average_meta = 0.0;
- double average_raw = 0.0;
- unsigned long long min_meta = (unsigned long long)ROS3_STATS_STARTING_MIN;
- unsigned long long min_raw = (unsigned long long)ROS3_STATS_STARTING_MIN;
- unsigned long long max_meta = 0;
- unsigned long long max_raw = 0;
- unsigned long long bytes_raw = 0;
- unsigned long long bytes_meta = 0;
- double re_dub = 0.0; /* reusable double variable */
- unsigned suffix_i = 0;
- const char suffixes[] = {' ', 'K', 'M', 'G', 'T', 'P'};
+ H5FD_ros3_t *file = (H5FD_ros3_t *)_file;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
- if (stream == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file stream cannot be null");
- if (file == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file cannot be null");
- if (file->s3r_handle == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "s3 request handle cannot be null");
- if (file->s3r_handle->purl == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "parsed url structure cannot be null");
- purl = file->s3r_handle->purl;
+ assert(file != NULL);
+ assert(file->s3r_handle != NULL);
- /******************
- * PRINT FILENAME *
- ******************/
+#ifdef ROS3_STATS
+ if (H5FD__ros3_print_stats(stdout, file) == FAIL)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, "problem while writing file statistics");
+#endif
- fprintf(stream, "stats for %s://%s", purl->scheme, purl->host);
- if (purl->port != NULL && purl->port[0] != '\0')
- fprintf(stream, ":%s", purl->port);
- if (purl->query != NULL && purl->query[0] != '\0') {
- if (purl->path != NULL && purl->path[0] != '\0')
- fprintf(stream, "/%s", purl->path);
- else
- fprintf(stream, "/");
- fprintf(stream, "?%s", purl->query);
- }
- else if (purl->path != NULL && purl->path[0] != '\0') {
- fprintf(stream, "/%s", purl->path);
- }
- fprintf(stream, "\n");
+ /* Close the underlying request handle */
+ if (FAIL == H5FD_s3comms_s3r_close(file->s3r_handle))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close S3 request handle");
- /*******************
- * AGGREGATE STATS *
- *******************/
+ /* Release the file info */
+ H5MM_xfree(file->cache);
+ file = H5FL_FREE(H5FD_ros3_t, file);
- for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) {
- const ros3_statsbin *r = &file->raw[i];
- const ros3_statsbin *m = &file->meta[i];
+done:
+ curl_global_cleanup();
- 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;
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__ros3_close() */
- 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;
+/*-------------------------------------------------------------------------
+ * Function: H5FD__ros3_cmp
+ *
+ * Purpose: Compares two files belonging to this driver using an
+ * arbitrary (but consistent) ordering:
+ *
+ * + url scheme
+ * + url host
+ * + url port
+ * + url path
+ * + url query
+ * + fapl aws_region
+ * + fapl secret_id
+ * + fapl secret_key
+ *
+ * TODO: This should return -1/0/1 like the other VFDs
+ *
+ * Return: Equivalent: 0
+ * Not Equivalent: -1
+ * (Can't fail)
+ *-------------------------------------------------------------------------
+ */
+static int
+H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
+{
+ 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;
+ int ret_value = 0;
- /******************
- * PRINT OVERVIEW *
- ******************/
+ FUNC_ENTER_PACKAGE_NOERR
- fprintf(stream, "TOTAL READS: %lu (%lu meta, %lu raw)\n", count_raw + count_meta, count_meta, count_raw);
- fprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", bytes_raw + bytes_meta, bytes_meta,
- bytes_raw);
+ assert(f1->s3r_handle != NULL);
+ assert(f2->s3r_handle != NULL);
- if (count_raw + count_meta == 0)
- goto done;
+ purl1 = (const parsed_url_t *)f1->s3r_handle->purl;
+ purl2 = (const parsed_url_t *)f2->s3r_handle->purl;
+ assert(purl1 != NULL);
+ assert(purl2 != NULL);
+ assert(purl1->scheme != NULL);
+ assert(purl2->scheme != NULL);
+ assert(purl1->host != NULL);
+ assert(purl2->host != NULL);
- /*************************
- * PRINT AGGREGATE STATS *
- *************************/
+ /* URL: SCHEME */
+ if (strcmp(purl1->scheme, purl2->scheme))
+ HGOTO_DONE(-1);
- fprintf(stream, "SIZES meta raw\n");
- fprintf(stream, " min ");
- if (count_meta == 0)
- fprintf(stream, " 0.000 ");
- else {
- re_dub = (double)min_meta;
- for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
- re_dub /= 1024.0;
- assert(suffix_i < sizeof(suffixes));
- fprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]);
- }
+ /* URL: HOST */
+ if (strcmp(purl1->host, purl2->host))
+ HGOTO_DONE(-1);
- if (count_raw == 0)
- fprintf(stream, " 0.000 \n");
- else {
- re_dub = (double)min_raw;
- for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
- re_dub /= 1024.0;
- assert(suffix_i < sizeof(suffixes));
- fprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]);
+ /* URL: PORT */
+ if (purl1->port && purl2->port) {
+ if (strcmp(purl1->port, purl2->port))
+ HGOTO_DONE(-1);
}
-
- fprintf(stream, " avg ");
- re_dub = (double)average_meta;
- for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
- re_dub /= 1024.0;
- assert(suffix_i < sizeof(suffixes));
- fprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]);
-
- re_dub = (double)average_raw;
- for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
- re_dub /= 1024.0;
- assert(suffix_i < sizeof(suffixes));
- fprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]);
-
- fprintf(stream, " max ");
- re_dub = (double)max_meta;
- for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
- re_dub /= 1024.0;
- assert(suffix_i < sizeof(suffixes));
- fprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]);
-
- re_dub = (double)max_raw;
- for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
- re_dub /= 1024.0;
- assert(suffix_i < sizeof(suffixes));
- fprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]);
-
- /******************************
- * PRINT INDIVIDUAL BIN STATS *
- ******************************/
-
- fprintf(stream, "BINS # of reads total bytes average size\n");
- fprintf(stream, " up-to meta raw meta raw meta raw\n");
-
- for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) {
- const ros3_statsbin *m;
- const ros3_statsbin *r;
- unsigned long long range_end = 0;
- char bm_suffix = ' '; /* bytes-meta */
- double bm_val = 0.0;
- char br_suffix = ' '; /* bytes-raw */
- double br_val = 0.0;
- char am_suffix = ' '; /* average-meta */
- double am_val = 0.0;
- char ar_suffix = ' '; /* average-raw */
- double ar_val = 0.0;
-
- m = &file->meta[i];
- r = &file->raw[i];
- if (r->count == 0 && m->count == 0)
- continue;
-
- range_end = ros3_stats_boundaries[i];
-
- if (i == ROS3_STATS_BIN_COUNT) {
- range_end = ros3_stats_boundaries[i - 1];
- fprintf(stream, ">");
- }
- else
- fprintf(stream, " ");
-
- bm_val = (double)m->bytes;
- for (suffix_i = 0; bm_val >= 1024.0; suffix_i++)
- bm_val /= 1024.0;
- assert(suffix_i < sizeof(suffixes));
- bm_suffix = suffixes[suffix_i];
-
- br_val = (double)r->bytes;
- for (suffix_i = 0; br_val >= 1024.0; suffix_i++)
- br_val /= 1024.0;
- assert(suffix_i < sizeof(suffixes));
- br_suffix = suffixes[suffix_i];
-
- if (m->count > 0)
- am_val = (double)(m->bytes) / (double)(m->count);
- for (suffix_i = 0; am_val >= 1024.0; suffix_i++)
- am_val /= 1024.0;
- assert(suffix_i < sizeof(suffixes));
- am_suffix = suffixes[suffix_i];
-
- if (r->count > 0)
- ar_val = (double)(r->bytes) / (double)(r->count);
- for (suffix_i = 0; ar_val >= 1024.0; suffix_i++)
- ar_val /= 1024.0;
- assert(suffix_i < sizeof(suffixes));
- ar_suffix = suffixes[suffix_i];
-
- re_dub = (double)range_end;
- for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
- re_dub /= 1024.0;
- assert(suffix_i < sizeof(suffixes));
-
- fprintf(stream, " %8.3f%c %7llu %7llu %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub,
- suffixes[suffix_i], /* Bin ceiling */
- m->count, /* Metadata reads */
- r->count, /* Raw data reads */
- bm_val, bm_suffix, /* Metadata bytes */
- br_val, br_suffix, /* Raw data bytes */
- am_val, am_suffix, /* Metadata average */
- ar_val, ar_suffix); /* Raw data average */
-
- fflush(stream);
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-
-} /* ros3_fprint_stats */
-#endif /* ROS3_STATS */
-
-/*-------------------------------------------------------------------------
- * Function: H5FD__ros3_close
- *
- * Purpose: Close the file.
- *
- * Return: SUCCEED/FAIL
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5FD__ros3_close(H5FD_t H5_ATTR_UNUSED *_file)
-{
- H5FD_ros3_t *file = (H5FD_ros3_t *)_file;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_PACKAGE
-
-#if ROS3_DEBUG
- fprintf(stdout, "H5FD__ros3_close() called.\n");
-#endif
-
- assert(file != NULL);
- assert(file->s3r_handle != NULL);
-
-#if ROS3_STATS
- /* TODO: mechanism to re-target stats printout */
- if (ros3_fprint_stats(stdout, file) == FAIL)
- HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, "problem while writing file statistics");
-#endif
-
- /* Close the underlying request handle */
- if (FAIL == H5FD_s3comms_s3r_close(file->s3r_handle))
- HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close S3 request handle");
-
- /* Release the file info */
- H5MM_xfree(file->cache);
- file = H5FL_FREE(H5FD_ros3_t, file);
-
-done:
- curl_global_cleanup();
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD__ros3_close() */
-
-/*-------------------------------------------------------------------------
- * Function: H5FD__ros3_cmp
- *
- * Purpose: Compares two files belonging to this driver using an
- * arbitrary (but consistent) ordering:
- *
- * + url scheme
- * + url host
- * + url port
- * + url path
- * + url query
- * + fapl aws_region
- * + fapl secret_id
- * + fapl secret_key
- *
- * TODO: This should return -1/0/1 like the other VFDs
- *
- * Return: Equivalent: 0
- * Not Equivalent: -1
- * (Can't fail)
- *-------------------------------------------------------------------------
- */
-static int
-H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
-{
- 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;
- int ret_value = 0;
-
- FUNC_ENTER_PACKAGE_NOERR
-
-#if ROS3_DEBUG
- fprintf(stdout, "H5FD__ros3_cmp() called.\n");
-#endif
-
- assert(f1->s3r_handle != NULL);
- assert(f2->s3r_handle != NULL);
-
- purl1 = (const parsed_url_t *)f1->s3r_handle->purl;
- purl2 = (const parsed_url_t *)f2->s3r_handle->purl;
- assert(purl1 != NULL);
- assert(purl2 != NULL);
- assert(purl1->scheme != NULL);
- assert(purl2->scheme != NULL);
- assert(purl1->host != NULL);
- assert(purl2->host != NULL);
-
- /* URL: SCHEME */
- if (strcmp(purl1->scheme, purl2->scheme))
- HGOTO_DONE(-1);
-
- /* URL: HOST */
- if (strcmp(purl1->host, purl2->host))
- HGOTO_DONE(-1);
-
- /* URL: PORT */
- if (purl1->port && purl2->port) {
- if (strcmp(purl1->port, purl2->port))
- HGOTO_DONE(-1);
- }
- else if (purl1->port)
- HGOTO_DONE(-1);
- else if (purl2->port)
- HGOTO_DONE(-1);
+ else if (purl1->port)
+ HGOTO_DONE(-1);
+ else if (purl2->port)
+ HGOTO_DONE(-1);
/* URL: PATH */
if (purl1->path && purl2->path) {
@@ -1385,10 +981,6 @@ H5FD__ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags)
{
FUNC_ENTER_PACKAGE_NOERR
-#if ROS3_DEBUG >= ROS3_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "H5FD__ros3_query() called.\n");
-#endif
-
/* Set the VFL feature flags that this driver supports
*
* Since the ros3 VFD is read-only, many flags are irrelevant.
@@ -1419,10 +1011,6 @@ H5FD__ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
FUNC_ENTER_PACKAGE_NOERR
-#if ROS3_DEBUG >= ROS3_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "H5FD__ros3_get_eoa() called.\n");
-#endif
-
FUNC_LEAVE_NOAPI(file->eoa)
} /* end H5FD__ros3_get_eoa() */
@@ -1441,10 +1029,6 @@ H5FD__ros3_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr)
FUNC_ENTER_PACKAGE_NOERR
-#if ROS3_DEBUG >= ROS3_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "H5FD__ros3_set_eoa() called.\n");
-#endif
-
file->eoa = addr;
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -1466,10 +1050,6 @@ H5FD__ros3_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
FUNC_ENTER_PACKAGE_NOERR
-#if ROS3_DEBUG >= ROS3_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "H5FD__ros3_get_eof() called.\n");
-#endif
-
FUNC_LEAVE_NOAPI(H5FD_s3comms_s3r_get_filesize(file->s3r_handle))
} /* end H5FD__ros3_get_eof() */
@@ -1489,10 +1069,6 @@ H5FD__ros3_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_hand
FUNC_ENTER_PACKAGE
-#if ROS3_DEBUG
- fprintf(stdout, "H5FD__ros3_get_handle() called.\n");
-#endif
-
if (!file_handle)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid");
@@ -1519,18 +1095,9 @@ H5FD__ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
H5FD_ros3_t *file = (H5FD_ros3_t *)_file;
size_t filesize = 0;
herr_t ret_value = SUCCEED;
-#if ROS3_STATS
- /* working variables for storing stats */
- ros3_statsbin *bin = NULL;
- unsigned bin_i = 0;
-#endif
FUNC_ENTER_PACKAGE
-#if ROS3_DEBUG
- fprintf(stdout, "H5FD__ros3_read() called.\n");
-#endif
-
assert(file);
assert(file->cache);
assert(file->s3r_handle);
@@ -1551,26 +1118,9 @@ H5FD__ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
if (H5FD_s3comms_s3r_read(file->s3r_handle, addr, size, buf) == FAIL)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to execute read");
-#if ROS3_STATS
- /* 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])
- break;
- bin = (type == H5FD_MEM_DRAW) ? &file->raw[bin_i] : &file->meta[bin_i];
-
- /* 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;
- }
- bin->count++;
- bin->bytes += (unsigned long long)size;
+#ifdef ROS3_STATS
+ if (H5FD__ros3_log_read_stats(file, type, (uint64_t)size) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "unable to log read stats");
#endif
}
@@ -1596,10 +1146,6 @@ H5FD__ros3_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, h
FUNC_ENTER_PACKAGE
-#if ROS3_DEBUG
- fprintf(stdout, "H5FD__ros3_write() called.\n");
-#endif
-
HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot write to read-only file.");
done:
@@ -1624,14 +1170,346 @@ H5FD__ros3_truncate(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED dxpl_id,
FUNC_ENTER_PACKAGE
-#if ROS3_DEBUG
- fprintf(stdout, "H5FD__ros3_truncate() called.\n");
-#endif
-
HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot truncate read-only file.");
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__ros3_truncate() */
+#ifdef ROS3_STATS
+/*----------------------------------------------------------------------------
+ * Function: H5FD__ros3_reset_stats
+ *
+ * Purpose: Reset the collected statistics
+ *
+ * Return: SUCCEED/FAIL
+ *----------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__ros3_reset_stats(H5FD_ros3_t *file)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
+
+ if (file == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file was null");
+
+ for (int i = 0; i <= ROS3_STATS_BIN_COUNT; i++) {
+ file->raw[i].bytes = 0;
+ file->raw[i].count = 0;
+ file->raw[i].min = 0;
+ file->raw[i].max = 0;
+
+ file->meta[i].bytes = 0;
+ file->meta[i].count = 0;
+ file->meta[i].min = 0;
+ file->meta[i].max = 0;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__ros3_reset_stats() */
+
+/*----------------------------------------------------------------------------
+ * Function: H5FD__ros3_log_read_stats
+ *
+ * Purpose: Add data for a read to the ros3 stats
+ *
+ * Return: SUCCEED/FAIL
+ *----------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__ros3_log_read_stats(H5FD_ros3_t *file, H5FD_mem_t type, uint64_t size)
+{
+ H5FD_ros3_stats_bin_t *bin = NULL;
+ int i = 0;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
+
+ if (file == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file was null");
+
+ /* Find which "bin" this read fits in */
+ for (i = 0; i < ROS3_STATS_BIN_COUNT; i++)
+ if (size < ros3_stats_boundaries_g[i])
+ break;
+ bin = (type == H5FD_MEM_DRAW) ? &file->raw[i] : &file->meta[i];
+
+ /* Store collected stats in appropriate bin */
+ bin->count++;
+ bin->bytes += size;
+ if (size < bin->min)
+ bin->min = size;
+ if (size > bin->max)
+ bin->max = size;
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__ros3_log_read_stats() */
+
+/*----------------------------------------------------------------------------
+ * Function: H5FD__ros3_print_stats
+ *
+ * Purpose: Tabulate and pretty-print statistics for this virtual file.
+ *
+ * Should be called upon file close.
+ *
+ * Shows number of reads and bytes read, broken down by
+ * "raw" (H5FD_MEM_DRAW) or "meta" (any other flag)
+ *
+ * Prints filename and listing of total number of reads and bytes read,
+ * both as a grand total and separate meta- and raw data reads.
+ *
+ * If any reads were done, prints out two tables:
+ *
+ * 1. overview of raw- and metadata reads
+ * - min (smallest size read)
+ * - average of size read
+ * - k,M,G suffixes by powers of 1024 (2^10)
+ * - 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
+ * separate sub-colums for raw- and metadata reads.
+ * - each row represents one bin, identified by the top of its range
+ *
+ * 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) is
+ * divied by powers of 1024. By corollary, four digits before the decimal
+ * is valid.
+ *
+ * - 41080 bytes is represented by 40.177k, not 41.080k
+ * - 1004.831M represents approx. 1052642000 bytes
+ *
+ * Return: SUCCEED/FAIL
+ *----------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__ros3_print_stats(FILE *stream, const H5FD_ros3_t *file)
+{
+ herr_t ret_value = SUCCEED;
+ parsed_url_t *purl = NULL;
+ unsigned i = 0;
+ unsigned long count_meta = 0;
+ unsigned long count_raw = 0;
+ double average_meta = 0.0;
+ double average_raw = 0.0;
+ uint64_t min_meta = 0;
+ uint64_t min_raw = 0;
+ uint64_t max_meta = 0;
+ uint64_t max_raw = 0;
+ uint64_t bytes_raw = 0;
+ uint64_t bytes_meta = 0;
+ double re_dub = 0.0; /* reusable double variable */
+ unsigned suffix_i = 0;
+ const char suffixes[] = {' ', 'K', 'M', 'G', 'T', 'P'};
+
+ FUNC_ENTER_PACKAGE
+
+ if (stream == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file stream cannot be null");
+ if (file == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file cannot be null");
+ if (file->s3r_handle == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "s3 request handle cannot be null");
+ 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 *
+ ******************/
+
+ fprintf(stream, "stats for %s://%s", purl->scheme, purl->host);
+ if (purl->port != NULL && purl->port[0] != '\0')
+ fprintf(stream, ":%s", purl->port);
+ if (purl->query != NULL && purl->query[0] != '\0') {
+ if (purl->path != NULL && purl->path[0] != '\0')
+ fprintf(stream, "/%s", purl->path);
+ else
+ fprintf(stream, "/");
+ fprintf(stream, "?%s", purl->query);
+ }
+ else if (purl->path != NULL && purl->path[0] != '\0') {
+ fprintf(stream, "/%s", purl->path);
+ }
+ fprintf(stream, "\n");
+
+ /*******************
+ * AGGREGATE STATS *
+ *******************/
+
+ for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) {
+ const H5FD_ros3_stats_bin_t *r = &file->raw[i];
+ const H5FD_ros3_stats_bin_t *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;
+
+ 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;
+
+ /******************
+ * PRINT OVERVIEW *
+ ******************/
+
+ fprintf(stream, "TOTAL READS: %lu (%lu meta, %lu raw)\n", count_raw + count_meta, count_meta, count_raw);
+ fprintf(stream, "TOTAL BYTES: %" PRIu64 " (%" PRIu64 " meta, %" PRIu64 " raw)\n", bytes_raw + bytes_meta,
+ bytes_meta, bytes_raw);
+
+ if (count_raw + count_meta == 0)
+ goto done;
+
+ /*************************
+ * PRINT AGGREGATE STATS *
+ *************************/
+
+ fprintf(stream, "SIZES meta raw\n");
+ fprintf(stream, " min ");
+ if (count_meta == 0)
+ fprintf(stream, " 0.000 ");
+ else {
+ re_dub = (double)min_meta;
+ for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
+ re_dub /= 1024.0;
+ assert(suffix_i < sizeof(suffixes));
+ fprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]);
+ }
+
+ if (count_raw == 0)
+ fprintf(stream, " 0.000 \n");
+ else {
+ re_dub = (double)min_raw;
+ for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
+ re_dub /= 1024.0;
+ assert(suffix_i < sizeof(suffixes));
+ fprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]);
+ }
+
+ fprintf(stream, " avg ");
+ re_dub = (double)average_meta;
+ for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
+ re_dub /= 1024.0;
+ assert(suffix_i < sizeof(suffixes));
+ fprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]);
+
+ re_dub = (double)average_raw;
+ for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
+ re_dub /= 1024.0;
+ assert(suffix_i < sizeof(suffixes));
+ fprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]);
+
+ fprintf(stream, " max ");
+ re_dub = (double)max_meta;
+ for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
+ re_dub /= 1024.0;
+ assert(suffix_i < sizeof(suffixes));
+ fprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]);
+
+ re_dub = (double)max_raw;
+ for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
+ re_dub /= 1024.0;
+ assert(suffix_i < sizeof(suffixes));
+ fprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]);
+
+ /******************************
+ * PRINT INDIVIDUAL BIN STATS *
+ ******************************/
+
+ fprintf(stream, "BINS # of reads total bytes average size\n");
+ fprintf(stream, " up-to meta raw meta raw meta raw\n");
+
+ for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) {
+ const H5FD_ros3_stats_bin_t *m;
+ const H5FD_ros3_stats_bin_t *r;
+ uint64_t range_end = 0;
+ char bm_suffix = ' '; /* bytes-meta */
+ double bm_val = 0.0;
+ char br_suffix = ' '; /* bytes-raw */
+ double br_val = 0.0;
+ char am_suffix = ' '; /* average-meta */
+ double am_val = 0.0;
+ char ar_suffix = ' '; /* average-raw */
+ double ar_val = 0.0;
+
+ m = &file->meta[i];
+ r = &file->raw[i];
+ if (r->count == 0 && m->count == 0)
+ continue;
+
+ range_end = ros3_stats_boundaries_g[i];
+
+ if (i == ROS3_STATS_BIN_COUNT) {
+ range_end = ros3_stats_boundaries_g[i - 1];
+ fprintf(stream, ">");
+ }
+ else
+ fprintf(stream, " ");
+
+ bm_val = (double)m->bytes;
+ for (suffix_i = 0; bm_val >= 1024.0; suffix_i++)
+ bm_val /= 1024.0;
+ assert(suffix_i < sizeof(suffixes));
+ bm_suffix = suffixes[suffix_i];
+
+ br_val = (double)r->bytes;
+ for (suffix_i = 0; br_val >= 1024.0; suffix_i++)
+ br_val /= 1024.0;
+ assert(suffix_i < sizeof(suffixes));
+ br_suffix = suffixes[suffix_i];
+
+ if (m->count > 0)
+ am_val = (double)(m->bytes) / (double)(m->count);
+ for (suffix_i = 0; am_val >= 1024.0; suffix_i++)
+ am_val /= 1024.0;
+ assert(suffix_i < sizeof(suffixes));
+ am_suffix = suffixes[suffix_i];
+
+ if (r->count > 0)
+ ar_val = (double)(r->bytes) / (double)(r->count);
+ for (suffix_i = 0; ar_val >= 1024.0; suffix_i++)
+ ar_val /= 1024.0;
+ assert(suffix_i < sizeof(suffixes));
+ ar_suffix = suffixes[suffix_i];
+
+ re_dub = (double)range_end;
+ for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
+ re_dub /= 1024.0;
+ assert(suffix_i < sizeof(suffixes));
+
+ fprintf(stream, " %8.3f%c %7" PRIu64 " %7" PRIu64 " %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub,
+ suffixes[suffix_i], /* Bin ceiling */
+ m->count, /* Metadata reads */
+ r->count, /* Raw data reads */
+ bm_val, bm_suffix, /* Metadata bytes */
+ br_val, br_suffix, /* Raw data bytes */
+ am_val, am_suffix, /* Metadata average */
+ ar_val, ar_suffix); /* Raw data average */
+
+ fflush(stream);
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+
+} /* H5FD__ros3_print_stats */
+#endif /* ROS3_STATS */
+
#endif /* H5_HAVE_ROS3_VFD */
From 3f9a03b3f9a29bcd6dc95e09254ebaacbbc0afb5 Mon Sep 17 00:00:00 2001
From: Dana Robinson <43805+derobins@users.noreply.github.com>
Date: Tue, 18 Jun 2024 14:15:30 -0700
Subject: [PATCH 19/45] Turn off ros3 VFD stat collection by default (#4581)
Not a new change - an artifact from a previous check-in.
---
src/H5FDros3.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/H5FDros3.c b/src/H5FDros3.c
index 108f240142a..6222fef8bf3 100644
--- a/src/H5FDros3.c
+++ b/src/H5FDros3.c
@@ -34,7 +34,7 @@
#ifdef H5_HAVE_ROS3_VFD
/* Define to turn on stats collection and reporting */
-#define ROS3_STATS
+/* #define ROS3_STATS */
/* Max size of the cache, in bytes */
#define ROS3_MAX_CACHE_SIZE 16777216
From d2a31935f6cfa218e9d56d0c3c74445500d7223d Mon Sep 17 00:00:00 2001
From: Quincey Koziol
Date: Tue, 18 Jun 2024 16:17:43 -0500
Subject: [PATCH 20/45] Pause recording errors instead of clearing the error
stack (#4475)
An internal capability that's similar to the H5E_BEGIN_TRY / H5E_END_TRY
macros in H5Epublic.h, but more efficient since we can avoid pushing errors on
the stack entirely (and those macros use public API routines).
This capability (and other techniques) can be used to remove use of
H5E_clear_stack() and H5E_BEGIN_TRY / H5E_END_TRY within library routines.
We want to remove H5E_clear_stack() because it can trigger calls to the H5I
interface from within the H5E code, which creates a great deal of complexity
for threadsafe code. And we want to remove H5E_BEGIN_TRY / H5E_END_TRY's
because they make public API calls from within the library code.
Also some other minor tidying in routines related to removing the use of
H5E_clear_stack() and H5E_BEGIN_TRY / H5E_END_TRY from H5Fint.c
---
bin/format_source | 6 +-
release_docs/RELEASE.txt | 971 +------------------------
src/H5Dvirtual.c | 10 +-
src/H5E.c | 179 ++++-
src/H5Edeprec.c | 49 +-
src/H5Eint.c | 124 +++-
src/H5Epkg.h | 1 +
src/H5Eprivate.h | 19 +
src/H5Epublic.h | 68 +-
src/H5FD.c | 102 ++-
src/H5FDonion.c | 73 +-
src/H5FDprivate.h | 3 +-
src/H5FDsplitter.c | 7 +-
src/H5FDsubfiling/H5FDsubfiling.c | 2 +-
src/H5FDsubfiling/H5subfiling_common.c | 2 +-
src/H5Fefc.c | 197 +++--
src/H5Fint.c | 339 +++++----
src/H5Fpkg.h | 11 +-
src/H5Fprivate.h | 5 +-
src/H5Lexternal.c | 4 +-
src/H5VLnative_file.c | 4 +-
test/efc.c | 964 ++++++++++++------------
test/error_test.c | 181 ++++-
23 files changed, 1437 insertions(+), 1884 deletions(-)
diff --git a/bin/format_source b/bin/format_source
index dea771ce7f4..c5aec15bf0f 100755
--- a/bin/format_source
+++ b/bin/format_source
@@ -25,10 +25,12 @@ find . \( -type d -path ./config -prune -and -not -path ./config \) \
-name H5LTanalyze.c \
-or -name H5LTparse.c \
-or -name H5LTparse.h \
- -or -name H5Epubgen.h \
+ -or -name H5Edefin.h \
-or -name H5Einit.h \
+ -or -name H5Emajdef.h \
+ -or -name H5Emindef.h \
+ -or -name H5Epubgen.h \
-or -name H5Eterm.h \
- -or -name H5Edefin.h \
-or -name H5version.h \
-or -name H5overflow.h \
\) \) \
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index bf0d0daed89..153c3ee944f 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -82,357 +82,21 @@ New Features
- Added configure options for enabling/disabling non-standard programming
language features
- * Added a new configuration option that allows enabling or disabling of
- support for features that are extensions to programming languages, such
- as support for the _Float16 datatype:
-
- CMake: HDF5_ENABLE_NONSTANDARD_FEATURES (ON/OFF) (Default: ON)
- Autotools: --enable-nonstandard-features (yes/no) (Default: yes)
-
- When this option is enabled, configure time checks are still performed
- to ensure that a feature can be used properly, but these checks may not
- be sufficient when compiler support for a feature is incomplete or broken,
- resulting in library build failures. When set to OFF/no, this option
- provides a way to disable support for all non-standard features to avoid
- these issues. Individual features can still be re-enabled with their
- respective configuration options.
-
- * Added a new configuration option that allows enabling or disabling of
- support for the _Float16 C datatype:
-
- CMake: HDF5_ENABLE_NONSTANDARD_FEATURE_FLOAT16 (ON/OFF) (Default: ON)
- Autotools: --enable-nonstandard-feature-float16 (yes/no) (Default: yes)
-
- While support for the _Float16 C datatype can generally be detected and
- used properly, some compilers have incomplete support for the datatype
- and will pass configure time checks while still failing to build HDF5.
- This option provides a way to disable support for the _Float16 datatype
- when the compiler doesn't have the proper support for it.
-
- - Deprecate bin/cmakehdf5 script
-
- With the improvements made in CMake since version 3.23 and the addition
- of CMake preset files, this script is no longer necessary.
-
- See INSTALL_CMake.txt file, Section X: Using CMakePresets.json for compiling
-
- - Overhauled LFS support checks
-
- In 2024, we can assume that Large File Support (LFS) exists on all
- systems we support, though it may require flags to enable it,
- particularly when building 32-bit binaries. The HDF5 source does
- not use any of the 64-bit specific API calls (e.g., ftello64)
- or explicit 64-bit offsets via off64_t.
-
- Autotools
-
- * We now use AC_SYS_LARGEFILE to determine how to support LFS. We
- previously used a custom m4 script for this.
-
- CMake
-
- * The HDF_ENABLE_LARGE_FILE option (advanced) has been removed
- * We no longer run a test program to determine if LFS works, which
- will help with cross-compiling
- * On Linux we now unilaterally set -D_LARGEFILE_SOURCE and
- -D_FILE_OFFSET_BITS=64, regardless of 32/64 bit system. CMake
- doesn't offer a nice equivalent to AC_SYS_LARGEFILE and since
- those options do nothing on 64-bit systems, this seems safe and
- covers all our bases. We don't set -D_LARGEFILE64_SOURCE since
- we don't use any of the POSIX 64-bit specific API calls like
- ftello64, as noted above.
- * We didn't test for LFS support on non-Linux platforms. We've added
- comments for how LFS should probably be supported on AIX and Solaris,
- which seem to be alive, though uncommon. PRs would be appreciated if
- anyone wishes to test this.
-
- This overhaul also fixes GitHub #2395, which points out that the LFS flags
- used when building with CMake differ based on whether CMake has been
- run before. The LFS check program that caused this problem no longer exists.
-
- - The CMake HDF5_ENABLE_DEBUG_H5B option has been removed
-
- This enabled some additional version-1 B-tree checks. These have been
- removed so the option is no longer necessary.
-
- This option was CMake-only and marked as advanced.
-
- - New option for building with static CRT in Windows
-
- The following option has been added:
- HDF5_BUILD_STATIC_CRT_LIBS "Build With Static Windows CRT Libraries" OFF
- Because our minimum CMake is 3.18, the macro to change runtime flags no longer
- works as CMake changed the default behavior in CMake 3.15.
-
- Fixes GitHub issue #3984
-
- - Added support for the new MSVC preprocessor
-
- Microsoft added support for a new, standards-conformant preprocessor
- to MSVC, which can be enabled with the /Zc:preprocessor option. This
- preprocessor would trip over our HDopen() variadic function-like
- macro, which uses a feature that only works with the legacy preprocessor.
-
- ifdefs have been added that select the correct HDopen() form and
- allow building HDF5 with the /Zc:preprocessor option.
-
- The HDopen() macro is located in an internal header file and only
- affects building the HDF5 library from source.
-
- Fixes GitHub #2515
-
- - Renamed HDF5_ENABLE_USING_MEMCHECKER to HDF5_USING_ANALYSIS_TOOL
-
- The HDF5_USING_ANALYSIS_TOOL is used to indicate to test macros that
- an analysis tool is being used and that the tests should not use
- the runTest.cmake macros and it's variations. The analysis tools,
- like valgrind, test the macro code instead of the program under test.
-
- HDF5_ENABLE_USING_MEMCHECKER is still used for controlling the HDF5
- define, H5_USING_MEMCHECKER.
-
- - New option for building and naming tools in CMake
-
- The following option has been added:
- HDF5_BUILD_STATIC_TOOLS "Build Static Tools Not Shared Tools" OFF
-
- The default will build shared tools unless BUILD_SHARED_LIBS = OFF.
- Tools will no longer have "-shared" as only one set of tools will be created.
-
- - Incorporated HDF5 examples repository into HDF5 library.
-
- The HDF5Examples folder is equivalent to the hdf5-examples repository.
- This enables building and testing the examples
- during the library build process or after the library has been installed.
- Previously, the hdf5-examples archives were downloaded
- for packaging with the library. Now the examples can be built
- and tested without a packaged install of the library.
-
- However, to maintain the ability to use the HDF5Examples with an installed
- library, it is necessary to map the option names used by the library
- to those used by the examples. The typical pattern is:
- =
- HDF_BUILD_FORTRAN = ${HDF5_BUILD_FORTRAN}
-
- - Added new option for CMake to mark tests as SKIPPED.
-
- HDF5_DISABLE_TESTS_REGEX is a REGEX string that will be checked with
- test names and if there is a match then that test's property will be
- set to DISABLED. HDF5_DISABLE_TESTS_REGEX can be initialized on the
- command line: "-DHDF5_DISABLE_TESTS_REGEX:STRING="
- See CMake documentation for regex-specification.
-
- - Added defaults to CMake for long double conversion checks
-
- HDF5 performs a couple of checks at build time to see if long double
- values can be converted correctly (IBM's Power architecture uses a
- special format for long doubles). These checks were performed using
- TRY_RUN, which is a problem when cross-compiling.
-
- These checks now use default values appropriate for most non-Power
- systems when cross-compiling. The cache values can be pre-set if
- necessary, which will preempt both the TRY_RUN and the default.
-
- Affected values:
- H5_LDOUBLE_TO_LONG_SPECIAL (default no)
- H5_LONG_TO_LDOUBLE_SPECIAL (default no)
- H5_LDOUBLE_TO_LLONG_ACCURATE (default yes)
- H5_LLONG_TO_LDOUBLE_CORRECT (default yes)
- H5_DISABLE_SOME_LDOUBLE_CONV (default no)
-
- Fixes GitHub #3585
+ - Added the CMake variable HDF5_ENABLE_ROS3_VFD to the HDF5 CMake config
+ file hdf5-config.cmake. This allows to easily detect if the library
+ has been built with or without read-only S3 functionality.
Library:
--------
- - Relaxed behavior of H5Pset_page_buffer_size() when opening files
-
- This API call sets the size of a file's page buffer cache. This call
- was extremely strict about matching its parameters to the file strategy
- and page size used to create the file, requiring a separate open of the
- file to obtain these parameters.
-
- These requirements have been relaxed when using the fapl to open
- a previously-created file:
-
- * When opening a file that does not use the H5F_FSPACE_STRATEGY_PAGE
- strategy, the setting is ignored and the file will be opened, but
- without a page buffer cache. This was previously an error.
-
- * When opening a file that has a page size larger than the desired
- page buffer cache size, the page buffer cache size will be increased
- to the file's page size. This was previously an error.
-
- The behavior when creating a file using H5Pset_page_buffer_size() is
- unchanged.
-
- Fixes GitHub issue #3382
-
- - Added support for _Float16 16-bit half-precision floating-point datatype
-
- Support for the _Float16 C datatype has been added on platforms where:
-
- - The _Float16 datatype and its associated macros (FLT16_MIN, FLT16_MAX,
- FLT16_EPSILON, etc.) are available
- - A simple test program that converts between the _Float16 datatype and
- other datatypes with casts can be successfully compiled and run at
- configure time. Some compilers appear to be buggy or feature-incomplete
- in this regard and will generate calls to compiler-internal functions
- for converting between the _Float16 datatype and other datatypes, but
- will not link these functions into the build, resulting in build
- failures.
-
- The following new macros have been added:
-
- H5_HAVE__FLOAT16 - This macro is defined in H5pubconf.h and will have
- the value 1 if support for the _Float16 datatype is
- available. It will not be defined otherwise.
-
- H5_SIZEOF__FLOAT16 - This macro is defined in H5pubconf.h and will have
- a value corresponding to the size of the _Float16
- datatype, as computed by sizeof(). It will have the
- value 0 if support for the _Float16 datatype is not
- available.
-
- H5_HAVE_FABSF16 - This macro is defined in H5pubconf.h and will have the
- value 1 if the fabsf16 function is available for use.
-
- H5_LDOUBLE_TO_FLOAT16_CORRECT - This macro is defined in H5pubconf.h and
- will have the value 1 if the platform can
- correctly convert long double values to
- _Float16. Some compilers have issues with
- this.
-
- H5T_NATIVE_FLOAT16 - This macro maps to the ID of an HDF5 datatype representing
- the native C _Float16 datatype for the platform. If
- support for the _Float16 datatype is not available, the
- macro will map to H5I_INVALID_HID and should not be used.
-
- H5T_IEEE_F16BE - This macro maps to the ID of an HDF5 datatype representing
- a big-endian IEEE 754 16-bit floating-point datatype. This
- datatype is available regardless of whether _Float16 support
- is available or not.
-
- H5T_IEEE_F16LE - This macro maps to the ID of an HDF5 datatype representing
- a little-endian IEEE 754 16-bit floating-point datatype.
- This datatype is available regardless of whether _Float16
- support is available or not.
-
- The following new hard datatype conversion paths have been added, but
- will only be used when _Float16 support is available:
-
- H5T_NATIVE_SCHAR <-> H5T_NATIVE_FLOAT16 | H5T_NATIVE_UCHAR <-> H5T_NATIVE_FLOAT16
- H5T_NATIVE_SHORT <-> H5T_NATIVE_FLOAT16 | H5T_NATIVE_USHORT <-> H5T_NATIVE_FLOAT16
- H5T_NATIVE_INT <-> H5T_NATIVE_FLOAT16 | H5T_NATIVE_UINT <-> H5T_NATIVE_FLOAT16
- H5T_NATIVE_LONG <-> H5T_NATIVE_FLOAT16 | H5T_NATIVE_ULONG <-> H5T_NATIVE_FLOAT16
- H5T_NATIVE_LLONG <-> H5T_NATIVE_FLOAT16 | H5T_NATIVE_ULLONG <-> H5T_NATIVE_FLOAT16
- H5T_NATIVE_FLOAT <-> H5T_NATIVE_FLOAT16 | H5T_NATIVE_DOUBLE <-> H5T_NATIVE_FLOAT16
- H5T_NATIVE_LDOUBLE <-> H5T_NATIVE_FLOAT16
-
- The H5T_NATIVE_LDOUBLE -> H5T_NATIVE_FLOAT16 hard conversion path will only
- be available and used if H5_LDOUBLE_TO_FLOAT16_CORRECT has a value of 1. Otherwise,
- the conversion will be emulated in software by the library.
-
- Note that in the absence of any compiler flags for architecture-specific
- tuning, the generated code for datatype conversions with the _Float16 type
- may perform conversions by first promoting the type to float. Use of
- architecture-specific tuning compiler flags may instead allow for the
- generation of specialized instructions, such as AVX512-FP16 instructions,
- if available.
-
- - Made several improvements to the datatype conversion code
-
- * The datatype conversion code was refactored to use pointers to
- H5T_t datatype structures internally rather than IDs wrapping
- the pointers to those structures. These IDs are needed if an
- application-registered conversion function or conversion exception
- function are involved during the conversion process. For simplicity,
- the conversion code simply passed these IDs down and let the internal
- code unwrap the IDs as necessary when needing to access the wrapped
- H5T_t structures. However, this could cause a significant amount of
- repeated ID lookups for compound datatypes and other container-like
- datatypes. The code now passes down pointers to the datatype
- structures and only creates IDs to wrap those pointers as necessary.
- Quick testing showed an average ~3x to ~10x improvement in performance
- of conversions on container-like datatypes, depending on the
- complexity of the datatype.
-
- * A conversion "context" structure was added to hold information about
- the current conversion being performed. This allows conversions on
- container-like datatypes to be optimized better by skipping certain
- portions of the conversion process that remain relatively constant
- when multiple elements of the container-like datatype are being
- converted.
-
- * After refactoring the datatype conversion code to use pointers
- internally rather than IDs, several copies of datatypes that were
- made by higher levels of the library were able to be removed. The
- internal IDs that were previously registered to wrap those copied
- datatypes were also able to be removed.
-
- - Implemented optimized support for vector I/O in the Subfiling VFD
-
- Previously, the Subfiling VFD would handle vector I/O requests by
- breaking them down into individual I/O requests, one for each entry
- in the I/O vectors provided. This could result in poor I/O performance
- for features in HDF5 that utilize vector I/O, such as parallel I/O
- to filtered datasets. The Subfiling VFD now properly handles vector
- I/O requests in their entirety, resulting in fewer I/O calls, improved
- vector I/O performance and improved vector I/O memory efficiency.
-
- - Added support for in-place type conversion in most cases
-
- In-place type conversion allows the library to perform type conversion
- without an intermediate type conversion buffer. This can improve
- performance by allowing I/O in a single operation over the entire
- selection instead of being limited by the size of the intermediate buffer.
- Implemented for I/O on contiguous and chunked datasets when the selection
- is contiguous in memory and when the memory datatype is not smaller than
- the file datatype.
-
- - Changed selection I/O to be on by default when using the MPIO file driver
-
- - Added support for selection I/O in the MPIO file driver
-
- Previously, only vector I/O operations were supported. Support for
- selection I/O should improve performance and reduce memory uses in some
- cases.
-
- - Changed the error handling for a not found path in the find plugin process.
-
- While attempting to load a plugin the HDF5 library will fail if one of the
- directories in the plugin paths does not exist, even if there are more paths
- to check. Instead of exiting the function with an error, just logged the error
- and continue processing the list of paths to check.
-
- - Implemented support for temporary security credentials for the Read-Only
- S3 (ROS3) file driver.
-
- When using temporary security credentials, one also needs to specify a
- session/security token next to the access key id and secret access key.
- This token can be specified by the new API function H5Pset_fapl_ros3_token().
- The API function H5Pget_fapl_ros3_token() can be used to retrieve
- the currently set token.
-
- - Added a Subfiling VFD configuration file prefix environment variable
-
- The Subfiling VFD now checks for values set in a new environment
- variable "H5FD_SUBFILING_CONFIG_FILE_PREFIX" to determine if the
- application has specified a pathname prefix to apply to the file
- path for its configuration file. For example, this can be useful
- for cases where the application wishes to write subfiles to a
- machine's node-local storage while placing the subfiling configuration
- file on a file system readable by all machine nodes.
-
- - Added H5Pset_selection_io(), H5Pget_selection_io(), and
- H5Pget_no_selection_io_cause() API functions to manage the selection I/O
- feature. This can be used to enable collective I/O with type conversion,
- or it can be used with custom VFDs that support vector or selection I/O.
-
- - Added H5Pset_modify_write_buf() and H5Pget_modify_write_buf() API
- functions to allow the library to modify the contents of write buffers, in
- order to avoid malloc/memcpy. Currently only used for type conversion
- with selection I/O.
+ - Added new routines for interacting with error stacks: H5Epause_stack,
+ H5Eresume_stack, and H5Eis_paused. These routines can be used to
+ indicate that errors from a call to an HDF5 routine should not be
+ pushed on to an error stack. Primarily targeted toward 3rd-party
+ developers of Virtual File Drivirs (VFDs) and Virtual Object Layer (VOL)
+ connectors, these routines allow developers to perform "speculative"
+ operations (such as trying to open a file or object) without requiring
+ that the error stack be cleared after a speculative operation fails.
Parallel Library:
@@ -449,36 +113,6 @@ New Features
h5rget_file_name_f, h5rget_attr_name_f, h5rget_obj_name_f,
h5rcopy_f, h5requal_f, h5rdestroy_f, h5rget_type_f
- - Added Fortran H5E APIs:
- h5eregister_class_f, h5eunregister_class_f, h5ecreate_msg_f, h5eclose_msg_f
- h5eget_msg_f, h5epush_f, h5eget_num_f, h5ewalk_f, h5eget_class_name_f,
- h5eappend_stack_f, h5eget_current_stack_f, h5eset_current_stack_f, h5ecreate_stack_f,
- h5eclose_stack_f, h5epop_f, h5eprint_f (C h5eprint v2 signature)
-
- - Added API support for Fortran MPI_F08 module definitions:
- Adds support for MPI's MPI_F08 module datatypes: type(MPI_COMM) and type(MPI_INFO) for HDF5 APIs:
- H5PSET_FAPL_MPIO_F, H5PGET_FAPL_MPIO_F, H5PSET_MPI_PARAMS_F, H5PGET_MPI_PARAMS_F
- Ref. #3951
-
- - Added Fortran APIs:
- H5FGET_INTENT_F, H5SSEL_ITER_CREATE_F, H5SSEL_ITER_GET_SEQ_LIST_F,
- H5SSEL_ITER_CLOSE_F, H5S_mp_H5SSEL_ITER_RESET_F
-
- - Added Fortran Parameters:
- H5S_SEL_ITER_GET_SEQ_LIST_SORTED_F, H5S_SEL_ITER_SHARE_WITH_DATASPACE_F
-
- - Added Fortran Parameters:
- H5S_BLOCK_F and H5S_PLIST_F
-
- - The configuration definitions file, H5config_f.inc, is now installed
- and the HDF5 version number has been added to it.
-
- - Added Fortran APIs:
- h5fdelete_f
-
- - Added Fortran APIs:
- h5vlnative_addr_to_token_f and h5vlnative_token_to_address_f
-
C++ Library:
------------
@@ -537,23 +171,6 @@ Bug Fixes since HDF5-1.14.4 release
disabled for any form of parallel file access, even if only 1 MPI process
is used.
- - Fixed a leak of datatype IDs created internally during datatype conversion
-
- Fixed an issue where the library could leak IDs that it creates internally
- for compound datatype members during datatype conversion. When the library's
- table of datatype conversion functions is modified (such as when a new
- conversion function is registered with the library from within an application),
- the compound datatype conversion function has to recalculate data that it
- has cached. When recalculating that data, the library was registering new
- IDs for each of the members of the source and destination compound datatypes
- involved in the conversion process and was overwriting the old cached IDs
- without first closing them. This would result in use-after-free issues due
- to multiple IDs pointing to the same internal H5T_t structure, as well as
- crashes due to the library not gracefully handling partially initialized or
- partially freed datatypes on library termination.
-
- Fixes h5py GitHub #2419
-
- Fixed function H5Requal actually to compare the reference pointers
Fixed an issue with H5Requal always returning true because the
@@ -573,496 +190,6 @@ Bug Fixes since HDF5-1.14.4 release
Fixes GitHub #3790
- - Fixed many (future) CVE issues
-
- A partner organization corrected many potential security issues, which
- were fixed and reported to us before submission to MITRE. These do
- not have formal CVE issues assigned to them yet, so the numbers assigned
- here are just placeholders. We will update the HDF5 1.14 CVE list (link
- below) when official MITRE CVE tracking numbers are assigned.
-
- These CVE issues are generally of the same form as other reported HDF5
- CVE issues, and rely on the library failing while attempting to read
- a malformed file. Most of them cause the library to segfault and will
- probably be assigned "medium (~5/10)" scores by NIST, like the other
- HDF5 CVE issues.
-
- The issues that were reported to us have all been fixed in this release,
- so HDF5 will continue to have no unfixed public CVE issues.
-
- NOTE: HDF5 versions earlier than 1.14.4 should be considered vulnerable
- to these issues and users should upgrade to 1.14.4 as soon as
- possible. Note that it's possible to build the 1.14 library with
- HDF5 1.8, 1.10, etc. API bindings for people who wish to enjoy
- the benefits of a more secure library but don't want to upgrade
- to the latest API. We will not be bringing the CVE fixes to earlier
- versions of the library (they are no longer supported).
-
- LIST OF CVE ISSUES FIXED IN THIS RELEASE:
-
- * CVE-2024-0116-001
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5D__scatter_mem resulting in causing denial of service or potential
- code execution
-
- * CVE-2024-0112-001
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5S__point_deserialize resulting in the corruption of the
- instruction pointer and causing denial of service or potential code
- execution
-
- * CVE-2024-0111-001
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5T__conv_struct_opt resulting in causing denial of service or
- potential code execution
-
- * CVE-2023-1208-002
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5O__mtime_new_encode resulting in the corruption of the instruction
- pointer and causing denial of service or potential code execution
-
- * CVE-2023-1208-001
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5O__layout_encode resulting in the corruption of the instruction
- pointer and causing denial of service or potential code execution
-
- * CVE-2023-1207-001
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5O__dtype_encode_helper causing denial of service or potential
- code execution
-
- * CVE-2023-1205-001
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5VM_array_fill resulting in the corruption of the instruction
- pointer and causing denial of service or potential code execution
-
- * CVE-2023-1202-002
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5T__get_native_type resulting in the corruption of the instruction
- pointer and causing denial of service or potential code execution
-
- * CVE-2023-1202-001
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5T__ref_mem_setnull resulting in the corruption of the instruction
- pointer and causing denial of service or potential code execution
-
- * CVE-2023-1130-001
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5T_copy_reopen resulting in the corruption of the instruction
- pointer and causing denial of service or potential code execution
-
- * CVE-2023-1125-001
- HDF5 versions <= 1.14.3 contain a heap buffer overflow in
- H5Z__nbit_decompress_one_byte caused by the earlier use of an
- initialized pointer. This may result in Denial of Service or
- potential code execution
-
- * CVE-2023-1114-001
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5HG_read resulting in the corruption of the instruction pointer
- and causing denial of service or potential code execution
-
- * CVE-2023-1113-002
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5F_addr_decode_len resulting in the corruption of the instruction
- pointer and causing denial of service or potential code execution
-
- * CVE-2023-1113-001
- HDF5 versions <= 1.14.3 contain a heap buffer overflow caused by
- the unsafe use of strdup in H5MM_xstrdup, resulting in denial of
- service or potential code execution
-
- * CVE-2023-1108-001
- HDF5 versions <= 1.14.3 contain a out-of-bounds read operation in
- H5FL_arr_malloc resulting in denial of service or potential code
- execution
-
- * CVE-2023-1104-004
- HDF5 versions <= 1.14.3 contain a out-of-bounds read operation in
- H5T_close_real resulting in denial of service or potential code
- execution
-
- * CVE-2023-1104-003
- HDF5 library versions <=1.14.3 contain a heap buffer overflow flaw
- in the function H5HL__fl_deserialize resulting in denial of service
- or potential code execution
-
- * CVE-2023-1104-002
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5HL__fl_deserialize resulting in the corruption of the instruction
- pointer and causing denial of service or potential code execution
-
- * CVE-2023-1104-001
- HDF5 library versions <=1.14.3 contains a stack overflow in the
- function H5E_printf_stack resulting in denial of service or
- potential code execution
-
- * CVE-2023-1023-001
- HDF5 library versions <=1.14.3 heap buffer overflow in
- H5VM_memcpyvv which may result in denial of service or code
- execution
-
- * CVE-2023-1019-001
- HDF5 library versions <=1.14.3 contain a stack buffer overflow in
- H5VM_memcpyvv resulting in the corruption of the instruction
- pointer and causing denial of service or potential code execution
-
- * CVE-2023-1018-001
- HDF5 library versions <=1.14.3 contain a memory corruption in
- H5A__close resulting in the corruption of the instruction pointer
- and causing denial of service or potential code execution
-
- * CVE-2023-1017-002
- HDF5 library versions <=1.14.3 may use an uninitialized value
- H5A__attr_release_table resulting in denial of service
-
- * CVE-2023-1017-001
- HDF5 library versions <=1.14.3 may attempt to dereference
- uninitialized values in h5tools_str_sprint, which will lead to
- denial of service
-
- * CVE-2023-1013-004
- HDF5 versions <= 1.13.3 contain a stack buffer overflow in
- H5HG_read resulting in denial of service or potential code
- execution
-
- * CVE-2023-1013-003
- HDF5 library versions <=1.14.3 contain a buffer overrun in
- H5Z__filter_fletcher32 resulting in the corruption of the
- instruction pointer and causing denial of service or potential
- code execution
-
- * CVE-2023-1013-002
- HDF5 library versions <=1.14.3 contain a buffer overrun in
- H5O__linfo_decode resulting in the corruption of the instruction
- pointer and causing denial of service or potential code execution
-
- * CVE-2023-1013-001
- HDF5 library versions <=1.14.3 contain a buffer overrun in
- H5Z__filter_scaleoffset resulting in the corruption of the
- instruction pointer and causing denial of service or potential
- code execution
-
- * CVE-2023-1012-001
- HDF5 library versions <=1.14.3 contain a stack buffer overflow in
- H5R__decode_heap resulting in the corruption of the instruction
- pointer and causing denial of service or potential code execution
-
- * CVE-2023-1010-001
- HDF5 library versions <=1.14.3 contain a stack buffer overflow in
- H5FL_arr_malloc resulting in the corruption of the instruction
- pointer and causing denial of service or potential code execution
-
- * CVE-2023-1009-001
- HDF5 library versions <=1.14.3 contain a stack buffer overflow in
- H5FL_arr_malloc resulting in the corruption of the instruction
- pointer and causing denial of service or potential code execution
-
- * CVE-2023-1006-004
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5A__attr_release_table resulting in the corruption of the
- instruction pointer and causing denial of service or potential code
- execution
-
- * CVE-2023-1006-003
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5T__bit_find resulting in the corruption of the instruction pointer
- and causing denial of service or potential code execution.
-
- * CVE-2023-1006-002
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5HG_read resulting in the corruption of the instruction pointer
- and causing denial of service or potential code execution
-
- * CVE-2023-1006-001
- HDF5 library versions <=1.14.3 contain a heap buffer overflow in
- H5HG__cache_heap_deserialize resulting in the corruption of the
- instruction pointer and causing denial of service or potential code
- execution
-
- FULL OFFICIAL HDF5 CVE list (from mitre.org):
-
- https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=HDF5
-
- 1.14.x CVE tracking list:
-
- https://github.com/HDFGroup/hdf5/blob/hdf5_1_14/CVE_list_1_14.md
-
- HDF5 CVE regression test suite (includes proof-of-concept files):
-
- https://github.com/HDFGroup/cve_hdf5
-
- - Fixed a divide-by-zero issue when a corrupt file sets the page size to 0
-
- If a corrupt file sets the page buffer size in the superblock to zero,
- the library could attempt to divide by zero when allocating space in
- the file. The library now checks for valid page buffer sizes when
- reading the superblock message.
-
- Fixes oss-fuzz issue 58762
-
- - Fixed a bug when using array datatypes with certain parent types
-
- Array datatype conversion would never use a background buffer, even if the
- array's parent type (what the array is an array of) required a background
- buffer for conversion. This resulted in crashes in some cases when using
- an array of compound, variable length, or reference datatypes. Array types
- now use a background buffer if needed by the parent type.
-
- - Fixed potential buffer read overflows in H5PB_read
-
- H5PB_read previously did not account for the fact that the size of the
- read it's performing could overflow the page buffer pointer, depending
- on the calculated offset for the read. This has been fixed by adjusting
- the size of the read if it's determined that it would overflow the page.
-
- - Fixed CVE-2017-17507
-
- This CVE was previously declared fixed, but later testing with a static
- build of HDF5 showed that it was not fixed.
-
- When parsing a malformed (fuzzed) compound type containing variable-length
- string members, the library could produce a segmentation fault, crashing
- the library.
-
- This was fixed after GitHub PR #4234
-
- Fixes GitHub issue #3446
-
- - Fixed a cache assert with very large metadata objects
-
- If the library tries to load a metadata object that is above a
- certain size, this would trip an assert in debug builds. This could
- happen if you create a very large number of links in an old-style
- group that uses local heaps.
-
- There is no need for this assert. The library's metadata cache
- can handle large objects. The assert has been removed.
-
- Fixes GitHub #3762
-
- - Fixed an issue with the Subfiling VFD and multiple opens of a
- file
-
- An issue with the way the Subfiling VFD handles multiple opens
- of the same file caused the file structures for the extra opens
- to occasionally get mapped to an incorrect subfiling context
- object. The VFD now correctly maps the file structures for
- additional opens of an already open file to the same context
- object.
-
- - Fixed a bug that causes the library to incorrectly identify
- the endian-ness of 16-bit and smaller C floating-point datatypes
-
- When detecting the endian-ness of an in-memory C floating-point
- datatype, the library previously always assumed that the type
- was at least 32 bits in size. This resulted in invalid memory
- accesses and would usually cause the library to identify the
- datatype as having an endian-ness of H5T_ORDER_VAX. This has
- now been fixed.
-
- - Fixed a bug that causes an invalid memory access issue when
- converting 16-bit floating-point values to integers with the
- library's software conversion function
-
- The H5T__conv_f_i function previously always assumed that
- floating-point values were at least 32 bits in size and would
- access invalid memory when attempting to convert 16-bit
- floating-point values to integers. To fix this, parts of the
- H5T__conv_f_i function had to be rewritten, which also resulted
- in a significant speedup when converting floating-point values
- to integers where the library does not have a hard conversion
- path. This is the case for any floating-point values with a
- datatype not represented by H5T_NATIVE_FLOAT16 (if _Float16 is
- supported), H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE or
- H5T_NATIVE_LDOUBLE.
-
- - Fixed a bug that can cause incorrect data when overflows occur
- while converting integer values to floating-point values with
- the library's software conversion function
-
- The H5T__conv_i_f function had a bug which previously caused it
- to return incorrect data when an overflow occurs and an application's
- conversion exception callback function decides not to handle the
- overflow. Rather than return positive infinity, the library would
- return truncated data. This has now been fixed.
-
- - Corrected H5Soffset_simple() when offset is NULL
-
- The reference manual states that the offset parameter of H5Soffset_simple()
- can be set to NULL to reset the offset of a simple dataspace to 0. This
- has never been true, and passing NULL was regarded as an error.
-
- The library will now accept NULL for the offset parameter and will
- correctly set the offset to zero.
-
- Fixes HDFFV-9299
-
- - Fixed an issue where the Subfiling VFD's context object cache could
- grow too large
-
- The Subfiling VFD keeps a cache of its internal context objects to
- speed up access to a context object for a particular file, as well
- as access to that object across multiple opens of the same file.
- However, opening a large amount of files with the Subfiling VFD over
- the course of an application's lifetime could cause this cache to grow
- too large and result in the application running out of available MPI
- communicator objects. On file close, the Subfiling VFD now simply
- evicts context objects out of its cache and frees them. It is assumed
- that multiple opens of a file will be a less common use case for the
- Subfiling VFD, but this can be revisited if it proves to be an issue
- for performance.
-
- - Fixed error when overwriting certain nested variable length types
-
- Previously, when using a datatype that included a variable length type
- within a compound or array within another variable length type, and
- overwriting data with a shorter (top level) variable length sequence, an
- error could occur. This has been fixed.
-
- - Take user block into account in H5Dchunk_iter() and H5Dget_chunk_info()
-
- The address reported by the following functions did not correctly
- take the user block into account:
-
- * H5Dchunk_iter() <-- addr passed to callback
- * H5Dget_chunk_info() <-- addr parameter
- * H5Dget_chunk_info_by_coord() <-- addr parameter
-
- This means that these functions reported logical HDF5 file addresses,
- which would only be equal to the physical addresses when there is no
- user block prepended to the HDF5 file. This is unfortunate, as the
- primary use of these functions is to get physical addresses in order
- to directly access the chunks.
-
- The listed functions now correctly take the user block into account,
- so they will emit physical addresses that can be used to directly
- access the chunks.
-
- Fixes #3003
-
- - Fixed asserts raised by large values of H5Pset_est_link_info() parameters
-
- If large values for est_num_entries and/or est_name_len were passed
- to H5Pset_est_link_info(), the library would attempt to create an
- object header NIL message to reserve enough space to hold the links in
- compact form (i.e., concatenated), which could exceed allowable object
- header message size limits and trip asserts in the library.
-
- This bug only occurred when using the HDF5 1.8 file format or later and
- required the product of the two values to be ~64k more than the size
- of any links written to the group, which would cause the library to
- write out a too-large NIL spacer message to reserve the space for the
- unwritten links.
-
- The library now inspects the phase change values to see if the dataset
- is likely to be compact and checks the size to ensure any NIL spacer
- messages won't be larger than the library allows.
-
- Fixes GitHub #1632
-
- - Fixed a bug where H5Tset_fields does not account for any offset
- set for a floating-point datatype when determining if values set
- for spos, epos, esize, mpos and msize make sense for the datatype
-
- Previously, H5Tset_fields did not take datatype offsets into account
- when determining if the values set make sense for the datatype.
- This would cause the function to fail when the precision for a
- datatype is correctly set such that the offset bits are not included.
- This has now been fixed.
-
- - Fixed H5Fget_access_plist so that it returns the file locking
- settings for a file
-
- When H5Fget_access_plist (and the internal H5F_get_access_plist)
- is called on a file, the returned File Access Property List has
- the library's default file locking settings rather than any
- settings set for the file. This causes two problems:
-
- - Opening an HDF5 file through an external link using H5Gopen,
- H5Dopen, etc. with H5P_DEFAULT for the Dataset/Group/etc.
- Access Property List will cause the external file to be opened
- with the library's default file locking settings rather than
- inheriting them from the parent file. This can be surprising
- when a file is opened with file locking disabled, but its
- external files are opened with file locking enabled.
-
- - An application cannot make use of the H5Pset_elink_fapl
- function to match file locking settings between an external
- file and its parent file without knowing the correct setting
- ahead of time, as calling H5Fget_access_plist on the parent
- file will not return the correct settings.
-
- This has been fixed by copying a file's file locking settings
- into the newly-created File Access Property List in H5F_get_access_plist.
-
- This fix partially addresses GitHub issue #4011
-
- - Memory usage growth issue
-
- Starting with the HDF5 1.12.1 release, an issue (GitHub issue #1256)
- was observed where running a simple program that has a loop of opening
- a file, reading from an object with a variable-length datatype and
- then closing the file would result in the process fairly quickly
- running out of memory. Upon further investigation, it was determined
- that this memory was being kept around in the library's datatype
- conversion pathway cache that is used to speed up datatype conversions
- which are repeatedly used within an HDF5 application's lifecycle. For
- conversions involving variable-length or reference datatypes, each of
- these cached pathway entries keeps a reference to its associated file
- for later use. Since the file was being closed and reopened on each
- loop iteration, and since the library compares for equality between
- instances of opened files (rather than equality of the actual files)
- when determining if it can reuse a cached conversion pathway, it was
- determining that no cached conversion pathways could be reused and was
- creating a new cache entry on each loop iteration during I/O. This
- would lead to constant growth of that cache and the memory it consumed,
- as well as constant growth of the memory consumed by each cached entry
- for the reference to its associated file.
-
- To fix this issue, the library now removes any cached datatype
- conversion path entries for variable-length or reference datatypes
- associated with a particular file when that file is closed.
-
- Fixes GitHub #1256
-
- - Suppressed floating-point exceptions in H5T init code
-
- The floating-point datatype initialization code in H5Tinit_float.c
- could raise FE_INVALID exceptions while munging bits and performing
- comparisons that might involve NaN. This was not a problem when the
- initialization code was executed in H5detect at compile time (prior
- to 1.14.3), but now that the code is executed at library startup
- (1.14.3+), these exceptions can be caught by user code, as is the
- default in the NAG Fortran compiler.
-
- Starting in 1.14.4, we now suppress floating-point exceptions while
- initializing the floating-point types and clear FE_INVALID before
- restoring the original environment.
-
- Fixes GitHub #3831
-
- - Fixed a file handle leak in the core VFD
-
- When opening a file with the core VFD and a file image, if the file
- already exists, the file check would leak the POSIX file handle.
-
- Fixes GitHub issue #635
-
- - Dropped support for MPI-2
-
- The MPI-2 supporting artifacts have been removed due to the cessation
- of MPI-2 maintenance and testing since version HDF5 1.12.
-
-
- - Fixed a segfault when using a user-defined conversion function between compound datatypes
-
- During type info initialization for compound datatype conversion, the library checked if the
- datatypes are subsets of one another in order to perform special conversion handling.
- This check uses information that is only defined if a library conversion function is in use.
- The library now skips this check for user-defined conversion functions.
-
- Fixes Github issue #3840
Java Library
------------
@@ -1114,16 +241,6 @@ Bug Fixes since HDF5-1.14.4 release
* HDF5_ENABLE_DOXY_WARNINGS: ON/OFF (Default: OFF)
* --enable-doxygen-errors: enable/disable (Default: disable)
- - Fixed an issue where the h5tools_test_utils test program was being
- installed on the system for Autotools builds of HDF5
-
- The h5tools_test_utils test program was mistakenly added to bin_PROGRAMS
- in its Makefile.am configuration file, causing the executable to be
- installed on the system. The executable is now added to noinst_PROGRAMS
- instead and will no longer be installed on the system for Autotools builds
- of HDF5. The CMake configuration code already avoids installing the
- executable on the system.
-
Tools
-----
@@ -1141,10 +258,6 @@ Bug Fixes since HDF5-1.14.4 release
preventing the library from setting up an MPI communicator attribute
to perform library cleanup on MPI_Finalize
- - Renamed h5fuse.sh to h5fuse
-
- Addresses Discussion #3791
-
Performance
-------------
@@ -1153,25 +266,12 @@ Bug Fixes since HDF5-1.14.4 release
Fortran API
-----------
- - Fixed: HDF5 fails to compile with -Werror=lto-type-mismatch
-
- Removed the use of the offending C stub wrapper.
-
- Fixes GitHub issue #3987
+ -
High-Level Library
------------------
- - Fixed a memory leak in H5LTopen_file_image with H5LT_FILE_IMAGE_DONT_COPY flag
-
- When the H5LT_FILE_IMAGE_DONT_COPY flag is passed to H5LTopen_file_image, the
- internally-allocated udata structure gets leaked as the core file driver doesn't
- have a way to determine when or if it needs to call the "udata_free" callback.
- This has been fixed by freeing the udata structure when the "image_free" callback
- gets made during file close, where the file is holding the last reference to the
- udata structure.
-
- Fixes GitHub issue #827
+ -
Fortran High-Level APIs
@@ -1196,50 +296,7 @@ Bug Fixes since HDF5-1.14.4 release
Testing
-------
- - Fixed a bug in the dt_arith test when H5_WANT_DCONV_EXCEPTION is not
- defined
-
- The dt_arith test program's test_particular_fp_integer sub-test tries
- to ensure that the library correctly raises a datatype conversion
- exception when converting a floating-point value to an integer overflows.
- However, this test would run even when H5_WANT_DCONV_EXCEPTION isn't
- defined, causing the test to fail due to the library not raising
- datatype conversion exceptions. This has now been fixed by not running
- the test when H5_WANT_DCONV_EXCEPTION is not defined.
-
- - Fixed a testing failure in testphdf5 on Cray machines
-
- On some Cray machines, what appears to be a bug in Cray MPICH was causing
- calls to H5Fis_accessible to create a 0-byte file with strange Unix
- permissions. This was causing an H5Fdelete file deletion test in the
- testphdf5 program to fail due to a just-deleted HDF5 file appearing to
- still be accessible on the file system. The issue in Cray MPICH has been
- worked around for the time being by resetting the MPI_Info object on the
- File Access Property List used to MPI_INFO_NULL before passing it to the
- H5Fis_accessible call.
-
- - A bug was fixed in the HDF5 API test random datatype generation code
-
- A bug in the random datatype generation code could cause test failures
- when trying to generate an enumeration datatype that has duplicated
- name/value pairs in it. This has now been fixed.
-
- - A bug was fixed in the HDF5 API test VOL connector registration checking code
-
- The HDF5 API test code checks to see if the VOL connector specified by the
- HDF5_VOL_CONNECTOR environment variable (if any) is registered with the library
- before attempting to run tests with it so that testing can be skipped and an
- error can be returned when a VOL connector fails to register successfully.
- Previously, this code didn't account for VOL connectors that specify extra
- configuration information in the HDF5_VOL_CONNECTOR environment variable and
- would incorrectly report that the specified VOL connector isn't registered
- due to including the configuration information as part of the VOL connector
- name being checked for registration status. This has now been fixed.
-
- - Fixed Fortran 2003 test with gfortran-v13, optimization levels O2,O3
-
- Fixes failing Fortran 2003 test with gfortran, optimization level O2,O3
- with -fdefault-real-16. Fixes GH #2928.
+ -
Platforms Tested
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index 11874878fd7..ac31231b1e8 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -875,16 +875,14 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir
intent = H5F_INTENT(vdset->oloc.file);
/* Try opening the file */
- src_file = H5F_prefix_open_file(vdset->oloc.file, H5F_PREFIX_VDS, vdset->shared->vds_prefix,
- source_dset->file_name, intent,
- vdset->shared->layout.storage.u.virt.source_fapl);
+ if (H5F_prefix_open_file(true, &src_file, vdset->oloc.file, H5F_PREFIX_VDS, vdset->shared->vds_prefix,
+ source_dset->file_name, intent,
+ vdset->shared->layout.storage.u.virt.source_fapl) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENFILE, FAIL, "can't try opening file");
/* If we opened the source file here, we should close it when leaving */
if (src_file)
src_file_open = true;
- else
- /* Reset the error stack */
- H5E_clear_stack();
} /* end if */
else
/* Source file is ".", use the virtual dataset's file */
diff --git a/src/H5E.c b/src/H5E.c
index 0eb256f4ad4..f1b865e7c17 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -532,8 +532,11 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid
/* Don't clear the error stack! :-) */
FUNC_ENTER_API_NOCLEAR(FAIL)
- if (err_stack == H5E_DEFAULT)
- estack = NULL;
+ /* Check for 'default' error stack */
+ if (err_stack == H5E_DEFAULT) {
+ if (NULL == (estack = H5E__get_my_stack()))
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get the default error stack");
+ }
else {
/* Only clear the error stack if it's not the default stack */
H5E_clear_stack();
@@ -543,35 +546,33 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID");
} /* end else */
- /* Note that the variable-argument parsing for the format is identical in
- * the H5E_printf_stack() routine - correct errors and make changes in both
- * places. -QAK
- */
-
- /* Format the description */
- va_start(ap, fmt);
- va_started = true;
-
- /* Duplicate string information */
- if (NULL == (tmp_file = strdup(file)))
- HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate file string");
- if (NULL == (tmp_func = strdup(func)))
- HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate function string");
-
- /* Increment refcount on non-library IDs */
- if (cls_id != H5E_ERR_CLS_g)
- if (H5I_inc_ref(cls_id, false) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment class ID");
- if (maj_id < H5E_first_maj_id_g || maj_id > H5E_last_maj_id_g)
- if (H5I_inc_ref(maj_id, false) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment major error ID");
- if (min_id < H5E_first_min_id_g || min_id > H5E_last_min_id_g)
- if (H5I_inc_ref(min_id, false) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment minor error ID");
-
- /* Push the error on the stack */
- if (H5E__push_stack(estack, true, tmp_file, tmp_func, line, cls_id, maj_id, min_id, fmt, &ap) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack");
+ /* Check if error reporting is paused for this stack */
+ if (!estack->paused) {
+ /* Start the variable-argument parsing */
+ va_start(ap, fmt);
+ va_started = true;
+
+ /* Duplicate string information */
+ if (NULL == (tmp_file = strdup(file)))
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate file string");
+ if (NULL == (tmp_func = strdup(func)))
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate function string");
+
+ /* Increment refcount on non-library IDs */
+ if (cls_id != H5E_ERR_CLS_g)
+ if (H5I_inc_ref(cls_id, false) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment class ID");
+ if (maj_id < H5E_first_maj_id_g || maj_id > H5E_last_maj_id_g)
+ if (H5I_inc_ref(maj_id, false) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment major error ID");
+ if (min_id < H5E_first_min_id_g || min_id > H5E_last_min_id_g)
+ if (H5I_inc_ref(min_id, false) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment minor error ID");
+
+ /* Push the error on the stack */
+ if (H5E__push_stack(estack, true, tmp_file, tmp_func, line, cls_id, maj_id, min_id, fmt, &ap) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack");
+ }
done:
if (va_started)
@@ -865,7 +866,6 @@ H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_sta
H5E_stack_t *dst_stack, *src_stack; /* Error stacks */
herr_t ret_value = SUCCEED; /* Return value */
- /* Don't clear the error stack! :-) */
FUNC_ENTER_API(FAIL)
/* Check args */
@@ -889,3 +889,118 @@ H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_sta
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eappend_stack() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Eis_paused
+ *
+ * Purpose: Check if pushing errors on an error stack is paused
+ *
+ * Return: Non-negative value on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Eis_paused(hid_t stack_id, hbool_t *is_paused)
+{
+ H5E_stack_t *stack; /* Error stack */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ /* Don't clear the error stack! :-) */
+ FUNC_ENTER_API_NOCLEAR(FAIL)
+
+ /* Get the correct error stack */
+ if (stack_id == H5E_DEFAULT) {
+ if (NULL == (stack = H5E__get_my_stack()))
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");
+ } /* end if */
+ else {
+ /* Only clear the error stack if it's not the default stack */
+ H5E_clear_stack();
+
+ /* Get the error stack to operate on */
+ if (NULL == (stack = (H5E_stack_t *)H5I_object_verify(stack_id, H5I_ERROR_STACK)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an error stack ID");
+ } /* end else */
+
+ /* Check arguments */
+ if (NULL == is_paused)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "is_paused parameter is NULL");
+
+ /* Check if the stack is paused */
+ *is_paused = (stack->paused > 0);
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Eis_paused() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Epause_stack
+ *
+ * Purpose: Pause pushing errors on an error stack
+ *
+ * Return: Non-negative value on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Epause_stack(hid_t stack_id)
+{
+ H5E_stack_t *stack; /* Error stack */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+
+ /* Get the correct error stack */
+ if (stack_id == H5E_DEFAULT) {
+ if (NULL == (stack = H5E__get_my_stack()))
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");
+ } /* end if */
+ else
+ /* Get the error stack to operate on */
+ if (NULL == (stack = (H5E_stack_t *)H5I_object_verify(stack_id, H5I_ERROR_STACK)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an error stack ID");
+
+ /* Increment pause counter */
+ stack->paused++;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Epause_stack() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Eresume_stack
+ *
+ * Purpose: Resume pushing errors on an error stack
+ *
+ * Return: Non-negative value on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Eresume_stack(hid_t stack_id)
+{
+ H5E_stack_t *stack; /* Error stack */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+
+ /* Get the correct error stack */
+ if (stack_id == H5E_DEFAULT) {
+ if (NULL == (stack = H5E__get_my_stack()))
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");
+ } /* end if */
+ else
+ /* Get the error stack to operate on */
+ if (NULL == (stack = (H5E_stack_t *)H5I_object_verify(stack_id, H5I_ERROR_STACK)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an error stack ID");
+
+ /* Check for pause/resume imbalance */
+ if (0 == stack->paused)
+ HGOTO_ERROR(H5E_ERROR, H5E_BADRANGE, FAIL, "resuming more than paused");
+
+ /* Decrement pause counter */
+ stack->paused--;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Eresume_stack() */
diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c
index 06648000ae1..87b39e4133f 100644
--- a/src/H5Edeprec.c
+++ b/src/H5Edeprec.c
@@ -182,30 +182,38 @@ H5Eget_minor(H5E_minor_t min)
herr_t
H5Epush1(const char *file, const char *func, unsigned line, H5E_major_t maj, H5E_minor_t min, const char *str)
{
- const char *tmp_file; /* Copy of the file name */
- const char *tmp_func; /* Copy of the function name */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5E_stack_t *estack; /* Pointer to error stack to modify */
+ const char *tmp_file; /* Copy of the file name */
+ const char *tmp_func; /* Copy of the function name */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
FUNC_ENTER_API_NOCLEAR(FAIL)
- /* Duplicate string information */
- if (NULL == (tmp_file = strdup(file)))
- HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate file string");
- if (NULL == (tmp_func = strdup(func)))
- HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate function string");
-
- /* Increment refcount on non-library IDs */
- if (maj < H5E_first_maj_id_g || maj > H5E_last_maj_id_g)
- if (H5I_inc_ref(maj, false) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment major error ID");
- if (min < H5E_first_min_id_g || min > H5E_last_min_id_g)
- if (H5I_inc_ref(min, false) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment minor error ID");
-
- /* Push the error on the default error stack */
- if (H5E__push_stack(NULL, true, tmp_file, tmp_func, line, H5E_ERR_CLS_g, maj, min, str, NULL) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack");
+ /* Get the 'default' error stack */
+ if (NULL == (estack = H5E__get_my_stack()))
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get the default error stack");
+
+ /* Check if error reporting is paused for this stack */
+ if (!estack->paused) {
+ /* Duplicate string information */
+ if (NULL == (tmp_file = strdup(file)))
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate file string");
+ if (NULL == (tmp_func = strdup(func)))
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate function string");
+
+ /* Increment refcount on non-library IDs */
+ if (maj < H5E_first_maj_id_g || maj > H5E_last_maj_id_g)
+ if (H5I_inc_ref(maj, false) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment major error ID");
+ if (min < H5E_first_min_id_g || min > H5E_last_min_id_g)
+ if (H5I_inc_ref(min, false) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment minor error ID");
+
+ /* Push the error on the default error stack */
+ if (H5E__push_stack(estack, true, tmp_file, tmp_func, line, H5E_ERR_CLS_g, maj, min, str, NULL) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack");
+ }
done:
FUNC_LEAVE_API(ret_value)
@@ -259,6 +267,7 @@ H5Eprint1(FILE *stream)
/* Don't clear the error stack! :-) */
FUNC_ENTER_API_NOCLEAR(FAIL)
+ /* Get the 'default' error stack */
if (NULL == (estack = H5E__get_my_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 00b6efbe33d..9590f3cbbee 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -188,7 +188,6 @@ H5E_init(void)
HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group");
#ifndef H5_HAVE_THREADSAFE
- H5E_stack_g[0].nused = 0;
H5E__set_default_auto(H5E_stack_g);
#endif /* H5_HAVE_THREADSAFE */
@@ -317,7 +316,6 @@ H5E__get_stack(void)
assert(estack);
/* Set the thread-specific info */
- estack->nused = 0;
H5E__set_default_auto(estack);
/* (It's not necessary to release this in this API, it is
@@ -821,8 +819,7 @@ H5E__append_stack(H5E_stack_t *dst_stack, const H5E_stack_t *src_stack)
/*--------------------------------------------------------------------------
* Function: H5E__set_default_auto
*
- * Purpose: Initialize "automatic" error stack reporting info to library
- * default
+ * Purpose: Initialize error stack to library default
*
* Return: SUCCEED/FAIL
*
@@ -833,6 +830,8 @@ H5E__set_default_auto(H5E_stack_t *stk)
{
FUNC_ENTER_PACKAGE_NOERR
+ stk->nused = 0;
+
#ifndef H5_NO_DEPRECATED_SYMBOLS
#ifdef H5_USE_16_API_DEFAULT
stk->auto_op.vers = 1;
@@ -848,6 +847,7 @@ H5E__set_default_auto(H5E_stack_t *stk)
#endif /* H5_NO_DEPRECATED_SYMBOLS */
stk->auto_data = NULL;
+ stk->paused = 0;
FUNC_LEAVE_NOAPI_VOID
} /* end H5E__set_default_auto() */
@@ -1383,9 +1383,10 @@ herr_t
H5E_printf_stack(const char *file, const char *func, unsigned line, hid_t maj_id, hid_t min_id,
const char *fmt, ...)
{
- va_list ap; /* Varargs info */
- bool va_started = false; /* Whether the variable argument list is open */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5E_stack_t *estack; /* Pointer to error stack to modify */
+ va_list ap; /* Varargs info */
+ bool va_started = false; /* Whether the variable argument list is open */
+ herr_t ret_value = SUCCEED; /* Return value */
/*
* WARNING: We cannot call HERROR() from within this function or else we
@@ -1401,18 +1402,20 @@ H5E_printf_stack(const char *file, const char *func, unsigned line, hid_t maj_id
assert(min_id >= H5E_first_min_id_g && min_id <= H5E_last_min_id_g);
assert(fmt);
- /* Note that the variable-argument parsing for the format is identical in
- * the H5Epush2() routine - correct errors and make changes in both
- * places. -QAK
- */
+ /* Get the 'default' error stack */
+ if (NULL == (estack = H5E__get_my_stack()))
+ HGOTO_DONE(FAIL);
- /* Start the variable-argument parsing */
- va_start(ap, fmt);
- va_started = true;
+ /* Check if error reporting is paused for this stack */
+ if (!estack->paused) {
+ /* Start the variable-argument parsing */
+ va_start(ap, fmt);
+ va_started = true;
- /* Push the error on the stack */
- if (H5E__push_stack(NULL, false, file, func, line, H5E_ERR_CLS_g, maj_id, min_id, fmt, &ap) < 0)
- HGOTO_DONE(FAIL);
+ /* Push the error on the stack */
+ if (H5E__push_stack(estack, false, file, func, line, H5E_ERR_CLS_g, maj_id, min_id, fmt, &ap) < 0)
+ HGOTO_DONE(FAIL);
+ }
done:
if (va_started)
@@ -1458,11 +1461,6 @@ H5E__push_stack(H5E_stack_t *estack, bool app_entry, const char *file, const cha
assert(maj_id > 0);
assert(min_id > 0);
- /* Check for 'default' error stack */
- if (estack == NULL)
- if (NULL == (estack = H5E__get_my_stack()))
- HGOTO_DONE(FAIL);
-
/*
* Push the error if there's room. Otherwise just forget it.
*/
@@ -1688,8 +1686,9 @@ H5E_clear_stack(void)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");
/* Empty the error stack */
- if (H5E__clear_entries(estack, estack->nused) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack");
+ if (estack->nused)
+ if (H5E__clear_entries(estack, estack->nused) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1791,3 +1790,80 @@ H5E_dump_api_stack(void)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_dump_api_stack() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5E_pause_stack
+ *
+ * Purpose: Pause pushing errors on the default error stack.
+ *
+ * Generally used via the H5E_PAUSE_ERRORS / H5E_RESUME_ERRORS
+ * macros.
+ *
+ * When one needs to temporarily disable recording errors while
+ * trying something that's likely or expected to fail. The code
+ * to try can be nested between these macros like:
+ *
+ * H5E_PAUSE_ERRORS {
+ * ...stuff here that's likely to fail...
+ * } H5E_RESUME_ERRORS
+ *
+ * Warning: don't break, return, or longjmp() from the block of
+ * code or the error reporting won't be properly restored!
+ *
+ * Return: none
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5E_pause_stack(void)
+{
+ H5E_stack_t *estack = H5E__get_my_stack();
+
+ FUNC_ENTER_NOAPI_NOERR
+
+ assert(estack);
+
+ /* Increment pause counter */
+ estack->paused++;
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5E_pause_stack() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5E_resume_stack
+ *
+ * Purpose: Resume pushing errors on the default error stack.
+ *
+ * Generally used via the H5E_PAUSE_ERRORS / H5E_RESUME_ERRORS
+ * macros.
+ *
+ * When one needs to temporarily disable recording errors while
+ * trying something that's likely or expected to fail. The code
+ * to try can be nested between these macros like:
+ *
+ * H5E_PAUSE_ERRORS {
+ * ...stuff here that's likely to fail...
+ * } H5E_RESUME_ERRORS
+ *
+ * Warning: don't break, return, or longjmp() from the block of
+ * code or the error reporting won't be properly restored!
+ *
+ * Return: none
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5E_resume_stack(void)
+{
+ H5E_stack_t *estack = H5E__get_my_stack();
+
+ FUNC_ENTER_NOAPI_NOERR
+
+ assert(estack);
+ assert(estack->paused);
+
+ /* Decrement pause counter */
+ estack->paused--;
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5E_resume_stack() */
diff --git a/src/H5Epkg.h b/src/H5Epkg.h
index 2d950ca3d7b..1577939c184 100644
--- a/src/H5Epkg.h
+++ b/src/H5Epkg.h
@@ -114,6 +114,7 @@ typedef struct H5E_stack_t {
H5E_entry_t entries[H5E_MAX_ENTRIES]; /* Array of error entries */
H5E_auto_op_t auto_op; /* Operator for 'automatic' error reporting */
void *auto_data; /* Callback data for 'automatic error reporting */
+ unsigned paused; /* Whether error reporting is paused (>0) for this stack */
} H5E_stack_t;
/*****************************/
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index 3777805aeb9..a3f8b693b33 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -21,6 +21,23 @@
/* Private headers needed by this file */
#include "H5private.h"
+/*
+ * When one needs to temporarily disable recording errors while trying
+ * something that's likely or expected to fail. The code to try can be nested
+ * between these macros like:
+ *
+ * H5E_PAUSE_ERRORS {
+ * ...stuff here that's likely to fail...
+ * } H5E_RESUME_ERRORS
+ *
+ * Warning: don't break, return, or longjmp() from the block of code or
+ * the error reporting won't be properly restored!
+ *
+ */
+#define H5E_PAUSE_ERRORS H5E_pause_stack();
+
+#define H5E_RESUME_ERRORS H5E_resume_stack();
+
/*
* HERROR macro, used to facilitate error reporting between a FUNC_ENTER()
* and a FUNC_LEAVE() within a function body. The arguments are the major
@@ -186,5 +203,7 @@ H5_DLL herr_t H5E_printf_stack(const char *file, const char *func, unsigned line
hid_t min_idx, const char *fmt, ...) H5_ATTR_FORMAT(printf, 6, 7);
H5_DLL herr_t H5E_clear_stack(void);
H5_DLL herr_t H5E_dump_api_stack(void);
+H5_DLL void H5E_pause_stack(void);
+H5_DLL void H5E_resume_stack(void);
#endif /* H5Eprivate_H */
diff --git a/src/H5Epublic.h b/src/H5Epublic.h
index 2b0e48dc9fd..49628efb9be 100644
--- a/src/H5Epublic.h
+++ b/src/H5Epublic.h
@@ -77,11 +77,12 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g;
* trying something that's likely or expected to fail. The code to try can
* be nested between calls to H5Eget_auto() and H5Eset_auto(), but it's
* easier just to use this macro like:
+ *
* H5E_BEGIN_TRY {
* ...stuff here that's likely to fail...
* } H5E_END_TRY
*
- * Warning: don't break, return, or longjmp() from the body of the loop or
+ * Warning: don't break, return, or longjmp() from the block of code or
* the error reporting won't be properly restored!
*
* These two macros still use the old API functions for backward compatibility
@@ -322,6 +323,71 @@ H5_DLL hid_t H5Eget_current_stack(void);
* \since 1.14.0
*/
H5_DLL herr_t H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_stack);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief * Check if pushing errors on an error stack is paused
+ *
+ * \estack_id{stack_id}
+ * \param[out] is_paused Flag whether stack is paused
+ * \return \herr_t
+ *
+ * \details H5Eis_paused() can be used within HDF5 VOL connectors and other
+ * dynamically loaded components to check if the HDF5 library, or other
+ * component has paused pushing error on the default error stack or
+ * an application stack.
+ *
+ * The library may pause pushing errors on the default error stack
+ * when performing "speculative" operations, such as testing for the
+ * existence of something that could be located at one of many
+ * locations. \p stack_id is the error stack to query, and the value
+ * pointed to by \p is_paused is set to TRUE/FALSE.
+ *
+ * If an error occurs while attempting to query the status of \p stack_id,
+ * the value pointed to by \p is_paused is unchanged.
+ *
+ * \since 1.14.5
+ */
+H5_DLL herr_t H5Eis_paused(hid_t stack_id, hbool_t *is_paused);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief * Pause pushing errors on an error stack
+ *
+ * \estack_id{stack_id}
+ * \return \herr_t
+ *
+ * \details H5Epause_stack() pauses pushing errors on an error stack. Pushing
+ * an error on a paused error stack will be ignored (not fail).
+ *
+ * H5Eresume_stack() is used to allow errors to be pushed on a stack.
+ * Calls to H5Epause_stack() and H5Eresume_stack() must be matched.
+ *
+ * Calls to H5Epause_stack()/H5Eresume_stack() may be nested.
+ *
+ * \since 1.14.5
+ */
+H5_DLL herr_t H5Epause_stack(hid_t stack_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief * Resume pushing errors on an error stack
+ *
+ * \estack_id{stack_id}
+ * \return \herr_t
+ *
+ * \details H5Eresume_stack() resumes pushing errors on an error stack.
+ *
+ * Calls to H5Epause_stack() and H5Eresume_stack() must be matched.
+ *
+ * Calls to H5Epause_stack()/H5Eresume_stack() may be nested.
+ *
+ * \since 1.14.5
+ */
+H5_DLL herr_t H5Eresume_stack(hid_t stack_id);
/**
* --------------------------------------------------------------------------
* \ingroup H5E
diff --git a/src/H5FD.c b/src/H5FD.c
index 1f603806b7d..a6f35ad6a87 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -693,7 +693,7 @@ H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list");
/* Call private function */
- if (NULL == (ret_value = H5FD_open(name, flags, fapl_id, maxaddr)))
+ if (H5FD_open(false, &ret_value, name, flags, fapl_id, maxaddr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file");
done:
@@ -703,64 +703,88 @@ H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
/*-------------------------------------------------------------------------
* Function: H5FD_open
*
- * Purpose: Private version of H5FDopen()
- *
- * Return: Success: Pointer to a new file driver struct
+ * Purpose: Opens a file named NAME for the type(s) of access described
+ * by the bit vector FLAGS according to a file access
+ * property list FAPL_ID (which may be the constant H5P_DEFAULT).
+ * The file should expect to handle format addresses in the range
+ * [0, MAXADDR] (if MAXADDR is the undefined address then the
+ * caller doesn't care about the address range).
+ *
+ * If the 'try' flag is true, the VFD 'open' callback is called
+ * with errors paused and not opening the file is not treated as
+ * an error; SUCCEED is returned, with the file ptr set to NULL.
+ * If 'try' is false, the VFD 'open' callback is made with errors
+ * unpaused and a failure generates an error.
*
- * Failure: NULL
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
-H5FD_t *
-H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
+herr_t
+H5FD_open(bool try, H5FD_t **_file, const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
- H5FD_class_t *driver; /* VFD for file */
- H5FD_t *file = NULL; /* VFD file struct */
- H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */
- H5P_genplist_t *plist; /* Property list pointer */
- unsigned long driver_flags = 0; /* File-inspecific driver feature flags */
- H5FD_file_image_info_t file_image_info; /* Initial file image */
- H5FD_t *ret_value = NULL; /* Return value */
+ H5FD_t *file = NULL; /* File opened */
+ H5FD_class_t *driver; /* VFD for file */
+ H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */
+ H5P_genplist_t *plist; /* Property list pointer */
+ unsigned long driver_flags = 0; /* File-inspecific driver feature flags */
+ H5FD_file_image_info_t file_image_info; /* Initial file image */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(NULL)
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Reset 'out' parameter */
+ *_file = NULL;
/* Sanity checks */
if (0 == maxaddr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "zero format address range");
/* Get file access property list */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
/* Get the VFD to open the file with */
if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID & info");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info");
/* Get driver info */
if (NULL == (driver = (H5FD_class_t *)H5I_object(driver_prop.driver_id)))
- HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list");
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list");
if (NULL == driver->open)
- HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method");
+ HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no `open' method");
/* Query driver flag */
if (H5FD_driver_query(driver, &driver_flags) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't query VFD flags");
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't query VFD flags");
/* Get initial file image info */
if (H5P_peek(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file image info");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info");
/* If an image is provided, make sure the driver supports this feature */
- assert(((file_image_info.buffer != NULL) && (file_image_info.size > 0)) ||
- ((file_image_info.buffer == NULL) && (file_image_info.size == 0)));
- if ((file_image_info.buffer != NULL) && !(driver_flags & H5FD_FEAT_ALLOW_FILE_IMAGE))
- HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file image set, but not supported.");
+ assert((file_image_info.buffer && file_image_info.size > 0) ||
+ (!file_image_info.buffer && file_image_info.size == 0));
+ if (file_image_info.buffer && !(driver_flags & H5FD_FEAT_ALLOW_FILE_IMAGE))
+ HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file image set, but not supported.");
- /* Dispatch to file driver */
if (HADDR_UNDEF == maxaddr)
maxaddr = driver->maxaddr;
- if (NULL == (file = (driver->open)(name, flags, fapl_id, maxaddr)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed");
+
+ /* Try dispatching to file driver */
+ if (try) {
+ H5E_PAUSE_ERRORS
+ {
+ file = (driver->open)(name, flags, fapl_id, maxaddr);
+ }
+ H5E_RESUME_ERRORS
+
+ /* Check if file was not opened */
+ if (NULL == file)
+ HGOTO_DONE(SUCCEED);
+ }
+ else if (NULL == (file = (driver->open)(name, flags, fapl_id, maxaddr)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "can't open file");
/* Set the file access flags */
file->access_flags = flags;
@@ -770,22 +794,22 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
*/
file->driver_id = driver_prop.driver_id;
if (H5I_inc_ref(file->driver_id, false) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver");
file->cls = driver;
file->maxaddr = maxaddr;
- if (H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &(file->threshold)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment threshold");
- if (H5P_get(plist, H5F_ACS_ALIGN_NAME, &(file->alignment)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment");
+ if (H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &file->threshold) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment threshold");
+ if (H5P_get(plist, H5F_ACS_ALIGN_NAME, &file->alignment) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment");
/* Retrieve the VFL driver feature flags */
- if (H5FD__query(file, &(file->feature_flags)) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver");
+ if (H5FD__query(file, &file->feature_flags) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to query file driver");
/* Increment the global serial number & assign it to this H5FD_t object */
if (++H5FD_file_serial_no_g == 0) {
/* (Just error out if we wrap around for now...) */
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to get file serial number");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to get file serial number");
} /* end if */
file->fileno = H5FD_file_serial_no_g;
@@ -793,8 +817,8 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
/* (This will be changed later, when the superblock is located) */
file->base_addr = 0;
- /* Set return value */
- ret_value = file;
+ /* Set 'out' parameter */
+ *_file = file;
done:
/* Can't cleanup 'file' information, since we don't know what type it is */
diff --git a/src/H5FDonion.c b/src/H5FDonion.c
index f1b46d83ada..96f9166b244 100644
--- a/src/H5FDonion.c
+++ b/src/H5FDonion.c
@@ -710,25 +710,20 @@ H5FD__onion_create_truncate_onion(H5FD_onion_t *file, const char *filename, cons
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid backing FAPL ID");
/* Create backing files for onion history */
-
- if (NULL == (file->original_file = H5FD_open(filename, flags, backing_fapl_id, maxaddr)))
+ if (H5FD_open(false, &file->original_file, filename, flags, backing_fapl_id, maxaddr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "cannot open the backing file");
-
- if (NULL == (file->onion_file = H5FD_open(name_onion, flags, backing_fapl_id, maxaddr)))
+ if (H5FD_open(false, &file->onion_file, name_onion, flags, backing_fapl_id, maxaddr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "cannot open the backing onion file");
-
- if (NULL == (file->recovery_file = H5FD_open(recovery_file_nameery, flags, backing_fapl_id, maxaddr)))
+ if (H5FD_open(false, &file->recovery_file, recovery_file_nameery, flags, backing_fapl_id, maxaddr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "cannot open the backing file");
/* Write "empty" .h5 file contents (signature ONIONEOF) */
-
if (H5FD_set_eoa(file->original_file, H5FD_MEM_DRAW, 8) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't extend EOA");
if (H5FD_write(file->original_file, H5FD_MEM_DRAW, 0, 8, "ONIONEOF") < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "cannot write header to the backing h5 file");
/* Write nascent history (with no revisions) to "recovery" */
-
if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HISTORY)))
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer");
size = H5FD__onion_history_encode(history, buf, &history->checksum);
@@ -745,7 +740,6 @@ H5FD__onion_create_truncate_onion(H5FD_onion_t *file, const char *filename, cons
/* Write history header with "no" history.
* Size of the "recovery" history recorded for later use on close.
*/
-
if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HEADER)))
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer");
size = H5FD__onion_header_encode(hdr, buf, &hdr->checksum);
@@ -1019,15 +1013,12 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma
/* Opening an existing onion file */
/* Open the existing file using the specified fapl */
- if (NULL == (file->original_file = H5FD_open(filename, flags, backing_fapl_id, maxaddr)))
+ if (H5FD_open(false, &file->original_file, filename, flags, backing_fapl_id, maxaddr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open canonical file (does not exist?)");
/* Try to open any existing onion file */
- H5E_BEGIN_TRY
- {
- file->onion_file = H5FD_open(name_onion, flags, backing_fapl_id, maxaddr);
- }
- H5E_END_TRY
+ if (H5FD_open(true, &file->onion_file, name_onion, flags, backing_fapl_id, maxaddr) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "cannot try opening the backing onion file");
/* If that didn't work, create a new onion file */
/* TODO: Move to a new function */
@@ -1054,9 +1045,8 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma
file->align_history_on_pages = true;
}
- if (HADDR_UNDEF == (canon_eof = H5FD_get_eof(file->original_file, H5FD_MEM_DEFAULT))) {
+ if (HADDR_UNDEF == (canon_eof = H5FD_get_eof(file->original_file, H5FD_MEM_DEFAULT)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "cannot get size of canonical file");
- }
if (H5FD_set_eoa(file->original_file, H5FD_MEM_DRAW, canon_eof) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't extend EOA");
hdr->origin_eof = canon_eof;
@@ -1068,11 +1058,9 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid backing FAPL ID");
/* Create backing files for onion history */
-
- if ((file->onion_file = H5FD_open(name_onion, (H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC),
- backing_fapl_id, maxaddr)) == NULL) {
+ if (H5FD_open(false, &file->onion_file, name_onion,
+ (H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC), backing_fapl_id, maxaddr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "cannot open the backing onion file");
- }
/* Write history header with "no" history */
hdr->history_size = H5FD_ONION_ENCODED_SIZE_HISTORY; /* record for later use */
@@ -1092,16 +1080,14 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma
history->n_revisions = 0;
size = H5FD__onion_history_encode(history, hist_buf, &history->checksum);
file->header.history_size = size; /* record for later use */
- if (H5FD_ONION_ENCODED_SIZE_HISTORY != size) {
+ if (H5FD_ONION_ENCODED_SIZE_HISTORY != size)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't encode history");
- }
if (H5FD_set_eoa(file->onion_file, H5FD_MEM_DRAW, saved_size + size + 1) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't extend EOA");
- if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, 0, saved_size, head_buf) < 0) {
+ if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, 0, saved_size, head_buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, NULL,
"cannot write header to the backing onion file");
- }
file->onion_eof = (haddr_t)saved_size;
if (true == file->align_history_on_pages)
@@ -1112,24 +1098,21 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma
file->header.history_addr = file->onion_eof;
/* Write nascent history (with no revisions) to the backing onion file */
- if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, saved_size + 1, size, hist_buf) < 0) {
+ if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, saved_size + 1, size, hist_buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, NULL,
"cannot write history to the backing onion file");
- }
file->header.history_size = size; /* record for later use */
H5MM_xfree(head_buf);
H5MM_xfree(hist_buf);
}
- else {
+ else
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open onion file (does not exist?).");
- }
}
- if (HADDR_UNDEF == (canon_eof = H5FD_get_eof(file->original_file, H5FD_MEM_DEFAULT))) {
+ if (HADDR_UNDEF == (canon_eof = H5FD_get_eof(file->original_file, H5FD_MEM_DEFAULT)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "cannot get size of canonical file");
- }
if (H5FD_set_eoa(file->original_file, H5FD_MEM_DRAW, canon_eof) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't extend EOA");
@@ -1139,10 +1122,9 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma
file->align_history_on_pages =
(file->header.flags & H5FD_ONION_HEADER_FLAG_PAGE_ALIGNMENT) ? true : false;
- if (H5FD_ONION_HEADER_FLAG_WRITE_LOCK & file->header.flags) {
- /* Opening a file twice in write mode is an error */
+ /* Opening a file twice in write mode is an error */
+ if (H5FD_ONION_HEADER_FLAG_WRITE_LOCK & file->header.flags)
HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "Can't open file already opened in write-mode");
- }
else {
/* Read in the history from the onion file */
if (H5FD__onion_ingest_history(&file->history, file->onion_file, file->header.history_addr,
@@ -1154,21 +1136,18 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma
fa->revision_num != H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "target revision ID out of range");
- if (fa->revision_num == 0) {
+ if (fa->revision_num == 0)
file->curr_rev_record.logical_eof = canon_eof;
- }
else if (file->history.n_revisions > 0 &&
H5FD__onion_ingest_revision_record(
&file->curr_rev_record, file->onion_file, &file->history,
- MIN(fa->revision_num - 1, (file->history.n_revisions - 1))) < 0) {
+ MIN(fa->revision_num - 1, (file->history.n_revisions - 1))) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get revision record from backing store");
- }
if (H5F_ACC_RDWR & flags)
if (H5FD__onion_open_rw(file, flags, maxaddr, new_open) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "can't write-open write-locked file");
}
-
} /* End if opening existing file */
/* Copy comment from FAPL info, if one is given */
@@ -1211,7 +1190,6 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma
H5I_dec_app_ref(fa->backing_fapl_id);
if ((NULL == ret_value) && file) {
-
if (file->original_file)
if (H5FD_close(file->original_file) < 0)
HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, NULL, "can't destroy backing canon");
@@ -1221,13 +1199,11 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma
if (file->recovery_file)
if (H5FD_close(file->recovery_file) < 0)
HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, NULL, "can't destroy backing recov");
-
if (file->rev_index)
if (H5FD__onion_revision_index_destroy(file->rev_index) < 0)
HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, NULL, "can't destroy revision index");
H5MM_xfree(file->history.record_locs);
-
H5MM_xfree(file->recovery_file_name);
H5MM_xfree(file->curr_rev_record.comment);
@@ -1270,10 +1246,8 @@ H5FD__onion_open_rw(H5FD_onion_t *file, unsigned int flags, haddr_t maxaddr, boo
HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't write-open write-locked file");
/* Copy history to recovery file */
-
- if (NULL ==
- (file->recovery_file = H5FD_open(file->recovery_file_name, (flags | H5F_ACC_CREAT | H5F_ACC_TRUNC),
- file->fa.backing_fapl_id, maxaddr)))
+ if (H5FD_open(false, &file->recovery_file, file->recovery_file_name,
+ (flags | H5F_ACC_CREAT | H5F_ACC_TRUNC), file->fa.backing_fapl_id, maxaddr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "unable to create recovery file");
if (0 == (size = H5FD__onion_write_history(&file->history, file->recovery_file, 0, 0)))
@@ -1282,20 +1256,15 @@ H5FD__onion_open_rw(H5FD_onion_t *file, unsigned int flags, haddr_t maxaddr, boo
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "written history differed from expected size");
/* Set write-lock flag in onion header */
-
if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HEADER)))
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate space for encoded buffer");
-
file->header.flags |= H5FD_ONION_HEADER_FLAG_WRITE_LOCK;
-
if (0 == (size = H5FD__onion_header_encode(&file->header, buf, &checksum)))
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "problem encoding history header");
-
if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, 0, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write updated history header");
/* Prepare revision index and finalize write-mode open */
-
if (NULL == (file->rev_index = H5FD__onion_revision_index_init(file->fa.page_size)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize revision index");
file->curr_rev_record.parent_revision_num = file->curr_rev_record.revision_num;
@@ -1679,7 +1648,7 @@ H5FDonion_get_revision_count(const char *filename, hid_t fapl_id, uint64_t *revi
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Onion VFL driver");
/* Open the file with the driver */
- if (NULL == (file = H5FD_open(filename, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF)))
+ if (H5FD_open(false, &file, filename, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "unable to open file with onion driver");
/* Call the private function */
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 2fe54a588a9..942dc21e2e5 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -124,7 +124,8 @@ H5_DLL htri_t H5FD_is_driver_registered_by_name(const char *driver_name,
H5_DLL htri_t H5FD_is_driver_registered_by_value(H5FD_class_value_t driver_value, hid_t *registered_id);
H5_DLL hid_t H5FD_get_driver_id_by_name(const char *name, bool is_api);
H5_DLL hid_t H5FD_get_driver_id_by_value(H5FD_class_value_t value, bool is_api);
-H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
+H5_DLL herr_t H5FD_open(bool try, H5FD_t **file, const char *name, unsigned flags, hid_t fapl_id,
+ haddr_t maxaddr);
H5_DLL herr_t H5FD_close(H5FD_t *file);
H5_DLL int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2);
H5_DLL herr_t H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags /*out*/);
diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c
index 434f870407f..778d112822e 100644
--- a/src/H5FDsplitter.c
+++ b/src/H5FDsplitter.c
@@ -854,12 +854,9 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha
} /* end if logfile path given */
} /* end if logfile pointer/handle does not exist */
- file_ptr->rw_file = H5FD_open(name, flags, fapl_ptr->rw_fapl_id, HADDR_UNDEF);
- if (!file_ptr->rw_file)
+ if (H5FD_open(false, &file_ptr->rw_file, name, flags, fapl_ptr->rw_fapl_id, HADDR_UNDEF) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open R/W file");
-
- file_ptr->wo_file = H5FD_open(fapl_ptr->wo_path, flags, fapl_ptr->wo_fapl_id, HADDR_UNDEF);
- if (!file_ptr->wo_file)
+ if (H5FD_open(false, &file_ptr->wo_file, fapl_ptr->wo_path, flags, fapl_ptr->wo_fapl_id, HADDR_UNDEF) < 0)
H5FD_SPLITTER_WO_ERROR(file_ptr, __func__, H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open W/O file")
ret_value = (H5FD_t *)file_ptr;
diff --git a/src/H5FDsubfiling/H5FDsubfiling.c b/src/H5FDsubfiling/H5FDsubfiling.c
index 7971050b1c4..6fbd3696200 100644
--- a/src/H5FDsubfiling/H5FDsubfiling.c
+++ b/src/H5FDsubfiling/H5FDsubfiling.c
@@ -1235,7 +1235,7 @@ H5FD__subfiling_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t ma
H5_SUBFILING_GOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, "can't set stub file ID on FAPL");
/* Open the HDF5 file's subfiles */
- if (NULL == (file_ptr->sf_file = H5FD_open(name, flags, file_ptr->fa.ioc_fapl_id, HADDR_UNDEF)))
+ if (H5FD_open(false, &file_ptr->sf_file, name, flags, file_ptr->fa.ioc_fapl_id, HADDR_UNDEF) < 0)
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open IOC file");
if (driver->value == H5_VFD_IOC) {
diff --git a/src/H5FDsubfiling/H5subfiling_common.c b/src/H5FDsubfiling/H5subfiling_common.c
index 0493603f828..53fb0ce3c4c 100644
--- a/src/H5FDsubfiling/H5subfiling_common.c
+++ b/src/H5FDsubfiling/H5subfiling_common.c
@@ -573,7 +573,7 @@ H5_open_subfiling_stub_file(const char *name, unsigned flags, MPI_Comm file_comm
if (H5P_set_driver(plist, H5FD_MPIO, NULL, NULL) < 0)
H5_SUBFILING_GOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI I/O driver on FAPL");
- if (NULL == (stub_file = H5FD_open(name, flags, fapl_id, HADDR_UNDEF)))
+ if (H5FD_open(false, &stub_file, name, flags, fapl_id, HADDR_UNDEF) < 0)
H5_SUBFILING_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "couldn't open HDF5 stub file");
HDcompile_assert(sizeof(uint64_t) >= sizeof(ino_t));
diff --git a/src/H5Fefc.c b/src/H5Fefc.c
index fa7dd1e6d0b..e8ecc6d0efe 100644
--- a/src/H5Fefc.c
+++ b/src/H5Fefc.c
@@ -62,6 +62,8 @@ struct H5F_efc_t {
};
/* Private prototypes */
+static herr_t H5F__efc_open_file(bool try, H5F_t **file, const char *name, unsigned flags, hid_t fcpl_id,
+ hid_t fapl_id);
static herr_t H5F__efc_release_real(H5F_efc_t *efc);
static herr_t H5F__efc_remove_ent(H5F_efc_t *efc, H5F_efc_ent_t *ent);
static void H5F__efc_try_close_tag1(H5F_shared_t *sf, H5F_shared_t **tail);
@@ -114,66 +116,128 @@ H5F__efc_create(unsigned max_nfiles)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__efc_create() */
+/*-------------------------------------------------------------------------
+ * Function: H5F__efc_open_file
+ *
+ * Purpose: Helper routine to try opening and setting up a file.
+ *
+ * If the 'try' flag is true, not opening the file with the
+ * underlying 'open' call is not treated an error; SUCCEED is
+ * returned, with the file ptr set to NULL. If 'try' is false,
+ * failing the 'open' call generates an error.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5F__efc_open_file(bool try, H5F_t **_file, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
+{
+ H5F_t *file = NULL; /* File opened */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Reset 'out' parameter */
+ *_file = NULL;
+
+ /* Open the file */
+ if (H5F_open(try, &file, name, flags, fcpl_id, fapl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't open file");
+
+ /* Check if file was not opened */
+ if (NULL == file) {
+ assert(try);
+ HGOTO_DONE(SUCCEED);
+ }
+
+ /* Make file post open call */
+ if (H5F__post_open(file) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't finish opening file");
+
+ /* Increment the number of open objects to prevent the file from being
+ * closed out from under us - "simulate" having an open file id. Note
+ * that this behaviour replaces the calls to H5F_incr_nopen_objs() and
+ * H5F_decr_nopen_objs() in H5L_extern_traverse(). */
+ file->nopen_objs++;
+
+ /* Set 'out' parameter */
+ *_file = file;
+
+done:
+ if (ret_value < 0)
+ if (file)
+ if (H5F_try_close(file, NULL) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close external file");
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__efc_open_file() */
+
/*-------------------------------------------------------------------------
* Function: H5F__efc_open
*
- * Purpose: Opens a file using the external file cache. The target
- * file is added to the external file cache of the parent
- * if it is not already present. If the target file is in
- * the parent's EFC, simply returns the target file. When
+ * Purpose: Attempts to open a file using the external file cache.
+ *
+ * The target file is added to the external file cache of the
+ * parent if it is not already present. If the target file is
+ * in the parent's EFC, simply returns the target file. When
* the file object is no longer in use, it should be closed
* with H5F_efc_close (will not actually close the file
* until it is evicted from the EFC).
*
- * Return: Pointer to open file on success
- * NULL on failure
+ * If the 'try' flag is true, not opening the file with the
+ * underlying 'open' call is not treated an error; SUCCEED is
+ * returned, with the file ptr set to NULL. If 'try' is false,
+ * failing the 'open' call generates an error.
+ *
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
-H5F_t *
-H5F__efc_open(H5F_efc_t *efc, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
+herr_t
+H5F__efc_open(bool try, H5F_efc_t *efc, H5F_t **_file, const char *name, unsigned flags, hid_t fcpl_id,
+ hid_t fapl_id)
{
- H5F_efc_ent_t *ent = NULL; /* Entry for target file in efc */
- bool open_file = false; /* Whether ent->file needs to be closed in case of error */
- H5P_genplist_t *plist; /* Property list pointer for FAPL */
- H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
- H5F_t *ret_value = NULL; /* Return value */
+ H5F_efc_ent_t *ent = NULL; /* Entry for target file in efc */
+ bool open_file = false; /* Whether ent->file needs to be closed in case of error */
+ H5P_genplist_t *plist; /* Property list pointer for FAPL */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Sanity checks */
+ assert(_file);
assert(name);
+ /* Reset 'out' parameter */
+ *_file = NULL;
+
/* Get the VOL info from the fapl */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
- HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, NULL, "not a file access property list");
+ HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file access property list");
if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get VOL connector info");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL connector info");
/* Stash a copy of the "top-level" connector property, before any pass-through
* connectors modify or unwrap it.
*/
if (H5CX_set_vol_connector_prop(&connector_prop) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set VOL connector info in API context");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VOL connector info in API context");
- /* Check if the EFC exists. If it does not, just call H5F_open(). We
+ /* Check if the EFC exists. If it does not, just open the file. We
* support this so clients do not have to make 2 different calls depending
* on the state of the efc. */
if (!efc) {
- if (NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file");
+ if (H5F__efc_open_file(try, _file, name, flags, fcpl_id, fapl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file");
- /* Make file post open call */
- if (H5F__post_open(ret_value) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file");
+ /* Check if file was not opened */
+ if (NULL == *_file)
+ assert(try);
- /* Increment the number of open objects to prevent the file from being
- * closed out from under us - "simulate" having an open file id. Note
- * that this behaviour replaces the calls to H5F_incr_nopen_objs() and
- * H5F_decr_nopen_objs() in H5L_extern_traverse(). */
- ret_value->nopen_objs++;
-
- HGOTO_DONE(ret_value);
+ /* Done now */
+ HGOTO_DONE(SUCCEED);
} /* end if */
/* Search the skip list for name if the skip list exists, create the skip
@@ -185,7 +249,7 @@ H5F__efc_open(H5F_efc_t *efc, const char *name, unsigned flags, hid_t fcpl_id, h
else {
assert(efc->nfiles == 0);
if (NULL == (efc->slist = H5SL_create(H5SL_TYPE_STR, NULL)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, NULL, "can't create skip list");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "can't create skip list");
} /* end else */
/* If we found the file update the LRU list and return the cached file,
@@ -231,54 +295,56 @@ H5F__efc_open(H5F_efc_t *efc, const char *name, unsigned flags, hid_t fcpl_id, h
* do not add it to cache */
if (ent) {
if (H5F__efc_remove_ent(efc, ent) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTREMOVE, NULL,
+ HGOTO_ERROR(H5E_FILE, H5E_CANTREMOVE, FAIL,
"can't remove entry from external file cache");
/* Do not free ent, we will recycle it below */
} /* end if */
else {
- /* Cannot cache file, just open file and return */
- if (NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file");
+ /* Cannot cache file, just try opening file and return */
+ if (H5F__efc_open_file(try, _file, name, flags, fcpl_id, fapl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file");
- /* Make file post open call */
- if (H5F__post_open(ret_value) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file");
+ /* Check if file was not opened */
+ if (NULL == *_file)
+ assert(try);
- /* Increment the number of open objects to prevent the file from
- * being closed out from under us - "simulate" having an open
- * file id */
- ret_value->nopen_objs++;
-
- HGOTO_DONE(ret_value);
+ /* Done now */
+ HGOTO_DONE(SUCCEED);
} /* end else */
} /* end if */
else
/* Allocate new entry */
if (NULL == (ent = H5FL_MALLOC(H5F_efc_ent_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "memory allocation failed");
- /* Build new entry */
- if (NULL == (ent->name = H5MM_strdup(name)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ /* Reset pointers */
+ ent->file = NULL;
+ ent->name = NULL;
- /* Open the file */
- if (NULL == (ent->file = H5F_open(name, flags, fcpl_id, fapl_id)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file");
- open_file = true;
+ /* Try opening the file */
+ if (H5F__efc_open_file(try, &ent->file, name, flags, fcpl_id, fapl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file");
- /* Make file post open call */
- if (H5F__post_open(ent->file) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file");
+ /* Check if file was actually opened */
+ if (NULL == ent->file) {
+ /* Sanity check */
+ assert(try);
+
+ ent = H5FL_FREE(H5F_efc_ent_t, ent);
+ HGOTO_DONE(SUCCEED);
+ }
+ else
+ open_file = true;
- /* Increment the number of open objects to prevent the file from being
- * closed out from under us - "simulate" having an open file id */
- ent->file->nopen_objs++;
+ /* Build new entry */
+ if (NULL == (ent->name = H5MM_strdup(name)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "memory allocation failed");
/* Add the file to the cache */
/* Skip list */
if (H5SL_insert(efc->slist, ent, ent->name) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, NULL, "can't insert entry into skip list");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, FAIL, "can't insert entry into skip list");
/* Add to head of LRU list and update tail if necessary */
ent->LRU_next = efc->LRU_head;
@@ -300,23 +366,18 @@ H5F__efc_open(H5F_efc_t *efc, const char *name, unsigned flags, hid_t fcpl_id, h
ent->file->shared->efc->nrefs++;
} /* end else */
- assert(ent);
- assert(ent->file);
- assert(ent->name);
- assert(ent->nopen);
-
- /* Set the return value */
- ret_value = ent->file;
+ /* Set 'out' parameter */
+ *_file = ent->file;
done:
- if (!ret_value)
+ if (ret_value < 0)
if (ent) {
if (open_file) {
ent->file->nopen_objs--;
if (H5F_try_close(ent->file, NULL) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "can't close external file");
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close external file");
} /* end if */
- ent->name = (char *)H5MM_xfree(ent->name);
+ ent->name = H5MM_xfree(ent->name);
ent = H5FL_FREE(H5F_efc_ent_t, ent);
} /* end if */
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 0cc48c82c9f..883cc00d857 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -819,12 +819,12 @@ H5F__getenv_prefix_name(char **env_prefix /*in,out*/)
*
* Purpose: Attempts to open a dataset file.
*
- * Return: Pointer to an opened file on success / NULL on failure
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
-H5F_t *
-H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const char *prop_prefix,
- const char *file_name, unsigned file_intent, hid_t fapl_id)
+herr_t
+H5F_prefix_open_file(bool try, H5F_t **_file, H5F_t *primary_file, H5F_prefix_open_t prefix_type,
+ const char *prop_prefix, const char *file_name, unsigned file_intent, hid_t fapl_id)
{
H5F_t *src_file = NULL; /* Source file */
H5F_efc_t *efc = NULL; /* External file cache */
@@ -832,12 +832,14 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
char *actual_file_name = NULL; /* File's actual name */
char *temp_file_name = NULL; /* Temporary pointer to file name */
size_t temp_file_name_len; /* Length of temporary file name */
- H5F_t *ret_value = NULL; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI(FAIL)
- assert(primary_file);
- assert(primary_file->shared);
+ assert(_file);
+
+ /* Reset 'out' parameter */
+ *_file = NULL;
efc = primary_file->shared->efc;
@@ -846,21 +848,19 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
/* Copy the file name to use */
if (NULL == (temp_file_name = H5MM_strdup(file_name)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "memory allocation failed");
temp_file_name_len = strlen(temp_file_name);
/* Target file_name is an absolute pathname: see RM for detailed description */
if (H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) {
/* Try opening file */
- src_file = H5F__efc_open(efc, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
+ if (H5F__efc_open(true, efc, &src_file, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file");
/* Adjust temporary file name if file not opened */
if (NULL == src_file) {
char *ptr;
- /* Reset the error stack */
- H5E_clear_stack();
-
/* Get last component of file_name */
H5_GET_LAST_DELIMITER(file_name, ptr)
assert(ptr);
@@ -875,13 +875,11 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
} /* end if */
else if (H5_CHECK_ABS_DRIVE(file_name)) {
/* Try opening file */
- src_file = H5F__efc_open(efc, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
+ if (H5F__efc_open(true, efc, &src_file, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file");
/* Adjust temporary file name if file not opened */
if (NULL == src_file) {
- /* Reset the error stack */
- H5E_clear_stack();
-
/* Strip ":" */
strncpy(temp_file_name, &file_name[2], temp_file_name_len);
temp_file_name[temp_file_name_len - 1] = '\0';
@@ -898,7 +896,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
else if (H5F_PREFIX_ELINK == prefix_type)
env_prefix = getenv("HDF5_EXT_PREFIX");
else
- HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, NULL, "prefix type is not sensible");
+ HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "prefix type is not sensible");
/* If environment variable is defined, iterate through prefixes it defines */
if (NULL != env_prefix) {
@@ -906,7 +904,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
/* Make a copy of the environment variable string */
if (NULL == (saved_env = tmp_env_prefix = H5MM_strdup(env_prefix)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "memory allocation failed");
/* Loop over prefixes in environment variable */
while ((tmp_env_prefix) && (*tmp_env_prefix)) {
@@ -916,23 +914,20 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
if (out_prefix_name && (*out_prefix_name)) {
if (H5F__build_name(out_prefix_name, temp_file_name, &full_name /*out*/) < 0) {
saved_env = (char *)H5MM_xfree(saved_env);
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't prepend prefix to filename");
} /* end if */
/* Try opening file */
- src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
+ if (H5F__efc_open(true, efc, &src_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT,
+ fapl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file");
/* Release copy of file name */
full_name = (char *)H5MM_xfree(full_name);
- /* Check for file not opened */
- if (NULL == src_file)
- /* Reset the error stack */
- H5E_clear_stack();
/* Leave if file was opened */
- else
+ if (src_file)
break;
- H5E_clear_stack();
} /* end if */
} /* end while */
@@ -944,18 +939,14 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
if (src_file == NULL && prop_prefix) {
/* Construct name to open */
if (H5F__build_name(prop_prefix, temp_file_name, &full_name /*out*/) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't prepend prefix to filename");
/* Try opening file */
- src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
+ if (H5F__efc_open(true, efc, &src_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file");
/* Release name */
full_name = (char *)H5MM_xfree(full_name);
-
- /* Check for file not opened */
- if (NULL == src_file)
- /* Reset the error stack */
- H5E_clear_stack();
} /* end if */
/* Try searching from main file's "extpath": see description in H5F_open() & H5_build_extpath() */
@@ -965,30 +956,24 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
if (NULL != (dspath = H5F_EXTPATH(primary_file))) {
/* Construct name to open */
if (H5F__build_name(dspath, temp_file_name, &full_name /*out*/) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't prepend prefix to filename");
/* Try opening file */
- src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
+ if (H5F__efc_open(true, efc, &src_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT,
+ fapl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file");
/* Release name */
full_name = (char *)H5MM_xfree(full_name);
-
- /* Check for file not opened */
- if (NULL == src_file)
- /* Reset the error stack */
- H5E_clear_stack();
} /* end if */
} /* end if */
/* Try the relative file_name stored in temp_file_name */
if (src_file == NULL) {
/* Try opening file */
- src_file = H5F__efc_open(efc, temp_file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
-
- /* Check for file not opened */
- if (NULL == src_file)
- /* Reset the error stack */
- H5E_clear_stack();
+ if (H5F__efc_open(true, efc, &src_file, temp_file_name, file_intent, H5P_FILE_CREATE_DEFAULT,
+ fapl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file");
} /* end if */
/* try the 'resolved' name for the virtual file */
@@ -997,7 +982,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
/* Copy resolved file name */
if (NULL == (actual_file_name = H5MM_strdup(H5F_ACTUAL_NAME(primary_file))))
- HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "can't duplicate resolved file name string");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't duplicate resolved file name string");
/* get last component of file_name */
H5_GET_LAST_DELIMITER(actual_file_name, ptr)
@@ -1007,28 +992,28 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
/* Build new file name for the external file */
if (H5F__build_name((ptr ? actual_file_name : ""), temp_file_name, &full_name /*out*/) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't prepend prefix to filename");
actual_file_name = (char *)H5MM_xfree(actual_file_name);
/* Try opening with the resolved name */
- src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
+ if (H5F__efc_open(true, efc, &src_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file");
/* Release name */
full_name = (char *)H5MM_xfree(full_name);
-
- /* Check for file not opened */
- if (NULL == src_file)
- /* Reset the error stack */
- H5E_clear_stack();
} /* end if */
- /* Set return value (possibly NULL or valid H5F_t *) */
- ret_value = src_file;
+ /* Set 'out' parameter */
+ *_file = src_file;
+
+ /* See is we should return an error */
+ if (NULL == src_file && !try)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't open file");
done:
- if ((NULL == ret_value) && src_file)
- if (H5F_efc_close(primary_file, src_file) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "can't close source file");
+ if (ret_value < 0)
+ if (src_file && H5F_efc_close(primary_file, src_file) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close source file");
if (full_name)
full_name = (char *)H5MM_xfree(full_name);
if (temp_file_name)
@@ -1050,7 +1035,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
htri_t
H5F__is_hdf5(const char *name, hid_t fapl_id)
{
- H5FD_t *file = NULL; /* Low-level file struct */
+ H5FD_t *lf = NULL; /* Low-level file struct */
H5F_shared_t *shared = NULL; /* Shared part of file */
haddr_t sig_addr = HADDR_UNDEF; /* Address of hdf5 file signature */
htri_t ret_value = FAIL; /* Return value */
@@ -1061,7 +1046,7 @@ H5F__is_hdf5(const char *name, hid_t fapl_id)
/* NOTE: This now uses the fapl_id that was passed in, so H5Fis_accessible()
* should work with arbitrary VFDs, unlike H5Fis_hdf5().
*/
- if (NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF)))
+ if (H5FD_open(false, &lf, name, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to open file");
/* If the file is already open, it's an HDF5 file
@@ -1070,19 +1055,19 @@ H5F__is_hdf5(const char *name, hid_t fapl_id)
* mandatory file locks (like Windows), creating a new file handle and attempting
* to read through it will fail so we have to try this first.
*/
- if ((shared = H5F__sfile_search(file)) != NULL)
+ if (NULL != (shared = H5F__sfile_search(lf)))
ret_value = true;
else {
/* The file is an HDF5 file if the HDF5 file signature can be found */
- if (H5FD_locate_signature(file, &sig_addr) < 0)
+ if (H5FD_locate_signature(lf, &sig_addr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "error while trying to locate file signature");
ret_value = (HADDR_UNDEF != sig_addr);
}
done:
/* Close the file */
- if (file)
- if (H5FD_close(file) < 0 && true == ret_value)
+ if (lf)
+ if (H5FD_close(lf) < 0 && true == ret_value)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file");
FUNC_LEAVE_NOAPI(ret_value)
@@ -1724,10 +1709,10 @@ H5F__check_if_using_file_locks(H5P_genplist_t *fapl, bool *use_file_locking, boo
} /* end H5F__check_if_using_file_locks() */
/*-------------------------------------------------------------------------
- * Function: H5F_open
+ * Function: H5F_open
*
- * Purpose: Opens (or creates) a file. This function understands the
- * following flags which are similar in nature to the Posix
+ * Purpose: Attempts to open (or create) a file. This function understands
+ * the following flags which are similar in nature to the POSIX
* open(2) flags.
*
* H5F_ACC_RDWR: Open with read/write access. If the file is
@@ -1791,13 +1776,17 @@ H5F__check_if_using_file_locks(H5P_genplist_t *fapl, bool *use_file_locking, boo
* f: the open fails with flags combination from both the first and second opens
* s: the open succeeds with flags combination from both the first and second opens
*
+ * NOTE: If the 'try' flag is true, not opening the file with the
+ * "non-tentative" VFD 'open' call is not treated an error; SUCCEED is
+ * returned, with the file ptr set to NULL. If 'try' is false, failing
+ * the "non-tentative" VFD 'open' call generates an error.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: A new file pointer.
- * Failure: NULL
*-------------------------------------------------------------------------
*/
-H5F_t *
-H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
+herr_t
+H5F_open(bool try, H5F_t **_file, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
{
H5F_t *file = NULL; /*the success return value */
H5F_shared_t *shared = NULL; /*shared part of `file' */
@@ -1809,16 +1798,19 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
size_t page_buf_size;
unsigned page_buf_min_meta_perc = 0;
unsigned page_buf_min_raw_perc = 0;
- bool set_flag = false; /*set the status_flags in the superblock */
- bool clear = false; /*clear the status_flags */
- bool evict_on_close; /* evict on close value from plist */
- bool use_file_locking = true; /* Using file locks? */
- bool ignore_disabled_locks = false; /* Ignore disabled file locks? */
- bool ci_load = false; /* whether MDC ci load requested */
- bool ci_write = false; /* whether MDC CI write requested */
- H5F_t *ret_value = NULL; /*actual return value */
+ bool set_flag = false; /*set the status_flags in the superblock */
+ bool clear = false; /*clear the status_flags */
+ bool evict_on_close; /* evict on close value from plist */
+ bool use_file_locking = true; /* Using file locks? */
+ bool ignore_disabled_locks = false; /* Ignore disabled file locks? */
+ bool ci_load = false; /* whether MDC ci load requested */
+ bool ci_write = false; /* whether MDC CI write requested */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
- FUNC_ENTER_NOAPI(NULL)
+ /* Reset 'out' parameter */
+ *_file = NULL;
/*
* If the driver has a 'cmp' method then the driver is capable of
@@ -1829,15 +1821,15 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
* same file more than once at a time.
*/
if (NULL == (drvr = H5FD_get_class(fapl_id)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to retrieve VFL class");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve VFL class");
/* Get the file access property list, for future queries */
if (NULL == (a_plist = (H5P_genplist_t *)H5I_object(fapl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list");
/* Check if we are using file locking */
if (H5F__check_if_using_file_locks(a_plist, &use_file_locking, &ignore_disabled_locks) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file locking flags");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file locking flags");
/*
* Opening a file is a two step process. First we try to open the
@@ -1850,40 +1842,40 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
* application's responsibility to prevent this situation (there's no
* way for us to detect it here anyway).
*/
- if (drvr->cmp)
+ if (drvr->cmp) {
tent_flags = flags & ~(H5F_ACC_CREAT | H5F_ACC_TRUNC | H5F_ACC_EXCL);
- else
- tent_flags = flags;
- /*
- * When performing a tentative open of a file where we have stripped away
- * flags such as H5F_ACC_CREAT from the specified file access flags, the
- * H5E_BEGIN/END_TRY macros are used to suppress error output since there
- * is an expectation that the tentative open might fail. Even though we
- * explicitly clear the error stack after such a failure, the underlying
- * file driver might maintain its own error stack and choose whether to
- * display errors based on whether the library has disabled error reporting.
- * Since we wish to suppress that error output as well for the case of
- * tentative file opens, surrounding the file open call with the
- * H5E_BEGIN/END_TRY macros is an explicit instruction to the file driver
- * not to display errors. If the tentative file open call fails, another
- * attempt at opening the file will be made without error output being
- * suppressed.
- *
- * However, if stripping away the H5F_ACC_CREAT flag and others left us
- * with the same file access flags as before, then we will skip this
- * tentative file open and only make a single attempt at opening the file.
- * In this case, we don't want to suppress error output since the underlying
- * file driver might provide more details on why the file open failed.
- */
- if (tent_flags != flags) {
- /* Make tentative attempt to open file */
- H5E_BEGIN_TRY
- {
- lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF);
+ /*
+ * When performing a tentative open of a file where we have stripped
+ * away flags such as H5F_ACC_CREAT from the specified file access
+ * flags, use 'try open' operation to avoid pushing error messages
+ * on the error stack since there is an expectation that the tentative
+ * open might fail.
+ *
+ * If the tentative file open call fails, another attempt at opening
+ * the file will be made without error output being suppressed.
+ *
+ * However, if stripping away the H5F_ACC_CREAT flag and others left
+ * us with the same file access flags as before, then we will skip
+ * this tentative file open and only make a single attempt at opening
+ * the file. In this case, we don't want to suppress errors since
+ * the underlying file driver might provide more details on why the
+ * file open failed.
+ */
+ if (tent_flags != flags) {
+ /* Make tentative attempt to open file */
+ if (H5FD_open(true, &lf, name, tent_flags, fapl_id, HADDR_UNDEF) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file");
+
+ /* If the tentative open failed, reset the file access flags,
+ * then make another attempt at opening the file.
+ */
+ if (NULL == lf)
+ tent_flags = flags;
}
- H5E_END_TRY
}
+ else
+ tent_flags = flags;
/*
* If a tentative attempt to open the file wasn't necessary, attempt
@@ -1891,15 +1883,15 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
* the error stack and reset the file access flags, then make another
* attempt at opening the file.
*/
- if ((tent_flags == flags) || (lf == NULL)) {
- if (tent_flags != flags) {
- H5E_clear_stack();
- tent_flags = flags;
+ if (NULL == lf) {
+ if (H5FD_open(try, &lf, name, tent_flags, fapl_id, HADDR_UNDEF) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file");
+
+ /* Check if file was not opened */
+ if (NULL == lf) {
+ assert(try);
+ HGOTO_DONE(SUCCEED);
}
-
- if (NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x",
- name, tent_flags);
}
/* Is the file already open? */
@@ -1915,26 +1907,26 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
* SWMR write/read access flags don't agree.
*/
if (H5FD_close(lf) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to close low-level file info");
if (flags & H5F_ACC_TRUNC)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to truncate a file which is already open");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to truncate a file which is already open");
if (flags & H5F_ACC_EXCL)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file exists");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "file exists");
if ((flags & H5F_ACC_RDWR) && 0 == (shared->flags & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file is already open for read-only");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "file is already open for read-only");
if ((flags & H5F_ACC_SWMR_WRITE) && 0 == (shared->flags & H5F_ACC_SWMR_WRITE))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL,
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL,
"SWMR write access flag not the same for file that is already open");
if ((flags & H5F_ACC_SWMR_READ) &&
!((shared->flags & H5F_ACC_SWMR_WRITE) || (shared->flags & H5F_ACC_SWMR_READ) ||
(shared->flags & H5F_ACC_RDWR)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL,
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL,
"SWMR read access flag not the same for file that is already open");
/* Allocate new "high-level" file struct */
if ((file = H5F__new(shared, flags, fcpl_id, fapl_id, NULL)) == NULL)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create new file object");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create new file object");
} /* end if */
else {
/* Check if tentative open was good enough */
@@ -1945,10 +1937,12 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
* file and open it for real.
*/
if (H5FD_close(lf) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to close low-level file info");
+ lf = NULL;
- if (NULL == (lf = H5FD_open(name, flags, fapl_id, HADDR_UNDEF)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file");
+ if (H5FD_open(false, &lf, name, flags, fapl_id, HADDR_UNDEF) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file");
+ assert(lf);
} /* end if */
/* Place an advisory lock on the file */
@@ -1956,8 +1950,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
if (H5FD_lock(lf, (bool)((flags & H5F_ACC_RDWR) ? true : false)) < 0) {
/* Locking failed - Closing will remove the lock */
if (H5FD_close(lf) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "unable to close low-level file info");
- HGOTO_ERROR(H5E_FILE, H5E_CANTLOCKFILE, NULL, "unable to lock the file");
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close low-level file info");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTLOCKFILE, FAIL, "unable to lock the file");
} /* end if */
/* Create the 'top' file structure */
@@ -1967,8 +1961,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
* so we have to close lf here before heading to the error handling.
*/
if (H5FD_close(lf) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info");
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to initialize file structure");
+ HDONE_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to close low-level file info");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to initialize file structure");
} /* end if */
/* Need to set status_flags in the superblock if the driver has a 'lock' method */
@@ -1978,9 +1972,9 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* Check to see if both SWMR and cache image are requested. Fail if so */
if (H5C_cache_image_status(file, &ci_load, &ci_write) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get MDC cache image status");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MDC cache image status");
if ((ci_load || ci_write) && (flags & (H5F_ACC_SWMR_READ | H5F_ACC_SWMR_WRITE)))
- HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, NULL, "can't have both SWMR and cache image");
+ HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, "can't have both SWMR and cache image");
/* Retain the name the file was opened with */
file->open_name = H5MM_xstrdup(name);
@@ -1998,26 +1992,26 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
}
else if (shared->nrefs > 1) {
if (file->shared->use_file_locking != use_file_locking)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file locking flag values don't match");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "file locking flag values don't match");
if (file->shared->use_file_locking && (file->shared->ignore_disabled_locks != ignore_disabled_locks))
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL,
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL,
"file locking 'ignore disabled locks' flag values don't match");
}
/* Check if page buffering is enabled */
if (H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &page_buf_size) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get page buffer size");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get page buffer size");
if (page_buf_size) {
/* Query for other page buffer cache properties */
if (H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &page_buf_min_meta_perc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get minimum metadata fraction of page buffer");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get minimum metadata fraction of page buffer");
if (H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &page_buf_min_raw_perc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get minimum raw data fraction of page buffer");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get minimum raw data fraction of page buffer");
} /* end if */
/* Get the evict on close setting */
if (H5P_get(a_plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, &evict_on_close) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get evict on close value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get evict on close value");
#ifdef H5_HAVE_PARALLEL
/* Check for unsupported settings in parallel */
@@ -2033,15 +2027,16 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
if (page_buf_size) {
/* Collective metadata writes are not supported with page buffering */
if (file->shared->coll_md_write)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL,
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL,
"collective metadata writes are not supported with page buffering");
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "page buffering is disabled for parallel");
+ /* Temporary: fail file create when page buffering feature is enabled for parallel */
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "page buffering is disabled for parallel");
}
if (mpi_size > 1) {
if (evict_on_close)
- HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, NULL,
+ HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL,
"evict on close is currently not supported in parallel HDF5");
}
}
@@ -2061,24 +2056,24 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* Create the page buffer before initializing the superblock */
if (page_buf_size)
if (H5PB_create(shared, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create page buffer");
/* Initialize information about the superblock and allocate space for it */
/* (Writes superblock extension messages, if there are any) */
if (H5F__super_init(file) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to allocate file superblock");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to allocate file superblock");
/* Create and open the root group */
/* (This must be after the space for the superblock is allocated in
* the file, since the superblock must be at offset 0)
*/
if (H5G_mkroot(file, true) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create/open root group");
} /* end if */
else if (1 == shared->nrefs) {
/* Read the superblock if it hasn't been read before. */
if (H5F__super_read(file, a_plist, true) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock");
+ HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "unable to read superblock");
/* Skip trying to create a page buffer if the file space strategy
* stored in the superblock isn't paged.
@@ -2097,11 +2092,11 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* Create the page buffer *after* reading the superblock */
if (page_buf_size)
if (H5PB_create(shared, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create page buffer");
/* Open the root group */
if (H5G_mkroot(file, false) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read root group");
} /* end if */
/*
@@ -2111,7 +2106,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
* the degree in shared file structure.
*/
if (H5P_get(a_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file close degree");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file close degree");
if (shared->nrefs == 1) {
if (fc_degree == H5F_CLOSE_DEFAULT)
shared->fc_degree = lf->cls->fc_degree;
@@ -2120,16 +2115,16 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
} /* end if */
else if (shared->nrefs > 1) {
if (fc_degree == H5F_CLOSE_DEFAULT && shared->fc_degree != lf->cls->fc_degree)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "file close degree doesn't match");
if (fc_degree != H5F_CLOSE_DEFAULT && fc_degree != shared->fc_degree)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "file close degree doesn't match");
} /* end if */
/* This is a private property to clear the status_flags in the super block */
/* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */
if (H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) {
if (H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get clearance for status_flags");
else if (clear)
file->shared->sblock->status_flags = 0;
} /* end if */
@@ -2143,18 +2138,18 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
shared->evict_on_close = evict_on_close;
else if (shared->nrefs > 1) {
if (shared->evict_on_close != evict_on_close)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "file evict-on-close value doesn't match");
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file evict-on-close value doesn't match");
} /* end if */
/* Formulate the absolute path for later search of target file for external links */
if (shared->nrefs == 1) {
if (H5_build_extpath(name, &file->shared->extpath) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to build extpath");
}
/* Formulate the actual file name, after following symlinks, etc. */
if (H5F__build_actual_name(file, a_plist, name, &file->actual_name) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build actual name");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to build actual name");
if (set_flag) {
if (H5F_INTENT(file) & H5F_ACC_RDWR) { /* Set and check consistency of status_flags */
@@ -2163,7 +2158,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
if (file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS ||
file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL,
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL,
"file is already open for write/SWMR write (may use to clear "
"file consistency flags)");
} /* version 3 superblock */
@@ -2174,16 +2169,16 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* Flush the superblock & superblock extension */
if (H5F_super_dirty(file) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, NULL, "unable to mark superblock as dirty");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty");
if (H5F_flush_tagged_metadata(file, H5AC__SUPERBLOCK_TAG) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, NULL, "unable to flush superblock");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock");
if (H5F_flush_tagged_metadata(file, file->shared->sblock->ext_addr) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, NULL, "unable to flush superblock extension");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock extension");
/* Remove the file lock for SWMR_WRITE */
if (use_file_locking && (H5F_INTENT(file) & H5F_ACC_SWMR_WRITE)) {
if (H5FD_unlock(file->shared->lf) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, NULL, "unable to unlock the file");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock the file");
} /* end if */
} /* end if */
else { /* H5F_ACC_RDONLY: check consistency of status_flags */
@@ -2194,25 +2189,25 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
!(file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)) ||
(!(file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS) &&
file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL,
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL,
"file is not already open for SWMR writing");
} /* end if */
else if ((file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS) ||
(file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL,
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL,
"file is already open for write (may use to clear file "
"consistency flags)");
} /* version 3 superblock */
} /* end else */
} /* end if set_flag */
- /* Success */
- ret_value = file;
+ /* Set 'out' parameter */
+ *_file = file;
done:
- if ((NULL == ret_value) && file)
+ if (ret_value < 0 && file)
if (H5F__dest(file, false, true) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file");
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file");
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_open() */
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 06d13ebffdd..3ecff5a28bc 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -460,11 +460,12 @@ H5_DLL herr_t H5F__set_mpi_atomicity(H5F_t *file, bool flag);
/* External file cache routines */
H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles);
-H5_DLL H5F_t *H5F__efc_open(H5F_efc_t *efc, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
-H5_DLL unsigned H5F__efc_max_nfiles(H5F_efc_t *efc);
-H5_DLL herr_t H5F__efc_release(H5F_efc_t *efc);
-H5_DLL herr_t H5F__efc_destroy(H5F_efc_t *efc);
-H5_DLL herr_t H5F__efc_try_close(H5F_t *f);
+H5_DLL herr_t H5F__efc_open(bool try, H5F_efc_t *efc, H5F_t **file, const char *name, unsigned flags,
+ hid_t fcpl_id, hid_t fapl_id);
+H5_DLL unsigned H5F__efc_max_nfiles(H5F_efc_t *efc);
+H5_DLL herr_t H5F__efc_release(H5F_efc_t *efc);
+H5_DLL herr_t H5F__efc_destroy(H5F_efc_t *efc);
+H5_DLL herr_t H5F__efc_try_close(H5F_t *f);
/* Space allocation routines */
H5_DLL haddr_t H5F__alloc(H5F_t *f, H5F_mem_t type, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index d2b1b887a7f..a4ad311a189 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -495,7 +495,8 @@ typedef enum H5F_prefix_open_t {
/* Private functions */
H5_DLL herr_t H5F_init(void);
-H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
+H5_DLL herr_t H5F_open(bool try, H5F_t **file, const char *name, unsigned flags, hid_t fcpl_id,
+ hid_t fapl_id);
H5_DLL herr_t H5F_try_close(H5F_t *f, bool *was_closed /*out*/);
H5_DLL hid_t H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, bool app_ref);
@@ -659,7 +660,7 @@ H5_DLL herr_t H5F_shared_get_mpi_file_sync_required(const H5F_shared_t *f_sh,
H5_DLL herr_t H5F_efc_close(H5F_t *parent, H5F_t *file);
/* File prefix routines */
-H5_DLL H5F_t *H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type,
+H5_DLL herr_t H5F_prefix_open_file(bool try, H5F_t **file, H5F_t *primary_file, H5F_prefix_open_t prefix_type,
const char *prop_prefix, const char *file_name, unsigned file_intent,
hid_t fapl_id);
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index 89484ea1134..88ee6baa201 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -212,8 +212,8 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get external link prefix");
/* Search for the target file */
- if (NULL == (ext_file = H5F_prefix_open_file(loc.oloc->file, H5F_PREFIX_ELINK, elink_prefix, file_name,
- intent, fapl_id)))
+ if (H5F_prefix_open_file(false, &ext_file, loc.oloc->file, H5F_PREFIX_ELINK, elink_prefix, file_name,
+ intent, fapl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, H5I_INVALID_HID,
"unable to open external file, external link file name = '%s'", file_name);
diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c
index b0686d0f1df..cb4841f2595 100644
--- a/src/H5VLnative_file.c
+++ b/src/H5VLnative_file.c
@@ -90,7 +90,7 @@ H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t
flags |= H5F_ACC_RDWR | H5F_ACC_CREAT;
/* Create the file */
- if (NULL == (new_file = H5F_open(name, flags, fcpl_id, fapl_id)))
+ if (H5F_open(false, &new_file, name, flags, fcpl_id, fapl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file");
new_file->id_exists = true;
@@ -124,7 +124,7 @@ H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t H5
FUNC_ENTER_PACKAGE
/* Open the file */
- if (NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id)))
+ if (H5F_open(false, &new_file, name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file");
new_file->id_exists = true;
diff --git a/test/efc.c b/test/efc.c
index 484320dc3d0..b5399823c89 100644
--- a/test/efc.c
+++ b/test/efc.c
@@ -66,7 +66,7 @@ test_single(void)
TEST_ERROR;
/* Open parent file */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
/* Disable EFC for child files */
@@ -77,12 +77,12 @@ test_single(void)
* count = 2, release EFC, verify ref count = 1. Verifies a file can be
* held open by the EFC.
*/
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp1->shared->nrefs != 2)
TEST_ERROR;
@@ -96,13 +96,13 @@ test_single(void)
/* Test 2: Verify that subsequent efc_open requests return the cached top
* level file pointer. Open file 1 through EFC, close, open again, verify
* file pointers are the same. */
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
ftmp1 = f1;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1 != ftmp1)
TEST_ERROR;
@@ -117,34 +117,34 @@ test_single(void)
* that the one added first is evicted. Then reopen files in a different
* order. Open each file normally after closing through EFC the first time
* to track ref counts. */
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 2)
TEST_ERROR;
if (f2->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 2)
TEST_ERROR;
@@ -153,12 +153,12 @@ test_single(void)
if (f3->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f4 = H5F__efc_open(f0->shared->efc, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f4) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
@@ -169,7 +169,7 @@ test_single(void)
if (f4->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (ftmp3 = H5F__efc_open(f0->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, ftmp3) < 0)
FAIL_STACK_ERROR;
@@ -182,7 +182,7 @@ test_single(void)
if (f4->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f0->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, ftmp2) < 0)
FAIL_STACK_ERROR;
@@ -195,7 +195,7 @@ test_single(void)
if (f4->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f0->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, ftmp1) < 0)
FAIL_STACK_ERROR;
@@ -208,7 +208,7 @@ test_single(void)
if (f4->shared->nrefs != 1)
TEST_ERROR;
- if (NULL == (ftmp4 = H5F__efc_open(f0->shared->efc, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &ftmp4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, ftmp4) < 0)
FAIL_STACK_ERROR;
@@ -242,10 +242,10 @@ test_single(void)
/* Test 4: Verify that files kept open through the EFC are not evicted by
* H5F__efc_release(). */
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp1->shared->nrefs != 2)
TEST_ERROR;
@@ -268,36 +268,36 @@ test_single(void)
* filling up the cache. Open 4 files while holding the first open. Verify
* that the second file is evicted. Close the first file, reopen the
* second, and verify that the first file is evicted. */
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp1->shared != f1->shared)
TEST_ERROR;
if (ftmp1->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp2->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR;
if (ftmp2->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f4 = H5F__efc_open(f0->shared->efc, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f4) < 0)
FAIL_STACK_ERROR;
@@ -310,7 +310,7 @@ test_single(void)
FAIL_STACK_ERROR;
if (ftmp1->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR;
@@ -318,7 +318,7 @@ test_single(void)
TEST_ERROR;
if (ftmp2->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
@@ -342,42 +342,42 @@ test_single(void)
* prevents further files from being cached. Open and hold open 3 files
* through the EFC, then open the fourth and verify that it was not added to
* the EFC. */
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp1->shared != f1->shared)
TEST_ERROR;
if (ftmp1->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp2->shared != f2->shared)
TEST_ERROR;
if (ftmp2->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp3->shared != f3->shared)
TEST_ERROR;
if (ftmp3->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f4 = H5F__efc_open(f0->shared->efc, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f4) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp4->shared->nrefs != 1)
TEST_ERROR;
@@ -415,13 +415,13 @@ test_single(void)
/* Test 7: Test multiple file opens. Open a file twice, close it once, then
* verify that it is not evicted by H5F__efc_release(). */
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp1->shared->nrefs != 2)
TEST_ERROR;
@@ -492,19 +492,19 @@ test_graph_nocycle(void)
* ref count reduced (implying file 1 was closed). Do the same with the
* opening order reversed.
*/
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f2) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp2->shared->nrefs != 2)
TEST_ERROR;
@@ -517,15 +517,15 @@ test_graph_nocycle(void)
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL ==
- (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) <
+ 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(ftmp1->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, ftmp1->shared->efc, &f2, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_try_close(ftmp1, NULL) < 0)
FAIL_STACK_ERROR;
@@ -533,7 +533,7 @@ test_graph_nocycle(void)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp2->shared->nrefs != 2)
TEST_ERROR;
@@ -549,35 +549,35 @@ test_graph_nocycle(void)
/* Test 2: 5 file chain. The parent file has 2 child files, each of which
* has their own child file. Verifies that releasing the parent's EFC
* closes all 4 children. */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f2) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp2->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f4 = H5F__efc_open(f3->shared->efc, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, f4) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp4->shared->nrefs != 2)
TEST_ERROR;
@@ -600,17 +600,17 @@ test_graph_nocycle(void)
* closed until both parents' EFCs are released. First release through one
* parent, then reopen through that parent and release the other, then
* re-release the first parent. */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f1->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR;
@@ -618,7 +618,7 @@ test_graph_nocycle(void)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp2) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp3->shared->nrefs != 2)
TEST_ERROR;
@@ -628,7 +628,7 @@ test_graph_nocycle(void)
if (ftmp3->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR;
@@ -652,20 +652,20 @@ test_graph_nocycle(void)
/* Test 4: Simple "diamond" tree. The parent file has two children, which
* shared the same child. Verify that releasing the parent file closes all
* files. */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR;
@@ -673,7 +673,7 @@ test_graph_nocycle(void)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp3->shared->nrefs != 3)
TEST_ERROR;
@@ -691,27 +691,27 @@ test_graph_nocycle(void)
/* Test 5: Dense 5 file graph. f0 caches f1, f2, f3 and f4. f1 and f2
* each cache f3 and f4. f3 caches f4. Verify that releasing f0 closes all
* files. */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f4 = H5F__efc_open(f0->shared->efc, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f4) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f4 = H5F__efc_open(f1->shared->efc, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f4) < 0)
FAIL_STACK_ERROR;
@@ -719,21 +719,21 @@ test_graph_nocycle(void)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f4 = H5F__efc_open(f2->shared->efc, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, f4) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f4 = H5F__efc_open(f3->shared->efc, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &f4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, f4) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp4->shared->nrefs != 5)
TEST_ERROR;
@@ -742,15 +742,15 @@ test_graph_nocycle(void)
FAIL_STACK_ERROR;
if (ftmp4->shared->nrefs != 1)
TEST_ERROR;
- if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp1->shared->nrefs != 1)
TEST_ERROR;
- if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp2->shared->nrefs != 1)
TEST_ERROR;
- if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (ftmp3->shared->nrefs != 1)
TEST_ERROR;
@@ -811,9 +811,9 @@ test_graph_cycle(void)
/* Test 1: File caches itself. Verify that closing the file causes it to be
* actually closed, and there is no other unexpected behavior.
*/
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f0->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, ftmp0) < 0)
FAIL_STACK_ERROR;
@@ -824,7 +824,7 @@ test_graph_cycle(void)
if (f0->shared->nrefs != 1)
TEST_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f0->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, ftmp0) < 0)
FAIL_STACK_ERROR;
@@ -832,7 +832,7 @@ test_graph_cycle(void)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
@@ -842,12 +842,12 @@ test_graph_cycle(void)
/* Test 2: Indirectly referenced file caches itself. Same as above except
* the file is part of another file's EFC. */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f1->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp1) < 0)
FAIL_STACK_ERROR;
@@ -857,17 +857,17 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f1->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp1) < 0)
FAIL_STACK_ERROR;
@@ -877,7 +877,7 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
@@ -885,12 +885,12 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 3: Simple 2 file cycle */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
@@ -903,10 +903,10 @@ test_graph_cycle(void)
if (f0->shared->nrefs != 1)
TEST_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
@@ -916,7 +916,7 @@ test_graph_cycle(void)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
@@ -924,15 +924,15 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 4: Simple 2 file cycle (indirectly referenced) */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp1) < 0)
FAIL_STACK_ERROR;
@@ -944,7 +944,7 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
@@ -952,21 +952,21 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 5: Parallel double cycle */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f2->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp0) < 0)
FAIL_STACK_ERROR;
@@ -976,7 +976,7 @@ test_graph_cycle(void)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
@@ -984,21 +984,21 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 6: Parallel double cycle with release */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f2->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp0) < 0)
FAIL_STACK_ERROR;
@@ -1014,26 +1014,26 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 7: Chained parallel double cycle */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp1) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f2) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f3->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp1) < 0)
FAIL_STACK_ERROR;
@@ -1047,7 +1047,7 @@ test_graph_cycle(void)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
@@ -1055,26 +1055,26 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 8: Chained parallel double cycle with release */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp1) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f2) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f3->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp1) < 0)
FAIL_STACK_ERROR;
@@ -1094,14 +1094,14 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 9: Simple 2 file cycle, extra ID on root */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp1) < 0)
FAIL_STACK_ERROR;
@@ -1117,7 +1117,7 @@ test_graph_cycle(void)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
@@ -1125,14 +1125,14 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 10: Simple 2 file cycle, extra ID on second file */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
@@ -1147,7 +1147,7 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
if (ftmp1->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 2)
TEST_ERROR;
@@ -1156,13 +1156,13 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
if (H5F_try_close(ftmp1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
@@ -1170,23 +1170,23 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 11: Parallel double cycle, extra ID on a child file */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f2->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp0) < 0)
FAIL_STACK_ERROR;
@@ -1201,7 +1201,7 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
if (ftmp2->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 3)
TEST_ERROR;
@@ -1210,19 +1210,19 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
if (H5F_try_close(ftmp2, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
@@ -1230,23 +1230,23 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 12: Parallel double cycle, extra ID on a child file, with release */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f2->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp0) < 0)
FAIL_STACK_ERROR;
@@ -1276,28 +1276,28 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 13: Chained parallel double cycle, extra ID on a child file */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp1) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f2) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f3->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp1) < 0)
FAIL_STACK_ERROR;
@@ -1316,7 +1316,7 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
if (ftmp3->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 2)
TEST_ERROR;
@@ -1325,25 +1325,25 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
if (H5F_try_close(ftmp3, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 1)
TEST_ERROR;
@@ -1352,28 +1352,28 @@ test_graph_cycle(void)
/* Test 14: Chained parallel double cycle, extra ID on a child file, with
* release */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp1) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f2) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f3->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp1) < 0)
FAIL_STACK_ERROR;
@@ -1407,24 +1407,24 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 15: One local and one remote cycle */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f3->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp2) < 0)
FAIL_STACK_ERROR;
@@ -1437,25 +1437,25 @@ test_graph_cycle(void)
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 1)
TEST_ERROR;
@@ -1463,24 +1463,24 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 16: One local and one remote cycle, with release */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f3->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp2) < 0)
FAIL_STACK_ERROR;
@@ -1497,19 +1497,19 @@ test_graph_cycle(void)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 1)
TEST_ERROR;
@@ -1517,26 +1517,26 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 17: One local and one remote cycle, remote cycle held open */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f3->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp2) < 0)
FAIL_STACK_ERROR;
@@ -1549,7 +1549,7 @@ test_graph_cycle(void)
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
@@ -1560,19 +1560,19 @@ test_graph_cycle(void)
if (H5F_try_close(ftmp3, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 1)
TEST_ERROR;
@@ -1581,26 +1581,26 @@ test_graph_cycle(void)
/* Test 18: One local and one remote cycle, remote cycle held open, with
* release */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f3->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp2) < 0)
FAIL_STACK_ERROR;
@@ -1617,13 +1617,13 @@ test_graph_cycle(void)
TEST_ERROR;
if (ftmp3->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f2->shared->nrefs != 2)
TEST_ERROR;
@@ -1634,7 +1634,7 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
if (ftmp3->shared->nrefs != 1)
TEST_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
@@ -1648,44 +1648,44 @@ test_graph_cycle(void)
/* Test 19: "Diamond" shape with links moving from bottom (root) to top.
* Also cycle between bottom (root) and top and cycles on the sides. */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f3->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp0) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f4 = H5F__efc_open(f1->shared->efc, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f4->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f4->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f4, ftmp1) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f4) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f5 = H5F__efc_open(f2->shared->efc, filename[5],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f5, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f5->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f5->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f5, ftmp2) < 0)
FAIL_STACK_ERROR;
@@ -1700,37 +1700,37 @@ test_graph_cycle(void)
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f4->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f4, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f5, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f5->shared->nrefs != 1)
TEST_ERROR;
@@ -1740,44 +1740,44 @@ test_graph_cycle(void)
/* Test 20: "Diamond" shape with links moving from bottom (root) to top.
* Also cycle between bottom (root) and top, cycles on the sides, and
* release the files instead of closing. */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f3->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp0) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f4 = H5F__efc_open(f1->shared->efc, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f4->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f4->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f4, ftmp1) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f4) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f5 = H5F__efc_open(f2->shared->efc, filename[5],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f5, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f5->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f5->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f5, ftmp2) < 0)
FAIL_STACK_ERROR;
@@ -1796,31 +1796,31 @@ test_graph_cycle(void)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f4->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f4, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f5, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f5->shared->nrefs != 1)
TEST_ERROR;
@@ -1829,52 +1829,52 @@ test_graph_cycle(void)
/* Test 21: "Diamond" shape with links moving from bottom (root) to top.
* Also cycle between bottom (root) and top, cycles on sides held open. */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f3->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp0) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f4 = H5F__efc_open(f1->shared->efc, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f4->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f4->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f4, ftmp1) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f4) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f5 = H5F__efc_open(f2->shared->efc, filename[5],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f5, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f5->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f5->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f5, ftmp2) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, f5) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f5, filename[5], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
@@ -1893,7 +1893,7 @@ test_graph_cycle(void)
TEST_ERROR;
if (f5->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 2)
TEST_ERROR;
@@ -1909,7 +1909,7 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
if (f5->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 2)
TEST_ERROR;
@@ -1919,37 +1919,37 @@ test_graph_cycle(void)
if (H5F_try_close(f5, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f4->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f4, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f5, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f5->shared->nrefs != 1)
TEST_ERROR;
@@ -1959,52 +1959,52 @@ test_graph_cycle(void)
/* Test 22: "Diamond" shape with links moving from bottom (root) to top.
* Also cycle between bottom (root) and top, cycles on sides held open.
* Also release the files instead of closing. */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f3->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp0) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f4 = H5F__efc_open(f1->shared->efc, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f4->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f4->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f4, ftmp1) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, f4) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f5 = H5F__efc_open(f2->shared->efc, filename[5],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f5, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f5->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f5->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f5, ftmp2) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, f5) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f5, filename[5], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
@@ -2025,7 +2025,7 @@ test_graph_cycle(void)
TEST_ERROR;
if (f5->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 3)
TEST_ERROR;
@@ -2040,7 +2040,7 @@ test_graph_cycle(void)
TEST_ERROR;
if (f5->shared->nrefs != 2)
TEST_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 2)
TEST_ERROR;
@@ -2055,7 +2055,7 @@ test_graph_cycle(void)
TEST_ERROR;
if (f5->shared->nrefs != 1)
TEST_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 1)
TEST_ERROR;
@@ -2071,69 +2071,69 @@ test_graph_cycle(void)
/* Test 23: Dense "ball" of files. 4 files each cache all files (including
* itself). */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f0->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, ftmp0) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f1->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f1->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp2) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp3 = H5F__efc_open(f1->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f2->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp0) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f2->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp2) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp3 = H5F__efc_open(f2->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f3->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp0) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f3->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f3->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp2) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp3 = H5F__efc_open(f3->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp3) < 0)
FAIL_STACK_ERROR;
@@ -2147,25 +2147,25 @@ test_graph_cycle(void)
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 1)
TEST_ERROR;
@@ -2174,69 +2174,69 @@ test_graph_cycle(void)
/* Test 24: Dense "ball" of files. 4 files each cache all files (including
* itself). Release the files instead of closing. */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f0->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, ftmp0) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f1->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f1->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp2) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp3 = H5F__efc_open(f1->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f2->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp0) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f2->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp2) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp3 = H5F__efc_open(f2->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f2, ftmp3) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f3->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp0) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp1 = H5F__efc_open(f3->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp2 = H5F__efc_open(f3->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp2) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp3 = H5F__efc_open(f3->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f3->shared->efc, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f3, ftmp3) < 0)
FAIL_STACK_ERROR;
@@ -2254,19 +2254,19 @@ test_graph_cycle(void)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 1)
TEST_ERROR;
@@ -2274,12 +2274,12 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 25: File held open by EFC client interrupts cycle, with release */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
@@ -2307,19 +2307,19 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 26: File held open by EFC does not interrupt cycle, with release */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 2)
TEST_ERROR;
@@ -2341,23 +2341,23 @@ test_graph_cycle(void)
/* Test 27: File held open by EFC client through non-parent file does not
* interrupt cycle, but parent file does (no valid way around it) */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 2)
TEST_ERROR;
@@ -2376,7 +2376,7 @@ test_graph_cycle(void)
TEST_ERROR;
if (f3->shared->nrefs != 1)
TEST_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 2)
TEST_ERROR;
@@ -2389,13 +2389,13 @@ test_graph_cycle(void)
TEST_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 2)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 2)
TEST_ERROR;
@@ -2406,19 +2406,19 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 2)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 3)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 2)
TEST_ERROR;
@@ -2427,25 +2427,25 @@ test_graph_cycle(void)
if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 1)
TEST_ERROR;
@@ -2455,23 +2455,23 @@ test_graph_cycle(void)
/* Test 28: File held open by EFC client through non-parent file does not
* interrupt cycle, but parent file does (no valid way around it), with
* release */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f2->shared->efc, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 2)
TEST_ERROR;
@@ -2514,13 +2514,13 @@ test_graph_cycle(void)
TEST_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f3->shared->nrefs != 1)
TEST_ERROR;
@@ -2533,16 +2533,16 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 29: File without EFC interrupts cycle */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5Pset_elink_file_cache_size(fapl_id, 0) < 0)
TEST_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5Pset_elink_file_cache_size(fapl_id, 8) < 0)
TEST_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 2)
TEST_ERROR;
@@ -2557,13 +2557,13 @@ test_graph_cycle(void)
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
@@ -2571,12 +2571,12 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
/* Test 30: File without EFC does not interrupt cycle */
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
- if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR;
@@ -2584,8 +2584,8 @@ test_graph_cycle(void)
FAIL_STACK_ERROR;
if (H5Pset_elink_file_cache_size(fapl_id, 0) < 0)
TEST_ERROR;
- if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC,
+ fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (H5Pset_elink_file_cache_size(fapl_id, 8) < 0)
TEST_ERROR;
@@ -2596,19 +2596,19 @@ test_graph_cycle(void)
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f0->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f1->shared->nrefs != 1)
TEST_ERROR;
if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR;
- if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0)
FAIL_STACK_ERROR;
if (f2->shared->nrefs != 1)
TEST_ERROR;
diff --git a/test/error_test.c b/test/error_test.c
index bb780215574..84db80e3f93 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -456,8 +456,7 @@ custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
static herr_t
test_create(void)
{
- const char *err_func = "test_create"; /* Function name for pushing error */
- const char *err_msg = "Error message"; /* Error message for pushing error */
+ const char *err_msg = "Error message"; /* Error message for pushing error */
ssize_t err_num; /* Number of errors on stack */
hid_t estack_id = H5I_INVALID_HID; /* Error stack ID */
@@ -471,7 +470,7 @@ test_create(void)
TEST_ERROR;
/* Push an error with a long description */
- if (H5Epush(estack_id, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s",
+ if (H5Epush(estack_id, __FILE__, __func__, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s",
err_msg) < 0)
TEST_ERROR;
@@ -512,14 +511,13 @@ test_create(void)
static herr_t
test_copy(void)
{
- const char *err_func = "test_copy"; /* Function name for pushing error */
- const char *err_msg = "Error message"; /* Error message for pushing error */
+ const char *err_msg = "Error message"; /* Error message for pushing error */
ssize_t err_num; /* Number of errors on stack */
hid_t estack_id = H5I_INVALID_HID; /* Error stack ID */
herr_t ret; /* Generic return value */
/* Push an error with a long description */
- if (H5Epush(H5E_DEFAULT, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s",
+ if (H5Epush(H5E_DEFAULT, __FILE__, __func__, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s",
err_msg) < 0)
TEST_ERROR;
@@ -581,7 +579,6 @@ test_copy(void)
static herr_t
test_append(void)
{
- const char *err_func = "test_append"; /* Function name for pushing error */
const char *err_msg1 = "Error message #1"; /* Error message #1 for pushing error */
const char *err_msg2 = "Error message #2"; /* Error message #2 for pushing error */
ssize_t err_num; /* Number of errors on stack */
@@ -590,7 +587,7 @@ test_append(void)
herr_t ret; /* Generic return value */
/* Push an error */
- if (H5Epush(H5E_DEFAULT, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s",
+ if (H5Epush(H5E_DEFAULT, __FILE__, __func__, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s",
err_msg1) < 0)
TEST_ERROR;
@@ -613,7 +610,7 @@ test_append(void)
TEST_ERROR;
/* Push an error on stack #2 */
- if (H5Epush(estack_id2, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE, "%s",
+ if (H5Epush(estack_id2, __FILE__, __func__, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE, "%s",
err_msg2) < 0)
TEST_ERROR;
@@ -660,7 +657,7 @@ test_append(void)
TEST_ERROR;
/* Append error stack #2 to error stack #1, and close stack #2 */
- if (H5Eappend_stack(estack_id1, estack_id2, true) < 0)
+ if (H5Eappend_stack(estack_id1, estack_id2, TRUE) < 0)
TEST_ERROR;
/* Try to close error stack #2. Should fail because H5Eappend_stack
@@ -685,6 +682,166 @@ test_append(void)
return -1;
} /* end test_append() */
+/*-------------------------------------------------------------------------
+ * Function: test_pause
+ *
+ * Purpose: Test pausing error stacks
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_pause(void)
+{
+ const char *err_msg1 = "Error message #1"; /* Error message #1 for pushing error */
+ ssize_t err_num; /* Number of errors on stack */
+ hid_t estack_id1 = H5I_INVALID_HID; /* Error stack ID */
+ hbool_t is_paused; /* Whether error stack is paused */
+ herr_t ret; /* Generic return value */
+
+ /* Push an error */
+ if (H5Epush(H5E_DEFAULT, __FILE__, __func__, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s",
+ err_msg1) < 0)
+ TEST_ERROR;
+
+ /* Copy error stack, which clears the original */
+ if ((estack_id1 = H5Eget_current_stack()) < 0)
+ TEST_ERROR;
+
+ /* Check the number of errors on stack #1 */
+ err_num = H5Eget_num(estack_id1);
+ if (err_num != 1)
+ TEST_ERROR;
+
+ /* Check for bad arguments */
+ is_paused = TRUE;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Eis_paused(H5I_INVALID_HID, &is_paused);
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR;
+
+ /* Verify that default stack is not paused */
+ is_paused = TRUE;
+ if (H5Eis_paused(H5E_DEFAULT, &is_paused) < 0)
+ TEST_ERROR;
+ if (FALSE != is_paused)
+ TEST_ERROR;
+
+ /* Verify that application stack is not paused */
+ is_paused = TRUE;
+ if (H5Eis_paused(estack_id1, &is_paused) < 0)
+ TEST_ERROR;
+ if (FALSE != is_paused)
+ TEST_ERROR;
+
+ /* Check for bad arguments */
+ H5E_BEGIN_TRY
+ {
+ ret = H5Epause_stack(H5I_INVALID_HID);
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR;
+ /* Check for bad arguments */
+ H5E_BEGIN_TRY
+ {
+ ret = H5Eresume_stack(H5I_INVALID_HID);
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR;
+
+ /* Pause error stack */
+ if (H5Epause_stack(estack_id1) < 0)
+ TEST_ERROR;
+
+ /* Check if stack is paused */
+ is_paused = FALSE;
+ if (H5Eis_paused(estack_id1, &is_paused) < 0)
+ TEST_ERROR;
+ if (TRUE != is_paused)
+ TEST_ERROR;
+
+ /* Resume error stack */
+ if (H5Eresume_stack(estack_id1) < 0)
+ TEST_ERROR;
+
+ /* Check if stack is paused */
+ is_paused = TRUE;
+ if (H5Eis_paused(estack_id1, &is_paused) < 0)
+ TEST_ERROR;
+ if (FALSE != is_paused)
+ TEST_ERROR;
+
+ /* Check for resuming too many times */
+ H5E_BEGIN_TRY
+ {
+ ret = H5Eresume_stack(estack_id1);
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR;
+
+ /* Check if stack is paused, after trying to resume too many times */
+ is_paused = TRUE;
+ if (H5Eis_paused(estack_id1, &is_paused) < 0)
+ TEST_ERROR;
+ if (FALSE != is_paused)
+ TEST_ERROR;
+
+ /* Close error stack */
+ if (H5Eclose_stack(estack_id1) < 0)
+ TEST_ERROR;
+
+ /* Pause default error stack */
+ if (H5Epause_stack(H5E_DEFAULT) < 0)
+ TEST_ERROR;
+
+ /* Check if stack is paused */
+ is_paused = FALSE;
+ if (H5Eis_paused(H5E_DEFAULT, &is_paused) < 0)
+ TEST_ERROR;
+ if (TRUE != is_paused)
+ TEST_ERROR;
+
+ /* Resume error stack */
+ if (H5Eresume_stack(H5E_DEFAULT) < 0)
+ TEST_ERROR;
+
+ /* Check if stack is paused */
+ is_paused = TRUE;
+ if (H5Eis_paused(H5E_DEFAULT, &is_paused) < 0)
+ TEST_ERROR;
+ if (FALSE != is_paused)
+ TEST_ERROR;
+
+ /* Check for resuming too many times */
+ H5E_BEGIN_TRY
+ {
+ ret = H5Eresume_stack(H5E_DEFAULT);
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR;
+
+ /* Check if stack is paused, after trying to resume too many times */
+ is_paused = TRUE;
+ if (H5Eis_paused(H5E_DEFAULT, &is_paused) < 0)
+ TEST_ERROR;
+ if (FALSE != is_paused)
+ TEST_ERROR;
+
+ return 0;
+
+error:
+ return -1;
+} /* end test_pause() */
+
/*-------------------------------------------------------------------------
* Function: close_error
*
@@ -868,6 +1025,10 @@ main(void)
if (test_append() < 0)
TEST_ERROR;
+ /* Test pausing error stacks */
+ if (test_pause() < 0)
+ TEST_ERROR;
+
/* Close error information */
if (close_error() < 0)
TEST_ERROR;
From cc91bead610eddf4d0d5665b44fc85ba1aea595b Mon Sep 17 00:00:00 2001
From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Date: Wed, 19 Jun 2024 07:38:30 -0500
Subject: [PATCH 21/45] Add page buffer cache command line option to tools
(#4562)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
---
release_docs/RELEASE.txt | 8 ++
tools/lib/h5diff.c | 70 +++++++----
tools/lib/h5diff.h | 1 +
tools/lib/h5tools.c | 45 ++++---
tools/lib/h5tools.h | 5 +-
tools/libtest/h5tools_test_utils.c | 11 +-
tools/src/h5diff/h5diff_common.c | 12 +-
tools/src/h5dump/h5dump.c | 40 ++++++-
tools/src/h5ls/h5ls.c | 52 +++++---
tools/src/h5repack/h5repack.c | 6 +-
tools/src/h5repack/h5repack.h | 6 +-
tools/src/h5repack/h5repack_copy.c | 6 +-
tools/src/h5repack/h5repack_main.c | 112 +++++++++++-------
tools/src/h5repack/h5repack_verify.c | 10 +-
tools/src/h5stat/h5stat.c | 30 ++++-
tools/src/misc/h5mkgrp.c | 70 ++++++-----
tools/test/h5diff/expected/h5diff_10.txt | 1 +
tools/test/h5diff/expected/h5diff_600.txt | 1 +
tools/test/h5diff/expected/h5diff_603.txt | 1 +
tools/test/h5diff/expected/h5diff_606.txt | 1 +
tools/test/h5diff/expected/h5diff_612.txt | 1 +
tools/test/h5diff/expected/h5diff_615.txt | 1 +
tools/test/h5diff/expected/h5diff_621.txt | 1 +
tools/test/h5diff/expected/h5diff_622.txt | 1 +
tools/test/h5diff/expected/h5diff_623.txt | 1 +
tools/test/h5diff/expected/h5diff_624.txt | 1 +
tools/test/h5dump/CMakeTests.cmake | 2 +
.../test/h5dump/expected/file_space_cache.ddl | 22 ++++
tools/test/h5dump/expected/h5dump-help.txt | 1 +
.../pbits/tnofilename-with-packed-bits.ddl | 1 +
.../expected/pbits/tpbitsIncomplete.ddl | 1 +
.../expected/pbits/tpbitsLengthExceeded.ddl | 1 +
.../expected/pbits/tpbitsLengthPositive.ddl | 1 +
.../expected/pbits/tpbitsMaxExceeded.ddl | 1 +
.../expected/pbits/tpbitsOffsetExceeded.ddl | 1 +
.../expected/pbits/tpbitsOffsetNegative.ddl | 1 +
tools/test/h5dump/testh5dump.sh.in | 2 +
tools/test/h5ls/CMakeTests.cmake | 3 +
tools/test/h5ls/expected/help-1.ls | 1 +
tools/test/h5ls/expected/help-2.ls | 1 +
tools/test/h5ls/expected/help-3.ls | 1 +
.../h5ls/expected/textlinksrc-nodangle-1.ls | 1 +
tools/test/h5ls/expected/tgroup-1.ls | 1 +
.../test/h5repack/expected/h5repack-help.txt | 1 +
tools/test/h5repack/h5repacktst.c | 10 +-
tools/test/h5stat/CMakeTests.cmake | 3 +
.../h5stat/expected/h5stat_filters-cache.ddl | 99 ++++++++++++++++
tools/test/h5stat/expected/h5stat_help1.ddl | 1 +
tools/test/h5stat/expected/h5stat_help2.ddl | 1 +
tools/test/h5stat/expected/h5stat_nofile.ddl | 1 +
tools/test/h5stat/testh5stat.sh.in | 3 +
51 files changed, 495 insertions(+), 160 deletions(-)
create mode 100644 tools/test/h5dump/expected/file_space_cache.ddl
create mode 100644 tools/test/h5stat/expected/h5stat_filters-cache.ddl
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 153c3ee944f..e29a329c558 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -126,6 +126,14 @@ New Features
Tools:
------
+ - Add option to adjust the page buffer size in tools
+
+ The page buffer cache size for a file can now be adjusted using the
+ --page-buffer-size=N
+ option in the h5repack, h5diff, h5dump, h5ls, and h5stat tools. This
+ will call the H5Pset_page_buffer_size() API function with the specified
+ size in bytes.
+
- Allow h5repack to reserve space for a user block without a file
This is useful for users who want to reserve space
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 9329872d965..bd8112f2c65 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -624,46 +624,72 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
*-------------------------------------------------------------------------
*/
/* open file 1 */
- if (opts->vfd_info[0].u.name) {
- if ((fapl1_id = h5tools_get_fapl(H5P_DEFAULT, NULL, &(opts->vfd_info[0]))) < 0) {
- parallel_print("h5diff: unable to create fapl for input file\n");
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create input fapl\n");
+ if ((fapl1_id = h5tools_get_new_fapl(H5P_DEFAULT)) < 0) {
+ parallel_print("h5diff: unable to create fapl for input file\n");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create input fapl\n");
+ }
+
+ /* Set non-default virtual file driver, if requested */
+ if (opts->custom_vfd[0] && opts->vfd_info[0].u.name) {
+ if (h5tools_set_fapl_vfd(fapl1_id, &(opts->vfd_info[0])) < 0) {
+ parallel_print("h5diff: unable to set VFD on fapl for input file\n");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "failed to set VFD on FAPL\n");
+ }
+ }
+
+ /* Set non-default VOL connector, if requested */
+ if (opts->custom_vol[0]) {
+ if (h5tools_set_fapl_vol(fapl1_id, &(opts->vol_info[0])) < 0) {
+ parallel_print("h5diff: unable to set VOL on fapl for input file\n");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "failed to set VOL on FAPL\n");
}
}
- if (opts->custom_vol[0] || opts->custom_vfd[0]) {
- if ((fapl1_id = h5tools_get_fapl(fapl1_id, opts->custom_vol[0] ? &(opts->vol_info[0]) : NULL,
- opts->custom_vfd[0] ? &(opts->vfd_info[0]) : NULL)) < 0) {
- parallel_print("h5diff: unable to create fapl for input file\n");
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create input fapl\n");
+ if (opts->page_cache > 0) {
+ if (H5Pset_page_buffer_size(fapl1_id, opts->page_cache, 0, 0) < 0) {
+ parallel_print("h5diff: unable to set page buffer cache size for fapl for input file\n");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to set page buffer cache size on FAPL\n");
}
}
- if ((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, fapl1_id, (fapl1_id != H5P_DEFAULT), NULL,
- (size_t)0)) < 0) {
+ if ((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, fapl1_id,
+ (opts->custom_vol[0] || opts->custom_vfd[0]), NULL, (size_t)0)) < 0) {
parallel_print("h5diff: <%s>: unable to open file\n", fname1);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "<%s>: unable to open file\n", fname1);
}
H5TOOLS_DEBUG("file1_id = %s", fname1);
/* open file 2 */
- if (opts->vfd_info[1].u.name) {
- if ((fapl2_id = h5tools_get_fapl(H5P_DEFAULT, NULL, &(opts->vfd_info[1]))) < 0) {
- parallel_print("h5diff: unable to create fapl for output file\n");
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create output fapl\n");
+ if ((fapl2_id = h5tools_get_new_fapl(H5P_DEFAULT)) < 0) {
+ parallel_print("h5diff: unable to create fapl for output file\n");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create output fapl\n");
+ }
+
+ /* Set non-default virtual file driver, if requested */
+ if (opts->custom_vfd[1] && opts->vfd_info[1].u.name) {
+ if (h5tools_set_fapl_vfd(fapl2_id, &(opts->vfd_info[1])) < 0) {
+ parallel_print("h5diff: unable to set VFD on fapl for output file\n");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "failed to set VFD on FAPL\n");
+ }
+ }
+
+ /* Set non-default VOL connector, if requested */
+ if (opts->custom_vol[1]) {
+ if (h5tools_set_fapl_vol(fapl2_id, &(opts->vol_info[1])) < 0) {
+ parallel_print("h5diff: unable to set VOL on fapl for output file\n");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "failed to set VOL on FAPL\n");
}
}
- if (opts->custom_vol[1] || opts->custom_vfd[1]) {
- if ((fapl2_id = h5tools_get_fapl(fapl2_id, opts->custom_vol[1] ? &(opts->vol_info[1]) : NULL,
- opts->custom_vfd[1] ? &(opts->vfd_info[1]) : NULL)) < 0) {
- parallel_print("h5diff: unable to create fapl for output file\n");
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create output fapl\n");
+ if (opts->page_cache > 0) {
+ if (H5Pset_page_buffer_size(fapl2_id, opts->page_cache, 0, 0) < 0) {
+ parallel_print("h5diff: unable to set page buffer cache size for fapl for output file\n");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to set page buffer cache size for output fapl\n");
}
}
- if ((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, fapl2_id, (fapl2_id != H5P_DEFAULT), NULL,
- (size_t)0)) < 0) {
+ if ((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, fapl2_id,
+ (opts->custom_vol[1] || opts->custom_vfd[1]), NULL, (size_t)0)) < 0) {
parallel_print("h5diff: <%s>: unable to open file\n", fname2);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "<%s>: unable to open file\n", fname2);
}
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 12bf56a8ecd..4b9847a3044 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -92,6 +92,7 @@ typedef struct {
h5tools_vfd_info_t vfd_info[2]; /* VFD information for input file, output file */
bool custom_vol[2]; /* Using a custom input, output VOL? */
bool custom_vfd[2]; /* Using a custom input, output VFD? */
+ size_t page_cache; /* Size to request for page buffer cache */
} diff_opt_t;
/*-------------------------------------------------------------------------
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 16253b195d5..29419e297af 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -469,7 +469,7 @@ h5tools_set_error_file(const char *fname, int is_bin)
* negative - failed
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info)
{
herr_t ret_value = SUCCEED;
@@ -650,7 +650,7 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info)
* negative - failed
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
h5tools_set_fapl_vol(hid_t fapl_id, h5tools_vol_info_t *vol_info)
{
htri_t connector_is_registered;
@@ -746,9 +746,9 @@ h5tools_set_fapl_vol(hid_t fapl_id, h5tools_vol_info_t *vol_info)
}
/*-------------------------------------------------------------------------
- * Function: h5tools_get_fapl
+ * Function: h5tools_get_new_fapl
*
- * Purpose: Copies an input fapl and then sets a VOL and/or a VFD on it.
+ * Purpose: Copies an input fapl.
*
* The returned fapl must be closed by the caller.
*
@@ -757,7 +757,7 @@ h5tools_set_fapl_vol(hid_t fapl_id, h5tools_vol_info_t *vol_info)
*-------------------------------------------------------------------------
*/
hid_t
-h5tools_get_fapl(hid_t prev_fapl_id, h5tools_vol_info_t *vol_info, h5tools_vfd_info_t *vfd_info)
+h5tools_get_new_fapl(hid_t prev_fapl_id)
{
hid_t new_fapl_id = H5I_INVALID_HID;
hid_t ret_value = H5I_INVALID_HID;
@@ -775,16 +775,6 @@ h5tools_get_fapl(hid_t prev_fapl_id, h5tools_vol_info_t *vol_info, h5tools_vfd_i
H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "H5Pcopy failed");
}
- /* Set non-default VOL connector, if requested */
- if (vol_info)
- if (h5tools_set_fapl_vol(new_fapl_id, vol_info) < 0)
- H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to set VOL on FAPL");
-
- /* Set non-default virtual file driver, if requested */
- if (vfd_info)
- if (h5tools_set_fapl_vfd(new_fapl_id, vfd_info) < 0)
- H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to set VFD on FAPL");
-
ret_value = new_fapl_id;
done:
@@ -1026,9 +1016,23 @@ h5tools_fopen(const char *fname, unsigned flags, hid_t fapl_id, bool use_specifi
vfd_info.u.name = drivernames[drivernum];
/* Get a fapl reflecting the selected VOL connector and VFD */
- if ((tmp_fapl_id = h5tools_get_fapl(fapl_id, &vol_info, &vfd_info)) < 0)
+ if ((tmp_fapl_id = h5tools_get_new_fapl(fapl_id)) < 0)
continue;
+ if (h5tools_set_fapl_vol(tmp_fapl_id, &vol_info) < 0) {
+ /* Close the temporary fapl */
+ H5Pclose(tmp_fapl_id);
+ tmp_fapl_id = H5I_INVALID_HID;
+ continue;
+ }
+
+ if (h5tools_set_fapl_vfd(tmp_fapl_id, &vfd_info) < 0) {
+ /* Close the temporary fapl */
+ H5Pclose(tmp_fapl_id);
+ tmp_fapl_id = H5I_INVALID_HID;
+ continue;
+ }
+
/* Can we open the file with this combo? */
H5E_BEGIN_TRY
{
@@ -1051,9 +1055,16 @@ h5tools_fopen(const char *fname, unsigned flags, hid_t fapl_id, bool use_specifi
/* NOT the native VOL connector */
/* Get a FAPL for the current VOL connector */
- if ((tmp_fapl_id = h5tools_get_fapl(fapl_id, &vol_info, NULL)) < 0)
+ if ((tmp_fapl_id = h5tools_get_new_fapl(fapl_id)) < 0)
continue;
+ if (h5tools_set_fapl_vol(tmp_fapl_id, &vol_info) < 0) {
+ /* Close the temporary fapl */
+ H5Pclose(tmp_fapl_id);
+ tmp_fapl_id = H5I_INVALID_HID;
+ continue;
+ }
+
/* Can we open the file with this connector? */
if ((fid = h5tools_fopen(fname, flags, tmp_fapl_id, true, drivername, drivername_size)) >= 0) {
used_fapl_id = tmp_fapl_id;
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index b4ace197d7f..52e3a3659a8 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -673,9 +673,10 @@ H5TOOLS_DLL int h5tools_set_input_file(const char *fname, int is_bin);
H5TOOLS_DLL int h5tools_set_output_file(const char *fname, int is_bin);
H5TOOLS_DLL int h5tools_set_error_file(const char *fname, int is_bin);
-H5TOOLS_DLL hid_t h5tools_get_fapl(hid_t prev_fapl_id, h5tools_vol_info_t *vol_info,
- h5tools_vfd_info_t *vfd_info);
+H5TOOLS_DLL hid_t h5tools_get_new_fapl(hid_t prev_fapl_id);
H5TOOLS_DLL herr_t h5tools_get_vfd_name(hid_t fid, hid_t fapl_id, char *drivername, size_t drivername_size);
+H5TOOLS_DLL herr_t h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info);
+H5TOOLS_DLL herr_t h5tools_set_fapl_vol(hid_t fapl_id, h5tools_vol_info_t *vol_info);
H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl, bool use_specific_driver,
char *drivername, size_t drivername_size);
H5TOOLS_DLL hid_t h5tools_get_little_endian_type(hid_t type);
diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c
index 369472e8d86..03c595f66cb 100644
--- a/tools/libtest/h5tools_test_utils.c
+++ b/tools/libtest/h5tools_test_utils.c
@@ -927,7 +927,7 @@ test_populate_ros3_fa(void)
*
* Function: test_set_configured_fapl()
*
- * Purpose: Verify `h5tools_get_fapl()` with ROS3 and HDFS VFDs
+ * Purpose: Verify `h5tools_get_new_fapl()` with ROS3 and HDFS VFDs
*
* Return: 0 if test passes
* 1 if failure
@@ -1111,12 +1111,15 @@ test_set_configured_fapl(void)
vfd_info.info = C.conf_fa;
vfd_info.u.name = C.vfdname;
- if (C.expected == 1)
- result = h5tools_get_fapl(H5P_DEFAULT, NULL, &vfd_info);
+ if (C.expected == 1) {
+ result = h5tools_get_new_fapl(H5P_DEFAULT);
+ result = h5tools_set_fapl_vfd(result, &vfd_info);
+ }
else {
H5E_BEGIN_TRY
{
- result = h5tools_get_fapl(H5P_DEFAULT, NULL, &vfd_info);
+ result = h5tools_get_new_fapl(H5P_DEFAULT);
+ result = h5tools_set_fapl_vfd(result, &vfd_info);
}
H5E_END_TRY
}
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index 77b83533409..62a8cd2abe5 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -24,7 +24,7 @@ static int check_d_input(const char *);
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "cd:ehln:p:qrv*xA:CE:NS*V";
+static const char *s_opts = "cd:ehln:p:qrv*xA:CE:K:NS*V";
static struct h5_long_options l_opts[] = {{"compare", no_arg, 'c'},
{"delta", require_arg, 'd'},
{"use-system-epsilon", no_arg, 'e'},
@@ -39,6 +39,7 @@ static struct h5_long_options l_opts[] = {{"compare", no_arg, 'c'},
{"exclude-attribute", require_arg, 'A'},
{"no-compact-subset", no_arg, 'C'},
{"exclude-path", require_arg, 'E'},
+ {"page-buffer-size", require_arg, 'K'},
{"nan", no_arg, 'N'},
{"enable-error-stack", optional_arg, 'S'},
{"version", no_arg, 'V'},
@@ -137,6 +138,9 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const
/**this is bad in mixing option with results**/
opts->not_cmp = 0;
+ /* init for page buffer cache size option */
+ opts->page_cache = 0;
+
/* init for exclude-path option */
exclude_head = NULL;
@@ -320,6 +324,10 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const
opts->use_system_epsilon = 1;
break;
+ case 'K':
+ opts->page_cache = strtoul(H5_optarg, NULL, 0);
+ break;
+
case '1':
opts->vol_info[0].type = VOL_BY_VALUE;
opts->vol_info[0].u.value = (H5VL_class_value_t)atoi(H5_optarg);
@@ -622,6 +630,8 @@ usage(void)
PRINTVALSTREAM(rawoutstream, " 3 : All level 2 information plus file names.\n");
PRINTVALSTREAM(rawoutstream, " -q, --quiet\n");
PRINTVALSTREAM(rawoutstream, " Quiet mode. Do not produce output.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --page-buffer-size=N Set the page buffer cache size, N=non-negative integers\n");
PRINTVALSTREAM(rawoutstream,
" --vol-value-1 Value (ID) of the VOL connector to use for opening the\n");
PRINTVALSTREAM(rawoutstream, " first HDF5 file specified\n");
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index 40041e3aec9..dc86e526294 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -17,6 +17,7 @@
/* Name of tool */
#define PROGRAMNAME "h5dump"
+size_t page_cache = 0;
const char *outfname_g = NULL;
static bool doxml_g = false;
static bool useschema_g = true;
@@ -97,7 +98,7 @@ struct handler_t {
*/
/* The following initialization makes use of C language concatenating */
/* "xxx" "yyy" into "xxxyyy". */
-static const char *s_opts = "a:b*c:d:ef:g:hik:l:m:n*o*pq:rs:t:uvw:xyz:A*BCD:E*F:G:HM:N:O*RS:VX:";
+static const char *s_opts = "a:b*c:d:ef:g:hik:l:m:n*o*pq:rs:t:uvw:xyz:A*BCD:E*F:G:HK:M:N:O*RS:VX:";
static struct h5_long_options l_opts[] = {{"attribute", require_arg, 'a'},
{"binary", optional_arg, 'b'},
{"count", require_arg, 'c'},
@@ -132,6 +133,7 @@ static struct h5_long_options l_opts[] = {{"attribute", require_arg, 'a'},
{"form", require_arg, 'F'},
{"vds-gap-size", require_arg, 'G'},
{"header", no_arg, 'H'},
+ {"page-buffer-size", require_arg, 'K'},
{"packed-bits", require_arg, 'M'},
{"any_path", require_arg, 'N'},
{"ddl", optional_arg, 'O'},
@@ -198,6 +200,8 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " -O F, --ddl=F Output ddl text into file F\n");
PRINTVALSTREAM(rawoutstream,
" Use blank(empty) filename F to suppress ddl display\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --page-buffer-size=N Set the page buffer cache size, N=non-negative integers\n");
PRINTVALSTREAM(rawoutstream,
" --s3-cred= Supply S3 authentication information to \"ros3\" vfd.\n");
PRINTVALSTREAM(rawoutstream,
@@ -1019,6 +1023,9 @@ parse_command_line(int argc, const char *const *argv)
goto error;
}
break;
+ case 'K':
+ page_cache = strtoul(H5_optarg, NULL, 0);
+ break;
/** begin XML parameters **/
case 'x':
@@ -1368,10 +1375,30 @@ main(int argc, char *argv[])
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
- if (use_custom_vol_g || use_custom_vfd_g) {
- if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, use_custom_vol_g ? &vol_info_g : NULL,
- use_custom_vfd_g ? &vfd_info_g : NULL)) < 0) {
- error_msg("unable to create FAPL for file access\n");
+ if ((fapl_id = h5tools_get_new_fapl(H5P_DEFAULT)) < 0) {
+ error_msg("unable to create FAPL for file access\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ /* Set non-default VOL connector, if requested */
+ if (use_custom_vol_g) {
+ if (h5tools_set_fapl_vol(fapl_id, &vol_info_g) < 0) {
+ error_msg("unable to set VOL on fapl for file\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ }
+ /* Set non-default virtual file driver, if requested */
+ if (use_custom_vfd_g) {
+ if (h5tools_set_fapl_vfd(fapl_id, &vfd_info_g) < 0) {
+ error_msg("unable to set VFD on fapl for file\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ }
+ if (page_cache > 0) {
+ if (H5Pset_page_buffer_size(fapl_id, page_cache, 0, 0) < 0) {
+ error_msg("unable to set page buffer cache size for file access\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
@@ -1394,7 +1421,8 @@ main(int argc, char *argv[])
goto done;
}
else
- fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id != H5P_DEFAULT), NULL, 0);
+ fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (use_custom_vol_g || use_custom_vfd_g), NULL,
+ 0);
if (fid < 0) {
error_msg("unable to open file \"%s\"\n", fname);
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index bef90cf9061..ef36839f815 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -25,6 +25,7 @@
#define PROGRAMNAME "h5ls"
#define NAME_BUF_SIZE 2048
+
/*
* Alternative formatting for data dumped by H5LS
*
@@ -211,6 +212,8 @@ usage(void)
PRINTVALSTREAM(rawoutstream, " -wN, --width=N Set the number of columns of output\n");
PRINTVALSTREAM(rawoutstream, " -v, --verbose Generate more verbose output\n");
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --page-buffer-size=N Set the page buffer cache size, N=non-negative integers\n");
PRINTVALSTREAM(rawoutstream, " --vfd=DRIVER Use the specified virtual file driver\n");
PRINTVALSTREAM(rawoutstream, " -x, --hexdump Show raw data in hexadecimal format\n");
PRINTVALSTREAM(rawoutstream,
@@ -2659,6 +2662,7 @@ main(int argc, char *argv[])
static char root_name[] = "/";
char drivername[50];
int err_exit = 0;
+ size_t page_cache = 0;
hid_t fapl_id = H5P_DEFAULT;
bool custom_vol_fapl = false;
bool custom_vfd_fapl = false;
@@ -2816,6 +2820,9 @@ main(int argc, char *argv[])
leave(EXIT_FAILURE);
}
}
+ else if (!strncmp(argv[argno], "--page-buffer-size=", (size_t)19)) {
+ page_cache = strtoul(argv[argno] + 19, &rest, 0);
+ }
else if (!strcmp(argv[argno], "--verbose")) {
verbose_g++;
}
@@ -2995,23 +3002,40 @@ main(int argc, char *argv[])
}
/* Setup a custom fapl for file accesses */
- if (custom_vol_fapl || custom_vfd_fapl) {
#ifdef H5_HAVE_ROS3_VFD
- if (custom_vfd_fapl && (0 == strcmp(vfd_info.u.name, drivernames[ROS3_VFD_IDX]))) {
- if (!vfd_info.info)
- vfd_info.info = &ros3_fa;
- }
+ if (custom_vfd_fapl && (0 == strcmp(vfd_info.u.name, drivernames[ROS3_VFD_IDX]))) {
+ if (!vfd_info.info)
+ vfd_info.info = &ros3_fa;
+ }
#endif
#ifdef H5_HAVE_LIBHDFS
- if (custom_vfd_fapl && (0 == strcmp(vfd_info.u.name, drivernames[HDFS_VFD_IDX]))) {
- if (!vfd_info.info)
- vfd_info.info = &hdfs_fa;
- }
+ if (custom_vfd_fapl && (0 == strcmp(vfd_info.u.name, drivernames[HDFS_VFD_IDX]))) {
+ if (!vfd_info.info)
+ vfd_info.info = &hdfs_fa;
+ }
#endif
- if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, custom_vol_fapl ? &vol_info : NULL,
- custom_vfd_fapl ? &vfd_info : NULL)) < 0) {
- error_msg("failed to setup file access property list (fapl) for file\n");
+ if ((fapl_id = h5tools_get_new_fapl(H5P_DEFAULT)) < 0) {
+ error_msg("unable to create FAPL for file access\n");
+ leave(EXIT_FAILURE);
+ }
+ /* Set non-default VOL connector, if requested */
+ if (custom_vol_fapl) {
+ if (h5tools_set_fapl_vol(fapl_id, &vol_info) < 0) {
+ error_msg("unable to set VOL on fapl for file\n");
+ leave(EXIT_FAILURE);
+ }
+ }
+ /* Set non-default virtual file driver, if requested */
+ if (custom_vfd_fapl) {
+ if (h5tools_set_fapl_vfd(fapl_id, &vfd_info) < 0) {
+ error_msg("unable to set VFD on fapl for file\n");
+ leave(EXIT_FAILURE);
+ }
+ }
+ if (page_cache > 0) {
+ if (H5Pset_page_buffer_size(fapl_id, page_cache, 0, 0) < 0) {
+ error_msg("unable to set page buffer cache size for file access\n");
leave(EXIT_FAILURE);
}
}
@@ -3040,8 +3064,8 @@ main(int argc, char *argv[])
file_id = H5I_INVALID_HID;
while (fname && *fname) {
- file_id = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id != H5P_DEFAULT), drivername,
- sizeof drivername);
+ file_id = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (custom_vol_fapl || custom_vfd_fapl),
+ drivername, sizeof drivername);
if (file_id >= 0) {
if (verbose_g)
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 30351e220d7..fa1dc90081b 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -80,6 +80,10 @@ h5repack_init(pack_opt_t *options, int verbose, bool latest)
options->high_bound = H5F_LIBVER_LATEST;
options->fin_fapl = H5P_DEFAULT;
options->fout_fapl = H5P_DEFAULT;
+ options->fin_vol = false;
+ options->fin_vfd = false;
+ options->fout_vol = false;
+ options->fout_vfd = false;
for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) {
options->filter_g[n].filtn = -1;
@@ -793,7 +797,7 @@ check_objects(const char *fname, pack_opt_t *options)
* open the file
*-------------------------------------------------------------------------
*/
- if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, options->fin_fapl, (options->fin_fapl != H5P_DEFAULT),
+ if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, options->fin_fapl, (options->fin_vol || options->fin_vfd),
NULL, 0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR);
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h
index fa79c6f53f5..cc724a067cf 100644
--- a/tools/src/h5repack/h5repack.h
+++ b/tools/src/h5repack/h5repack.h
@@ -133,6 +133,10 @@ typedef struct {
int fs_persist; /* Free space section threshold */
long fs_threshold; /* Free space section threshold */
long long fs_pagesize; /* File space page size */
+ bool fin_vol; /* Custom VOL for input file */
+ bool fin_vfd; /* Custom VFD for input file */
+ bool fout_vol; /* Custom VOL for output file */
+ bool fout_vfd; /* Custom VFD for output file */
} pack_opt_t;
typedef struct named_dt_t {
@@ -156,7 +160,7 @@ int h5repack_addlayout(const char *str, pack_opt_t *options);
int h5repack_init(pack_opt_t *options, int verbose, bool latest);
int h5repack_end(pack_opt_t *options);
int h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options);
-int h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, hid_t fname2_fapl);
+int h5repack_cmp_pl(const char *fname1, const char *fname2, pack_opt_t *options);
/* Note: The below copy_named_datatype(), named_datatype_free(), copy_attr()
* and struct named_dt_t were located in h5repack_copy.c as static prior to
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index ca1e76753d4..77442269f6f 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -81,8 +81,8 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options)
* open input file
*-------------------------------------------------------------------------
*/
- if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, options->fin_fapl, (options->fin_fapl != H5P_DEFAULT),
- NULL, (size_t)0)) < 0)
+ if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, options->fin_fapl,
+ (options->fin_vol || options->fin_vfd), NULL, (size_t)0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fnamein, H5FOPENERROR);
/* get user block size and file space strategy/persist/threshold */
@@ -849,7 +849,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
* doesn't support this.
*/
if (use_h5ocopy &&
- (options->fin_fapl != H5P_DEFAULT || options->fout_fapl != H5P_DEFAULT)) {
+ (options->fin_vol || options->fout_vol || options->fin_vfd || options->fout_vfd)) {
hid_t in_vol_id;
hid_t out_vol_id;
hid_t default_vol_id;
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 85ab93a375c..8318fd11be5 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -30,7 +30,8 @@ static const char *outfile = NULL;
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:v*z:E*G:LM:P:S:T:VXWY:Z:1:2:3:4:5:6:7:8:9:0:";
+static const char *s_opts =
+ "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:v*z:E*G:K:LM:P:S:T:VXWY:Z:1:2:3:4:5:6:7:8:9:0:";
static struct h5_long_options l_opts[] = {{"alignment", require_arg, 'a'},
{"block", require_arg, 'b'},
{"compact", require_arg, 'c'},
@@ -53,6 +54,7 @@ static struct h5_long_options l_opts[] = {{"alignment", require_arg, 'a'},
{"sort_order", require_arg, 'z'},
{"enable-error-stack", optional_arg, 'E'},
{"fs_pagesize", require_arg, 'G'},
+ {"page-buffer-size", require_arg, 'K'},
{"latest", no_arg, 'L'},
{"metadata_block_size", require_arg, 'M'},
{"fs_persist", require_arg, 'P'},
@@ -113,6 +115,8 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " N - is an integer greater than 1, 2 displays read/write timing\n");
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
PRINTVALSTREAM(rawoutstream, " -n, --native Use a native HDF5 type when repacking\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --page-buffer-size=N Set the page buffer cache size, N=non-negative integers\n");
PRINTVALSTREAM(rawoutstream,
" --src-vol-value Value (ID) of the VOL connector to use for opening the\n");
PRINTVALSTREAM(rawoutstream, " input HDF5 file specified\n");
@@ -525,11 +529,8 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
h5tools_vol_info_t out_vol_info;
h5tools_vfd_info_t in_vfd_info;
h5tools_vfd_info_t out_vfd_info;
- bool custom_in_vol = false;
- bool custom_in_vfd = false;
- bool custom_out_vol = false;
- bool custom_out_vfd = false;
- hid_t tmp_fapl = H5I_INVALID_HID;
+ hid_t tmp_fapl = H5I_INVALID_HID;
+ size_t page_cache = 0;
int bound, opt;
int ret_value = 0;
@@ -764,6 +765,10 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
options->fs_pagesize = -1;
break;
+ case 'K':
+ page_cache = strtoul(H5_optarg, NULL, 0);
+ break;
+
case 'q':
if (H5_INDEX_UNKNOWN == (sort_by = set_sort_by(H5_optarg))) {
error_msg("failed to set sort by form <%s>\n", H5_optarg);
@@ -792,13 +797,13 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
case '1':
in_vol_info.type = VOL_BY_VALUE;
in_vol_info.u.value = (H5VL_class_value_t)atoi(H5_optarg);
- custom_in_vol = true;
+ options->fin_vol = true;
break;
case '2':
in_vol_info.type = VOL_BY_NAME;
in_vol_info.u.name = H5_optarg;
- custom_in_vol = true;
+ options->fin_vol = true;
break;
case '3':
@@ -808,13 +813,13 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
case '4':
out_vol_info.type = VOL_BY_VALUE;
out_vol_info.u.value = (H5VL_class_value_t)atoi(H5_optarg);
- custom_out_vol = true;
+ options->fout_vol = true;
break;
case '5':
out_vol_info.type = VOL_BY_NAME;
out_vol_info.u.name = H5_optarg;
- custom_out_vol = true;
+ options->fout_vol = true;
break;
case '6':
@@ -824,13 +829,13 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
case '7':
in_vfd_info.type = VFD_BY_VALUE;
in_vfd_info.u.value = (H5FD_class_value_t)atoi(H5_optarg);
- custom_in_vfd = true;
+ options->fin_vfd = true;
break;
case '8':
in_vfd_info.type = VFD_BY_NAME;
in_vfd_info.u.name = H5_optarg;
- custom_in_vfd = true;
+ options->fin_vfd = true;
break;
case '9':
@@ -840,13 +845,13 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
case '0':
out_vfd_info.type = VFD_BY_VALUE;
out_vfd_info.u.value = (H5FD_class_value_t)atoi(H5_optarg);
- custom_out_vfd = true;
+ options->fout_vfd = true;
break;
case 'Y':
out_vfd_info.type = VFD_BY_NAME;
out_vfd_info.u.name = H5_optarg;
- custom_out_vfd = true;
+ options->fout_vfd = true;
break;
case 'Z':
@@ -903,47 +908,68 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
}
/* Setup FAPL for input and output file accesses */
- if (custom_in_vol || custom_in_vfd) {
- if ((tmp_fapl = h5tools_get_fapl(options->fin_fapl, custom_in_vol ? &in_vol_info : NULL,
- custom_in_vfd ? &in_vfd_info : NULL)) < 0) {
- error_msg("failed to setup FAPL for input file\n");
+ if ((tmp_fapl = h5tools_get_new_fapl(options->fin_fapl)) < 0) {
+ error_msg("unable to create FAPL for file access for input file\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+ /* Set non-default VOL connector, if requested */
+ if (options->fin_vol) {
+ if (h5tools_set_fapl_vol(tmp_fapl, &in_vol_info) < 0) {
+ error_msg("unable to set VOL on fapl for input file\n");
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
}
-
- /* Close old FAPL */
- if (options->fin_fapl != H5P_DEFAULT)
- if (H5Pclose(options->fin_fapl) < 0) {
- error_msg("failed to close FAPL\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = -1;
- goto done;
- }
-
- options->fin_fapl = tmp_fapl;
}
-
- if (custom_out_vol || custom_out_vfd) {
- if ((tmp_fapl = h5tools_get_fapl(options->fout_fapl, custom_out_vol ? &out_vol_info : NULL,
- custom_out_vfd ? &out_vfd_info : NULL)) < 0) {
- error_msg("failed to setup FAPL for output file\n");
+ /* Set non-default virtual file driver, if requested */
+ if (options->fin_vfd) {
+ if (h5tools_set_fapl_vfd(tmp_fapl, &in_vfd_info) < 0) {
+ error_msg("unable to set VFD on fapl for input file\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+ }
+ if (page_cache > 0) {
+ if (H5Pset_page_buffer_size(tmp_fapl, page_cache, 0, 0) < 0) {
+ error_msg("unable to set page buffer cache size for input file\n");
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
}
+ }
- /* Close old FAPL */
- if (options->fout_fapl != H5P_DEFAULT)
- if (H5Pclose(options->fout_fapl) < 0) {
- error_msg("failed to close FAPL\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = -1;
- goto done;
- }
+ options->fin_fapl = tmp_fapl;
- options->fout_fapl = tmp_fapl;
+ /* Setup FAPL for input and output file accesses */
+ if ((tmp_fapl = h5tools_get_new_fapl(options->fout_fapl)) < 0) {
+ error_msg("unable to create FAPL for file access for output file\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
}
+ /* Set non-default VOL connector, if requested */
+ if (options->fout_vol) {
+ if (h5tools_set_fapl_vol(tmp_fapl, &out_vol_info) < 0) {
+ error_msg("unable to set VOL on fapl for output file\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+ }
+ /* Set non-default virtual file driver, if requested */
+ if (options->fout_vfd) {
+ if (h5tools_set_fapl_vfd(tmp_fapl, &out_vfd_info) < 0) {
+ error_msg("unable to set VFD on fapl for output file\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+ }
+
+ options->fout_fapl = tmp_fapl;
done:
return ret_value;
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
index 819dd94ab26..50604e055cb 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -356,7 +356,7 @@ verify_layout(hid_t pid, pack_info_t *obj)
*/
int
-h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, hid_t fname2_fapl)
+h5repack_cmp_pl(const char *fname1, const char *fname2, pack_opt_t *options)
{
hid_t fid1 = H5I_INVALID_HID; /* file ID */
hid_t fid2 = H5I_INVALID_HID; /* file ID */
@@ -377,11 +377,11 @@ h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, hid_t
*-------------------------------------------------------------------------
*/
/* Open the files */
- if ((fid1 = h5tools_fopen(fname1, H5F_ACC_RDONLY, fname1_fapl, (fname1_fapl != H5P_DEFAULT), NULL, 0)) <
- 0)
+ if ((fid1 = h5tools_fopen(fname1, H5F_ACC_RDONLY, options->fin_fapl,
+ (options->fin_vol || options->fin_vfd), NULL, 0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname1, H5FOPENERROR);
- if ((fid2 = h5tools_fopen(fname2, H5F_ACC_RDONLY, fname2_fapl, (fname2_fapl != H5P_DEFAULT), NULL, 0)) <
- 0)
+ if ((fid2 = h5tools_fopen(fname2, H5F_ACC_RDONLY, options->fout_fapl,
+ (options->fout_vol || options->fout_vfd), NULL, 0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR);
/*-------------------------------------------------------------------------
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index a90ef5e5e8f..71c507801ee 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -117,6 +117,8 @@ typedef struct iter_t {
static const char *drivername = NULL;
+size_t page_cache = 0;
+
#ifdef H5_HAVE_ROS3_VFD
/* Default "anonymous" S3 configuration */
static H5FD_ros3_fapl_ext_t ros3_fa = {
@@ -171,7 +173,7 @@ struct handler_t {
char **obj;
};
-static const char *s_opts = "Aa:Ddm:E*FfhGgl:sSTO:Vw:H:";
+static const char *s_opts = "Aa:Ddm:E*FfhGgl:K:sSTO:Vw:H:";
/* e.g. "filemetadata" has to precede "file"; "groupmetadata" has to precede "group" etc. */
static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'},
{"filemetadata", no_arg, 'F'},
@@ -187,6 +189,7 @@ static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'},
{"numattrs", require_arg, 'a'},
{"freespace", no_arg, 's'},
{"summary", no_arg, 'S'},
+ {"page-buffer-size", require_arg, 'K'},
{"s3-cred", require_arg, 'w'},
{"hdfs-attrs", require_arg, 'H'},
{NULL, 0, '\0'}};
@@ -239,6 +242,7 @@ usage(const char *prog)
fprintf(stdout, " than 0. The default threshold is 10.\n");
fprintf(stdout, " -s, --freespace Print free space information\n");
fprintf(stdout, " -S, --summary Print summary of file space information\n");
+ fprintf(stdout, " --page-buffer-size=N Set the page buffer cache size, N=non-negative integers\n");
fprintf(stdout, " --s3-cred= Access file on S3, using provided credential\n");
fprintf(stdout, " :: (region,id,key)\n");
fprintf(stdout, " If == \"(,,)\", no authentication is used.\n");
@@ -967,6 +971,10 @@ parse_command_line(int argc, const char *const *argv, struct handler_t **hand_re
#endif
break;
+ case 'K':
+ page_cache = strtoul(H5_optarg, NULL, 0);
+ break;
+
default:
usage(h5tools_getprogname());
goto error;
@@ -1618,6 +1626,11 @@ main(int argc, char *argv[])
/* enable error reporting if command line option */
h5tools_error_report();
+ if ((fapl_id = h5tools_get_new_fapl(H5P_DEFAULT)) < 0) {
+ error_msg("unable to create FAPL for file access\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
if (drivername) {
h5tools_vfd_info_t vfd_info;
@@ -1634,8 +1647,17 @@ main(int argc, char *argv[])
vfd_info.info = &hdfs_fa;
#endif
- if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, NULL, &vfd_info)) < 0) {
- error_msg("Unable to create FAPL for file access\n");
+ /* Set non-default virtual file driver, if requested */
+ if (h5tools_set_fapl_vfd(fapl_id, &vfd_info) < 0) {
+ error_msg("unable to set VFD on fapl for file\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ }
+ if (page_cache > 0) {
+ if (H5Pset_page_buffer_size(fapl_id, page_cache, 0, 0) < 0) {
+ error_msg("unable to set page buffer cache size for file access\n");
+ h5tools_setstatus(EXIT_FAILURE);
goto done;
}
}
@@ -1649,7 +1671,7 @@ main(int argc, char *argv[])
printf("Filename: %s\n", fname);
- fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id != H5P_DEFAULT), NULL, 0);
+ fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (drivername != NULL), NULL, 0);
if (fid < 0) {
error_msg("unable to open file \"%s\"\n", fname);
diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c
index 92e30423661..b96251991b5 100644
--- a/tools/src/misc/h5mkgrp.c
+++ b/tools/src/misc/h5mkgrp.c
@@ -30,13 +30,15 @@ static struct h5_long_options l_opts[] = {
/* Command line parameter settings */
typedef struct mkgrp_opt_t {
- char *fname; /* File name to operate on */
- bool latest; /* Whether file should use latest format versions */
- bool verbose; /* Whether output should be verbose */
- bool parents; /* Whether to create intermediate groups */
- size_t ngroups; /* Number of groups to create */
- char **groups; /* Pointer to array of group names */
- hid_t fapl_id; /* fapl to use when opening the file */
+ char *fname; /* File name to operate on */
+ bool latest; /* Whether file should use latest format versions */
+ bool verbose; /* Whether output should be verbose */
+ bool parents; /* Whether to create intermediate groups */
+ size_t ngroups; /* Number of groups to create */
+ char **groups; /* Pointer to array of group names */
+ hid_t fapl_id; /* fapl to use when opening the file */
+ bool custom_vol; /* Whether fapl uses custom VOL */
+ bool custom_vfd; /* Whether fapl uses custom VFD */
} mkgrp_opt_t;
static mkgrp_opt_t params_g; /* Command line parameter settings */
@@ -135,8 +137,6 @@ parse_command_line(int argc, const char *const *argv, mkgrp_opt_t *options)
{
int opt; /* Option from command line */
size_t curr_group; /* Current group name to copy */
- bool custom_vol = false;
- bool custom_vfd = false;
h5tools_vol_info_t vol_info;
h5tools_vfd_info_t vfd_info;
hid_t tmp_fapl_id = H5I_INVALID_HID;
@@ -182,15 +182,15 @@ parse_command_line(int argc, const char *const *argv, mkgrp_opt_t *options)
break;
case '1':
- vol_info.type = VOL_BY_VALUE;
- vol_info.u.value = (H5VL_class_value_t)atoi(H5_optarg);
- custom_vol = true;
+ vol_info.type = VOL_BY_VALUE;
+ vol_info.u.value = (H5VL_class_value_t)atoi(H5_optarg);
+ options->custom_vol = true;
break;
case '2':
- vol_info.type = VOL_BY_NAME;
- vol_info.u.name = H5_optarg;
- custom_vol = true;
+ vol_info.type = VOL_BY_NAME;
+ vol_info.u.name = H5_optarg;
+ options->custom_vol = true;
break;
case '3':
@@ -198,15 +198,15 @@ parse_command_line(int argc, const char *const *argv, mkgrp_opt_t *options)
break;
case '4':
- vfd_info.type = VFD_BY_VALUE;
- vfd_info.u.value = (H5FD_class_value_t)atoi(H5_optarg);
- custom_vfd = true;
+ vfd_info.type = VFD_BY_VALUE;
+ vfd_info.u.value = (H5FD_class_value_t)atoi(H5_optarg);
+ options->custom_vfd = true;
break;
case '5':
- vfd_info.type = VFD_BY_NAME;
- vfd_info.u.name = H5_optarg;
- custom_vfd = true;
+ vfd_info.type = VFD_BY_NAME;
+ vfd_info.u.name = H5_optarg;
+ options->custom_vfd = true;
break;
case '6':
@@ -251,19 +251,25 @@ parse_command_line(int argc, const char *const *argv, mkgrp_opt_t *options)
}
/* Setup a custom fapl for file accesses */
- if (custom_vol || custom_vfd) {
- if ((tmp_fapl_id = h5tools_get_fapl(options->fapl_id, custom_vol ? &vol_info : NULL,
- custom_vfd ? &vfd_info : NULL)) < 0) {
- error_msg("failed to setup file access property list (fapl) for file\n");
+ if (options->custom_vol || options->custom_vfd) {
+ if ((tmp_fapl_id = h5tools_get_new_fapl(options->fapl_id)) < 0) {
+ error_msg("unable to create FAPL for file access\n");
leave(EXIT_FAILURE);
}
-
- /* Close the old fapl */
- if (options->fapl_id != H5P_DEFAULT)
- if (H5Pclose(options->fapl_id) < 0) {
- error_msg("failed to close file access property list (fapl)\n");
+ /* Set non-default VOL connector, if requested */
+ if (options->custom_vol) {
+ if (h5tools_set_fapl_vol(tmp_fapl_id, &vol_info) < 0) {
+ error_msg("unable to set VOL on fapl for file\n");
leave(EXIT_FAILURE);
}
+ }
+ /* Set non-default virtual file driver, if requested */
+ if (options->custom_vfd) {
+ if (h5tools_set_fapl_vfd(tmp_fapl_id, &vfd_info) < 0) {
+ error_msg("unable to set VFD on fapl for file\n");
+ leave(EXIT_FAILURE);
+ }
+ }
options->fapl_id = tmp_fapl_id;
}
@@ -323,8 +329,8 @@ main(int argc, char *argv[])
}
/* Attempt to open an existing HDF5 file first */
- fid = h5tools_fopen(params_g.fname, H5F_ACC_RDWR, params_g.fapl_id, (params_g.fapl_id != H5P_DEFAULT),
- NULL, 0);
+ fid = h5tools_fopen(params_g.fname, H5F_ACC_RDWR, params_g.fapl_id,
+ (params_g.custom_vol || params_g.custom_vfd), NULL, 0);
/* If we couldn't open an existing file, try creating file */
/* (use "EXCL" instead of "TRUNC", so we don't blow away existing non-HDF5 file) */
diff --git a/tools/test/h5diff/expected/h5diff_10.txt b/tools/test/h5diff/expected/h5diff_10.txt
index a30da23a8fe..30a62550fd9 100644
--- a/tools/test/h5diff/expected/h5diff_10.txt
+++ b/tools/test/h5diff/expected/h5diff_10.txt
@@ -25,6 +25,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--vol-value-1 Value (ID) of the VOL connector to use for opening the
first HDF5 file specified
--vol-name-1 Name of the VOL connector to use for opening the first
diff --git a/tools/test/h5diff/expected/h5diff_600.txt b/tools/test/h5diff/expected/h5diff_600.txt
index bdb7788af7d..5a081f96b3a 100644
--- a/tools/test/h5diff/expected/h5diff_600.txt
+++ b/tools/test/h5diff/expected/h5diff_600.txt
@@ -25,6 +25,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--vol-value-1 Value (ID) of the VOL connector to use for opening the
first HDF5 file specified
--vol-name-1 Name of the VOL connector to use for opening the first
diff --git a/tools/test/h5diff/expected/h5diff_603.txt b/tools/test/h5diff/expected/h5diff_603.txt
index ce1577c5f82..12e67ddb02b 100644
--- a/tools/test/h5diff/expected/h5diff_603.txt
+++ b/tools/test/h5diff/expected/h5diff_603.txt
@@ -26,6 +26,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--vol-value-1 Value (ID) of the VOL connector to use for opening the
first HDF5 file specified
--vol-name-1 Name of the VOL connector to use for opening the first
diff --git a/tools/test/h5diff/expected/h5diff_606.txt b/tools/test/h5diff/expected/h5diff_606.txt
index 9ee22448c5b..1d04cb92f53 100644
--- a/tools/test/h5diff/expected/h5diff_606.txt
+++ b/tools/test/h5diff/expected/h5diff_606.txt
@@ -26,6 +26,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--vol-value-1 Value (ID) of the VOL connector to use for opening the
first HDF5 file specified
--vol-name-1 Name of the VOL connector to use for opening the first
diff --git a/tools/test/h5diff/expected/h5diff_612.txt b/tools/test/h5diff/expected/h5diff_612.txt
index fee63aaed28..130970a1f45 100644
--- a/tools/test/h5diff/expected/h5diff_612.txt
+++ b/tools/test/h5diff/expected/h5diff_612.txt
@@ -26,6 +26,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--vol-value-1 Value (ID) of the VOL connector to use for opening the
first HDF5 file specified
--vol-name-1 Name of the VOL connector to use for opening the first
diff --git a/tools/test/h5diff/expected/h5diff_615.txt b/tools/test/h5diff/expected/h5diff_615.txt
index 562308aaa9a..9c086bf2360 100644
--- a/tools/test/h5diff/expected/h5diff_615.txt
+++ b/tools/test/h5diff/expected/h5diff_615.txt
@@ -26,6 +26,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--vol-value-1 Value (ID) of the VOL connector to use for opening the
first HDF5 file specified
--vol-name-1 Name of the VOL connector to use for opening the first
diff --git a/tools/test/h5diff/expected/h5diff_621.txt b/tools/test/h5diff/expected/h5diff_621.txt
index 03b69bba232..c76aae8b347 100644
--- a/tools/test/h5diff/expected/h5diff_621.txt
+++ b/tools/test/h5diff/expected/h5diff_621.txt
@@ -26,6 +26,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--vol-value-1 Value (ID) of the VOL connector to use for opening the
first HDF5 file specified
--vol-name-1 Name of the VOL connector to use for opening the first
diff --git a/tools/test/h5diff/expected/h5diff_622.txt b/tools/test/h5diff/expected/h5diff_622.txt
index 05e6b94c502..99f396aa40d 100644
--- a/tools/test/h5diff/expected/h5diff_622.txt
+++ b/tools/test/h5diff/expected/h5diff_622.txt
@@ -26,6 +26,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--vol-value-1 Value (ID) of the VOL connector to use for opening the
first HDF5 file specified
--vol-name-1 Name of the VOL connector to use for opening the first
diff --git a/tools/test/h5diff/expected/h5diff_623.txt b/tools/test/h5diff/expected/h5diff_623.txt
index d2e81fa8f47..3490630de93 100644
--- a/tools/test/h5diff/expected/h5diff_623.txt
+++ b/tools/test/h5diff/expected/h5diff_623.txt
@@ -26,6 +26,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--vol-value-1 Value (ID) of the VOL connector to use for opening the
first HDF5 file specified
--vol-name-1 Name of the VOL connector to use for opening the first
diff --git a/tools/test/h5diff/expected/h5diff_624.txt b/tools/test/h5diff/expected/h5diff_624.txt
index 94e6b4ef8af..f6ff568800e 100644
--- a/tools/test/h5diff/expected/h5diff_624.txt
+++ b/tools/test/h5diff/expected/h5diff_624.txt
@@ -26,6 +26,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--vol-value-1 Value (ID) of the VOL connector to use for opening the
first HDF5 file specified
--vol-name-1 Name of the VOL connector to use for opening the first
diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake
index 546cfcbf011..05f3648eb57 100644
--- a/tools/test/h5dump/CMakeTests.cmake
+++ b/tools/test/h5dump/CMakeTests.cmake
@@ -23,6 +23,7 @@
charsets.ddl
err_attr_dspace.ddl
file_space.ddl
+ file_space_cache.ddl
filter_fail.ddl
non_existing.ddl
infinite_loop.ddl
@@ -1187,6 +1188,7 @@
ADD_H5_TEST (tboot2A 0 --enable-error-stack --boot-block tfcontents2.h5)
ADD_H5_TEST (tboot2B 0 --enable-error-stack --superblock tfcontents2.h5)
ADD_H5_TEST (file_space 0 --enable-error-stack -B file_space.h5)
+ ADD_H5_TEST (file_space_cache 0 --enable-error-stack=2 --page-buffer-size=16384 -B file_space.h5)
# test -p with a non existing dataset
ADD_H5ERR_MASK_TEST (tperror 1 "h5dump error: unable to get link info from \"bogus\"" --enable-error-stack -p -d bogus tfcontents1.h5)
diff --git a/tools/test/h5dump/expected/file_space_cache.ddl b/tools/test/h5dump/expected/file_space_cache.ddl
new file mode 100644
index 00000000000..6b8aa476a19
--- /dev/null
+++ b/tools/test/h5dump/expected/file_space_cache.ddl
@@ -0,0 +1,22 @@
+HDF5 "file_space.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 2
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 32
+ FILE_SPACE_STRATEGY H5F_FSPACE_STRATEGY_NONE
+ FREE_SPACE_PERSIST FALSE
+ FREE_SPACE_SECTION_THRESHOLD 1
+ FILE_SPACE_PAGE_SIZE 8192
+ USER_BLOCK {
+ USERBLOCK_SIZE 0
+ }
+}
+GROUP "/" {
+}
+}
diff --git a/tools/test/h5dump/expected/h5dump-help.txt b/tools/test/h5dump/expected/h5dump-help.txt
index 45beb63d23b..a78d8d820ec 100644
--- a/tools/test/h5dump/expected/h5dump-help.txt
+++ b/tools/test/h5dump/expected/h5dump-help.txt
@@ -16,6 +16,7 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--s3-cred= Supply S3 authentication information to "ros3" vfd.
:: "(,,)"
If absent or -> "(,,)", no authentication.
diff --git a/tools/test/h5dump/expected/pbits/tnofilename-with-packed-bits.ddl b/tools/test/h5dump/expected/pbits/tnofilename-with-packed-bits.ddl
index 45beb63d23b..a78d8d820ec 100644
--- a/tools/test/h5dump/expected/pbits/tnofilename-with-packed-bits.ddl
+++ b/tools/test/h5dump/expected/pbits/tnofilename-with-packed-bits.ddl
@@ -16,6 +16,7 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--s3-cred= Supply S3 authentication information to "ros3" vfd.
:: "(,,)"
If absent or -> "(,,)", no authentication.
diff --git a/tools/test/h5dump/expected/pbits/tpbitsIncomplete.ddl b/tools/test/h5dump/expected/pbits/tpbitsIncomplete.ddl
index 45beb63d23b..a78d8d820ec 100644
--- a/tools/test/h5dump/expected/pbits/tpbitsIncomplete.ddl
+++ b/tools/test/h5dump/expected/pbits/tpbitsIncomplete.ddl
@@ -16,6 +16,7 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--s3-cred= Supply S3 authentication information to "ros3" vfd.
:: "(,,)"
If absent or -> "(,,)", no authentication.
diff --git a/tools/test/h5dump/expected/pbits/tpbitsLengthExceeded.ddl b/tools/test/h5dump/expected/pbits/tpbitsLengthExceeded.ddl
index 45beb63d23b..a78d8d820ec 100644
--- a/tools/test/h5dump/expected/pbits/tpbitsLengthExceeded.ddl
+++ b/tools/test/h5dump/expected/pbits/tpbitsLengthExceeded.ddl
@@ -16,6 +16,7 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--s3-cred= Supply S3 authentication information to "ros3" vfd.
:: "(,,)"
If absent or -> "(,,)", no authentication.
diff --git a/tools/test/h5dump/expected/pbits/tpbitsLengthPositive.ddl b/tools/test/h5dump/expected/pbits/tpbitsLengthPositive.ddl
index 45beb63d23b..a78d8d820ec 100644
--- a/tools/test/h5dump/expected/pbits/tpbitsLengthPositive.ddl
+++ b/tools/test/h5dump/expected/pbits/tpbitsLengthPositive.ddl
@@ -16,6 +16,7 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--s3-cred= Supply S3 authentication information to "ros3" vfd.
:: "(,,)"
If absent or -> "(,,)", no authentication.
diff --git a/tools/test/h5dump/expected/pbits/tpbitsMaxExceeded.ddl b/tools/test/h5dump/expected/pbits/tpbitsMaxExceeded.ddl
index 45beb63d23b..a78d8d820ec 100644
--- a/tools/test/h5dump/expected/pbits/tpbitsMaxExceeded.ddl
+++ b/tools/test/h5dump/expected/pbits/tpbitsMaxExceeded.ddl
@@ -16,6 +16,7 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--s3-cred= Supply S3 authentication information to "ros3" vfd.
:: "(,,)"
If absent or -> "(,,)", no authentication.
diff --git a/tools/test/h5dump/expected/pbits/tpbitsOffsetExceeded.ddl b/tools/test/h5dump/expected/pbits/tpbitsOffsetExceeded.ddl
index 45beb63d23b..a78d8d820ec 100644
--- a/tools/test/h5dump/expected/pbits/tpbitsOffsetExceeded.ddl
+++ b/tools/test/h5dump/expected/pbits/tpbitsOffsetExceeded.ddl
@@ -16,6 +16,7 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--s3-cred= Supply S3 authentication information to "ros3" vfd.
:: "(,,)"
If absent or -> "(,,)", no authentication.
diff --git a/tools/test/h5dump/expected/pbits/tpbitsOffsetNegative.ddl b/tools/test/h5dump/expected/pbits/tpbitsOffsetNegative.ddl
index 45beb63d23b..a78d8d820ec 100644
--- a/tools/test/h5dump/expected/pbits/tpbitsOffsetNegative.ddl
+++ b/tools/test/h5dump/expected/pbits/tpbitsOffsetNegative.ddl
@@ -16,6 +16,7 @@ usage: h5dump [OPTIONS] files
-b B, --binary=B Binary file output, of form B
-O F, --ddl=F Output ddl text into file F
Use blank(empty) filename F to suppress ddl display
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--s3-cred= Supply S3 authentication information to "ros3" vfd.
:: "(,,)"
If absent or -> "(,,)", no authentication.
diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in
index efada14934f..6a60785e959 100644
--- a/tools/test/h5dump/testh5dump.sh.in
+++ b/tools/test/h5dump/testh5dump.sh.in
@@ -198,6 +198,7 @@ $SRC_H5DUMP_TESTFILES/tst_onion_dset_1d.h5.onion
LIST_OTHER_TEST_FILES="
$SRC_H5DUMP_OUTFILES/charsets.ddl
$SRC_H5DUMP_OUTFILES/file_space.ddl
+$SRC_H5DUMP_OUTFILES/file_space_cache.ddl
$SRC_H5DUMP_OUTFILES/filter_fail.ddl
$SRC_H5DUMP_OUTFILES/non_existing.ddl
$SRC_H5DUMP_OUTFILES/infinite_loop.ddl
@@ -1254,6 +1255,7 @@ TOOLTEST tboot2.ddl --enable-error-stack -B tfcontents2.h5
TOOLTEST tboot2A.ddl --enable-error-stack --boot-block tfcontents2.h5
TOOLTEST tboot2B.ddl --enable-error-stack --superblock tfcontents2.h5
TOOLTEST file_space.ddl --enable-error-stack -B file_space.h5
+TOOLTEST file_space_cache.ddl --enable-error-stack=2 --page-buffer-size=16384 -B file_space.h5
# test -p with a non existing dataset
GREPTEST ERRTXT "h5dump error: unable to get link info from" tperror.ddl --enable-error-stack -p -d bogus tfcontents1.h5
diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake
index e47c254f465..f9a489f96f0 100644
--- a/tools/test/h5ls/CMakeTests.cmake
+++ b/tools/test/h5ls/CMakeTests.cmake
@@ -258,6 +258,9 @@
ADD_H5_TEST (tgroup 0 -w80 tgroup.h5)
ADD_H5_TEST (tgroup-3 0 -w80 tgroup.h5/g1)
+ # test page buffer cache command
+ ADD_H5_TEST (tall-pbc 0 -w80 --page-buffer-size=8192 tall.h5)
+
# test for displaying groups
# The following combination of arguments is expected to return an error message
# and return value 1
diff --git a/tools/test/h5ls/expected/help-1.ls b/tools/test/h5ls/expected/help-1.ls
index 1cf733bc3a3..668f34aabe6 100644
--- a/tools/test/h5ls/expected/help-1.ls
+++ b/tools/test/h5ls/expected/help-1.ls
@@ -35,6 +35,7 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
-wN, --width=N Set the number of columns of output
-v, --verbose Generate more verbose output
-V, --version Print version number and exit
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--vfd=DRIVER Use the specified virtual file driver
-x, --hexdump Show raw data in hexadecimal format
--s3-cred=C Supply S3 authentication information to "ros3" vfd.
diff --git a/tools/test/h5ls/expected/help-2.ls b/tools/test/h5ls/expected/help-2.ls
index 1cf733bc3a3..668f34aabe6 100644
--- a/tools/test/h5ls/expected/help-2.ls
+++ b/tools/test/h5ls/expected/help-2.ls
@@ -35,6 +35,7 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
-wN, --width=N Set the number of columns of output
-v, --verbose Generate more verbose output
-V, --version Print version number and exit
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--vfd=DRIVER Use the specified virtual file driver
-x, --hexdump Show raw data in hexadecimal format
--s3-cred=C Supply S3 authentication information to "ros3" vfd.
diff --git a/tools/test/h5ls/expected/help-3.ls b/tools/test/h5ls/expected/help-3.ls
index 1cf733bc3a3..668f34aabe6 100644
--- a/tools/test/h5ls/expected/help-3.ls
+++ b/tools/test/h5ls/expected/help-3.ls
@@ -35,6 +35,7 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
-wN, --width=N Set the number of columns of output
-v, --verbose Generate more verbose output
-V, --version Print version number and exit
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--vfd=DRIVER Use the specified virtual file driver
-x, --hexdump Show raw data in hexadecimal format
--s3-cred=C Supply S3 authentication information to "ros3" vfd.
diff --git a/tools/test/h5ls/expected/textlinksrc-nodangle-1.ls b/tools/test/h5ls/expected/textlinksrc-nodangle-1.ls
index 1cf733bc3a3..668f34aabe6 100644
--- a/tools/test/h5ls/expected/textlinksrc-nodangle-1.ls
+++ b/tools/test/h5ls/expected/textlinksrc-nodangle-1.ls
@@ -35,6 +35,7 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
-wN, --width=N Set the number of columns of output
-v, --verbose Generate more verbose output
-V, --version Print version number and exit
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--vfd=DRIVER Use the specified virtual file driver
-x, --hexdump Show raw data in hexadecimal format
--s3-cred=C Supply S3 authentication information to "ros3" vfd.
diff --git a/tools/test/h5ls/expected/tgroup-1.ls b/tools/test/h5ls/expected/tgroup-1.ls
index 1cf733bc3a3..668f34aabe6 100644
--- a/tools/test/h5ls/expected/tgroup-1.ls
+++ b/tools/test/h5ls/expected/tgroup-1.ls
@@ -35,6 +35,7 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
-wN, --width=N Set the number of columns of output
-v, --verbose Generate more verbose output
-V, --version Print version number and exit
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--vfd=DRIVER Use the specified virtual file driver
-x, --hexdump Show raw data in hexadecimal format
--s3-cred=C Supply S3 authentication information to "ros3" vfd.
diff --git a/tools/test/h5repack/expected/h5repack-help.txt b/tools/test/h5repack/expected/h5repack-help.txt
index bff70afdb08..ae655feccd0 100644
--- a/tools/test/h5repack/expected/h5repack-help.txt
+++ b/tools/test/h5repack/expected/h5repack-help.txt
@@ -10,6 +10,7 @@ usage: h5repack [OPTIONS] file1 file2
N - is an integer greater than 1, 2 displays read/write timing
-V, --version Print version number and exit
-n, --native Use a native HDF5 type when repacking
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--src-vol-value Value (ID) of the VOL connector to use for opening the
input HDF5 file specified
--src-vol-name Name of the VOL connector to use for opening the input
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
index f3b84c4d1fd..62d3a948c92 100644
--- a/tools/test/h5repack/h5repacktst.c
+++ b/tools/test/h5repack/h5repacktst.c
@@ -384,7 +384,7 @@ main(void)
GOERROR;
if (h5repack_verify(FNAME0, FNAME0OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_cmp_pl(FNAME0, pack_options.fin_fapl, FNAME0OUT, pack_options.fout_fapl) <= 0)
+ if (h5repack_cmp_pl(FNAME0, FNAME0OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
@@ -404,7 +404,7 @@ main(void)
GOERROR;
if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_cmp_pl(FNAME1, pack_options.fin_fapl, FNAME1OUT, pack_options.fout_fapl) <= 0)
+ if (h5repack_cmp_pl(FNAME1, FNAME1OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
@@ -424,7 +424,7 @@ main(void)
GOERROR;
if (h5repack_verify(FNAME2, FNAME2OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_cmp_pl(FNAME2, pack_options.fin_fapl, FNAME2OUT, pack_options.fout_fapl) <= 0)
+ if (h5repack_cmp_pl(FNAME2, FNAME2OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
@@ -443,7 +443,7 @@ main(void)
GOERROR;
if (h5repack_verify(FNAME3, FNAME3OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_cmp_pl(FNAME3, pack_options.fin_fapl, FNAME3OUT, pack_options.fout_fapl) <= 0)
+ if (h5repack_cmp_pl(FNAME3, FNAME3OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
@@ -1127,7 +1127,7 @@ main(void)
GOERROR;
if (h5repack_verify(FNAME7, FNAME7OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_cmp_pl(FNAME7, pack_options.fin_fapl, FNAME7OUT, pack_options.fout_fapl) <= 0)
+ if (h5repack_cmp_pl(FNAME7, FNAME7OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake
index f6287406ee8..943551b4bec 100644
--- a/tools/test/h5stat/CMakeTests.cmake
+++ b/tools/test/h5stat/CMakeTests.cmake
@@ -28,6 +28,7 @@
h5stat_notexist
h5stat_nofile
h5stat_filters
+ h5stat_filters-cache
h5stat_filters-file
h5stat_filters-F
h5stat_filters-d
@@ -192,6 +193,8 @@
ADD_H5_TEST (h5stat_filters-dT 0 -dT h5stat_filters.h5)
ADD_H5_TEST (h5stat_filters-UD 0 -D h5stat_filters.h5)
ADD_H5_TEST (h5stat_filters-UT 0 -T h5stat_filters.h5)
+# Test for page buffer cache size option
+ ADD_H5_TEST (h5stat_filters-cache 0 --enable-error-stack=2 --page-buffer-size=8192 h5stat_filters.h5)
# h5stat_tsohm.h5 is a copy of ../../../test/tsohm.h5 generated by tsohm.c
# as of release 1.8.7-snap0 (on a 64-bit machine)
ADD_H5_TEST (h5stat_tsohm 0 h5stat_tsohm.h5)
diff --git a/tools/test/h5stat/expected/h5stat_filters-cache.ddl b/tools/test/h5stat/expected/h5stat_filters-cache.ddl
new file mode 100644
index 00000000000..7383f0b31ff
--- /dev/null
+++ b/tools/test/h5stat/expected/h5stat_filters-cache.ddl
@@ -0,0 +1,99 @@
+Filename: h5stat_filters.h5
+File information
+ # of unique groups: 1
+ # of unique datasets: 15
+ # of unique named datatypes: 1
+ # of unique links: 0
+ # of unique other: 0
+ Max. # of links to object: 1
+ Max. # of objects in group: 16
+File space information for file metadata (in bytes):
+ Superblock: 96
+ Superblock extension: 0
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 40/0
+ Datasets(exclude compact data): 4128/1088
+ Datatypes: 80/0
+ Groups:
+ B-tree/List: 1200
+ Heap: 384
+ Attributes:
+ B-tree/List: 0
+ Heap: 0
+ Chunked datasets:
+ Index: 31392
+ Datasets:
+ Heap: 72
+ Shared Messages:
+ Header: 0
+ B-tree/List: 0
+ Heap: 0
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
+Small groups (with 0 to 9 links):
+ Total # of small groups: 0
+Group bins:
+ # of groups with 10 - 99 links: 1
+ Total # of groups: 1
+Dataset dimension information:
+ Max. rank of datasets: 2
+ Dataset ranks:
+ # of dataset with rank 1: 1
+ # of dataset with rank 2: 14
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 100
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ Total # of small datasets: 0
+ 1-D Dataset dimension bins:
+ # of datasets with dimension size 100 - 999: 1
+ Total # of datasets: 1
+Dataset storage information:
+ Total raw data size: 9046
+ Total external raw data size: 400
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 1
+ Dataset layout counts[CONTIG]: 2
+ Dataset layout counts[CHUNKED]: 12
+ Dataset layout counts[VIRTUAL]: 0
+ Number of external files : 2
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 7
+ GZIP filter: 2
+ SHUFFLE filter: 2
+ FLETCHER32 filter: 2
+ SZIP filter: 2
+ NBIT filter: 2
+ SCALEOFFSET filter: 1
+ USER-DEFINED filter: 1
+Dataset datatype information:
+ # of unique datatypes used by datasets: 2
+ Dataset datatype #0:
+ Count (total/named) = (14/0)
+ Size (desc./elmt) = (14/4)
+ Dataset datatype #1:
+ Count (total/named) = (1/0)
+ Size (desc./elmt) = (14/4)
+ Total dataset datatype count: 15
+Small # of attributes (objects with 1 to 10 attributes):
+ Total # of objects with small # of attributes: 0
+Attribute bins:
+ Total # of objects with attributes: 0
+ Max. # of attributes to objects: 0
+Free-space persist: FALSE
+Free-space section threshold: 1 bytes
+Small size free-space sections (< 10 bytes):
+ Total # of small size sections: 0
+Free-space section bins:
+ Total # of sections: 0
+File space management strategy: H5F_FSPACE_STRATEGY_FSM_AGGR
+File space page size: 4096 bytes
+Summary of file space information:
+ File metadata: 37392 bytes
+ Raw data: 9046 bytes
+ Amount/Percent of tracked free space: 0 bytes/0.0%
+ Unaccounted space: 258 bytes
+Total space: 46696 bytes
+External raw data: 400 bytes
diff --git a/tools/test/h5stat/expected/h5stat_help1.ddl b/tools/test/h5stat/expected/h5stat_help1.ddl
index 54d6a318eda..82f1cfff3ee 100644
--- a/tools/test/h5stat/expected/h5stat_help1.ddl
+++ b/tools/test/h5stat/expected/h5stat_help1.ddl
@@ -25,6 +25,7 @@ usage: h5stat [OPTIONS] file
than 0. The default threshold is 10.
-s, --freespace Print free space information
-S, --summary Print summary of file space information
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--s3-cred= Access file on S3, using provided credential
:: (region,id,key)
If == "(,,)", no authentication is used.
diff --git a/tools/test/h5stat/expected/h5stat_help2.ddl b/tools/test/h5stat/expected/h5stat_help2.ddl
index 54d6a318eda..82f1cfff3ee 100644
--- a/tools/test/h5stat/expected/h5stat_help2.ddl
+++ b/tools/test/h5stat/expected/h5stat_help2.ddl
@@ -25,6 +25,7 @@ usage: h5stat [OPTIONS] file
than 0. The default threshold is 10.
-s, --freespace Print free space information
-S, --summary Print summary of file space information
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--s3-cred= Access file on S3, using provided credential
:: (region,id,key)
If == "(,,)", no authentication is used.
diff --git a/tools/test/h5stat/expected/h5stat_nofile.ddl b/tools/test/h5stat/expected/h5stat_nofile.ddl
index 54d6a318eda..82f1cfff3ee 100644
--- a/tools/test/h5stat/expected/h5stat_nofile.ddl
+++ b/tools/test/h5stat/expected/h5stat_nofile.ddl
@@ -25,6 +25,7 @@ usage: h5stat [OPTIONS] file
than 0. The default threshold is 10.
-s, --freespace Print free space information
-S, --summary Print summary of file space information
+ --page-buffer-size=N Set the page buffer cache size, N=non-negative integers
--s3-cred= Access file on S3, using provided credential
:: (region,id,key)
If == "(,,)", no authentication is used.
diff --git a/tools/test/h5stat/testh5stat.sh.in b/tools/test/h5stat/testh5stat.sh.in
index bc48494f59b..b44c43921de 100644
--- a/tools/test/h5stat/testh5stat.sh.in
+++ b/tools/test/h5stat/testh5stat.sh.in
@@ -84,6 +84,7 @@ $SRC_H5STAT_OUTFILES/h5stat_help2.ddl
$SRC_H5STAT_OUTFILES/h5stat_notexist.ddl
$SRC_H5STAT_OUTFILES/h5stat_nofile.ddl
$SRC_H5STAT_OUTFILES/h5stat_filters.ddl
+$SRC_H5STAT_OUTFILES/h5stat_filters-cache.ddl
$SRC_H5STAT_OUTFILES/h5stat_filters-file.ddl
$SRC_H5STAT_OUTFILES/h5stat_filters-F.ddl
$SRC_H5STAT_OUTFILES/h5stat_filters-d.ddl
@@ -290,6 +291,8 @@ TOOLTEST h5stat_filters-g.ddl -g h5stat_filters.h5
TOOLTEST h5stat_filters-dT.ddl -dT h5stat_filters.h5
TOOLTEST h5stat_filters-UD.ddl -D h5stat_filters.h5
TOOLTEST h5stat_filters-UT.ddl -T h5stat_filters.h5
+# Test for page buffer cache size option
+TOOLTEST h5stat_filters-cache.ddl --page-buffer-size=8192 h5stat_filters.h5
#
# h5stat_tsohm.h5 is a copy of ../../../test/tsohm.h5 generated by tsohm.c
# as of release 1.8.7-snap0 (on a 64-bit machine)
From 0443a946d3448f8dd0a55943741f34d20ac73ecc Mon Sep 17 00:00:00 2001
From: mattjala <124107509+mattjala@users.noreply.github.com>
Date: Wed, 19 Jun 2024 07:48:11 -0500
Subject: [PATCH 22/45] Clarify documentation for H5CX_get_data_transform
(#4580)
* Correct comment for H5CX_get_data_transform
* Document why data transform ctx field doesnt use macro
---
src/H5CX.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/H5CX.c b/src/H5CX.c
index d3d1ab3bed3..2b25288f41c 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -2351,7 +2351,7 @@ H5CX_get_filter_cb(H5Z_cb_t *filter_cb)
/*-------------------------------------------------------------------------
* Function: H5CX_get_data_transform
*
- * Purpose: Retrieves the I/O filter callback function for the current API call context.
+ * Purpose: Retrieves the data transformation expression for the current API call context.
*
* Return: Non-negative on success / Negative on failure
*
@@ -2371,6 +2371,9 @@ H5CX_get_data_transform(H5Z_data_xform_t **data_transform)
assert(head && *head);
assert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
+ /* This getter does not use H5CX_RETRIEVE_PROP_VALID in order to use H5P_peek instead of H5P_get.
+ This prevents invocation of the data transform property's library-defined copy callback */
+
/* Check if the value has been retrieved already */
if (!(*head)->ctx.data_transform_valid) {
/* Check for default DXPL */
From 8f3520e20bd9b7b9c3fb1fd5a3fda5612bd8a4a1 Mon Sep 17 00:00:00 2001
From: Dana Robinson <43805+derobins@users.noreply.github.com>
Date: Wed, 19 Jun 2024 05:49:07 -0700
Subject: [PATCH 23/45] Remove public API call from ros3 VFD (#4583)
---
src/H5FDros3.c | 76 +++++++++++++++++++++++---------------------------
src/H5Pfapl.c | 21 +++++++-------
2 files changed, 45 insertions(+), 52 deletions(-)
diff --git a/src/H5FDros3.c b/src/H5FDros3.c
index 6222fef8bf3..eebf9edca3c 100644
--- a/src/H5FDros3.c
+++ b/src/H5FDros3.c
@@ -352,17 +352,13 @@ H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_dst /*out*/)
if (fa_dst == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_dst is NULL");
-
- plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS);
- if (plist == NULL)
+ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list");
-
if (H5FD_ROS3 != H5P_peek_driver(plist))
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fapl not set to use the ros3 VFD");
- fa_src = (const H5FD_ros3_fapl_t *)H5P_peek_driver_info(plist);
- if (fa_src == NULL)
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info");
+ if (NULL == (fa_src = (const H5FD_ros3_fapl_t *)H5P_peek_driver_info(plist)))
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "bad VFL driver info");
/* Copy the ros3 fapl data out */
H5MM_memcpy(fa_dst, fa_src, sizeof(H5FD_ros3_fapl_t));
@@ -694,22 +690,19 @@ H5Pset_fapl_ros3_token(hid_t fapl_id, const char *token)
static H5FD_t *
H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
- 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;
- H5P_genplist_t *plist = NULL;
- htri_t token_exists;
- char *token;
- H5FD_t *ret_value = NULL;
+ H5FD_ros3_t *file = NULL;
+ struct tm *now = NULL;
+ char iso8601now[ISO8601_SIZE];
+ unsigned char signing_key[SHA256_DIGEST_LENGTH];
+ s3r_t *handle = NULL;
+ const H5FD_ros3_fapl_t *fa = NULL;
+ H5P_genplist_t *plist = NULL;
+ htri_t token_exists;
+ char *token;
+ H5FD_t *ret_value = NULL;
FUNC_ENTER_PACKAGE
- /* Sanity check on file offsets */
- HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t));
-
/* Check arguments */
if (!url || !*url)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name");
@@ -719,27 +712,29 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr");
if (flags != H5F_ACC_RDONLY)
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, "only Read-Only access allowed");
+ 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 (FAIL == H5Pget_fapl_ros3(fapl_id, &fa))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't get property list");
-
+ /* Init curl */
if (CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to initialize curl global (placeholder flags)");
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "unable to initialize curl global (placeholder flags)");
+
+ /* Get ros3 driver info */
+ if (NULL == (fa = (const H5FD_ros3_fapl_t *)H5P_peek_driver_info(plist)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "could not get ros3 VFL driver info");
/* Session/security token */
- if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a file access property list");
if ((token_exists = H5P_exist_plist(plist, ROS3_TOKEN_PROP_NAME)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "failed to check if property token exists in plist");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "failed check for property token in plist");
if (token_exists) {
if (H5P_get(plist, ROS3_TOKEN_PROP_NAME, &token) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to get token value");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "unable to get token value");
}
/* Open file; procedure depends on whether or not the fapl instructs to
* authenticate requests or not.
*/
- if (fa.authenticate == true) {
+ if (fa->authenticate == true) {
/* Compute signing key (part of AWS/S3 REST API). Can be re-used by
* user/key for 7 days after creation.
*
@@ -749,15 +744,15 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
assert(now != NULL);
if (ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem while writing iso8601 timestamp");
- if (FAIL == H5FD_s3comms_signing_key(signing_key, (const char *)fa.secret_key,
- (const char *)fa.aws_region, (const char *)iso8601now))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem while computing signing key");
+ if (FAIL == H5FD_s3comms_signing_key(signing_key, (const char *)fa->secret_key,
+ (const char *)fa->aws_region, (const char *)iso8601now))
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "problem while computing signing key");
if (token_exists)
- handle = H5FD_s3comms_s3r_open(url, (const char *)fa.aws_region, (const char *)fa.secret_id,
+ handle = H5FD_s3comms_s3r_open(url, (const char *)fa->aws_region, (const char *)fa->secret_id,
(const unsigned char *)signing_key, (const char *)token);
else
- handle = H5FD_s3comms_s3r_open(url, (const char *)fa.aws_region, (const char *)fa.secret_id,
+ handle = H5FD_s3comms_s3r_open(url, (const char *)fa->aws_region, (const char *)fa->secret_id,
(const unsigned char *)signing_key, "");
}
else
@@ -771,16 +766,15 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "could not open");
/* Create new file struct */
- file = H5FL_CALLOC(H5FD_ros3_t);
- if (file == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct");
+ if (NULL == (file = H5FL_CALLOC(H5FD_ros3_t)))
+ HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, NULL, "unable to allocate file struct");
file->s3r_handle = handle;
- H5MM_memcpy(&(file->fa), &fa, sizeof(H5FD_ros3_fapl_t));
+ H5MM_memcpy(&(file->fa), fa, sizeof(H5FD_ros3_fapl_t));
#ifdef ROS3_STATS
if (FAIL == H5FD__ros3_reset_stats(file))
- HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, "unable to reset file statistics");
+ HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, NULL, "unable to reset file statistics");
#endif
/* Cache the initial bytes of the file */
@@ -791,7 +785,7 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if (NULL == (file->cache = (uint8_t *)H5MM_calloc(file->cache_size)))
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, NULL, "unable to allocate cache memory");
- if (H5FD_s3comms_s3r_read(file->s3r_handle, 0, file->cache_size, file->cache) == FAIL)
+ if (H5FD_s3comms_s3r_read(file->s3r_handle, 0, file->cache_size, file->cache) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, NULL, "unable to execute read");
}
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 3d4ca8b69eb..03a65fb7870 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -1477,23 +1477,22 @@ H5Pget_driver(hid_t plist_id)
/*-------------------------------------------------------------------------
* Function: H5P_peek_driver_info
*
- * Purpose: Returns a pointer directly to the file driver-specific
- * information of a file access.
+ * Purpose: Returns a pointer directly to the file driver-specific
+ * information of a file access.
*
- * Return: Success: Ptr to *uncopied* driver specific data
- * structure if any.
- *
- * Failure: NULL. Null is also returned if the driver has
- * not registered any driver-specific properties
- * although no error is pushed on the stack in
- * this case.
+ * Return: Success: Pointer to *uncopied* driver-specific data
+ * structure, if any.
*
+ * Failure: NULL. NULL is also returned if the driver has
+ * not registered any driver-specific properties
+ * although no error is pushed on the stack in
+ * this case.
*-------------------------------------------------------------------------
*/
const void *
H5P_peek_driver_info(H5P_genplist_t *plist)
{
- const void *ret_value = NULL; /* Return value */
+ const void *ret_value = NULL;
FUNC_ENTER_NOAPI(NULL)
@@ -1504,7 +1503,7 @@ H5P_peek_driver_info(H5P_genplist_t *plist)
if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info");
ret_value = driver_prop.driver_info;
- } /* end if */
+ }
else
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a file access property list");
From 07bc505fdd64c54a2372d2a46bf96ec75d5977df Mon Sep 17 00:00:00 2001
From: Dana Robinson <43805+derobins@users.noreply.github.com>
Date: Wed, 19 Jun 2024 05:51:50 -0700
Subject: [PATCH 24/45] Remove printf debugging from H5FDs3comms.c (#4584)
---
src/H5FDs3comms.c | 219 +---------------------------------------------
1 file changed, 1 insertion(+), 218 deletions(-)
diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c
index bcda801a8dd..9b0d786dfe7 100644
--- a/src/H5FDs3comms.c
+++ b/src/H5FDs3comms.c
@@ -47,17 +47,7 @@
#ifdef H5_HAVE_ROS3_VFD
-/* toggle debugging: pick a level
- */
-#define S3COMMS_DEBUG_NONE 0
-#define S3COMMS_DEBUG_REQUESTS 1
-#define S3COMMS_DEBUG_TRACE_API 2
-#define S3COMMS_DEBUG_TRACE_INTERNAL 3
-#define S3COMMS_DEBUG_HEADERS 4
-#define S3COMMS_DEBUG 0
-
/* manipulate verbosity of CURL output
- * operates separately from S3COMMS_DEBUG
*
* 0 -> no explicit curl output
* 1 -> on error, print failure info to stderr
@@ -218,18 +208,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- fprintf(stdout, "called H5FD_s3comms_hrb_node_set.");
- printf("NAME: %s\n", name);
- printf("VALUE: %s\n", value);
- printf("LIST:\n->");
- for (node_ptr = (*L); node_ptr != NULL; node_ptr = node_ptr->next)
- fprintf(stdout, "{%s}\n->", node_ptr->cat);
- printf("(null)\n");
- fflush(stdout);
- node_ptr = NULL;
-#endif
-
if (name == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to operate on null name");
namelen = strlen(name);
@@ -297,10 +275,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
if (value == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove node from empty list");
else {
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- printf("CREATE NEW\n");
- fflush(stdout);
-#endif
/*******************
* CREATE NEW LIST *
*******************/
@@ -328,60 +302,24 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
is_looking = false;
if (value == NULL) {
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- printf("REMOVE HEAD\n");
- fflush(stdout);
-#endif
/***************
* REMOVE HEAD *
***************/
*L = node_ptr->next;
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- printf("FREEING CAT (node)\n");
- fflush(stdout);
-#endif
H5MM_xfree(node_ptr->cat);
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- printf("FREEING LOWERNAME (node)\n");
- fflush(stdout);
-#endif
H5MM_xfree(node_ptr->lowername);
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- printf("FREEING NAME (node)\n");
- fflush(stdout);
-#endif
H5MM_xfree(node_ptr->name);
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- printf("FREEING VALUE (node)\n");
- fflush(stdout);
-#endif
H5MM_xfree(node_ptr->value);
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- printf("MAGIC OK? %s\n", (node_ptr->magic == S3COMMS_HRB_NODE_MAGIC) ? "YES" : "NO");
- fflush(stdout);
-#endif
assert(node_ptr->magic == S3COMMS_HRB_NODE_MAGIC);
node_ptr->magic += 1ul;
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- printf("FREEING POINTER\n");
- fflush(stdout);
-#endif
H5MM_xfree(node_ptr);
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- printf("FREEING WORKING LOWERNAME\n");
- fflush(stdout);
-#endif
H5MM_xfree(lowername);
lowername = NULL;
}
else {
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- printf("MODIFY HEAD\n");
- fflush(stdout);
-#endif
/***************
* MODIFY HEAD *
***************/
@@ -408,10 +346,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
if (value == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove a node 'before' head");
else {
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- printf("PREPEND NEW HEAD\n");
- fflush(stdout);
-#endif
/*******************
* INSERT NEW HEAD *
*******************/
@@ -437,10 +371,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
if (value == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node");
else {
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- printf("APPEND A NODE\n");
- fflush(stdout);
-#endif
/*******************
* APPEND NEW NODE *
*******************/
@@ -460,10 +390,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
if (value == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node");
else {
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- printf("INSERT A NODE\n");
- fflush(stdout);
-#endif
/*******************
* INSERT NEW NODE *
*******************/
@@ -489,10 +415,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
hrb_node_t *tmp = node_ptr->next;
node_ptr->next = tmp->next;
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- printf("REMOVE A NODE\n");
- fflush(stdout);
-#endif
H5MM_xfree(tmp->cat);
H5MM_xfree(tmp->lowername);
H5MM_xfree(tmp->name);
@@ -506,10 +428,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
lowername = NULL;
}
else {
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- printf("MODIFY A NODE\n");
- fflush(stdout);
-#endif
/*****************
* MODIFY A NODE *
*****************/
@@ -602,10 +520,6 @@ H5FD_s3comms_hrb_destroy(hrb_t **_buf)
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- fprintf(stdout, "called H5FD_s3comms_hrb_destroy.\n");
-#endif
-
if (_buf != NULL && *_buf != NULL) {
buf = *_buf;
if (buf->magic != S3COMMS_HRB_MAGIC)
@@ -663,10 +577,6 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "called H5FD_s3comms_hrb_init_request.\n");
-#endif
-
if (_resource == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "resource string cannot be null.");
@@ -767,10 +677,6 @@ H5FD_s3comms_s3r_close(s3r_t *handle)
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG > S3COMMS_DEBUG_TRACE_API
- fprintf(stdout, "called H5FD_s3comms_s3r_close.\n");
-#endif
-
if (handle == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null.");
if (handle->magic != S3COMMS_S3R_MAGIC)
@@ -868,10 +774,6 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle)
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "called H5FD_s3comms_s3r_getsize.\n");
-#endif
-
if (handle == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null.");
if (handle->magic != S3COMMS_S3R_MAGIC)
@@ -916,10 +818,6 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "HTTP metadata buffer overrun");
else if (sds.size == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "No HTTP metadata");
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- else
- fprintf(stdout, "GETSIZE: OK\n");
-#endif
/******************
* PARSE RESPONSE *
@@ -950,10 +848,6 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle)
handle->filesize = (size_t)content_length;
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_REQUESTS
- fprintf(stdout, " -- size: %ju\n", content_length);
-#endif
-
/**********************
* UNDO HEAD SETTINGS *
**********************/
@@ -1019,10 +913,6 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_API
- fprintf(stdout, "called H5FD_s3comms_s3r_open.\n");
-#endif
-
if (url == NULL || url[0] == '\0')
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "url cannot be null.");
@@ -1217,10 +1107,6 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_API
- fprintf(stdout, "called H5FD_s3comms_s3r_read.\n");
-#endif
-
/**************************************
* ABSOLUTELY NECESSARY SANITY-CHECKS *
**************************************/
@@ -1278,11 +1164,6 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value");
}
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS
- fprintf(stdout, "%s: Bytes %" PRIuHADDR " - %" PRIuHADDR ", Request Size: %zu\n", handle->httpverb,
- offset, offset + len - 1, len);
-#endif
-
/*******************
* COMPILE REQUEST *
*******************/
@@ -1391,10 +1272,6 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
}
if (rangebytesstr != NULL) {
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_REQUESTS
- fprintf(stdout, " -- request: %lu %zu\n", (size_t)offset, len);
-
-#endif
if (FAIL == H5FD_s3comms_hrb_node_set(&headers, "Range", rangebytesstr))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set range header");
if (headers == NULL)
@@ -1504,23 +1381,6 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "curl cannot perform request");
#endif
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- if (dest != NULL) {
- fprintf(stdout, "len: %d\n", (int)len);
- fprintf(stdout, "CHECKING FOR BUFFER OVERFLOW\n");
- if (sds == NULL)
- fprintf(stdout, "sds is NULL!\n");
- else {
- fprintf(stdout, "sds: 0x%llx\n", (long long)sds);
- fprintf(stdout, "sds->size: %d\n", (int)sds->size);
- if (len > sds->size)
- fprintf(stdout, "buffer overwrite\n");
- }
- }
- else
- fprintf(stdout, "performed on entire file\n");
-#endif
-
done:
/* clean any malloc'd resources
*/
@@ -1668,10 +1528,6 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "called H5FD_s3comms_aws_canonical_request.\n");
-#endif
-
if (http_request == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hrb object cannot be null.");
assert(http_request->magic == S3COMMS_HRB_MAGIC);
@@ -1774,10 +1630,6 @@ H5FD_s3comms_bytes_to_hex(char *dest, const unsigned char *msg, size_t msg_len,
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "called H5FD_s3comms_bytes_to_hex.\n");
-#endif
-
if (dest == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hex destination cannot be null.");
if (msg == NULL)
@@ -1815,10 +1667,6 @@ H5FD_s3comms_free_purl(parsed_url_t *purl)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- printf("called H5FD_s3comms_free_purl.\n");
-#endif
-
if (purl != NULL) {
assert(purl->magic == S3COMMS_PARSED_URL_MAGIC);
if (purl->scheme != NULL)
@@ -1875,10 +1723,6 @@ H5FD_s3comms_HMAC_SHA256(const unsigned char *key, size_t key_len, const char *m
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "called H5FD_s3comms_HMAC_SHA256.\n");
-#endif
-
if (dest == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null.");
@@ -1962,10 +1806,6 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha
FUNC_ENTER_PACKAGE
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "called load_aws_creds_from_file.\n");
-#endif
-
/* format target line for start of profile */
if (32 < snprintf(profile_line, 32, "[%s]", profile_name))
HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format profile label");
@@ -2079,10 +1919,6 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char *
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "called H5FD_s3comms_load_aws_profile.\n");
-#endif
-
#ifdef H5_HAVE_WIN32_API
ret = snprintf(awspath, 117, "%s/.aws/", getenv("USERPROFILE"));
#else
@@ -2161,10 +1997,6 @@ H5FD_s3comms_nlowercase(char *dest, const char *s, size_t len)
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "called H5FD_s3comms_nlowercase.\n");
-#endif
-
if (dest == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null.");
@@ -2221,10 +2053,6 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- printf("called H5FD_s3comms_parse_url.\n");
-#endif
-
if (str == NULL || *str == '\0')
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid url string");
@@ -2428,33 +2256,16 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr
unsigned int i = 0;
int chars_written = 0;
herr_t ret_value = SUCCEED;
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- unsigned char s[2] = {c, 0};
- unsigned char hex[3] = {0, 0, 0};
-#endif
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "called H5FD_s3comms_percent_encode_char.\n");
-#endif
-
if (repr == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination `repr`.");
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- H5FD_s3comms_bytes_to_hex((char *)hex, s, 1, false);
- fprintf(stdout, " CHAR: \'%s\'\n", s);
- fprintf(stdout, " CHAR-HEX: \"%s\"\n", hex);
-#endif
-
if (c <= (unsigned char)0x7f) {
/* character represented in a single "byte"
* and single percent-code
*/
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, " SINGLE-BYTE\n");
-#endif
*repr_len = 3;
chars_written = snprintf(repr, 4, "%%%02X", c);
if (chars_written < 0)
@@ -2467,9 +2278,7 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr
unsigned int k = 0; /* uint character representation */
unsigned int stack_size = 0;
unsigned char stack[4] = {0, 0, 0, 0};
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, " MULTI-BYTE\n");
-#endif
+
stack_size = 0;
k = (unsigned int)c;
*repr_len = 0;
@@ -2487,16 +2296,6 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr
* UTF-8 byte fields.
*/
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, " STACK:\n {\n");
- for (i = 0; i < stack_size; i++) {
- H5FD_s3comms_bytes_to_hex((char *)hex, (&stack[i]), 1, false);
- hex[2] = 0;
- fprintf(stdout, " %s,\n", hex);
- }
- fprintf(stdout, " }\n");
-#endif
-
/****************
* leading byte *
****************/
@@ -2580,10 +2379,6 @@ H5FD_s3comms_signing_key(unsigned char *md, const char *secret, const char *regi
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "called H5FD_s3comms_signing_key.\n");
-#endif
-
if (md == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Destination `md` cannot be NULL.");
if (secret == NULL)
@@ -2669,10 +2464,6 @@ H5FD_s3comms_tostringtosign(char *dest, const char *req, const char *now, const
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "called H5FD_s3comms_tostringtosign.\n");
-#endif
-
if (dest == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer cannot be null.");
if (req == NULL)
@@ -2753,10 +2544,6 @@ H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written)
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "called H5FD_s3comms_trim.\n");
-#endif
-
if (dest == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null.");
if (s == NULL)
@@ -2840,10 +2627,6 @@ H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, bool encode_slas
FUNC_ENTER_NOAPI_NOINIT
-#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL
- fprintf(stdout, "H5FD_s3comms_uriencode called.\n");
-#endif
-
if (s == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source string cannot be NULL");
if (dest == NULL)
From 98b9c07c0ae37afe97124aba39eb4c960184a746 Mon Sep 17 00:00:00 2001
From: Dana Robinson <43805+derobins@users.noreply.github.com>
Date: Wed, 19 Jun 2024 06:36:45 -0700
Subject: [PATCH 25/45] Cleanup of ros3 test (#4587)
* Removed JS* macro scheme (replaced w/ h5test.h macros)
* Moved curl setup/teardown to main()
* A lot of cleanup and simplification
---
test/ros3.c | 1575 +++++++++++++++------------------------------------
1 file changed, 465 insertions(+), 1110 deletions(-)
diff --git a/test/ros3.c b/test/ros3.c
index cc058fbc9b0..b88c8c61de8 100644
--- a/test/ros3.c
+++ b/test/ros3.c
@@ -29,315 +29,6 @@
#ifdef H5_HAVE_ROS3_VFD
-/* only include the testing macros if needed */
-
-/*****************************************************************************
- *
- * FILE-LOCAL TESTING MACROS
- *
- * Purpose:
- *
- * 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.
- * 2) Increase clarity and reduce overhead found with `TEST_ERROR`.
- * e.g., "if(somefunction(arg, arg2) < 0) TEST_ERROR:"
- * 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
- * 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
- * `VERIFY(actual, expected)`. Provide preprocessor ifdef switch
- * to satisfy 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
- * proper.
- *
- * Macros:
- *
- * JSVERIFY_EXP_ACT - ifdef flag, configures comparison order
- * FAIL_IF() - check condition
- * FAIL_UNLESS() - check _not_ condition
- * JSVERIFY() - long-int equality check; prints reason/comparison
- * JSVERIFY_NOT() - long-int inequality check; prints
- * JSVERIFY_STR() - string equality check; prints
- *
- *****************************************************************************/
-
-/*----------------------------------------------------------------------------
- *
- * ifdef flag: JSVERIFY_EXP_ACT
- *
- * JSVERIFY macros accept arguments as (EXPECTED, ACTUAL[, reason])
- * default, if this is undefined, is (ACTUAL, EXPECTED[, reason])
- *
- *----------------------------------------------------------------------------
- */
-#define JSVERIFY_EXP_ACT 1L
-
-/*----------------------------------------------------------------------------
- *
- * Macro: JSFAILED_AT()
- *
- * Purpose:
- *
- * Preface a test failure by printing "*FAILED*" and location to stdout
- * Similar to `H5_FAILED(); AT();` from h5test.h
- *
- * *FAILED* at somefile.c:12 in function_name()...
- *
- *----------------------------------------------------------------------------
- */
-#define JSFAILED_AT() \
- { \
- printf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, __func__); \
- }
-
-/*----------------------------------------------------------------------------
- *
- * Macro: FAIL_IF()
- *
- * Purpose:
- *
- * Make tests more accessible and less cluttered than
- * `if (thing == otherthing()) TEST_ERROR`
- * paradigm.
- *
- * The following lines are roughly equivalent:
- *
- * `if (myfunc() < 0) TEST_ERROR;` (as seen elsewhere in HDF tests)
- * `FAIL_IF(myfunc() < 0)`
- *
- * Prints a generic "FAILED AT" line to stdout and jumps to `error`,
- * similar to `TEST_ERROR` in h5test.h
- *
- *----------------------------------------------------------------------------
- */
-#define FAIL_IF(condition) \
- if (condition) { \
- JSFAILED_AT() \
- goto error; \
- }
-
-/*----------------------------------------------------------------------------
- *
- * Macro: FAIL_UNLESS()
- *
- * Purpose:
- *
- * 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() )`
- * is equivalent to
- * `FAIL_UNLESS( 5 == my_op() )`
- * However, `JSVERIFY(5, my_op(), "bad return")` may be even clearer.
- * (see JSVERIFY)
- *
- *----------------------------------------------------------------------------
- */
-#if 0 /* UNUSED */
-#define FAIL_UNLESS(condition) \
- if (!(condition)) { \
- JSFAILED_AT() \
- goto error; \
- }
-#endif
-
-/*----------------------------------------------------------------------------
- *
- * Macro: JSERR_LONG()
- *
- * Purpose:
- *
- * Print an failure message for long-int arguments.
- * ERROR-AT printed first.
- * If `reason` is given, it is printed on own line and newlined after
- * else, prints "expected/actual" aligned on own lines.
- *
- * *FAILED* at myfile.c:488 in somefunc()...
- * forest must be made of trees.
- *
- * or
- *
- * *FAILED* at myfile.c:488 in somefunc()...
- * ! Expected 425
- * ! Actual 3
- *
- *----------------------------------------------------------------------------
- */
-static inline void
-jserr_long(long expected, long actual, const char *reason)
-{
- if (reason != NULL) {
- printf("%s\n", reason);
- }
- else {
- printf(" ! Expected %ld\n ! Actual %ld\n", expected, actual);
- }
-}
-
-#define JSERR_LONG(expected, actual, reason) \
- { \
- JSFAILED_AT() \
- jserr_long((long)(expected), (long)(actual), (reason)); \
- }
-
-/*----------------------------------------------------------------------------
- *
- * Macro: JSERR_STR()
- *
- * Purpose:
- *
- * Print an failure message for string arguments.
- * ERROR-AT printed first.
- * If `reason` is given, it is printed on own line and newlined after
- * else, prints "expected/actual" aligned on own lines.
- *
- * *FAILED* at myfile.c:421 in myfunc()...
- * Blue and Red strings don't match!
- *
- * or
- *
- * *FAILED* at myfile.c:421 in myfunc()...
- * !!! Expected:
- * this is my expected
- * string
- * !!! Actual:
- * not what I expected at all
- *
- *----------------------------------------------------------------------------
- */
-static inline void
-jserr_str(const char *expected, const char *actual, const char *reason)
-{
- if (reason != NULL) {
- printf("%s\n", reason);
- }
- else {
- printf("!!! Expected:\n%s\n!!!Actual:\n%s\n", expected, actual);
- }
-}
-
-#define JSERR_STR(expected, actual, reason) \
- { \
- JSFAILED_AT() \
- jserr_str((expected), (actual), (reason)); \
- }
-
-#ifdef JSVERIFY_EXP_ACT
-
-/*----------------------------------------------------------------------------
- *
- * Macro: JSVERIFY()
- *
- * Purpose:
- *
- * Verify that two long integers are equal.
- * If unequal, print failure message
- * (with `reason`, if not NULL; expected/actual if NULL)
- * and jump to `error` at end of function
- *
- *----------------------------------------------------------------------------
- */
-#define JSVERIFY(expected, actual, reason) \
- if ((long)(actual) != (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)) \
- goto error; \
- } /* JSVERIFY */
-
-/*----------------------------------------------------------------------------
- *
- * Macro: JSVERIFY_NOT()
- *
- * Purpose:
- *
- * Verify that two long integers are _not_ equal.
- * If equal, print failure message
- * (with `reason`, if not NULL; expected/actual if NULL)
- * and jump to `error` at end of function
- *
- *----------------------------------------------------------------------------
- */
-#define JSVERIFY_NOT(expected, actual, reason) \
- if ((long)(actual) == (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)) \
- goto error; \
- } /* JSVERIFY_NOT */
-
-/*----------------------------------------------------------------------------
- *
- * Macro: JSVERIFY_STR()
- *
- * Purpose:
- *
- * Verify that two strings are equal.
- * If unequal, print failure message
- * (with `reason`, if not NULL; expected/actual if NULL)
- * and jump to `error` at end of function
- *
- *----------------------------------------------------------------------------
- */
-#define JSVERIFY_STR(expected, actual, reason) \
- if (strcmp((actual), (expected)) != 0) { \
- JSERR_STR((expected), (actual), (reason)); \
- goto error; \
- } /* JSVERIFY_STR */
-
-#else
-/* JSVERIFY_EXP_ACT not defined
- *
- * Repeats macros above, but with actual/expected parameters reversed.
- */
-
-/*----------------------------------------------------------------------------
- * Macro: JSVERIFY()
- * See: JSVERIFY documentation above.
- *----------------------------------------------------------------------------
- */
-#define JSVERIFY(actual, expected, reason) \
- if ((long)(actual) != (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)); \
- goto error; \
- } /* JSVERIFY */
-
-/*----------------------------------------------------------------------------
- * Macro: JSVERIFY_NOT()
- * See: JSVERIFY_NOT documentation above.
- *----------------------------------------------------------------------------
- */
-#define JSVERIFY_NOT(actual, expected, reason) \
- if ((long)(actual) == (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)) \
- goto error; \
- } /* JSVERIFY_NOT */
-
-/*----------------------------------------------------------------------------
- * Macro: JSVERIFY_STR()
- * See: JSVERIFY_STR documentation above.
- *----------------------------------------------------------------------------
- */
-#define JSVERIFY_STR(actual, expected, reason) \
- if (strcmp((actual), (expected)) != 0) { \
- JSERR_STR((expected), (actual), (reason)); \
- goto error; \
- } /* JSVERIFY_STR */
-
-#endif /* ifdef/else JSVERIFY_EXP_ACT */
-
-/********************************
- * OTHER MACROS AND DEFINITIONS *
- ********************************/
-
#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1)
#define S3_TEST_PROFILE_NAME "ros3_vfd_test"
@@ -375,52 +66,25 @@ H5FD_ros3_fapl_t restricted_access_fa = {H5FD_CURR_ROS3_FAPL_T_VERSION, /* fapl
H5FD_ros3_fapl_t anonymous_fa = {H5FD_CURR_ROS3_FAPL_T_VERSION, false, "", "", ""};
/*---------------------------------------------------------------------------
+ * Function: test_fapl_config_validation
*
- * Function: test_fapl_config_validation()
- *
- * Purpose:
- *
- * Test data consistency of fapl configuration.
- * Tests `H5FD_ros3_validate_config` indirectly through `H5Pset_fapl_ros3`.
- *
- * Return:
- *
- * PASSED : 0
- * FAILED : 1
+ * Purpose: Test ros3 fapl configurations and H5Pset/get_fapl_ros3()
*
+ * Return: PASS : 0
+ * FAIL : 1
*---------------------------------------------------------------------------
*/
static int
test_fapl_config_validation(void)
{
-
- /*********************
- * test-local macros *
- *********************/
-
- /*************************
- * test-local structures *
- *************************/
-
struct testcase {
const char *msg;
herr_t expected;
H5FD_ros3_fapl_t config;
};
- /************************
- * test-local variables *
- ************************/
-
- hid_t fapl_id = H5I_INVALID_HID; /* file access property list ID */
- H5FD_ros3_fapl_t config;
- H5FD_ros3_fapl_t fa_fetch;
- herr_t success = SUCCEED;
- unsigned int i = 0;
- unsigned int ncases = 8; /* should equal number of cases */
- struct testcase *case_ptr = NULL; /* dumb work-around for possible */
- /* dynamic cases creation because */
- /* of compiler warnings Wlarger-than */
+ hid_t fapl_id = H5I_INVALID_HID;
+ const int NCASES = 8; /* Should equal number of cases */
struct testcase cases_arr[] = {
{
"non-authenticating config allows empties.\n",
@@ -513,11 +177,7 @@ test_fapl_config_validation(void)
},
};
- TESTING("ROS3 fapl configuration validation");
-
- /*********
- * TESTS *
- *********/
+ TESTING("ros3 fapl configuration validation");
if (false == s3_test_bucket_defined) {
SKIPPED();
@@ -526,78 +186,67 @@ test_fapl_config_validation(void)
return 0;
}
- for (i = 0; i < ncases; i++) {
+ for (int i = 0; i < NCASES; i++) {
+
+ struct testcase *case_ptr = &cases_arr[i]; /* Alias */
+ herr_t ret;
+
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
- /*---------------
- * per-test setup
- *---------------
- */
- case_ptr = &cases_arr[i];
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF(fapl_id < 0) /* sanity-check */
-
- /*-----------------------------------
- * Actually test.
- * Mute stack trace in failure cases.
- *-----------------------------------
- */
H5E_BEGIN_TRY
{
- /* `H5FD_ros3_validate_config(...)` is static/private
- * to src/ros3.c and cannot (and should not?) be tested directly?
- * Instead, validate config through public api.
- */
- success = H5Pset_fapl_ros3(fapl_id, &case_ptr->config);
+ ret = H5Pset_fapl_ros3(fapl_id, &case_ptr->config);
}
H5E_END_TRY
- JSVERIFY(case_ptr->expected, success, case_ptr->msg)
+ if (ret != case_ptr->expected)
+ FAIL_PUTS_ERROR(case_ptr->msg);
- /* Make sure we can get back what we put in.
- * Only valid if the fapl configuration does not result in error.
+ /* If H5Pset_fapl_ros3() succeeded, make sure H5Pget_fapl_ros3()
+ * returns what we put in.
*/
- if (success == SUCCEED) {
- config = case_ptr->config;
- JSVERIFY(SUCCEED, H5Pget_fapl_ros3(fapl_id, &fa_fetch), "unable to get fapl")
-
- JSVERIFY(H5FD_CURR_ROS3_FAPL_T_VERSION, fa_fetch.version, "invalid version number")
- JSVERIFY(config.version, fa_fetch.version, "version number mismatch")
- JSVERIFY(config.authenticate, fa_fetch.authenticate, "authentication flag mismatch")
- JSVERIFY_STR(config.aws_region, fa_fetch.aws_region, NULL)
- JSVERIFY_STR(config.secret_id, fa_fetch.secret_id, NULL)
- JSVERIFY_STR(config.secret_key, fa_fetch.secret_key, NULL)
+ if (ret == SUCCEED) {
+ H5FD_ros3_fapl_t config = case_ptr->config; /* Alias for this config */
+ H5FD_ros3_fapl_t conf_out; /* Config from fapl */
+
+ /* Get the config from the fapl */
+ if (H5Pget_fapl_ros3(fapl_id, &conf_out) < 0)
+ TEST_ERROR;
+
+ /* Make sure all fields match */
+ if (H5FD_CURR_ROS3_FAPL_T_VERSION != conf_out.version)
+ FAIL_PUTS_ERROR("invalid version number");
+ if (config.version != conf_out.version)
+ FAIL_PUTS_ERROR("version number mismatch");
+ if (config.authenticate != conf_out.authenticate)
+ FAIL_PUTS_ERROR("authentication flag mismatch");
+ if (strncmp(config.aws_region, conf_out.aws_region, H5FD_ROS3_MAX_REGION_LEN + 1))
+ FAIL_PUTS_ERROR("AWS region mismatch");
+ if (strncmp(config.secret_id, conf_out.secret_id, H5FD_ROS3_MAX_SECRET_ID_LEN + 1))
+ FAIL_PUTS_ERROR("secret ID mismatch");
+ if (strncmp(config.secret_key, conf_out.secret_key, H5FD_ROS3_MAX_SECRET_KEY_LEN + 1))
+ FAIL_PUTS_ERROR("secret key mismatch");
}
- /*-----------------------------
- * per-test sanitation/teardown
- *-----------------------------
- */
- FAIL_IF(FAIL == H5Pclose(fapl_id))
- fapl_id = -1;
-
- } /* for each test case */
+ if (H5Pclose(fapl_id) < 0)
+ TEST_ERROR;
+ }
PASSED();
return 0;
error:
- /***********
- * CLEANUP *
- ***********/
-
- if (fapl_id < 0) {
- H5E_BEGIN_TRY
- {
- (void)H5Pclose(fapl_id);
- }
- H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(fapl_id);
}
+ H5E_END_TRY
return 1;
-} /* test_fapl_config_validation */
+} /* end test_fapl_config_validation() */
/*-------------------------------------------------------------------------
- *
- * Function: test_ros3_fapl()
+ * Function: test_ros3_fapl
*
* Purpose: Tests the file handle interface for the ROS3 driver
*
@@ -608,18 +257,13 @@ test_fapl_config_validation(void)
* For now, test only fapl & flags. Extend as the
* work on the VFD continues.
*
- * Return: Success: 0
- * Failure: 1
- *
+ * Return: PASS : 0
+ * FAIL : 1
*-------------------------------------------------------------------------
*/
static int
-test_ros3_fapl(void)
+test_ros3_fapl_driver_flags(void)
{
- /************************
- * test-local variables *
- ************************/
-
hid_t fapl_id = H5I_INVALID_HID; /* file access property list ID */
hid_t driver_id = H5I_INVALID_HID; /* ID for this VFD */
unsigned long driver_flags = 0; /* VFD feature flags */
@@ -631,30 +275,24 @@ test_ros3_fapl(void)
"plugh", /* secret_key */
};
- TESTING("ROS3 fapl ");
-
- /* Set property list and file name for ROS3 driver.
- */
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF(fapl_id < 0)
+ TESTING("ros3 driver flags");
- FAIL_IF(FAIL == H5Pset_fapl_ros3(fapl_id, &ros3_fa_0))
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+ if (H5Pset_fapl_ros3(fapl_id, &ros3_fa_0) < 0)
+ TEST_ERROR;
+ if ((driver_id = H5Pget_driver(fapl_id)) < 0)
+ TEST_ERROR;
- driver_id = H5Pget_driver(fapl_id);
- FAIL_IF(driver_id < 0)
+ /* Get VFD flags */
+ if (H5FDdriver_query(driver_id, &driver_flags) < 0)
+ TEST_ERROR;
- /****************
- * Check that the VFD feature flags are correct
- * SPEC MAY CHANGE
- ******************/
-
- FAIL_IF(H5FDdriver_query(driver_id, &driver_flags) < 0)
-
- JSVERIFY_NOT(0, (driver_flags & H5FD_FEAT_DATA_SIEVE),
- "bit(s) in `driver_flags` must align with "
- "H5FD_FEAT_DATA_SIEVE")
-
- JSVERIFY(H5FD_FEAT_DATA_SIEVE, driver_flags, "H5FD_FEAT_DATA_SIEVE should be the only supported flag")
+ /* Validate flags */
+ if (0 == (driver_flags & H5FD_FEAT_DATA_SIEVE))
+ FAIL_PUTS_ERROR("ros3 VFD should support H5FD_FEAT_DATA_SIEVE");
+ if (H5FD_FEAT_DATA_SIEVE != driver_flags)
+ FAIL_PUTS_ERROR("H5FD_FEAT_DATA_SIEVE should be the only supported flag");
PASSED();
return 0;
@@ -662,275 +300,189 @@ test_ros3_fapl(void)
error:
H5E_BEGIN_TRY
{
- (void)H5Pclose(fapl_id);
+ H5Pclose(fapl_id);
}
H5E_END_TRY
return 1;
-} /* test_ros3_fapl() */
+} /* end test_ros3_fapl() */
/*---------------------------------------------------------------------------
+ * Function: test_vfl_open
*
- * Function: test_vfd_open()
- *
- * Purpose:
- *
- * Demonstrate/specify VFD-level "Open" failure cases
- *
- * Return:
- *
- * PASSED : 0
- * FAILED : 1
+ * Purpose: Test the VFL "open" callback
*
+ * Return: PASS : 0
+ * FAIL : 1
*---------------------------------------------------------------------------
*/
static int
-test_vfd_open(void)
+test_vfl_open(void)
{
-
- /*********************
- * test-local macros *
- *********************/
-
-#define FAPL_H5P_DEFAULT -2
-#define FAPL_FILE_ACCESS -3
-#define FAPL_ROS3_ANON -4
-
- /*************************
- * test-local structures *
- *************************/
-
struct test_condition {
const char *message;
const char *url;
unsigned flags;
- int which_fapl;
+ hid_t fapl;
haddr_t maxaddr;
};
- /************************
- * test-local variables *
- ************************/
+ /* struct test_condition tests[] defined after fapl initialization */
+ H5FD_t *fd = NULL;
+ hid_t ros3_fapl_id = H5I_INVALID_HID;
+ hid_t default_fapl_id = H5I_INVALID_HID;
+ const int TESTS_COUNT = 10;
+
+ TESTING("ros3 VFD-level open");
+
+ if (false == s3_test_bucket_defined) {
+ SKIPPED();
+ puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined");
+ fflush(stdout);
+ return 0;
+ }
+
+ /* Set up fapls */
+ if ((default_fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+ if ((ros3_fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+ if (H5Pset_fapl_ros3(ros3_fapl_id, &anonymous_fa) < 0)
+ TEST_ERROR;
+
+ /* Set up test cases */
struct test_condition tests[] = {
{
"default property list (H5P_DEFAULT) is invalid",
url_text_public,
H5F_ACC_RDONLY,
- FAPL_H5P_DEFAULT,
+ H5P_DEFAULT,
MAXADDR,
},
{
"generic file access property list is invalid",
url_text_public,
H5F_ACC_RDONLY,
- FAPL_FILE_ACCESS,
+ default_fapl_id,
MAXADDR,
},
{
"filename cannot be null",
NULL,
H5F_ACC_RDONLY,
- FAPL_ROS3_ANON,
+ ros3_fapl_id,
MAXADDR,
},
{
"filename cannot be empty",
"",
H5F_ACC_RDONLY,
- FAPL_ROS3_ANON,
+ ros3_fapl_id,
MAXADDR,
},
{
"filename must exist",
url_missing,
H5F_ACC_RDONLY,
- FAPL_ROS3_ANON,
+ ros3_fapl_id,
MAXADDR,
},
{
"read-write flag not supported",
url_text_public,
H5F_ACC_RDWR,
- FAPL_ROS3_ANON,
+ ros3_fapl_id,
MAXADDR,
},
{
"truncate flag not supported",
url_text_public,
H5F_ACC_TRUNC,
- FAPL_ROS3_ANON,
+ ros3_fapl_id,
MAXADDR,
},
{
"create flag not supported",
url_text_public,
H5F_ACC_CREAT,
- FAPL_ROS3_ANON,
+ ros3_fapl_id,
MAXADDR,
},
{
"EXCL flag not supported",
url_text_public,
H5F_ACC_EXCL,
- FAPL_ROS3_ANON,
+ ros3_fapl_id,
MAXADDR,
},
{
"maxaddr cannot be 0 (caught in `H5FD_open()`)",
url_text_public,
H5F_ACC_RDONLY,
- FAPL_ROS3_ANON,
+ ros3_fapl_id,
0,
},
};
- H5FD_t *fd = NULL;
- bool curl_ready = false;
- hid_t fapl_id = H5I_INVALID_HID;
- hid_t fapl_file_access = H5I_INVALID_HID;
- unsigned i = 0;
- unsigned tests_count = 10;
-
- TESTING("ROS3 VFD-level open");
-
- if (false == s3_test_bucket_defined) {
- SKIPPED();
- puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined");
- fflush(stdout);
- return 0;
- }
-
- FAIL_IF(CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT))
- curl_ready = true;
-
- fapl_file_access = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF(fapl_file_access < 0)
-
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF(fapl_id < 0)
- FAIL_IF(FAIL == H5Pset_fapl_ros3(fapl_id, &anonymous_fa))
-
- /*********
- * TESTS *
- *********/
- /* all the test cases that will _not_ open
- */
- for (i = 0; i < tests_count; i++) {
- struct test_condition T = tests[i];
- hid_t _fapl_id = H5P_DEFAULT;
-
- fd = NULL;
-
- if (T.which_fapl == FAPL_FILE_ACCESS)
- _fapl_id = fapl_file_access;
- else if (T.which_fapl == FAPL_ROS3_ANON)
- _fapl_id = fapl_id;
+ /* Test a variety of cases that are expected to fail */
+ for (int i = 0; i < TESTS_COUNT; i++) {
H5E_BEGIN_TRY
{
- fd = H5FDopen(T.url, T.flags, _fapl_id, T.maxaddr);
+ fd = H5FDopen(tests[i].url, tests[i].flags, tests[i].fapl, tests[i].maxaddr);
}
H5E_END_TRY
+
if (NULL != fd)
- JSVERIFY(1, 0, T.message); /* wrapper to print message and fail */
+ FAIL_PUTS_ERROR(tests[i].message);
}
- FAIL_IF(NULL != fd)
-
- /* finally, show that a file can be opened
- */
- fd = H5FDopen(url_text_public, H5F_ACC_RDONLY, fapl_id, MAXADDR);
- FAIL_IF(NULL == fd)
-
- /************
- * TEARDOWN *
- ************/
-
- FAIL_IF(FAIL == H5FDclose(fd))
- fd = NULL;
-
- FAIL_IF(FAIL == H5Pclose(fapl_id))
- fapl_id = -1;
+ /* Finally, show that a file can be opened */
+ if (NULL == (fd = H5FDopen(url_text_public, H5F_ACC_RDONLY, ros3_fapl_id, MAXADDR)))
+ TEST_ERROR;
+ if (H5FDclose(fd) < 0)
+ TEST_ERROR;
- FAIL_IF(FAIL == H5Pclose(fapl_file_access))
- fapl_file_access = -1;
-
- curl_global_cleanup();
- curl_ready = false;
+ if (H5Pclose(default_fapl_id) < 0)
+ TEST_ERROR;
+ if (H5Pclose(ros3_fapl_id) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
- /***********
- * CLEANUP *
- ***********/
-
- if (fd) {
- (void)H5FDclose(fd);
- }
- if (fapl_id >= 0) {
- H5E_BEGIN_TRY
- {
- (void)H5Pclose(fapl_id);
- }
- H5E_END_TRY
- }
- if (fapl_file_access >= 0) {
- H5E_BEGIN_TRY
- {
- (void)H5Pclose(fapl_file_access);
- }
- H5E_END_TRY
- }
- if (curl_ready == true) {
- curl_global_cleanup();
+ H5E_BEGIN_TRY
+ {
+ H5FDclose(fd);
+ H5Pclose(default_fapl_id);
+ H5Pclose(ros3_fapl_id);
}
+ H5E_END_TRY
return 1;
-#undef FAPL_FILE_ACCESS
-#undef FAPL_H5P_DEFAULT
-#undef FAPL_ROS3_ANON
-
-} /* test_vfd_open */
+} /* end test_vfd_open() */
/*---------------------------------------------------------------------------
+ * Function: test_eof_eoa
*
- * Function: test_eof_eoa()
- *
- * Purpose:
- *
- * Demonstrate behavior of get_eof, get_eoa, and set_eoa.
- *
- * Return:
- *
- * PASSED : 0
- * FAILED : 1
+ * Purpose: Demonstrate behavior of get_eof, get_eoa, and set_eoa
*
+ * Return: PASS : 0
+ * FAIL : 1
*---------------------------------------------------------------------------
*/
static int
test_eof_eoa(void)
{
-
- /*********************
- * test-local macros *
- *********************/
-
- /*************************
- * test-local structures *
- *************************/
-
- /************************
- * test-local variables *
- ************************/
-
- H5FD_t *fd_shakespeare = NULL;
- bool curl_ready = false;
- hid_t fapl_id = H5I_INVALID_HID;
+ const haddr_t INITIAL_ADDR = 5458199; /* Fragile! */
+ const haddr_t LOWER_ADDR = INITIAL_ADDR - (1024 * 1024);
+ const haddr_t HIGHER_ADDR = INITIAL_ADDR + (1024 * 1024);
+ H5FD_t *fd = NULL;
+ hid_t fapl_id = H5I_INVALID_HID;
TESTING("ROS3 eof/eoa gets and sets");
@@ -948,198 +500,69 @@ test_eof_eoa(void)
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)
- FAIL_IF(FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa))
-
- fd_shakespeare = H5FDopen(url_text_restricted, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF);
- FAIL_IF(NULL == fd_shakespeare)
-
- /*********
- * TESTS *
- *********/
-
- /* verify as found
- */
- JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), NULL)
- JSVERIFY(H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), H5FDget_eof(fd_shakespeare, H5FD_MEM_DRAW),
- "mismatch between DEFAULT and RAW memory types")
- JSVERIFY(0, 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), "unable to set EoA (lower)")
- JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), "EoF changed")
- 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), "unable to set EoA (higher)")
- JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), "EoF changed")
- JSVERIFY(6789012, H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), "EoA unchanged")
-
- /************
- * TEARDOWN *
- ************/
-
- FAIL_IF(FAIL == H5FDclose(fd_shakespeare))
-
- FAIL_IF(FAIL == H5Pclose(fapl_id))
- fapl_id = -1;
-
- curl_global_cleanup();
- curl_ready = false;
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+ if (H5Pset_fapl_ros3(fapl_id, &restricted_access_fa) < 0)
+ TEST_ERROR;
+
+ /* Open and verify EOA and EOF in a sample file */
+ if (NULL == (fd = H5FDopen(url_text_restricted, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF)))
+ TEST_ERROR;
+ if (INITIAL_ADDR != H5FDget_eof(fd, H5FD_MEM_DEFAULT))
+ FAIL_PUTS_ERROR("incorrect EOF (fragile - make sure the file size didn't change)");
+ if (H5FDget_eof(fd, H5FD_MEM_DEFAULT) != H5FDget_eof(fd, H5FD_MEM_DRAW))
+ FAIL_PUTS_ERROR("mismatch between DEFAULT and RAW memory types");
+ if (0 != H5FDget_eoa(fd, H5FD_MEM_DEFAULT))
+ FAIL_PUTS_ERROR("EOA should be unset by H5FDopen");
+
+ /* Set EOA below EOF - should succeed w/ EOF changed and EOA unchanged */
+ if (H5FDset_eoa(fd, H5FD_MEM_DEFAULT, LOWER_ADDR) < 0)
+ TEST_ERROR;
+ if (INITIAL_ADDR != H5FDget_eof(fd, H5FD_MEM_DEFAULT))
+ FAIL_PUTS_ERROR("EOF changed when setting (lower) EOA");
+ if (LOWER_ADDR != H5FDget_eoa(fd, H5FD_MEM_DEFAULT))
+ FAIL_PUTS_ERROR("EOA unchanged when setting (lower) EOA");
+
+ /* Set EOA above EOF - should succeed w/ EOF changed and EOA unchanged */
+ if (H5FDset_eoa(fd, H5FD_MEM_DEFAULT, HIGHER_ADDR) < 0)
+ TEST_ERROR;
+ if (INITIAL_ADDR != H5FDget_eof(fd, H5FD_MEM_DEFAULT))
+ FAIL_PUTS_ERROR("EOF changed when setting (higher) EOA");
+ if (HIGHER_ADDR != H5FDget_eoa(fd, H5FD_MEM_DEFAULT))
+ FAIL_PUTS_ERROR("EOA unchanged when setting (higher) EOA");
+
+ if (H5FDclose(fd) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fapl_id) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
- /***********
- * CLEANUP *
- ***********/
-
- if (fd_shakespeare)
- (void)H5FDclose(fd_shakespeare);
- if (true == curl_ready)
- curl_global_cleanup();
- if (fapl_id >= 0) {
- H5E_BEGIN_TRY
- {
- (void)H5Pclose(fapl_id);
- }
- H5E_END_TRY
- }
-
- return 1;
-
-} /* 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
- *
- *-----------------------------------------------------------------------------
- */
-static int
-test_H5FDread_without_eoa_set_fails(void)
-{
- char buffer[256];
- unsigned int i = 0;
- H5FD_t *file_shakespeare = NULL;
- hid_t fapl_id = H5I_INVALID_HID;
-
- TESTING("ROS3 VFD read-eoa temporal coupling library limitation ");
-
- if (s3_test_credentials_loaded == 0) {
- SKIPPED();
- puts(" s3 credentials are not loaded");
- fflush(stdout);
- return 0;
- }
-
- if (false == s3_test_bucket_defined) {
- SKIPPED();
- puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined");
- fflush(stdout);
- return 0;
- }
-
- /*********
- * SETUP *
- *********/
-
- /* create ROS3 fapl
- */
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF(fapl_id < 0)
- FAIL_IF(FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa))
-
- file_shakespeare = H5FDopen(url_text_restricted, H5F_ACC_RDONLY, fapl_id, MAXADDR);
- FAIL_IF(NULL == file_shakespeare)
-
- JSVERIFY(0, H5FDget_eoa(file_shakespeare, H5FD_MEM_DEFAULT), "EoA should remain unset by H5FDopen")
-
- for (i = 0; i < 256; i++)
- buffer[i] = 0; /* zero buffer contents */
-
- /********
- * TEST *
- ********/
-
- H5E_BEGIN_TRY{/* mute stack trace on expected failure */
- JSVERIFY(FAIL, H5FDread(file_shakespeare, H5FD_MEM_DRAW, H5P_DEFAULT, 1200699, 102, buffer),
- "cannot read before eoa is set")} H5E_END_TRY
- JSVERIFY_STR("", buffer, "buffer should remain untouched")
-
- /************
- * TEARDOWN *
- ************/
-
- FAIL_IF(FAIL == H5FDclose(file_shakespeare))
- file_shakespeare = NULL;
-
- FAIL_IF(FAIL == H5Pclose(fapl_id))
- fapl_id = -1;
-
- PASSED();
- return 0;
-
-error:
- /***********
- * CLEANUP *
- ***********/
-
- if (file_shakespeare) {
- (void)H5FDclose(file_shakespeare);
- }
- if (fapl_id >= 0) {
- H5E_BEGIN_TRY
- {
- (void)H5Pclose(fapl_id);
- }
- H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ H5FDclose(fd);
+ H5Pclose(fapl_id);
}
+ H5E_END_TRY
return 1;
-} /* test_H5FDread_without_eoa_set_fails */
+} /* end test_eof_eoa() */
/*---------------------------------------------------------------------------
+ * Function: test_vfl_read
*
- * Function: test_read()
- *
- * Purpose:
- *
- * Return:
- *
- * PASSED : 0
- * FAILED : 1
+ * Purpose: Test reading via the VFL API
*
+ * Return: PASS : 0
+ * FAIL : 1
*---------------------------------------------------------------------------
*/
static int
-test_read(void)
+test_vfl_read(void)
{
-
- /*********************
- * test-local macros *
- *********************/
-
- /*************************
- * test-local structures *
- *************************/
struct testcase {
const char *message; /* purpose of test case */
haddr_t eoa_set; /* set file EOA to this prior to read */
@@ -1149,10 +572,7 @@ test_read(void)
const char *expected; /* expected contents of buffer; failure ignores */
};
- /************************
- * test-local variables *
- ************************/
- struct testcase cases[] = {
+ struct testcase tests[] = {
{
"successful range-get",
6464,
@@ -1202,16 +622,12 @@ test_read(void)
NULL,
},
};
- unsigned testcase_count = 6;
- unsigned test_i = 0;
- struct testcase test;
- herr_t open_return = FAIL;
- char buffer[S3_TEST_MAX_URL_SIZE];
- unsigned int i = 0;
- H5FD_t *file_raven = NULL;
- hid_t fapl_id = H5I_INVALID_HID;
+ const int TESTCASE_COUNT = 6;
+ char buffer[S3_TEST_MAX_URL_SIZE];
+ H5FD_t *fd = NULL;
+ hid_t fapl_id = H5I_INVALID_HID;
- TESTING("ROS3 VFD read/range-gets");
+ TESTING("ros3 VFD read/range-gets");
if (s3_test_credentials_loaded == 0) {
SKIPPED();
@@ -1227,132 +643,89 @@ test_read(void)
return 0;
}
- /*********
- * SETUP *
- *********/
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+ if (H5Pset_fapl_ros3(fapl_id, &restricted_access_fa) < 0)
+ TEST_ERROR;
- /* create ROS3 fapl
- */
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF(fapl_id < 0)
- FAIL_IF(FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa))
+ if (NULL == (fd = H5FDopen(url_text_public, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF)))
+ TEST_ERROR;
+ if (6464 != H5FDget_eof(fd, H5FD_MEM_DEFAULT))
+ FAIL_PUTS_ERROR("incorrect EOF (fragile - make sure the file size didn't change)");
- /* open file
- */
- file_raven =
- H5FDopen( /* will open with "authenticating" fapl */
- url_text_public, /* TODO: check return state: anon access of restricted says OK? (not NULL)
- */
- H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF); /* Demonstrate success with "automatic" value */
- FAIL_IF(NULL == file_raven)
+ for (int i = 0; i < TESTCASE_COUNT; i++) {
- JSVERIFY(6464, H5FDget_eof(file_raven, H5FD_MEM_DEFAULT), NULL)
+ herr_t ret = FAIL;
- /*********
- * TESTS *
- *********/
+ /* Per-test setup */
- for (test_i = 0; test_i < testcase_count; test_i++) {
+ if (S3_TEST_MAX_URL_SIZE < tests[i].len)
+ FAIL_PUTS_ERROR("buffer too small!");
+ if (H5FD_set_eoa(fd, H5FD_MEM_DEFAULT, tests[i].eoa_set) < 0)
+ TEST_ERROR;
+ memset(buffer, 0, S3_TEST_MAX_URL_SIZE);
- /* -------------- *
- * per-test setup *
- * -------------- */
-
- test = cases[test_i];
- open_return = FAIL;
-
- FAIL_IF(S3_TEST_MAX_URL_SIZE < test.len) /* buffer too small! */
-
- FAIL_IF(FAIL == H5FD_set_eoa(file_raven, H5FD_MEM_DEFAULT, test.eoa_set))
-
- for (i = 0; i < S3_TEST_MAX_URL_SIZE; i++) /* zero buffer contents */
- buffer[i] = 0;
-
- /* ------------ *
- * conduct test *
- * ------------ */
+ /* Check test config */
H5E_BEGIN_TRY
{
- open_return = H5FDread(file_raven, H5FD_MEM_DRAW, H5P_DEFAULT, test.addr, test.len, buffer);
+ ret = H5FDread(fd, H5FD_MEM_DRAW, H5P_DEFAULT, tests[i].addr, tests[i].len, buffer);
}
H5E_END_TRY
- JSVERIFY(test.success, open_return, test.message)
- if (open_return == SUCCEED)
- JSVERIFY_STR(test.expected, buffer, NULL)
-
- } /* for each testcase */
-
- /************
- * TEARDOWN *
- ************/
-
- FAIL_IF(FAIL == H5FDclose(file_raven))
- file_raven = NULL;
+ if (tests[i].success != ret)
+ FAIL_PUTS_ERROR(tests[i].message);
+ if (ret == SUCCEED)
+ if (strncmp(tests[i].expected, buffer, S3_TEST_MAX_URL_SIZE))
+ FAIL_PUTS_ERROR("expected output is not the same");
+ }
- FAIL_IF(FAIL == H5Pclose(fapl_id))
- fapl_id = -1;
+ if (H5FDclose(fd) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fapl_id) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
- /***********
- * CLEANUP *
- ***********/
-
- if (file_raven)
- (void)H5FDclose(file_raven);
- if (fapl_id >= 0) {
- H5E_BEGIN_TRY
- {
- (void)H5Pclose(fapl_id);
- }
- H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ H5FDclose(fd);
+ H5Pclose(fapl_id);
}
+ H5E_END_TRY
return 1;
-} /* test_read */
+} /* end test_vfl_read() */
-/*---------------------------------------------------------------------------
- *
- * Function: test_noops_and_autofails()
- *
- * Purpose:
- *
- * Demonstrate the unavailable and do-nothing routines unique to
- * Read-Only VFD.
- *
- * Return:
+/*-----------------------------------------------------------------------------
+ * Function: test_vfl_read_without_eoa_set_fails
*
- * PASSED : 0
- * FAILED : 1
+ * Purpose: Demonstrate a not-obvious constraint by the library, preventing
+ * file read before EOA is set
*
- *---------------------------------------------------------------------------
+ * Return: PASS : 0
+ * FAIL : 1
+ *-----------------------------------------------------------------------------
*/
static int
-test_noops_and_autofails(void)
+test_vfl_read_without_eoa_set_fails(void)
{
- /*********************
- * test-local macros *
- *********************/
-
- /*************************
- * test-local structures *
- *************************/
+ char buffer[256];
+ H5FD_t *fd = NULL;
+ hid_t fapl_id = H5I_INVALID_HID;
+ herr_t ret;
- /************************
- * test-local variables *
- ************************/
+ TESTING("ros3 VFD read-eoa temporal coupling library limitation");
- bool curl_ready = false;
- hid_t fapl_id = H5I_INVALID_HID;
- H5FD_t *file = NULL;
- const char data[36] = "The Force shall be with you, always";
-
- TESTING("ROS3 VFD always-fail and no-op routines");
+ if (s3_test_credentials_loaded == 0) {
+ SKIPPED();
+ puts(" s3 credentials are not loaded");
+ fflush(stdout);
+ return 0;
+ }
if (false == s3_test_bucket_defined) {
SKIPPED();
@@ -1361,115 +734,149 @@ test_noops_and_autofails(void)
return 0;
}
- /*********
- * SETUP *
- *********/
+ /* Set up fapl */
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+ if (H5Pset_fapl_ros3(fapl_id, &restricted_access_fa) < 0)
+ TEST_ERROR;
- FAIL_IF(CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT))
- curl_ready = true;
+ /* Open w/ VFL call */
+ if (NULL == (fd = H5FDopen(url_text_restricted, H5F_ACC_RDONLY, fapl_id, MAXADDR)))
+ TEST_ERROR;
+ if (0 != H5FDget_eoa(fd, H5FD_MEM_DEFAULT))
+ FAIL_PUTS_ERROR("EOA should remain unset by H5FDopen");
- /* create ROS3 fapl
- */
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF(fapl_id < 0)
- JSVERIFY(SUCCEED, H5Pset_fapl_ros3(fapl_id, &anonymous_fa), NULL)
+ /* Try reading without EOA set (should fail) */
+ memset(buffer, 0, 256);
+ H5E_BEGIN_TRY
+ {
+ ret = H5FDread(fd, H5FD_MEM_DRAW, H5P_DEFAULT, 1200699, 102, buffer);
+ }
+ H5E_END_TRY
+ if (ret != FAIL)
+ FAIL_PUTS_ERROR("should not be able to read before eoa is set");
+ for (int i = 0; i < 256; i++) {
+ if (buffer[i] != 0)
+ FAIL_PUTS_ERROR("buffer should remain untouched");
+ }
- /* open file
- */
- file = H5FDopen(url_text_public, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF);
- FAIL_IF(NULL == file)
+ if (H5FDclose(fd) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fapl_id) < 0)
+ TEST_ERROR;
- /*********
- * TESTS *
- *********/
+ PASSED();
+ return 0;
- /* auto-fail calls to write and truncate
- */
- H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDwrite(file, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data),
- "write must fail")} H5E_END_TRY
+error:
+ H5E_BEGIN_TRY
+ {
+ H5FDclose(fd);
+ H5Pclose(fapl_id);
+ }
+ H5E_END_TRY
- H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, false), "truncate must fail")} H5E_END_TRY
+ return 1;
- H5E_BEGIN_TRY{
- JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, true), "truncate must fail (closing)")} H5E_END_TRY
+} /* end test_vfl_read_without_eoa_set_fails() */
- /************
- * TEARDOWN *
- ************/
+/*---------------------------------------------------------------------------
+ * Function: test_noops_and_autofails
+ *
+ * Purpose: Demonstrate the unavailable and do-nothing routines unique to
+ * Read-Only VFD
+ *
+ * Return: PASS : 0
+ * FAIL : 1
+ *---------------------------------------------------------------------------
+ */
+static int
+test_noops_and_autofails(void)
+{
+ hid_t fapl_id = H5I_INVALID_HID;
+ H5FD_t *fd = NULL;
+ const char data[36] = "The Force shall be with you, always";
+ herr_t ret;
- FAIL_IF(FAIL == H5FDclose(file))
- file = NULL;
+ TESTING("ros3 VFD always-fail and no-op routines");
- FAIL_IF(FAIL == H5Pclose(fapl_id))
- fapl_id = -1;
+ if (false == s3_test_bucket_defined) {
+ SKIPPED();
+ puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined");
+ fflush(stdout);
+ return 0;
+ }
- curl_global_cleanup();
- curl_ready = false;
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+ if (H5Pset_fapl_ros3(fapl_id, &anonymous_fa) < 0)
+ TEST_ERROR;
+ if (NULL == (fd = H5FDopen(url_text_public, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF)))
+ TEST_ERROR;
+
+ /* Calls to write and truncate must fail */
+ H5E_BEGIN_TRY
+ {
+ ret = H5FDwrite(fd, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data);
+ }
+ H5E_END_TRY
+ if (ret == SUCCEED)
+ FAIL_PUTS_ERROR("write calls must fail");
+
+ H5E_BEGIN_TRY
+ {
+ ret = H5FDtruncate(fd, H5P_DEFAULT, false);
+ }
+ H5E_END_TRY
+ if (ret == SUCCEED)
+ FAIL_PUTS_ERROR("truncate calls must fail");
+
+ H5E_BEGIN_TRY
+ {
+ ret = H5FDtruncate(fd, H5P_DEFAULT, true);
+ }
+ H5E_END_TRY
+ if (ret == SUCCEED)
+ FAIL_PUTS_ERROR("truncate calls must fail (closing flag set)");
+
+ if (H5FDclose(fd) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fapl_id) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
- /***********
- * CLEANUP *
- ***********/
-
- if (fapl_id >= 0) {
- H5E_BEGIN_TRY
- {
- (void)H5Pclose(fapl_id);
- }
- H5E_END_TRY
- }
- if (file) {
- (void)H5FDclose(file);
- }
- if (curl_ready == true) {
- curl_global_cleanup();
+ H5E_BEGIN_TRY
+ {
+ H5FDclose(fd);
+ H5Pclose(fapl_id);
}
+ H5E_END_TRY
return 1;
-} /* test_noops_and_autofails*/
+} /* end test_noops_and_autofails() */
/*---------------------------------------------------------------------------
+ * Function: test_cmp
*
- * Function: test_cmp()
- *
- * Purpose:
- *
- * Verify "file comparison" behavior.
- *
- * Return:
- *
- * PASSED : 0
- * FAILED : 1
+ * Purpose: Verify file comparison behavior
*
+ * Return: PASS : 0
+ * FAIL : 1
*---------------------------------------------------------------------------
*/
static int
test_cmp(void)
{
-
- /*********************
- * 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;
- bool curl_ready = false;
hid_t fapl_id = H5I_INVALID_HID;
- TESTING("ROS3 cmp (comparison)");
+ TESTING("ros3 cmp (comparison)");
if (s3_test_credentials_loaded == 0) {
SKIPPED();
@@ -1485,112 +892,69 @@ test_cmp(void)
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_ros3(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;
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+ if (H5Pset_fapl_ros3(fapl_id, &restricted_access_fa) < 0)
+ TEST_ERROR;
+
+ /* Open files */
+ if (NULL == (fd_raven = H5FDopen(url_text_public, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF)))
+ TEST_ERROR;
+ if (NULL == (fd_shakes = H5FDopen(url_text_restricted, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF)))
+ TEST_ERROR;
+ if (NULL == (fd_raven_2 = H5FDopen(url_text_public, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF)))
+ TEST_ERROR;
+
+ /* Compare files */
+ if (0 != H5FDcmp(fd_raven, fd_raven_2))
+ FAIL_PUTS_ERROR("bad comparison (case 1)");
+ if (-1 != H5FDcmp(fd_raven, fd_shakes))
+ FAIL_PUTS_ERROR("bad comparison (case 2)");
+ if (-1 != H5FDcmp(fd_shakes, fd_raven_2))
+ FAIL_PUTS_ERROR("bad comparison (case 3)");
+
+ if (H5FDclose(fd_raven) < 0)
+ TEST_ERROR;
+ if (H5FDclose(fd_shakes) < 0)
+ TEST_ERROR;
+ if (H5FDclose(fd_raven_2) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fapl_id) < 0)
+ TEST_ERROR;
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
+ H5E_BEGIN_TRY
+ {
+ H5FDclose(fd_raven);
+ H5FDclose(fd_shakes);
+ H5FDclose(fd_raven_2);
+ H5Pclose(fapl_id);
}
+ H5E_END_TRY
return 1;
-} /* test_cmp */
+} /* end test_cmp() */
/*---------------------------------------------------------------------------
+ * Function: test_ros3_access_modes
*
- * Function: test_H5F_integration()
- *
- * Purpose:
- *
- * Demonstrate S3 file-open through H5F API.
- *
- * Return:
- *
- * PASSED : 0
- * FAILED : 1
+ * Purpose: Make sure ros3 files can only be opened read-only
*
+ * Return: PASS : 0
+ * FAIL : 1
*---------------------------------------------------------------------------
*/
static int
-test_H5F_integration(void)
+test_ros3_access_modes(void)
{
- /*********************
- * test-local macros *
- *********************/
-
- /*************************
- * test-local structures *
- *************************/
-
- /************************
- * test-local variables *
- ************************/
-
- hid_t file = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
hid_t fapl_id = H5I_INVALID_HID;
- TESTING("S3 file access through HD5F library (H5F API)");
+ TESTING("ros3 access modes");
if (s3_test_credentials_loaded == 0) {
SKIPPED();
@@ -1606,76 +970,61 @@ test_H5F_integration(void)
return 0;
}
- /*********
- * SETUP *
- *********/
-
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF(0 > fapl_id)
- FAIL_IF(FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa))
-
- /*********
- * TESTS *
- *********/
-
- /* Read-Write Open access is not allowed with this file driver.
- */
- H5E_BEGIN_TRY{FAIL_IF(0 <= H5Fopen(url_h5_public, H5F_ACC_RDWR, fapl_id))} H5E_END_TRY
-
- /* H5Fcreate() is not allowed with this file driver.
- */
- H5E_BEGIN_TRY{FAIL_IF(0 <= H5Fcreate(url_missing, H5F_ACC_RDONLY, H5P_DEFAULT, fapl_id))} H5E_END_TRY
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+ if (H5Pset_fapl_ros3(fapl_id, &restricted_access_fa) < 0)
+ TEST_ERROR;
- /* Successful open.
- */
- file = H5Fopen(url_h5_public, H5F_ACC_RDONLY, fapl_id);
- FAIL_IF(file < 0)
+ /* Read-Write Open access is not allowed with this file driver */
+ H5E_BEGIN_TRY
+ {
+ fid = H5Fopen(url_h5_public, H5F_ACC_RDWR, fapl_id);
+ }
+ H5E_END_TRY
+ if (fid != H5I_INVALID_HID)
+ FAIL_PUTS_ERROR("should not be allowed to open a file read-write with the ros3 VFD");
- /************
- * TEARDOWN *
- ************/
+ /* H5Fcreate() is not allowed with this file driver */
+ H5E_BEGIN_TRY
+ {
+ fid = H5Fcreate(url_missing, H5F_ACC_RDONLY, H5P_DEFAULT, fapl_id);
+ }
+ H5E_END_TRY
+ if (fid != H5I_INVALID_HID)
+ FAIL_PUTS_ERROR("should not be allowed to create a file with the ros3 VFD");
- FAIL_IF(FAIL == H5Fclose(file))
- file = -1;
+ /* Read-only access should succeed */
+ if ((fid = H5Fopen(url_h5_public, H5F_ACC_RDONLY, fapl_id)) < 0)
+ TEST_ERROR;
- FAIL_IF(FAIL == H5Pclose(fapl_id))
- fapl_id = -1;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fapl_id) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
- /***********
- * CLEANUP *
- ***********/
- printf("\nerror!");
- fflush(stdout);
-
- if (fapl_id >= 0) {
- H5E_BEGIN_TRY
- {
- (void)H5Pclose(fapl_id);
- }
- H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ H5Fclose(fid);
+ H5Pclose(fapl_id);
}
- if (file > 0)
- (void)H5Fclose(file);
+ H5E_END_TRY
return 1;
-} /* test_H5F_integration */
-
+} /* end test_ros3_access_modes() */
#endif /* H5_HAVE_ROS3_VFD */
/*-------------------------------------------------------------------------
- *
* Function: main
*
- * Purpose: Tests the basic features of Virtual File Drivers
- *
- * Return: Success: 0
- * Failure: 1
+ * Purpose: Tests the basic functionality of the ros3 VFD
*
+ * Return: Success: EXIT_SUCCESS
+ * Failure: EXIT_FAILURE
*-------------------------------------------------------------------------
*/
int
@@ -1692,7 +1041,7 @@ main(void)
#ifdef H5_HAVE_ROS3_VFD
/************************
- * initialize test urls *
+ * Initialize test urls *
************************/
bucket_url_env = getenv("HDF5_ROS3_TEST_BUCKET_URL");
@@ -1709,39 +1058,37 @@ main(void)
(const char *)s3_test_bucket_url,
(const char *)S3_TEST_RESOURCE_TEXT_RESTRICTED)) {
printf("* ros3 setup failed (text_restricted) ! *\n");
- return 1;
+ return EXIT_FAILURE;
}
if (S3_TEST_MAX_URL_SIZE < snprintf(url_text_public, (size_t)S3_TEST_MAX_URL_SIZE, "%s/%s",
(const char *)s3_test_bucket_url,
(const char *)S3_TEST_RESOURCE_TEXT_PUBLIC)) {
printf("* ros3 setup failed (text_public) ! *\n");
- return 1;
+ return EXIT_FAILURE;
}
if (S3_TEST_MAX_URL_SIZE < snprintf(url_h5_public, (size_t)S3_TEST_MAX_URL_SIZE, "%s/%s",
(const char *)s3_test_bucket_url,
(const char *)S3_TEST_RESOURCE_H5_PUBLIC)) {
printf("* ros3 setup failed (h5_public) ! *\n");
- return 1;
+ return EXIT_FAILURE;
}
if (S3_TEST_MAX_URL_SIZE < snprintf(url_missing, S3_TEST_MAX_URL_SIZE, "%s/%s",
(const char *)s3_test_bucket_url,
(const char *)S3_TEST_RESOURCE_MISSING)) {
printf("* ros3 setup failed (missing) ! *\n");
- return 1;
+ return EXIT_FAILURE;
}
/**************************************
- * load credentials and prepare fapls *
+ * Load credentials and prepare fapls *
**************************************/
- /* "clear" profile data strings */
+ /* Clear profile data strings */
s3_test_aws_access_key_id[0] = '\0';
s3_test_aws_secret_access_key[0] = '\0';
s3_test_aws_region[0] = '\0';
- /* attempt to load test credentials
- * if unable, certain tests will be skipped
- */
+ /* Attempt to load test credentials - if unable, certain tests will be skipped */
if (SUCCEED == H5FD_s3comms_load_aws_profile(S3_TEST_PROFILE_NAME, s3_test_aws_access_key_id,
s3_test_aws_secret_access_key, s3_test_aws_region)) {
s3_test_credentials_loaded = 1;
@@ -1753,29 +1100,37 @@ main(void)
}
/******************
- * commence tests *
+ * Commence tests *
******************/
h5_reset();
- nerrors += test_fapl_config_validation();
- nerrors += test_ros3_fapl();
- nerrors += test_vfd_open();
- nerrors += test_eof_eoa();
- nerrors += test_H5FDread_without_eoa_set_fails();
- nerrors += test_read();
- nerrors += test_noops_and_autofails();
- nerrors += test_cmp();
- nerrors += test_H5F_integration();
+ if (CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT)) {
+ printf("Unable to set up curl, can't run ros3 tests\n");
+ nerrors++;
+ }
+
+ if (nerrors == 0) {
+ nerrors += test_fapl_config_validation();
+ nerrors += test_ros3_fapl_driver_flags();
+ nerrors += test_vfl_open();
+ nerrors += test_eof_eoa();
+ nerrors += test_vfl_read();
+ nerrors += test_vfl_read_without_eoa_set_fails();
+ nerrors += test_noops_and_autofails();
+ nerrors += test_cmp();
+ nerrors += test_ros3_access_modes();
+ }
+
+ curl_global_cleanup();
if (nerrors > 0) {
printf("***** %d ros3 TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
- nerrors = 1;
+ return EXIT_FAILURE;
}
- else {
- printf("All ros3 tests passed.\n");
- }
- return nerrors; /* 0 if no errors, 1 if any errors */
+
+ printf("All ros3 tests passed.\n");
+ return EXIT_SUCCESS;
#else
@@ -1784,4 +1139,4 @@ main(void)
#endif /* H5_HAVE_ROS3_VFD */
-} /* main() */
+} /* end main() */
From a7ff043b59ef89b89b7fa86af9992024aa806bb0 Mon Sep 17 00:00:00 2001
From: Dana Robinson <43805+derobins@users.noreply.github.com>
Date: Wed, 19 Jun 2024 12:24:13 -0700
Subject: [PATCH 26/45] Removed unused code from H5FDs3comms.c (#4588)
* H5FD_s3comms_nlowercase()
* H5FD_s3comms_trim()
* H5FD_s3comms_uriencode()
---
src/H5FDs3comms.c | 199 -------------------------------
src/H5FDs3comms.h | 8 --
test/s3comms.c | 297 ----------------------------------------------
3 files changed, 504 deletions(-)
diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c
index 9b0d786dfe7..26691318e60 100644
--- a/src/H5FDs3comms.c
+++ b/src/H5FDs3comms.c
@@ -1967,51 +1967,6 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char *
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_s3comms_load_aws_profile() */
-/*----------------------------------------------------------------------------
- *
- * Function: H5FD_s3comms_nlowercase()
- *
- * Purpose:
- *
- * From string starting at `s`, write `len` characters to `dest`,
- * converting all to lowercase.
- *
- * Behavior is undefined if `s` is NULL or `len` overruns the allocated
- * space of either `s` or `dest`.
- *
- * Provided as convenience.
- *
- * Return:
- *
- * - SUCCESS: `SUCCEED`
- * - upon completion, `dest` is populated
- * - FAILURE: `FAIL`
- * - `dest == NULL`
- *
- *----------------------------------------------------------------------------
- */
-herr_t
-H5FD_s3comms_nlowercase(char *dest, const char *s, size_t len)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- if (dest == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null.");
-
- if (len > 0) {
- H5MM_memcpy(dest, s, len);
- do {
- len--;
- dest[len] = (char)tolower((int)dest[len]);
- } while (len > 0);
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_s3comms_nlowercase() */
-
/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_parse_url()
@@ -2511,158 +2466,4 @@ H5FD_s3comms_tostringtosign(char *dest, const char *req, const char *now, const
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5ros3_tostringtosign() */
-/*----------------------------------------------------------------------------
- *
- * Function: H5FD_s3comms_trim()
- *
- * Purpose:
- *
- * Remove all whitespace characters from start and end of a string `s`
- * of length `s_len`, writing trimmed string copy to `dest`.
- * Stores number of characters remaining at `n_written`.
- *
- * Destination for trimmed copy `dest` cannot be null.
- * `dest` must have adequate space allocated for trimmed copy.
- * If inadequate space, behavior is undefined, possibly resulting
- * in segfault or overwrite of other data.
- *
- * If `s` is NULL or all whitespace, `dest` is untouched and `n_written`
- * is set to 0.
- *
- * Return:
- *
- * - SUCCESS: `SUCCEED`
- * - FAILURE: `FAIL`
- * - `dest == NULL`
- *
- *----------------------------------------------------------------------------
- */
-herr_t
-H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- if (dest == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null.");
- if (s == NULL)
- s_len = 0;
-
- if (s_len > 0) {
- /* Find first non-whitespace character from start;
- * reduce total length per character.
- */
- while (s_len > 0 && isspace((unsigned char)s[0])) {
- s++;
- s_len--;
- }
-
- /* Find first non-whitespace character from tail;
- * reduce length per-character.
- * If length is 0 already, there is no non-whitespace character.
- */
- if (s_len > 0) {
- do {
- s_len--;
- } while (isspace((unsigned char)s[s_len]));
- s_len++;
-
- /* write output into dest */
- H5MM_memcpy(dest, s, s_len);
- }
- }
-
- *n_written = s_len;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_s3comms_trim() */
-
-/*----------------------------------------------------------------------------
- *
- * Function: H5FD_s3comms_uriencode()
- *
- * Purpose:
- *
- * URIencode (percent-encode) every byte except "[a-zA-Z0-9]-._~".
- *
- * For each character in source string `_s` from `s[0]` to `s[s_len-1]`,
- * writes to `dest` either the raw character or its percent-encoded
- * equivalent.
- *
- * See `H5FD_s3comms_bytes_to_hex` for information on percent-encoding.
- *
- * Space (' ') character encoded as "%20" (not "+")
- *
- * Forward-slash ('/') encoded as "%2F" only when `encode_slash == true`.
- *
- * Records number of characters written at `n_written`.
- *
- * Assumes that `dest` has been allocated with enough space.
- *
- * Neither `dest` nor `s` can be NULL.
- *
- * `s_len == 0` will have no effect.
- *
- * Return:
- *
- * - SUCCESS: `SUCCEED`
- * - FAILURE: `FAIL`
- * - source strings `s` or destination `dest` are NULL
- * - error while attempting to percent-encode a character
- *
- *----------------------------------------------------------------------------
- */
-herr_t
-H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, bool encode_slash, size_t *n_written)
-{
- char c = 0;
- size_t dest_off = 0;
- char hex_buffer[13];
- size_t hex_off = 0;
- size_t hex_len = 0;
- herr_t ret_value = SUCCEED;
- size_t s_off = 0;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- if (s == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source string cannot be 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.
- * e.g., '$' -> "%24"
- */
- for (s_off = 0; s_off < s_len; s_off++) {
- c = s[s_off];
- if (isalnum(c) || c == '.' || c == '-' || c == '_' || c == '~' || (c == '/' && encode_slash == false))
- dest[dest_off++] = c;
- else {
- hex_off = 0;
- if (H5FD_s3comms_percent_encode_char(hex_buffer, (const unsigned char)c, &hex_len) == FAIL) {
- hex_buffer[0] = c;
- hex_buffer[1] = 0;
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "unable to percent-encode character \'%s\' "
- "at %d in \"%s\"",
- hex_buffer, (int)s_off, s);
- }
-
- 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, "buffer overflow");
-
- *n_written = dest_off;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FD_s3comms_uriencode */
-
#endif /* H5_HAVE_ROS3_VFD */
diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h
index 120a71a9c85..d523928efc6 100644
--- a/src/H5FDs3comms.h
+++ b/src/H5FDs3comms.h
@@ -533,8 +533,6 @@ H5_DLL herr_t H5FD_s3comms_HMAC_SHA256(const unsigned char *key, size_t key_len,
H5_DLL herr_t H5FD_s3comms_load_aws_profile(const char *name, char *key_id_out, char *secret_access_key_out,
char *aws_region_out);
-H5_DLL herr_t H5FD_s3comms_nlowercase(char *dest, const char *s, size_t len);
-
H5_DLL herr_t H5FD_s3comms_parse_url(const char *str, parsed_url_t **purl);
H5_DLL herr_t H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr_len);
@@ -544,12 +542,6 @@ H5_DLL herr_t H5FD_s3comms_signing_key(unsigned char *md, const char *secret, co
H5_DLL herr_t H5FD_s3comms_tostringtosign(char *dest, const char *req_str, const char *now,
const char *region);
-
-H5_DLL herr_t H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written);
-
-H5_DLL herr_t H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, bool encode_slash,
- size_t *n_written);
-
#ifdef __cplusplus
}
#endif
diff --git a/test/s3comms.c b/test/s3comms.c
index 40f163e8ef2..e08da8e99b1 100644
--- a/test/s3comms.c
+++ b/test/s3comms.c
@@ -1255,80 +1255,6 @@ test_HMAC_SHA256(void)
} /* end test_HMAC_SHA256() */
-/*----------------------------------------------------------------------------
- *
- * Function: test_nlowercase()
- *
- * Purpose:
- *
- * Define and verify behavior of `H5FD_s3comms_nlowercase()`
- *
- *----------------------------------------------------------------------------
- */
-static herr_t
-test_nlowercase(void)
-{
- /*************************
- * test-local structures *
- *************************/
-
- struct testcase {
- const char *in;
- size_t len;
- const char *exp;
- };
-
- /************************
- * test-local variables *
- ************************/
-
- /* any character after in exp on or after exp[len] is undefined.
- * in this test, kept as the null character for simplicity.
- */
- struct testcase cases[] = {
- {
- "HALlEluJAh",
- 6,
- "hallel",
- },
- {
- "all\0 lower",
- 10,
- "all\0 lower",
- },
- {
- "to meeeeeee",
- 0,
- "",
- },
- };
- char *dest = NULL;
- int i = 0;
- int n_cases = 3;
-
- TESTING("nlowercase");
-
- for (i = 0; i < n_cases; i++) {
- dest = (char *)malloc(sizeof(char) * 16);
-
- JSVERIFY(SUCCEED, H5FD_s3comms_nlowercase(dest, cases[i].in, cases[i].len), cases[i].in)
- if (cases[i].len > 0) {
- JSVERIFY(0, strncmp(dest, cases[i].exp, cases[i].len), NULL)
- }
- free(dest);
- } /* end for each testcase */
-
- JSVERIFY(FAIL, H5FD_s3comms_nlowercase(NULL, cases[0].in, cases[0].len), "null destination should fail")
-
- PASSED();
- return 0;
-
-error:
- free(dest);
- return -1;
-
-} /* end test_nlowercase() */
-
/*---------------------------------------------------------------------------
*
* Function: test_parse_url()
@@ -2252,226 +2178,6 @@ test_tostringtosign(void)
} /* end test_tostringtosign() */
-/*----------------------------------------------------------------------------
- *
- * Function: test_trim()
- *
- * Purpose:
- *
- * Define and verify behavior of `H5FD_s3comms_trim()`.
- *
- *----------------------------------------------------------------------------
- */
-static herr_t
-test_trim(void)
-{
- /*************************
- * test-local structures *
- *************************/
-
- struct testcase {
- const char *in;
- size_t in_len;
- const char *exp;
- size_t exp_len;
- };
-
- /************************
- * test-local variables *
- ************************/
-
- struct testcase cases[] = {
- {
- "block string",
- 12,
- "block string",
- 12,
- },
- {
- " \n\r \t",
- 6,
- "",
- 0,
- },
- {
- " \twhite b4",
- 10,
- "white b4",
- 8,
- },
- {
- "white after\r\n ",
- 15,
- "white after",
- 11,
- },
- {
- " on\nends\t",
- 9,
- "on\nends",
- 7,
- },
- };
- char dest[32];
- size_t dest_len = 0;
- int i = 0;
- int n_cases = 5;
- char *str = NULL;
-
- TESTING("s3comms trim");
-
- for (i = 0; i < n_cases; i++) {
- assert(str == NULL);
- str = (char *)malloc(sizeof(char) * cases[i].in_len);
- assert(str != NULL);
- strncpy(str, cases[i].in, cases[i].in_len);
-
- JSVERIFY(SUCCEED, H5FD_s3comms_trim(dest, str, cases[i].in_len, &dest_len), NULL)
- JSVERIFY(cases[i].exp_len, dest_len, cases[i].in)
- if (dest_len > 0) {
- JSVERIFY(0, strncmp(cases[i].exp, dest, dest_len), cases[i].exp)
- }
- 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");
- JSVERIFY(0, dest_len, "trimming NULL string writes 0 characters")
-
- assert(str == NULL);
- str = (char *)malloc(sizeof(char *) * 11);
- assert(str != NULL);
- memcpy(str, "some text ", 11); /* string with null terminator */
- JSVERIFY(FAIL, H5FD_s3comms_trim(NULL, str, 10, &dest_len), "destination for trim cannot be NULL");
- free(str);
- str = NULL;
-
- PASSED();
- return 0;
-
-error:
- if (str != NULL) {
- free(str);
- }
- return -1;
-
-} /* end test_trim() */
-
-/*----------------------------------------------------------------------------
- *
- * Function: test_uriencode()
- *
- * Purpose:
- *
- * Define and verify behavior of `H5FD_s3comms_uriencode()`.
- *
- *----------------------------------------------------------------------------
- */
-static herr_t
-test_uriencode(void)
-{
- /*************************
- * test-local structures *
- *************************/
-
- struct testcase {
- const char *str;
- size_t s_len;
- bool encode_slash;
- const char *expected;
- };
-
- /************************
- * test-local variables *
- ************************/
-
- struct testcase cases[] = {{
- "/path/to/resource.jpg",
- 21,
- false,
- "/path/to/resource.jpg",
- },
- {
- "/path/to/resource.jpg",
- 21,
- true,
- "%2Fpath%2Fto%2Fresource.jpg",
- },
- {
- "string got_spaa ces",
- 20,
- true,
- "string%20got_spaa%20%20ces",
- },
- {
- "sp ac~es/and-sl ash.encoded",
- 27,
- true,
- "sp%20ac~es%2Fand-sl%20ash.encoded",
- },
- {
- "sp ac~es/and-sl ash.unencoded",
- 29,
- false,
- "sp%20ac~es/and-sl%20ash.unencoded",
- },
- {
- "/path/to/resource.txt",
- 0,
- false,
- "",
-
- }};
- char *dest = NULL;
- size_t dest_written = 0;
- int i = 0;
- int ncases = 6;
- size_t str_len = 0;
-
- TESTING("s3comms uriencode");
-
- for (i = 0; i < ncases; i++) {
- str_len = cases[i].s_len;
- dest = (char *)malloc(sizeof(char) * str_len * 3 + 1);
- FAIL_IF(dest == NULL)
-
- JSVERIFY(SUCCEED,
- H5FD_s3comms_uriencode(dest, cases[i].str, str_len, cases[i].encode_slash, &dest_written),
- NULL);
- JSVERIFY(strlen(cases[i].expected), dest_written, NULL)
- JSVERIFY(0, strncmp(dest, cases[i].expected, dest_written), cases[i].expected);
-
- free(dest);
- dest = NULL;
- } /* end for each testcase */
-
- /***************
- * ERROR CASES *
- ***************/
-
- dest = (char *)malloc(sizeof(char) * 15);
- assert(dest != NULL);
-
- JSVERIFY(FAIL, H5FD_s3comms_uriencode(NULL, "word$", 5, false, &dest_written),
- "destination cannot be NULL");
- JSVERIFY(FAIL, H5FD_s3comms_uriencode(dest, NULL, 5, false, &dest_written),
- "source string cannot be NULL");
-
- free(dest);
- dest = NULL;
-
- PASSED();
- return 0;
-
-error:
- if (dest != NULL) {
- free(dest);
- }
- return -1;
-
-} /* end test_uriencode() */
-
#endif /* H5_HAVE_ROS3_VFD */
/*-------------------------------------------------------------------------
@@ -2532,9 +2238,6 @@ main(void)
/* tests ordered roughly by dependence */
nerrors += test_macro_format_credential() < 0 ? 1 : 0;
- nerrors += test_trim() < 0 ? 1 : 0;
- nerrors += test_nlowercase() < 0 ? 1 : 0;
- nerrors += test_uriencode() < 0 ? 1 : 0;
nerrors += test_percent_encode_char() < 0 ? 1 : 0;
nerrors += test_bytes_to_hex() < 0 ? 1 : 0;
nerrors += test_HMAC_SHA256() < 0 ? 1 : 0;
From 9319f8daaf253faeda510b3fd0b7a2067a47e45d Mon Sep 17 00:00:00 2001
From: Dana Robinson <43805+derobins@users.noreply.github.com>
Date: Wed, 19 Jun 2024 13:03:10 -0700
Subject: [PATCH 27/45] Remove magic fields from s3comms structs (#4589)
---
src/H5FDs3comms.c | 76 ++++++-----------------------------------------
src/H5FDs3comms.h | 57 +++++++----------------------------
test/s3comms.c | 1 -
3 files changed, 20 insertions(+), 114 deletions(-)
diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c
index 26691318e60..d0577fa5e78 100644
--- a/src/H5FDs3comms.c
+++ b/src/H5FDs3comms.c
@@ -73,11 +73,9 @@
* pointer to data region and record of bytes written (offset)
*/
struct s3r_datastruct {
- unsigned long magic;
- char *data;
- size_t size;
+ char *data;
+ size_t size;
};
-#define S3COMMS_CALLBACK_DATASTRUCT_MAGIC 0x28c2b2ul
/********************/
/* Local Prototypes */
@@ -130,9 +128,6 @@ curlwritecallback(char *ptr, size_t size, size_t nmemb, void *userdata)
size_t product = (size * nmemb);
size_t written = 0;
- if (sds->magic != S3COMMS_CALLBACK_DATASTRUCT_MAGIC)
- return written;
-
if (size > 0) {
H5MM_memcpy(&(sds->data[sds->size]), ptr, product);
sds->size += product;
@@ -259,7 +254,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
if (new_node == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for new set.");
- new_node->magic = S3COMMS_HRB_NODE_MAGIC;
new_node->name = NULL;
new_node->value = NULL;
new_node->cat = NULL;
@@ -292,7 +286,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
/* sanity-check pointer passed in
*/
assert((*L) != NULL);
- assert((*L)->magic == S3COMMS_HRB_NODE_MAGIC);
node_ptr = (*L);
/* Check whether to modify/remove first node in list
@@ -312,8 +305,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
H5MM_xfree(node_ptr->lowername);
H5MM_xfree(node_ptr->name);
H5MM_xfree(node_ptr->value);
- assert(node_ptr->magic == S3COMMS_HRB_NODE_MAGIC);
- node_ptr->magic += 1ul;
H5MM_xfree(node_ptr);
H5MM_xfree(lowername);
@@ -334,7 +325,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
H5MM_xfree(lowername);
lowername = NULL;
- new_node->magic += 1ul;
H5MM_xfree(new_node);
new_node = NULL;
}
@@ -420,8 +410,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
H5MM_xfree(tmp->name);
H5MM_xfree(tmp->value);
- assert(tmp->magic == S3COMMS_HRB_NODE_MAGIC);
- tmp->magic += 1ul;
H5MM_xfree(tmp);
H5MM_xfree(lowername);
@@ -437,8 +425,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
H5MM_xfree(node_ptr->value);
H5MM_xfree(node_ptr->cat);
- assert(new_node->magic == S3COMMS_HRB_NODE_MAGIC);
- new_node->magic += 1ul;
H5MM_xfree(new_node);
H5MM_xfree(lowername);
new_node = NULL;
@@ -470,8 +456,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
if (valuecpy != NULL)
H5MM_xfree(valuecpy);
if (new_node != NULL) {
- assert(new_node->magic == S3COMMS_HRB_NODE_MAGIC);
- new_node->magic += 1ul;
H5MM_xfree(new_node);
}
}
@@ -502,14 +486,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
* - Destroy node/list separately as appropriate
* - Failure to account for this will result in a memory leak.
*
- * Return:
- *
- * - SUCCESS: `SUCCEED`
- * - successfully released buffer resources
- * - if `buf` is NULL or `*buf` is NULL, no effect
- * - FAILURE: `FAIL`
- * - `buf->magic != S3COMMS_HRB_MAGIC`
- *
+ * Return: SUCCEED (can't fail)
*----------------------------------------------------------------------------
*/
herr_t
@@ -518,22 +495,18 @@ H5FD_s3comms_hrb_destroy(hrb_t **_buf)
hrb_t *buf = NULL;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
if (_buf != NULL && *_buf != NULL) {
buf = *_buf;
- if (buf->magic != S3COMMS_HRB_MAGIC)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "pointer's magic does not match.");
H5MM_xfree(buf->verb);
H5MM_xfree(buf->version);
H5MM_xfree(buf->resource);
- buf->magic += 1ul;
H5MM_xfree(buf);
*_buf = NULL;
- } /* end if `_buf` has some value */
+ }
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_s3comms_hrb_destroy() */
@@ -590,7 +563,6 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch
request = (hrb_t *)H5MM_malloc(sizeof(hrb_t));
if (request == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for request structure");
- request->magic = S3COMMS_HRB_MAGIC;
request->body = NULL;
request->body_len = 0;
request->first_header = NULL;
@@ -661,13 +633,7 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch
* Close communications through given S3 Request Handle (`s3r_t`)
* and clean up associated resources.
*
- * Return:
- *
- * - SUCCESS: `SUCCEED`
- * - FAILURE: `FAIL`
- * - fails if handle is null or has invalid magic number
- *
- *
+ * Return: SUCCEED/FAIL
*----------------------------------------------------------------------------
*/
herr_t
@@ -679,8 +645,6 @@ H5FD_s3comms_s3r_close(s3r_t *handle)
if (handle == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null.");
- if (handle->magic != S3COMMS_S3R_MAGIC)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic.");
curl_easy_cleanup(handle->curlhandle);
@@ -768,7 +732,7 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle)
CURL *curlh = NULL;
char *end = NULL;
char *headerresponse = NULL;
- struct s3r_datastruct sds = {S3COMMS_CALLBACK_DATASTRUCT_MAGIC, NULL, 0};
+ struct s3r_datastruct sds = {NULL, 0};
char *start = NULL;
herr_t ret_value = SUCCEED;
@@ -776,8 +740,6 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle)
if (handle == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null.");
- if (handle->magic != S3COMMS_S3R_MAGIC)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic.");
if (handle->curlhandle == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) curlhandle.");
@@ -860,7 +822,6 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle)
done:
H5MM_xfree(headerresponse);
- sds.magic += 1; /* set to bad magic */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FD_s3comms_s3r_getsize */
@@ -921,13 +882,11 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const
HGOTO_ERROR(H5E_ARGS, H5E_CANTCREATE, NULL, "unable to create parsed url structure");
assert(purl != NULL); /* if above passes, this must be true */
- assert(purl->magic == S3COMMS_PARSED_URL_MAGIC);
handle = (s3r_t *)H5MM_malloc(sizeof(s3r_t));
if (handle == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "could not malloc space for handle.");
- handle->magic = S3COMMS_S3R_MAGIC;
handle->purl = purl;
handle->filesize = 0;
handle->region = NULL;
@@ -1113,13 +1072,10 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
if (handle == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null.");
- if (handle->magic != S3COMMS_S3R_MAGIC)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic.");
if (handle->curlhandle == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) curlhandle.");
if (handle->purl == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) url.");
- assert(handle->purl->magic == S3COMMS_PARSED_URL_MAGIC);
if (offset > handle->filesize || (len + offset) > handle->filesize)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to read past EoF");
@@ -1134,9 +1090,8 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
if (sds == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc destination datastructure.");
- sds->magic = S3COMMS_CALLBACK_DATASTRUCT_MAGIC;
- sds->data = (char *)dest;
- sds->size = 0;
+ sds->data = (char *)dest;
+ sds->size = 0;
if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_WRITEDATA, sds))
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL,
"error while setting CURL option (CURLOPT_WRITEDATA).");
@@ -1244,7 +1199,6 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
(const char *)handle->purl->path, "HTTP/1.1");
if (request == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not allocate hrb_t request.");
- assert(request->magic == S3COMMS_HRB_MAGIC);
now = gmnow();
if (ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1))
@@ -1254,13 +1208,11 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-date header");
if (headers == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list.");
- assert(headers->magic == S3COMMS_HRB_NODE_MAGIC);
if (FAIL == H5FD_s3comms_hrb_node_set(&headers, "x-amz-content-sha256", (const char *)EMPTY_SHA256))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-content-sha256 header");
if (headers == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list.");
- assert(headers->magic == S3COMMS_HRB_NODE_MAGIC);
if (strlen((const char *)handle->token) > 0) {
if (FAIL ==
@@ -1268,7 +1220,6 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-security-token header");
if (headers == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list.");
- assert(headers->magic == S3COMMS_HRB_NODE_MAGIC);
}
if (rangebytesstr != NULL) {
@@ -1276,14 +1227,12 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set range header");
if (headers == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list.");
- assert(headers->magic == S3COMMS_HRB_NODE_MAGIC);
}
if (FAIL == H5FD_s3comms_hrb_node_set(&headers, "Host", handle->purl->host))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set host header");
if (headers == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list.");
- assert(headers->magic == S3COMMS_HRB_NODE_MAGIC);
request->first_header = headers;
@@ -1327,7 +1276,6 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
node = request->first_header;
while (node != NULL) {
- assert(node->magic == S3COMMS_HRB_NODE_MAGIC);
curlheaders = curl_slist_append(curlheaders, (const char *)node->cat);
if (curlheaders == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not append header to curl slist.");
@@ -1530,7 +1478,6 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c
if (http_request == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hrb object cannot be null.");
- assert(http_request->magic == S3COMMS_HRB_MAGIC);
if (canonical_request_dest == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "canonical request destination cannot be null.");
@@ -1554,8 +1501,6 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c
node = http_request->first_header; /* assumed sorted */
while (node != NULL) {
- assert(node->magic == S3COMMS_HRB_NODE_MAGIC);
-
ret = snprintf(tmpstr, sizeof(tmpstr), "%s:%s\n", node->lowername, node->value);
if (ret < 0 || ret >= (int)sizeof(tmpstr))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to concatenate HTTP header %s:%s",
@@ -1668,7 +1613,6 @@ H5FD_s3comms_free_purl(parsed_url_t *purl)
FUNC_ENTER_NOAPI_NOINIT_NOERR
if (purl != NULL) {
- assert(purl->magic == S3COMMS_PARSED_URL_MAGIC);
if (purl->scheme != NULL)
H5MM_xfree(purl->scheme);
if (purl->host != NULL)
@@ -1679,7 +1623,6 @@ H5FD_s3comms_free_purl(parsed_url_t *purl)
H5MM_xfree(purl->path);
if (purl->query != NULL)
H5MM_xfree(purl->query);
- purl->magic += 1ul;
H5MM_xfree(purl);
}
@@ -2016,7 +1959,6 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
purl = (parsed_url_t *)H5MM_malloc(sizeof(parsed_url_t));
if (purl == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for parsed_url_t");
- purl->magic = S3COMMS_PARSED_URL_MAGIC;
purl->scheme = NULL;
purl->host = NULL;
purl->port = NULL;
diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h
index d523928efc6..a0c72c7129a 100644
--- a/src/H5FDs3comms.h
+++ b/src/H5FDs3comms.h
@@ -207,12 +207,6 @@
* All data (`name`, `value`, `lowername`, and `cat`) are null-terminated
* strings allocated specifically for their node.
*
- *
- *
- * `magic` (unsigned long)
- *
- * "unique" identifier number for the structure type
- *
* `name` (char *)
*
* Case-meaningful name of the HTTP field.
@@ -243,14 +237,12 @@
*----------------------------------------------------------------------------
*/
typedef struct hrb_node_t {
- unsigned long magic;
char *name;
char *value;
char *cat;
char *lowername;
struct hrb_node_t *next;
} hrb_node_t;
-#define S3COMMS_HRB_NODE_MAGIC 0x7F5757UL
/*----------------------------------------------------------------------------
*
@@ -280,14 +272,6 @@ typedef struct hrb_node_t {
* included in the request by a pointer to the head of the list.
*
*
- *
- * `magic` (unsigned long)
- *
- * "Magic" number confirming that this is an hrb_t structure and
- * what operations are valid for it.
- *
- * Must be S3COMMS_HRB_MAGIC to be valid.
- *
* `body` (char *) :
*
* Pointer to start of HTTP body.
@@ -319,15 +303,13 @@ typedef struct hrb_node_t {
*----------------------------------------------------------------------------
*/
typedef struct {
- unsigned long magic;
- char *body;
- size_t body_len;
- hrb_node_t *first_header;
- char *resource;
- char *verb;
- char *version;
+ char *body;
+ size_t body_len;
+ hrb_node_t *first_header;
+ char *resource;
+ char *verb;
+ char *version;
} hrb_t;
-#define S3COMMS_HRB_MAGIC 0x6DCC84UL
/*----------------------------------------------------------------------------
*
@@ -345,12 +327,6 @@ typedef struct {
* Scheme Host Port Resource Query/-ies
*
*
- *
- * `magic` (unsigned long)
- *
- * Structure identification and validation identifier.
- * Identifies as `parsed_url_t` type.
- *
* `scheme` (char *)
*
* String representing which protocol is to be expected.
@@ -382,14 +358,12 @@ typedef struct {
*----------------------------------------------------------------------------
*/
typedef struct {
- unsigned long magic;
- char *scheme; /* required */
- char *host; /* required */
- char *port;
- char *path;
- char *query;
+ char *scheme; /* required */
+ char *host; /* required */
+ char *port;
+ char *path;
+ char *query;
} parsed_url_t;
-#define S3COMMS_PARSED_URL_MAGIC 0x21D0DFUL
/*----------------------------------------------------------------------------
*
@@ -411,12 +385,6 @@ typedef struct {
* undefined behavior if called to perform in multiple threads.
*
*
- *
- * `magic` (unsigned long)
- *
- * "magic" number identifying this structure as unique type.
- * MUST equal `S3R_MAGIC` to be valid.
- *
* `curlhandle` (CURL)
*
* Pointer to the curl_easy handle generated for the request.
@@ -470,7 +438,6 @@ typedef struct {
*----------------------------------------------------------------------------
*/
typedef struct {
- unsigned long magic;
CURL *curlhandle;
size_t filesize;
char *httpverb;
@@ -481,8 +448,6 @@ typedef struct {
char *token;
} s3r_t;
-#define S3COMMS_S3R_MAGIC 0x44d8d79
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/test/s3comms.c b/test/s3comms.c
index e08da8e99b1..0dcff97cc65 100644
--- a/test/s3comms.c
+++ b/test/s3comms.c
@@ -730,7 +730,6 @@ test_hrb_init_request(void)
}
else {
FAIL_IF(req == NULL);
- JSVERIFY(S3COMMS_HRB_MAGIC, req->magic, NULL)
if (C->verb == NULL) {
JSVERIFY_STR("GET", req->verb, NULL)
}
From 8a3063b49e7780122ec173f2104e2be95ba312e8 Mon Sep 17 00:00:00 2001
From: Dana Robinson <43805+derobins@users.noreply.github.com>
Date: Wed, 19 Jun 2024 14:22:21 -0700
Subject: [PATCH 28/45] Remove dead H5FD_s3comms_percent_encode_char() (#4591)
---
src/H5FDs3comms.c | 118 ----------------------------------------------
src/H5FDs3comms.h | 2 -
test/s3comms.c | 72 ----------------------------
3 files changed, 192 deletions(-)
diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c
index d0577fa5e78..4246263a551 100644
--- a/src/H5FDs3comms.c
+++ b/src/H5FDs3comms.c
@@ -2110,124 +2110,6 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_s3comms_parse_url() */
-/*----------------------------------------------------------------------------
- *
- * Function: H5FD_s3comms_percent_encode_char()
- *
- * Purpose:
- *
- * "Percent-encode" utf-8 character `c`, e.g.,
- * '$' -> "%24"
- * '¢' -> "%C2%A2"
- *
- * `c` cannot be null.
- *
- * Does not (currently) accept multi-byte characters...
- * limit to (?) u+00ff, well below upper bound for two-byte utf-8 encoding
- * (u+0080..u+07ff).
- *
- * Writes output to `repr`.
- * `repr` cannot be null.
- * Assumes adequate space i `repr`...
- * >>> char[4] or [7] for most characters,
- * >>> [13] as theoretical maximum.
- *
- * Representation `repr` is null-terminated.
- *
- * Stores length of representation (without null terminator) at pointer
- * `repr_len`.
- *
- * Return : SUCCEED/FAIL
- *
- * - SUCCESS: `SUCCEED`
- * - percent-encoded representation written to `repr`
- * - 'repr' is null-terminated
- * - FAILURE: `FAIL`
- * - `c` or `repr` was NULL
- *
- *----------------------------------------------------------------------------
- */
-herr_t
-H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr_len)
-{
- unsigned int i = 0;
- int chars_written = 0;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- if (repr == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination `repr`.");
-
- if (c <= (unsigned char)0x7f) {
- /* character represented in a single "byte"
- * and single percent-code
- */
- *repr_len = 3;
- chars_written = snprintf(repr, 4, "%%%02X", c);
- if (chars_written < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c);
- } /* 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};
-
- stack_size = 0;
- k = (unsigned int)c;
- *repr_len = 0;
- do {
- /* push number onto stack in six-bit slices
- */
- acc = k;
- acc >>= 6; /* cull least */
- acc <<= 6; /* six bits */
- stack[stack_size++] = (unsigned char)(k - acc);
- k = acc >> 6;
- } while (k > 0);
-
- /* `stack` now has two to four six-bit 'numbers' to be put into
- * UTF-8 byte fields.
- */
-
- /****************
- * leading byte *
- ****************/
-
- /* prepend 11[1[1]]0 to first byte */
- /* 110xxxxx, 1110xxxx, or 11110xxx */
- acc = 0xC0; /* 0x11000000 */
- acc += (stack_size > 2) ? 0x20 : 0; /* 0x00100000 */
- acc += (stack_size > 3) ? 0x10 : 0; /* 0x00010000 */
- stack_size--;
- chars_written = snprintf(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;
-
- /************************
- * continuation byte(s) *
- ************************/
-
- /* 10xxxxxx */
- for (i = 0; i < stack_size; i++) {
- chars_written =
- snprintf(&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()
diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h
index a0c72c7129a..62855e3d952 100644
--- a/src/H5FDs3comms.h
+++ b/src/H5FDs3comms.h
@@ -500,8 +500,6 @@ H5_DLL herr_t H5FD_s3comms_load_aws_profile(const char *name, char *key_id_out,
H5_DLL herr_t H5FD_s3comms_parse_url(const char *str, parsed_url_t **purl);
-H5_DLL herr_t H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr_len);
-
H5_DLL herr_t H5FD_s3comms_signing_key(unsigned char *md, const char *secret, const char *region,
const char *iso8601now);
diff --git a/test/s3comms.c b/test/s3comms.c
index 0dcff97cc65..ab447f869d9 100644
--- a/test/s3comms.c
+++ b/test/s3comms.c
@@ -1546,77 +1546,6 @@ test_parse_url(void)
} /* end test_parse_url() */
-/*---------------------------------------------------------------------------
- *
- * Function: test_percent_encode_char()
- *
- * Purpose:
- *
- * Define and verify behavior of `H5FD_s3comms_percent_encode_char()`
- *
- * Return:
- *
- * Success: 0
- * Failure: -1
- *
- *---------------------------------------------------------------------------
- */
-static herr_t
-test_percent_encode_char(void)
-{
- /*************************
- * test-local structures *
- *************************/
-
- struct testcase {
- const char c;
- const char *exp;
- size_t exp_len;
- };
-
- /************************
- * test-local variables *
- ************************/
-
- struct testcase cases[] = {
- {'$', "%24", 3}, /* u+0024 dollar sign */
- {' ', "%20", 3}, /* u+0020 space */
- {'^', "%5E", 3}, /* u+0094 carat */
- {'/', "%2F", 3}, /* u+002f solidus (forward slash) */
- /* {??, "%C5%8C", 6},*/ /* u+014c Latin Capital Letter O with Macron */
- /* Not included because it is multibyte "wide" character that poses */
- /* issues both in the underlying function and in being written in */
- /* this file. */
- /* {'¢', "%C2%A2", 6}, */ /* u+00a2 cent sign */
- /* above works, but complains about wide character overflow */
- /* Elide for now, until it is determined (a) unnecessary or */
- /* (b) requiring signature change to accommodate wide characters */
- {'\0', "%00", 3}, /* u+0000 null */
- };
- char dest[13];
- size_t dest_len = 0;
- int i = 0;
- int n_cases = 5;
-
- TESTING("percent encode characters");
-
- for (i = 0; i < n_cases; i++) {
- JSVERIFY(SUCCEED, H5FD_s3comms_percent_encode_char(dest, (const unsigned char)cases[i].c, &dest_len),
- NULL)
- JSVERIFY(cases[i].exp_len, dest_len, NULL)
- JSVERIFY(0, strncmp(dest, cases[i].exp, dest_len), NULL)
- JSVERIFY_STR(cases[i].exp, dest, NULL)
- }
-
- JSVERIFY(FAIL, H5FD_s3comms_percent_encode_char(NULL, (const unsigned char)'^', &dest_len), NULL)
-
- PASSED();
- return 0;
-
-error:
- return -1;
-} /* end test_percent_encode_char() */
-
/*---------------------------------------------------------------------------
* Function: test_s3r_get_filesize()
*---------------------------------------------------------------------------
@@ -2237,7 +2166,6 @@ main(void)
/* tests ordered roughly by dependence */
nerrors += test_macro_format_credential() < 0 ? 1 : 0;
- nerrors += test_percent_encode_char() < 0 ? 1 : 0;
nerrors += test_bytes_to_hex() < 0 ? 1 : 0;
nerrors += test_HMAC_SHA256() < 0 ? 1 : 0;
nerrors += test_signing_key() < 0 ? 1 : 0;
From e6f8118bfc0e93726a1d656d8a7e0722d3eef164 Mon Sep 17 00:00:00 2001
From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Date: Thu, 20 Jun 2024 16:01:43 -0500
Subject: [PATCH 29/45] Rework the TestExpress usage and refactor dead code
(#4590)
---
.github/workflows/abi-report.yml | 2 +-
.github/workflows/cmake-bintest.yml | 12 ++--
.github/workflows/testxpr-cmake.yml | 2 +
c++/test/dsets.cpp | 1 -
c++/test/tlinks.cpp | 3 +-
config/cmake/LIBAEC/CMakeLists.txt | 8 +--
config/cmake/LIBAEC/CPack.Info.plist.in | 2 +-
config/cmake/ZLIB/CMakeLists.txt | 2 +-
java/src/hdf/overview.html | 2 +-
test/accum.c | 2 +-
test/accum_swmr_reader.c | 2 +-
test/app_ref.c | 6 +-
test/big.c | 9 ++-
test/btree2.c | 16 +++---
test/cache_logging.c | 5 +-
test/chunk_info.c | 2 +-
test/cmpd_dset.c | 2 +-
test/cross_read.c | 2 +-
test/del_many_dense_attrs.c | 2 +-
test/dsets.c | 2 +-
test/dt_arith.c | 34 ++++++------
test/dtypes.c | 38 ++++++-------
test/earray.c | 23 ++++----
test/efc.c | 3 +-
test/enum.c | 2 +-
test/err_compat.c | 3 +-
test/error_test.c | 3 +-
test/event_set.c | 2 +-
test/evict_on_close.c | 2 +-
test/extend.c | 2 +-
test/external.c | 2 +-
test/external_env.c | 2 +-
test/farray.c | 23 ++++----
test/fheap.c | 18 +++---
test/file_image.c | 22 +++++---
test/filenotclosed.c | 2 +-
test/fillval.c | 2 +-
test/filter_fail.c | 2 +-
test/filter_plugin.c | 12 ++--
test/flush1.c | 2 +-
test/flush2.c | 2 +-
test/freespace.c | 2 +-
test/getname.c | 2 +-
test/gheap.c | 2 +-
test/h5test.c | 73 ++-----------------------
test/h5test.h | 33 ++++++++---
test/hdfs.c | 2 +-
test/istore.c | 2 +-
test/lheap.c | 2 +-
test/links.c | 2 +-
test/links_env.c | 2 +-
test/mdset.c | 2 +-
test/mf.c | 2 +-
test/mirror_vfd.c | 2 +-
test/mount.c | 2 +-
test/mtime.c | 2 +-
test/ntypes.c | 2 +-
test/objcopy.c | 10 ++--
test/objcopy_ref.c | 6 +-
test/ohdr.c | 2 +-
test/onion.c | 2 +-
test/page_buffer.c | 5 +-
test/ros3.c | 2 +-
test/s3comms.c | 2 +-
test/select_io_dset.c | 2 +-
test/set_extent.c | 2 +-
test/stab.c | 2 +-
test/swmr.c | 2 +-
test/testframe.c | 2 +-
test/tfile.c | 12 ++--
test/timer.c | 2 +-
test/tsohm.c | 4 +-
test/unlink.c | 2 +-
test/unregister.c | 2 +-
test/vds.c | 8 ++-
test/vds_env.c | 2 +-
test/vfd.c | 2 +-
test/vfd_plugin.c | 2 +-
test/vol.c | 2 +-
test/vol_plugin.c | 2 +-
testpar/t_filters_parallel.c | 3 +-
testpar/t_mpi.c | 3 +-
testpar/t_pflush2.c | 6 +-
testpar/t_pmulti_dset.c | 2 +-
testpar/t_select_io_dset.c | 2 +-
testpar/t_shapesame.c | 3 +-
testpar/t_subfiling_vfd.c | 2 +-
testpar/testphdf5.c | 3 +-
tools/test/h5repack/h5repacktst.c | 3 +-
tools/test/perform/perf_meta.c | 3 +-
90 files changed, 248 insertions(+), 280 deletions(-)
diff --git a/.github/workflows/abi-report.yml b/.github/workflows/abi-report.yml
index 4736dc5adb4..d69cc18aa1c 100644
--- a/.github/workflows/abi-report.yml
+++ b/.github/workflows/abi-report.yml
@@ -82,7 +82,7 @@ jobs:
mkdir "${{ github.workspace }}/hdf5R"
cd "${{ github.workspace }}/hdf5R"
wget -q https://github.com/HDFGroup/hdf5/releases/download/hdf5-${{ inputs.file_ref }}/hdf5-${{ inputs.file_ref }}-ubuntu-2204.tar.gz
- tar zxf hdf5-${{ inputs.file_ref }}-ubuntu-2204.tar.gz
+ tar zxf hdf5-${{ inputs.file_ref }}-ubuntu-2204_gcc.tar.gz
- name: List files for the space (Linux)
run: |
diff --git a/.github/workflows/cmake-bintest.yml b/.github/workflows/cmake-bintest.yml
index 4f815a4102e..d4d7308ecd2 100644
--- a/.github/workflows/cmake-bintest.yml
+++ b/.github/workflows/cmake-bintest.yml
@@ -189,12 +189,12 @@ jobs:
ls ${{ runner.workspace }}
# symlinks the compiler executables to a common location
- # - name: Setup GNU Fortran
- # uses: fortran-lang/setup-fortran@v1
- # id: setup-fortran
- # with:
- # compiler: gcc
- # version: 12
+ - name: Setup GNU Fortran
+ uses: fortran-lang/setup-fortran@v1
+ id: setup-fortran
+ with:
+ compiler: gcc
+ version: 12
- name: Run ctest (MacOS)
id: run-ctest
diff --git a/.github/workflows/testxpr-cmake.yml b/.github/workflows/testxpr-cmake.yml
index 172c2f7e6be..809832f3e3a 100644
--- a/.github/workflows/testxpr-cmake.yml
+++ b/.github/workflows/testxpr-cmake.yml
@@ -61,6 +61,8 @@ jobs:
working-directory: ${{ runner.workspace }}/build
- name: CMake Run Tests
+ env:
+ HDF5TestExpress: 0
run: ctest . --parallel 2 -C ${{ matrix.build_mode }} -V -R H5TESTXPR
working-directory: ${{ runner.workspace }}/build
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 9de6db1319f..65dabbe11c2 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -17,7 +17,6 @@
EXTERNAL ROUTINES/VARIABLES:
These routines are in the test directory of the C library:
- h5_reset() -- in h5test.c, resets the library by closing it
h5_fileaccess() -- in h5test.c, returns a file access template
***************************************************************************/
diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp
index 7017217009a..3ce8c6823d3 100644
--- a/c++/test/tlinks.cpp
+++ b/c++/test/tlinks.cpp
@@ -752,7 +752,8 @@ test_links()
/* Close 2nd FAPL */
H5Pclose(fapl2_id);
- h5_clean_files(FILENAME, fapl_id);
+ h5_delete_all_test_files(FILENAME, fapl_id);
+ H5Pclose(fapl_id);
}
catch (Exception &E) {
issue_fail_msg("test_links()", __LINE__, __FILE__, E.getCDetailMsg());
diff --git a/config/cmake/LIBAEC/CMakeLists.txt b/config/cmake/LIBAEC/CMakeLists.txt
index bdf43f8baf7..29f1fc7f460 100644
--- a/config/cmake/LIBAEC/CMakeLists.txt
+++ b/config/cmake/LIBAEC/CMakeLists.txt
@@ -125,9 +125,9 @@ set (CMAKE_POSITION_INDEPENDENT_CODE ON)
set (EXE_EXT "")
if (WIN32)
set (EXE_EXT ".exe")
- add_definitions (-D_BIND_TO_CURRENT_VCLIBS_VERSION=1)
- add_definitions (-D_CRT_SECURE_NO_WARNINGS)
- add_definitions (-D_CONSOLE)
+ add_compile_definitions (_BIND_TO_CURRENT_VCLIBS_VERSION=1)
+ add_compile_definitions (_CRT_SECURE_NO_WARNINGS)
+ add_compile_definitions (_CONSOLE)
endif ()
if (MSVC)
@@ -161,7 +161,7 @@ configure_file(
#-----------------------------------------------------------------------------
# All libs/tests/examples need the main include directories
#-----------------------------------------------------------------------------
-set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES
+set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES
"${LIBAEC_BINARY_DIR};${LIBAEC_SOURCE_DIR}/src;${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
)
diff --git a/config/cmake/LIBAEC/CPack.Info.plist.in b/config/cmake/LIBAEC/CPack.Info.plist.in
index 08d371bd5d9..b936470fc29 100644
--- a/config/cmake/LIBAEC/CPack.Info.plist.in
+++ b/config/cmake/LIBAEC/CPack.Info.plist.in
@@ -17,7 +17,7 @@
CFBundleSignature
????
CFBundleVersion
- @CPACK_PACKAGE_VERSIO@
+ @CPACK_PACKAGE_VERSION@
CFBundleShortVersionString
@CPACK_SHORT_VERSION_STRING@
CSResourcesFileMapped
diff --git a/config/cmake/ZLIB/CMakeLists.txt b/config/cmake/ZLIB/CMakeLists.txt
index d31503b0ac6..78d678074b0 100644
--- a/config/cmake/ZLIB/CMakeLists.txt
+++ b/config/cmake/ZLIB/CMakeLists.txt
@@ -42,7 +42,7 @@ HDF_DIR_PATHS(ZLIB)
#-----------------------------------------------------------------------------
# All libs/tests/examples need the main include directories
#-----------------------------------------------------------------------------
-set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES
+set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES
"${ZLIB_BINARY_DIR};${ZLIB_SOURCE_DIR};${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
)
diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html
index 74907555534..84e945b2f87 100644
--- a/java/src/hdf/overview.html
+++ b/java/src/hdf/overview.html
@@ -91,6 +91,6 @@
and the HDF5 library.
To Obtain
-The JHI5 is included with the HDF5 library.
+The JHI5 is included with the HDF5 library.