diff options
47 files changed, 1277 insertions, 388 deletions
diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 8a20eb4..ae78f95 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -21,10 +21,10 @@ set (CTEST_NIGHTLY_START_TIME "18:00:00 CST") set (CTEST_DROP_METHOD "http") if (CDASH_LOCAL) set (CTEST_DROP_SITE "cdash-internal.hdfgroup.org") - set (CTEST_DROP_LOCATION "/submit.php?project=HDF5Trunk") + set (CTEST_DROP_LOCATION "/submit.php?project=HDF5110") else () set (CTEST_DROP_SITE "cdash.hdfgroup.org") - set (CTEST_DROP_LOCATION "/submit.php?project=HDF5+Trunk") + set (CTEST_DROP_LOCATION "/submit.php?project=HDF5110") endif () set (CTEST_DROP_SITE_CDASH TRUE) @@ -1,4 +1,4 @@ -HDF5 version 1.11.2 currently under development +HDF5 version 1.10.2-snap10 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index 3943f7b..3654e28 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.11.2" +PROJECT_NUMBER = "1.10.2-snap10, currently under development" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 7eaf80a..3dddbca 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -34,8 +34,8 @@ cmake_minimum_required (VERSION 3.10) # CTEST_SOURCE_NAME - source folder
##############################################################################
-set (CTEST_SOURCE_VERSION "1.11.2")
-set (CTEST_SOURCE_VERSEXT "")
+set (CTEST_SOURCE_VERSION "1.10.2")
+set (CTEST_SOURCE_VERSEXT "-snap10")
##############################################################################
# handle input parameters to script.
@@ -184,7 +184,7 @@ set (MODEL "Experimental") ##### Following controls source update #####
#set (LOCAL_UPDATE "TRUE")
set (REPOSITORY_URL "https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git")
-set (REPOSITORY_BRANCH "develop")
+set (REPOSITORY_BRANCH "hdf5_1_10_2")
#uncomment to use a compressed source file: *.tar on linux or mac *.zip on windows
#set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}")
diff --git a/config/lt_vers.am b/config/lt_vers.am index fcc2a40..1bacd1b 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -12,13 +12,13 @@ ## If you do not have access to either file, you may request a copy from ## help@hdfgroup.org. ## -# Add libtool shared library version numbers to the HDF5 library -# See libtool versioning documentation online. -# After making changes, run bin/reconfigure to update other configure related -# files like Makefile.in. -LT_VERS_INTERFACE = 1000 -LT_VERS_AGE = 0 +## Add libtool shared library version numbers to the HDF5 library +## See libtool versioning documentation online. +## After making changes, run bin/reconfigure to update other configure related +## files like Makefile.in. +LT_VERS_INTERFACE = 101 LT_VERS_REVISION = 0 +LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and ## reset LT_VERS_REVISION to 0. @@ -39,31 +39,31 @@ LT_VERS_REVISION = 0 ## the effects of the H5_V1_x_COMPAT flag. ## ## Version numbers for wrapper shared library files. -LT_CXX_VERS_INTERFACE = 1000 +LT_CXX_VERS_INTERFACE = 101 LT_CXX_VERS_REVISION = 0 LT_CXX_VERS_AGE = 0 -LT_F_VERS_INTERFACE = 1000 +LT_F_VERS_INTERFACE = 101 LT_F_VERS_REVISION = 0 -LT_F_VERS_AGE = 0 +LT_F_VERS_AGE = 1 -LT_HL_VERS_INTERFACE = 1000 -LT_HL_VERS_REVISION = 0 +LT_HL_VERS_INTERFACE = 100 +LT_HL_VERS_REVISION = 1 LT_HL_VERS_AGE = 0 -LT_HL_CXX_VERS_INTERFACE = 1000 +LT_HL_CXX_VERS_INTERFACE = 101 LT_HL_CXX_VERS_REVISION = 0 -LT_HL_CXX_VERS_AGE = 0 +LT_HL_CXX_VERS_AGE = 1 -LT_HL_F_VERS_INTERFACE = 1000 -LT_HL_F_VERS_REVISION = 0 +LT_HL_F_VERS_INTERFACE = 100 +LT_HL_F_VERS_REVISION = 1 LT_HL_F_VERS_AGE = 0 -LT_JAVA_VERS_INTERFACE = 1000 +LT_JAVA_VERS_INTERFACE = 101 LT_JAVA_VERS_REVISION = 0 -LT_JAVA_VERS_AGE = 0 +LT_JAVA_VERS_AGE = 1 -LT_TOOLS_VERS_INTERFACE = 1000 -LT_TOOLS_VERS_REVISION = 0 +LT_TOOLS_VERS_INTERFACE = 100 +LT_TOOLS_VERS_REVISION = 1 LT_TOOLS_VERS_AGE = 0 diff --git a/configure.ac b/configure.ac index 98c97cc..c60db0d 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.11.2], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.10.2-snap10], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADERS([src/H5config.h]) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 9d1aed1..7c1ff5b 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -214,7 +214,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * exception handlers to print out the HDF-5 error stack. * <hr> * - * @version HDF5 1.11.2 <BR> + * @version HDF5 1.10.2 <BR> * <b>See also: <a href ="./hdf.hdf5lib.HDFArray.html"> hdf.hdf5lib.HDFArray</a> </b><BR> * <a href ="./hdf.hdf5lib.HDF5Constants.html"> hdf.hdf5lib.HDF5Constants</a><BR> * <a href ="./hdf.hdf5lib.HDF5CDataTypes.html"> hdf.hdf5lib.HDF5CDataTypes</a><BR> @@ -237,7 +237,7 @@ public class H5 implements java.io.Serializable { * * Make sure to update the versions number when a different library is used. */ - public final static int LIB_VERSION[] = { 1, 11, 2 }; + public final static int LIB_VERSION[] = { 1, 10, 2 }; public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib"; diff --git a/java/test/TestH5.java b/java/test/TestH5.java index b922583..9c3d8dc 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -162,7 +162,7 @@ public class TestH5 { */ @Test public void testH5get_libversion() { - int libversion[] = { 1, 11, 2 }; + int libversion[] = { 1, 10, 2 }; try { H5.H5get_libversion(libversion); @@ -184,7 +184,7 @@ public class TestH5 { */ @Test public void testH5check_version() { - int majnum = 1, minnum = 11, relnum = 2; + int majnum = 1, minnum = 10, relnum = 2; try { H5.H5check_version(majnum, minnum, relnum); diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index f30c1b3..1861d92 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -667,7 +667,7 @@ cmake_minimum_required (VERSION 3.10) # CTEST_SOURCE_NAME - source folder ############################################################################## -set (CTEST_SOURCE_VERSION "1.11.0") +set (CTEST_SOURCE_VERSION 1.10.2) set (CTEST_SOURCE_VERSEXT "") ############################################################################## diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index cfa0b1c..73c9614 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.11.2 currently under development +HDF5 version 1.10.2-snap10 currently under development ================================================================================ @@ -84,6 +84,35 @@ New Features (ADB - 2018/01/08, HDFFV-10385, HDFFV-10296) + - Removed version-specific gcc/gfortran flags for version 4.0 (inclusive) + and earlier. + + The config/gnu-flags file, which is sourced as a part of the configure + process, adds version-specific flags for use when building HDF5. Most of + these flags control warnings and do not affect the final product. + + Flags for older versions of the compiler were consolidated into the + common flags section. Moving these flags simplifies maintenance of + the file. + + The upshot of this is that building with ancient versions of gcc + (<= 4.0) will possibly no longer work without hand-hacking the file + to remove the flags not understood by that version of the compiler. + Nothing should change when building with gcc >= 4.1. + + (HDFFV-9937, DER, 2017/05/31) + + - -fno-omit-frame-pointer was added when building with debugging symbols + enabled. + + Debugging symbols can be enabled independently of the overall build + mode in both the autotools and CMake. This allows (limited) debugging + of optimized code. Since many debuggers rely on the frame pointer, + we've disabled this optimization when debugging symbols are requested + (e.g.: via building with --enable-symbols). + + (HDFFV-10226, DER, 2017/05/31) + Library: -------- - Add an enumerated value to H5F_libver_t for H5Pset_libver_bounds(). @@ -116,6 +145,40 @@ New Features (ADB - 2017/12/12, HDFFV-9724, HDFFV-10361) + - H5FDdriver_query() API call added to the C library. + + This new library call allows the user to query a virtual file driver + (VFD) for the feature flags it supports (listed in H5FDpublic.h). + This can be useful to determine if a VFD supports SWMR, for example. + + Note that some VFDs have feature flags that may only be present + after a file has been created or opened (e.g.: the core VFD will + have the H5FD_FEAT_POSIX_COMPAT_HANDLE flag set if the backing + store is switched on). Since the new API call queries a generic VFD + unassociated with a file, these flags will never be returned. + + (HDFFV-10215, DER, 2017/05/31) + + + - H5FD_FEAT_DEFAULT_VFD_COMPATIBLE VFD feature flag added to the C library. + + This new feature flag indicates that the VFD is compatible with the + default VFD. VFDs that set this flag create single files that follow + the canonical HDF5 file format. + + (HDFFV-10214, DER, 2017/05/31) + + - The H5I_REFERENCE value in the H5I_type_t enum (defined in H5Ipublic.h) + has been marked as deprectated. + + This ID type value is not used in the C library. i.e.: There are no + hid_t values that are of ID type H5I_REFERENCE. + + This enum value will be removed in a future major version of the library. + The code will remain unchanged in the HDF5 1.10.x branches. + + (HDFFV-10252, DER, 2017/04/05) + Parallel Library: ----------------- @@ -166,7 +229,7 @@ New Features fulfill the original user request without encountering API errors. - (RAW - 2017/07/11, HDFFV-8839) + (RAW - 2017/09/10, HDFFV-8839) Fortran Library: ---------------- @@ -246,6 +309,18 @@ New Features (ADB - 2017/12/20) + - The H5I_REFERENCE value in the H5I_type_t enum (defined in H5Ipublic.h) + has been marked as deprectated. + + JNI code which refers to this value will be removed in a future + major version of the library. The code will remain unchanged in the + 1.10.x branches. + + See the C library section, above, for further information. + + (HDFFV-10252, DER, 2017/04/05) + + Tools: ------ - h5diff @@ -284,6 +359,22 @@ Bug Fixes since HDF5-1.10.1 release Library ------- + - Fix H5Sencode() bug when the number of elements selected is > 2^32 + + H5Sencode() incorrectly encodes dataspace selection with number of + elements exceeding 2^32. When decoding such selection via H5Sdecode(), + the number of elements in the decoded dataspace is not the same as + what is encoded. This problem exists for H5S_SEL_HYPER and + H5S_SEL_POINTS encoding. + + The cause of the problem is because the library uses 32 bits to + encode counts and block offsets for the selection. + The solution is to use the original 32 bit encodings if possible, + but use a different way to encode selection > 32 bits when needed. + See details in the RFC: H5Sencode/H5Secode Format Change. + + (VC - 2017/11/28, HDFFV-9947) + - Freeing of object header in H5Ocache.c It was discovered that the object header was not released properly @@ -318,6 +409,14 @@ Bug Fixes since HDF5-1.10.1 release (such as szip or zlib) to be available. (ADB - 2017/11/16, HDFFV-10328) + - Fix rare object header corruption bug + + In certain cases, such as when converting large attributes to dense + storage, an error could occur which would either fail an assertion or + cause file corruption. Fixed and added test. + + (NAF - 2017/11/14, HDFFV-10274) + - H5Zfilter_avail in H5Z.c The public function checked for plugins, while the private @@ -329,6 +428,61 @@ Bug Fixes since HDF5-1.10.1 release (ADB - 2017/10/10, HDFFV-10297, HDFFV-10319) + - Fix H5HL_offset_into() + + (1) Fix H5HL_offset_into() to return error when offset exceeds heap data + block size. + (2) Fix other places in the library that call this routine to detect + error routine. + + (HDFFV-10216, VC, 2017/08/30) + + - Fixes for paged aggregation + + Skip test in test/fheap.c when: + (1) multi/split drivers and + (2) persisting free-space or using paged aggregation strategy + + (VC, 2017/07/10) + + - Fixes for paged aggregation + + Changes made based on RFC review comments: + (1) Add maximum value for file space page size + (2) Drop check for page end metadata threshold + (3) Remove "can_shrink" and "shrink" callbacks for small section class + + (VC, 2017/06/09) + + - Fix for infinite loop in H5VM_power2up(). + + The function H5VM_power2up() returns the next power of 2 + for n. When n exceeds 2^63, it overflows and becomes 0 causing + the infinite looping. + + The fix ensures that the function checks for n >= 2^63 + and returns 0. + + (HDFFV-10217, VC, 2017/07/10) + + - Fix for H5Ocopy doesn't work with open identifiers + + Changes made so that raw data for dataset objects are copied from + cached info when possible instead of flushing objects to file and + read them back in again. + + (HDFFV-7853, VC, 2017/07/05) + + - Refactored the testpar/t_bigio.c test to include ALARM macros + + Changed the test to include the ALARM_ON and ALARM_OFF macros which + are intended to prevent nightly test hangs that have been observed + with this particular parallel test example. The code was also modified to + simplify status reporting (only from MPI rank 0) and additional + status checking added. + + (RAW - 2017/11/08, HDFFV-10301) + - An uninitialized struct could cause a memory access error when using variable-length or reference types in a compressed, chunked dataset. @@ -344,6 +498,17 @@ Bug Fixes since HDF5-1.10.1 release (DER - 2017/11/21, HDFFV-10330) + - Fix for collective metadata writes on file close + + It was discovered that metadata was being written twice as part of + the parallel file close behavior, once independently and once + collectively. + + A fix for this error was included as part of the parallel compression + feature but remained undocumented here. + + (RAW - 2017/12/01, HDFFV-10272) + - If an HDF5 file contains a filter pipeline message with a 'number of filters' field that exceeds the maximum number of allowed filters, the error handling code will attempt to dereference a NULL pointer. @@ -495,6 +660,32 @@ Bug Fixes since HDF5-1.10.1 release (ADB - 2017/11/02, HDFFV-10321) + - Corrected FORTRAN_HAVE_C_LONG_DOUBLE processing in the autotools. + + A bug in the autotools Fortran processing code always set the + FORTRAN_HAVE_C_LONG_DOUBLE variable to be true regardless of + whether or not a C long double type was present. + + This would cause compilation failures on platforms where a C + long double type was not available and the Fortran wrappers + were being built. + + (HDFFV-10247, DER, 2017/07/05) + + - The deprecated --enable-production and --enable-debug configure options + failed to emit errors when passed an empty string + (e.g.: --enable-debug=""). + + Due to the way we checked for these options being set, it was possible + to avoid the error message and continue configuration if an empty string + was passed to the option. + + Any use of --enable-production or --enable-debug will now halt the + configuration step and emit a helpful error message + (use --enable-build-mode=debug|production instead). + + (HDFFV-10248, DER, 2017/07/05) + - CMake Too many commands for POST_BUILD step caused command line to be @@ -505,6 +696,17 @@ Bug Fixes since HDF5-1.10.1 release (ADB - 2017/07/12, HDFFV-10254) + - cmake test execution environment + + The parallel HDF5 test: 't_pread' assumed the use of autotools + and the directory structure associated with that testing approach. + Modified the test code to check whether the 'h5jam' utility can be + found in the same directory as the test executable (which is + preferred directory structure utilized by cmake) and if found + will invoke the tool directly rather than utilizing a relative path. + + (RAW - 2017/11/03, HDFFV-10318) + Performance ------------- - @@ -640,6 +842,13 @@ Bug Fixes since HDF5-1.10.1 release (ADB - 2017/08/17, HDFFV-10188) + - h5repack + + Add tests to h5repack.sh.in to verify options added for paged + aggregation work as expected. + + (VC, 2017/08/03) + - h5dump h5dump segfaulted on output of XML file. @@ -697,7 +906,12 @@ Bug Fixes since HDF5-1.10.1 release High-Level APIs: ------ - - + - Fixed a bug in the H5DOwrite_chunk() API call where overwriting a chunk + with no filters caused an assert to trip (with assertions enabled / + debug builds) or additional chunks to be inserted instead of overwriting + the data (without assertions enabled / production builds). + + (HDFFV-10187, DER, 2017/05/11) Fortran High-Level APIs: ------ @@ -731,18 +945,6 @@ Bug Fixes since HDF5-1.10.1 release Supported Platforms =================== - Linux 2.6.32-573.22.1.el6 GNU C (gcc), Fortran (gfortran), C++ (g++) - #1 SMP x86_64 GNU/Linux compilers: - (mayll/platypus) Version 4.4.7 20120313 - Version 4.8.4 - PGI C, Fortran, C++ for 64-bit target on - x86-64; - Version 16.10-0 - Intel(R) C (icc), C++ (icpc), Fortran (icc) - compilers: - Version 15.0.3.187 (Build 20150407) - MPICH 3.1.4 compiled with GCC 4.9.3 - Linux 2.6.32-573.18.1.el6.ppc64 gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4) #1 SMP ppc64 GNU/Linux g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4) (ostrich) GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4) @@ -823,15 +1025,13 @@ Windows 7 x64 Cygwin n y/n n y y y Windows 10 y y/y n y y y Windows 10 x64 y y/y n y y y Mac OS X Mountain Lion 10.8.5 64-bit n y/y n y y y -Mac OS X Mavericks 10.9.5 64-bit n y/y n y y ? -Mac OS X Yosemite 10.10.5 64-bit n y/y n y y ? -Mac OS X El Capitan 10.11.6 64-bit n y/y n y y ? -CentOS 6.7 Linux 2.6.18 x86_64 GNU n y/y n y y y -CentOS 6.7 Linux 2.6.18 x86_64 Intel n y/y n y y y -CentOS 6.7 Linux 2.6.32 x86_64 PGI n y/y n y y y +Mac OS X Mavericks 10.9.5 64-bit n y/y n y y y +Mac OS X Yosemite 10.10.5 64-bit n y/y n y y y +Mac OS X El Capitan 10.11.6 64-bit n y/y n y y y +CentOS 7.2 Linux 2.6.32 x86_64 PGI n y/y n y y y CentOS 7.2 Linux 2.6.32 x86_64 GNU y y/y y y y y CentOS 7.2 Linux 2.6.32 x86_64 Intel n y/y n y y y -Linux 2.6.32-573.18.1.el6.ppc64 n y/n n y y y +Linux 2.6.32-573.18.1.el6.ppc64 n y/y n y y y Platform Shared Shared Shared Thread- @@ -848,10 +1048,8 @@ Mac OS X Mountain Lion 10.8.5 64-bit y n y y Mac OS X Mavericks 10.9.5 64-bit y n y y Mac OS X Yosemite 10.10.5 64-bit y n y y Mac OS X El Capitan 10.11.6 64-bit y n y y -CentOS 6.7 Linux 2.6.18 x86_64 GNU y y y y -CentOS 6.7 Linux 2.6.18 x86_64 Intel y y y n -CentOS 6.7 Linux 2.6.32 x86_64 PGI y y y n -CentOS 7.2 Linux 2.6.32 x86_64 GNU y y y n +CentOS 7.2 Linux 2.6.32 x86_64 PGI y y y n +CentOS 7.2 Linux 2.6.32 x86_64 GNU y y y y CentOS 7.2 Linux 2.6.32 x86_64 Intel y y y n Linux 2.6.32-573.18.1.el6.ppc64 y y y n diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index be3b678..f96abdd 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2008,7 +2008,7 @@ H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, coords_in_chunk[u] = coords[u] - (scaled[u] * fm->layout->u.chunk.dim[u]); /* Add point to file selection for chunk */ - if(H5S_select_elements(chunk_info->fspace, H5S_SELECT_APPEND, (size_t)1, coords_in_chunk) < 0) + if(H5S_select_elements(chunk_info->fspace, H5S_SELECT_APPEND, (hsize_t)1, coords_in_chunk) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element") /* Increment the number of elemented selected in chunk */ @@ -2088,7 +2088,7 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u } /* end else */ /* Move memory selection iterator to next element in selection */ - if(H5S_SELECT_ITER_NEXT(&fm->mem_iter, (size_t)1) < 0) + if(H5S_SELECT_ITER_NEXT(&fm->mem_iter, (hsize_t)1) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to move to next iterator location") done: diff --git a/src/H5Dint.c b/src/H5Dint.c index fc191ff..17b989e 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2561,7 +2561,7 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ATT HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf") /* Select point to read in */ - if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0) + if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (hsize_t)1, point) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point") /* Read in the point (with the custom VL memory allocator) */ diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 79572c0..94d763d 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -2859,6 +2859,7 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty int *send_displacements = NULL; int scatter_recvcount_int; int mpi_rank, mpi_size, mpi_code; + hid_t fapl_id = -1; /* File access property list for H5S_encode() */ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -2873,6 +2874,9 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty if ((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0) HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size") + if((fapl_id = H5F_get_access_plist(io_info->dset->oloc.file, FALSE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fapl") + if (*local_chunk_array_num_entries) if (NULL == (send_requests = (MPI_Request *) H5MM_malloc(*local_chunk_array_num_entries * sizeof(MPI_Request)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate send requests buffer") @@ -2978,7 +2982,7 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty /* Determine size of serialized chunk file dataspace, plus the size of * the data being written */ - if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0) + if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size, fapl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to get encoded dataspace size") if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) @@ -2991,7 +2995,7 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty /* Serialize the chunk's file dataspace into the buffer */ mod_data_p = mod_data[num_send_requests]; - if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0) + if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size, fapl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to encode dataspace") /* Intialize iterator for memory selection */ diff --git a/src/H5Ffake.c b/src/H5Ffake.c index 6072f2e..d199cf0 100644 --- a/src/H5Ffake.c +++ b/src/H5Ffake.c @@ -18,6 +18,8 @@ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property lists */ /* PRIVATE PROTOTYPES */ @@ -40,9 +42,10 @@ *------------------------------------------------------------------------- */ H5F_t * -H5F_fake_alloc(uint8_t sizeof_size) +H5F_fake_alloc(uint8_t sizeof_size, hid_t fapl_id) { H5F_t *f = NULL; /* Pointer to fake file struct */ + H5P_genplist_t *plist; /* Property list */ H5F_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -59,6 +62,16 @@ H5F_fake_alloc(uint8_t sizeof_size) else f->shared->sizeof_size = sizeof_size; + /* Set low/high bounds according to the setting in fapl_id */ + /* See H5F_new() in H5Fint.c */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list") + + if(H5P_get(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &(f->shared->low_bound)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'low' bound for library format versions") + if(H5P_get(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &(f->shared->high_bound)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'high' bound for library format versions") + /* Set return value */ ret_value = f; diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 28ebbd2..1886c5c 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -831,7 +831,7 @@ H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t **pp, haddr_t *ad H5_DLL void H5F_sfile_assert_num(unsigned n); /* Routines for creating & destroying "fake" file structures */ -H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size); +H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size, hid_t fapl_id); H5_DLL herr_t H5F_fake_free(H5F_t *f); /* Superblock related routines */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 553013c..2c4c4ce 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -552,10 +552,11 @@ done: static herr_t H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { - const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; - uint8_t *heap_block = NULL; + const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; + uint8_t *heap_block = NULL; size_t *str_size = NULL; - unsigned u; + unsigned u; + H5F_libver_t saved_low, saved_high; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -572,6 +573,9 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, /* Layout class */ *p++ = mesg->type; + saved_low = H5F_LOW_BOUND(f); + saved_high = H5F_HIGH_BOUND(f); + /* Write out layout class specific information */ switch(mesg->type) { case H5D_COMPACT: @@ -683,6 +687,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, /* Note that we assume here that the contents of the heap block * cannot change! If this ever stops being the case we must change * this code to allow overwrites of the heap block. -NAF */ + if((mesg->storage.u.virt.serial_list_hobjid.addr == HADDR_UNDEF) && (mesg->storage.u.virt.list_nused > 0)) { uint8_t *heap_block_p; @@ -692,6 +697,9 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, uint32_t chksum; size_t i; + if(H5F_set_libver_bounds(f, H5F_LIBVER_V110, H5F_LIBVER_V110) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "cannot set low/high bounds") + /* Allocate array for caching results of strlen */ if(NULL == (str_size = (size_t *)H5MM_malloc(2 * mesg->storage.u.virt.list_nused *sizeof(size_t)))) HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, FAIL, "unable to allocate string length array") @@ -718,12 +726,12 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, block_size += str_size[(2 * i) + 1]; /* Source selection */ - if((select_serial_size = H5S_SELECT_SERIAL_SIZE(mesg->storage.u.virt.list[i].source_select)) < 0) + if((select_serial_size = H5S_SELECT_SERIAL_SIZE(mesg->storage.u.virt.list[i].source_select, f)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size") block_size += (size_t)select_serial_size; /* Virtual dataset selection */ - if((select_serial_size = H5S_SELECT_SERIAL_SIZE(mesg->storage.u.virt.list[i].source_dset.virtual_select)) < 0) + if((select_serial_size = H5S_SELECT_SERIAL_SIZE(mesg->storage.u.virt.list[i].source_dset.virtual_select, f)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size") block_size += (size_t)select_serial_size; } /* end for */ @@ -758,11 +766,11 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, heap_block_p += str_size[(2 * i) + 1]; /* Source selection */ - if(H5S_SELECT_SERIALIZE(mesg->storage.u.virt.list[i].source_select, &heap_block_p) < 0) + if(H5S_SELECT_SERIALIZE(mesg->storage.u.virt.list[i].source_select, &heap_block_p, f) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize source selection") /* Virtual selection */ - if(H5S_SELECT_SERIALIZE(mesg->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p) < 0) + if(H5S_SELECT_SERIALIZE(mesg->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p, f) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize virtual selection") } /* end for */ @@ -788,6 +796,9 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, } /* end switch */ done: + if(H5F_set_libver_bounds(f, saved_low, saved_high) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "cannot reset low/high bounds") + heap_block = (uint8_t *)H5MM_xfree(heap_block); str_size = (size_t *)H5MM_xfree(str_size); @@ -26,10 +26,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Ppkg.h" /* Property lists */ +#include "H5Fprivate.h" /* Files */ /****************/ /* Local Macros */ @@ -839,6 +840,10 @@ herr_t H5Pencode(hid_t plist_id, void *buf, size_t *nalloc) { H5P_genplist_t *plist; /* Property list to query */ + H5P_genplist_t *fapl_plist; + hid_t new_fapl_id; + H5F_libver_t low_bound = H5F_LIBVER_V110; + H5F_libver_t high_bound = H5F_LIBVER_V110; herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) @@ -849,7 +854,7 @@ H5Pencode(hid_t plist_id, void *buf, size_t *nalloc) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Call the internal encode routine */ - if((ret_value = H5P__encode(plist, TRUE, buf, nalloc)) < 0) + if((ret_value = H5P__encode(plist, TRUE, buf, nalloc, H5P_FILE_ACCESS_DEFAULT)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to encode property list"); done: diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index da06297..ad2ae4c 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -121,7 +121,7 @@ static herr_t H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, static herr_t H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value); /* Property list callbacks */ -static herr_t H5P__dacc_vds_view_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dacc_vds_view_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dacc_vds_view_dec(const void **pp, void *value); static herr_t H5P__dapl_vds_file_pref_set(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dapl_vds_file_pref_get(hid_t prop_id, const char* name, size_t size, void* value); @@ -135,7 +135,7 @@ static herr_t H5P__dapl_vds_file_pref_close(const char* name, size_t size, void* /* Property list callbacks */ static herr_t H5P__dapl_efile_pref_set(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dapl_efile_pref_get(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__dapl_efile_pref_dec(const void **_pp, void *value); static herr_t H5P__dapl_efile_pref_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dapl_efile_pref_copy(const char* name, size_t size, void* value); @@ -562,7 +562,7 @@ H5P__dapl_efile_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *------------------------------------------------------------------------- */ static herr_t -H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size) +H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const char *efile_pref = *(const char * const *)value; uint8_t **pp = (uint8_t **)_pp; @@ -1157,7 +1157,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dacc_vds_view_enc(const void *value, void **_pp, size_t *size) +H5P__dacc_vds_view_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5D_vds_view_t *view = (const H5D_vds_view_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 894f6cb..76a2658 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -146,7 +146,7 @@ static herr_t H5P__dcrt_reg_prop(H5P_genclass_t *pclass); /* Property callbacks */ static herr_t H5P__dcrt_layout_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_layout_get(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P__dcrt_layout_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dcrt_layout_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dcrt_layout_dec(const void **pp, void *value); static herr_t H5P__dcrt_layout_del(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_layout_copy(const char *name, size_t size, void *value); @@ -154,14 +154,14 @@ static int H5P__dcrt_layout_cmp(const void *value1, const void *value2, size_t s static herr_t H5P__dcrt_layout_close(const char *name, size_t size, void *value); static herr_t H5P__dcrt_fill_value_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_fill_value_get(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P__dcrt_fill_value_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dcrt_fill_value_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dcrt_fill_value_dec(const void **pp, void *value); static herr_t H5P__dcrt_fill_value_del(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_fill_value_copy(const char *name, size_t size, void *value); static herr_t H5P__dcrt_fill_value_close(const char *name, size_t size, void *value); static herr_t H5P__dcrt_ext_file_list_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_ext_file_list_get(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P__dcrt_ext_file_list_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dcrt_ext_file_list_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dcrt_ext_file_list_dec(const void **pp, void *value); static herr_t H5P__dcrt_ext_file_list_del(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_ext_file_list_copy(const char *name, size_t size, void *value); @@ -366,21 +366,41 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) +H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size, void *_udata) { const H5O_layout_t *layout = (const H5O_layout_t *)value; /* Create local aliases for values */ + H5P_enc_cb_info_t *udata = (H5P_enc_cb_info_t *)_udata; /* User data for encode callback */ uint8_t **pp = (uint8_t **)_pp; uint8_t *tmp_p; size_t tmp_size; size_t u; /* Local index variable */ + H5P_genplist_t *fapl_plist; /* The file access property list */ + hid_t new_fapl_id; /* The file access property list ID */ + H5F_libver_t low_bound = H5F_LIBVER_V110; /* Set the low bound in fapl to latest */ + H5F_libver_t high_bound = H5F_LIBVER_V110; /* Set the high bound in fapl to latest */ herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_STATIC /* Sanity check */ HDassert(layout); HDassert(size); + /* Make a copy of the default file access property list */ + if(NULL == (fapl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Set latest format in fapl_plist */ + /* This will eventually be used by VDS to encode datasets via H5S_encode() */ + if(H5P_set(fapl_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &low_bound) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'low' bound for library format versions") + if(H5P_set(fapl_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &high_bound) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'high' bound for library format versions") + + if((new_fapl_id = H5P_copy_plist(fapl_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list") + if(NULL != *pp) { /* Encode layout type */ *(*pp)++ = (uint8_t)layout->type; @@ -426,14 +446,15 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) * list before we get here. */ tmp_size = (size_t)-1; tmp_p = *pp; - if(H5S_encode(layout->storage.u.virt.list[u].source_select, pp, &tmp_size) < 0) + + if(H5S_encode(layout->storage.u.virt.list[u].source_select, pp, &tmp_size, new_fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize source selection") *size += (size_t)(*pp - tmp_p); /* Virtual dataset selection. Same notes as above apply. */ tmp_size = (size_t)-1; tmp_p = *pp; - if(H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, pp, &tmp_size) < 0) + if(H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, pp, &tmp_size, new_fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize virtual selection") *size += (size_t)(*pp - tmp_p); } /* end for */ @@ -466,14 +487,14 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) /* Source selection */ tmp_size = (size_t)0; tmp_p = NULL; - if(H5S_encode(layout->storage.u.virt.list[u].source_select, &tmp_p, &tmp_size) < 0) + if(H5S_encode(layout->storage.u.virt.list[u].source_select, &tmp_p, &tmp_size, new_fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize source selection") *size += tmp_size; /* Virtual dataset selection */ tmp_size = (size_t)0; tmp_p = NULL; - if(H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, &tmp_p, &tmp_size) < 0) + if(H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, &tmp_p, &tmp_size, new_fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize virtual selection") *size += tmp_size; } /* end for */ @@ -979,7 +1000,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size) +H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5O_fill_t *fill = (const H5O_fill_t *)value; /* Create local aliases for values */ size_t dt_size = 0; /* Size of encoded datatype */ @@ -1382,7 +1403,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size) +H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5O_efl_t *efl = (const H5O_efl_t *)value; /* Create local aliases for values */ size_t len = 0; /* String length of slot name */ diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 3c53c15..c815542 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -212,21 +212,21 @@ static herr_t H5P__dxfr_reg_prop(H5P_genclass_t *pclass); /* Property list callbacks */ -static herr_t H5P__dxfr_bkgr_buf_type_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_bkgr_buf_type_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dxfr_bkgr_buf_type_dec(const void **pp, void *value); -static herr_t H5P__dxfr_btree_split_ratio_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_btree_split_ratio_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dxfr_btree_split_ratio_dec(const void **pp, void *value); -static herr_t H5P__dxfr_io_xfer_mode_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_io_xfer_mode_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dxfr_io_xfer_mode_dec(const void **pp, void *value); -static herr_t H5P__dxfr_mpio_collective_opt_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_mpio_collective_opt_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dxfr_mpio_collective_opt_dec(const void **pp, void *value); -static herr_t H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dxfr_mpio_chunk_opt_hard_dec(const void **pp, void *value); -static herr_t H5P__dxfr_edc_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_edc_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dxfr_edc_dec(const void **pp, void *value); static herr_t H5P__dxfr_xform_set(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dxfr_xform_get(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__dxfr_xform_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_xform_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dxfr_xform_dec(const void **pp, void *value); static herr_t H5P__dxfr_xform_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dxfr_xform_copy(const char* name, size_t size, void* value); @@ -559,7 +559,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_bkgr_buf_type_enc(const void *value, void **_pp, size_t *size) +H5P__dxfr_bkgr_buf_type_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5T_bkg_t *bkgr_buf_type = (const H5T_bkg_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -632,7 +632,7 @@ H5P__dxfr_bkgr_buf_type_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_btree_split_ratio_enc(const void *value, void **_pp, size_t *size) +H5P__dxfr_btree_split_ratio_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const double *btree_split_ratio = (const double *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -793,7 +793,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size) +H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5Z_data_xform_t *data_xform_prop = *(const H5Z_data_xform_t * const *)value; /* Create local alias for values */ const char *pexp = NULL; /* Pointer to transform expression */ @@ -1881,7 +1881,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_io_xfer_mode_enc(const void *value, void **_pp, size_t *size) +H5P__dxfr_io_xfer_mode_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5FD_mpio_xfer_t *xfer_mode = (const H5FD_mpio_xfer_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -1954,7 +1954,7 @@ H5P__dxfr_io_xfer_mode_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_mpio_collective_opt_enc(const void *value, void **_pp, size_t *size) +H5P__dxfr_mpio_collective_opt_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5FD_mpio_collective_opt_t *coll_opt = (const H5FD_mpio_collective_opt_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -2027,7 +2027,7 @@ H5P__dxfr_mpio_collective_opt_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **_pp, size_t *size) +H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5FD_mpio_chunk_opt_t *chunk_opt = (const H5FD_mpio_chunk_opt_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -2212,7 +2212,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_edc_enc(const void *value, void **_pp, size_t *size) +H5P__dxfr_edc_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5Z_EDC_t *check = (const H5Z_EDC_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index 73c48d7..3332098 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -49,9 +49,10 @@ /* Typedef for iterator when encoding a property list */ typedef struct { - hbool_t encode; /* Whether the property list should be encoded */ - size_t *enc_size_ptr; /* Pointer to size of encoded buffer */ - void **pp; /* Pointer to encoding buffer pointer */ + hbool_t encode; /* Whether the property list should be encoded */ + size_t *enc_size_ptr; /* Pointer to size of encoded buffer */ + void **pp; /* Pointer to encoding buffer pointer */ + hid_t fapl_id; /* File access property list */ } H5P_enc_iter_ud_t; @@ -90,7 +91,7 @@ typedef struct { *------------------------------------------------------------------------- */ herr_t -H5P__encode_size_t(const void *value, void **_pp, size_t *size) +H5P__encode_size_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint64_t enc_value = (uint64_t)*(const size_t *)value; /* Property value to encode */ uint8_t **pp = (uint8_t **)_pp; @@ -132,7 +133,7 @@ H5P__encode_size_t(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ herr_t -H5P__encode_hsize_t(const void *value, void **_pp, size_t *size) +H5P__encode_hsize_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint64_t enc_value = (uint64_t)*(const hsize_t *)value; /* Property value to encode */ unsigned enc_size = H5VM_limit_enc_size(enc_value); /* Size of encoded property */ @@ -173,7 +174,7 @@ H5P__encode_hsize_t(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ herr_t -H5P__encode_unsigned(const void *value, void **_pp, size_t *size) +H5P__encode_unsigned(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint8_t **pp = (uint8_t **)_pp; @@ -212,7 +213,7 @@ H5P__encode_unsigned(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ herr_t -H5P__encode_uint8_t(const void *value, void **_pp, size_t *size) +H5P__encode_uint8_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint8_t **pp = (uint8_t **)_pp; @@ -248,7 +249,7 @@ H5P__encode_uint8_t(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ herr_t -H5P__encode_hbool_t(const void *value, void **_pp, size_t *size) +H5P__encode_hbool_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint8_t **pp = (uint8_t **)_pp; @@ -283,7 +284,7 @@ H5P__encode_hbool_t(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ herr_t -H5P__encode_double(const void *value, void **_pp, size_t *size) +H5P__encode_double(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint8_t **pp = (uint8_t **)_pp; @@ -332,7 +333,8 @@ static int H5P__encode_cb(H5P_genprop_t *prop, void *_udata) { H5P_enc_iter_ud_t *udata = (H5P_enc_iter_ud_t *)_udata; /* Pointer to user data */ - int ret_value = H5_ITER_CONT; /* Return value */ + H5P_enc_cb_info_t cb_udata; /* User data for property iteration callback */ + int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_STATIC @@ -355,7 +357,8 @@ H5P__encode_cb(H5P_genprop_t *prop, void *_udata) /* Encode (or not, if *(udata->pp) is NULL) the property value */ prop_value_len = 0; - if((prop->encode)(prop->value, udata->pp, &prop_value_len) < 0) + cb_udata.fapl_id = udata->fapl_id; + if((prop->encode)(prop->value, udata->pp, &prop_value_len, &cb_udata) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, H5_ITER_ERROR, "property encoding routine failed") *(udata->enc_size_ptr) += prop_value_len; } /* end if */ @@ -390,7 +393,7 @@ done: --------------------------------------------------------------------------*/ herr_t H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf, - size_t *nalloc) + size_t *nalloc, hid_t fapl_id) { H5P_enc_iter_ud_t udata; /* User data for property iteration callback */ uint8_t *p = (uint8_t *)buf; /* Temporary pointer to encoding buffer */ @@ -425,6 +428,7 @@ H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf, udata.encode = encode; udata.enc_size_ptr = &encode_size; udata.pp = (void **)&p; + udata.fapl_id = fapl_id; /* Iterate over all properties in property list, encoding them */ idx = 0; diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index eded286..a7c8218 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -297,18 +297,18 @@ static int H5P__facc_file_image_info_cmp(const void *value1, const void *value2, static herr_t H5P__facc_file_image_info_close(const char *name, size_t size, void *value); /* encode & decode callbacks */ -static herr_t H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__facc_cache_config_dec(const void **_pp, void *value); static int H5P__facc_cache_config_cmp(const void *value1, const void *value2, size_t size); -static herr_t H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__facc_fclose_degree_dec(const void **pp, void *value); -static herr_t H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__facc_multi_type_dec(const void **_pp, void *value); static herr_t H5P__facc_libver_type_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__facc_libver_type_dec(const void **_pp, void *value); /* Metadata cache log location property callbacks */ -static herr_t H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P_facc_mdc_log_location_dec(const void **_pp, void *value); static herr_t H5P_facc_mdc_log_location_del(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P_facc_mdc_log_location_copy(const char *name, size_t size, void *value); @@ -317,7 +317,7 @@ static herr_t H5P_facc_mdc_log_location_close(const char *name, size_t size, voi /* Metadata cache image property callbacks */ static int H5P__facc_cache_image_config_cmp(const void *_config1, const void *_config2, size_t H5_ATTR_UNUSED size); -static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value); @@ -3019,7 +3019,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size) +H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5AC_cache_image_config_t *config = (const H5AC_cache_image_config_t *)value; /* Create local aliases for value */ uint8_t **pp = (uint8_t **)_pp; @@ -3445,7 +3445,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) +H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5AC_cache_config_t *config = (const H5AC_cache_config_t *)value; /* Create local aliases for values */ uint8_t **pp = (uint8_t **)_pp; @@ -3725,7 +3725,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size) +H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5F_close_degree_t *fclose_degree = (const H5F_close_degree_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -3798,7 +3798,7 @@ H5P__facc_fclose_degree_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ static herr_t -H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size) +H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5FD_mem_t *type = (const H5FD_mem_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -4298,7 +4298,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) +H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const char *log_location = *(const char * const *)value; uint8_t **pp = (uint8_t **)_pp; @@ -4598,7 +4598,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) +H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5P_coll_md_read_flag_t *coll_md_read_flag = (const H5P_coll_md_read_flag_t *)value; uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index 6b0d2c0..720c526 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -132,13 +132,13 @@ static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass); /* property callbacks */ -static herr_t H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__fcrt_btree_rank_dec(const void **_pp, void *value); -static herr_t H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__fcrt_shmsg_index_types_dec(const void **_pp, void *value); -static herr_t H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__fcrt_shmsg_index_minsize_dec(const void **_pp, void *value); -static herr_t H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__fcrt_fspace_strategy_dec(const void **_pp, void *_value); @@ -722,7 +722,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size) +H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const unsigned *btree_k = (const unsigned *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -1013,7 +1013,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size) +H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const unsigned *type_flags = (const unsigned *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -1106,7 +1106,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size) +H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const unsigned *minsizes = (const unsigned *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -1388,7 +1388,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size) +H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5F_fspace_strategy_t *strategy = (const H5F_fspace_strategy_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 6f1fab1..a719616 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -69,9 +69,9 @@ static herr_t H5P__gcrt_reg_prop(H5P_genclass_t *pclass); /* Property callbacks */ -static herr_t H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__gcrt_group_info_dec(const void **_pp, void *value); -static herr_t H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__gcrt_link_info_dec(const void **_pp, void *value); @@ -546,7 +546,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size) +H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)value; /* Create local aliases for values */ uint8_t **pp = (uint8_t **)_pp; @@ -634,7 +634,7 @@ H5P__gcrt_group_info_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ static herr_t -H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size) +H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5O_linfo_t *linfo = (const H5O_linfo_t *)value; /* Create local aliases for values */ uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 18b81ac..4a95991 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -114,7 +114,7 @@ static herr_t H5P__lacc_reg_prop(H5P_genclass_t *pclass); /* Property list callbacks */ static herr_t H5P__lacc_elink_pref_set(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__lacc_elink_pref_get(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__lacc_elink_pref_dec(const void **_pp, void *value); static herr_t H5P__lacc_elink_pref_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__lacc_elink_pref_copy(const char* name, size_t size, void* value); @@ -122,7 +122,7 @@ static int H5P__lacc_elink_pref_cmp(const void *value1, const void *value2, size static herr_t H5P__lacc_elink_pref_close(const char* name, size_t size, void* value); static herr_t H5P__lacc_elink_fapl_set(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__lacc_elink_fapl_get(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__lacc_elink_fapl_dec(const void **_pp, void *value); static herr_t H5P__lacc_elink_fapl_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__lacc_elink_fapl_copy(const char* name, size_t size, void* value); @@ -338,13 +338,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) +H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size, void *_udata) { - const hid_t *elink_fapl = (const hid_t *)value; /* Property to encode */ + const hid_t *elink_fapl = (const hid_t *)value; /* Property to encode */ uint8_t **pp = (uint8_t **)_pp; + H5P_enc_cb_info_t *udata = (H5P_enc_cb_info_t *)_udata; /* User data for encode callback */ H5P_genplist_t *fapl_plist; /* Pointer to property list */ hbool_t non_default_fapl = FALSE; /* Whether the FAPL is non-default */ - size_t fapl_size = 0; /* FAPL's encoded size */ + size_t fapl_size = 0; /* FAPL's encoded size */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -364,7 +365,7 @@ H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) /* Encode the property list, if non-default */ /* (if *pp == NULL, will only compute the size) */ if(non_default_fapl) { - if(H5P__encode(fapl_plist, TRUE, NULL, &fapl_size) < 0) + if(H5P__encode(fapl_plist, TRUE, NULL, &fapl_size, udata->fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list") if(*pp) { @@ -379,7 +380,7 @@ H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) UINT64ENCODE_VAR(*pp, enc_value, enc_size); /* encode the plist */ - if(H5P__encode(fapl_plist, TRUE, *pp, &fapl_size) < 0) + if(H5P__encode(fapl_plist, TRUE, *pp, &fapl_size, udata->fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list") *pp += fapl_size; @@ -688,7 +689,7 @@ H5P__lacc_elink_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *------------------------------------------------------------------------- */ static herr_t -H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) +H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const char *elink_pref = *(const char * const *)value; uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index be41e32..b3c472e 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -90,7 +90,7 @@ static herr_t H5P__ocrt_reg_prop(H5P_genclass_t *pclass); /* Property callbacks */ -static herr_t H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__ocrt_pipeline_dec(const void **_pp, void *value); static herr_t H5P__ocrt_pipeline_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__ocrt_pipeline_get(hid_t prop_id, const char *name, size_t size, void *value); @@ -1459,7 +1459,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size) +H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5O_pline_t *pline = (const H5O_pline_t *)value; uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 13463ae..2cf1342 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -176,21 +176,21 @@ H5_DLL hid_t H5P__new_plist_of_type(H5P_plist_type_t type); /* Encode/decode routines */ H5_DLL herr_t H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, - void *buf, size_t *nalloc); + void *buf, size_t *nalloc, hid_t fapl_id); H5_DLL hid_t H5P__decode(const void *buf); -H5_DLL herr_t H5P__encode_hsize_t(const void *value, void **_pp, size_t *size); -H5_DLL herr_t H5P__encode_size_t(const void *value, void **_pp, size_t *size); -H5_DLL herr_t H5P__encode_unsigned(const void *value, void **_pp, size_t *size); -H5_DLL herr_t H5P__encode_uint8_t(const void *value, void **_pp, size_t *size); -H5_DLL herr_t H5P__encode_hbool_t(const void *value, void **_pp, size_t *size); -H5_DLL herr_t H5P__encode_double(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__encode_hsize_t(const void *value, void **_pp, size_t *size, void *udata); +H5_DLL herr_t H5P__encode_size_t(const void *value, void **_pp, size_t *size, void *udata); +H5_DLL herr_t H5P__encode_unsigned(const void *value, void **_pp, size_t *size, void *udata); +H5_DLL herr_t H5P__encode_uint8_t(const void *value, void **_pp, size_t *size, void *udata); +H5_DLL herr_t H5P__encode_hbool_t(const void *value, void **_pp, size_t *size, void *udata); +H5_DLL herr_t H5P__encode_double(const void *value, void **_pp, size_t *size, void *udat); H5_DLL herr_t H5P__decode_hsize_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_size_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_unsigned(const void **_pp, void *value); H5_DLL herr_t H5P__decode_uint8_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_hbool_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_double(const void **_pp, void *value); -H5_DLL herr_t H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size, void *udata); H5_DLL herr_t H5P__decode_coll_md_read_flag_t(const void **_pp, void *value); /* Private OCPL routines */ diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 374c117..33847e6 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -84,6 +84,16 @@ typedef enum H5P_plist_type_t { /* Function pointer for library classes with properties to register */ typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass); +/* Move encode/decode callback typedefs from H5Ppublic.h: not exposed to user */ +/* Add a parameter to encode callback */ +typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *size, void *udata); +typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value); + +/* User data passed to encode callback */ +typedef struct H5P_enc_cb_info_t { + hid_t fapl_id; /* File access property list */ +} H5P_enc_cb_info_t; + /* * Each library property list class has a variable of this type that contains * class variables and methods used to initialize the class. diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index a2c0418..77aa816 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -116,8 +116,6 @@ typedef herr_t (*H5P_prp_cb2_t)(hid_t prop_id, const char *name, size_t size, vo typedef H5P_prp_cb1_t H5P_prp_create_func_t; typedef H5P_prp_cb2_t H5P_prp_set_func_t; typedef H5P_prp_cb2_t H5P_prp_get_func_t; -typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *size); -typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value); typedef H5P_prp_cb2_t H5P_prp_delete_func_t; typedef H5P_prp_cb1_t H5P_prp_copy_func_t; typedef int (*H5P_prp_compare_func_t)(const void *value1, const void *value2, size_t size); diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index fb91356..b84d69b 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -69,7 +69,7 @@ static herr_t H5P__strcrt_reg_prop(H5P_genclass_t *pclass); /* encode & decode callbacks */ -static herr_t H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__strcrt_char_encoding_dec(const void **_pp, void *value); @@ -227,7 +227,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size) +H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5T_cset_t *encoding = (const H5T_cset_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Rint.c b/src/H5Rint.c index 716a573..d9669c5 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -289,7 +289,7 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5 HDmemset(ref, 0, H5R_DSET_REG_REF_BUF_SIZE); /* Get the amount of space required to serialize the selection */ - if ((buf_size = H5S_SELECT_SERIAL_SIZE(space)) < 0) + if ((buf_size = H5S_SELECT_SERIAL_SIZE(space, loc->oloc->file)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection") /* Increase buffer size to allow for the dataset OID */ @@ -305,7 +305,7 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5 H5F_addr_encode(loc->oloc->file, &p, obj_loc.oloc->addr); /* Serialize the selection into heap buffer */ - if (H5S_SELECT_SERIALIZE(space, &p) < 0) + if (H5S_SELECT_SERIALIZE(space, &p, loc->oloc->file) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection") /* Save the serialized buffer for later */ @@ -1554,7 +1554,7 @@ H5Sencode(hid_t obj_id, void *buf, size_t *nalloc) if (NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - if(H5S_encode(dspace, (unsigned char **)&buf, nalloc)<0) + if(H5S_encode(dspace, (unsigned char **)&buf, nalloc, H5P_FILE_ACCESS_DEFAULT)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace") done: @@ -1579,7 +1579,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) +H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc, hid_t fapl_id) { H5F_t *f = NULL; /* Fake file structure*/ size_t extent_size; /* Size of serialized dataspace extent */ @@ -1590,7 +1590,7 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) FUNC_ENTER_NOAPI_NOINIT /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc((uint8_t)0))) + if(NULL == (f = H5F_fake_alloc((uint8_t)0, fapl_id))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") /* Find out the size of buffer needed for extent */ @@ -1598,7 +1598,7 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size") /* Find out the size of buffer needed for selection */ - if((sselect_size = H5S_SELECT_SERIAL_SIZE(obj)) < 0) + if((sselect_size = H5S_SELECT_SERIAL_SIZE(obj, f)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size") H5_CHECKED_ASSIGN(select_size, size_t, sselect_size, hssize_t); @@ -1628,7 +1628,7 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) /* Encode the selection part of dataspace. */ *p = pp; - if(H5S_SELECT_SERIALIZE(obj, p) < 0) + if(H5S_SELECT_SERIALIZE(obj, p, f) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space") } /* end else */ @@ -1722,8 +1722,8 @@ H5S_decode(const unsigned char **p) sizeof_size = *pp++; /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc(sizeof_size))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") + if(NULL == (f = H5F_fake_alloc(sizeof_size, H5P_FILE_ACCESS_DEFAULT))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") /* Decode size of extent information */ UINT32DECODE(pp, extent_size); diff --git a/src/H5Sall.c b/src/H5Sall.c index 710727b..98d7319 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -36,8 +36,8 @@ static herr_t H5S_all_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S_all_release(H5S_t *space); static htri_t H5S_all_is_valid(const H5S_t *space); -static hssize_t H5S_all_serial_size(const H5S_t *space); -static herr_t H5S_all_serialize(const H5S_t *space, uint8_t **p); +static hssize_t H5S_all_serial_size(const H5S_t *space, H5F_t *f); +static herr_t H5S_all_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); static herr_t H5S_all_deserialize(H5S_t *space, uint32_t version, uint8_t flags, const uint8_t **p); static herr_t H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); @@ -56,7 +56,7 @@ static herr_t H5S_all_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); static herr_t H5S_all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S_all_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S_all_iter_has_next_block(const H5S_sel_iter_t *iter); -static herr_t H5S_all_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); +static herr_t H5S_all_iter_next(H5S_sel_iter_t *sel_iter, hsize_t nelem); static herr_t H5S_all_iter_next_block(H5S_sel_iter_t *sel_iter); static herr_t H5S_all_iter_release(H5S_sel_iter_t *sel_iter); @@ -276,7 +276,7 @@ H5S_all_iter_has_next_block (const H5S_sel_iter_t H5_ATTR_UNUSED *iter) USAGE herr_t H5S_all_iter_next(iter, nelem) H5S_sel_iter_t *iter; IN: Pointer to selection iterator - size_t nelem; IN: Number of elements to advance by + hsize_t nelem; IN: Number of elements to advance by RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -287,7 +287,7 @@ H5S_all_iter_has_next_block (const H5S_sel_iter_t H5_ATTR_UNUSED *iter) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_all_iter_next(H5S_sel_iter_t *iter, size_t nelem) +H5S_all_iter_next(H5S_sel_iter_t *iter, hsize_t nelem) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -465,8 +465,9 @@ H5S_all_is_valid (const H5S_t H5_ATTR_UNUSED *space) Determine the number of bytes needed to store the serialized "all" selection information. USAGE - hssize_t H5S_all_serial_size(space) + hssize_t H5S_all_serial_size(space, f) H5S_t *space; IN: Dataspace pointer to query + H5F_t *f; IN: File pointer RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -478,7 +479,7 @@ H5S_all_is_valid (const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S_all_serial_size (const H5S_t H5_ATTR_UNUSED *space) +H5S_all_serial_size (const H5S_t H5_ATTR_UNUSED *space, H5F_t H5_ATTR_UNUSED *f) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -498,11 +499,12 @@ H5S_all_serial_size (const H5S_t H5_ATTR_UNUSED *space) PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_all_serialize(space, p) + herr_t H5S_all_serialize(space, p, f) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of serialized selection. + H5F_t *f; IN: File pointer RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -514,7 +516,7 @@ H5S_all_serial_size (const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_all_serialize(const H5S_t *space, uint8_t **p) +H5S_all_serialize(const H5S_t *space, uint8_t **p, H5F_t H5_ATTR_UNUSED *f) { uint8_t *pp = (*p); /* Local pointer for decoding */ @@ -526,8 +528,8 @@ H5S_all_serialize(const H5S_t *space, uint8_t **p) HDassert(pp); /* Store the preamble information */ - UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */ + UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ + UINT32ENCODE(pp, (uint32_t)H5S_ALL_VERSION_1); /* Store the version number */ UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 9263cd8..94b600d 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -28,6 +28,13 @@ #include "H5Spkg.h" /* Dataspace functions */ #include "H5VMprivate.h" /* Vector functions */ +/* Format version bounds for dataspace hyperslab selection */ +const unsigned H5O_sds_hyper_ver_bounds[] = { + H5S_HYPER_VERSION_1, /* H5F_LIBVER_EARLIEST */ + H5S_HYPER_VERSION_1, /* H5F_LIBVER_V18 */ + H5S_HYPER_VERSION_2 /* H5F_LIBVER_LATEST */ +}; + /* Local datatypes */ /* Static function prototypes */ @@ -55,8 +62,8 @@ static herr_t H5S_hyper_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S_hyper_release(H5S_t *space); static htri_t H5S_hyper_is_valid(const H5S_t *space); -static hssize_t H5S_hyper_serial_size(const H5S_t *space); -static herr_t H5S_hyper_serialize(const H5S_t *space, uint8_t **p); +static hssize_t H5S_hyper_serial_size(const H5S_t *space, H5F_t *f); +static herr_t H5S_hyper_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); static herr_t H5S_hyper_deserialize(H5S_t *space, uint32_t version, uint8_t flags, const uint8_t **p); static herr_t H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); @@ -77,7 +84,7 @@ static herr_t H5S_hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) static herr_t H5S_hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S_hyper_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S_hyper_iter_has_next_block(const H5S_sel_iter_t *sel_iter); -static herr_t H5S_hyper_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); +static herr_t H5S_hyper_iter_next(H5S_sel_iter_t *sel_iter, hsize_t nelem); static herr_t H5S_hyper_iter_next_block(H5S_sel_iter_t *sel_iter); static herr_t H5S_hyper_iter_release(H5S_sel_iter_t *sel_iter); @@ -664,7 +671,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5S_hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) +H5S_hyper_iter_next(H5S_sel_iter_t *iter, hsize_t nelem) { unsigned ndims; /* Number of dimensions of dataset */ int fast_dim; /* Rank of the fastest changing dimension for the dataspace */ @@ -714,14 +721,14 @@ H5S_hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) temp_dim=fast_dim; while(temp_dim>=0) { if(temp_dim==fast_dim) { - size_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ + hsize_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ hsize_t block_elem; /* Number of elements left in a block */ /* Compute the number of elements left in block */ block_elem=tdiminfo[temp_dim].block-iter_offset[temp_dim]; /* Compute the number of actual elements to advance */ - actual_elem=(size_t)MIN(nelem,block_elem); + actual_elem=MIN(nelem,block_elem); /* Move the iterator over as many elements as possible */ iter_offset[temp_dim]+=actual_elem; @@ -785,14 +792,14 @@ H5S_hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) /* Increment absolute position */ if(curr_dim==fast_dim) { - size_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ + hsize_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ hsize_t span_elem; /* Number of elements left in a span */ /* Compute the number of elements left in block */ span_elem=(curr_span->high-abs_arr[curr_dim])+1; /* Compute the number of actual elements to advance */ - actual_elem=(size_t)MIN(nelem,span_elem); + actual_elem=MIN(nelem,span_elem); /* Move the iterator over as many elements as possible */ abs_arr[curr_dim]+=actual_elem; @@ -1941,13 +1948,140 @@ done: /*-------------------------------------------------------------------------- NAME + H5S_hyper_set_offset_size + PURPOSE + Determine the offset size (4 or 8 bytes) to use for encoding hyperslab selection info + USAGE + hssize_t H5S_hyper_set_offset_size(space, block_count, bounds_end, version, offset_size) + const H5S_t *space: IN: The maximum size of the hyperslab selection info + hsize_t block_count: IN: The number of blocks in the selection + hsize_t bounds_end: IN: The selection high bounds + uint32_t version: IN: The version used for encoding + uint8_t *offset_size: OUT: The offset size + + RETURNS + The offset size + DESCRIPTION + Determine the offset size for encoding hyperslab selection info based on the + the input parameter "version". This is for release 1.10. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5S_hyper_set_offset_size(const H5S_t *space, hsize_t block_count, hsize_t bounds_end[], uint32_t version, uint8_t *offset_size) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + switch(version) { + case H5S_HYPER_VERSION_1: + *offset_size = H5S_INFO_SIZE_4; + break; + + case H5S_HYPER_VERSION_2: + *offset_size = H5S_INFO_SIZE_8; + break; + + default: + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper offset size") + break; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5S_hyper_set_offset_size() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S_hyper_set_version + PURPOSE + Determine the version to use for encoding hyperslab selection info + See tables 2 & 3 in the RFC: H5Sencode/H5Sdecode Format Change + USAGE + hssize_t H5S_hyper_set_version(space, block_count, bounds_end, f, version) + const H5S_t *space: IN: The dataspace + hsize_t block_count: IN: The number of blocks in the selection + hsize_t bounds_end: IN: The selection high bounds + H5F_t *f: IN: The file pointer + uint32_t *version: OUT: The version to use for encoding + + RETURNS + The version to use + DESCRIPTION + Determine the version to use for encoding hyperslab selection info based + on whether the number of blocks or the selection high bounds exceeds (2^32 - 1). + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5S_hyper_set_version(const H5S_t *space, hsize_t block_count, hsize_t bounds_end[], H5F_t *f, uint32_t *version) +{ + hbool_t count_up_version = FALSE; /* Whether number of blocks exceed (2^32 - 1) */ + hbool_t bound_up_version = FALSE; /* Whether high bounds exceed (2^32 - 1) */ + unsigned u; /* Local index veriable */ + uint32_t tmp_version; /* Temporay version */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Determine whether the number of blocks or the high bounds in the selection exceed (2^32 - 1) */ + if(block_count > H5S_UINT32_MAX) + count_up_version = TRUE; + else { + for(u = 0; u < space->extent.rank; u++) + if(bounds_end[u] > H5S_UINT32_MAX) + bound_up_version = TRUE; + } + + /* Use version 2 for unlimited selection */ + if(space->select.sel_info.hslab->unlim_dim >= 0) + tmp_version = H5S_HYPER_VERSION_2; + else if(H5S_hyper_is_regular(space)) { + + /* If exceed (2^32 -1) */ + if(count_up_version || bound_up_version) + tmp_version = H5S_HYPER_VERSION_2; + else + /* block_count < 4: version 1 */ + /* block_count >= 4: determined by low bound */ + tmp_version = (block_count < 4) ? H5S_HYPER_VERSION_1 : H5O_sds_hyper_ver_bounds[H5F_LOW_BOUND(f)]; + + } else { + /* Fail for irregular hyperslab if exceeds 32 bits */ + if(count_up_version) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The number of blocks in hyperslab selection exceeds 2^32") + else if(bound_up_version) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The end of bounding box in hyperslab selection exceeds 2^32") + tmp_version = H5S_HYPER_VERSION_1; + } + + /* Version bounds check */ + if(tmp_version > H5O_sds_hyper_ver_bounds[H5F_HIGH_BOUND(f)]) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "Dataspace hyperslab selection version out of bounds") + + *version = tmp_version; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5S_hyper_set_version() */ + + +/*-------------------------------------------------------------------------- + NAME H5S_hyper_serial_size PURPOSE Determine the number of bytes needed to store the serialized hyperslab selection information. USAGE - hssize_t H5S_hyper_serial_size(space) + hssize_t H5S_hyper_serial_size(space, H5F_t *f) H5S_t *space; IN: Dataspace pointer to query + H5F_t *f; IN: File pointer RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -1959,52 +2093,72 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S_hyper_serial_size(const H5S_t *space) +H5S_hyper_serial_size(const H5S_t *space, H5F_t *f) { - hsize_t block_count; /* block counter for regular hyperslabs */ - unsigned u; /* Counter */ - hssize_t ret_value = -1; /* return value */ + hsize_t block_count = 0; /* block counter for regular hyperslabs */ + hsize_t bounds_start[H5S_MAX_RANK]; /* Selection bounds */ + hsize_t bounds_end[H5S_MAX_RANK]; /* Selection bounds */ + uint32_t version; /* Version number */ + uint8_t offset_size; /* Offset size */ + unsigned u; /* Local index variable */ + hssize_t ret_value = -1; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_NOAPI_NOINIT HDassert(space); - /* Check for version (right now, an unlimited dimension is the only thing - * that would bump the version) */ - if(space->select.sel_info.hslab->unlim_dim >= 0) + /* Get bounding box for the selection */ + HDmemset(bounds_end, 0, sizeof(bounds_end)); + if(space->select.sel_info.hslab->unlim_dim < 0) { /* ! H5S_UNLIMITED */ + /* Determine the number of blocks */ + if(H5S_hyper_is_regular(space)) { + /* Check each dimension */ + for(block_count = 1, u = 0; u < space->extent.rank; u++) + block_count *= space->select.sel_info.hslab->opt_diminfo[u].count; + } /* end if */ + else + /* Spin through hyperslab spans, adding 8 * rank bytes for each block */ + block_count = H5S_hyper_span_nblocks(space->select.sel_info.hslab->span_lst); + + /* Get bounding box for the selection */ + if(H5S_hyper_bounds(space, bounds_start, bounds_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") + } + + /* Determine the version */ + if(H5S_hyper_set_version(space, block_count, bounds_end, f, &version) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + /* Determine the offset size */ + if(H5S_hyper_set_offset_size(space, block_count, bounds_end, version, &offset_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + if(version == H5S_HYPER_VERSION_2) { /* Version 2 */ /* Size required is always: * <type (4 bytes)> + <version (4 bytes)> + <flags (1 byte)> + * <length (4 bytes)> + <rank (4 bytes)> + - * (4 (start/stride/count/block) * <rank> * <value (8 bytes)>) = - * 17 + (4 * rank * 8) bytes + * (4 (start/stride/count/block) * <offset_size (8 bytes)> * <rank>) = + * 17 + (4 * 8 * rank) bytes */ - ret_value = (hssize_t)17 + ((hssize_t)4 * (hssize_t)space->extent.rank - * (hssize_t)8); - else { + HDassert(offset_size == 8); + ret_value = (hssize_t)17 + ((hssize_t)4 * (hssize_t)8 * (hssize_t)space->extent.rank); + } else { + HDassert(version == H5S_HYPER_VERSION_1); + HDassert(offset_size == 4); /* Version 1 */ /* Basic number of bytes required to serialize hyperslab selection: * <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> + - * <length (4 bytes)> + <rank (4 bytes)> + <# of blocks (4 bytes)> - * = 24 bytes + * <length (4 bytes)> + <rank (4 bytes)> + <# of blocks (4 bytes)> + + * (2 (starting/ending offset) * <offset_size (4 bytes)> * <rank> * <# of blocks) = + * = 24 bytes + (2 * 4 * rank * block_count) */ ret_value = 24; - - /* Check for a "regular" hyperslab selection */ - if(space->select.sel_info.hslab->diminfo_valid) { - /* Check each dimension */ - for(block_count = 1, u = 0; u < space->extent.rank; u++) - block_count *= space->select.sel_info.hslab->opt_diminfo[u].count; - } /* end if */ - else - /* Spin through hyperslab spans, adding 8 * rank bytes for each - * block */ - block_count = H5S_hyper_span_nblocks(space->select.sel_info.hslab->span_lst); - H5_CHECK_OVERFLOW((8 * space->extent.rank * block_count), hsize_t, hssize_t); - ret_value += (hssize_t)(8 * block_count * space->extent.rank); + ret_value += (hssize_t)(8 * space->extent.rank * block_count); } /* end else */ +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_serial_size() */ @@ -2100,6 +2254,7 @@ H5S_hyper_serialize_helper(const H5S_hyper_span_info_t *spans, uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of serialized selection. + H5F_t *f; IN: File pointer RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -2111,15 +2266,15 @@ H5S_hyper_serialize_helper(const H5S_hyper_span_info_t *spans, REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_hyper_serialize(const H5S_t *space, uint8_t **p) +H5S_hyper_serialize(const H5S_t *space, uint8_t **p, H5F_t *f) { const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */ uint8_t *pp = (*p); /* Local pointer for decoding */ hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */ - hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */ + hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */ hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */ hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */ - hsize_t temp_off; /* Offset in a given dimension */ + hsize_t temp_off; /* Offset in a given dimension */ uint8_t *lenp; /* pointer to length location for later storage */ uint32_t len = 0; /* number of bytes used */ uint32_t version; /* Version number */ @@ -2127,63 +2282,89 @@ H5S_hyper_serialize(const H5S_t *space, uint8_t **p) hsize_t block_count; /* block counter for regular hyperslabs */ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */ unsigned ndims; /* Rank of the dataspace */ + unsigned u; /* Local counting variable */ int done; /* Whether we are done with the iteration */ + uint8_t offset_size; + hsize_t bounds_start[H5S_MAX_RANK]; + hsize_t bounds_end[H5S_MAX_RANK]; + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_NOAPI_NOINIT HDassert(space); HDassert(p); HDassert(pp); - /* Calculate version */ - if(space->select.sel_info.hslab->unlim_dim >= 0) { - version = 2; - flags |= H5S_SELECT_FLAG_UNLIM; - } /* end if */ - else - version = 1; + /* Set some convienence values */ + ndims = space->extent.rank; + diminfo = space->select.sel_info.hslab->opt_diminfo; + + if(space->select.sel_info.hslab->unlim_dim < 0) { /* ! H5S_UNLIMITED */ + /* Calculate the # of blocks */ + if(H5S_hyper_is_regular(space)) { + /* Check each dimension */ + for(block_count = 1, u = 0; u < ndims; u++) + block_count *= diminfo[u].count; + } /* end if */ + else + /* Spin through hyperslab spans, adding 8 * rank bytes for each block */ + block_count = H5S_hyper_span_nblocks(space->select.sel_info.hslab->span_lst); + + /* Get bounding box */ + if(H5S_hyper_bounds(space, bounds_start, bounds_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") + } + + /* Determine the version to use */ + if(H5S_hyper_set_version(space, block_count, bounds_end, f, &version) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + /* Determine the size of offset info */ + if(H5S_hyper_set_offset_size(space, block_count, bounds_end, version, &offset_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + if(H5S_hyper_is_regular(space) && version == H5S_HYPER_VERSION_2) + flags |= H5S_HYPER_REGULAR; /* Store the preamble information */ UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ UINT32ENCODE(pp, version); /* Store the version number */ - if(version >= 2) - *(pp)++ = flags; /* Store the flags */ + + if(version == 2) + *(pp)++ = flags; /* Store the flags */ else UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ - lenp = pp; /* keep the pointer to the length location for later */ - pp += 4; /* skip over space for length */ + lenp = pp; /* keep the pointer to the length location for later */ + pp += 4; /* skip over space for length */ + + len += 4; /* ndims */ /* Encode number of dimensions */ - UINT32ENCODE(pp, (uint32_t)space->extent.rank); - len += 4; + UINT32ENCODE(pp, (uint32_t)ndims); - /* If there is an unlimited dimension, only encode opt_unlim_diminfo */ - if(flags & H5S_SELECT_FLAG_UNLIM) { + /* If flags indicates a regular hyperslab or unlimited dimension, encode opt_diminfo */ + if(flags & H5S_HYPER_REGULAR) { unsigned i; HDassert(H5S_UNLIMITED == HSIZE_UNDEF); + HDassert(version == H5S_HYPER_VERSION_2); /* Iterate over dimensions */ + /* Encode start/stride/block/count */ for(i = 0; i < space->extent.rank; i++) { - /* Encode start/stride/block/count */ - UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].start); - UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].stride); - UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].count); - UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].block); + UINT64ENCODE(pp, diminfo[i].start); + UINT64ENCODE(pp, diminfo[i].stride); + UINT64ENCODE(pp, diminfo[i].count); + UINT64ENCODE(pp, diminfo[i].block); } /* end for */ + len += (4 * space->extent.rank * 8); } /* end if */ /* Check for a "regular" hyperslab selection */ - else if(space->select.sel_info.hslab->diminfo_valid) { - unsigned u; /* Local counting variable */ + else if(H5S_hyper_is_regular(space)) { + HDassert(version == H5S_HYPER_VERSION_1); /* Set some convienence values */ - ndims = space->extent.rank; fast_dim = ndims - 1; - diminfo=space->select.sel_info.hslab->opt_diminfo; - - /* Check each dimension */ - for(block_count = 1, u = 0; u < ndims; u++) - block_count *= diminfo[u].count; /* Encode number of hyperslabs */ H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t); @@ -2262,15 +2443,16 @@ H5S_hyper_serialize(const H5S_t *space, uint8_t **p) } /* end while */ } /* end if */ else { + HDassert(version == H5S_HYPER_VERSION_1); /* Encode number of hyperslabs */ - block_count = H5S_hyper_span_nblocks(space->select.sel_info.hslab->span_lst); H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t); UINT32ENCODE(pp, (uint32_t)block_count); - len+=4; + + len+=4; /* block_count */ /* Add 8 bytes times the rank for each hyperslab selected */ - H5_CHECK_OVERFLOW((8 * space->extent.rank * block_count), hsize_t, size_t); - len += (uint32_t)(8 * space->extent.rank * block_count); + H5_CHECK_OVERFLOW((8 * ndims * block_count), hsize_t, size_t); + len += (uint32_t)(8 * ndims * block_count); /* Encode each hyperslab in selection */ H5S_hyper_serialize_helper(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, &pp); @@ -2282,7 +2464,8 @@ H5S_hyper_serialize(const H5S_t *space, uint8_t **p) /* Update encoding pointer */ *p = pp; - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_hyper_serialize() */ @@ -2316,7 +2499,7 @@ H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fla { unsigned rank; /* rank of points */ const uint8_t *pp = (*p); /* Local pointer for decoding */ - size_t num_elem=0; /* number of elements in selection */ + hsize_t num_elem=0; /* number of elements in selection */ hsize_t start[H5O_LAYOUT_NDIMS]; /* hyperslab start information */ hsize_t end[H5O_LAYOUT_NDIMS]; /* hyperslab end information */ hsize_t stride[H5O_LAYOUT_NDIMS]; /* hyperslab stride information */ @@ -2341,14 +2524,13 @@ H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fla /* (The header and rank have already beed decoded) */ rank = space->extent.rank; /* Retrieve rank from space */ - /* If there is an unlimited dimension, only encode opt_unlim_diminfo */ - if(flags & H5S_SELECT_FLAG_UNLIM) { + if(flags & H5S_HYPER_REGULAR) { HDassert(H5S_UNLIMITED == HSIZE_UNDEF); HDassert(version >= 2); /* Iterate over dimensions */ + /* Decode start/stride/block/count */ for(i = 0; i < space->extent.rank; i++) { - /* Decode start/stride/block/count */ UINT64DECODE(pp, start[i]); UINT64DECODE(pp, stride[i]); UINT64DECODE(pp, count[i]); @@ -2360,7 +2542,7 @@ H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fla HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") } /* end if */ else { - /* decode the number of points */ + /* decode the number of blocks */ UINT32DECODE(pp,num_elem); /* Set the count & stride for all blocks */ @@ -2371,11 +2553,10 @@ H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fla /* Retrieve the coordinates from the buffer */ for(i = 0; i < num_elem; i++) { - /* Decode the starting points */ + + /* Decode the starting and ending points */ for(tstart=start,j=0; j<rank; j++,tstart++) UINT32DECODE(pp, *tstart); - - /* Decode the ending points */ for(tend = end, j = 0; j < rank; j++, tend++) UINT32DECODE(pp, *tend); diff --git a/src/H5Snone.c b/src/H5Snone.c index 104b0bb..160745b 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -37,8 +37,8 @@ static herr_t H5S_none_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S_none_release(H5S_t *space); static htri_t H5S_none_is_valid(const H5S_t *space); -static hssize_t H5S_none_serial_size(const H5S_t *space); -static herr_t H5S_none_serialize(const H5S_t *space, uint8_t **p); +static hssize_t H5S_none_serial_size(const H5S_t *space, H5F_t *f); +static herr_t H5S_none_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); static herr_t H5S_none_deserialize(H5S_t *space, uint32_t version, uint8_t flags, const uint8_t **p); static herr_t H5S_none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); @@ -57,7 +57,7 @@ static herr_t H5S_none_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); static herr_t H5S_none_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S_none_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S_none_iter_has_next_block(const H5S_sel_iter_t *iter); -static herr_t H5S_none_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); +static herr_t H5S_none_iter_next(H5S_sel_iter_t *sel_iter, hsize_t nelem); static herr_t H5S_none_iter_next_block(H5S_sel_iter_t *sel_iter); static herr_t H5S_none_iter_release(H5S_sel_iter_t *sel_iter); @@ -251,7 +251,7 @@ H5S_none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) USAGE herr_t H5S_none_iter_next(iter, nelem) H5S_sel_iter_t *iter; IN: Pointer to selection iterator - size_t nelem; IN: Number of elements to advance by + hsize_t nelem; IN: Number of elements to advance by RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -262,7 +262,7 @@ H5S_none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED nelem) +H5S_none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_UNUSED nelem) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -433,8 +433,9 @@ H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space) Determine the number of bytes needed to store the serialized "none" selection information. USAGE - hssize_t H5S_none_serial_size(space) + hssize_t H5S_none_serial_size(space, f) H5S_t *space; IN: Dataspace pointer to query + H5F_t *f; IN: File pointer RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -446,7 +447,7 @@ H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space) +H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space, H5F_t H5_ATTR_UNUSED *f) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -466,11 +467,12 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space) PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_none_serialize(space, p) + herr_t H5S_none_serialize(space, p, f) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of serialized selection. + H5F_t *f; IN: File pointer RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -482,7 +484,7 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_serialize(const H5S_t *space, uint8_t **p) +H5S_none_serialize(const H5S_t *space, uint8_t **p, H5F_t H5_ATTR_UNUSED *f) { uint8_t *pp = (*p); /* Local pointer for decoding */ @@ -494,8 +496,8 @@ H5S_none_serialize(const H5S_t *space, uint8_t **p) HDassert(pp); /* Store the preamble information */ - UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */ + UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ + UINT32ENCODE(pp, (uint32_t)H5S_NONE_VERSION_1); /* Store the version number */ UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */ diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 5312ce7..75c5e77 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -33,8 +33,28 @@ #define H5S_VALID_PERM 0x02 /* Flags for serialization of selections */ -#define H5S_SELECT_FLAG_UNLIM 0x01 -#define H5S_SELECT_FLAG_BITS (H5S_SELECT_FLAG_UNLIM) +#define H5S_HYPER_REGULAR 0x01 +#define H5S_SELECT_FLAG_BITS (H5S_HYPER_REGULAR) + +/* Versions for H5S_SEL_HYPER selection info */ +#define H5S_HYPER_VERSION_1 1 +#define H5S_HYPER_VERSION_2 2 + +/* Versions for H5S_SEL_POINTS selection info */ +#define H5S_POINT_VERSION_1 1 + +/* Versions for H5S_SEL_NONE selection info */ +#define H5S_NONE_VERSION_1 1 + +/* Versions for H5S_SEL_ALL selection info */ +#define H5S_ALL_VERSION_1 1 + +/* Size of point/offset info for H5S_SEL_POINTS/H5S_SEL_HYPER */ +#define H5S_INFO_SIZE_4 0x04 /* 4 bytes: 32 bits */ +#define H5S_INFO_SIZE_8 0x08 /* 8 bytes: 64 bits */ +#define H5S_SELECT_INFO_SIZE_BITS (H5S_INFO_SIZE_4|H5S_INFO_SIZE_8) + +#define H5S_UINT32_MAX 4294967295 /* 2^32 - 1 */ /* Length of stack-allocated sequences for "project intersect" routines */ #define H5S_PROJECT_INTERSECT_NSEQS 256 @@ -139,9 +159,9 @@ typedef herr_t (*H5S_sel_release_func_t)(H5S_t *space); /* Method to determine if current selection is valid for dataspace */ typedef htri_t (*H5S_sel_is_valid_func_t)(const H5S_t *space); /* Method to determine number of bytes required to store current selection */ -typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space); +typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space, H5F_t *f); /* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */ -typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t **p); +typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t **p, H5F_t *f); /* Method to create selection from "serialized" form (a byte sequence suitable for storing on disk) */ typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t *space, uint32_t version, uint8_t flags, const uint8_t **p); @@ -222,7 +242,7 @@ typedef hsize_t (*H5S_sel_iter_nelmts_func_t)(const H5S_sel_iter_t *iter); /* Method to determine if there are more blocks left in the current selection */ typedef htri_t (*H5S_sel_iter_has_next_block_func_t)(const H5S_sel_iter_t *iter); /* Method to move selection iterator to the next element in the selection */ -typedef herr_t (*H5S_sel_iter_next_func_t)(H5S_sel_iter_t *iter, size_t nelem); +typedef herr_t (*H5S_sel_iter_next_func_t)(H5S_sel_iter_t *iter, hsize_t nelem); /* Method to move selection iterator to the next block in the selection */ typedef herr_t (*H5S_sel_iter_next_block_func_t)(H5S_sel_iter_t *iter); /* Method to release iterator for current selection */ @@ -262,8 +282,9 @@ H5_DLLVAR const H5S_select_class_t H5S_sel_none[1]; */ H5_DLLVAR const H5S_select_class_t H5S_sel_point[1]; -/* Array of versions for Dataspace */ +/* Array of versions for Dataspace and hyperslab selections */ H5_DLLVAR const unsigned H5O_sdspace_ver_bounds[H5F_LIBVER_NBOUNDS]; +H5_DLLVAR const unsigned H5O_sds_hyper_ver_bounds[H5F_LIBVER_NBOUNDS]; /* Extent functions */ H5_DLL herr_t H5S_extent_release(H5S_extent_t *extent); diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 251a063..d13dd0a 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -38,8 +38,8 @@ static herr_t H5S_point_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S_point_release(H5S_t *space); static htri_t H5S_point_is_valid(const H5S_t *space); -static hssize_t H5S_point_serial_size(const H5S_t *space); -static herr_t H5S_point_serialize(const H5S_t *space, uint8_t **p); +static hssize_t H5S_point_serial_size(const H5S_t *space, H5F_t *f); +static herr_t H5S_point_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); static herr_t H5S_point_deserialize(H5S_t *space, uint32_t version, uint8_t flags, const uint8_t **p); static herr_t H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); @@ -58,7 +58,7 @@ static herr_t H5S_point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) static herr_t H5S_point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S_point_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter); -static herr_t H5S_point_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); +static herr_t H5S_point_iter_next(H5S_sel_iter_t *sel_iter, hsize_t nelem); static herr_t H5S_point_iter_next_block(H5S_sel_iter_t *sel_iter); static herr_t H5S_point_iter_release(H5S_sel_iter_t *sel_iter); @@ -278,7 +278,7 @@ done: USAGE herr_t H5S_point_iter_next(iter, nelem) H5S_sel_iter_t *iter; IN: Pointer to selection iterator - size_t nelem; IN: Number of elements to advance by + hsize_t nelem; IN: Number of elements to advance by RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -289,7 +289,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem) +H5S_point_iter_next(H5S_sel_iter_t *iter, hsize_t nelem) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -376,7 +376,7 @@ H5S_point_iter_release (H5S_sel_iter_t H5_ATTR_UNUSED * iter) USAGE herr_t H5S_point_add(space, num_elem, coord) H5S_t *space; IN: Dataspace of selection to modify - size_t num_elem; IN: Number of elements in COORD array. + hsize_t num_elem; IN: Number of elements in COORD array. const hsize_t *coord[]; IN: The location of each element selected RETURNS Non-negative on success/Negative on failure @@ -388,7 +388,7 @@ H5S_point_iter_release (H5S_sel_iter_t H5_ATTR_UNUSED * iter) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *coord) +H5S_point_add(H5S_t *space, H5S_seloper_t op, hsize_t num_elem, const hsize_t *coord) { H5S_pnt_node_t *top = NULL, *curr = NULL, *new_node = NULL; /* Point selection nodes */ unsigned u; /* Counter */ @@ -527,7 +527,7 @@ H5S_point_release (H5S_t *space) herr_t H5S_select_elements(dsid, op, num_elem, coord) hid_t dsid; IN: Dataspace ID of selection to modify H5S_seloper_t op; IN: Operation to perform on current selection - size_t num_elem; IN: Number of elements in COORD array. + hsize_t num_elem; IN: Number of elements in COORD array. const hsize_t *coord; IN: The location of each element selected RETURNS Non-negative on success/Negative on failure @@ -549,7 +549,7 @@ H5S_point_release (H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem, +H5S_select_elements(H5S_t *space, H5S_seloper_t op, hsize_t num_elem, const hsize_t *coord) { herr_t ret_value = SUCCEED; /* return value */ @@ -752,6 +752,93 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Sget_select_elem_npoints() */ +/*-------------------------------------------------------------------------- + NAME + H5S_point_set_version + PURPOSE + Determine the version to use for encoding points selection info + USAGE + hssize_t H5S_point_set_version(space, bounds_end, f, version) + const H5S_t *space; IN: The dataspace + hsize_t bounds_end: IN: The selection high bounds + H5F_t *f: IN: The file pointer + uint32_t *version: OUT: The version to use for encoding + RETURNS + The version to use + DESCRIPTION + Determine the version to use for encoding points selection info: + For 1.10, return 1 + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5S_point_set_version(const H5S_t *space, hsize_t bounds_end[], H5F_t *f, uint32_t *version) +{ + hbool_t exceed = FALSE; + unsigned u; + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_NOAPI_NOINIT + + *version = H5S_POINT_VERSION_1; + + /* Determine whether the number of points or the high bounds in the selection exceed (2^32 - 1) */ + for(u = 0; u < space->extent.rank; u++) + if(bounds_end[u] > H5S_UINT32_MAX) { + exceed = TRUE; + break; + } + + if(space->select.num_elem > H5S_UINT32_MAX) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The number of points in point selection exceeds 2^32") + else if(exceed) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The end of bounding box in point selection exceeds 2^32") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5S_point_set_version() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S_point_set_info_size + PURPOSE + Determine the size of point info to use for encoding selection info + USAGE + hssize_t H5S_point_set_info_size(space, bounds_end, version, point_size) + const H5S_t *space: IN: Dataspace ID of selection to query + hsize_t bounds_end[]: IN: The selection high bounds + uint32_t version: IN: The version used for encoding + uint8_t *point_size: OUT: The size of point info + RETURNS + The size of the points selection info + DESCRIPTION + Determine the size for encoding points selection info: + For 1.10, return 4 + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5S_point_set_info_size(const H5S_t *space, hsize_t H5_ATTR_UNUSED bounds_end[], uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED *point_size) +{ + hsize_t max_size = 0; + unsigned u; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(version == H5S_POINT_VERSION_1); + + *point_size = H5S_INFO_SIZE_4; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5S_point_set_info_size() */ + /*-------------------------------------------------------------------------- NAME @@ -760,8 +847,9 @@ done: Determine the number of bytes needed to store the serialized point selection information. USAGE - hssize_t H5S_point_serial_size(space) + hssize_t H5S_point_serial_size(space, f) H5S_t *space; IN: Dataspace pointer to query + H5F_t *f; IN: File pointer RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -773,29 +861,54 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S_point_serial_size (const H5S_t *space) +H5S_point_serial_size (const H5S_t *space, H5F_t *f) { H5S_pnt_node_t *curr; /* Point information nodes */ + hsize_t bounds_start[H5S_MAX_RANK]; + hsize_t bounds_end[H5S_MAX_RANK]; + uint32_t version; /* Version number */ + uint8_t point_size; /* Size of point info */ hssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_NOAPI_NOINIT HDassert(space); - /* Basic number of bytes required to serialize point selection: + /* Get bounding box for the selection */ + HDmemset(bounds_end, 0, sizeof(bounds_end)); + if(H5S_point_bounds(space, bounds_start, bounds_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") + + /* Determine the version */ + if(H5S_point_set_version(space, bounds_end, f, &version) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + /* Determine the size of point info */ + if(H5S_point_set_info_size(space, bounds_end, version, &point_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + HDassert(version == H5S_POINT_VERSION_1); + HDassert(point_size == H5S_INFO_SIZE_4); + + /* Basic number of bytes required to serialize point selection: */ + /* * <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> + - * <length (4 bytes)> + <rank (4 bytes)> + <# of points (4 bytes)> = 24 bytes + * <length (4 bytes)> + <rank (4 bytes)> */ - ret_value=24; + ret_value=20; + + /* <num points (depend on point_size)> */ + ret_value += point_size; /* Count points in selection */ curr=space->select.sel_info.pnt_lst->head; while(curr!=NULL) { - /* Add 4 bytes times the rank for each element selected */ - ret_value+=4*space->extent.rank; - curr=curr->next; + /* Add <point_size> bytes times the rank for each element selected */ + ret_value += point_size * space->extent.rank; + curr = curr->next; } /* end while */ +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_point_serial_size() */ @@ -806,11 +919,12 @@ H5S_point_serial_size (const H5S_t *space) PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_point_serialize(space, p) + herr_t H5S_point_serialize(space, p, f) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of serialized selection. + H5F_t *f; IN: File pointer RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -822,41 +936,63 @@ H5S_point_serial_size (const H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_serialize (const H5S_t *space, uint8_t **p) +H5S_point_serialize (const H5S_t *space, uint8_t **p, H5F_t *f) { H5S_pnt_node_t *curr; /* Point information nodes */ uint8_t *pp = (*p); /* Local pointer for decoding */ uint8_t *lenp; /* pointer to length location for later storage */ uint32_t len=0; /* number of bytes used */ unsigned u; /* local counting variable */ + uint32_t version; /* Version number */ + uint8_t point_size; /* Size of point info */ + hsize_t bounds_start[H5S_MAX_RANK]; + hsize_t bounds_end[H5S_MAX_RANK]; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_NOAPI_NOINIT /* Check args */ HDassert(space); HDassert(p); HDassert(pp); + /* Get bounding box for the selection */ + HDmemset(bounds_end, 0, sizeof(bounds_end)); + if(H5S_point_bounds(space, bounds_start, bounds_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") + + /* Determine the version */ + if(H5S_point_set_version(space, bounds_end, f, &version) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + /* Determine the size of point info */ + if(H5S_point_set_info_size(space, bounds_end, version, &point_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + HDassert(point_size == H5S_INFO_SIZE_4); + HDassert(version == H5S_POINT_VERSION_1); + /* Store the preamble information */ UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */ + UINT32ENCODE(pp, version); /* Store the version number */ + UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ - lenp = pp; /* Keep the pointer to the length location for later */ - pp += 4; /* Skip over space for length */ + lenp = pp; /* Keep the pointer to the length location for later */ + pp += 4; /* Skip over space for length */ + len += 8; /* Add in advance # of bytes for num of dimensions and num elements */ /* Encode number of dimensions */ UINT32ENCODE(pp, (uint32_t)space->extent.rank); - len+=4; + /* Encode number of elements */ UINT32ENCODE(pp, (uint32_t)space->select.num_elem); - len+=4; /* Encode each point in selection */ curr=space->select.sel_info.pnt_lst->head; while(curr!=NULL) { /* Add 4 bytes times the rank for each element selected */ - len+=4*space->extent.rank; + len += 4 * space->extent.rank; /* Encode each point */ for(u=0; u<space->extent.rank; u++) @@ -871,7 +1007,8 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p) /* Update encoding pointer */ *p = pp; - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_point_serialize() */ @@ -906,7 +1043,7 @@ H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ H5S_seloper_t op = H5S_SELECT_SET; /* Selection operation */ hsize_t *coord = NULL, *tcoord; /* Pointer to array of elements */ const uint8_t *pp = (*p); /* Local pointer for decoding */ - size_t num_elem = 0; /* Number of elements in selection */ + hsize_t num_elem = 0; /* Number of elements in selection */ unsigned rank; /* Rank of points */ unsigned i, j; /* local counting variables */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1619,7 +1756,7 @@ H5Sselect_elements(hid_t spaceid, H5S_seloper_t op, size_t num_elem, HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "unsupported operation attempted") /* Call the real element selection routine */ - if((ret_value = H5S_select_elements(space, op, num_elem, coord)) < 0) + if((ret_value = H5S_select_elements(space, op, (hsize_t)num_elem, coord)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't select elements") done: diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index bb84ebd..e8a42e8 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -149,8 +149,8 @@ typedef struct H5S_sel_iter_op_t { #define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) ((*(S)->select.type->get_seq_list)(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN)) #define H5S_SELECT_VALID(S) ((*(S)->select.type->is_valid)(S)) #define H5S_SELECT_RELEASE(S) ((*(S)->select.type->release)(S)) -#define H5S_SELECT_SERIAL_SIZE(S) ((*(S)->select.type->serial_size)(S)) -#define H5S_SELECT_SERIALIZE(S,BUF) ((*(S)->select.type->serialize)(S,BUF)) +#define H5S_SELECT_SERIAL_SIZE(S,F) ((*(S)->select.type->serial_size)(S,F)) +#define H5S_SELECT_SERIALIZE(S,BUF,F) ((*(S)->select.type->serialize)(S,BUF,F)) #define H5S_SELECT_BOUNDS(S,START,END) ((*(S)->select.type->bounds)(S,START,END)) #define H5S_SELECT_OFFSET(S, OFFSET) ((*(S)->select.type->offset)(S, OFFSET)) #define H5S_SELECT_IS_CONTIGUOUS(S) ((*(S)->select.type->is_contiguous)(S)) @@ -175,8 +175,8 @@ typedef struct H5S_sel_iter_op_t { #define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) (H5S_select_get_seq_list(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN)) #define H5S_SELECT_VALID(S) (H5S_select_valid(S)) #define H5S_SELECT_RELEASE(S) (H5S_select_release(S)) -#define H5S_SELECT_SERIAL_SIZE(S) (H5S_select_serial_size(S)) -#define H5S_SELECT_SERIALIZE(S,BUF) (H5S_select_serialize(S,BUF)) +#define H5S_SELECT_SERIAL_SIZE(S,F) (H5S_select_serial_size(S,F)) +#define H5S_SELECT_SERIALIZE(S,BUF,F) (H5S_select_serialize(S,BUF,F)) #define H5S_SELECT_BOUNDS(S,START,END) (H5S_get_select_bounds(S,START,END)) #define H5S_SELECT_OFFSET(S, OFFSET) (H5S_get_select_offset(S, OFFSET)) #define H5S_SELECT_IS_CONTIGUOUS(S) (H5S_select_is_contiguous(S)) @@ -220,7 +220,7 @@ H5_DLL H5S_t *H5S_create(H5S_class_t type); 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); +H5_DLL herr_t H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc, hid_t fapl_id); H5_DLL H5S_t *H5S_decode(const unsigned char **p); H5_DLL herr_t H5S_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -258,8 +258,8 @@ H5_DLL herr_t H5S_select_release(H5S_t *ds); H5_DLL herr_t H5S_select_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); -H5_DLL hssize_t H5S_select_serial_size(const H5S_t *space); -H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p); +H5_DLL hssize_t H5S_select_serial_size(const H5S_t *space, H5F_t *f); +H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space); H5_DLL htri_t H5S_select_is_single(const H5S_t *space); H5_DLL htri_t H5S_select_is_regular(const H5S_t *space); @@ -279,7 +279,7 @@ H5_DLL herr_t H5S_select_none(H5S_t *space); /* Operations on point selections */ H5_DLL herr_t H5S_select_elements(H5S_t *space, H5S_seloper_t op, - size_t num_elem, const hsize_t *coord); + hsize_t num_elem, const hsize_t *coord); /* Operations on hyperslab selections */ H5_DLL herr_t H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, const hsize_t start[], @@ -309,7 +309,7 @@ H5_DLL hsize_t H5S_hyper_get_first_inc_block(const H5S_t *space, H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size); H5_DLL herr_t H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords); H5_DLL hsize_t H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter); -H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); +H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, hsize_t nelem); H5_DLL herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter); #ifdef H5_HAVE_PARALLEL diff --git a/src/H5Sselect.c b/src/H5Sselect.c index c34e1cc..dbbc927 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -225,7 +225,7 @@ H5S_select_get_seq_list(const H5S_t *space, unsigned flags, *------------------------------------------------------------------------- */ hssize_t -H5S_select_serial_size(const H5S_t *space) +H5S_select_serial_size(const H5S_t *space, H5F_t *f) { hssize_t ret_value = -1; /* Return value */ @@ -234,7 +234,7 @@ H5S_select_serial_size(const H5S_t *space) HDassert(space); /* Call the selection type's serial_size function */ - ret_value=(*space->select.type->serial_size)(space); + ret_value=(*space->select.type->serial_size)(space, f); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_serial_size() */ @@ -251,6 +251,7 @@ H5S_select_serial_size(const H5S_t *space) uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of serialized selection. + H5F_t *f; IN: File pointer RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -265,7 +266,7 @@ H5S_select_serial_size(const H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_select_serialize(const H5S_t *space, uint8_t **p) +H5S_select_serialize(const H5S_t *space, uint8_t **p, H5F_t *f) { herr_t ret_value=SUCCEED; /* Return value */ @@ -275,7 +276,7 @@ H5S_select_serialize(const H5S_t *space, uint8_t **p) HDassert(p); /* Call the selection type's serialize function */ - ret_value=(*space->select.type->serialize)(space,p); + ret_value=(*space->select.type->serialize)(space,p,f); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_serialize() */ @@ -1225,7 +1226,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter) USAGE herr_t H5S_select_iter_next(iter, nelem) H5S_sel_iter_t *iter; IN/OUT: Selection iterator to change - size_t nelem; IN: Number of elements to advance by + hsize_t nelem; IN: Number of elements to advance by RETURNS Non-negative on success, negative on failure. DESCRIPTION @@ -1240,7 +1241,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem) +H5S_select_iter_next(H5S_sel_iter_t *iter, hsize_t nelem) { herr_t ret_value = FAIL; /* Return value */ @@ -2870,7 +2870,7 @@ H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc) FUNC_ENTER_NOAPI_NOINIT /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc((uint8_t)0))) + if(NULL == (f = H5F_fake_alloc((uint8_t)0, H5P_FILE_ACCESS_DEFAULT))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") /* Find out the size of buffer needed */ @@ -2925,7 +2925,7 @@ H5T_decode(size_t buf_size, const unsigned char *buf) FUNC_ENTER_NOAPI_NOINIT /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc((uint8_t)0))) + if(NULL == (f = H5F_fake_alloc((uint8_t)0, H5P_FILE_ACCESS_DEFAULT))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") /* Decode the type of the information */ diff --git a/src/H5public.h b/src/H5public.h index 9157366..29c5ec1 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -92,11 +92,11 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ -#define H5_VERS_MINOR 11 /* For minor interface/format changes */ +#define H5_VERS_MINOR 10 /* For minor interface/format changes */ #define H5_VERS_RELEASE 2 /* For tweaks, bug-fixes, or development */ -#define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ +#define H5_VERS_SUBRELEASE "snap10" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.11.2" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.10.2-snap10" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/test/tfile.c b/test/tfile.c index 80c1e11..200f221 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -4969,7 +4969,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, #define VERBFNAME "tverbounds_dspace.h5" #define VERBDSNAME "dataset 1" #define SPACE1_DIM1 3 -static void +static int test_libver_bounds_open(void) { hid_t file = -1; /* File ID */ diff --git a/test/th5s.c b/test/th5s.c index 0619571..9d5273f 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -93,6 +93,10 @@ struct space4_struct { char c2; } space4_data={'v',987123,-3.14F,'g'}; /* Test data for 4th dataspace */ + +/* Used in test_h5s_encode_irregular_exceed32() and test_h5s_encode_points_exceed32() */ +#define POWER32 4294967296 /* 2^32 */ + /**************************************************************** ** ** test_h5s_basic(): Test basic H5S (dataspace) code. @@ -2504,6 +2508,188 @@ test_versionbounds(void) /**************************************************************** ** +** test_h5s_encode_regular_exceed32(): +** Test to verify HDFFV-9947 is fixed. +** Verify that selection encoding that exceeds (2^32 - 1) +** (32 bit integer limit) is correctly encoded. +** +** Note: See encoding changes for 1.10 in +** "RFC: H5Sencode/H5Sdecode Format Change". +** +****************************************************************/ +static void +test_h5s_encode_regular_exceed32(void) +{ + hid_t sid; /* Dataspace ID */ + hid_t decoded_sid; /* Dataspace ID from H5Sdecode */ + size_t sbuf_size=0; /* Buffer size for H5Sencode */ + unsigned char *sbuf=NULL; /* Buffer for H5Sencode */ + hssize_t num; /* Number of elements in the dataspace selection */ + hssize_t decoded_num; /* Number of elements in the dataspace selection from H5Sdeocde */ + hsize_t numparticles = 8388608; + unsigned num_dsets = 513; + hsize_t total_particles = numparticles * num_dsets; + hsize_t vdsdims[1] = {total_particles}; + hsize_t start, count, block; + herr_t ret; /* Generic return value */ + + MESSAGE(5, ("Testing Dataspace encoding regular hyperslabs that exceeds 32 bits\n")); + + /*------------------------------------------------------------------------- + * Test encoding and decoding of simple dataspace and hyperslab selection. + *------------------------------------------------------------------------- + */ + sid = H5Screate_simple(1, vdsdims, NULL); + CHECK(sid, FAIL, "H5Screate_simple"); + + start = 0; + block = total_particles; + count = 1; + + ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, NULL, &count, &block); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Encode simple data space in a buffer */ + ret = H5Sencode(sid, NULL, &sbuf_size); + CHECK(ret, FAIL, "H5Sencode2"); + + if(sbuf_size > 0) { + sbuf = (unsigned char*)HDcalloc((size_t)1, sbuf_size); + CHECK(sbuf, NULL, "H5Sencode"); + } + + /* The version used for encoding should be 2 */ + ret = H5Sencode(sid, sbuf, &sbuf_size); + CHECK(ret, FAIL, "H5Sencode"); + VERIFY((uint32_t)sbuf[35], 2, "Version for regular hyperslab that exceeds 32 bits"); + + /* Decode from the dataspace buffer and return an object handle */ + decoded_sid = H5Sdecode(sbuf); + CHECK(decoded_sid, FAIL, "H5Sdecode"); + + /* Verify the decoded dataspace */ + decoded_num = H5Sget_select_npoints(decoded_sid); + CHECK(decoded_num, FAIL, "H5Sget_select_npoints"); + + num = H5Sget_select_npoints(sid); + CHECK(num, FAIL, "H5Sget_select_npoints"); + + VERIFY(num, decoded_num, "H5Sget_select_npoints"); + + ret = H5Sclose(decoded_sid); + CHECK(ret, FAIL, "H5Sclose"); + + if(sbuf) + HDfree(sbuf); + + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); + +} /* test_h5s_encode_regular_exceed32() */ + +/**************************************************************** +** +** test_h5s_encode_irregular_exceed32(): +** This test verifies that 1.10 H5Sencode() will fail for +** irregular hyperslab selection that exceeds 32 bits. +** +** Note: See encoding changes for 1.10 in +** "RFC: H5Sencode/H5Sdecode Format Change". +** +****************************************************************/ +static void +test_h5s_encode_irregular_exceed32(void) +{ + hid_t sid; /* Dataspace ID */ + hsize_t numparticles = 8388608; + unsigned num_dsets = 513; + hsize_t total_particles = numparticles * num_dsets; + hsize_t vdsdims[1] = {total_particles}; /* Dimension size */ + hsize_t start, stride, count, block; /* Selection info */ + size_t sbuf_size=0; /* Buffer size for H5Sencode */ + htri_t is_regular; /* Is this a regular hyperslab */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Dataspace encoding irregular hyperslab that exceeds 32 bits\n")); + + sid = H5Screate_simple(1, vdsdims, NULL); + CHECK(sid, FAIL, "H5Screate_simple"); + + start = 0; + block = total_particles; + count = 1; + + ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, NULL, &count, &block); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + start = 8; + count = 5; + block = 2; + stride = POWER32; + + ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, &start, &stride, &count, &block); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Should be irregular hyperslab */ + is_regular = H5Sis_regular_hyperslab(sid); + VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab"); + + /* Should fail because selection exceeds 32 bits */ + ret = H5Sencode(sid, NULL, &sbuf_size); + VERIFY(ret, FAIL, "H5Sencode"); + + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); + +} /* test_h5s_encode_irregular_exceed32() */ + +/**************************************************************** +** +** test_h5s_encode_points_exceed32(): +** This test verifies that 1.10 H5Sencode() will fail for +** point selection that exceeds 32 bits. +** +** Note: See encoding changes for 1.10 in +** "RFC: H5Sencode/H5Sdecode Format Change". +** +****************************************************************/ +static void +test_h5s_encode_points_exceed32(void) +{ + hid_t sid; /* Dataspace ID */ + hsize_t numparticles = 8388608; + unsigned num_dsets = 513; + hsize_t total_particles = numparticles * num_dsets; + hsize_t vdsdims[1] = {total_particles}; /* Dimension size */ + hsize_t coord[4]; /* The point coordinates */ + size_t sbuf_size=0; /* Buffer size for H5Sencode */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Dataspace encoding points selection that exceeds 32 bits\n")); + + sid = H5Screate_simple(1, vdsdims, NULL); + CHECK(sid, FAIL, "H5Screate_simple"); + + coord[0] = 5; + coord[1] = 15; + coord[2] = POWER32; + coord[3] = 19; + ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord); + CHECK(ret, FAIL, "H5Sselect_elements"); + + /* Should fail because selection exceeds 32 bits */ + ret = H5Sencode(sid, NULL, &sbuf_size); + VERIFY(ret, FAIL, "H5Sencode"); + + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); + +} /* test_h5s_encode_points_exceed32() */ + +/**************************************************************** +** ** test_h5s(): Main H5S (dataspace) testing routine. ** ****************************************************************/ @@ -2517,8 +2703,12 @@ test_h5s(void) test_h5s_null(); /* Test Null dataspace H5S code */ test_h5s_zero_dim(); /* Test dataspace with zero dimension size */ test_h5s_encode(); /* Test encoding and decoding */ - test_h5s_scalar_write(); /* Test scalar H5S writing code */ - test_h5s_scalar_read(); /* Test scalar H5S reading code */ + test_h5s_encode_regular_exceed32(); /* Test encoding regular hyperslab selection that exceeds 32 bits */ + test_h5s_encode_irregular_exceed32(); /* Testing encoding irregular hyperslab selection that exceeds 32 bits */ + test_h5s_encode_points_exceed32(); /* Testing encoding point selection that exceeds 32 bits */ + + test_h5s_scalar_write(); /* Test scalar H5S writing code */ + test_h5s_scalar_read(); /* Test scalar H5S reading code */ test_h5s_compound_scalar_write(); /* Test compound datatype scalar H5S writing code */ test_h5s_compound_scalar_read(); /* Test compound datatype scalar H5S reading code */ diff --git a/test/trefer.c b/test/trefer.c index 7cbb77f..55172c0 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -490,46 +490,70 @@ test_reference_obj(void) ** test_reference_region(): Test basic H5R (reference) object reference code. ** Tests references to various kinds of objects ** +** Add test to verify that dataspace selection exceeding +** 32 bits is correctly encoded and referenced. +** +** Note: The "new_format" parameter is added to create the file with +** either the old or latest format. This is done so that the +** 1.10 encoding of dataspace selection for H5R_DATASET_REGION +** in the internal library will be done according to the file +** format setting in fapl. +** See encoding changes for 1.10 in +** "RFC: H5Sencode/H5Sdecode Format Change". +** ****************************************************************/ static void -test_reference_region(void) +test_reference_region(hbool_t new_format) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dset1, /* Dataset ID */ - dset2; /* Dereferenced dataset ID */ - hid_t sid1, /* Dataspace ID #1 */ - sid2; /* Dataspace ID #2 */ - hid_t dapl_id; /* Dataset access property list */ - hsize_t dims1[] = {SPACE1_DIM1}, - dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ - hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ - hsize_t * coords; /* Coordinate buffer */ - hsize_t low[SPACE2_RANK]; /* Selection bounds */ - hsize_t high[SPACE2_RANK]; /* Selection bounds */ - hdset_reg_ref_t *wbuf, /* buffer to write to disk */ - *rbuf; /* buffer read from disk */ - hdset_reg_ref_t nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */ - uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ - *drbuf; /* Buffer for reading numeric data from disk */ - uint8_t *tu8; /* Temporary pointer to uint8 data */ - H5O_type_t obj_type; /* Type of object */ - int i, j; /* counting variables */ - hssize_t hssize_ret; /* hssize_t return value */ - htri_t tri_ret; /* htri_t return value */ - herr_t ret; /* Generic return value */ - haddr_t addr = HADDR_UNDEF; /* test for undefined reference */ - hid_t dset_NA; /* Dataset id for undefined reference */ - hid_t space_NA; /* Dataspace id for undefined reference */ - hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */ - hdset_reg_ref_t wdata_NA[1], /* Write buffer */ - rdata_NA[1]; /* Read buffer */ + hid_t fid1; /* HDF5 File IDs */ + hid_t fapl = -1; /* File access property list */ + hid_t dset1, /* Dataset ID */ + dset2, /* Dereferenced dataset ID */ + dset3; /* Dereferenced dataset ID */ + hid_t sid1, /* Dataspace ID #1 */ + sid2, /* Dataspace ID #2 */ + sid3; /* Dataspace ID #3 */ + hid_t dapl_id; /* Dataset access property list */ + hsize_t dims1[] = {SPACE1_DIM1}, + dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ + hsize_t *coords; /* Coordinate buffer */ + hsize_t low[SPACE2_RANK]; /* Selection bounds */ + hsize_t high[SPACE2_RANK]; /* Selection bounds */ + hdset_reg_ref_t *wbuf, /* buffer to write to disk */ + *rbuf; /* buffer read from disk */ + hdset_reg_ref_t nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */ + uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ + *drbuf; /* Buffer for reading numeric data from disk */ + uint8_t *tu8; /* Temporary pointer to uint8 data */ + H5O_type_t obj_type; /* Type of object */ + int i, j; /* counting variables */ + hssize_t hssize_ret; /* hssize_t return value */ + htri_t tri_ret; /* htri_t return value */ + herr_t ret; /* Generic return value */ + haddr_t addr = HADDR_UNDEF; /* test for undefined reference */ + hid_t dset_NA; /* Dataset id for undefined reference */ + hid_t space_NA; /* Dataspace id for undefined reference */ + hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */ + hdset_reg_ref_t wdata_NA[1], /* Write buffer */ + rdata_NA[1]; /* Read buffer */ + hsize_t numparticles = 8388608; + hsize_t ret_particles; + unsigned num_dsets = 513; + hsize_t total_particles = numparticles * num_dsets; + hsize_t vdsdims[1] = {total_particles}; + hsize_t start3, count3, block3; /* Output message about test being performed */ - MESSAGE(5, ("Testing Dataset Region Reference Functions\n")); + if(new_format) { + MESSAGE(5, ("Testing Dataset Region Reference Functions for new format\n")); + } else { + MESSAGE(5, ("Testing Dataset Region Reference Functions for old format\n")); + } /* Allocate write & read buffers */ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); @@ -537,8 +561,16 @@ test_reference_region(void) dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); + /* Set to use the latest file format */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + if(new_format) { + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + } + /* Create file */ - fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid1, FAIL, "H5Fcreate"); /* Create dataspace for datasets */ @@ -564,11 +596,30 @@ test_reference_region(void) ret = H5Dclose(dset2); CHECK(ret, FAIL, "H5Dclose"); + /* Create dataspace with selection exceeding 32 bits */ + sid3 = H5Screate_simple(1, vdsdims, NULL); + CHECK(sid3, FAIL, "H5Screate_simple"); + + start3 = 0; + block3 = total_particles; + count3 = 1; + + ret = H5Sselect_hyperslab(sid3, H5S_SELECT_SET, &start3, NULL, &count3, &block3); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Create the dataset with dataspace exceeding 32 bits */ + dset3 = H5Dcreate2(fid1, "Dataset3", H5T_STD_U8LE, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dset3, FAIL, "H5Dcreate2"); + + /* Close Dataset */ + ret = H5Dclose(dset3); + CHECK(ret, FAIL, "H5Dclose"); + /* Create dataspace for the reference dataset */ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); CHECK(sid1, FAIL, "H5Screate_simple"); - /* Create a dataset */ + /* Create the reference dataset */ dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Dcreate2"); @@ -627,10 +678,18 @@ test_reference_region(void) /* Store third dataset region */ ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2); CHECK(ret, FAIL, "H5Rcreate"); - ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type); + ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[2], &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type2"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2"); + /* Store fourth dataset region */ + ret = H5Rcreate(&wbuf[3], fid1, "/Dataset3", H5R_DATASET_REGION, sid3); + CHECK(ret, FAIL, "H5Rcreate"); + ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[3], &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type2"); + VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2"); + + /* Write selection to disk */ ret = H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); CHECK(ret, FAIL, "H5Dwrite"); @@ -672,6 +731,9 @@ test_reference_region(void) ret = H5Sclose(sid2); CHECK(ret, FAIL, "H5Sclose"); + ret = H5Sclose(sid3); + CHECK(ret, FAIL, "H5Sclose"); + /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -727,6 +789,28 @@ test_reference_region(void) dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &addr); VERIFY(dset2, FAIL, "H5Rdereference2 haddr_undef"); + + /* Try to open the referenced dataset with dataspace exceeding 32 bits */ + dset3 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[3]); + CHECK(dset3, FAIL, "H5Rdereference2"); + + /* Check what H5Rget_obj_type2 function returns */ + ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf[3], &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type2"); + VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2"); + + /* Check information in the referenced dataset */ + sid3 = H5Dget_space(dset3); + CHECK(sid3, FAIL, "H5Dget_space"); + ret_particles = H5Sget_select_npoints(sid3); + VERIFY(ret_particles, total_particles, "H5Sget_select_npoints"); + + /* Close the dataspace and dataset */ + ret = H5Sclose(sid3); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Dclose(dset3); + CHECK(ret, FAIL, "H5Dclose"); + /* Try to open objects */ dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[0]); CHECK(dset2, FAIL, "H5Rdereference2"); @@ -889,7 +973,7 @@ test_reference_region(void) ** ****************************************************************/ static void -test_reference_region_1D(void) +test_reference_region_1D(hbool_t new_format) { hid_t fid1; /* HDF5 File IDs */ hid_t dset1, /* Dataset ID */ @@ -1736,14 +1820,16 @@ test_reference(void) /* Output message about test being performed */ MESSAGE(5, ("Testing References\n")); - test_reference_params(); /* Test for correct parameter checking */ - test_reference_obj(); /* Test basic H5R object reference code */ - test_reference_region(); /* Test basic H5R dataset region reference code */ - test_reference_region_1D(); /* Test H5R dataset region reference code for 1-D datasets */ - test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */ - test_reference_group(); /* Test operations on dereferenced groups */ + test_reference_params(); /* Test for correct parameter checking */ + test_reference_obj(); /* Test basic H5R object reference code */ + test_reference_region(FALSE); /* Test basic H5R dataset region reference code */ + test_reference_region(TRUE); /* Test basic H5R dataset region reference code */ + test_reference_region_1D(FALSE); /* Test H5R dataset region reference code for 1-D datasets */ + test_reference_region_1D(TRUE); /* Test H5R dataset region reference code for 1-D datasets */ + test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */ + test_reference_group(); /* Test operations on dereferenced groups */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_reference_compat(); /* Test operations with old API routines */ + test_reference_compat(); /* Test operations with old API routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_reference() */ @@ -618,7 +618,7 @@ test_api(test_api_config_t config, hid_t fapl) TEST_ERROR /* Get examination DCPL */ - if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)213) < 0) + if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)174) < 0) TEST_ERROR /* Test H5Pget_virtual_count */ diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake index 87470f3..cd9acda 100644 --- a/testpar/CMakeTests.cmake +++ b/testpar/CMakeTests.cmake @@ -18,6 +18,10 @@ add_test (NAME TEST_PAR_testphdf5 COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:testphdf5> ${MPIEXEC_POSTFLAGS}) +if (WIN32) + # t_cache_imagee uses fork() and execve(), will not run on Windows + list (REMOVE_ITEM H5P_TESTS t_cache_image) +endif () foreach (testp ${H5P_TESTS}) add_test (NAME TEST_PAR_${testp} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${testp}> ${MPIEXEC_POSTFLAGS}) endforeach () diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl index a1fc0cb..561ab14 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl @@ -11,7 +11,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 10 2 } } } FILLVALUE { @@ -33,7 +33,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 10 2 } } } FILLVALUE { @@ -55,7 +55,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 10 2 } } } FILLVALUE { @@ -77,7 +77,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 10 2 } } } FILLVALUE { @@ -99,7 +99,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 10 2 } } } FILLVALUE { @@ -121,7 +121,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 10 2 } } } FILLVALUE { @@ -143,7 +143,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 10 2 } } } FILLVALUE { |