summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvchoi-hdfgroup <55293060+vchoi-hdfgroup@users.noreply.github.com>2021-08-05 19:32:43 (GMT)
committerGitHub <noreply@github.com>2021-08-05 19:32:43 (GMT)
commit14cbceaa96dfef990e34179de4a49ff226c71ae7 (patch)
tree76dcc9ea92df237cf081f8988b6315f6db78475e
parentb6aa2680ed426cdc2baf9ec51c6d35fe19bc1f76 (diff)
parent58759a7355dc1c3debde32944c373509fe078a6f (diff)
downloadhdf5-14cbceaa96dfef990e34179de4a49ff226c71ae7.zip
hdf5-14cbceaa96dfef990e34179de4a49ff226c71ae7.tar.gz
hdf5-14cbceaa96dfef990e34179de4a49ff226c71ae7.tar.bz2
Merge pull request #32 from vchoi-hdfgroup/feature/vfd_swmr
Feature/vfd swmr
-rw-r--r--.gitignore6
-rw-r--r--config/cmake/H5pubconf.h.in3
-rw-r--r--config/cmake_ext_mod/ConfigureChecks.cmake6
-rw-r--r--doc/vfd-swmr-user-guide.md264
-rw-r--r--src/H5Dchunk.c67
-rw-r--r--src/H5Dprivate.h11
-rw-r--r--src/H5FD.c119
-rw-r--r--src/H5FDcore.c1
-rw-r--r--src/H5FDdevelop.h1
-rw-r--r--src/H5FDdirect.c1
-rw-r--r--src/H5FDfamily.c1
-rw-r--r--src/H5FDhdfs.c1
-rw-r--r--src/H5FDlog.c1
-rw-r--r--src/H5FDmirror.c1
-rw-r--r--src/H5FDmpio.c1
-rw-r--r--src/H5FDmulti.c1
-rw-r--r--src/H5FDprivate.h1
-rw-r--r--src/H5FDros3.c1
-rw-r--r--src/H5FDsec2.c1
-rw-r--r--src/H5FDsplitter.c1
-rw-r--r--src/H5FDstdio.c1
-rw-r--r--src/H5FDvfd_swmr.c645
-rw-r--r--src/H5FDvfd_swmr.h6
-rw-r--r--src/H5Fint.c11
-rw-r--r--src/H5Oattribute.c45
-rw-r--r--src/H5Pdxpl.c278
-rw-r--r--src/H5S.c51
-rw-r--r--src/H5Sprivate.h1
-rw-r--r--src/H5Spublic.h8
-rw-r--r--src/H5VLnative_dataset.c154
-rw-r--r--src/H5private.h13
-rw-r--r--src/H5system.c6
-rw-r--r--test/cmpd_dset.c4
-rw-r--r--test/cross_read.c2
-rw-r--r--test/direct_chunk.c100
-rw-r--r--test/dsets.c43
-rw-r--r--test/dtypes.c56
-rw-r--r--test/earray.c4
-rw-r--r--test/farray.c4
-rw-r--r--test/file_image.c16
-rw-r--r--test/h5test.c34
-rw-r--r--test/h5test.h14
-rw-r--r--test/hyperslab.c7
-rw-r--r--test/istore.c6
-rw-r--r--test/links.c8
-rw-r--r--test/objcopy.c12
-rw-r--r--test/page_buffer.c12
-rw-r--r--test/testfiles/err_compat_14
-rw-r--r--test/testfiles/links_env.out4
-rw-r--r--test/tfile.c1
-rw-r--r--test/trefer_deprec.c6
-rw-r--r--test/trefstr.c2
-rw-r--r--test/unlink.c2
-rw-r--r--test/use_common.c21
-rw-r--r--test/vfd_swmr.c30
-rw-r--r--test/vfd_swmr_dsetchks_writer.c8
-rw-r--r--test/vfd_swmr_group_writer.c16
-rw-r--r--testpar/t_file.c5
-rw-r--r--testpar/t_span_tree.c5
-rw-r--r--tools/lib/io_timer.h2
60 files changed, 1209 insertions, 927 deletions
diff --git a/.gitignore b/.gitignore
index bdeae42..3caf16a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,5 @@
# .gitignore file for HDF5
-# ctags
-**/tags
-
-# vim swap files
-**/.*.swp
-
# Makefile.in files
**/Makefile.in
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in
index 11b56a4..740a0cf 100644
--- a/config/cmake/H5pubconf.h.in
+++ b/config/cmake/H5pubconf.h.in
@@ -394,9 +394,6 @@
/* Define if your system has window style path name. */
#cmakedefine H5_HAVE_WINDOW_PATH @H5_HAVE_WINDOW_PATH@
-/* Define to 1 if you have the <winsock2.h> header file. */
-#cmakedefine H5_HAVE_WINSOCK2_H @H5_HAVE_WINSOCK2_H@
-
/* Define to 1 if you have the <zlib.h> header file. */
#cmakedefine H5_HAVE_ZLIB_H @H5_HAVE_ZLIB_H@
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake
index d014535..61cec8b 100644
--- a/config/cmake_ext_mod/ConfigureChecks.cmake
+++ b/config/cmake_ext_mod/ConfigureChecks.cmake
@@ -53,7 +53,6 @@ if (MINGW)
set (${HDF_PREFIX}_HAVE_MINGW 1)
set (WINDOWS 1) # MinGW tries to imitate Windows
set (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1")
- set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1)
set (__USE_MINGW_ANSI_STDIO 1)
endif ()
@@ -117,11 +116,6 @@ CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H)
CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H)
CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H)
-# Windows
-if (NOT CYGWIN)
- CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" ${HDF_PREFIX}_HAVE_WINSOCK2_H)
-endif ()
-
CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" ${HDF_PREFIX}_HAVE_GLOBUS_COMMON_H)
CHECK_INCLUDE_FILE_CONCAT ("pdb.h" ${HDF_PREFIX}_HAVE_PDB_H)
CHECK_INCLUDE_FILE_CONCAT ("pthread.h" ${HDF_PREFIX}_HAVE_PTHREAD_H)
diff --git a/doc/vfd-swmr-user-guide.md b/doc/vfd-swmr-user-guide.md
index 6a14487..a4375b3 100644
--- a/doc/vfd-swmr-user-guide.md
+++ b/doc/vfd-swmr-user-guide.md
@@ -35,7 +35,7 @@ with results that become visible to the VFD SWMR readers.
In particular, VFD SWMR allows the writer to create and delete
both groups and datasets, and to create and delete attributes on
both groups and datasets while operating in VFD SWMR mode --
-which is not possible in the original SWMR.
+which is not possible using the original SWMR implementation.
We say that VFD SWMR is almost "full SWMR" because there are a
few limitations -- most notably:
@@ -69,68 +69,44 @@ the writer makes HDF5 library API calls with sufficient regularity, and
that both reader and writer avoid long running HDF5 API calls.
For further details on VFD SWMR design and implementation, see
-VFD_SWMR_RFC_200916.pdf or VFD_SWMR_RFC_200916.docx in the
-doc directory.
+`VFD_SWMR_RFC_200916.pdf` in the doc directory.
# Quick start
Follow these instructions to download, configure, and build the
-VFD SWMR project in a jiffy. Then install the HDF5 library and
+VFD SWMR project, then install the HDF5 library and
utilities built by the VFD SWMR project.
## Download
Clone the HDF5 repository in a new directory, then switch to the
-features/vfd_swmr_alpa_1 branch as follows:
+`feature/vfd_swmr_beta_1` branch as follows:
```
-% git clone https://@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git swmr
+% git clone https://github.com/HDFGroup/hdf5 swmr
% cd swmr
-% git checkout feature/vfd_swmr_alpha_1
+% git checkout feature/vfd_swmr_beta_1
```
## Build
-Create a build directory, change to that directory, and run the
-configure script:
+There are no special instructions for building VFD SWMR. Simply follow
+the usual build procedure for CMake or the Autotools using the guides
+in the `release_docs` directory.
-```
-% mkdir -p ../build/swmr
-% cd ../build/swmr
-% ../../swmr/configure
-```
-
-Build the project:
-
-```
-% make
-```
-
-## Test
-
-We recommend that you run the full HDF5 test suite to make sure that VFD
-SWMR works correctly on your system. To test the library, utilities, run
-
-```
-% make check
-```
+IMPORTANT:
-If the tests don't pass, please let the developers know!
+The VFD SWMR branches are maintenance branches and will default to a debug
+build. They also do not come with generated files, so Perl will be required
+when building with CMake and Perl and the Autotools (autoconf, etc.) will
+be required when building with the Autotools.
-Note that due to reader and writer process drifting out of sync, you
-are likely to see several messages such as:
+Some notes:
-```
- vfd_swmr_zoo_reader: tend_zoo: vrfy_ns_grp_c: H5Gopen2() failed
-```
-or
-```
- vfd_swmr_zoo_reader: tend_zoo: H5Lexists unexpectedly true.
-```
-
-These are expected transient failues. In addition, there will be
-expected errors in the variable length data tests until we are able
-to re-implement variable length data storage in HDF5.
+- The mirror VFD tests require some rework, so enabling that feature will cause the build step to fail. This will be fixed in a future beta release.
+- The VFD SWMR tests can take some time to run.
+- The VFD SWMR acceptance tests will typically emit some output about "expected errors" that you can ignore. Real errors are clearly flagged.
+- If the tests do not pass on your system, please let the developers know via the email address given at the end of this document.
# Sample programs
@@ -170,48 +146,51 @@ and in the other window, run the reader:
% ./vfd_swmr_bigset_reader -n 50 -d 2 -W
```
-The writer will wait for a signal before it quits. You may tap
-Control-C to make it quit.
+The writer will wait for a signal before it quits. You can tap CTRL-C to make
+it quit.
The reader and writer programs support several command-line options:
-* `-h`: show program usage
-
-* `-W`: stop the program from waiting for a signal before it quits.
-
-* `-q`: suppress the progress messages that the programs write to the
- standard error stream.
-
-* `-V`: create a virtual dataset with content in three source datasets
- in the same HDF5 file---only available when the writer creates a
- dataset extensible in one dimension (`-d 1`)
-
-* `-M`: like `-V`, the writer creates the virtual dataset on three
- source datasets, but each source dataset is in a different HDF5 file.
+```
+usage: vfd_swmr_bigset_writer [-F] [-M] [-S] [-V] [-W] [-a steps] [-b] [-c cols]
+ [-d dims]
+ [-n iterations] [-r rows] [-s datasets]
+ [-u milliseconds]
+
+-F: fixed maximal dimension for the chunked datasets
+-M: use virtual datasets and many source files
+-S: do not use VFD SWMR
+-V: use virtual datasets and a single source file
+-W: do not wait for a signal before exiting
+-a steps: `steps` between adding attributes
+-b: write data in big-endian byte order
+-c cols: `cols` columns per chunk
+-d 1|one|2|two|both: select dataset expansion in one or
+ both dimensions
+-n iterations: how many times to expand each dataset
+-r rows: `rows` rows per chunk
+-s datasets: number of datasets to create
+-u ms: milliseconds interval between updates
+ to vfd_swmr_bigset_writer.h5
+```
## The VFD SWMR demos
-The VFD SWMR demos are in a [separate
-repository](https://bitbucket.hdfgroup.org/scm/~dyoung/swmr-demo.git).
-
-Before you build the demos, you will need to install the HDF5 library
-and utilities built from the VFD SWMR branch in your home directory
-somewhere. In the ./configure step, use the command-line option
-`--prefix=$HOME/path/for/library` to set the directory you prefer.
-In the demo Makefiles, update the `H5CC` variable with the path to
-the `h5cc` installed from the VFD SWMR branch. Then you should be
-able to `make` and `make clean` the demos.
+The VFD SWMR demos are located in the `examples` directory of this source
+tree. Instructions for building the example programs are given in the README
+file in that directory. These programs are NOT installed via `make install`
+and have to built by hand with h5cc as described in the README.
-Under `gaussians/`, two programs are built, `wgaussians` and
-`rgaussians`. If you start both from the same directory in different
-terminals, you should see the "bouncing 2-D Gaussian distributions"
-in the `rgaussians` terminal. This demo uses curses, so you may need
-to install the curses developers library to build.
+Two Gaussian programs are built, `wgaussians` and `rgaussians`. If you start
+both from the same directory in different terminals, you should see the
+"bouncing 2-D Gaussian distributions" in the `rgaussians` terminal. This demo
+uses curses, so you may need to install the curses developers library to build
+(and this is probably not going to be easy to build on Windows).
The creation-deletion (`credel`) demo is also run in two terminals.
-The two command lines are given in `credel/README.md`. You need
-to use the `h5ls` installed from the VFD SWMR branch, since only
-that version has the `--poll` option.
+The two command lines are given in the README. You need to use the `h5ls`
+installed from the VFD SWMR branch, since only that version has the `--poll`
+option. Be careful to not use a non-VFD-SWMR system h5ls here.
# Developer tips
@@ -219,7 +198,7 @@ that version has the `--poll` option.
### File-creation properties
-To use VFD SWMR, creating your HDF5 file with paged allocation strategy
+To use VFD SWMR, creating your HDF5 file with a paged allocation strategy
is mandatory. This call enables the paged allocation strategy:
```
@@ -233,74 +212,40 @@ allocation strategy.
### File-access properties
-In this section we dissect `vfd_swmr_create_fapl()`, a helper routine in
-the VFD SWMR tests, to show how to configure your application to use VFD
+In this section we show how to configure your application to use VFD
SWMR.
-```
-hid_t
-vfd_swmr_create_fapl(bool writer, bool only_meta_pages, bool use_vfd_swmr)
-{
- H5F_vfd_swmr_config_t config;
- hid_t fapl;
-
-```
-
-`h5_fileaccess()` is also a helper routine for the tests. In your
-program, you can replace the `h5_fileaccess()` call with a call to
-`H5Pcreate(H5P_FILE_ACCESS)`.
-
-```
- /* Create file access property list */
- if((fapl = h5_fileaccess()) < 0) {
- warnx("h5_fileaccess");
- return badhid;
- }
-```
-
-
-VFD SWMR has only been tested with the latest file format. It may
-malfunction with older formats, we just don't know. We force the
-latest version here.
-
-```
- /* FOR NOW: set to use latest format, the "old" parameter is not used */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
- warnx("H5Pset_libver_bounds");
- return badhid;
- }
-
- /*
- * Set up to open the file with VFD SWMR configured.
- */
-```
+1. Create a file access property list using `H5Pcreate(H5P_FILE_ACCESS)`.
+2. Set the latest file format using `H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)`.
+3. Enable page buffering using `H5Pset_page_buffer_size()`.
+4. Set any VFD SWMR configuration properties using `H5Pset_vfd_swmr_config()`. The struct is documented in H5Fpublic.h, with some additional documentation below. (In the near future, this struct will be documented in the library's Doxygen documentation.)
VFD SWMR relies on metadata reads and writes to go through the
-page buffer. Note that the default page size is 4096 bytes. This
-call sets the total page buffer size to 4096 bytes. So we have
-effectively created a one-page page buffer! That is adequate for
-testing, but it may not be best for your application.
-
-If `only_meta_pages` is true, then the entire page buffer is
-dedicated to metadata. That's fine for VFD SWMR.
+page buffer. Note that the default page size is 4096 bytes. Finding good
+values for `buf_size` may take some experimentation. We use 4096 (giving a
+single page buffer) for `buf_size` in our test code.
*Note well*: when VFD SWMR is enabled, the meta-/raw-data pages proportion
set by `H5Pset_page_buffer_size()` does not actually control the
pages reserved for raw data. *All* pages are dedicated to buffering
metadata.
+### `H5F_vfd_swmr_config_t` fields discussion
+
+Example code:
```
- /* Enable page buffering */
- if(H5Pset_page_buffer_size(fapl, 4096, only_meta_pages ? 100 : 0, 0) < 0) {
- warnx("H5Pset_page_buffer_size");
- return badhid;
- }
-```
+ memset(&config, 0, sizeof(config));
+ config.version = H5F__CURR_VFD_SWMR_CONFIG_VERSION;
+ config.tick_len = 4;
+ config.max_lag = 7;
+ config.writer = true;
+ config.md_pages_reserved = 128;
+ strcpy(config.md_file_path, "./my_md_file");
-Add VFD SWMR-specific configuration to the file-access property list
-(`fapl`) using an `H5Pset_vfd_swmr_config()` call.
+ H5Pset_vfd_swmr_config(fapl, &config);
+```
When VFD SWMR is enabled, changes to the HDF5 metadata accumulate in
RAM until a configurable unit of time known as a *tick* has passed.
@@ -308,11 +253,11 @@ At the end of each tick, a snapshot of the metadata at the end of
the tick is "published"---that is, made visible to the readers.
The length of a *tick* is configurable in units of 100 milliseconds
-using the `tick_len` parameter. Below, `tick_len` is set to `4` to
+using the `tick_len` parameter. Here, `tick_len` is set to `4` to
select a tick length of 400ms.
A snapshot does not persist forever, but it expires after a number
-of ticks, given by the *maximum lag*, has passed. Below, `max_lag`
+of ticks, given by the *maximum lag*, has passed. Here, `max_lag`
is set to `7` to select a maximum lag of 7 ticks. After a snapshot
has expired, the writer may overwrite it.
@@ -352,25 +297,6 @@ The `version` parameter tells what version of VFD SWMR configuration
the parameter struct `config` contains. For now, it should be
initialized to `H5F__CURR_VFD_SWMR_CONFIG_VERSION`.
-```
- memset(&config, 0, sizeof(config));
-
- config.version = H5F__CURR_VFD_SWMR_CONFIG_VERSION;
- config.tick_len = 4;
- config.max_lag = 7;
- config.writer = writer;
- config.md_pages_reserved = 128;
- HDstrcpy(config.md_file_path, "./my_md_file");
-
- /* Enable VFD SWMR configuration */
- if(use_vfd_swmr && H5Pset_vfd_swmr_config(fapl, &config) < 0) {
- warnx("H5Pset_vfd_swmr_config");
- return badhid;
- }
- return fapl;
-}
-```
-
## Using virtual datasets (VDS)
An application may want to use VFD SWMR to create, read, or write
@@ -412,14 +338,14 @@ user configurable in the first production release.
With the currently hard coded flush of raw data at the end of each tick,
it should not be necessary to call H5Fflush(). In fact, when VFD SWMR is
-active, H5Fflush() may require up to 'max_lag' ticks to complete due to
+active, H5Fflush() may require up to `max_lag` ticks to complete due to
metadata consistency issues.
Instead, a writer can make its last changes to HDF5 file visible to all
readers immediately using the new call, `H5Fvfd_swmr_end_tick()`. Note
that this call should be used sparingly, as it terminates the current
-tick early, thus effectively reducing 'max_lag'. Repeated calls in
-quick succession can force a reader to overrun 'max_lag', and
+tick early, thus effectively reducing `max_lag`. Repeated calls in
+quick succession can force a reader to overrun `max_lag`, and
read stale metadata.
When the flush of raw data at end of tick is disabled (not possible at present),
@@ -527,14 +453,6 @@ object---while the writer deletes it, then reading content through
the handle may yield corrupted data or the data from some other
object, or the library may crash.
-## Microsoft Windows
-
-VFD SWMR is not officially supported on Microsoft Windows at this time. The
-feature should in theory work on Windows and NTFS, however it has not been
-tested as the existing VFD SWMR tests rely on shell scripts. Note that Windows
-file shares are not supported as there is no write ordering guarantee (as with
-NFS, et al.).
-
## Supported filesystems
A VFD SWMR writer and readers share a couple of files, the HDF5 (`.h5`)
@@ -547,12 +465,20 @@ ordering should take effect, regardless of the underlying filesystem.
If the VFD SWMR reader and the writer run on *different* hosts, then
the write-ordering rules depend on the shared filesystem. VFD SWMR is
-not generally expected to work with NFS at this time. GPFS is reputed
-to order writes according to POSIX convention, so we expect VFD SWMR
-to work with GPFS. (Caveat: we are still looking for an authoritative
-description of GPFS I/O semantics.)
+not generally expected to work with NFS at this time. Parallel file systems
+like GPFS and Lustre should order writes according to POSIX convention, so we
+expect VFD SWMR to work on those file systems but we have not tested this.
-The HDF Group plans to add support for NFS to VFD SWMR in the future.
+The HDF Group plans to add support for networked file systems like NFS and
+Windows SMB to VFD SWMR in the future.
+
+## Microsoft Windows
+
+VFD SWMR is not officially supported on Microsoft Windows at this time. The
+feature should in theory work on Windows and NTFS, however it has not been
+tested as the existing VFD SWMR tests rely on shell scripts. Note that Windows
+file shares are not supported as there is no write ordering guarantee (as with
+NFS, et al.).
## File-opening order
@@ -564,7 +490,7 @@ seconds.
# Reporting bugs
-VFD SWMR is still under development, so we expect that you will encounter
+VFD SWMR is still under development, so it is possible that you will encounter
bugs. Please report them, along with any performance or design issues you
encounter.
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index d6eb715..5fc7abb 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -604,8 +604,6 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage
HDassert(offset);
HDassert(storage_size);
- *storage_size = 0;
-
/* Allocate dataspace and initialize it if it hasn't been. */
if (!(*layout->ops->is_space_alloc)(&layout->storage))
HGOTO_DONE(SUCCEED)
@@ -5031,7 +5029,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
* order of offset in the file.
*/
if (need_addr_sort)
- HDqsort(chunk_disp_array, blocks, sizeof(MPI_Aint), H5D__chunk_cmp_addr);
+ HDqsort(chunk_disp_array, (size_t)blocks, sizeof(MPI_Aint), H5D__chunk_cmp_addr);
/* MSC - should use this if MPI_type_create_hindexed block is working:
* mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE,
@@ -6066,6 +6064,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
if (udata->chunk_in_cache) {
HDassert(H5F_addr_defined(chunk_rec->chunk_addr));
+ HDassert(ent);
HDassert(H5F_addr_defined(ent->chunk_block.offset));
H5_CHECKED_ASSIGN(nbytes, size_t, shared_fo->layout.u.chunk.size, uint32_t);
@@ -7499,6 +7498,36 @@ done:
} /* end H5D__get_chunk_info_by_coord() */
/*-------------------------------------------------------------------------
+ * Function: H5D__chunk_iter_cb
+ *
+ * Purpose: Call the user-defined function with the chunk data. The iterator continues if
+ * the user-defined function returns H5_ITER_CONT, and stops if H5_ITER_STOP is
+ * returned.
+ *
+ * Return: Success: H5_ITER_CONT or H5_ITER_STOP
+ * Failure: Negative (H5_ITER_ERROR)
+ *
+ * Programmer: Gaute Hope
+ * August 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata)
+{
+ int ret_value = 0;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ const H5D_chunk_iter_cb_data_t *data = (H5D_chunk_iter_cb_data_t *)udata;
+
+ ret_value = (data->cb)(chunk_rec->scaled, chunk_rec->filter_mask, chunk_rec->chunk_addr,
+ chunk_rec->nbytes, data->op_data);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__chunk_iter_cb */
+
+/*-------------------------------------------------------------------------
* Function: H5D__chunk_iter
*
* Purpose: Iterate over all the chunks in the dataset with given callbak.
@@ -7537,7 +7566,7 @@ H5D__chunk_iter(const H5D_t *dset, H5D_chunk_iter_op_t cb, void *op_data)
for (ent = rdcc->head; ent; ent = ent->next)
/* Flush the chunk out to disk, to make certain the size is correct later */
if (H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "cannot flush indexed storage buffer")
/* Compose chunked index info struct */
idx_info.f = dset->oloc.file;
@@ -7559,33 +7588,3 @@ H5D__chunk_iter(const H5D_t *dset, H5D_chunk_iter_op_t cb, void *op_data)
done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__chunk_iter() */
-
-/*-------------------------------------------------------------------------
- * Function: H5D__chunk_iter_cb
- *
- * Purpose: Call the user-defined function with the chunk data. The iterator continues if
- * the user-defined function returns H5_ITER_CONT, and stops if H5_ITER_STOP is
- * returned.
- *
- * Return: Success: H5_ITER_CONT or H5_ITER_STOP
- * Failure: Negative (H5_ITER_ERROR)
- *
- * Programmer: Gaute Hope
- * August 2020
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata)
-{
- int ret_value = 0;
-
- FUNC_ENTER_STATIC_NOERR
-
- const H5D_chunk_iter_cb_data_t *data = (H5D_chunk_iter_cb_data_t *)udata;
-
- ret_value = (data->cb)(chunk_rec->scaled, chunk_rec->filter_mask, chunk_rec->chunk_addr,
- chunk_rec->nbytes, data->op_data);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__chunk_iter_cb */
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index f9ef772..ad9794d 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -79,11 +79,12 @@
#define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME \
"local_no_collective_cause" /* cause of broken collective I/O in each process */
#define H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME \
- "global_no_collective_cause" /* cause of broken collective I/O in all processes */
-#define H5D_XFER_EDC_NAME "err_detect" /* EDC */
-#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */
-#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */
-#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */
+ "global_no_collective_cause" /* cause of broken collective I/O in all processes */
+#define H5D_XFER_EDC_NAME "err_detect" /* EDC */
+#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */
+#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */
+#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */
+#define H5D_XFER_DSET_IO_SEL_NAME "dset_io_selection" /* Dataset I/O selection */
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
/* Collective chunk instrumentation properties */
#define H5D_XFER_COLL_CHUNK_LINK_HARD_NAME "coll_chunk_link_hard"
diff --git a/src/H5FD.c b/src/H5FD.c
index fcf39f5..2cae1a8 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -60,7 +60,7 @@ typedef struct H5FD_wrap_t {
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5FD__free_cls(H5FD_class_t *cls);
+static herr_t H5FD__free_cls(H5FD_class_t *cls, void **request);
static herr_t H5FD__query(const H5FD_t *f, unsigned long *flags /*out*/);
/*********************/
@@ -180,7 +180,7 @@ H5FD_term_package(void)
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD__free_cls(H5FD_class_t *cls)
+H5FD__free_cls(H5FD_class_t *cls, void H5_ATTR_UNUSED **request)
{
herr_t ret_value = SUCCEED;
@@ -668,68 +668,81 @@ done:
FUNC_LEAVE_API(ret_value)
}
-/* Helper routine for H5FD_deduplicate(): compare `self` and `other` using
- * the deduplication method of `self`, if it has one; otherwise compare using
- * `H5FDcmp()`.
+/*-------------------------------------------------------------------------
+ * Function: H5FD__dedup
+ *
+ * Purpose: Helper routine for H5FD_deduplicate
+ *
+ * Compares `self` and `other` using the dedup callback of
+ * `self` (if it has one); otherwise compares using `H5FDcmp()`.
+ *
+ * No `dedup' callback:
+ *
+ * If `self` has no de-duplication method, compare `self` and
+ * `other` using `H5FDcmp()` and return `self` if they're equal
+ * and `other` if unequal.
+ *
+ * `dedup' callback present:
+ *
+ * If `self` does have a de-duplication callback, invoke it and
+ * return the method's result: `other` if it duplicates `self`,
+ * `self` if `other` does NOT duplicate it, NULL if `other`
+ * conflicts with `self` or if there is an error.
*
- * If `self` has no de-duplication method, compare `self` and `other`
- * using `H5FDcmp()` and return `self` if they're equal and `other` if
- * unequal.
+ * Return: Success: `self' or `other', as described above
*
- * If `self` does have a de-duplication method, call it and return the
- * method's result: `other` if it duplicates `self`, `self` if `other`
- * does NOT duplicate it, NULL if `other` conflicts with `self` or if
- * there is an error.
+ * Failure: NULL
+ *
+ * Note: Unlike H5FD_deduplicate(), this routine does not free `self`
+ * under any circumstances.
+ *
+ *-------------------------------------------------------------------------
*
- * Unlike H5FD_deduplicate(), this routine does not free `self` under any
- * circumstances.
*/
-static H5FD_t *
-H5FD_dedup(H5FD_t *self, H5FD_t *other, hid_t fapl)
-{
- H5FD_t *(*dedup)(H5FD_t *, H5FD_t *, hid_t);
-
- if ((dedup = self->cls->dedup) != NULL)
- return (*dedup)(self, other, fapl);
-
- if (H5FDcmp(self, other) == 0)
- return self;
- return other;
-}
-
-/* Search the already-opened VFD instances for an instance similar to the
- * instance `file` newly-opened using file-access properties given by `fapl`.
+/*-------------------------------------------------------------------------
+ * Function: H5FD_deduplicate
+ *
+ * Purpose: Search the already-opened VFD instances for an instance
+ * similar to the instance `file` newly-opened using file access
+ * properties given by `fapl_id`.
*
- * If there is an already-open instance that is functionally
- * identical to `file`, close `file` and return the already-open instance.
+ * Return: It's complicated...
*
- * If there is an already-open instance that conflicts with `file` because,
- * for example, its file-access properties are incompatible with `fapl`'s
- * or, for another example, it is under exclusive control by a third VFD
- * instance, then close `file` and return `NULL`.
+ * If there is an already-open instance that is functionally
+ * identical to `file`, close `file` and return the already
+ * open instance.
*
- * Otherwise, return `file` to indicate that there are no identical or
- * conflicting VFD instances already open.
+ * If there is an already open instance that conflicts with
+ * `file` because, for example, its file-access properties are
+ * incompatible with `fapl_id`'s or, for another example, it is
+ * under exclusive control by a third VFD instance, then close
+ * `file` and return `NULL`.
+ *
+ * Otherwise, return `file` to indicate that there are no
+ * identical or conflicting VFD instances already open.
+ *-------------------------------------------------------------------------
*/
H5FD_t *
-H5FD_deduplicate(H5FD_t *file, hid_t fapl)
+H5FD_deduplicate(H5FD_t *file, hid_t fapl_id)
{
- H5FD_t * deduped = file;
H5FD_wrap_t *item;
+ H5FD_t * ret_value = file;
+
+ FUNC_ENTER_NOAPI(NULL)
TAILQ_FOREACH(item, &all_vfds, link)
{
- /* skip "self" */
+ /* Skip "self" */
if (item->file == file)
continue;
- /* skip files with exclusive owners, for now */
+ /* Skip files with exclusive owners, for now */
if (item->file->exc_owner != NULL)
continue;
- if ((deduped = H5FD_dedup(item->file, file, fapl)) != file)
- goto finish;
+ if ((ret_value = H5FD_vfd_swmr_dedup(item->file, file, fapl_id)) != file)
+ goto done;
}
/* If we reach this stage, then we identified neither a conflict nor a
@@ -741,19 +754,17 @@ H5FD_deduplicate(H5FD_t *file, hid_t fapl)
if (item->file == file || item->file->exc_owner == NULL)
continue;
- if (H5FDcmp(file, item->file) == 0) {
- deduped = NULL;
- break;
- }
+ if (H5FD_cmp(file, item->file) == 0)
+ HGOTO_ERROR(H5E_VFL, H5E_FILEOPEN, NULL,
+ "found a conflicting open file when searching for duplicates")
}
-finish:
- if (deduped != file && H5FD_close(file) < 0) {
- HERROR(H5E_FILE, H5E_CANTOPENFILE, "could not close file");
- return NULL;
- }
- return deduped;
-}
+done:
+ if (ret_value != file && H5FD_close(file) < 0)
+ HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "could not close file")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_deduplicate() */
/*-------------------------------------------------------------------------
* Function: H5FD_open
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index f405200..50288c4 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -183,7 +183,6 @@ static const H5FD_class_t H5FD_core_g = {
H5FD__core_lock, /* lock */
H5FD__core_unlock, /* unlock */
H5FD__core_delete, /* del */
- NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
diff --git a/src/H5FDdevelop.h b/src/H5FDdevelop.h
index 5cf30ff..a723a1d 100644
--- a/src/H5FDdevelop.h
+++ b/src/H5FDdevelop.h
@@ -192,7 +192,6 @@ typedef struct H5FD_class_t {
herr_t (*lock)(H5FD_t *file, hbool_t rw);
herr_t (*unlock)(H5FD_t *file);
herr_t (*del)(const char *name, hid_t fapl);
- H5FD_t *(*dedup)(H5FD_t *, H5FD_t *, hid_t);
H5FD_mem_t fl_map[H5FD_MEM_NTYPES];
} H5FD_class_t;
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 2a51883..a1b7b7e 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -172,7 +172,6 @@ static const H5FD_class_t H5FD_direct_g = {
H5FD__direct_lock, /* lock */
H5FD__direct_unlock, /* unlock */
H5FD__direct_delete, /* del */
- NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 2356309..b265e1d 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -137,7 +137,6 @@ static const H5FD_class_t H5FD_family_g = {
H5FD__family_lock, /* lock */
H5FD__family_unlock, /* unlock */
H5FD__family_delete, /* del */
- NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c
index b308f17..102a3ab 100644
--- a/src/H5FDhdfs.c
+++ b/src/H5FDhdfs.c
@@ -310,7 +310,6 @@ static const H5FD_class_t H5FD_hdfs_g = {
NULL, /* lock */
NULL, /* unlock */
NULL, /* del */
- NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 4fd5e27..707c97b 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -212,7 +212,6 @@ static const H5FD_class_t H5FD_log_g = {
H5FD__log_lock, /* lock */
H5FD__log_unlock, /* unlock */
H5FD__log_delete, /* del */
- NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c
index 1886714..cf14c90 100644
--- a/src/H5FDmirror.c
+++ b/src/H5FDmirror.c
@@ -192,7 +192,6 @@ static const H5FD_class_t H5FD_mirror_g = {
H5FD__mirror_lock, /* lock */
H5FD__mirror_unlock, /* unlock */
NULL, /* del */
- NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 2d86eed..dd40399 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -127,7 +127,6 @@ static const H5FD_class_mpi_t H5FD_mpio_g = {
NULL, /* lock */
NULL, /* unlock */
H5FD__mpio_delete, /* del */
- NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
}, /* End of superclass information */
H5FD__mpio_mpi_rank, /* get_rank */
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index 1b5815a..86f7664 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -201,7 +201,6 @@ static const H5FD_class_t H5FD_multi_g = {
H5FD_multi_lock, /* lock */
H5FD_multi_unlock, /* unlock */
H5FD_multi_delete, /* del */
- NULL, /* dedup */
H5FD_FLMAP_DEFAULT /* fl_map */
};
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 2e3d270..0a8850f 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -367,6 +367,7 @@ H5_DLL H5FD_vfd_swmr_idx_entry_t *vfd_swmr_enlarge_shadow_index(struct H5F_t *);
H5_DLL void H5FD_vfd_swmr_dump_status(H5FD_t *, uint64_t);
H5_DLL void H5FD_vfd_swmr_set_pb_configured(H5FD_t *_file);
H5_DLL void H5FD_vfd_swmr_record_elapsed_ticks(H5FD_t *, uint64_t);
+H5_DLL H5FD_t *H5FD_vfd_swmr_dedup(H5FD_t *_self, H5FD_t *_other, hid_t fapl_id);
/* Function prototypes for MPI based VFDs*/
#ifdef H5_HAVE_PARALLEL
diff --git a/src/H5FDros3.c b/src/H5FDros3.c
index 0303b50..6e116ee 100644
--- a/src/H5FDros3.c
+++ b/src/H5FDros3.c
@@ -267,7 +267,6 @@ static const H5FD_class_t H5FD_ros3_g = {
NULL, /* lock */
NULL, /* unlock */
NULL, /* del */
- NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index c694190..d823e3c 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -173,7 +173,6 @@ static const H5FD_class_t H5FD_sec2_g = {
H5FD__sec2_lock, /* lock */
H5FD__sec2_unlock, /* unlock */
H5FD__sec2_delete, /* del */
- NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c
index 91a8e84..c27cd1b 100644
--- a/src/H5FDsplitter.c
+++ b/src/H5FDsplitter.c
@@ -163,7 +163,6 @@ static const H5FD_class_t H5FD_splitter_g = {
H5FD__splitter_lock, /* lock */
H5FD__splitter_unlock, /* unlock */
NULL, /* del */
- NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index f9faf53..6631325 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -215,7 +215,6 @@ static const H5FD_class_t H5FD_stdio_g = {
H5FD_stdio_lock, /* lock */
H5FD_stdio_unlock, /* unlock */
H5FD_stdio_delete, /* del */
- NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
diff --git a/src/H5FDvfd_swmr.c b/src/H5FDvfd_swmr.c
index 316ca6d..568f5d9 100644
--- a/src/H5FDvfd_swmr.c
+++ b/src/H5FDvfd_swmr.c
@@ -24,71 +24,64 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
-#include "H5retry_private.h" /* Retry loops. */
+#include "H5retry_private.h" /* Retry loops. */
/* The driver identification number, initialized at runtime */
static hid_t H5FD_VFD_SWMR_g = 0;
+/* The description of a file belonging to this driver */
typedef struct H5FD_vfd_swmr_t {
- H5FD_t pub; /* public stuff, must be */
- /* first */
+ H5FD_t pub; /* public stuff, must be first */
/* HDF5 file */
- char hdf5_filename[H5FD_MAX_FILENAME_LEN]; /* Name of the HDF5 file from */
- /* open */
- H5FD_t *hdf5_file_lf; /* Driver info for the HDF5 */
- /* file */
+ char hdf5_filename[H5FD_MAX_FILENAME_LEN]; /* Name of the HDF5 file from open */
+ H5FD_t *hdf5_file_lf; /* Driver info for the HDF5 file */
/* Metadata file */
- int md_fd; /* File descriptor for the */
- /* metadata file */
- uint32_t md_pages_reserved; /* # of pages reserved at the */
- /* head of the metadata file */
- char md_file_path[H5FD_MAX_FILENAME_LEN]; /* Name of the metadate file */
- H5FD_vfd_swmr_md_header md_header; /* Metadata file header */
- H5FD_vfd_swmr_md_index md_index; /* Metadata file index */
-
- uint64_t *api_elapsed_ticks; /* Histogram of ticks elapsed
- * inside the API (reader only).
- * api_elapsed_ticks[elapsed] is
- * the number of times `elapsed`
- * ticks passed in an API call
- * during the program lifetime.
- */
- uint32_t api_elapsed_nbuckets; /* Number of histogram buckets. */
-
- hbool_t pb_configured; /* boolean flag set to TRUE */
- /* when the page buffer is */
- /* and to FALSE otherwise. */
- /* Used for sanity checking. */
- H5F_vfd_swmr_config_t config;
- hbool_t writer; /* True iff configured to write.
- * All methods on a write-mode
- * SWMR VFD instance are passed
- * to the lower VFD instance.
- */
+ int md_fd; /* File descriptor for the metadata file */
+ uint32_t md_pages_reserved; /* # of pages reserved at the head of the metadata file */
+ char md_file_path[H5FD_MAX_FILENAME_LEN]; /* Name of the metadate file */
+ H5FD_vfd_swmr_md_header md_header; /* Metadata file header */
+ H5FD_vfd_swmr_md_index md_index; /* Metadata file index */
+
+ /* Histogram of ticks elapsed inside the API (reader only).
+ * api_elapsed_ticks[elapsed] is the number of times
+ * `elapsed' ticks passed during an API call in the
+ * program's lifetime.
+ */
+ uint64_t *api_elapsed_ticks; /* Array of histogram buckets */
+ uint32_t api_elapsed_nbuckets; /* Number of histogram buckets. */
+
+ hbool_t pb_configured; /* Sanity-checking flag set when page buffer is configured */
+ H5F_vfd_swmr_config_t config; /* VFD SWMR configuration */
+
+ /* Flag set if the file is a SWMR writer.
+ * All methods on a write-mode SWMR VFD instance are passed
+ * to the lower VFD instance.
+ */
+ hbool_t writer;
+
} H5FD_vfd_swmr_t;
#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1)
/* Prototypes */
-static herr_t H5FD_vfd_swmr_term(void);
-static H5FD_t *H5FD_vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
-static herr_t H5FD_vfd_swmr_close(H5FD_t *_file);
-static int H5FD_vfd_swmr_cmp(const H5FD_t *_f1, const H5FD_t *_f2);
-static H5FD_t *H5FD_vfd_swmr_dedup(H5FD_t *, H5FD_t *, hid_t);
-static herr_t H5FD_vfd_swmr_query(const H5FD_t *_f1, unsigned long *flags);
-static haddr_t H5FD_vfd_swmr_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
-static herr_t H5FD_vfd_swmr_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
-static haddr_t H5FD_vfd_swmr_get_eof(const H5FD_t *_file, H5FD_mem_t type);
-static herr_t H5FD_vfd_swmr_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle);
-static herr_t H5FD_vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size,
- void *buf);
-static herr_t H5FD_vfd_swmr_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size,
- const void *buf);
-static herr_t H5FD_vfd_swmr_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
-static herr_t H5FD_vfd_swmr_lock(H5FD_t *_file, hbool_t rw);
-static herr_t H5FD_vfd_swmr_unlock(H5FD_t *_file);
+static herr_t H5FD__vfd_swmr_term(void);
+static H5FD_t *H5FD__vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
+static herr_t H5FD__vfd_swmr_close(H5FD_t *_file);
+static int H5FD__vfd_swmr_cmp(const H5FD_t *_f1, const H5FD_t *_f2);
+static herr_t H5FD__vfd_swmr_query(const H5FD_t *_f1, unsigned long *flags);
+static haddr_t H5FD__vfd_swmr_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
+static herr_t H5FD__vfd_swmr_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
+static haddr_t H5FD__vfd_swmr_get_eof(const H5FD_t *_file, H5FD_mem_t type);
+static herr_t H5FD__vfd_swmr_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle);
+static herr_t H5FD__vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size,
+ void *buf);
+static herr_t H5FD__vfd_swmr_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size,
+ const void *buf);
+static herr_t H5FD__vfd_swmr_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
+static herr_t H5FD__vfd_swmr_lock(H5FD_t *_file, hbool_t rw);
+static herr_t H5FD__vfd_swmr_unlock(H5FD_t *_file);
/* VFD SWMR */
static htri_t H5FD__vfd_swmr_header_deserialize(H5FD_vfd_swmr_t *, H5FD_vfd_swmr_md_header *);
@@ -97,40 +90,39 @@ static htri_t H5FD__vfd_swmr_index_deserialize(const H5FD_vfd_swmr_t *file, H5FD
static herr_t H5FD__vfd_swmr_load_hdr_and_idx(H5FD_vfd_swmr_t *, hbool_t);
static const H5FD_class_t H5FD_vfd_swmr_g = {
- "vfd_swmr", /* name */
- MAXADDR, /* maxaddr */
- H5F_CLOSE_WEAK, /* fc_degree */
- H5FD_vfd_swmr_term, /* terminate */
- NULL, /* sb_size */
- NULL, /* sb_encode */
- NULL, /* sb_decode */
- 0, /* fapl_size */
- NULL, /* fapl_get */
- NULL, /* fapl_copy */
- NULL, /* fapl_free */
- 0, /* dxpl_size */
- NULL, /* dxpl_copy */
- NULL, /* dxpl_free */
- H5FD_vfd_swmr_open, /* open */
- H5FD_vfd_swmr_close, /* close */
- H5FD_vfd_swmr_cmp, /* cmp */
- H5FD_vfd_swmr_query, /* query */
- NULL, /* get_type_map */
- NULL, /* alloc */
- NULL, /* free */
- H5FD_vfd_swmr_get_eoa, /* get_eoa */
- H5FD_vfd_swmr_set_eoa, /* set_eoa */
- H5FD_vfd_swmr_get_eof, /* get_eof */
- H5FD_vfd_swmr_get_handle, /* get_handle */
- H5FD_vfd_swmr_read, /* read */
- H5FD_vfd_swmr_write, /* write */
- NULL, /* flush */
- H5FD_vfd_swmr_truncate, /* truncate */
- H5FD_vfd_swmr_lock, /* lock */
- H5FD_vfd_swmr_unlock, /* unlock */
- NULL, /* del */
- H5FD_vfd_swmr_dedup, /* dedup */
- H5FD_FLMAP_DICHOTOMY /* fl_map */
+ "vfd_swmr", /* name */
+ MAXADDR, /* maxaddr */
+ H5F_CLOSE_WEAK, /* fc_degree */
+ H5FD__vfd_swmr_term, /* terminate */
+ NULL, /* sb_size */
+ NULL, /* sb_encode */
+ NULL, /* sb_decode */
+ 0, /* fapl_size */
+ NULL, /* fapl_get */
+ NULL, /* fapl_copy */
+ NULL, /* fapl_free */
+ 0, /* dxpl_size */
+ NULL, /* dxpl_copy */
+ NULL, /* dxpl_free */
+ H5FD__vfd_swmr_open, /* open */
+ H5FD__vfd_swmr_close, /* close */
+ H5FD__vfd_swmr_cmp, /* cmp */
+ H5FD__vfd_swmr_query, /* query */
+ NULL, /* get_type_map */
+ NULL, /* alloc */
+ NULL, /* free */
+ H5FD__vfd_swmr_get_eoa, /* get_eoa */
+ H5FD__vfd_swmr_set_eoa, /* set_eoa */
+ H5FD__vfd_swmr_get_eof, /* get_eof */
+ H5FD__vfd_swmr_get_handle, /* get_handle */
+ H5FD__vfd_swmr_read, /* read */
+ H5FD__vfd_swmr_write, /* write */
+ NULL, /* flush */
+ H5FD__vfd_swmr_truncate, /* truncate */
+ H5FD__vfd_swmr_lock, /* lock */
+ H5FD__vfd_swmr_unlock, /* unlock */
+ NULL, /* del */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
};
/* Declare a free list to manage the H5FD_vfd_swmr_t struct */
@@ -195,7 +187,7 @@ done:
} /* end H5FD_vfd_swmr_init() */
/*---------------------------------------------------------------------------
- * Function: H5FD_vfd_swmr_term
+ * Function: H5FD__vfd_swmr_term
*
* Purpose: Shut down the VFD
*
@@ -207,15 +199,15 @@ done:
*---------------------------------------------------------------------------
*/
static herr_t
-H5FD_vfd_swmr_term(void)
+H5FD__vfd_swmr_term(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Reset VFL ID */
H5FD_VFD_SWMR_g = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5FD_vfd_swmr_term() */
+} /* end H5FD__vfd_swmr_term() */
/*-------------------------------------------------------------------------
* Function: H5Pset_fapl_vfd_swmr (Not yet)
@@ -255,15 +247,15 @@ H5FD__swmr_reader_open(H5FD_vfd_swmr_t *file)
h5_retry_t retry;
hbool_t do_try; /* more tries remain */
herr_t ret_value = SUCCEED;
+
FUNC_ENTER_STATIC
file->api_elapsed_nbuckets = file->config.max_lag + 1;
file->api_elapsed_ticks = H5MM_calloc(file->api_elapsed_nbuckets * sizeof(*file->api_elapsed_ticks));
- if (file->api_elapsed_ticks == NULL) {
- HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "could not allocate API elapsed ticks");
- }
+ if (file->api_elapsed_ticks == NULL)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "could not allocate API elapsed ticks")
/* Retry on opening the metadata file */
for (do_try = h5_retry_init(&retry, H5FD_VFD_SWMR_MD_FILE_RETRY_MAX, H5_RETRY_DEFAULT_MINIVAL,
@@ -286,10 +278,10 @@ H5FD__swmr_reader_open(H5FD_vfd_swmr_t *file)
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD__swmr_reader_open() */
/*-------------------------------------------------------------------------
- * Function: H5FD_vfd_swmr_open
+ * Function: H5FD__vfd_swmr_open
*
* Purpose: Open the metadata file and the underlying HDF5 file
*
@@ -301,7 +293,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5FD_t *
-H5FD_vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
+H5FD__vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
H5FD_vfd_swmr_t * file = NULL;
size_t page_buf_size;
@@ -309,35 +301,31 @@ H5FD_vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxa
H5F_vfd_swmr_config_t *vfd_swmr_config;
H5FD_t * ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* 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");
- }
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
if (H5P_get(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_VFL, H5E_CANTGET, NULL, "can't get page buffer size");
/* Paged allocation, too, has to be enabled, but the page buffer
* initialization (H5PB_create) will detect a conflicting configuration
* and return an error.
*/
- if (page_buf_size == 0) {
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "page buffering must be enabled");
- }
+ if (page_buf_size == 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "page buffering must be enabled")
/* Create the new driver struct */
- if (NULL == (file = H5FL_CALLOC(H5FD_vfd_swmr_t))) {
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct");
- }
+ if (NULL == (file = H5FL_CALLOC(H5FD_vfd_swmr_t)))
+ HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, NULL, "unable to allocate file struct")
vfd_swmr_config = &file->config;
/* Get VFD SWMR configuration */
- if (H5P_get(plist, H5F_ACS_VFD_SWMR_CONFIG_NAME, vfd_swmr_config) < 0) {
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VFD SWMR config info");
- }
+ if (H5P_get(plist, H5F_ACS_VFD_SWMR_CONFIG_NAME, vfd_swmr_config) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get VFD SWMR config info")
file->md_fd = -1;
file->hdf5_file_lf = NULL;
@@ -354,9 +342,8 @@ H5FD_vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxa
file->writer = vfd_swmr_config->writer;
/* Ensure that this is the reader */
- if (!vfd_swmr_config->writer && H5FD__swmr_reader_open(file) < 0) {
- HGOTO_ERROR(H5E_VFL, H5E_OPENERROR, NULL, "perform reader-specific opening steps failed");
- }
+ if (!vfd_swmr_config->writer && H5FD__swmr_reader_open(file) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_OPENERROR, NULL, "perform reader-specific opening steps failed")
/* Hard-wired to open the underlying HDF5 file with SEC2 */
if ((file->hdf5_file_lf = H5FD_open(name, flags, H5P_FILE_ACCESS_DEFAULT, maxaddr)) == NULL)
@@ -380,23 +367,19 @@ H5FD_vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxa
done:
/* Handle closing if error */
- if (NULL == ret_value && file) {
-
- if (H5FD_vfd_swmr_close(&file->pub) < 0)
-
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "error from closing")
-
- } /* end if */
+ if (NULL == ret_value && file)
+ if (H5FD__vfd_swmr_close(&file->pub) < 0)
+ HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "error from closing")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_vfd_swmr_open() */
+} /* end H5FD__vfd_swmr_open() */
/* Perform the reader-only aspects of closing in VFD SWMR mode: optionally
* log and always release the histogram of ticks spent in API calls,
* close the shadow file, release the shadow index.
*/
static void
-swmr_reader_close(H5FD_vfd_swmr_t *file)
+H5FD__swmr_reader_close(H5FD_vfd_swmr_t *file)
{
vfd_swmr_reader_did_increase_tick_to(0);
@@ -404,18 +387,17 @@ swmr_reader_close(H5FD_vfd_swmr_t *file)
H5MM_xfree(file->api_elapsed_ticks);
/* Close the metadata file */
- if (file->md_fd >= 0 && HDclose(file->md_fd) < 0) {
+ if (file->md_fd >= 0 && HDclose(file->md_fd) < 0)
/* Push error, but keep going */
- HERROR(H5E_FILE, H5E_CANTCLOSEFILE, "unable to close the metadata file");
- }
+ HERROR(H5E_VFL, H5E_CANTCLOSEFILE, "unable to close the metadata file");
/* Free the index entries */
if (file->md_index.num_entries && file->md_index.entries)
file->md_index.entries = H5FL_SEQ_FREE(H5FD_vfd_swmr_idx_entry_t, file->md_index.entries);
-}
+} /* end H5FD__swmr_reader_close() */
/*-------------------------------------------------------------------------
- * Function: H5FD_vfd_swmr_close
+ * Function: H5FD__vfd_swmr_close
*
* Purpose: Handle closing for VFD SWMR driver
* --close the underlying HDF5 file
@@ -428,12 +410,12 @@ swmr_reader_close(H5FD_vfd_swmr_t *file)
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_vfd_swmr_close(H5FD_t *_file)
+H5FD__vfd_swmr_close(H5FD_t *_file)
{
H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
if (file->hdf5_file_lf != NULL) {
if (file->hdf5_file_lf->exc_owner != NULL) {
@@ -444,21 +426,21 @@ H5FD_vfd_swmr_close(H5FD_t *_file)
/* Close the underlying file */
if (H5FD_close(file->hdf5_file_lf) < 0)
/* Push error, but keep going */
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close the HDF5 file")
+ HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close the HDF5 file")
}
if (!file->writer)
- (void)swmr_reader_close(file);
+ H5FD__swmr_reader_close(file);
/* Release the driver info */
file = H5FL_FREE(H5FD_vfd_swmr_t, file);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_vfd_swmr_close() */
+} /* end H5FD__vfd_swmr_close() */
/*-------------------------------------------------------------------------
- * Function: H5FD_vfd_swmr_cmp
+ * Function: H5FD__vfd_swmr_cmp
*
* Purpose: Compares two files belonging to this driver using an
* arbitrary (but consistent) ordering.
@@ -470,58 +452,78 @@ H5FD_vfd_swmr_close(H5FD_t *_file)
*-------------------------------------------------------------------------
*/
static int
-H5FD_vfd_swmr_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
+H5FD__vfd_swmr_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
{
const H5FD_vfd_swmr_t *f1 = (const H5FD_vfd_swmr_t *)_f1;
const H5FD_vfd_swmr_t *f2 = (const H5FD_vfd_swmr_t *)_f2;
int ret_value = 0;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
ret_value = H5FD_cmp(f1->hdf5_file_lf, f2->hdf5_file_lf);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_vfd_swmr_cmp() */
+} /* end H5FD_vfd__swmr_cmp() */
-/* Compare the already-opened VFD instance `_self` with the
- * VFD instance `_other` newly-opened with file-access properties `fapl`
- * and indicate whether the instances duplicate each other, if they conflict
- * with each other, or if they are dissimilar.
+/*-------------------------------------------------------------------------
+ * Function: H5FD_vfd_swmr_dedup
+ *
+ * Purpose: Compare the already-opened VFD instance `_self` with the
+ * VFD instance `_other` newly-opened with file-access properties
+ * `fapl_id` and indicate whether the instances duplicate each
+ * other, if they conflict with each other, or if they are
+ * dissimilar.
*
- * If `_self` duplicates `_other`, return `_self`.
+ * If `_self` duplicates `_other`, return `_self`.
*
- * Return NULL on error, or if `_other` and `_self` refer to the same file
- * but the file-access properties, `fapl`, conflict with the properties of
- * `_self`.
+ * Return NULL on error, or if `_other` and `_self` refer to the
+ * same file but the file-access properties, `fapl_id`, conflict
+ * with the properties of `_self`.
*
- * If `_other` neither duplicates nor conflicts with `_self`, then return
- * `_other`.
+ * If `_other` neither duplicates nor conflicts with `_self`,
+ * then return `_other`.
*
- * # Judging duplicate/conflicting/dissimilar VFD instances
+ * NOTE: Judging duplicate/conflicting/dissimilar VFD instances
*
- * `_self` duplicates `_other` if `_other` is also an instance of SWMR
- * class, the instances' lower files are equal under `H5FD_cmp()`, and
- * the file-access properties of `_self` match `fapl`.
- * The wildcard `fapl` value, `H5P_FILE_ACCESS_ANY_VFD`, matches all.
+ * `_self` DUPLICATES `_other` if `_other` is also an instance
+ * of SWMR class, the instances' lower files are equal under
+ * `H5FD_cmp()`, and the file-access properties of `_self` match
+ * `fapl_id`. The wildcard `fapl_id` value,
+ * `H5P_FILE_ACCESS_ANY_VFD`, matches all.
*
- * `_self` also duplicates `_other` if `_other` is not a SWMR instance, but
- * it equals the lower file of `_self` under `H5FD_cmp()`, and `fapl` is
- * `H5P_FILE_ACCESS_ANY_VFD`.
+ * `_self` also DUPLICATES `_other` if `_other` is not a SWMR
+ * instance, but it equals the lower file of `_self` under
+ * `H5FD_cmp()`, and `fapl_id` is `H5P_FILE_ACCESS_ANY_VFD`.
*
- * `_self` and `_other` conflict if both are SWMR instances referring to
- * the same lower file, and their file-access properties differ.
+ * `_self` and `_other` CONFLICT if both are SWMR instances
+ * referring to the same lower file, and their file-access
+ * properties differ.
*
- * `_self` and `_other` conflict if `_other` is not a SWMR instance, it
- * equals the lower file of `_self`, and `fapl` is not equal to
- * `H5P_FILE_ACCESS_ANY_VFD`.
+ * `_self` and `_other` CONFLICT if `_other` is not a SWMR
+ * instance, it equals the lower file of `_self`, and `fapl_id`
+ * is not equal to `H5P_FILE_ACCESS_ANY_VFD`.
+ *
+ * Return: Success: `_self' or `_other', as described above
+ * Failure: NULL
+ *-------------------------------------------------------------------------
*/
-static H5FD_t *
-H5FD_vfd_swmr_dedup(H5FD_t *_self, H5FD_t *_other, hid_t fapl)
+H5FD_t *
+H5FD_vfd_swmr_dedup(H5FD_t *_self, H5FD_t *_other, hid_t fapl_id)
{
- H5FD_vfd_swmr_t *self = (H5FD_vfd_swmr_t *)_self;
+ H5FD_vfd_swmr_t *self = (H5FD_vfd_swmr_t *)_self;
+ H5FD_t * ret_value = NULL;
+
+ FUNC_ENTER_NOAPI(NULL);
- HDassert(_self->driver_id == H5FD_VFD_SWMR_g);
+ /* Not VFD SWMR */
+ if (_self->driver_id != H5FD_VFD_SWMR_g) {
+ if (H5FD_cmp(_self, _other) == 0)
+ HGOTO_DONE(_self)
+ else
+ HGOTO_DONE(_other)
+ }
+ /* VFD SWMR */
if (_self->cls == _other->cls) {
H5FD_vfd_swmr_t * other = (H5FD_vfd_swmr_t *)_other;
H5P_genplist_t * plist;
@@ -529,53 +531,47 @@ H5FD_vfd_swmr_dedup(H5FD_t *_self, H5FD_t *_other, hid_t fapl)
hbool_t equal_configs;
if (H5FD_cmp(self->hdf5_file_lf, other->hdf5_file_lf) != 0)
- return _other;
+ HGOTO_DONE(_other)
- /* If fapl == _ANY_VFD, then the match between lower files is
+ /* If fapl_id == _ANY_VFD, then the match between lower files is
* sufficient.
*/
- if (fapl == H5P_FILE_ACCESS_ANY_VFD)
- return _self;
+ if (fapl_id == H5P_FILE_ACCESS_ANY_VFD)
+ HGOTO_DONE(_self)
- /* If fapl != _ANY_VFD, then we have either a duplicate or
+ /* If fapl_id != _ANY_VFD, then we have either a duplicate or
* a conflict. If the VFD SWMR parameters match, then
* return `self` to indicate a duplicate. Otherwise, return
* NULL to indicate a mismatch.
*/
- if (NULL == (plist = H5I_object(fapl))) {
- HERROR(H5E_ARGS, H5E_BADTYPE, "could not get fapl");
- return NULL;
- }
+ if (NULL == (plist = H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "could not get fapl")
- if ((config = H5MM_malloc(sizeof(*config))) == NULL) {
- HERROR(H5E_ARGS, H5E_BADTYPE, "could not allocate config");
- return NULL;
- }
- if (H5P_get(plist, H5F_ACS_VFD_SWMR_CONFIG_NAME, config) < 0) {
- HERROR(H5E_PLIST, H5E_CANTGET, "cannot get VFD SWMR config");
- return NULL;
- }
+ if ((config = H5MM_malloc(sizeof(*config))) == NULL)
+ HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, NULL, "could not allocate config")
+ if (H5P_get(plist, H5F_ACS_VFD_SWMR_CONFIG_NAME, config) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "cannot get VFD SWMR config")
equal_configs = HDmemcmp(&self->config, config, sizeof(*config)) == 0;
H5MM_xfree(config);
if (equal_configs)
- return _self;
+ HGOTO_DONE(_self)
- HERROR(H5E_PLIST, H5E_CANTGET, "inconsistent VFD SWMR config");
- return NULL;
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "inconsistent VFD SWMR config")
}
- else if (H5FD_cmp(self->hdf5_file_lf, _other) == 0) {
- return (fapl == H5P_FILE_ACCESS_ANY_VFD) ? _self : NULL;
- }
- else {
- return _other;
- }
-}
+ else if (H5FD_cmp(self->hdf5_file_lf, _other) == 0)
+ ret_value = (fapl_id == H5P_FILE_ACCESS_ANY_VFD) ? _self : NULL;
+ else
+ ret_value = _other;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5FD_vfd_swmr_dedup() */
/*-------------------------------------------------------------------------
- * Function: H5FD_vfd_swmr_query
+ * Function: H5FD__vfd_swmr_query
*
* Purpose: Set the flags that this VFL driver is capable of supporting.
* (listed in H5FDpublic.h)
@@ -585,49 +581,45 @@ H5FD_vfd_swmr_dedup(H5FD_t *_self, H5FD_t *_other, hid_t fapl)
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_vfd_swmr_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out */)
+H5FD__vfd_swmr_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out */)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Set the VFL feature flags that this driver supports */
if (flags) {
*flags = 0;
- *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate */
- /* metadata allocations */
- *flags |= H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate */
- /* metadata for faster */
- /* writes */
+ /* OK to aggregate metadata allocations */
+ *flags |= H5FD_FEAT_AGGREGATE_METADATA;
- *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data */
- /* sieving for faster */
- /* raw data reads & */
- /* writes */
+ /* OK to accumulate metadata for faster writes */
+ *flags |= H5FD_FEAT_ACCUMULATE_METADATA;
- *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate */
- /* "small" raw data */
- /* allocations */
+ /* OK to perform data sieving for faster raw data reads & writes */
+ *flags |= H5FD_FEAT_DATA_SIEVE;
- *flags |= H5FD_FEAT_POSIX_COMPAT_HANDLE; /* get_handle callback */
- /* returns a POSIX file */
- /* descriptor */
+ /* OK to aggregate "small" raw data allocations */
+ *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA;
- *flags |= H5FD_FEAT_SUPPORTS_SWMR_IO; /* VFD supports the */
- /* single-writer/ */
- /* multiple-readers */
- /* (SWMR) pattern */
+ /* get_handle callback returns a POSIX file descriptor */
+ *flags |= H5FD_FEAT_POSIX_COMPAT_HANDLE;
- *flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file */
- /* which can be opened */
- /* with the default VFD */
+ /* VFD supports the single-writer / multiple readers (SWMR) pattern */
+ *flags |= H5FD_FEAT_SUPPORTS_SWMR_IO;
- } /* end if */
+ /* VFD creates a file that can be opened with the default VFD
+ *
+ * NOTE: When this VFD becomes a true passthrough, this flag will
+ * probably need to go away.
+ */
+ *flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE;
+ }
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5FD_vfd_swmr_query() */
+} /* end H5FD__vfd_swmr_query() */
/*-------------------------------------------------------------------------
- * Function: H5FD_vfd_swmr_get_eoa
+ * Function: H5FD__vfd_swmr_get_eoa
*
* Purpose: Gets the end-of-address marker for the file for the
* underlying HDF5 file. The EOA marker is the first address
@@ -638,51 +630,49 @@ H5FD_vfd_swmr_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /*
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_vfd_swmr_get_eoa(const H5FD_t *_file, H5FD_mem_t type)
+H5FD__vfd_swmr_get_eoa(const H5FD_t *_file, H5FD_mem_t type)
{
const H5FD_vfd_swmr_t *file = (const H5FD_vfd_swmr_t *)_file;
haddr_t ret_value = HADDR_UNDEF;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
if ((ret_value = H5FD_get_eoa(file->hdf5_file_lf, type)) == HADDR_UNDEF)
-
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, HADDR_UNDEF, "unable to get HDF5 file eoa")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to get HDF5 file eoa")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_vfd_swmr_get_eoa() */
+} /* end H5FD__vfd_swmr_get_eoa() */
/*-------------------------------------------------------------------------
- * Function: H5FD_vfd_swmr_set_eoa
+ * Function: H5FD__vfd_swmr_set_eoa
*
* Purpose: Set the end-of-address marker for the underlying HDF5 file.
* This function is called shortly after an existing HDF5 file
* is opened in order to tell the driver where the end of the
* HDF5 data is located.
*
- * Return: SUCCEED (Can't fail)
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_vfd_swmr_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr)
+H5FD__vfd_swmr_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr)
{
H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
if (H5FD_set_eoa(file->hdf5_file_lf, type, addr) < 0)
-
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set HDF5 file eoa")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to set HDF5 file eoa")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_vfd_swmr_set_eoa() */
+} /* end H5FD__vfd_swmr_set_eoa() */
/*-------------------------------------------------------------------------
- * Function: H5FD_vfd_swmr_get_eof
+ * Function: H5FD__vfd_swmr_get_eof
*
* Purpose: Returns the end-of-file marker, which is the greater of
* either the filesystem end-of-file or the HDF5 end-of-address
@@ -694,38 +684,37 @@ done:
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_vfd_swmr_get_eof(const H5FD_t *_file, H5FD_mem_t type)
+H5FD__vfd_swmr_get_eof(const H5FD_t *_file, H5FD_mem_t type)
{
const H5FD_vfd_swmr_t *file = (const H5FD_vfd_swmr_t *)_file;
haddr_t ret_value = HADDR_UNDEF;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* LATER: need to determine the metadata file or underlying HDF5 file ? */
if ((ret_value = H5FD_get_eof(file->hdf5_file_lf, type)) == HADDR_UNDEF)
-
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, HADDR_UNDEF, "unable to set file eoa")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to set file eoa")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_vfd_swmr_get_eof() */
+} /* end H5FD__vfd_swmr_get_eof() */
/*-------------------------------------------------------------------------
- * Function: H5FD_vfd_swmr_get_handle
+ * Function: H5FD__vfd_swmr_get_handle
*
- * Purpose: Returns the file handle for the underling HDF5 file
+ * Purpose: Returns the file handle for the underling HDF5 file
*
- * Returns: SUCCEED/FAIL
+ * Returns: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_vfd_swmr_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle)
+H5FD__vfd_swmr_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle)
{
H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
if (!file_handle)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid")
@@ -738,10 +727,10 @@ H5FD_vfd_swmr_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_vfd_swmr_get_handle() */
+} /* end H5FD__vfd_swmr_get_handle() */
/*-------------------------------------------------------------------------
- * Function: H5FD_vfd_swmr_read
+ * Function: H5FD__vfd_swmr_read
*
* Purpose: If the target page or multi-page metadata entry is
* defined in the current metadata file index, satisfy
@@ -776,8 +765,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, const haddr_t addr,
- size_t size, void *const buf /*out*/)
+H5FD__vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, const haddr_t addr,
+ size_t size, void *const buf /*out*/)
{
const size_t init_size = size;
haddr_t target_page;
@@ -792,7 +781,7 @@ H5FD_vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
if (file->writer)
return H5FD_read(file->hdf5_file_lf, type, addr, size, buf);
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(file && file->pub.cls);
HDassert(buf);
@@ -808,9 +797,9 @@ H5FD_vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
if (entry == NULL) {
/* Cannot find addr in index, read from the underlying hdf5 file */
- if (H5FD_read(file->hdf5_file_lf, type, addr, size, buf) < 0) {
- HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed");
- }
+ if (H5FD_read(file->hdf5_file_lf, type, addr, size, buf) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed")
+
HGOTO_DONE(SUCCEED);
}
@@ -848,7 +837,7 @@ H5FD_vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
} while (-1 == bytes_read && EINTR == errno);
if (-1 == bytes_read)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL,
+ HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL,
"error reading the page/multi-page entry from the md file")
HDassert(0 <= bytes_read && (size_t)bytes_read <= size);
@@ -871,30 +860,30 @@ H5FD_vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
H5_checksum_metadata(buf, entry->length, 0) != entry->chksum) {
H5FD_vfd_swmr_md_header tmp_header;
- if (H5FD__vfd_swmr_header_deserialize(file, &tmp_header) != TRUE) {
+ if (H5FD__vfd_swmr_header_deserialize(file, &tmp_header) != TRUE)
HGOTO_ERROR(H5E_VFL, H5E_CANTLOAD, FAIL,
- "checksum error in shadow file entry; could not load header");
- }
+ "checksum error in shadow file entry; could not load header")
- HGOTO_ERROR(H5E_VFL, H5E_CANTLOAD, FAIL, "checksum error in shadow file entry");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTLOAD, FAIL, "checksum error in shadow file entry")
}
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_vfd_swmr_read() */
+} /* end H5FD__vfd_swmr_read() */
-/*
- * Function: H5FD_vfd_swmr_write
+/*-------------------------------------------------------------------------
+ * Function: H5FD__vfd_swmr_write
*
* Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR
* from buffer BUF according to data transfer properties in
* DXPL_ID.
*
* Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
*/
static herr_t
-H5FD_vfd_swmr_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size,
- const void *buf)
+H5FD__vfd_swmr_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size,
+ const void *buf)
{
H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file;
@@ -904,7 +893,7 @@ H5FD_vfd_swmr_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id
HDassert(file->writer);
return H5FD_write(file->hdf5_file_lf, type, addr, size, buf);
-}
+} /* end H5FD__vfd_swmr_write() */
/*-------------------------------------------------------------------------
* Function: H5FD_vfd_swmr_truncate
@@ -917,20 +906,22 @@ H5FD_vfd_swmr_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_vfd_swmr_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
+H5FD__vfd_swmr_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
{
H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file; /* VFD SWMR file struct */
+ FUNC_ENTER_STATIC_NOERR
+
/* This routine should only be called if the VFD instance is opened
* for writing.
*/
HDassert(file->writer);
- return H5FD_truncate(file->hdf5_file_lf, closing);
+ FUNC_LEAVE_NOAPI(H5FD_truncate(file->hdf5_file_lf, closing))
}
/*-------------------------------------------------------------------------
- * Function: H5FD_vfd_swmr_lock
+ * Function: H5FD__vfd_swmr_lock
*
* Purpose: To place an advisory lock on the underlying HDF5 file.
*
@@ -939,25 +930,24 @@ H5FD_vfd_swmr_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t clos
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_vfd_swmr_lock(H5FD_t *_file, hbool_t rw)
+H5FD__vfd_swmr_lock(H5FD_t *_file, hbool_t rw)
{
H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file; /* VFD SWMR file struct */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(file);
if (H5FD_lock(file->hdf5_file_lf, rw) < 0)
-
- HGOTO_ERROR(H5E_IO, H5E_CANTLOCK, FAIL, "unable to lock the HDF5 file")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTLOCK, FAIL, "unable to lock the HDF5 file")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_vfd_swmr_lock() */
+} /* end H5FD__vfd_swmr_lock() */
/*-------------------------------------------------------------------------
- * Function: H5FD_vfd_swmr_unlock
+ * Function: H5FD__vfd_swmr_unlock
*
* Purpose: To remove the existing lock on the underlying HDF5 file
*
@@ -966,26 +956,25 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_vfd_swmr_unlock(H5FD_t *_file)
+H5FD__vfd_swmr_unlock(H5FD_t *_file)
{
H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file; /* VFD SWMR file struct */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(file);
if (H5FD_unlock(file->hdf5_file_lf) < 0)
-
- HGOTO_ERROR(H5E_IO, H5E_CANTUNLOCK, FAIL, "unable to unlock the HDF5 file")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCK, FAIL, "unable to unlock the HDF5 file")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_vfd_swmr_unlock() */
+} /* end H5FD__vfd_swmr_unlock() */
-/*
+/*-------------------------------------------------------------------------
* Function: H5FD__vfd_swmr_load_hdr_and_idx()
*
* Purpose: Load and decode the header and index in the metadata file
@@ -1029,18 +1018,19 @@ done:
* Return: Success: SUCCEED
* Failure: FAIL
*
+ *-------------------------------------------------------------------------
*/
static herr_t
H5FD__vfd_swmr_load_hdr_and_idx(H5FD_vfd_swmr_t *file, hbool_t open)
{
hbool_t do_try;
h5_retry_t retry;
- H5FD_vfd_swmr_md_header md_header; /* Metadata file header, take 1 */
- H5FD_vfd_swmr_md_header md_header_two; /* Metadata file header, take 2 */
- H5FD_vfd_swmr_md_index md_index; /* Metadata file index */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FD_vfd_swmr_md_header md_header; /* Metadata file header, take 1 */
+ H5FD_vfd_swmr_md_header md_header_two; /* Metadata file header, take 2 */
+ H5FD_vfd_swmr_md_index md_index; /* Metadata file index */
htri_t rc;
static uint64_t last_index_offset = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1058,7 +1048,7 @@ H5FD__vfd_swmr_load_hdr_and_idx(H5FD_vfd_swmr_t *file, hbool_t open)
continue;
if (rc != TRUE)
- HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "could not read header");
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "could not read header")
if (md_header.index_offset != last_index_offset)
last_index_offset = md_header.index_offset;
@@ -1070,12 +1060,11 @@ H5FD__vfd_swmr_load_hdr_and_idx(H5FD_vfd_swmr_t *file, hbool_t open)
* time, then there is not a complete new index to read, so
* get out.
*/
- HGOTO_DONE(SUCCEED);
+ HGOTO_DONE(SUCCEED)
}
- else if (md_header.tick_num < file->md_header.tick_num) {
+ else if (md_header.tick_num < file->md_header.tick_num)
/* The tick number must not move backward. */
- HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "tick number in header moved backwards");
- }
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "tick number in header moved backwards")
HDassert(md_header.tick_num > file->md_header.tick_num || open);
@@ -1088,7 +1077,7 @@ H5FD__vfd_swmr_load_hdr_and_idx(H5FD_vfd_swmr_t *file, hbool_t open)
continue;
if (rc != TRUE)
- HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "could not read index");
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "could not read index")
/* If the tick_num is the same in both header and index,
* and the header reads the same the second time as the first time,
@@ -1108,18 +1097,16 @@ H5FD__vfd_swmr_load_hdr_and_idx(H5FD_vfd_swmr_t *file, hbool_t open)
(H5FD_vfd_swmr_idx_entry_t *)H5FL_SEQ_FREE(H5FD_vfd_swmr_idx_entry_t, md_index.entries);
}
- if (rc == FAIL) {
- HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "could not re-read header");
- }
+ if (rc == FAIL)
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "could not re-read header")
}
/* Exhaust all retries for loading and decoding the md file header
* and index
*/
- if (!do_try) {
+ if (!do_try)
HGOTO_ERROR(H5E_VFL, H5E_CANTLOAD, FAIL,
"error in loading/decoding the metadata file header and index")
- }
/* Free VFD local entries */
if (file->md_index.entries != NULL) {
@@ -1170,30 +1157,28 @@ H5FD__vfd_swmr_header_deserialize(H5FD_vfd_swmr_t *file, H5FD_vfd_swmr_md_header
FUNC_ENTER_STATIC
/* Set file pointer to the beginning the file */
- if (HDlseek(file->md_fd, H5FD_MD_HEADER_OFF, SEEK_SET) < 0) {
- HGOTO_ERROR(H5E_VFL, H5E_SEEKERROR, FAIL, "unable to seek in metadata file");
- }
+ if (HDlseek(file->md_fd, H5FD_MD_HEADER_OFF, SEEK_SET) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_SEEKERROR, FAIL, "unable to seek in metadata file")
/* Read the header */
nread = HDread(file->md_fd, image, H5FD_MD_HEADER_SIZE);
/* Try again if a signal interrupted the read. */
if (nread == -1 && errno == EINTR)
- HGOTO_DONE(FALSE);
+ HGOTO_DONE(FALSE)
/* We cannot recover from any other error by trying again,
* so bail out.
*/
- if (nread == -1) {
- HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "error in reading the shadow header");
- }
+ if (nread == -1)
+ HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "error in reading the shadow header")
if ((uint64_t)nread < H5FD_MD_HEADER_SIZE)
- HGOTO_DONE(FALSE);
+ HGOTO_DONE(FALSE)
/* Verify magic number */
if (HDmemcmp(image, H5FD_MD_HEADER_MAGIC, H5_SIZEOF_MAGIC) != 0)
- HGOTO_DONE(FALSE);
+ HGOTO_DONE(FALSE)
/* Verify stored and computed checksums are equal */
H5F_get_checksums(image, H5FD_MD_HEADER_SIZE, &stored_chksum, &computed_chksum);
@@ -1208,9 +1193,8 @@ H5FD__vfd_swmr_header_deserialize(H5FD_vfd_swmr_t *file, H5FD_vfd_swmr_md_header
UINT32DECODE(p, md_header->fs_page_size);
UINT64DECODE(p, md_header->tick_num);
UINT64DECODE(p, md_header->index_offset);
- if ((index_length = uint64_decode(&p)) > SIZE_MAX) {
- HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "index is too large to hold in core");
- }
+ if ((index_length = uint64_decode(&p)) > SIZE_MAX)
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "index is too large to hold in core")
md_header->index_length = (size_t)index_length;
@@ -1266,28 +1250,24 @@ H5FD__vfd_swmr_index_deserialize(const H5FD_vfd_swmr_t *file, H5FD_vfd_swmr_md_i
FUNC_ENTER_STATIC
/* Allocate buffer for reading index */
- if (NULL == (image = H5MM_malloc(md_header->index_length))) {
- HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL,
- "memory allocation failed for index's on disk image buffer");
- }
+ if (NULL == (image = H5MM_malloc(md_header->index_length)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "memory allocation failed for index's on disk image buffer")
/* We may seek past EOF. That's ok, the read(2) will catch that. */
- if (HDlseek(file->md_fd, (HDoff_t)md_header->index_offset, SEEK_SET) < 0) {
- HGOTO_ERROR(H5E_VFL, H5E_SEEKERROR, FAIL, "unable to seek in metadata file");
- }
+ if (HDlseek(file->md_fd, (HDoff_t)md_header->index_offset, SEEK_SET) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_SEEKERROR, FAIL, "unable to seek in metadata file")
nread = HDread(file->md_fd, image, md_header->index_length);
/* Try again if a signal interrupted the read. */
if (nread == -1 && errno == EINTR)
- HGOTO_DONE(FALSE);
+ HGOTO_DONE(FALSE)
/* We cannot recover from any other error by trying again,
* so bail out.
*/
- if (nread == -1) {
- HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "error in reading the header in metadata file");
- }
+ if (nread == -1)
+ HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "error in reading the header in metadata file")
/* Try again if the read was not full.
*
@@ -1302,7 +1282,7 @@ H5FD__vfd_swmr_index_deserialize(const H5FD_vfd_swmr_t *file, H5FD_vfd_swmr_md_i
* like an unrecoverable error instead of retrying.
*/
if ((size_t)nread < md_header->index_length)
- HGOTO_DONE(FALSE);
+ HGOTO_DONE(FALSE)
/* If the index magic is incorrect, then assume that is a
* temporary error and try again.
@@ -1323,7 +1303,7 @@ H5FD__vfd_swmr_index_deserialize(const H5FD_vfd_swmr_t *file, H5FD_vfd_swmr_md_i
* re-reading the header.
*/
if (HDmemcmp(image, H5FD_MD_INDEX_MAGIC, H5_SIZEOF_MAGIC) != 0)
- HGOTO_DONE(FALSE);
+ HGOTO_DONE(FALSE)
/* Verify stored and computed checksums are equal */
H5F_get_checksums(image, md_header->index_length, &stored_chksum, &computed_chksum);
@@ -1343,9 +1323,8 @@ H5FD__vfd_swmr_index_deserialize(const H5FD_vfd_swmr_t *file, H5FD_vfd_swmr_md_i
if (md_index->num_entries) {
/* Allocate memory for index entries */
md_index->entries = H5FL_SEQ_CALLOC(H5FD_vfd_swmr_idx_entry_t, md_index->num_entries);
- if (NULL == md_index->entries) {
- HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "memory allocation failed for index entries");
- }
+ if (NULL == md_index->entries)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "memory allocation failed for index entries")
/* Decode index entries */
for (i = 0; i < md_index->num_entries; i++) {
@@ -1419,9 +1398,8 @@ H5FD_vfd_swmr_get_tick_and_idx(H5FD_t *_file, hbool_t reload_hdr_and_index, uint
FUNC_ENTER_NOAPI(FAIL)
/* Load and decode the header and index as indicated */
- if (reload_hdr_and_index && H5FD__vfd_swmr_load_hdr_and_idx(file, FALSE) < 0) {
+ if (reload_hdr_and_index && H5FD__vfd_swmr_load_hdr_and_idx(file, FALSE) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTLOAD, FAIL, "unable to load/decode md header and index")
- }
/* Return tick_num */
if (tick_ptr != NULL)
@@ -1429,9 +1407,8 @@ H5FD_vfd_swmr_get_tick_and_idx(H5FD_t *_file, hbool_t reload_hdr_and_index, uint
if (index != NULL) {
- if (*num_entries_ptr < file->md_index.num_entries) {
- HGOTO_ERROR(H5E_VFL, H5E_CANTLOAD, FAIL, "not enough space to copy index");
- }
+ if (*num_entries_ptr < file->md_index.num_entries)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTLOAD, FAIL, "not enough space to copy index")
HDmemcpy(index, file->md_index.entries,
(file->md_index.num_entries * sizeof(file->md_index.entries[0])));
@@ -1475,10 +1452,8 @@ H5FD_vfd_swmr_dump_status(H5FD_t *_file, uint64_t page)
while ((!in_index) && (i < (int)num_entries)) {
- if (index[i].hdf5_page_offset == page) {
-
+ if (index[i].hdf5_page_offset == page)
in_index = TRUE;
- }
HDassert((i == 0) || (index[i - 1].hdf5_page_offset < index[i].hdf5_page_offset));
@@ -1527,15 +1502,29 @@ H5FD_vfd_swmr_set_pb_configured(H5FD_t *_file)
} /* H5FD_vfd_swmr_set_pb_configured() */
-/* In the histogram of ticks spent in API calls, increase the bucket
- * for `elapsed` ticks by one.
+/*-------------------------------------------------------------------------
+ * Function: H5FD_vfd_swmr_record_elapsed_ticks
+ *
+ * Purpose: In the histogram of ticks spent in API calls, increase
+ * the bucket for `elapsed` ticks by one.
+ *
+ * Return: VOID
+ *
+ * Programmer: JRM -- 1/29/19
+ *
+ *-------------------------------------------------------------------------
+ *
*/
void
H5FD_vfd_swmr_record_elapsed_ticks(H5FD_t *_file, uint64_t elapsed)
{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file;
uint32_t elapsed_idx = MIN(elapsed, file->api_elapsed_nbuckets);
file->api_elapsed_ticks[elapsed_idx]++;
-}
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5FD_vfd_swmr_record_elapsed_ticks() */
diff --git a/src/H5FDvfd_swmr.h b/src/H5FDvfd_swmr.h
index d85cc95..096d5fb 100644
--- a/src/H5FDvfd_swmr.h
+++ b/src/H5FDvfd_swmr.h
@@ -16,10 +16,6 @@
#ifndef H5FDvfd_swmr_H
#define H5FDvfd_swmr_H
-#include "H5api_adpt.h" /* H5_DLL */
-#include "H5public.h" /* uint64_t *ahem* */
-#include "H5Ipublic.h" /* hid_t */
-
#define H5FD_VFD_SWMR (H5FD_vfd_swmr_init())
#ifdef __cplusplus
@@ -33,4 +29,4 @@ H5_DLL herr_t H5Pset_fapl_vfd_swmr(hid_t fapl_id);
}
#endif
-#endif /* H5FDvfd_swmr_H */
+#endif
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 44506b6..247a047 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -1575,12 +1575,6 @@ H5F__dest(H5F_t *f, hbool_t flush)
/* Push error, but keep going*/
HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "vfd swmr prep for flush or close failed")
- if ((f->shared->vfd_swmr) && (!f->shared->vfd_swmr_writer))
- HDfprintf(stdout,
- "The maximum jump in ticks is %" PRIu64
- "; The maximum expected lag configured is %" PRIu32 "\n",
- f->shared->max_jump_ticks, f->shared->vfd_swmr_config.max_lag);
-
/* Shutdown the page buffer cache */
if (H5PB_dest(f->shared) < 0)
/* Push error, but keep going*/
@@ -1932,9 +1926,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* Avoid reusing a virtual file opened exclusively by a second virtual
* file, or opening the same file twice with different parameters.
*/
- if ((lf = H5FD_deduplicate(lf, fapl_id)) == NULL) {
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "an already-open file conflicts with '%s'", name);
- }
+ if ((lf = H5FD_deduplicate(lf, fapl_id)) == NULL)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "an already-open file conflicts with '%s'", name)
/* Is the file already open? */
if ((shared = H5F__sfile_search(lf)) != NULL) {
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 0fc4cc6..56f7145 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -1901,48 +1901,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O__attr_bh_info() */
-
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-
-/*-------------------------------------------------------------------------
- * Function: H5O__attr_count
- *
- * Purpose: Determine the # of attributes on an object
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: Quincey Koziol
- * Monday, December 11, 2006
- *
- *-------------------------------------------------------------------------
- */
-int
-H5O__attr_count(const H5O_loc_t *loc)
-{
- H5O_t * oh = NULL; /* Pointer to actual object header */
- hsize_t nattrs; /* Number of attributes */
- int ret_value = -1; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Check arguments */
- HDassert(loc);
-
- /* Protect the object header to iterate over */
- if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
-
- /* Retrieve # of attributes on object */
- if (H5O__attr_count_real(loc->file, oh, &nattrs) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute count")
-
- /* Set return value */
- ret_value = (int)nattrs;
-
-done:
- if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O__attr_count */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index de67dfd..046b046 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -159,6 +159,16 @@
#define H5D_XFER_XFORM_COPY H5P__dxfr_xform_copy
#define H5D_XFER_XFORM_CMP H5P__dxfr_xform_cmp
#define H5D_XFER_XFORM_CLOSE H5P__dxfr_xform_close
+/* Definitions for dataset I/O selection property */
+#define H5D_XFER_DSET_IO_SEL_SIZE sizeof(H5S_t *)
+#define H5D_XFER_DSET_IO_SEL_DEF NULL
+#define H5D_XFER_DSET_IO_SEL_COPY H5P__dxfr_dset_io_hyp_sel_copy
+#define H5D_XFER_DSET_IO_SEL_CMP H5P__dxfr_dset_io_hyp_sel_cmp
+#define H5D_XFER_DSET_IO_SEL_CLOSE H5P__dxfr_dset_io_hyp_sel_close
+#ifdef QAK
+#define H5D_XFER_DSET_IO_SEL_ENC H5P__dxfr_edc_enc
+#define H5D_XFER_DSET_IO_SEL_DEC H5P__dxfr_edc_dec
+#endif /* QAK */
/******************/
/* Local Typedefs */
@@ -196,6 +206,9 @@ static herr_t H5P__dxfr_xform_del(hid_t prop_id, const char *name, size_t size,
static herr_t H5P__dxfr_xform_copy(const char *name, size_t size, void *value);
static int H5P__dxfr_xform_cmp(const void *value1, const void *value2, size_t size);
static herr_t H5P__dxfr_xform_close(const char *name, size_t size, void *value);
+static herr_t H5P__dxfr_dset_io_hyp_sel_copy(const char *name, size_t size, void *value);
+static int H5P__dxfr_dset_io_hyp_sel_cmp(const void *value1, const void *value2, size_t size);
+static herr_t H5P__dxfr_dset_io_hyp_sel_close(const char *name, size_t size, void *value);
/*********************/
/* Package Variables */
@@ -262,7 +275,9 @@ static const H5Z_EDC_t H5D_def_enable_edc_g = H5D_XFER_EDC_DEF; /* Default
static const H5Z_cb_t H5D_def_filter_cb_g = H5D_XFER_FILTER_CB_DEF; /* Default value for filter callback */
static const H5T_conv_cb_t H5D_def_conv_cb_g =
H5D_XFER_CONV_CB_DEF; /* Default value for datatype conversion callback */
-static const void *H5D_def_xfer_xform_g = H5D_XFER_XFORM_DEF; /* Default value for data transform */
+static const void * H5D_def_xfer_xform_g = H5D_XFER_XFORM_DEF; /* Default value for data transform */
+static const H5S_t *H5D_def_dset_io_sel_g =
+ H5D_XFER_DSET_IO_SEL_DEF; /* Default value for dataset I/O selection */
/*-------------------------------------------------------------------------
* Function: H5P__dxfr_reg_prop
@@ -420,6 +435,13 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass)
H5D_XFER_XFORM_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ /* Register the dataset I/O selection property */
+ if (H5P__register_real(pclass, H5D_XFER_DSET_IO_SEL_NAME, H5D_XFER_DSET_IO_SEL_SIZE,
+ &H5D_def_dset_io_sel_g, NULL, NULL, NULL, NULL, NULL, NULL,
+ H5D_XFER_DSET_IO_SEL_COPY, H5D_XFER_DSET_IO_SEL_CMP,
+ H5D_XFER_DSET_IO_SEL_CLOSE) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__dxfr_reg_prop() */
@@ -894,7 +916,7 @@ H5P__dxfr_xform_cmp(const void *_xform1, const void *_xform2, size_t H5_ATTR_UNU
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P__dxfr_xform_copy() */
+} /* end H5P__dxfr_xform_cmp() */
/*-------------------------------------------------------------------------
* Function: H5P__dxfr_xform_close
@@ -965,7 +987,7 @@ H5Pset_data_transform(hid_t plist_id, const char *expression)
/* Create data transform info from expression */
if (NULL == (data_xform_prop = H5Z_xform_create(expression)))
- HGOTO_ERROR(H5E_PLINE, H5E_NOSPACE, FAIL, "unable to create data transform info")
+ HGOTO_ERROR(H5E_PLIST, H5E_NOSPACE, FAIL, "unable to create data transform info")
/* Update property list (takes ownership of transform) */
if (H5P_poke(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0)
@@ -974,7 +996,7 @@ H5Pset_data_transform(hid_t plist_id, const char *expression)
done:
if (ret_value < 0)
if (data_xform_prop && H5Z_xform_destroy(data_xform_prop) < 0)
- HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression")
+ HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release data transform expression")
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_data_transform() */
@@ -2109,3 +2131,251 @@ H5P__dxfr_edc_dec(const void **_pp, void *_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__dxfr_edc_dec() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_dset_io_hyp_sel_copy
+ *
+ * Purpose: Creates a copy of the dataset I/O selection.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Sunday, January 31, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_dset_io_hyp_sel_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value)
+{
+ H5S_t *orig_space = *(H5S_t **)value; /* Original dataspace for property */
+ H5S_t *new_space = NULL; /* New dataspace for property */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* If there's a dataspace I/O selection set, copy it */
+ if (orig_space) {
+ /* Make copy of dataspace */
+ if (NULL == (new_space = H5S_copy(orig_space, FALSE, TRUE)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "error copying the dataset I/O selection")
+
+ /* Set new value for property */
+ *(void **)value = new_space;
+ } /* end if */
+
+done:
+ /* Cleanup on error */
+ if (ret_value < 0)
+ if (new_space && H5S_close(new_space) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing dataset I/O selection dataspace")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__dxfr_dset_io_hyp_sel_copy() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_dset_io_hyp_sel_cmp
+ *
+ * Purpose: Compare two dataset I/O selections.
+ *
+ * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is
+ * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal.
+ *
+ * Programmer: Quincey Koziol
+ * Sunday, January 31, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5P__dxfr_dset_io_hyp_sel_cmp(const void *_space1, const void *_space2, size_t H5_ATTR_UNUSED size)
+{
+ const H5S_t *const *space1 = (const H5S_t *const *)_space1; /* Create local aliases for values */
+ const H5S_t *const *space2 = (const H5S_t *const *)_space2; /* Create local aliases for values */
+ herr_t ret_value = 0; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(space1);
+ HDassert(space1);
+ HDassert(size == sizeof(H5S_t *));
+
+ /* Check for a property being set */
+ if (*space1 == NULL && *space2 != NULL)
+ HGOTO_DONE(-1);
+ if (*space1 != NULL && *space2 == NULL)
+ HGOTO_DONE(1);
+
+ if (*space1) {
+ HDassert(*space2);
+
+ /* Compare the extents of the dataspaces */
+ /* (Error & not-equal count the same) */
+ if (TRUE != H5S_extent_equal(*space1, *space2))
+ HGOTO_DONE(-1);
+
+ /* Compare the selection "shape" of the dataspaces */
+ /* (Error & not-equal count the same) */
+ if (TRUE != H5S_select_shape_same(*space1, *space2))
+ HGOTO_DONE(-1);
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__dxfr_dset_io_hyp_sel_cmp() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_dset_io_hyp_sel_close
+ *
+ * Purpose: Frees resources for dataset I/O selection
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Sunday, January 31, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_dset_io_hyp_sel_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *_value)
+{
+ H5S_t *space = *(H5S_t **)_value; /* Dataspace for property */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Release any dataspace */
+ if (space && H5S_close(space) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing dataset I/O selection dataspace")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__dxfr_dset_io_hyp_sel_close() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_dataset_io_hyperslab_selection
+ *
+ * Purpose: H5Pset_dataset_io_hyperslab_selection() is designed to be used
+ * in conjunction with using H5S_PLIST for the file dataspace
+ * ID when making a call to H5Dread() or H5Dwrite(). When used
+ * with H5S_PLIST, the selection created by one or more calls to
+ * this routine is used for determining which dataset elements to
+ * access.
+ *
+ * 'rank' is the dimensionality of the selection and determines
+ * the size of the 'start', 'stride', 'count', and 'block' arrays.
+ * 'rank' must be between 1 and H5S_MAX_RANK, inclusive.
+ *
+ * The 'op', 'start', 'stride', 'count', and 'block' parameters
+ * behave identically to their behavior for H5Sselect_hyperslab(),
+ * please see the documentation for that routine for details about
+ * their use.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 30, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper_t op, const hsize_t start[],
+ const hsize_t stride[], const hsize_t count[], const hsize_t block[])
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5S_t * space; /* Dataspace to hold selection */
+ hbool_t space_created = FALSE; /* Whether a new dataspace has been created */
+ hbool_t reset_prop_on_error = FALSE; /* Whether to reset the property on failure */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "iIuSs*h*h*h*h", plist_id, rank, op, start, stride, count, block);
+
+ /* Check arguments */
+ if (rank < 1 || rank > H5S_MAX_RANK)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank value: %u", rank)
+ if (!(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID))
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
+ if (start == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "'count' pointer is NULL")
+ if (stride != NULL) {
+ unsigned u; /* Local index variable */
+
+ /* Check for 0-sized strides */
+ for (u = 0; u < rank; u++)
+ if (stride[u] == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid value - stride[%u]==0", u)
+ } /* end if */
+ if (count == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "'start' pointer is NULL")
+ /* block is allowed to be NULL, and will be assumed to be all '1's when NULL */
+
+ /* Get the plist structure */
+ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
+
+ /* See if a dataset I/O selection is already set, and free it if it is */
+ if (H5P_peek(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting dataset I/O selection")
+
+ /* Check for operation on existing dataspace selection */
+ if (NULL != space) {
+ int sndims; /* Rank of existing dataspace */
+
+ /* Get dimensions from current dataspace for selection */
+ if ((sndims = H5S_GET_EXTENT_NDIMS(space)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get selection's dataspace rank")
+
+ /* Check for different # of dimensions */
+ if ((unsigned)sndims != rank) {
+ /* Set up new dataspace for 'set' operation, otherwise fail */
+ if (op == H5S_SELECT_SET) {
+ /* Close previous dataspace */
+ if (H5S_close(space) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
+
+ /* Reset 'space' pointer, so it's re-created */
+ space = NULL;
+
+ /* Set flag to reset property list on error */
+ reset_prop_on_error = TRUE;
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "different rank for previous and new selections")
+ } /* end if */
+ } /* end if */
+
+ /* Check for first time called */
+ if (NULL == space) {
+ hsize_t dims[H5S_MAX_RANK]; /* Dimensions for new dataspace */
+ unsigned u; /* Local index variable */
+
+ /* Initialize dimensions to largest possible actual size */
+ for (u = 0; u < rank; u++)
+ dims[u] = (H5S_UNLIMITED - 1);
+
+ /* Create dataspace of the correct dimensionality, with maximum dimensions */
+ if (NULL == (space = H5S_create_simple(rank, dims, NULL)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create dataspace for selection")
+ space_created = TRUE;
+ } /* end if */
+
+ /* Set selection for dataspace */
+ if (H5S_select_hyperslab(space, op, start, stride, count, block) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSELECT, FAIL, "can't create selection")
+
+ /* Update property list (takes ownership of dataspace, if new) */
+ if (H5P_poke(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "error setting dataset I/O selection")
+ space_created = FALSE; /* Reset now that property owns the dataspace */
+
+done:
+ /* Cleanup on failure */
+ if (ret_value < 0) {
+ if (reset_prop_on_error && H5P_poke(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0)
+ HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "error setting dataset I/O selection")
+ if (space_created && H5S_close(space) < 0)
+ HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
+ } /* end if */
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_dataset_io_hyperslab_selection() */
diff --git a/src/H5S.c b/src/H5S.c
index 747d297..13d32cf 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -84,7 +84,7 @@ H5FL_ARR_DEFINE(hsize_t, H5S_MAX_RANK);
static const H5I_class_t H5I_DATASPACE_CLS[1] = {{
H5I_DATASPACE, /* ID class value */
0, /* Class flags */
- 2, /* # of reserved IDs for class */
+ 3, /* # of reserved IDs for class */
(H5I_free_t)H5S__close_cb /* Callback routine for closing objects of this class */
}};
@@ -277,55 +277,6 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5S_get_validiated_dataspace
- PURPOSE
- Get a pointer to a validated H5S_t pointer
- USAGE
- H5S_t *H5S_get_validated_space(dataspace_id, space)
- hid_t space_id; IN: The ID of the dataspace
- const H5S_t * space; OUT: A pointer to the dataspace
- RETURNS
- SUCCEED/FAIL
- DESCRIPTION
- Gets a pointer to a dataspace struct after validating it. The pointer
- can be NULL (if the ID is H5S_ALL, for example).
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(space);
-
- /* Check for invalid ID */
- if (space_id < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid space_id (ID cannot be a negative number)")
-
- /* No special dataspace struct for H5S_ALL */
- if (H5S_ALL == space_id)
- *space = NULL;
- else {
- /* Get the dataspace pointer */
- if (NULL == (*space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "space_id is not a dataspace ID")
-
- /* Check for valid selection */
- if (H5S_SELECT_VALID(*space) != TRUE)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection + offset not within extent")
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_get_validated_dataspace() */
-
-/*--------------------------------------------------------------------------
- NAME
H5S_create
PURPOSE
Create empty, typed dataspace
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 56c1646..51a98a6 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -217,7 +217,6 @@ H5_DLL htri_t H5S_set_extent(H5S_t *space, const hsize_t *size);
H5_DLL herr_t H5S_set_extent_real(H5S_t *space, const hsize_t *size);
H5_DLL herr_t H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, const hsize_t *max);
H5_DLL H5S_t *H5S_create(H5S_class_t type);
-H5_DLL herr_t H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space /*out*/);
H5_DLL H5S_t *H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/*rank*/]);
H5_DLL herr_t H5S_set_version(H5F_t *f, H5S_t *ds);
H5_DLL herr_t H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc);
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index c2c0aef..7962035 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -21,8 +21,12 @@
#include "H5public.h"
#include "H5Ipublic.h"
-/* Define atomic datatypes */
-#define H5S_ALL 0 /* (hid_t) */
+/* Define special dataspaces for dataset I/O operations */
+#define H5S_ALL 0 /* (hid_t) */
+#define H5S_BLOCK 1 /* (hid_t) */
+#define H5S_PLIST 2 /* (hid_t) */
+
+/* Define value for 'unlimited' dimensions */
#define H5S_UNLIMITED HSIZE_UNDEF
/* Define user-level maximum number of dimensions */
diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c
index 978ecb3..3a7f105 100644
--- a/src/H5VLnative_dataset.c
+++ b/src/H5VLnative_dataset.c
@@ -49,6 +49,10 @@
/* Local Prototypes */
/********************/
+/* Helper routines for read/write API calls */
+static herr_t H5VL__native_dataset_io_setup(H5D_t *dset, hid_t dxpl_id, hid_t file_space_id,
+ hid_t mem_space_id, H5S_t **file_space, H5S_t **mem_space);
+
/*********************/
/* Package Variables */
/*********************/
@@ -62,6 +66,100 @@
/*******************/
/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_io_setup
+ *
+ * Purpose: Set up file and memory dataspaces for dataset I/O operation
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_dataset_io_setup(H5D_t *dset, hid_t dxpl_id, hid_t file_space_id, hid_t mem_space_id,
+ H5S_t **file_space, H5S_t **mem_space)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(dset);
+ HDassert(file_space && NULL == *file_space);
+ HDassert(mem_space && NULL == *mem_space);
+
+ /* Set up file dataspace */
+ if (H5S_ALL == file_space_id)
+ /* Use dataspace for dataset */
+ *file_space = dset->shared->space;
+ else if (H5S_BLOCK == file_space_id)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "H5S_BLOCK is not allowed for file dataspace")
+ else if (H5S_PLIST == file_space_id) {
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5S_t * space; /* Dataspace to hold selection */
+
+ /* Get the plist structure */
+ if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_DATASET, H5E_BADID, FAIL, "bad dataset transfer property list")
+
+ /* See if a dataset I/O selection is already set, and free it if it is */
+ if (H5P_peek(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting dataset I/O selection")
+
+ /* Use dataspace for dataset */
+ *file_space = dset->shared->space;
+
+ /* Copy, but share, selection from property list to dataset's dataspace */
+ if (H5S_SELECT_COPY(*file_space, space, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataset I/O selection")
+ } /* end else-if */
+ else {
+ /* Get the dataspace pointer */
+ if (NULL == (*file_space = (H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "file_space_id is not a dataspace ID")
+ } /* end else */
+
+ /* Get dataspace for memory buffer */
+ if (H5S_ALL == mem_space_id)
+ *mem_space = *file_space;
+ else if (H5S_BLOCK == mem_space_id) {
+ hsize_t nelmts; /* # of selected elements in file */
+
+ /* Get the # of elements selected */
+ nelmts = H5S_GET_SELECT_NPOINTS(*file_space);
+
+ /* Check for any elements */
+ if (nelmts > 0) {
+ /* Create a 1-D dataspace of the same # of elements */
+ if (NULL == (*mem_space = H5S_create_simple(1, &nelmts, NULL)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create simple memory dataspace")
+ } /* end if */
+ else {
+ /* Create a NULL dataspace of the same # of elements */
+ if (NULL == (*mem_space = H5S_create(H5S_NULL)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create NULL memory dataspace")
+ } /* end else */
+ } /* end if */
+ else if (H5S_PLIST == mem_space_id)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "H5S_PLIST is not allowed for memory dataspace")
+ else {
+ /* Get the dataspace pointer */
+ if (NULL == (*mem_space = (H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "mem_space_id is not a dataspace ID")
+ } /* end else */
+
+ /* Check for valid selections */
+ if (H5S_SELECT_VALID(*file_space) != TRUE)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL,
+ "selection + offset not within extent for file dataspace")
+ if (H5S_SELECT_VALID(*mem_space) != TRUE)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL,
+ "selection + offset not within extent for memory dataspace")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_io_setup() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__native_dataset_create
*
* Purpose: Handles the dataset create callback
@@ -172,10 +270,10 @@ herr_t
H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
hid_t dxpl_id, void *buf, void H5_ATTR_UNUSED **req)
{
- H5D_t * dset = (H5D_t *)obj;
- const H5S_t *mem_space = NULL;
- const H5S_t *file_space = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t *dset = (H5D_t *)obj;
+ H5S_t *mem_space = NULL;
+ H5S_t *file_space = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -183,11 +281,10 @@ H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_
if (NULL == dset->oloc.file)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
- /* Get validated dataspace pointers */
- if (H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id")
- if (H5S_get_validated_dataspace(file_space_id, &file_space) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id")
+ /* Get file & memory dataspaces */
+ if (H5VL__native_dataset_io_setup(dset, dxpl_id, file_space_id, mem_space_id, &file_space, &mem_space) <
+ 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up file and memory dataspaces")
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
@@ -197,6 +294,17 @@ H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
done:
+ /* Clean up */
+ if (H5S_BLOCK == mem_space_id && mem_space) {
+ if (H5S_close(mem_space) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL,
+ "unable to release temporary memory dataspace for H5S_BLOCK")
+ } /* end if */
+ else if (H5S_PLIST == file_space_id && file_space)
+ if (H5S_select_all(file_space, TRUE) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL,
+ "unable to release file dataspace selection for H5S_PLIST")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL__native_dataset_read() */
@@ -213,10 +321,10 @@ herr_t
H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
hid_t dxpl_id, const void *buf, void H5_ATTR_UNUSED **req)
{
- H5D_t * dset = (H5D_t *)obj;
- const H5S_t *mem_space = NULL;
- const H5S_t *file_space = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t *dset = (H5D_t *)obj;
+ H5S_t *mem_space = NULL;
+ H5S_t *file_space = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -224,11 +332,10 @@ H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid
if (NULL == dset->oloc.file)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
- /* Get validated dataspace pointers */
- if (H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id")
- if (H5S_get_validated_dataspace(file_space_id, &file_space) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id")
+ /* Get file & memory dataspaces */
+ if (H5VL__native_dataset_io_setup(dset, dxpl_id, file_space_id, mem_space_id, &file_space, &mem_space) <
+ 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up file and memory dataspaces")
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
@@ -238,6 +345,17 @@ H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
done:
+ /* Clean up */
+ if (H5S_BLOCK == mem_space_id && mem_space) {
+ if (H5S_close(mem_space) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL,
+ "unable to release temporary memory dataspace for H5S_BLOCK")
+ } /* end if */
+ else if (H5S_PLIST == file_space_id && file_space)
+ if (H5S_select_all(file_space, TRUE) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL,
+ "unable to release file dataspace selection for H5S_PLIST")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL__native_dataset_write() */
diff --git a/src/H5private.h b/src/H5private.h
index 0e2cdec..bb416ef 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -113,22 +113,21 @@
#define H5_DEFAULT_VOL H5VL_NATIVE
#ifdef H5_HAVE_WIN32_API
+
/* The following two defines must be before any windows headers are included */
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
#define NOGDI /* Exclude Graphic Display Interface macros */
-#ifdef H5_HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
+#include <windows.h>
+
+#include <direct.h> /* For _getcwd() */
+#include <io.h> /* POSIX I/O */
+#include <winsock2.h> /* For GetUserName() */
#ifdef H5_HAVE_THREADSAFE
#include <process.h> /* For _beginthread() */
#endif
-#include <windows.h>
-#include <direct.h> /* For _getcwd() */
-#include <io.h> /* POSIX I/O */
-
#endif /*H5_HAVE_WIN32_API*/
#ifndef F_OK
diff --git a/src/H5system.c b/src/H5system.c
index dcb77dd..adfb758 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -365,7 +365,7 @@ Wsetenv(const char *name, const char *value, int overwrite)
return (int)_putenv_s(name, value);
} /* end Wsetenv() */
-#ifdef H5_HAVE_WINSOCK2_H
+#ifdef H5_HAVE_WIN32_API
#pragma comment(lib, "advapi32.lib")
#endif
@@ -450,12 +450,12 @@ char *
Wgetlogin(void)
{
-#ifdef H5_HAVE_WINSOCK2_H
+#ifdef H5_HAVE_WIN32_API
DWORD bufferCount = WloginBuffer_count;
if (GetUserName(Wlogin_buffer, &bufferCount) != 0)
return (Wlogin_buffer);
else
-#endif /* H5_HAVE_WINSOCK2_H */
+#endif
return NULL;
}
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index e74b438..4c3233d 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -1466,6 +1466,10 @@ test_hdf5_src_subset(char *filename, hid_t fapl)
return 0;
error:
+ HDfree(orig);
+ HDfree(rbuf);
+ HDfree(rew_buf);
+
HDputs("*** DATASET TESTS FAILED ***");
return 1;
}
diff --git a/test/cross_read.c b/test/cross_read.c
index eef814f..cb71996 100644
--- a/test/cross_read.c
+++ b/test/cross_read.c
@@ -41,8 +41,10 @@ const char *FILENAME[] = {"vms_data", "le_data", "be_data", NULL};
#define DATASETNAME14 "Fletcher_float_data_le"
#define DATASETNAME15 "Fletcher_float_data_be"
+#ifdef H5_HAVE_FILTER_DEFLATE
#define DATASETNAME16 "Deflate_float_data_le"
#define DATASETNAME17 "Deflate_float_data_be"
+#endif
#ifdef H5_HAVE_FILTER_SZIP
#define DATASETNAME18 "Szip_float_data_le"
#define DATASETNAME19 "Szip_float_data_be"
diff --git a/test/direct_chunk.c b/test/direct_chunk.c
index 61e3df9..8960784 100644
--- a/test/direct_chunk.c
+++ b/test/direct_chunk.c
@@ -23,7 +23,9 @@
#define FILE_NAME "direct_chunk.h5"
/* Datasets for Direct Write tests */
+#ifdef H5_HAVE_FILTER_DEFLATE
#define DATASETNAME1 "direct_write"
+#endif
#define DATASETNAME2 "skip_one_filter"
#define DATASETNAME3 "skip_two_filters"
#define DATASETNAME4 "data_conv"
@@ -31,9 +33,11 @@
#define DATASETNAME6 "invalid_argue"
#define DATASETNAME7 "overwrite_chunk"
/* Datasets for Direct Read tests */
+#ifdef H5_HAVE_FILTER_DEFLATE
#define DATASETNAME8 "disabled_chunk_cache"
#define DATASETNAME9 "flush_chunk_cache"
#define DATASETNAME10 "read_w_valid_cache"
+#endif
#define DATASETNAME11 "unallocated_chunk"
#define DATASETNAME12 "unfiltered_data"
@@ -43,7 +47,9 @@
#define CHUNK_NX 4
#define CHUNK_NY 4
+#ifdef H5_HAVE_FILTER_DEFLATE
#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * 1.001) + 12.0)
+#endif
/* Temporary filter IDs used for testing */
#define H5Z_FILTER_BOGUS1 305
@@ -1990,23 +1996,23 @@ test_read_unallocated_chunk(hid_t file)
/* Create the data space with unlimited dimensions. */
if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Modify dataset creation properties, i.e. enable chunking, no compression */
if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Create a new dataset within the file using cparms creation properties. */
if ((dataset = H5Dcreate2(file, DATASETNAME11, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms,
H5P_DEFAULT)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Write a single chunk to intialize the chunk storage */
HDmemset(direct_buf, 0, CHUNK_NX * CHUNK_NY * sizeof(int));
@@ -2014,7 +2020,7 @@ test_read_unallocated_chunk(hid_t file)
offset[1] = 0;
if (H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, chunk_nbytes, direct_buf) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Attempt to read each chunk in the dataset. Chunks are not allocated,
* therefore we expect the result of H5Dread_chunk to fail. Chunk idx starts
@@ -2034,7 +2040,7 @@ test_read_unallocated_chunk(hid_t file)
/* Check that the chunk read call does not succeed. */
if (status != -1)
- goto error;
+ TEST_ERROR
/* Query the size of the non-existant chunk */
direct_chunk_nbytes = ULONG_MAX;
@@ -2046,18 +2052,23 @@ test_read_unallocated_chunk(hid_t file)
/* Check that the chunk storage size call does not succeed. */
if (status != -1)
- goto error;
- if (direct_chunk_nbytes != 0)
- goto error;
+ TEST_ERROR
+ if (direct_chunk_nbytes != ULONG_MAX)
+ TEST_ERROR
}
}
/* Close/release resources. */
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
+ if (H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR;
+ if (H5Sclose(mem_space) < 0)
+ FAIL_STACK_ERROR;
+ if (H5Sclose(dataspace) < 0)
+ FAIL_STACK_ERROR;
+ if (H5Pclose(cparms) < 0)
+ FAIL_STACK_ERROR;
+ if (H5Pclose(dxpl) < 0)
+ FAIL_STACK_ERROR;
PASSED();
return 0;
@@ -2121,103 +2132,100 @@ test_single_chunk(unsigned config)
TESTING("Single chunk I/O");
/* Initialize data */
- for (i = 0; i < DIM0; i++) {
+ for (i = 0; i < DIM0; i++)
for (j = 0; j < DIM1; j++)
wdata[i][j] = j / CHUNK0;
- }
/* Create a new file with the latest format */
if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (config & CONFIG_LATEST)
if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if ((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Create dataspace */
if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Create the dataset creation property list and set the chunk size */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (H5Pset_chunk(dcpl, 2, chunk) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Create the dataset */
if ((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (config & CONFIG_DIRECT_WRITE) {
/* Write the data directly to the dataset */
if (H5Dwrite_chunk(did, H5P_DEFAULT, 0, offset, CHUNK0 * CHUNK1 * 4, (void *)wdata) < 0)
- goto error;
+ FAIL_STACK_ERROR;
} /* end if */
else
/* Write the data to the dataset */
if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)wdata) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/*
* Close and release resources.
*/
if (H5Pclose(dcpl) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (config & CONFIG_REOPEN_DSET)
if (H5Dclose(did) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (H5Sclose(sid) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (H5Pclose(fapl) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (config & CONFIG_REOPEN_FILE)
if (H5Fclose(fid) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Open the file and dataset with default properties */
if (config & CONFIG_REOPEN_FILE)
if ((fid = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (config & CONFIG_REOPEN_DSET)
if ((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Retrieve dataset creation property list */
if ((dcpl = H5Dget_create_plist(did)) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (config & CONFIG_DIRECT_READ) {
/* Read the data directly */
if (H5Dread_chunk(did, H5P_DEFAULT, offset, &filters, rdata) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Verify returned filter mask */
if (filters != 0)
- goto error;
+ TEST_ERROR
} /* end if */
else
/* Read the data */
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
- goto error;
+ FAIL_STACK_ERROR;
/* Verify that the data read was correct. */
- for (i = 0; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++) {
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
if (rdata[i][j] != wdata[i][j])
- goto error;
- }
- }
+ TEST_ERROR
/*
* Close and release resources
*/
if (H5Pclose(dcpl) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (H5Dclose(did) < 0)
- goto error;
+ FAIL_STACK_ERROR;
if (H5Fclose(fid) < 0)
- goto error;
+ FAIL_STACK_ERROR;
PASSED();
return 0;
diff --git a/test/dsets.c b/test/dsets.c
index 96f8b81..3a17575 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -93,25 +93,29 @@ const char *FILENAME[] = {"dataset", /* 0 */
#define FILE_DEFLATE_NAME "deflate.h5"
/* Dataset names for testing filters */
-#define DSET_DEFAULT_NAME "default"
-#define DSET_CHUNKED_NAME "chunked"
-#define DSET_COMPACT_NAME "compact"
-#define DSET_SIMPLE_IO_NAME "simple_io"
-#define DSET_USERBLOCK_IO_NAME "userblock_io"
-#define DSET_COMPACT_IO_NAME "compact_io"
-#define DSET_COMPACT_MAX_NAME "max_compact"
-#define DSET_COMPACT_MAX2_NAME "max_compact_2"
-#define DSET_CONV_BUF_NAME "conv_buf"
-#define DSET_TCONV_NAME "tconv"
-#define DSET_DEFLATE_NAME "deflate"
-#define DSET_SHUFFLE_NAME "shuffle"
-#define DSET_FLETCHER32_NAME "fletcher32"
-#define DSET_FLETCHER32_NAME_2 "fletcher32_2"
-#define DSET_FLETCHER32_NAME_3 "fletcher32_3"
+#define DSET_DEFAULT_NAME "default"
+#define DSET_CHUNKED_NAME "chunked"
+#define DSET_COMPACT_NAME "compact"
+#define DSET_SIMPLE_IO_NAME "simple_io"
+#define DSET_USERBLOCK_IO_NAME "userblock_io"
+#define DSET_COMPACT_IO_NAME "compact_io"
+#define DSET_COMPACT_MAX_NAME "max_compact"
+#define DSET_COMPACT_MAX2_NAME "max_compact_2"
+#define DSET_CONV_BUF_NAME "conv_buf"
+#define DSET_TCONV_NAME "tconv"
+#ifdef H5_HAVE_FILTER_DEFLATE
+#define DSET_DEFLATE_NAME "deflate"
+#endif
+#define DSET_SHUFFLE_NAME "shuffle"
+#define DSET_FLETCHER32_NAME "fletcher32"
+#define DSET_FLETCHER32_NAME_2 "fletcher32_2"
+#define DSET_FLETCHER32_NAME_3 "fletcher32_3"
+#ifdef H5_HAVE_FILTER_DEFLATE
#define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32"
#define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2"
-#define DSET_OPTIONAL_SCALAR "dataset_with_scalar_space"
-#define DSET_OPTIONAL_VLEN "dataset_with_vlen_type"
+#endif
+#define DSET_OPTIONAL_SCALAR "dataset_with_scalar_space"
+#define DSET_OPTIONAL_VLEN "dataset_with_vlen_type"
#ifdef H5_HAVE_FILTER_SZIP
#define DSET_SZIP_NAME "szip"
#define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32"
@@ -1502,6 +1506,9 @@ test_conv_buffer(hid_t fid)
return SUCCEED;
error:
+ HDfree(cfrR);
+ HDfree(cf);
+
H5E_BEGIN_TRY
{
H5Pclose(xfer_list);
@@ -7160,6 +7167,7 @@ error:
H5E_END_TRY;
return FAIL;
#else
+ (void)file; /* Silence compiler */
SKIPPED();
return SUCCEED;
#endif
@@ -15407,6 +15415,7 @@ main(void)
/* Tests version bounds using its own file */
nerrors += (test_versionbounds() < 0 ? 1 : 0);
+ /* Tests that use their own file */
nerrors += (test_object_header_minimization_dcpl() < 0 ? 1 : 0);
/* Run misc tests */
diff --git a/test/dtypes.c b/test/dtypes.c
index 52eb0ea..2a18302 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -783,9 +783,12 @@ test_compound_2(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->a = i * 8 + 0;
@@ -857,6 +860,10 @@ test_compound_2(void)
return 0;
error:
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -903,9 +910,12 @@ test_compound_3(void)
FAIL_STACK_ERROR
/* Initialize */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->a = i * 8 + 0;
@@ -973,6 +983,10 @@ test_compound_3(void)
return 0;
error:
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -1023,9 +1037,12 @@ test_compound_4(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->a = i * 8 + 0;
@@ -1096,6 +1113,10 @@ test_compound_4(void)
return 0;
error:
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -1146,6 +1167,12 @@ test_compound_5(void)
TESTING("optimized struct converter");
+ if (!buf || !bkg) {
+ HDfree(buf);
+ HDfree(bkg);
+ return 1;
+ }
+
/* Build datatypes */
short_array = H5Tcreate(H5T_COMPOUND, 4 * sizeof(short));
array_dt = H5Tarray_create2(H5T_NATIVE_SHORT, 1, dims);
@@ -1238,9 +1265,12 @@ test_compound_6(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->b = (int16_t)((i * 8 + 1) & 0x7fff);
@@ -2290,6 +2320,8 @@ test_compound_11(void)
((big_t *)buf)[u].i1 = (int)(u * 3);
((big_t *)buf)[u].i2 = (int)(u * 5);
((big_t *)buf)[u].s1 = (char *)HDmalloc((size_t)32);
+ if (!((big_t *)buf)[u].s1)
+ TEST_ERROR
HDsprintf(((big_t *)buf)[u].s1, "%u", (unsigned)u);
} /* end for */
diff --git a/test/earray.c b/test/earray.c
index bf7dcf3..337e818 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -2087,7 +2087,7 @@ test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, h
/*
* Display testing message
*/
- TESTING("%s", test_str);
+ TESTING(test_str);
/* Create file & retrieve pointer to internal file object */
if (create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
@@ -2261,7 +2261,7 @@ test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam,
/*
* Display testing message
*/
- TESTING("%s", test_str);
+ TESTING(test_str);
/* Create file & retrieve pointer to internal file object */
if (create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
diff --git a/test/farray.c b/test/farray.c
index bb5e3fc..950c7a7 100644
--- a/test/farray.c
+++ b/test/farray.c
@@ -1361,7 +1361,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, h
/*
* Display testing message
*/
- TESTING("%s", test_str);
+ TESTING(test_str);
/* Create file & retrieve pointer to internal file object */
if (create_file(fapl, &file, &f) < 0)
@@ -1516,7 +1516,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
/*
* Display testing message
*/
- TESTING("%s", test_str);
+ TESTING(test_str);
/* Create file & retrieve pointer to internal file object */
if (create_file(fapl, &file, &f) < 0)
diff --git a/test/file_image.c b/test/file_image.c
index 4fb1ef3..0373468 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -102,8 +102,9 @@ test_properties(void)
* property list functions. In the file driver tests further down, this will
* not be the case.
*/
- size = (size_t)count * sizeof(char);
- buffer = (char *)HDmalloc(size);
+ size = (size_t)count * sizeof(char);
+ if (NULL == (buffer = (char *)HDmalloc(size)))
+ TEST_ERROR
for (i = 0; i < count - 1; i++)
buffer[i] = (char)(65 + i);
buffer[count - 1] = '\0';
@@ -338,8 +339,8 @@ test_callbacks(void)
H5FD_file_image_callbacks_t callbacks;
hid_t fapl_1;
hid_t fapl_2;
- udata_t * udata;
- char * file_image;
+ udata_t * udata = NULL;
+ char * file_image = NULL;
char * temp_file_image;
int count = 10;
int i;
@@ -350,6 +351,7 @@ test_callbacks(void)
/* Allocate and initialize udata */
udata = (udata_t *)HDmalloc(sizeof(udata_t));
+ VERIFY(udata != NULL, "udata malloc failed");
reset_udata(udata);
/* copy the address of the user data into read_callbacks */
@@ -358,6 +360,7 @@ test_callbacks(void)
/* Allocate and initialize file image buffer */
size = (size_t)count * sizeof(char);
file_image = (char *)HDmalloc(size);
+ VERIFY(file_image != NULL, "file_image malloc failed");
for (i = 0; i < count - 1; i++)
file_image[i] = (char)(65 + i);
file_image[count - 1] = '\0';
@@ -529,6 +532,9 @@ test_callbacks(void)
return 0;
error:
+ HDfree(file_image);
+ HDfree(udata);
+
return 1;
} /* test_callbacks() */
@@ -735,7 +741,7 @@ test_get_file_image(const char *test_banner, const int file_name_num, hid_t fapl
hid_t fcpl = -1;
herr_t ret;
- TESTING("%s", test_banner);
+ TESTING(test_banner);
/* set flag if we are dealing with a family file */
driver = H5Pget_driver(fapl);
diff --git a/test/h5test.c b/test/h5test.c
index 8f74e45..755ae93 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -148,29 +148,6 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data)
}
/*-------------------------------------------------------------------------
- * Function: h5_testing
- *
- * Purpose: Prints "Testing" + formatted options to stdout
- * Used in the TESTING macro
- *
- * Return: void
- *-------------------------------------------------------------------------
- */
-void
-h5_testing(const char *fmt, ...)
-{
- va_list ap;
- char buf[62 + 1]; /* room for 62-char field + NUL */
-
- HDva_start(ap, fmt);
- HDvsnprintf(buf, sizeof(buf), fmt, ap);
- HDva_end(ap);
-
- HDprintf("Testing %s", buf);
- HDfflush(stdout);
-}
-
-/*-------------------------------------------------------------------------
* Function: h5_clean_files
*
* Purpose: Cleanup temporary test files (always).
@@ -1218,9 +1195,10 @@ h5_set_info_object(void)
valp++;
/* copy key/value pair into temporary buffer */
- len = strcspn(valp, ";");
- next = &valp[len];
- key_val = (char *)HDcalloc(1, len + 1);
+ len = HDstrcspn(valp, ";");
+ next = &valp[len];
+ if (NULL == (key_val = (char *)HDcalloc(1, len + 1)))
+ return -1;
/* increment the next pointer past the terminating semicolon */
if (*next == ';')
@@ -1616,6 +1594,9 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name)
void * buf = NULL; /* Buffer for copying data */
const char *filename = H5_get_srcdir_filename(origfilename); /* Get the test file name to copy */
+ if (!filename)
+ goto error;
+
/* Allocate copy buffer */
if (NULL == (buf = HDcalloc((size_t)1, (size_t)READ_BUF_SIZE)))
goto error;
@@ -1944,7 +1925,6 @@ static const H5FD_class_t H5FD_dummy_g = {
NULL, /* lock */
NULL, /* unlock */
NULL, /* del */
- NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
diff --git a/test/h5test.h b/test/h5test.h
index 3736537..2855fb5 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -100,7 +100,11 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
* spaces. If the h5_errors() is used for automatic error handling then
* the H5_FAILED() macro is invoked automatically when an API function fails.
*/
-#define TESTING(...) h5_testing(__VA_ARGS__);
+#define TESTING(WHAT) \
+ { \
+ HDprintf("Testing %-62s", WHAT); \
+ HDfflush(stdout); \
+ }
#define TESTING_2(WHAT) \
{ \
HDprintf(" Testing %-60s", WHAT); \
@@ -157,13 +161,6 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
HDputs(s); \
goto error; \
}
-#define FAIL_PRINTF_ERROR(fmt, ...) \
- { \
- H5_FAILED(); \
- AT(); \
- HDprintf(fmt, __VA_ARGS__); \
- goto error; \
- }
/* Number of seconds to wait before killing a test (requires alarm(2)) */
#define H5_ALARM_SEC 1200 /* default is 20 minutes */
@@ -235,7 +232,6 @@ extern "C" {
#endif
/* Generally useful testing routines */
-H5TEST_DLL void h5_testing(const char *, ...) H5_ATTR_FORMAT(printf, 1, 2);
H5TEST_DLL void h5_clean_files(const char *base_name[], hid_t fapl);
H5TEST_DLL int h5_cleanup(const char *base_name[], hid_t fapl);
H5TEST_DLL char * h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size);
diff --git a/test/hyperslab.c b/test/hyperslab.c
index 41528ad..1f57e3b 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -1014,7 +1014,8 @@ test_array_fill(size_t lo, size_t hi)
size_t u, v, w; /* Local index variables */
char s[256];
- TESTING("array filling %4zu-%-4zu elements", lo, hi);
+ HDsprintf(s, "array filling %4lu-%-4lu elements", (unsigned long)lo, (unsigned long)hi);
+ TESTING(s);
/* Initialize */
if (NULL == (dst = (int *)HDcalloc(sizeof(int), ARRAY_FILL_SIZE * hi)))
@@ -1077,7 +1078,9 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
hsize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */
char s[256];
- TESTING("array offset %4zux%4zux%4zu elements", z, y, x);
+ HDsprintf(s, "array offset %4lux%4lux%4lu elements", (unsigned long)z, (unsigned long)y,
+ (unsigned long)x);
+ TESTING(s);
/* Initialize */
if (NULL == (a = (hsize_t *)HDmalloc(sizeof(hsize_t) * x * y * z)))
diff --git a/test/istore.c b/test/istore.c
index 192e184..c75b8bf 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -284,7 +284,8 @@ test_extend(hid_t f, const char *prefix, size_t nx, size_t ny, size_t nz)
HDsprintf(dims, "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz);
}
- TESTING("istore extend: %s", dims);
+ HDsprintf(s, "istore extend: %s", dims);
+ TESTING(s);
buf = (uint8_t *)HDmalloc(nx * ny * nz);
check = (uint8_t *)HDmalloc(nx * ny * nz);
whole = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz);
@@ -499,7 +500,8 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, size_t nx, size_t ny, s
HDsprintf(dims, "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz);
}
- TESTING("istore sparse: %s", dims);
+ HDsprintf(s, "istore sparse: %s", dims);
+ TESTING(s);
if (skip_test) {
SKIPPED()
return SUCCEED;
diff --git a/test/links.c b/test/links.c
index b2d0d9a..f022783 100644
--- a/test/links.c
+++ b/test/links.c
@@ -3507,6 +3507,7 @@ done:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
case H5I_SPACE_SEL_ITER:
+ case H5I_EVENTSET:
case H5I_NTYPES:
default:
return FAIL;
@@ -3597,6 +3598,7 @@ done:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
case H5I_SPACE_SEL_ITER:
+ case H5I_EVENTSET:
case H5I_NTYPES:
default:
return FAIL;
@@ -13785,6 +13787,7 @@ done:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
case H5I_SPACE_SEL_ITER:
+ case H5I_EVENTSET:
case H5I_NTYPES:
default:
return FAIL;
@@ -13876,6 +13879,7 @@ done:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
case H5I_SPACE_SEL_ITER:
+ case H5I_EVENTSET:
case H5I_NTYPES:
default:
return FAIL;
@@ -16683,7 +16687,7 @@ obj_exists(hid_t fapl, hbool_t new_format)
FAIL_STACK_ERROR
/* Hard links */
- /* Verify that H5Oexists_by_name() fails for non-existent link in root group */
+ /* Verify that H5Oexists_by_name() returns false for non-existent link in root group */
H5E_BEGIN_TRY
{
status = H5Oexists_by_name(fid, "foo", H5P_DEFAULT);
@@ -16702,7 +16706,7 @@ obj_exists(hid_t fapl, hbool_t new_format)
if (TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT))
TEST_ERROR
- /* Verify that H5Oexists_by_name() fails for non-existent link in non-root group */
+ /* Verify that H5Oexists_by_name() returns false for non-existent object in non-root group */
H5E_BEGIN_TRY
{
status = H5Oexists_by_name(fid, "group/foo", H5P_DEFAULT);
diff --git a/test/objcopy.c b/test/objcopy.c
index 43a5756..e01083d 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -4498,6 +4498,10 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
TESTING("H5Ocopy(): compressed dataset");
#ifndef H5_HAVE_FILTER_DEFLATE
+ (void)fcpl_src;
+ (void)fcpl_dst;
+ (void)src_fapl;
+ (void)dst_fapl; /* Silence compiler */
SKIPPED();
HDputs(" Deflation filter not available");
#else /* H5_HAVE_FILTER_DEFLATE */
@@ -4923,6 +4927,10 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
}
#ifndef H5_HAVE_FILTER_DEFLATE
+ (void)fcpl_src;
+ (void)fcpl_dst;
+ (void)src_fapl;
+ (void)dst_fapl; /* Silence compiler */
SKIPPED();
HDputs(" Deflation filter not available");
#else /* H5_HAVE_FILTER_DEFLATE */
@@ -7277,6 +7285,10 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
TESTING("H5Ocopy(): compressed dataset with VLEN datatype");
#ifndef H5_HAVE_FILTER_DEFLATE
+ (void)fcpl_src;
+ (void)fcpl_dst;
+ (void)src_fapl;
+ (void)dst_fapl; /* Silence compiler */
SKIPPED();
HDputs(" Deflation filter not available");
#else /* H5_HAVE_FILTER_DEFLATE */
diff --git a/test/page_buffer.c b/test/page_buffer.c
index b04d1a2..61e9696 100644
--- a/test/page_buffer.c
+++ b/test/page_buffer.c
@@ -1167,8 +1167,10 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr, bool vfd_swmr_m
int * data = NULL;
H5F_t * f = NULL;
const uint32_t max_lag = 5;
+ char s[256];
- TESTING("%sRaw Data Handling", vfd_swmr_mode ? "VFD SWMR " : "");
+ HDsprintf(s, "%sRaw Data Handling", vfd_swmr_mode ? "VFD SWMR " : "");
+ TESTING(s);
h5_fixname(namebase, orig_fapl, filename, sizeof(filename));
@@ -2909,8 +2911,10 @@ md_entry_splitting_smoke_check(hid_t orig_fapl, const char *env_h5_drvr, bool vf
haddr_t p2_addr;
H5F_t * f = NULL;
const uint32_t max_lag = 5;
+ char s[256];
- TESTING("%sMetadata Entry Splitting Smoke Check", vfd_swmr_mode ? "VFD SWMR " : "");
+ HDsprintf(s, "%sMetadata Entry Splitting Smoke Check", vfd_swmr_mode ? "VFD SWMR " : "");
+ TESTING(s);
h5_fixname(namebase, orig_fapl, filename, sizeof(filename));
@@ -3202,8 +3206,10 @@ md_entry_splitting_boundary_test(hid_t orig_fapl, const char *env_h5_drvr, bool
haddr_t first_page_addr = HADDR_UNDEF;
haddr_t start_addr = HADDR_UNDEF;
size_t test_len;
+ char s[256];
- TESTING("%sMetadata Entry Splitting Boundary Test", vfd_swmr_mode ? "VFD SWMR " : "");
+ HDsprintf(s, "%sMetadata Entry Splitting Boundary Test", vfd_swmr_mode ? "VFD SWMR " : "");
+ TESTING(s);
h5_fixname(namebase, orig_fapl, filename, sizeof(filename));
diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1
index e588a8b..e0c4654 100644
--- a/test/testfiles/err_compat_1
+++ b/test/testfiles/err_compat_1
@@ -1,5 +1,5 @@
-Testing error API H5Eset/get_auto
-Testing error API based on data I/O
+Testing error API H5Eset/get_auto
+Testing error API based on data I/O
All error API tests passed.
This program tests the Error API compatible with HDF5 version (number). There are supposed to be some error messages
********* Print error stack in HDF5 default way *********
diff --git a/test/testfiles/links_env.out b/test/testfiles/links_env.out
index b9a9893..3f10fc6 100644
--- a/test/testfiles/links_env.out
+++ b/test/testfiles/links_env.out
@@ -1,3 +1,3 @@
-Testing external links via environment variable PASSED
-Testing external links via environment variable (w/new group format) PASSED
+Testing external links via environment variable PASSED
+Testing external links via environment variable (w/new group format) PASSED
All external Link (HDF5_EXT_PREFIX) tests passed.
diff --git a/test/tfile.c b/test/tfile.c
index 19263e8..d85d188 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -1452,6 +1452,7 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, hid_t gid2,
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
case H5I_SPACE_SEL_ITER:
+ case H5I_EVENTSET:
case H5I_NTYPES:
default:
ERROR("H5Fget_obj_ids");
diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c
index 24371ef..755df68 100644
--- a/test/trefer_deprec.c
+++ b/test/trefer_deprec.c
@@ -87,8 +87,11 @@ test_reference_params(void)
/* Allocate write & read buffers */
wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ CHECK_PTR(rbuf, "HDmalloc");
tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ CHECK_PTR(tbuf, "HDmalloc");
/* Create file */
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -269,8 +272,11 @@ test_reference_obj(void)
/* Allocate write & read buffers */
wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ CHECK_PTR(rbuf, "HDmalloc");
tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ CHECK_PTR(tbuf, "HDmalloc");
/* Create file */
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
diff --git a/test/trefstr.c b/test/trefstr.c
index a3f568a..d0575ab 100644
--- a/test/trefstr.c
+++ b/test/trefstr.c
@@ -186,7 +186,7 @@ test_refstr_cmp(void)
H5RS_str_t *rs1; /* Ref-counted string created */
H5RS_str_t *rs2; /* Ref-counted string created */
int cmp; /* Comparison value */
- ssize_t len; /* Length of string */
+ size_t len; /* Length of string */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
diff --git a/test/unlink.c b/test/unlink.c
index 73e3b25..94bd035 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -1493,7 +1493,7 @@ test_create_unlink(const char *msg, hid_t fapl)
char groupname[1024];
char filename[1024];
- TESTING("%s", msg);
+ TESTING(msg);
/* Create file */
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
diff --git a/test/use_common.c b/test/use_common.c
index 0ea2c83..8f78f3b 100644
--- a/test/use_common.c
+++ b/test/use_common.c
@@ -322,10 +322,12 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
rank = H5Sget_simple_extent_ndims(f_sid);
if (rank != UC_RANK) {
HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank);
+ HDfree(buffer);
return -1;
}
if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) {
HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
+ HDfree(buffer);
return -1;
}
HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", rank, (unsigned long long)(dims[0]),
@@ -334,12 +336,14 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
if (dims[0] != 0 || dims[1] != memdims[1] || dims[2] != memdims[2]) {
HDfprintf(stderr, "dataset is not empty. Got dims=(%llu,%llu,%llu)\n", (unsigned long long)dims[0],
(unsigned long long)dims[1], (unsigned long long)dims[2]);
+ HDfree(buffer);
return -1;
}
/* setup mem-space for buffer */
if ((m_sid = H5Screate_simple(rank, memdims, NULL)) < 0) {
HDfprintf(stderr, "H5Screate_simple for memory failed\n");
+ HDfree(buffer);
return -1;
}
@@ -360,6 +364,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
if (opts->use_swmr) {
if (H5Odisable_mdc_flushes(dsid) < 0) {
HDfprintf(stderr, "H5Odisable_mdc_flushes failed\n");
+ HDfree(buffer);
return -1;
}
}
@@ -368,12 +373,14 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
dims[0] = i + 1;
if (H5Dset_extent(dsid, dims) < 0) {
HDfprintf(stderr, "H5Dset_extent failed\n");
+ HDfree(buffer);
return -1;
}
/* Get the dataset's dataspace */
if ((f_sid = H5Dget_space(dsid)) < 0) {
HDfprintf(stderr, "H5Dset_extent failed\n");
+ HDfree(buffer);
return -1;
}
@@ -381,12 +388,14 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
/* Choose the next plane to write */
if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) {
HDfprintf(stderr, "Failed H5Sselect_hyperslab\n");
+ HDfree(buffer);
return -1;
}
/* Write plane to the dataset */
if (H5Dwrite(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0) {
HDfprintf(stderr, "Failed H5Dwrite\n");
+ HDfree(buffer);
return -1;
}
@@ -394,6 +403,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
if (opts->use_swmr) {
if (H5Oenable_mdc_flushes(dsid) < 0) {
HDfprintf(stderr, "H5Oenable_mdc_flushes failed\n");
+ HDfree(buffer);
return -1;
}
}
@@ -401,6 +411,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
/* flush file to make the just written plane available. */
if (H5Dflush(dsid) < 0) {
HDfprintf(stderr, "Failed to H5Fflush file\n");
+ HDfree(buffer);
return -1;
}
} /* end for each plane to write */
@@ -488,10 +499,12 @@ read_uc_file(hbool_t towait, options_t *opts)
rank = H5Sget_simple_extent_ndims(f_sid);
if (rank != UC_RANK) {
HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank);
+ HDfree(buffer);
return -1;
}
if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) {
HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
+ HDfree(buffer);
return -1;
}
HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", rank, (unsigned long long)(dims[0]),
@@ -502,12 +515,14 @@ read_uc_file(hbool_t towait, options_t *opts)
(unsigned long long)dims[0], (unsigned long long)dims[1], (unsigned long long)dims[2]);
HDfprintf(stderr, "But memdims=(%llu,%llu,%llu)\n", (unsigned long long)memdims[0],
(unsigned long long)memdims[1], (unsigned long long)memdims[2]);
+ HDfree(buffer);
return -1;
}
/* Setup mem-space for buffer */
if ((m_sid = H5Screate_simple(rank, memdims, NULL)) < 0) {
HDfprintf(stderr, "H5Screate_simple for memory failed\n");
+ HDfree(buffer);
return -1;
}
@@ -533,6 +548,7 @@ read_uc_file(hbool_t towait, options_t *opts)
HDprintf(".");
if (loops_waiting_for_plane >= 30) {
HDfprintf(stderr, "waited too long for new plane, quit.\n");
+ HDfree(buffer);
return -1;
}
}
@@ -550,6 +566,7 @@ read_uc_file(hbool_t towait, options_t *opts)
/* Get the dataset's dataspace */
if ((f_sid = H5Dget_space(dsid)) < 0) {
HDfprintf(stderr, "H5Dget_space failed\n");
+ HDfree(buffer);
return -1;
}
@@ -557,12 +574,14 @@ read_uc_file(hbool_t towait, options_t *opts)
/* Choose the next plane to read */
if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) {
HDfprintf(stderr, "H5Sselect_hyperslab failed\n");
+ HDfree(buffer);
return -1;
}
/* Read the plane from the dataset */
if (H5Dread(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0) {
HDfprintf(stderr, "H5Dread failed\n");
+ HDfree(buffer);
return -1;
}
@@ -594,12 +613,14 @@ read_uc_file(hbool_t towait, options_t *opts)
f_sid = H5Dget_space(dsid); /* Get filespace handle first. */
if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) {
HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
+ HDfree(buffer);
return -1;
}
} /* end while (expecting more planes to read) */
if (H5Fclose(fid) < 0) {
HDfprintf(stderr, "H5Fclose failed\n");
+ HDfree(buffer);
return -1;
}
diff --git a/test/vfd_swmr.c b/test/vfd_swmr.c
index 09dee38..3ed73c1 100644
--- a/test/vfd_swmr.c
+++ b/test/vfd_swmr.c
@@ -884,7 +884,7 @@ test_writer_md(void)
hid_t sid = -1; /* Dataspace ID */
hid_t did = -1; /* Dataset ID */
int * rwbuf = NULL; /* Data buffer for writing */
- H5O_info_t oinfo; /* Object metadata information */
+ H5O_info2_t oinfo; /* Object metadata information */
char dname[100]; /* Name of dataset */
hsize_t dims[2] = {50, 20}; /* Dataset dimension sizes */
hsize_t max_dims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Dataset maximum dimension sizes */
@@ -961,7 +961,7 @@ test_writer_md(void)
FAIL_STACK_ERROR
/* Get dataset object header address */
- if (H5Oget_info(did, &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0)
FAIL_STACK_ERROR
/* Close the dataset */
@@ -998,7 +998,7 @@ test_writer_md(void)
FAIL_STACK_ERROR
/* Get dataset object info */
- if (H5Oget_info(did, &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0)
FAIL_STACK_ERROR
/* Close the dataset */
@@ -1032,7 +1032,7 @@ test_writer_md(void)
FAIL_STACK_ERROR
/* Get dataset object info */
- if (H5Oget_info(did, &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0)
FAIL_STACK_ERROR
/* Close the dataset */
@@ -1166,16 +1166,16 @@ test_file_end_tick_concur(void)
static unsigned
test_reader_md_concur(void)
{
- unsigned i = 0; /* Local index variables */
- uint8_t * buf = NULL; /* Data page from the page buffer */
- hid_t dcpl = -1; /* Dataset creation property list */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- int * rwbuf = NULL; /* Data buffer for writing */
- H5O_info_t oinfo; /* Object metadata information */
- char dname[100]; /* Name of dataset */
- hsize_t dims[2] = {50, 20}; /* Dataset dimension sizes */
- hsize_t max_dims[2] = /* Dataset maximum dimension sizes */
+ unsigned i = 0; /* Local index variables */
+ uint8_t * buf = NULL; /* Data page from the page buffer */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ int * rwbuf = NULL; /* Data buffer for writing */
+ H5O_info2_t oinfo; /* Object metadata information */
+ char dname[100]; /* Name of dataset */
+ hsize_t dims[2] = {50, 20}; /* Dataset dimension sizes */
+ hsize_t max_dims[2] = /* Dataset maximum dimension sizes */
{H5S_UNLIMITED, H5S_UNLIMITED};
hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */
unsigned num_entries = 0; /* Number of entries in the index */
@@ -1519,7 +1519,7 @@ test_reader_md_concur(void)
FAIL_STACK_ERROR
/* Get dataset object header address */
- if (H5Oget_info(did, &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0)
FAIL_STACK_ERROR
/* Close the dataset */
diff --git a/test/vfd_swmr_dsetchks_writer.c b/test/vfd_swmr_dsetchks_writer.c
index 1d9bc4c..a02a042 100644
--- a/test/vfd_swmr_dsetchks_writer.c
+++ b/test/vfd_swmr_dsetchks_writer.c
@@ -265,10 +265,14 @@ state_init(state_t *s, int argc, char **argv)
int ch;
char tfile[PATH_MAX];
char * end;
+ char * base;
+
+ if (H5_basename(tfile, base) < 0)
+ TEST_ERROR
*s = ALL_HID_INITIALIZER;
esnprintf(tfile, sizeof(tfile), "%s", argv[0]);
- esnprintf(s->progname, sizeof(s->progname), "%s", basename(tfile));
+ esnprintf(s->progname, sizeof(s->progname), "%s", base);
while ((ch = getopt(argc, argv, "siferom:n:x:y:g:p:t:l:bqSNu:c:")) != -1) {
switch (ch) {
@@ -370,6 +374,8 @@ state_init(state_t *s, int argc, char **argv)
argc -= optind;
argv += optind;
+ HDfree(base);
+
/* Require to specify at least -s or -i or -f or -e or -r option */
if (!s->single_index && !s->implicit_index && !s->fa_index && !s->ea_index && !s->bt2_index) {
printf("Require to specify at least -s or -i or -f or -e or -r option\n");
diff --git a/test/vfd_swmr_group_writer.c b/test/vfd_swmr_group_writer.c
index f491353..c758781 100644
--- a/test/vfd_swmr_group_writer.c
+++ b/test/vfd_swmr_group_writer.c
@@ -3031,8 +3031,8 @@ verify_group(state_t *s, unsigned int which)
esnprintf(name, sizeof(name), "/group-%u", which);
- if ((g = H5Gopen(s->file, name, H5P_DEFAULT)) < 0) {
- HDprintf("H5Gopen failed\n");
+ if ((g = H5Gopen2(s->file, name, H5P_DEFAULT)) < 0) {
+ HDprintf("H5Gopen2 failed\n");
TEST_ERROR;
}
@@ -4078,8 +4078,8 @@ vrfy_create_group(state_t *s, unsigned int which)
esnprintf(name, sizeof(name), "/group-%u", which);
- if ((g = H5Gopen(s->file, name, H5P_DEFAULT)) < 0) {
- HDprintf("H5Gopen failed\n");
+ if ((g = H5Gopen2(s->file, name, H5P_DEFAULT)) < 0) {
+ HDprintf("H5Gopen2 failed\n");
TEST_ERROR;
}
@@ -4195,8 +4195,8 @@ vrfy_create_group_id(state_t *s, unsigned int which, bool dense_to_compact)
esnprintf(name, sizeof(name), "/group-%u", which);
- if ((g = H5Gopen(s->file, name, H5P_DEFAULT)) < 0) {
- HDprintf("H5Gopen failed\n");
+ if ((g = H5Gopen2(s->file, name, H5P_DEFAULT)) < 0) {
+ HDprintf("H5Gopen2 failed\n");
TEST_ERROR;
}
@@ -4569,8 +4569,8 @@ vrfy_move_one_group(state_t *s, hid_t obj_id, const char *name, const char *newn
TEST_ERROR;
}
- if ((g = H5Gopen(obj_id, newname, H5P_DEFAULT)) < 0) {
- HDprintf("H5Gopen failed\n");
+ if ((g = H5Gopen2(obj_id, newname, H5P_DEFAULT)) < 0) {
+ HDprintf("H5Gopen2 failed\n");
TEST_ERROR;
}
diff --git a/testpar/t_file.c b/testpar/t_file.c
index f18c447..9554052 100644
--- a/testpar/t_file.c
+++ b/testpar/t_file.c
@@ -954,9 +954,8 @@ test_file_properties(void)
void
test_delete(void)
{
- hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
- hid_t fapl_id = H5I_INVALID_HID; /* File access plist */
- hbool_t is_coll;
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t fapl_id = H5I_INVALID_HID; /* File access plist */
const char *filename = NULL;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c
index 7c2763c..518741d 100644
--- a/testpar/t_span_tree.c
+++ b/testpar/t_span_tree.c
@@ -35,6 +35,8 @@
#include "H5private.h"
#include "testphdf5.h"
+#define LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG 0
+
static void coll_write_test(int chunk_factor);
static void coll_read_test(void);
@@ -1431,8 +1433,7 @@ lower_dim_size_comp_test__verify_data(uint32_t *buf_ptr,
*-------------------------------------------------------------------------
*/
-#define LDSCT_DS_RANK 5
-#define LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG 0
+#define LDSCT_DS_RANK 5
static void
lower_dim_size_comp_test__run_test(const int chunk_edge_size, const hbool_t use_collective_io,
diff --git a/tools/lib/io_timer.h b/tools/lib/io_timer.h
index 75db660..0b0f0bb 100644
--- a/tools/lib/io_timer.h
+++ b/tools/lib/io_timer.h
@@ -22,7 +22,7 @@
#include <sys/time.h>
#endif
-#ifdef H5_HAVE_WINSOCK2_H
+#ifdef H5_HAVE_WIN32_API
#include <winsock2.h>
#endif