From d2a31935f6cfa218e9d56d0c3c74445500d7223d Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 18 Jun 2024 16:17:43 -0500 Subject: [PATCH] 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;