diff options
-rw-r--r-- | examples/h5_ref_extern.c | 2 | ||||
-rw-r--r-- | release_docs/RELEASE.txt | 389 | ||||
-rw-r--r-- | src/H5Fprivate.h | 5 | ||||
-rw-r--r-- | src/H5Fquery.c | 20 | ||||
-rw-r--r-- | src/H5Ocopy_ref.c | 2 | ||||
-rw-r--r-- | src/H5R.c | 42 | ||||
-rw-r--r-- | src/H5Rdeprec.c | 1 | ||||
-rw-r--r-- | src/H5Rpublic.h | 6 | ||||
-rw-r--r-- | src/H5Shyper.c | 3 | ||||
-rw-r--r-- | src/H5Smpio.c | 2 | ||||
-rw-r--r-- | src/H5Spkg.h | 7 | ||||
-rw-r--r-- | src/H5T.c | 5 | ||||
-rw-r--r-- | src/H5Tconv.c | 28 | ||||
-rw-r--r-- | src/H5Tpkg.h | 24 | ||||
-rw-r--r-- | src/H5Tref.c | 235 | ||||
-rw-r--r-- | src/H5Tvlen.c | 159 | ||||
-rw-r--r-- | src/H5VLcallback.c | 14 | ||||
-rw-r--r-- | src/H5VLconnector.h | 2 | ||||
-rw-r--r-- | src/H5VLconnector_passthru.h | 2 | ||||
-rw-r--r-- | src/H5VLnative_blob.c | 11 | ||||
-rw-r--r-- | src/H5VLnative_private.h | 2 | ||||
-rw-r--r-- | src/H5VLpassthru.c | 4 | ||||
-rw-r--r-- | src/H5VLprivate.h | 2 | ||||
-rw-r--r-- | test/objcopy_ref.c | 12 | ||||
-rw-r--r-- | test/trefer.c | 74 |
25 files changed, 759 insertions, 294 deletions
diff --git a/examples/h5_ref_extern.c b/examples/h5_ref_extern.c index 4327a06..17082ba 100644 --- a/examples/h5_ref_extern.c +++ b/examples/h5_ref_extern.c @@ -56,7 +56,7 @@ main(void) { /* Create reference to dataset1 in "refer_extern1.h5" */ file1 = H5Fopen(H5FILE_NAME1, H5F_ACC_RDONLY, H5P_DEFAULT); - H5Rcreate_object(file1, "dataset1", &ref_buf[0]); + H5Rcreate_object(file1, "dataset1", H5P_DEFAULT, &ref_buf[0]); H5Fclose(file1); /* Store reference in dataset in separate file "refer_extern2.h5" */ diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt new file mode 100644 index 0000000..7a237cb --- /dev/null +++ b/release_docs/RELEASE.txt @@ -0,0 +1,389 @@ +HDF5 version 1.12.0-alpha0 currently under development +================================================================================ + + +INTRODUCTION + +This document describes the new features introduced in the HDF5 1.12.0 release. +It contains information on the platforms tested and known problems in this +release. For more details check the HISTORY*.txt files in the HDF5 source. + +Note that documentation in the links below will be updated at the time of the +release. + +Links to HDF5 documentation can be found on The HDF5 web page: + + https://portal.hdfgroup.org/display/HDF5/HDF5 + +The official HDF5 releases can be obtained from: + + https://www.hdfgroup.org/downloads/hdf5/ + +More information about the new features can be found at: + + https://portal.hdfgroup.org/display/HDF5/New+Features+in+HDF5+Release+1.12 + +If you have any questions or comments, please send them to the HDF Help Desk: + + help@hdfgroup.org + + +CONTENTS + +- New Features +- Support for new platforms and languages +- Major Bug Fixes since HDF5-1.10.0 +- Supported Platforms +- Tested Configuration Features Summary +- More Tested Platforms +- Known Problems +- CMake vs. Autotools installations + + +New Features +============ + + Configuration: + ------------- + - Update CMake for VS2019 support + + CMake added support for VS2019 in version 3.15. Changes to the CMake + generator setting required changes to scripts. Also updated version + references in CMake files as necessary. + + (ADB - 2019/11/18, HDFFV-10962) + + + Library: + -------- + - Virtual Object Layer (VOL) + + In this major HDF5 release we introduce HDF5 Virtual Object Layer (VOL). + VOL is an abstraction layer within the HDF5 library that enables different + methods for accessing data and objects that conform to the HDF5 data model. + The VOL layer intercepts all HDF5 API calls that potentially modify data + on disk and forwards those calls to a plugin "object driver". The data on + disk can be a different format than the HDF5 format. For more information + about VOL we refer the reader to the following documents (under review): + + VOL HDF5 APIs + https://portal.hdfgroup.org/display/HDF5/Virtual+Object++Layer + + VOL Documentation + https://bitbucket.hdfgroup.org/projects/HDFFV/repos/hdf5doc/browse/RFCs/HDF5/VOL + + Repository with VOL plugins + https://bitbucket.hdfgroup.org/projects/HDF5VOL + + - Enhancements to HDF5 References + + HDF5 references were extended to support attributes, and object and dataset + selections that reside in another HDF5 file. For more information including + a list of new APIs, see + + https://portal.hdfgroup.org/display/HDF5/Update+to+References + + Current known limitations for references in this release: + • HDF5 command-line tools have not been updated to read new references types. + • When reading data with the H5T_STD_REF type, if data is filled with 0s, + H5A/Dread() currently returns an error. This will be fixed in an upcoming + release. + • h5dump will fail to display references on big-endian machines. + + - Add new public function H5Sselect_project_intersection. + + This function computes the intersection between two dataspace selections + and projects that intersection into a third selection. This can be useful + for VOL developers to implement chunked or virtual datasets. + + (NAF - 2019/11/13, ID-148) + + - Add new public function H5VLget_file_type. + + This function returns a datatype equivalent to the supplied datatype but + with the location set to be in the file. This datatype can then be used + with H5Tconvert to convert data between file and in-memory representation. + This funcition is intended for use only by VOL connector developers. + + (NAF - 2019/11/08, ID-127) + + - New S3 and HDFS Virtual File Drivers (VFDs) + + This release has two new VFDs. The S3 VFD allows accessing HDF5 files on + AWS S3 buckets. HDFS VFD allows accessing HDF5 files stored on Apache HDFS. + See https://portal.hdfgroup.org/display/HDF5/Virtual+File+Drivers+-+S3+and+HDFS + for information on enabling those drivers and using those APIs. + + Below are specific instructions for enabling S3 VFD on Windows: + + Fix windows requirements and java tests. Windows requires CMake 3.13. + - Install openssl library (with dev files); + from "Shining Light Productions". msi package preferred. + - PATH should have been updated with the installation dir. + - set ENV variable OPENSSL_ROOT_DIR to the installation dir. + - set ENV variable OPENSSL_CONF to the cfg file, likely %OPENSSL_ROOT_DIR%\bin\openssl.cfg + - Install libcurl library (with dev files); + - download the latest released version using git: https://github.com/curl/curl.git + - Open a Visual Studio Command prompt + - change to the libcurl root folder + - run the "buildconf.bat" batch file + - change to the winbuild directory + - nmake /f Makefile.vc mode=dll MACHINE=x64 + - copy libcurl-vc-x64-release-dll-ipv6-sspi-winssl dir to C:\curl (installation dir) + - set ENV variable CURL_ROOT to C:\curl (installation dir) + - update PATH ENV variable to %CURL_ROOT%\bin (installation bin dir). + - the aws credentials file should be in %USERPROFILE%\.aws folder + - set the ENV variable HDF5_ROS3_TEST_BUCKET_URL to the s3 url for the + s3 bucket containing the HDF5 files to be accessed. + + Other improvements and changes: + + - Hyperslab selection code was reworked to improve performance, getting more + than 10x speedup in some cases. + + - The HDF5 Library was enhanced to open files with Unicode names on Windows. + + - Deprecated H5Dvlen_reclaim() and replaced it with H5Treclaim(). + This routine is meant to be used when resources are internally allocated + when reading data, i.e. when using either vlen or new reference types. + This is applicable to both attribute and dataset reads. + + - h5repack was fixed to repack datasets with external storage + to other types of storage. + + +Support for new platforms, languages and compilers. +======================================= + - Added spectrum-mpi with clang, gcc and xl compilers on Linux 3.10.0 + - Added OpenMPI 3.1 and 4.0 with clang, gcc and Intel compilers on Linux 3.10.0 + - Added cray-mpich/PrgEnv with gcc and Intel compilers on Linux 4.14.180 + - Added spectrum mpi with clang, gcc and xl compilers on Linux 4.14.0 + + +Major Bug Fixes since HDF5-1.10.0 release +================================== + + - For major bug fixes please see HISTORY-1_10_0-1_12_0.txt file + + +Supported Platforms +=================== + + Linux 2.6.32-696.16.1.el6.ppc64 gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) + #1 SMP ppc64 GNU/Linux g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) + (ostrich) GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) + IBM XL C/C++ V13.1 + IBM XL Fortran V15.1 + + Linux 3.10.0-327.10.1.el7 GNU C (gcc), Fortran (gfortran), C++ (g++) + #1 SMP x86_64 GNU/Linux compilers: + (kituo/moohan) Version 4.8.5 20150623 (Red Hat 4.8.5-4) + Version 4.9.3, 5.2.0, 7.1.0 + Intel(R) C (icc), C++ (icpc), Fortran (icc) + compilers: + Version 17.0.0.098 Build 20160721 + MPICH 3.1.4 + + Linux-3.10.0- spectrum-mpi/rolling-release with cmake>3.10 and + 862.14.4.1chaos.ch6.ppc64le clang/3.9,8.0 + #1 SMP ppc64le GNU/Linux gcc/7.3 + (ray) xl/2016,2019 + + Linux 3.10.0- openmpi/3.1,4.0 with cmake>3.10 and + 957.12.2.1chaos.ch6.x86_64 clang 5.0 + #1 SMP x86_64 GNU/Linux gcc/7.3,8.2 + (serrano) intel/17.0,18.0/19.0 + + Linux 3.10.0- openmpi/3.1/4.0 with cmake>3.10 and + 1062.1.1.1chaos.ch6.x86_64 clang/3.9,5.0,8.0 + #1 SMP x86_64 GNU/Linux gcc/7.3,8.1,8.2 + (chama,quartz) intel/16.0,18.0,19.0 + + Linux 4.4.180-94.100-default cray-mpich/7.7.6 with PrgEnv-*/6.0.5, cmake>3.10 and + #1 SMP x86_64 GNU/Linux gcc/7.2.0,8.2.0 + (mutrino) intel/17.0,18.0 + + Linux 4.14.0- spectrum-mpi/rolling-release with cmake>3.10 and + 49.18.1.bl6.ppc64le clang/6.0,8.0 + #1 SMP ppc64le GNU/Linux gcc/7.3 + (lassen) xl/2019 + + SunOS 5.11 32- and 64-bit Sun C 5.12 SunOS_sparc + (emu) Sun Fortran 95 8.6 SunOS_sparc + Sun C++ 5.12 SunOS_sparc + + Windows 7 Visual Studio 2015 w/ Intel Fortran 18 (cmake) + + Windows 7 x64 Visual Studio 2015 w/ Intel C, Fortran 2018 (cmake) + Visual Studio 2015 w/ MSMPI 8 (cmake) + + Windows 10 Visual Studio 2015 w/ Intel Fortran 18 (cmake) + + Windows 10 x64 Visual Studio 2015 w/ Intel Fortran 18 (cmake) + Visual Studio 2017 w/ Intel Fortran 19 (cmake) + Visual Studio 2019 w/ Intel Fortran 19 (cmake) + + Mac OS X Yosemite 10.10.5 Apple clang/clang++ version 6.1 from Xcode 7.0 + 64-bit gfortran GNU Fortran (GCC) 4.9.2 + (osx1010dev/osx1010test) Intel icc/icpc/ifort version 15.0.3 + + Mac OS X El Capitan 10.11.6 Apple clang/clang++ version 7.3.0 from Xcode 7.3 + 64-bit gfortran GNU Fortran (GCC) 5.2.0 + (osx1011dev/osx1011test) Intel icc/icpc/ifort version 16.0.2 + + Mac OS High Sierra 10.13.6 Apple LLVM version 10.0.0 (clang/clang++-1000.10.44.4) + 64-bit gfortran GNU Fortran (GCC) 6.3.0 + (bear) Intel icc/icpc/ifort version 19.0.4 + + Mac OS Mojave 10.14.6 Apple LLVM version 10.0.1 (clang/clang++-1001.0.46.4) + 64-bit gfortran GNU Fortran (GCC) 6.3.0 + (bobcat) Intel icc/icpc/ifort version 19.0.4 + + +Tested Configuration Features Summary +===================================== + + In the tables below + y = tested + n = not tested in this release + C = Cluster + W = Workstation + x = not working in this release + dna = does not apply + ( ) = footnote appears below second table + <blank> = testing incomplete on this feature or platform + +Platform C F90/ F90 C++ zlib SZIP + parallel F2003 parallel +Solaris2.11 32-bit n y/y n y y y +Solaris2.11 64-bit n y/n n y y y +Windows 7 y y/y n y y y +Windows 7 x64 y y/y y y y y +Windows 7 Cygwin n y/n n y y y +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 +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 + + +Platform Shared Shared Shared Thread- + C libs F90 libs C++ libs safe +Solaris2.11 32-bit y y y y +Solaris2.11 64-bit y y y y +Windows 7 y y y y +Windows 7 x64 y y y y +Windows 7 Cygwin n n n y +Windows 7 x64 Cygwin n n n y +Windows 10 y y y y +Windows 10 x64 y y y y +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 Intel y y y n +Linux 2.6.32-573.18.1.el6.ppc64 y y y n + +Compiler versions for each platform are listed in the preceding +"Supported Platforms" table. + + +More Tested Platforms +===================== +The following platforms are not supported but have been tested for this release. + + 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.9.3, 5.3.0, 6.2.0 + PGI C, Fortran, C++ for 64-bit target on + x86-64; + Version 17.10-0 + Intel(R) C (icc), C++ (icpc), Fortran (icc) + compilers: + Version 17.0.4.196 Build 20170411 + MPICH 3.1.4 compiled with GCC 4.9.3 + + Linux 3.10.0-327.18.2.el7 GNU C (gcc) and C++ (g++) compilers + #1 SMP x86_64 GNU/Linux Version 4.8.5 20150623 (Red Hat 4.8.5-4) + (jelly) with NAG Fortran Compiler Release 6.1(Tozai) + GCC Version 7.1.0 + OpenMPI 3.0.0-GCC-7.2.0-2.29 + Intel(R) C (icc) and C++ (icpc) compilers + Version 17.0.0.098 Build 20160721 + with NAG Fortran Compiler Release 6.1(Tozai) + PGI C (pgcc), C++ (pgc++), Fortran (pgf90) + compilers: + Version 18.4, 19.4 + MPICH 3.3 + OpenMPI 2.1.5, 3.1.3, 4.0.0 + + Fedora30 5.3.11-200.fc30.x86_64 + #1 SMP x86_64 GNU/Linux GNU gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1 20190827) + GNU Fortran (GCC) 9.2.1 20190827 (Red Hat 9.2.1 20190827) + (cmake and autotools) + + +Known Problems +============== + CMake files do not behave correctly with paths containing spaces. + Do not use spaces in paths because the required escaping for handling spaces + results in very complex and fragile build files. + ADB - 2019/05/07 + + At present, metadata cache images may not be generated by parallel + applications. Parallel applications can read files with metadata cache + images, but since this is a collective operation, a deadlock is possible + if one or more processes do not participate. + + Known problems in previous releases can be found in the HISTORY*.txt files + in the HDF5 source. Please report any new problems found to + help@hdfgroup.org. + + +CMake vs. Autotools installations +================================= +While both build systems produce similar results, there are differences. +Each system produces the same set of folders on linux (only CMake works +on standard Windows); bin, include, lib and share. Autotools places the +COPYING and RELEASE.txt file in the root folder, CMake places them in +the share folder. + +The bin folder contains the tools and the build scripts. Additionally, CMake +creates dynamic versions of the tools with the suffix "-shared". Autotools +installs one set of tools depending on the "--enable-shared" configuration +option. + build scripts + ------------- + Autotools: h5c++, h5cc, h5fc + CMake: h5c++, h5cc, h5hlc++, h5hlcc + +The include folder holds the header files and the fortran mod files. CMake +places the fortran mod files into separate shared and static subfolders, +while Autotools places one set of mod files into the include folder. Because +CMake produces a tools library, the header files for tools will appear in +the include folder. + +The lib folder contains the library files, and CMake adds the pkgconfig +subfolder with the hdf5*.pc files used by the bin/build scripts created by +the CMake build. CMake separates the C interface code from the fortran code by +creating C-stub libraries for each Fortran library. In addition, only CMake +installs the tools library. The names of the szip libraries are different +between the build systems. + +The share folder will have the most differences because CMake builds include +a number of CMake specific files for support of CMake's find_package and support +for the HDF5 Examples CMake project. + diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index c9a1b25..e1a8a2f 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -26,7 +26,6 @@ typedef struct H5F_t H5F_t; /* Public headers needed by this file */ #include "H5FDpublic.h" /* File drivers */ -#include "H5VLpublic.h" /* Virtual Object Layer */ /* Private headers needed by this file */ #include "H5MMprivate.h" /* Memory management */ @@ -34,6 +33,7 @@ typedef struct H5F_t H5F_t; #include "H5Pprivate.h" /* Property lists */ #endif /* H5_HAVE_PARALLEL */ #include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /**************************/ @@ -337,6 +337,7 @@ typedef struct H5F_t H5F_t; #define H5F_GET_MIN_DSET_OHDR(F) ((F)->shared->crt_dset_min_ohdr_flag) #define H5F_SET_MIN_DSET_OHDR(F, V) ((F)->shared->crt_dset_min_ohdr_flag = (V)) #define H5F_VOL_CLS(F) ((F)->shared->vol_cls) +#define H5F_VOL_OBJ(F) ((F)->vol_obj) #else /* H5F_MODULE */ #define H5F_LOW_BOUND(F) (H5F_get_low_bound(F)) #define H5F_HIGH_BOUND(F) (H5F_get_high_bound(F)) @@ -398,6 +399,7 @@ typedef struct H5F_t H5F_t; #define H5F_GET_MIN_DSET_OHDR(F) (H5F_get_min_dset_ohdr(F)) #define H5F_SET_MIN_DSET_OHDR(F, V) (H5F_set_min_dset_ohdr((F), (V))) #define H5F_VOL_CLS(F) (H5F_get_vol_cls(F)) +#define H5F_VOL_OBJ(F) (H5F_get_vol_obj(F)) #endif /* H5F_MODULE */ @@ -759,6 +761,7 @@ H5_DLL hbool_t H5F_get_null_fsm_addr(const H5F_t *f); H5_DLL hbool_t H5F_get_min_dset_ohdr(const H5F_t *f); H5_DLL herr_t H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize); H5_DLL const H5VL_class_t *H5F_get_vol_cls(const H5F_t *f); +H5_DLL H5VL_object_t *H5F_get_vol_obj(const H5F_t *f); /* Functions than retrieve values set/cached from the superblock/FCPL */ H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 32743c4..68ad8e5 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -1306,6 +1306,26 @@ H5F_get_vol_cls(const H5F_t *f) /*------------------------------------------------------------------------- + * Function: H5F_get_vol_obj + * + * Purpose: Get the VOL object for the file + * + * Return: VOL object pointer for file, can't fail + * + *------------------------------------------------------------------------- + */ +H5VL_object_t * +H5F_get_vol_obj(const H5F_t *f) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f); + + FUNC_LEAVE_NOAPI(f->vol_obj) +} /* end H5F_get_vol_obj */ + + +/*------------------------------------------------------------------------- * Function: H5F_get_cont_info * * Purpose: Get the VOL container info for the file diff --git a/src/H5Ocopy_ref.c b/src/H5Ocopy_ref.c index 3b18073..d8efeb5 100644 --- a/src/H5Ocopy_ref.c +++ b/src/H5Ocopy_ref.c @@ -333,7 +333,7 @@ H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src, H5T_t *dt_src, /* create reference datatype at the destinaton file */ if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy") - if(H5T_set_loc(dt_dst, dst_oloc->file, H5T_LOC_DISK) < 0) { + if(H5T_set_loc(dt_dst, H5F_VOL_OBJ(dst_oloc->file), H5T_LOC_DISK) < 0) { (void)H5T_close_real(dt_dst); HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "cannot mark datatype on disk") } /* end if */ @@ -74,7 +74,7 @@ *------------------------------------------------------------------------- */ herr_t -H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr) +H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_ptr) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5I_type_t obj_type; /* Object type of loc_id */ @@ -86,13 +86,22 @@ H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*s*Rr", loc_id, name, ref_ptr); + H5TRACE4("e", "i*si*Rr", loc_id, name, oapl_id, ref_ptr); /* Check args */ if(ref_ptr == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + if(oapl_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get object access property list */ + if(H5P_DEFAULT == oapl_id) + oapl_id = H5P_LINK_ACCESS_DEFAULT; + else + if(TRUE != H5P_isa_class(oapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID") /* Get the VOL object */ if(NULL == (vol_obj = H5VL_vol_object(loc_id))) @@ -117,6 +126,7 @@ H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = oapl_id; loc_params.obj_type = obj_type; /* Get the object token */ @@ -152,7 +162,7 @@ done: */ herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, - H5R_ref_t *ref_ptr) + hid_t oapl_id, H5R_ref_t *ref_ptr) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5I_type_t obj_type; /* Object type of loc_id */ @@ -165,7 +175,7 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*si*Rr", loc_id, name, space_id, ref_ptr); + H5TRACE5("e", "i*sii*Rr", loc_id, name, space_id, oapl_id, ref_ptr); /* Check args */ if(ref_ptr == NULL) @@ -176,6 +186,15 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid") if(NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + if(oapl_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get object access property list */ + if(H5P_DEFAULT == oapl_id) + oapl_id = H5P_LINK_ACCESS_DEFAULT; + else + if(TRUE != H5P_isa_class(oapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID") /* Get the VOL object */ if(NULL == (vol_obj = H5VL_vol_object(loc_id))) @@ -200,6 +219,7 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = oapl_id; loc_params.obj_type = obj_type; /* Get the object token */ @@ -234,7 +254,7 @@ done: */ herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, - H5R_ref_t *ref_ptr) + hid_t oapl_id, H5R_ref_t *ref_ptr) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5I_type_t obj_type; /* Object type of loc_id */ @@ -246,7 +266,7 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*s*s*Rr", loc_id, name, attr_name, ref_ptr); + H5TRACE5("e", "i*s*si*Rr", loc_id, name, attr_name, oapl_id, ref_ptr); /* Check args */ if(ref_ptr == NULL) @@ -255,6 +275,15 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name given") + if(oapl_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get object access property list */ + if(H5P_DEFAULT == oapl_id) + oapl_id = H5P_LINK_ACCESS_DEFAULT; + else + if(TRUE != H5P_isa_class(oapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID") /* Get the VOL object */ if(NULL == (vol_obj = H5VL_vol_object(loc_id))) @@ -279,6 +308,7 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = oapl_id; loc_params.obj_type = obj_type; /* Get the object token */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index b9bdffa..f0dc503 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -258,6 +258,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params.obj_type = vol_obj_type; /* Get the object token */ diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index 1f0887a..3577ef9 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -104,9 +104,9 @@ extern "C" { #endif /* Constructors */ -H5_DLL herr_t H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr); -H5_DLL herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, H5R_ref_t *ref_ptr); -H5_DLL herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, H5R_ref_t *ref_ptr); +H5_DLL herr_t H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_ptr); +H5_DLL herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id, H5R_ref_t *ref_ptr); +H5_DLL herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl_id, H5R_ref_t *ref_ptr); H5_DLL herr_t H5Rdestroy(H5R_ref_t *ref_ptr); /* Info */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 2c7502a..c6314de 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -4263,6 +4263,9 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) /* Decode version */ UINT32DECODE(pp, version); + if(version < H5S_HYPER_VERSION_1 || version > H5S_HYPER_VERSION_LATEST) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for hyperslab selection") + if(version >= (uint32_t)H5S_HYPER_VERSION_2) { /* Decode flags */ flags = *(pp)++; diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 46c43da..800913f 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -86,7 +86,7 @@ static herr_t H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, static herr_t H5S__release_datatype(H5S_mpio_mpitype_list_t *type_list); static herr_t H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, size_t elmt_size, const MPI_Datatype *elmt_type, MPI_Datatype *span_type, - H5S_mpio_mpitype_list_t *type_list, uint64_t op_gen); + H5S_mpio_mpitype_list_t *type_list, unsigned op_info_i, uint64_t op_gen); /*****************************/ diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 6809643..2f15a74 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -41,9 +41,10 @@ #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 -#define H5S_HYPER_VERSION_3 3 +#define H5S_HYPER_VERSION_1 1 +#define H5S_HYPER_VERSION_2 2 +#define H5S_HYPER_VERSION_3 3 +#define H5S_HYPER_VERSION_LATEST H5S_HYPER_VERSION_3 /* Versions for H5S_SEL_POINTS selection info */ #define H5S_POINT_VERSION_1 1 @@ -227,7 +227,7 @@ H5T_INIT_TYPE_ALLOC_COMMON(H5T_REFERENCE) \ H5T_INIT_TYPE_NUM_COMMON(H5T_ORDER_NONE) \ dt->shared->force_conv = TRUE; \ - dt->shared->u.atomic.u.r.f = NULL; \ + dt->shared->u.atomic.u.r.file = NULL; \ dt->shared->u.atomic.u.r.loc = H5T_LOC_BADLOC; \ dt->shared->u.atomic.u.r.cls = NULL; \ } @@ -254,6 +254,7 @@ dt->shared->u.atomic.u.r.rtype = H5R_OBJECT2; \ dt->shared->u.atomic.u.r.opaque = TRUE; \ dt->shared->u.atomic.u.r.version = H5R_ENCODE_VERSION; \ + dt->shared->version = H5O_DTYPE_VERSION_4; \ } /* Define the code templates for the "SIZE_TMPL" in the H5T_INIT_TYPE macro */ @@ -5532,7 +5533,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) case H5T_REFERENCE: /* Reference types go through type conversion */ - if((ret_value = H5T__ref_set_loc(dt, f, loc)) < 0) + if((ret_value = H5T__ref_set_loc(dt, file, loc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "Unable to set reference location"); break; diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 111ae92..6aea00e 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3183,18 +3183,18 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, hbool_t is_nil; /* Whether sequence is "nil" */ /* Check for "nil" source sequence */ - if((*(src->shared->u.vlen.cls->isnull))(src->shared->u.vlen.f, s, &is_nil) < 0) + if((*(src->shared->u.vlen.cls->isnull))(src->shared->u.vlen.file, s, &is_nil) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if VL data is 'nil'") else if(is_nil) { /* Write "nil" sequence to destination location */ - if((*(dst->shared->u.vlen.cls->setnull))(dst->shared->u.vlen.f, d, b) < 0) + if((*(dst->shared->u.vlen.cls->setnull))(dst->shared->u.vlen.file, d, b) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set VL data to 'nil'") } /* end else-if */ else { size_t seq_len; /* The number of elements in the current sequence */ /* Get length of element sequences */ - if((*(src->shared->u.vlen.cls->getlen))(src->shared->u.vlen.f, s, &seq_len) < 0) + if((*(src->shared->u.vlen.cls->getlen))(src->shared->u.vlen.file, s, &seq_len) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "bad sequence length") /* If we are reading from memory and there is no conversion, just get the pointer to sequence */ @@ -3226,7 +3226,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } /* end else-if */ /* Read in VL sequence */ - if((*(src->shared->u.vlen.cls->read))(src->shared->u.vlen.f, s, conv_buf, src_size) < 0) + if((*(src->shared->u.vlen.cls->read))(src->shared->u.vlen.file, s, conv_buf, src_size) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data") } /* end else */ @@ -3248,7 +3248,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, HDassert(write_to_file); /* Get length of background element sequence */ - if((*(dst->shared->u.vlen.cls->getlen))(dst->shared->u.vlen.f, b, &bg_seq_len) < 0) + if((*(dst->shared->u.vlen.cls->getlen))(dst->shared->u.vlen.file, b, &bg_seq_len) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "bad sequence length") /* Read sequence if length > 0 */ @@ -3261,7 +3261,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } /* end if */ /* Read in background VL sequence */ - if((*(dst->shared->u.vlen.cls->read))(dst->shared->u.vlen.f, b, tmp_buf, bg_seq_len) < 0) + if((*(dst->shared->u.vlen.cls->read))(dst->shared->u.vlen.file, b, tmp_buf, bg_seq_len * dst_base_size) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data") } /* end if */ @@ -3276,7 +3276,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } /* end if */ /* Write sequence to destination location */ - if((*(dst->shared->u.vlen.cls->write))(dst->shared->u.vlen.f, &vl_alloc_info, d, conv_buf, b, seq_len, dst_base_size) < 0) + if((*(dst->shared->u.vlen.cls->write))(dst->shared->u.vlen.file, &vl_alloc_info, d, conv_buf, b, seq_len, dst_base_size) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data") if(!noop_conv) { @@ -3291,7 +3291,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, tmp = (uint8_t *)tmp_buf + seq_len * dst_base_size; for(u = seq_len; u < bg_seq_len; u++, tmp += dst_base_size) { /* Delete sequence in destination location */ - if((*(dst->shared->u.vlen.cls->del))(dst->shared->u.vlen.f, tmp) < 0) + if((*(dst->shared->u.vlen.cls->del))(dst->shared->u.vlen.file, tmp) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove heap object") } /* end for */ } /* end if */ @@ -3612,8 +3612,8 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Get size of references */ if(0 == (buf_size = src->shared->u.atomic.u.r.cls->getsize( - src->shared->u.atomic.u.r.f, s, src->shared->size, - dst->shared->u.atomic.u.r.f, &dst_copy))) + src->shared->u.atomic.u.r.file, s, src->shared->size, + dst->shared->u.atomic.u.r.file, &dst_copy))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect size") /* Check if conversion buffer is large enough, resize if necessary. */ @@ -3629,8 +3629,8 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } else { /* Read reference */ if(src->shared->u.atomic.u.r.cls->read( - src->shared->u.atomic.u.r.f, s, src->shared->size, - dst->shared->u.atomic.u.r.f, conv_buf, buf_size) < 0) + src->shared->u.atomic.u.r.file, s, src->shared->size, + dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read reference data") } @@ -3639,8 +3639,8 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } else { /* Write reference to destination location */ if(dst->shared->u.atomic.u.r.cls->write( - src->shared->u.atomic.u.r.f, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype, - dst->shared->u.atomic.u.r.f, d, dst->shared->size, b) < 0) + src->shared->u.atomic.u.r.file, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype, + dst->shared->u.atomic.u.r.file, d, dst->shared->size, b) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write reference data") } diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index eec486c..1dbc229 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -182,9 +182,9 @@ struct H5T_path_t { }; /* Reference function pointers */ -typedef size_t (*H5T_ref_getsizefunc_t)(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, hbool_t *dst_copy); -typedef herr_t (*H5T_ref_readfunc_t)(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, void *dst_buf, size_t dst_size); -typedef herr_t (*H5T_ref_writefunc_t)(H5F_t *src_f, const void *src_buf, size_t src_size, H5R_type_t src_type, H5F_t *dst_f, void *dst_buf, size_t dst_size, void *bg_buf); +typedef size_t (*H5T_ref_getsizefunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy); +typedef herr_t (*H5T_ref_readfunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); +typedef herr_t (*H5T_ref_writefunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf); typedef struct H5T_ref_class_t { H5T_ref_getsizefunc_t getsize; /* get reference size (bytes) */ @@ -224,7 +224,7 @@ typedef struct H5T_atomic_t { unsigned version; /* version of encoded reference */ hbool_t opaque; /* opaque reference type */ H5T_loc_t loc; /* location of data in buffer */ - H5F_t *f; /* file pointer (if data is on disk) */ + H5VL_object_t *file; /* file VOL pointer (if data is on disk) */ const H5T_ref_class_t *cls; /* Pointer to ref class callbacks */ } r; /* reference types */ } u; @@ -273,13 +273,13 @@ typedef enum { } H5T_vlen_type_t; /* VL function pointers */ -typedef herr_t (*H5T_vlen_getlen_func_t)(H5F_t *f, const void *vl_addr, size_t *len); +typedef herr_t (*H5T_vlen_getlen_func_t)(H5VL_object_t *file, const void *vl_addr, size_t *len); typedef void * (*H5T_vlen_getptr_func_t)(void *vl_addr); -typedef herr_t (*H5T_vlen_isnull_func_t)(const H5F_t *f, void *vl_addr, hbool_t *isnull); -typedef herr_t (*H5T_vlen_setnull_func_t)(H5F_t *f, void *_vl, void *_bg); -typedef herr_t (*H5T_vlen_read_func_t)(H5F_t *f, void *_vl, void *buf, size_t len); -typedef herr_t (*H5T_vlen_write_func_t)(H5F_t *f, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size); -typedef herr_t (*H5T_vlen_delete_func_t)(H5F_t *f, const void *_vl); +typedef herr_t (*H5T_vlen_isnull_func_t)(const H5VL_object_t *file, void *vl_addr, hbool_t *isnull); +typedef herr_t (*H5T_vlen_setnull_func_t)(H5VL_object_t *file, void *_vl, void *_bg); +typedef herr_t (*H5T_vlen_read_func_t)(H5VL_object_t *file, void *_vl, void *buf, size_t len); +typedef herr_t (*H5T_vlen_write_func_t)(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size); +typedef herr_t (*H5T_vlen_delete_func_t)(H5VL_object_t *file, const void *_vl); /* VL datatype callbacks */ typedef struct H5T_vlen_class_t { @@ -299,7 +299,7 @@ typedef struct H5T_vlen_t { H5T_cset_t cset; /* For VL string: character set */ H5T_str_t pad; /* For VL string: space or null padding of * extra bytes */ - H5F_t *f; /* File ID (if VL data is on disk) */ + H5VL_object_t *file; /* File object (if VL data is on disk) */ const H5T_vlen_class_t *cls; /* Pointer to VL class callbacks */ } H5T_vlen_t; @@ -1183,7 +1183,7 @@ H5_DLL int H5T__get_array_ndims(const H5T_t *dt); H5_DLL int H5T__get_array_dims(const H5T_t *dt, hsize_t dims[]); /* Reference functions */ -H5_DLL htri_t H5T__ref_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc); +H5_DLL htri_t H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc); /* Compound functions */ H5_DLL herr_t H5T__insert(H5T_t *parent, const char *name, size_t offset, diff --git a/src/H5Tref.c b/src/H5Tref.c index 937dc92..2e52954 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -27,6 +27,8 @@ #include "H5Rpkg.h" /* References */ #include "H5Tpkg.h" /* Datatypes */ +#include "H5VLnative_private.h" /* Native VOL connector */ + /****************/ /* Local Macros */ /****************/ @@ -52,20 +54,20 @@ struct H5Tref_dsetreg { /* Local Prototypes */ /********************/ -static size_t H5T__ref_mem_getsize(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, hbool_t *dst_copy); -static herr_t H5T__ref_mem_read(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, void *dst_buf, size_t dst_size); -static herr_t H5T__ref_mem_write(H5F_t *src_f, const void *src_buf, size_t src_size, H5R_type_t src_type, H5F_t *dst_f, void *dst_buf, size_t dst_size, void *bg_buf); +static size_t H5T__ref_mem_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy); +static herr_t H5T__ref_mem_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); +static herr_t H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf); -static size_t H5T__ref_disk_getsize(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, hbool_t *dst_copy); -static herr_t H5T__ref_disk_read(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, void *dst_buf, size_t dst_size); -static herr_t H5T__ref_disk_write(H5F_t *src_f, const void *src_buf, size_t src_size, H5R_type_t src_type, H5F_t *dst_f, void *dst_buf, size_t dst_size, void *bg_buf); +static size_t H5T__ref_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy); +static herr_t H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); +static herr_t H5T__ref_disk_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf); /* For compatibility */ -static size_t H5T__ref_obj_disk_getsize(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, hbool_t *dst_copy); -static herr_t H5T__ref_obj_disk_read(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, void *dst_buf, size_t dst_size); +static size_t H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy); +static herr_t H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); -static size_t H5T__ref_dsetreg_disk_getsize(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, hbool_t *dst_copy); -static herr_t H5T__ref_dsetreg_disk_read(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, void *dst_buf, size_t dst_size); +static size_t H5T__ref_dsetreg_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy); +static herr_t H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); /*******************/ /* Local Variables */ @@ -112,7 +114,7 @@ static const H5T_ref_class_t H5T_ref_dsetreg_disk_g = { *------------------------------------------------------------------------- */ htri_t -H5T__ref_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) +H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) { htri_t ret_value = FALSE; /* Indicate success, but no location change */ @@ -123,18 +125,18 @@ H5T__ref_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) HDassert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC); /* Only change the location if it's different */ - if(loc == dt->shared->u.atomic.u.r.loc && f == dt->shared->u.atomic.u.r.f) + if(loc == dt->shared->u.atomic.u.r.loc && file == dt->shared->u.atomic.u.r.file) HGOTO_DONE(FALSE) switch(loc) { case H5T_LOC_MEMORY: /* Memory based reference datatype */ - HDassert(NULL == f); + HDassert(NULL == file); /* Mark this type as being stored in memory */ dt->shared->u.atomic.u.r.loc = H5T_LOC_MEMORY; /* Reset file ID (since this reference is in memory) */ - dt->shared->u.atomic.u.r.f = f; /* f is NULL */ + dt->shared->u.atomic.u.r.file = file; /* file is NULL */ if(dt->shared->u.atomic.u.r.opaque) { /* Size in memory, disk size is different */ @@ -164,15 +166,24 @@ H5T__ref_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) break; case H5T_LOC_DISK: /* Disk based reference datatype */ - HDassert(f); + HDassert(file); /* Mark this type as being stored on disk */ dt->shared->u.atomic.u.r.loc = H5T_LOC_DISK; /* Set file pointer (since this reference is on disk) */ - dt->shared->u.atomic.u.r.f = f; + dt->shared->u.atomic.u.r.file = file; if(dt->shared->u.atomic.u.r.rtype == H5R_OBJECT1) { + H5F_t *f; + + /* We should assert here that the terminal connector is H5VL_NATIVE once + * there is a facility to do so -NAF 2019/10/30 */ + + /* Retrieve file from VOL object */ + if(NULL == (f = (H5F_t *)H5VL_object_data(file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + /* Size on disk, memory size is different */ dt->shared->size = H5T_REF_OBJ_DISK_SIZE(f); dt->shared->u.atomic.prec = 8 * dt->shared->size; @@ -181,6 +192,15 @@ H5T__ref_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) dt->shared->u.atomic.u.r.cls = &H5T_ref_obj_disk_g; } else if(dt->shared->u.atomic.u.r.rtype == H5R_DATASET_REGION1) { + H5F_t *f; + + /* We should assert here that the terminal connector is H5VL_NATIVE once + * there is a facility to do so -NAF 2019/10/30 */ + + /* Retrieve file from VOL object */ + if(NULL == (f = (H5F_t *)H5VL_object_data(file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + /* Size on disk, memory size is different */ dt->shared->size = H5T_REF_DSETREG_DISK_SIZE(f); dt->shared->u.atomic.prec = 8 * dt->shared->size; @@ -194,8 +214,8 @@ H5T__ref_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) H5R_ref_priv_t fixed_ref; /* Get container info */ - if(H5F__get_cont_info(f, &cont_info) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get file container info") + if(H5VL_file_get(file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info") /* Retrieve min encode size (when references have no vlen part) */ HDmemset(&fixed_ref, 0, sizeof(fixed_ref)); @@ -226,7 +246,7 @@ H5T__ref_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) dt->shared->u.atomic.u.r.loc = H5T_LOC_BADLOC; /* Reset file pointer */ - dt->shared->u.atomic.u.r.f = NULL; + dt->shared->u.atomic.u.r.file = NULL; /* Reset the function pointers */ dt->shared->u.atomic.u.r.cls = NULL; @@ -257,10 +277,12 @@ done: *------------------------------------------------------------------------- */ static size_t -H5T__ref_mem_getsize(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf, - size_t H5_ATTR_UNUSED src_size, H5F_t *dst_f, hbool_t *dst_copy) +H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, + size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, hbool_t *dst_copy) { - void *vol_obj = NULL; + H5F_t *src_f; + H5F_t *dst_f; + H5VL_object_t *vol_obj = NULL; const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf; unsigned flags = 0; size_t ret_value = 0; @@ -274,9 +296,14 @@ H5T__ref_mem_getsize(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf, if(NULL == (vol_obj = H5VL_vol_object(src_ref->loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") - /* Retrieve file from VOL object */ + /* We should assert here that the terminal connector is H5VL_NATIVE once + * there is a facility to do so -NAF 2019/10/30 */ + + /* Retrieve files from VOL objects */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(vol_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") + if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") /* Set external flag if referenced file is not destination file */ flags |= (src_f->shared != dst_f->shared) ? H5R_IS_EXTERNAL : 0; @@ -315,11 +342,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_mem_read(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf, - size_t H5_ATTR_UNUSED src_size, H5F_t *dst_f, void *dst_buf, +H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, + size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size) { - void *vol_obj = NULL; + H5F_t *src_f; + H5F_t *dst_f; + H5VL_object_t *vol_obj = NULL; const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf; unsigned flags = 0; herr_t ret_value = SUCCEED; @@ -328,7 +357,7 @@ H5T__ref_mem_read(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf, HDassert(src_buf); HDassert(src_size == H5T_REF_MEM_SIZE); - HDassert(dst_f); + HDassert(dst_file); HDassert(dst_buf); HDassert(dst_size); @@ -336,9 +365,14 @@ H5T__ref_mem_read(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf, if(NULL == (vol_obj = H5VL_vol_object(src_ref->loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") - /* Retrieve file from VOL object */ + /* We should assert here that the terminal connector is H5VL_NATIVE once + * there is a facility to do so -NAF 2019/10/30 */ + + /* Retrieve files from VOL objects */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(vol_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") + if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") /* Set external flag if referenced file is not destination file */ flags |= (src_f->shared != dst_f->shared) ? H5R_IS_EXTERNAL : 0; @@ -349,7 +383,7 @@ H5T__ref_mem_read(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf, H5CX_set_libver_bounds(dst_f); /* Encode reference */ - if(H5R__encode(H5F_ACTUAL_NAME(src_f), src_ref, dst_buf, &dst_size, flags) < 0) + if(H5R__encode(H5F_ACTUAL_NAME(src_f), src_ref, (unsigned char *)dst_buf, &dst_size, flags) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "Cannot encode reference") done: @@ -367,22 +401,30 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_mem_write(H5F_t *src_f, const void *src_buf, size_t src_size, - H5R_type_t src_type, H5F_t H5_ATTR_UNUSED *dst_f, void *dst_buf, +H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, + H5R_type_t src_type, H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t dst_size, void H5_ATTR_UNUSED *bg_buf) { + H5F_t *src_f; hid_t file_id = H5I_INVALID_HID; H5R_ref_priv_t *dst_ref = (H5R_ref_priv_t *)dst_buf; herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC - HDassert(src_f); + HDassert(src_file); HDassert(src_buf); HDassert(src_size); HDassert(dst_buf); HDassert(dst_size == H5T_REF_MEM_SIZE); + /* We should assert here that the terminal connector is H5VL_NATIVE once + * there is a facility to do so -NAF 2019/10/30 */ + + /* Retrieve file from VOL object */ + if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + /* Make sure reference buffer is correctly initialized */ HDmemset(dst_buf, 0, dst_size); @@ -451,8 +493,8 @@ done: *------------------------------------------------------------------------- */ static size_t -H5T__ref_disk_getsize(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf, - size_t src_size, H5F_t H5_ATTR_UNUSED *dst_f, hbool_t *dst_copy) +H5T__ref_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, + size_t src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file, hbool_t *dst_copy) { const uint8_t *p = (const uint8_t *)src_buf; unsigned flags; @@ -499,50 +541,36 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_disk_read(H5F_t *src_f, const void *src_buf, size_t src_size, - H5F_t H5_ATTR_UNUSED *dst_f, void *dst_buf, size_t dst_size) +H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, + H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t dst_size) { - H5VL_object_t *vol_obj = NULL; /* Object info */ - hid_t file_id = H5I_INVALID_HID; const uint8_t *p = (const uint8_t *)src_buf; uint8_t *q = (uint8_t *)dst_buf; - size_t buf_size_left = src_size; - size_t expected_size = dst_size; + size_t blob_size = dst_size; herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC - HDassert(src_f); + HDassert(src_file); HDassert(src_buf); HDassert(dst_buf); HDassert(dst_size); - /* TODO temporary hack to retrieve file object */ - if((file_id = H5F__get_file_id(src_f, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - if(NULL == (vol_obj = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Copy header manually */ HDmemcpy(q, p, H5R_ENCODE_HEADER_SIZE); p += H5R_ENCODE_HEADER_SIZE; q += H5R_ENCODE_HEADER_SIZE; - expected_size -= H5R_ENCODE_HEADER_SIZE; + blob_size -= H5R_ENCODE_HEADER_SIZE; /* Skip the length of the sequence */ p += H5_SIZEOF_UINT32_T; - HDassert(buf_size_left > H5_SIZEOF_UINT32_T); - buf_size_left -= H5_SIZEOF_UINT32_T; + HDassert(src_size > (H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T)); /* Retrieve blob */ - if(H5VL_blob_get(vol_obj, p, q, &dst_size, NULL) < 0) + if(H5VL_blob_get(src_file, p, q, blob_size, NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get blob") - if(dst_size != expected_size) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Expected data size does not match") done: - if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0)) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file id") FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__ref_disk_read() */ @@ -557,12 +585,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_disk_write(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf, - size_t src_size, H5R_type_t H5_ATTR_UNUSED src_type, H5F_t *dst_f, +H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, + size_t src_size, H5R_type_t H5_ATTR_UNUSED src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf) { - H5VL_object_t *vol_obj = NULL; /* Object info */ - hid_t file_id = H5I_INVALID_HID; const uint8_t *p = (const uint8_t *)src_buf; uint8_t *q = (uint8_t *)dst_buf; size_t buf_size_left = dst_size; @@ -573,15 +599,9 @@ H5T__ref_disk_write(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf, HDassert(src_buf); HDassert(src_size); - HDassert(dst_f); + HDassert(dst_file); HDassert(dst_buf); - /* TODO temporary hack to retrieve file object */ - if((file_id = H5F__get_file_id(dst_f, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - if(NULL == (vol_obj = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* TODO Should get rid of bg stuff */ if(p_bg) { size_t p_buf_size_left = dst_size; @@ -592,7 +612,7 @@ H5T__ref_disk_write(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf, p_buf_size_left -= H5_SIZEOF_UINT32_T; /* Remove blob for old data */ - if(H5VL_blob_specific(vol_obj, (void *)p_bg, H5VL_BLOB_DELETE) < 0) + if(H5VL_blob_specific(dst_file, (void *)p_bg, H5VL_BLOB_DELETE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob") } /* end if */ @@ -609,12 +629,10 @@ H5T__ref_disk_write(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf, buf_size_left -= H5_SIZEOF_UINT32_T; /* Store blob */ - if(H5VL_blob_put(vol_obj, p, src_size, q, NULL) < 0) + if(H5VL_blob_put(dst_file, p, src_size, q, NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to put blob") done: - if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0)) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file id") FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__ref_disk_write() */ @@ -629,20 +647,30 @@ done: *------------------------------------------------------------------------- */ static size_t -H5T__ref_obj_disk_getsize(H5F_t *src_f, const void H5_ATTR_UNUSED *src_buf, - size_t H5_ATTR_UNUSED src_size, H5F_t H5_ATTR_UNUSED *dst_f, +H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *src_buf, + size_t H5_ATTR_UNUSED src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file, hbool_t H5_ATTR_UNUSED *dst_copy) { + H5F_t *src_f; size_t ret_value = 0; - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_STATIC - HDassert(src_f); + HDassert(src_file); HDassert(src_buf); + + /* We should assert here that the terminal connector is H5VL_NATIVE once + * there is a facility to do so -NAF 2019/10/30 */ + + /* Retrieve file from VOL object */ + if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") + HDassert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f)); ret_value = H5T_REF_OBJ_DISK_SIZE(src_f); +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__ref_obj_disk_getsize() */ @@ -657,22 +685,31 @@ H5T__ref_obj_disk_getsize(H5F_t *src_f, const void H5_ATTR_UNUSED *src_buf, *------------------------------------------------------------------------- */ static herr_t -H5T__ref_obj_disk_read(H5F_t *src_f, const void *src_buf, size_t src_size, - H5F_t H5_ATTR_UNUSED *dst_f, void *dst_buf, size_t H5_ATTR_UNUSED dst_size) +H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, + H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t H5_ATTR_UNUSED dst_size) { + H5F_t *src_f; herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC - HDassert(src_f); + HDassert(src_file); HDassert(src_buf); - HDassert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f)); HDassert(dst_buf); + + /* We should assert here that the terminal connector is H5VL_NATIVE once + * there is a facility to do so -NAF 2019/10/30 */ + + /* Retrieve file from VOL object */ + if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + + HDassert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f)); HDassert(dst_size == H5F_SIZEOF_ADDR(src_f)); /* Get object address */ if(H5R__decode_token_obj_compat((const unsigned char *)src_buf, &src_size, - dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0) + (unsigned char *)dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address") done: @@ -690,17 +727,32 @@ done: *------------------------------------------------------------------------- */ static size_t -H5T__ref_dsetreg_disk_getsize(H5F_t H5_ATTR_UNUSED *f, +H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *file, const void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size, - H5F_t H5_ATTR_UNUSED *dst_f, hbool_t H5_ATTR_UNUSED *dst_copy) + H5VL_object_t H5_ATTR_UNUSED *dst_file, hbool_t H5_ATTR_UNUSED *dst_copy) { size_t ret_value = sizeof(struct H5Tref_dsetreg); - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_STATIC HDassert(buf); - HDassert(buf_size == H5T_REF_DSETREG_DISK_SIZE(f)); +#ifndef NDEBUG + { + H5F_t *f; + + /* We should assert here that the terminal connector is H5VL_NATIVE once + * there is a facility to do so -NAF 2019/10/30 */ + + /* Retrieve file from VOL object */ + if(NULL == (f = (H5F_t *)H5VL_object_data(file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") + + HDassert(buf_size == H5T_REF_DSETREG_DISK_SIZE(f)); + } /* end block */ +#endif /* NDEBUG */ + +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__ref_dsetreg_disk_getsize() */ @@ -715,20 +767,29 @@ H5T__ref_dsetreg_disk_getsize(H5F_t H5_ATTR_UNUSED *f, *------------------------------------------------------------------------- */ static herr_t -H5T__ref_dsetreg_disk_read(H5F_t *src_f, const void *src_buf, size_t src_size, - H5F_t H5_ATTR_UNUSED *dst_f, void *dst_buf, size_t H5_ATTR_UNUSED dst_size) +H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, + H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t H5_ATTR_UNUSED dst_size) { + H5F_t *src_f; struct H5Tref_dsetreg *dst_reg = (struct H5Tref_dsetreg *)dst_buf; herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC - HDassert(src_f); + HDassert(src_file); HDassert(src_buf); - HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f)); HDassert(dst_buf); HDassert(dst_size == sizeof(struct H5Tref_dsetreg)); + /* We should assert here that the terminal connector is H5VL_NATIVE once + * there is a facility to do so -NAF 2019/10/30 */ + + /* Retrieve file from VOL object */ + if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + + HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f)); + /* Retrieve object address and space */ if(H5R__decode_token_region_compat(src_f, (const unsigned char *)src_buf, &src_size, &dst_reg->token, H5F_SIZEOF_ADDR(src_f), &dst_reg->space) < 0) diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index a76cfbf..ec84879 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -33,6 +33,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Tpkg.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ /* Local Macros */ @@ -54,28 +55,28 @@ /********************/ /* Memory-based VL sequence callbacks */ -static herr_t H5T__vlen_mem_seq_getlen(H5F_t *f, const void *_vl, size_t *len); +static herr_t H5T__vlen_mem_seq_getlen(H5VL_object_t *file, const void *_vl, size_t *len); static void * H5T__vlen_mem_seq_getptr(void *_vl); -static herr_t H5T__vlen_mem_seq_isnull(const H5F_t *f, void *_vl, hbool_t *isnull); -static herr_t H5T__vlen_mem_seq_setnull(H5F_t *f, void *_vl, void *_bg); -static herr_t H5T__vlen_mem_seq_read(H5F_t *f, void *_vl, void *_buf, size_t len); -static herr_t H5T__vlen_mem_seq_write(H5F_t *f, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size); +static herr_t H5T__vlen_mem_seq_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull); +static herr_t H5T__vlen_mem_seq_setnull(H5VL_object_t *file, void *_vl, void *_bg); +static herr_t H5T__vlen_mem_seq_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len); +static herr_t H5T__vlen_mem_seq_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size); /* Memory-based VL string callbacks */ -static herr_t H5T__vlen_mem_str_getlen(H5F_t *f, const void *_vl, size_t *len); +static herr_t H5T__vlen_mem_str_getlen(H5VL_object_t *file, const void *_vl, size_t *len); static void * H5T__vlen_mem_str_getptr(void *_vl); -static herr_t H5T__vlen_mem_str_isnull(const H5F_t *f, void *_vl, hbool_t *isnull); -static herr_t H5T__vlen_mem_str_setnull(H5F_t *f, void *_vl, void *_bg); -static herr_t H5T__vlen_mem_str_read(H5F_t *f, void *_vl, void *_buf, size_t len); -static herr_t H5T__vlen_mem_str_write(H5F_t *f, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size); +static herr_t H5T__vlen_mem_str_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull); +static herr_t H5T__vlen_mem_str_setnull(H5VL_object_t *file, void *_vl, void *_bg); +static herr_t H5T__vlen_mem_str_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len); +static herr_t H5T__vlen_mem_str_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size); /* Disk-based VL sequence (and string) callbacks */ -static herr_t H5T__vlen_disk_getlen(H5F_t *f, const void *_vl, size_t *len); -static herr_t H5T__vlen_disk_isnull(const H5F_t *f, void *_vl, hbool_t *isnull); -static herr_t H5T__vlen_disk_setnull(H5F_t *f, void *_vl, void *_bg); -static herr_t H5T__vlen_disk_read(H5F_t *f, void *_vl, void *_buf, size_t len); -static herr_t H5T__vlen_disk_write(H5F_t *f, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size); -static herr_t H5T__vlen_disk_delete(H5F_t *f, const void *_vl); +static herr_t H5T__vlen_disk_getlen(H5VL_object_t *file, const void *_vl, size_t *len); +static herr_t H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull); +static herr_t H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *_bg); +static herr_t H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len); +static herr_t H5T__vlen_disk_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size); +static herr_t H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl); /*********************/ @@ -299,12 +300,13 @@ H5T__vlen_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* Mark this type as being stored on disk */ dt->shared->u.vlen.loc = H5T_LOC_DISK; - /* - * Size of element on disk is 4 bytes for the length, plus the size - * of an address in this file, plus 4 bytes for the size of a heap - * ID. Memory size is different. - */ - dt->shared->size = 4 + (size_t)H5F_SIZEOF_ADDR(f) + 4; + /* Get container info */ + if(H5VL_file_get(file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info") + + /* The datatype size is equal to 4 bytes for the sequence length + * plus the size of a blob id */ + dt->shared->size = 4 + cont_info.blob_id_size; /* Set up the function pointers to access the VL information on disk */ /* VL sequences and VL strings are stored identically on disk, so use the same functions */ @@ -324,7 +326,7 @@ H5T__vlen_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) dt->shared->u.vlen.cls = NULL; /* Reset file pointer */ - dt->shared->u.vlen.f = NULL; + dt->shared->u.vlen.file = NULL; break; case H5T_LOC_MAXLOC: @@ -355,7 +357,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_getlen(H5F_t H5_ATTR_UNUSED *f, const void *_vl, size_t *len) +H5T__vlen_mem_seq_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_t *len) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -431,7 +433,7 @@ H5T__vlen_mem_seq_getptr(void *_vl) *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl, hbool_t *isnull) +H5T__vlen_mem_seq_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hbool_t *isnull) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -469,7 +471,7 @@ H5T__vlen_mem_seq_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl, hbool_t *isnu *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSED *_bg) +H5T__vlen_mem_seq_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5_ATTR_UNUSED *_bg) { hvl_t vl; /* Temporary hvl_t to use during operation */ @@ -502,7 +504,7 @@ H5T__vlen_mem_seq_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSE *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len) +H5T__vlen_mem_seq_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, size_t len) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -543,7 +545,7 @@ H5T__vlen_mem_seq_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size) +H5T__vlen_mem_seq_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size) { hvl_t vl; /* Temporary hvl_t to use during operation */ herr_t ret_value = SUCCEED; /* Return value */ @@ -596,7 +598,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_getlen(H5F_t H5_ATTR_UNUSED *f, const void *_vl, size_t *len) +H5T__vlen_mem_str_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_t *len) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const char *s = *(const char * const *)_vl; /* Pointer to the user's string information */ @@ -667,7 +669,7 @@ H5T__vlen_mem_str_getptr(void *_vl) *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl, hbool_t *isnull) +H5T__vlen_mem_str_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hbool_t *isnull) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s = *(char **)_vl; /* Pointer to the user's string information */ @@ -700,7 +702,7 @@ H5T__vlen_mem_str_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl, hbool_t *isnu *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSED *_bg) +H5T__vlen_mem_str_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5_ATTR_UNUSED *_bg) { char *t = NULL; /* Pointer to temporary buffer allocated */ @@ -726,7 +728,7 @@ H5T__vlen_mem_str_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSE *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len) +H5T__vlen_mem_str_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, size_t len) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s = *(char **)_vl; /* Pointer to the user's string information */ @@ -766,7 +768,7 @@ H5T__vlen_mem_str_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_alloc_info, +H5T__vlen_mem_str_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size) { char *t; /* Pointer to temporary buffer allocated */ @@ -813,7 +815,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_getlen(H5F_t H5_ATTR_UNUSED *f, const void *_vl, size_t *seq_len) +H5T__vlen_disk_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_t *seq_len) { const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -843,36 +845,26 @@ H5T__vlen_disk_getlen(H5F_t H5_ATTR_UNUSED *f, const void *_vl, size_t *seq_len) *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_isnull(const H5F_t *f, void *_vl, hbool_t *isnull) +H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull) { - H5VL_object_t *vol_obj = NULL;/* Object info */ - hid_t file_id = H5I_INVALID_HID; uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Check parameters */ - HDassert(f); + HDassert(file); HDassert(vl); HDassert(isnull); /* Skip the sequence's length */ vl += 4; - /* TODO temporary hack to retrieve file object */ - if((file_id = H5F__get_file_id((H5F_t *)f, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - if(NULL == (vol_obj = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Check if blob ID is "nil" */ - if(H5VL_blob_specific(vol_obj, vl, H5VL_BLOB_ISNULL, isnull) < 0) + if(H5VL_blob_specific(file, vl, H5VL_BLOB_ISNULL, isnull) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'") done: - if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0)) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file id") FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__vlen_disk_isnull() */ @@ -890,41 +882,31 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_setnull(H5F_t *f, void *_vl, void *bg) +H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg) { - H5VL_object_t *vol_obj = NULL;/* Object info */ - hid_t file_id = H5I_INVALID_HID; uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* check parameters */ - HDassert(f); + HDassert(file); HDassert(vl); /* Free heap object for old data */ if(bg != NULL) /* Delete sequence in destination location */ - if(H5T__vlen_disk_delete(f, bg) < 0) + if(H5T__vlen_disk_delete(file, bg) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove background heap object") /* Set the length of the sequence */ UINT32ENCODE(vl, 0); - /* TODO temporary hack to retrieve file object */ - if((file_id = H5F__get_file_id(f, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - if(NULL == (vol_obj = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Set blob ID to "nil" */ - if(H5VL_blob_specific(vol_obj, vl, H5VL_BLOB_SETNULL) < 0) + if(H5VL_blob_specific(file, vl, H5VL_BLOB_SETNULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'") done: - if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0)) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file id") FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__vlen_disk_setnull() */ @@ -942,36 +924,26 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_read(H5F_t *f, void *_vl, void *buf, size_t H5_ATTR_UNUSED len) +H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *buf, size_t len) { - H5VL_object_t *vol_obj = NULL;/* Object info */ - hid_t file_id = H5I_INVALID_HID; const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Check parameters */ - HDassert(f); + HDassert(file); HDassert(vl); HDassert(buf); /* Skip the length of the sequence */ vl += 4; - /* TODO temporary hack to retrieve file object */ - if((file_id = H5F__get_file_id(f, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - if(NULL == (vol_obj = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Retrieve blob */ - if(H5VL_blob_get(vol_obj, vl, buf, NULL, NULL) < 0) + if(H5VL_blob_get(file, vl, buf, len, NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get blob") done: - if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0)) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file id") FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__vlen_disk_read() */ @@ -989,11 +961,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_write(H5F_t *f, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_alloc_info, - void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size) +H5T__vlen_disk_write(H5VL_object_t *file, + const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_alloc_info, void *_vl, + void *buf, void *_bg, size_t seq_len, size_t base_size) { - H5VL_object_t *vol_obj = NULL; /* Object info */ - hid_t file_id = H5I_INVALID_HID; uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */ const uint8_t *bg = (const uint8_t *)_bg; /* Pointer to the old data hvl_t */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1007,25 +978,17 @@ H5T__vlen_disk_write(H5F_t *f, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_al /* Free heap object for old data, if non-NULL */ if(bg != NULL) - if(H5T__vlen_disk_delete(f, bg) < 0) + if(H5T__vlen_disk_delete(file, bg) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove background heap object") /* Set the length of the sequence */ UINT32ENCODE(vl, seq_len); - /* TODO temporary hack to retrieve file object */ - if((file_id = H5F__get_file_id(f, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - if(NULL == (vol_obj = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Store blob */ - if(H5VL_blob_put(vol_obj, buf, (seq_len * base_size), vl, NULL) < 0) + if(H5VL_blob_put(file, buf, (seq_len * base_size), vl, NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to put blob") done: - if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0)) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file id") FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__vlen_disk_write() */ @@ -1043,16 +1006,15 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_delete(H5F_t *f, const void *_vl) +H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl) { const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */ - hid_t file_id = H5I_INVALID_HID; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Check parameters */ - HDassert(f); + HDassert(file); /* Free heap object for old data */ if(vl != NULL) { @@ -1062,23 +1024,12 @@ H5T__vlen_disk_delete(H5F_t *f, const void *_vl) UINT32DECODE(vl, seq_len); /* Delete object, if length > 0 */ - if(seq_len > 0) { - H5VL_object_t *vol_obj = NULL; /* Object info */ - - /* TODO temporary hack to retrieve file object */ - if((file_id = H5F__get_file_id(f, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - if(NULL == (vol_obj = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - - if(H5VL_blob_specific(vol_obj, (void *)vl, H5VL_BLOB_DELETE) < 0) /* Casting away 'const' OK -QAK */ + if(seq_len > 0) + if(H5VL_blob_specific(file, (void *)vl, H5VL_BLOB_DELETE) < 0) /* Casting away 'const' OK -QAK */ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob") - } } /* end if */ done: - if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0)) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file id") FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__vlen_disk_delete() */ diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 1990c81..8d7368b 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -180,7 +180,7 @@ static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls); static herr_t H5VL__blob_put(void *obj, const H5VL_class_t *cls, const void *buf, size_t size, void *blob_id, void *ctx); static herr_t H5VL__blob_get(void *obj, const H5VL_class_t *cls, - const void *blob_id, void *buf, size_t *size, void *ctx); + const void *blob_id, void *buf, size_t size, void *ctx); static herr_t H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); @@ -6692,7 +6692,7 @@ done: */ static herr_t H5VL__blob_get(void *obj, const H5VL_class_t *cls, const void *blob_id, - void *buf, size_t *size, void *ctx) + void *buf, size_t size, void *ctx) { herr_t ret_value = SUCCEED; /* Return value */ @@ -6702,7 +6702,7 @@ H5VL__blob_get(void *obj, const H5VL_class_t *cls, const void *blob_id, HDassert(obj); HDassert(cls); HDassert(blob_id); - HDassert(size || buf); + HDassert(buf); /* Check if the corresponding VOL callback exists */ if(NULL == cls->blob_cls.get) @@ -6728,7 +6728,7 @@ done: */ herr_t H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, - size_t *size, void *ctx) + size_t size, void *ctx) { hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -6738,7 +6738,7 @@ H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, /* Sanity check */ HDassert(vol_obj); HDassert(blob_id); - HDassert(size || buf); + HDassert(buf); /* Set wrapper info in API context */ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) @@ -6768,13 +6768,13 @@ done: */ herr_t H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf, - size_t *size, void *ctx) + size_t size, void *ctx) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xi*x*x*z*x", obj, connector_id, blob_id, buf, size, ctx); + H5TRACE6("e", "*xi*x*xz*x", obj, connector_id, blob_id, buf, size, ctx); /* Get class pointer */ if(NULL == obj) diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index b1a8054..13cb2b5 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -381,7 +381,7 @@ typedef struct H5VL_request_class_t { /* 'blob' routines */ typedef struct H5VL_blob_class_t { herr_t (*put)(void *obj, const void *buf, size_t size, void *blob_id, void *ctx); - herr_t (*get)(void *obj, const void *blob_id, void *buf, size_t *size, void *ctx); + herr_t (*get)(void *obj, const void *blob_id, void *buf, size_t size, void *ctx); herr_t (*specific)(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); herr_t (*optional)(void *obj, void *blob_id, va_list arguments); } H5VL_blob_class_t; diff --git a/src/H5VLconnector_passthru.h b/src/H5VLconnector_passthru.h index d0d73d2..a4c8742 100644 --- a/src/H5VLconnector_passthru.h +++ b/src/H5VLconnector_passthru.h @@ -160,7 +160,7 @@ H5_DLL herr_t H5VLrequest_free(void *req, hid_t connector_id); /* Public wrappers for blob callbacks */ H5_DLL herr_t H5VLblob_put(void *obj, hid_t connector_id, const void *buf, size_t size, void *blob_id, void *ctx); -H5_DLL herr_t H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf, size_t *size, void *ctx); +H5_DLL herr_t H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf, size_t size, void *ctx); H5_DLL herr_t H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); /* Public wrappers for generic 'optional' callback */ diff --git a/src/H5VLnative_blob.c b/src/H5VLnative_blob.c index b16b407..6c7f9b2 100644 --- a/src/H5VLnative_blob.c +++ b/src/H5VLnative_blob.c @@ -109,12 +109,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t *size, +H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void H5_ATTR_UNUSED *ctx) { H5F_t *f = (H5F_t *)obj; /* Retrieve file pointer */ const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the disk blob ID */ H5HG_t hobjid; /* Global heap ID for sequence */ + size_t hobj_size; /* Global heap object size returned from H5HG_read() */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -131,9 +132,13 @@ H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t *size, /* Check if this sequence actually has any data */ if(hobjid.addr > 0) /* Read the VL information from disk */ - if(NULL == H5HG_read(f, &hobjid, buf, size)) + if(NULL == H5HG_read(f, &hobjid, buf, &hobj_size)) HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read VL information") + /* Verify the size is correct */ + if(hobj_size != size) + HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "Expected global heap object size does not match") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_blob_get() */ @@ -175,7 +180,7 @@ H5VL__native_blob_specific(void *obj, void *blob_id, H5F_addr_decode(f, &id, &(hobjid.addr)); UINT32DECODE(id, hobjid.idx); - /* Free heap object */ + /* Get heap object's size */ if(hobjid.addr > 0) { if(H5HG_get_obj_size(f, &hobjid, size) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREMOVE, FAIL, "unable to remove heap object") diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h index 5ed0b1f..69a057e 100644 --- a/src/H5VLnative_private.h +++ b/src/H5VLnative_private.h @@ -103,7 +103,7 @@ H5_DLL herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req); /* Blob callbacks */ H5_DLL herr_t H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx); -H5_DLL herr_t H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t *size, void *ctx); +H5_DLL herr_t H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx); H5_DLL herr_t H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); #ifdef __cplusplus diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index 8e395e6..d9a207f 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -180,7 +180,7 @@ static herr_t H5VL_pass_through_request_free(void *req); /* Blob callbacks */ static herr_t H5VL_pass_through_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx); -static herr_t H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf, size_t *size, void *ctx); +static herr_t H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx); static herr_t H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); @@ -2885,7 +2885,7 @@ H5VL_pass_through_blob_put(void *obj, const void *buf, size_t size, */ herr_t H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf, - size_t *size, void *ctx) + size_t size, void *ctx) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 2449bdf..c572b79 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -196,7 +196,7 @@ H5_DLL herr_t H5VL_request_free(const H5VL_object_t *vol_obj); /* Blob functions */ H5_DLL herr_t H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_t size, void *blob_id, void *ctx); -H5_DLL herr_t H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size_t *size, void *ctx); +H5_DLL herr_t H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size_t size, void *ctx); H5_DLL herr_t H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specific_t specific_type, ...); /* Generic functions */ diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c index 721a7c6..a73e569 100644 --- a/test/objcopy_ref.c +++ b/test/objcopy_ref.c @@ -247,8 +247,8 @@ attach_ref_attr(hid_t file_id, hid_t loc_id) if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data2) < 0) TEST_ERROR /* create an attribute with two object references */ - if(H5Rcreate_object(file_id, dsetname1, &ref[0]) < 0) TEST_ERROR - if(H5Rcreate_object(file_id, dsetname2, &ref[1]) < 0) TEST_ERROR + if(H5Rcreate_object(file_id, dsetname1, H5P_DEFAULT, &ref[0]) < 0) TEST_ERROR + if(H5Rcreate_object(file_id, dsetname2, H5P_DEFAULT, &ref[1]) < 0) TEST_ERROR if((aid = H5Acreate2(loc_id, "obj_ref_attr", H5T_STD_REF, sid_ref, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Awrite(aid, H5T_STD_REF, ref) < 0) TEST_ERROR @@ -315,12 +315,12 @@ attach_reg_ref_attr(hid_t file_id, hid_t loc_id) /* create reg_ref of block selection */ if(H5Sselect_hyperslab(space_id,H5S_SELECT_SET,start,NULL,count,NULL) < 0) TEST_ERROR - if(H5Rcreate_region(file_id, dsetnamev, space_id, &ref[0]) < 0) TEST_ERROR + if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[0]) < 0) TEST_ERROR /* create reg_ref of point selection */ if(H5Sselect_none(space_id) < 0) TEST_ERROR if(H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0) TEST_ERROR - if(H5Rcreate_region(file_id, dsetnamev, space_id, &ref[1]) < 0) TEST_ERROR + if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[1]) < 0) TEST_ERROR /* create reg_ref attribute */ if((aid = H5Acreate2(loc_id, "reg_ref_attr", H5T_STD_REF, spacer_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -402,10 +402,10 @@ create_reg_ref_dataset(hid_t file_id, hid_t loc_id) count[0] = 2; count[1] = 3; if(H5Sselect_hyperslab(space_id,H5S_SELECT_SET,start,NULL,count,NULL) < 0) TEST_ERROR - if(H5Rcreate_region(file_id, dsetnamev, space_id, &ref[0]) < 0) TEST_ERROR + if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[0]) < 0) TEST_ERROR if(H5Sselect_none(space_id) < 0) TEST_ERROR if(H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0) TEST_ERROR - if(H5Rcreate_region(file_id, dsetnamev, space_id, &ref[1]) < 0) TEST_ERROR + if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[1]) < 0) TEST_ERROR if(H5Dwrite(dsetr_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT,ref) < 0) TEST_ERROR if(H5Dclose(dsetr_id) < 0) TEST_ERROR diff --git a/test/trefer.c b/test/trefer.c index 91443f1..b722b2b 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -195,33 +195,33 @@ test_reference_params(void) CHECK(ret, H5I_INVALID_HID, "H5Dcreate2"); /* Test parameters to H5Rcreate_object */ - ret = H5Rcreate_object(fid1, "/Group1/Dataset1", NULL); + ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, NULL); VERIFY(ret, FAIL, "H5Rcreate_object ref"); - ret = H5Rcreate_object(H5I_INVALID_HID, "/Group1/Dataset1", &wbuf[0]); + ret = H5Rcreate_object(H5I_INVALID_HID, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_object loc_id"); - ret = H5Rcreate_object(fid1, NULL, &wbuf[0]); + ret = H5Rcreate_object(fid1, NULL, H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_object name"); - ret = H5Rcreate_object(fid1, "", &wbuf[0]); + ret = H5Rcreate_object(fid1, "", H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_object null name"); /* Test parameters to H5Rcreate_region */ - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, NULL); + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, NULL); VERIFY(ret, FAIL, "H5Rcreate_region ref"); - ret = H5Rcreate_region(H5I_INVALID_HID, "/Group1/Dataset1", sid1, &wbuf[0]); + ret = H5Rcreate_region(H5I_INVALID_HID, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_region loc_id"); - ret = H5Rcreate_region(fid1, NULL, sid1, &wbuf[0]); + ret = H5Rcreate_region(fid1, NULL, sid1, H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_region name"); - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", H5I_INVALID_HID, &wbuf[0]); + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", H5I_INVALID_HID, H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_region dataspace"); /* Test parameters to H5Rcreate_attr */ - ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr", NULL); + ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr", H5P_DEFAULT, NULL); VERIFY(ret, FAIL, "H5Rcreate_attr ref"); - ret = H5Rcreate_attr(H5I_INVALID_HID, "/Group1/Dataset2", "Attr", &wbuf[0]); + ret = H5Rcreate_attr(H5I_INVALID_HID, "/Group1/Dataset2", "Attr", H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_attr loc_id"); - ret = H5Rcreate_attr(fid1, NULL, "Attr", &wbuf[0]); + ret = H5Rcreate_attr(fid1, NULL, "Attr", H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_attr name"); - ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", NULL, &wbuf[0]); + ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", NULL, H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_attr attr_name"); /* Test parameters to H5Rdestroy */ @@ -403,28 +403,28 @@ test_reference_obj(void) CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* Create reference to dataset */ - ret = H5Rcreate_object(fid1, "/Group1/Dataset1", &wbuf[0]); + ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_object"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to dataset */ - ret = H5Rcreate_object(fid1, "/Group1/Dataset2", &wbuf[1]); + ret = H5Rcreate_object(fid1, "/Group1/Dataset2", H5P_DEFAULT, &wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_object"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[1], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to group */ - ret = H5Rcreate_object(fid1, "/Group1", &wbuf[2]); + ret = H5Rcreate_object(fid1, "/Group1", H5P_DEFAULT, &wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_object"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[2], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3"); /* Create reference to named datatype */ - ret = H5Rcreate_object(fid1, "/Group1/Datatype1", &wbuf[3]); + ret = H5Rcreate_object(fid1, "/Group1/Datatype1", H5P_DEFAULT, &wbuf[3]); CHECK(ret, FAIL, "H5Rcreate_object"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[3], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -646,7 +646,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(ret, 36, "H5Sget_select_npoints"); /* Store first dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[0]); + ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_region"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -670,7 +670,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(ret, SPACE2_DIM2, "H5Sget_select_npoints"); /* Store second dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[1]); + ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_region"); /* Select unlimited hyperslab for third reference */ @@ -689,7 +689,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints"); /* Store third dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[2]); + ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_region"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[2], H5P_DEFAULT, &obj_type); @@ -697,7 +697,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Store fourth dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[3]); + ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[3]); CHECK(ret, FAIL, "H5Rcreate_region"); /* Write selection to disk */ @@ -1069,7 +1069,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(ret, (block[0] * count[0]), "H5Sget_select_npoints"); /* Store first dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid3, &wbuf[0]); + ret = H5Rcreate_region(fid1, "/Dataset2", sid3, H5P_DEFAULT, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_region"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -1093,7 +1093,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(ret, POINT1_NPOINTS, "H5Sget_select_npoints"); /* Store second dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid3, &wbuf[1]); + ret = H5Rcreate_region(fid1, "/Dataset2", sid3, H5P_DEFAULT, &wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_region"); /* Write selection to disk */ @@ -1312,7 +1312,7 @@ test_reference_obj_deleted(void) CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* Create reference to dataset */ - ret = H5Rcreate_object(fid1, "/Dataset1", &oref); + ret = H5Rcreate_object(fid1, "/Dataset1", H5P_DEFAULT, &oref); CHECK(ret, FAIL, "H5Rcreate_object"); ret = H5Rget_obj_type3((const H5R_ref_t *)&oref, H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -1470,7 +1470,7 @@ test_reference_group(void) CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Create reference to group */ - ret = H5Rcreate_object(fid, GROUPNAME, &wref); + ret = H5Rcreate_object(fid, GROUPNAME, H5P_DEFAULT, &wref); CHECK(ret, FAIL, "H5Rcreate_object"); /* Write reference to disk */ @@ -1679,28 +1679,28 @@ test_reference_attr(void) CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* Create reference to dataset1 attribute */ - ret = H5Rcreate_attr(fid, "/Group1/Dataset1", "Attr1", &ref_wbuf[0]); + ret = H5Rcreate_attr(fid, "/Group1/Dataset1", "Attr1", H5P_DEFAULT, &ref_wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to dataset2 attribute */ - ret = H5Rcreate_attr(fid, "/Group1/Dataset2", "Attr1", &ref_wbuf[1]); + ret = H5Rcreate_attr(fid, "/Group1/Dataset2", "Attr1", H5P_DEFAULT, &ref_wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[1], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to group attribute */ - ret = H5Rcreate_attr(fid, "/Group1", "Attr2", &ref_wbuf[2]); + ret = H5Rcreate_attr(fid, "/Group1", "Attr2", H5P_DEFAULT, &ref_wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[2], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3"); /* Create reference to named datatype attribute */ - ret = H5Rcreate_attr(fid, "/Group1/Datatype1", "Attr3", &ref_wbuf[3]); + ret = H5Rcreate_attr(fid, "/Group1/Datatype1", "Attr3", H5P_DEFAULT, &ref_wbuf[3]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[3], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -1940,28 +1940,28 @@ test_reference_external(void) CHECK(ret, FAIL, "H5Gclose"); /* Create reference to dataset1 attribute */ - ret = H5Rcreate_attr(fid1, "/Group1/Dataset1", "Attr1", &ref_wbuf[0]); + ret = H5Rcreate_attr(fid1, "/Group1/Dataset1", "Attr1", H5P_DEFAULT, &ref_wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to dataset2 attribute */ - ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr1", &ref_wbuf[1]); + ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr1", H5P_DEFAULT, &ref_wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[1], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to group attribute */ - ret = H5Rcreate_attr(fid1, "/Group1", "Attr2", &ref_wbuf[2]); + ret = H5Rcreate_attr(fid1, "/Group1", "Attr2", H5P_DEFAULT, &ref_wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[2], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3"); /* Create reference to named datatype attribute */ - ret = H5Rcreate_attr(fid1, "/Group1/Datatype1", "Attr3", &ref_wbuf[3]); + ret = H5Rcreate_attr(fid1, "/Group1/Datatype1", "Attr3", H5P_DEFAULT, &ref_wbuf[3]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[3], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -2508,7 +2508,7 @@ test_reference_perf(void) t = 0; for(i = 0; i < MAX_ITER_CREATE; i++) { t1 = H5_get_time(); - ret = H5Rcreate_object(fid1, "/Group1/Dataset1", &wbuf[0]); + ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_object"); t2 = H5_get_time(); t += t2 - t1; @@ -2518,7 +2518,7 @@ test_reference_perf(void) HDprintf("--- Object reference create time: %lfs\n", t / MAX_ITER_CREATE); /* Create reference to dataset */ - ret = H5Rcreate_object(fid1, "/Group1/Dataset1", &wbuf[0]); + ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_object"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -2580,7 +2580,7 @@ test_reference_perf(void) for(i = 0; i < MAX_ITER_CREATE; i++) { t1 = H5_get_time(); /* Store first dataset region */ - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, &wbuf_reg[0]); + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf_reg[0]); CHECK(ret, FAIL, "H5Rcreate_region"); t2 = H5_get_time(); t += t2 - t1; @@ -2590,7 +2590,7 @@ test_reference_perf(void) HDprintf("--- Region reference create time: %lfs\n", t / MAX_ITER_CREATE); /* Store first dataset region */ - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, &wbuf_reg[0]); + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf_reg[0]); CHECK(ret, FAIL, "H5Rcreate_region"); t = 0; @@ -2813,7 +2813,7 @@ test_reference(void) for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { /* Invalid combinations, just continue */ - if(high == H5F_LIBVER_EARLIEST || high < low) + if(high <= H5F_LIBVER_V110 || high < low) continue; test_reference_region(low, high); /* Test basic H5R dataset region reference code */ |