mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
VFD SWMR: Warning fixes and minor cleanup (#1847)
* Normalization with develop * Moves remaining datatype code changes over from develop * Cleanup in examples files * Warning cleanup in VFD SWMR code * Committing clang-format changes * Warning cleanup * Warning reduction * More warning fixes * Committing clang-format changes * Even more warning reduction in the VFD SWMR tests * More warning fixes in the VFD SWMR tests * Even more VFD SWMR test warning fixes * Last warning fixes in VFD SWMR * Committing clang-format changes * Minor things missed from develop * Warning fixes from GitHub build failures * Committing clang-format changes * Fix for warning due to weird bit shift type promotion * Yet another attempt at fixing the integral promotion warning Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
github-actions
parent
ac7bddf2af
commit
5ceaf920ec
+52
-15
@@ -6,7 +6,8 @@ on:
|
||||
push:
|
||||
branches: [ develop, hdf5_1_12, hdf5_1_10, hdf5_1_8, feature/vfd_swmr]
|
||||
paths-ignore:
|
||||
- '.github/**'
|
||||
- '.github/CODEOWNERS'
|
||||
- '.github/FUNDING.yml'
|
||||
- 'doc/**'
|
||||
- 'release_docs/**'
|
||||
- 'ACKNOWLEDGEMENTS'
|
||||
@@ -20,7 +21,7 @@ jobs:
|
||||
strategy:
|
||||
# fail-fast: false
|
||||
matrix:
|
||||
name: ["Windows Latest MSVC", "Ubuntu Latest GCC", "Ubuntu Debug GCC", "macOS Latest Clang", "Ubuntu Autotools GCC", "Windows TS MSVC", "Ubuntu TS GCC", "TS Debug GCC", "macOS TS Clang", "TS Autotools GCC"]
|
||||
name: ["Windows Latest MSVC", "Ubuntu Latest GCC", "Ubuntu Debug GCC", "macOS Latest Clang", "Ubuntu Autotools GCC", "Ubuntu Debug Autotools GCC", "-Werror Ubuntu Debug Autotools GCC", "Windows TS MSVC", "Ubuntu TS GCC", "TS Debug GCC", "macOS TS Clang", "TS Autotools GCC"]
|
||||
include:
|
||||
- name: "Windows Latest MSVC"
|
||||
artifact: "Windows-MSVC.tar.xz"
|
||||
@@ -34,6 +35,7 @@ jobs:
|
||||
hl: ON
|
||||
parallel: OFF
|
||||
generator: "-G \"Visual Studio 17 2022\" -A x64"
|
||||
flags: ""
|
||||
- name: "Ubuntu Latest GCC"
|
||||
artifact: "Linux.tar.xz"
|
||||
os: ubuntu-latest
|
||||
@@ -46,6 +48,7 @@ jobs:
|
||||
parallel: OFF
|
||||
toolchain: "config/toolchain/GCC.cmake"
|
||||
generator: "-G Ninja"
|
||||
flags: ""
|
||||
- name: "macOS Latest Clang"
|
||||
artifact: "macOS.tar.xz"
|
||||
os: macos-latest
|
||||
@@ -58,6 +61,7 @@ jobs:
|
||||
parallel: OFF
|
||||
toolchain: "config/toolchain/clang.cmake"
|
||||
generator: "-G Ninja"
|
||||
flags: ""
|
||||
- name: "Ubuntu Debug GCC"
|
||||
artifact: "LinuxDBG.tar.xz"
|
||||
os: ubuntu-latest
|
||||
@@ -70,10 +74,11 @@ jobs:
|
||||
parallel: OFF
|
||||
toolchain: "config/toolchain/GCC.cmake"
|
||||
generator: "-G Ninja"
|
||||
flags: ""
|
||||
- name: "Ubuntu Autotools GCC"
|
||||
artifact: "LinuxA.tar.xz"
|
||||
os: ubuntu-latest
|
||||
build_type: "Release"
|
||||
build_type: "production"
|
||||
cpp: enable
|
||||
fortran: enable
|
||||
java: enable
|
||||
@@ -82,6 +87,34 @@ jobs:
|
||||
parallel: disable
|
||||
toolchain: ""
|
||||
generator: "autogen"
|
||||
flags: ""
|
||||
- name: "Ubuntu Debug Autotools GCC"
|
||||
artifact: "LinuxA.tar.xz"
|
||||
os: ubuntu-latest
|
||||
build_type: "debug"
|
||||
cpp: enable
|
||||
fortran: enable
|
||||
java: enable
|
||||
ts: disable
|
||||
hl: enable
|
||||
parallel: disable
|
||||
toolchain: ""
|
||||
generator: "autogen"
|
||||
flags: ""
|
||||
# Build that ensures no new warnings sneak into the library.
|
||||
- name: "-Werror Ubuntu Debug Autotools GCC"
|
||||
artifact: "LinuxA.tar.xz"
|
||||
os: ubuntu-latest
|
||||
build_type: "debug"
|
||||
cpp: disable
|
||||
fortran: disable
|
||||
java: disable
|
||||
ts: disable
|
||||
hl: enable
|
||||
parallel: disable
|
||||
toolchain: ""
|
||||
generator: "autogen"
|
||||
flags: "CFLAGS=-Werror"
|
||||
# Threadsafe runs
|
||||
- name: "Windows TS MSVC"
|
||||
artifact: "Windows-MSVCTS.tar.xz"
|
||||
@@ -95,6 +128,7 @@ jobs:
|
||||
hl: OFF
|
||||
parallel: OFF
|
||||
generator: "-G \"Visual Studio 16 2019\" -A x64"
|
||||
flags: ""
|
||||
- name: "Ubuntu TS GCC"
|
||||
artifact: "LinuxTS.tar.xz"
|
||||
os: ubuntu-latest
|
||||
@@ -107,6 +141,7 @@ jobs:
|
||||
parallel: OFF
|
||||
toolchain: "config/toolchain/GCC.cmake"
|
||||
generator: "-G Ninja"
|
||||
flags: ""
|
||||
- name: "macOS TS Clang"
|
||||
artifact: "macOSTS.tar.xz"
|
||||
os: macos-latest
|
||||
@@ -119,6 +154,7 @@ jobs:
|
||||
parallel: OFF
|
||||
toolchain: "config/toolchain/clang.cmake"
|
||||
generator: "-G Ninja"
|
||||
flags: ""
|
||||
- name: "TS Debug GCC"
|
||||
artifact: "LinuxTSDBG.tar.xz"
|
||||
os: ubuntu-latest
|
||||
@@ -131,10 +167,11 @@ jobs:
|
||||
parallel: OFF
|
||||
toolchain: "config/toolchain/GCC.cmake"
|
||||
generator: "-G Ninja"
|
||||
flags: ""
|
||||
- name: "TS Autotools GCC"
|
||||
artifact: "LinuxATS.tar.xz"
|
||||
os: ubuntu-latest
|
||||
build_type: "Release"
|
||||
build_type: "production"
|
||||
cpp: disable
|
||||
fortran: disable
|
||||
java: disable
|
||||
@@ -143,15 +180,7 @@ jobs:
|
||||
parallel: disable
|
||||
toolchain: ""
|
||||
generator: "autogen"
|
||||
# - name: "Ubuntu Parallel GCC"
|
||||
# artifact: "LinuxPar.tar.xz"
|
||||
# os: ubuntu-latest
|
||||
# build_type: "Release"
|
||||
# cpp: OFF
|
||||
# fortran: OFF
|
||||
# parallel: ON
|
||||
# toolchain: "config/toolchain/GCC.cmake"
|
||||
# generator: "-G Ninja"
|
||||
flags: ""
|
||||
|
||||
name: ${{ matrix.name }}
|
||||
# The type of runner that the job will run on
|
||||
@@ -164,7 +193,11 @@ jobs:
|
||||
run: sudo apt-get install ninja-build
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
- name: Install Autotools Dependencies (Linux)
|
||||
run: sudo apt-get install automake autoconf libtool libtool-bin
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install automake autoconf libtool libtool-bin
|
||||
sudo apt install gcc-11 g++-11 gfortran-11
|
||||
sudo apt install openmpi-bin openmpi-common
|
||||
if: matrix.generator == 'autogen'
|
||||
- name: Install Dependencies (Windows)
|
||||
run: choco install ninja
|
||||
@@ -189,8 +222,12 @@ jobs:
|
||||
sh ./autogen.sh
|
||||
mkdir "${{ runner.workspace }}/build"
|
||||
cd "${{ runner.workspace }}/build"
|
||||
$GITHUB_WORKSPACE/configure --enable-shared --${{ matrix.ts }}-threadsafe --${{ matrix.hl }}-hl --${{ matrix.parallel }}-parallel --${{ matrix.cpp }}-cxx --${{ matrix.fortran }}-fortran --${{ matrix.java }}-java
|
||||
${{ matrix.flags }} $GITHUB_WORKSPACE/configure --enable-build-mode=${{ matrix.build_type }} --enable-shared --${{ matrix.ts }}-threadsafe --${{ matrix.hl }}-hl --${{ matrix.parallel }}-parallel --${{ matrix.cpp }}-cxx --${{ matrix.fortran }}-fortran --${{ matrix.java }}-java
|
||||
shell: bash
|
||||
env:
|
||||
CC: gcc-11
|
||||
CXX: g++-11
|
||||
FC: gfortran-11
|
||||
|
||||
- name: Configure
|
||||
if: matrix.generator != 'autogen'
|
||||
|
||||
@@ -5,7 +5,8 @@ on:
|
||||
pull_request:
|
||||
branches: [ develop, hdf5_1_12, hdf5_1_10, hdf5_1_8, feature/vfd_swmr ]
|
||||
paths-ignore:
|
||||
- '.github/**'
|
||||
- '.github/CODEOWNERS'
|
||||
- '.github/FUNDING.yml'
|
||||
- 'doc/**'
|
||||
- 'release_docs/**'
|
||||
- 'ACKNOWLEDGEMENTS'
|
||||
@@ -19,7 +20,7 @@ jobs:
|
||||
strategy:
|
||||
# fail-fast: false
|
||||
matrix:
|
||||
name: ["Windows Latest MSVC", "Ubuntu Latest GCC", "Ubuntu Debug GCC", "macOS Latest Clang", "Ubuntu Autotools GCC", "Windows TS MSVC", "Ubuntu TS GCC", "TS Debug GCC", "macOS TS Clang", "TS Autotools GCC"]
|
||||
name: ["Windows Latest MSVC", "Ubuntu Latest GCC", "Ubuntu Debug GCC", "macOS Latest Clang", "Ubuntu Autotools GCC", "Ubuntu Debug Autotools GCC", "-Werror Ubuntu Debug Autotools GCC", "Windows TS MSVC", "Ubuntu TS GCC", "TS Debug GCC", "macOS TS Clang", "TS Autotools GCC"]
|
||||
include:
|
||||
- name: "Windows Latest MSVC"
|
||||
artifact: "Windows-MSVC.tar.xz"
|
||||
@@ -33,6 +34,7 @@ jobs:
|
||||
hl: ON
|
||||
parallel: OFF
|
||||
generator: "-G \"Visual Studio 17 2022\" -A x64"
|
||||
flags: ""
|
||||
- name: "Ubuntu Latest GCC"
|
||||
artifact: "Linux.tar.xz"
|
||||
os: ubuntu-latest
|
||||
@@ -45,6 +47,7 @@ jobs:
|
||||
parallel: OFF
|
||||
toolchain: "config/toolchain/GCC.cmake"
|
||||
generator: "-G Ninja"
|
||||
flags: ""
|
||||
- name: "macOS Latest Clang"
|
||||
artifact: "macOS.tar.xz"
|
||||
os: macos-latest
|
||||
@@ -57,6 +60,7 @@ jobs:
|
||||
parallel: OFF
|
||||
toolchain: "config/toolchain/clang.cmake"
|
||||
generator: "-G Ninja"
|
||||
flags: ""
|
||||
- name: "Ubuntu Debug GCC"
|
||||
artifact: "LinuxDBG.tar.xz"
|
||||
os: ubuntu-latest
|
||||
@@ -69,10 +73,11 @@ jobs:
|
||||
parallel: OFF
|
||||
toolchain: "config/toolchain/GCC.cmake"
|
||||
generator: "-G Ninja"
|
||||
flags: ""
|
||||
- name: "Ubuntu Autotools GCC"
|
||||
artifact: "LinuxA.tar.xz"
|
||||
os: ubuntu-latest
|
||||
build_type: "Release"
|
||||
build_type: "production"
|
||||
cpp: enable
|
||||
fortran: enable
|
||||
java: enable
|
||||
@@ -81,6 +86,34 @@ jobs:
|
||||
parallel: disable
|
||||
toolchain: ""
|
||||
generator: "autogen"
|
||||
flags: ""
|
||||
- name: "Ubuntu Debug Autotools GCC"
|
||||
artifact: "LinuxA.tar.xz"
|
||||
os: ubuntu-latest
|
||||
build_type: "debug"
|
||||
cpp: enable
|
||||
fortran: enable
|
||||
java: enable
|
||||
ts: disable
|
||||
hl: enable
|
||||
parallel: disable
|
||||
toolchain: ""
|
||||
generator: "autogen"
|
||||
flags: ""
|
||||
# Build that ensures no new warnings sneak into the library.
|
||||
- name: "-Werror Ubuntu Debug Autotools GCC"
|
||||
artifact: "LinuxDBG.tar.xz"
|
||||
os: ubuntu-latest
|
||||
build_type: "debug"
|
||||
cpp: disable
|
||||
fortran: disable
|
||||
java: disable
|
||||
ts: disable
|
||||
hl: enable
|
||||
parallel: disable
|
||||
toolchain: ""
|
||||
generator: "autogen"
|
||||
flags: "CFLAGS=-Werror"
|
||||
# Threadsafe runs
|
||||
- name: "Windows TS MSVC"
|
||||
artifact: "Windows-MSVCTS.tar.xz"
|
||||
@@ -94,6 +127,7 @@ jobs:
|
||||
hl: OFF
|
||||
parallel: OFF
|
||||
generator: "-G \"Visual Studio 16 2019\" -A x64"
|
||||
flags: ""
|
||||
- name: "Ubuntu TS GCC"
|
||||
artifact: "LinuxTS.tar.xz"
|
||||
os: ubuntu-latest
|
||||
@@ -106,6 +140,7 @@ jobs:
|
||||
parallel: OFF
|
||||
toolchain: "config/toolchain/GCC.cmake"
|
||||
generator: "-G Ninja"
|
||||
flags: ""
|
||||
- name: "macOS TS Clang"
|
||||
artifact: "macOSTS.tar.xz"
|
||||
os: macos-latest
|
||||
@@ -118,6 +153,7 @@ jobs:
|
||||
parallel: OFF
|
||||
toolchain: "config/toolchain/clang.cmake"
|
||||
generator: "-G Ninja"
|
||||
flags: ""
|
||||
- name: "TS Debug GCC"
|
||||
artifact: "LinuxTSDBG.tar.xz"
|
||||
os: ubuntu-latest
|
||||
@@ -130,10 +166,11 @@ jobs:
|
||||
parallel: OFF
|
||||
toolchain: "config/toolchain/GCC.cmake"
|
||||
generator: "-G Ninja"
|
||||
flags: ""
|
||||
- name: "TS Autotools GCC"
|
||||
artifact: "LinuxATS.tar.xz"
|
||||
os: ubuntu-latest
|
||||
build_type: "Release"
|
||||
build_type: "production"
|
||||
cpp: disable
|
||||
fortran: disable
|
||||
java: disable
|
||||
@@ -142,15 +179,7 @@ jobs:
|
||||
parallel: disable
|
||||
toolchain: ""
|
||||
generator: "autogen"
|
||||
# - name: "Ubuntu Parallel GCC"
|
||||
# artifact: "LinuxPar.tar.xz"
|
||||
# os: ubuntu-latest
|
||||
# build_type: "Release"
|
||||
# cpp: OFF
|
||||
# fortran: OFF
|
||||
# parallel: ON
|
||||
# toolchain: "config/toolchain/GCC.cmake"
|
||||
# generator: "-G Ninja"
|
||||
flags: ""
|
||||
|
||||
name: ${{ matrix.name }}
|
||||
# The type of runner that the job will run on
|
||||
@@ -163,7 +192,11 @@ jobs:
|
||||
run: sudo apt-get install ninja-build
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
- name: Install Autotools Dependencies (Linux)
|
||||
run: sudo apt-get install automake autoconf libtool libtool-bin
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install automake autoconf libtool libtool-bin
|
||||
sudo apt install gcc-11 g++-11 gfortran-11
|
||||
sudo apt install openmpi-bin openmpi-common
|
||||
if: matrix.generator == 'autogen'
|
||||
- name: Install Dependencies (Windows)
|
||||
run: choco install ninja
|
||||
@@ -188,8 +221,12 @@ jobs:
|
||||
sh ./autogen.sh
|
||||
mkdir "${{ runner.workspace }}/build"
|
||||
cd "${{ runner.workspace }}/build"
|
||||
$GITHUB_WORKSPACE/configure --enable-shared --${{ matrix.ts }}-threadsafe --${{ matrix.hl }}-hl --${{ matrix.parallel }}-parallel --${{ matrix.cpp }}-cxx --${{ matrix.fortran }}-fortran --${{ matrix.java }}-java
|
||||
${{ matrix.flags }} $GITHUB_WORKSPACE/configure --enable-build-mode=${{ matrix.build_type }} --enable-shared --${{ matrix.ts }}-threadsafe --${{ matrix.hl }}-hl --${{ matrix.parallel }}-parallel --${{ matrix.cpp }}-cxx --${{ matrix.fortran }}-fortran --${{ matrix.java }}-java
|
||||
shell: bash
|
||||
env:
|
||||
CC: gcc-11
|
||||
CXX: g++-11
|
||||
FC: gfortran-11
|
||||
|
||||
- name: Configure
|
||||
if: matrix.generator != 'autogen'
|
||||
|
||||
@@ -98,10 +98,6 @@
|
||||
/* Define if the __attribute__(()) extension is present */
|
||||
#cmakedefine H5_HAVE_ATTRIBUTE @H5_HAVE_ATTRIBUTE@
|
||||
|
||||
/* Define if the compiler understands C99 designated initialization of structs
|
||||
and unions */
|
||||
#cmakedefine H5_HAVE_C99_DESIGNATED_INITIALIZER @H5_HAVE_C99_DESIGNATED_INITIALIZER@
|
||||
|
||||
/* Define to 1 if you have the `clock_gettime' function. */
|
||||
#cmakedefine H5_HAVE_CLOCK_GETTIME @H5_HAVE_CLOCK_GETTIME@
|
||||
|
||||
|
||||
@@ -495,7 +495,6 @@ endif ()
|
||||
if (MINGW OR NOT WINDOWS)
|
||||
foreach (other_test
|
||||
HAVE_ATTRIBUTE
|
||||
HAVE_C99_DESIGNATED_INITIALIZER
|
||||
SYSTEM_SCOPE_THREADS
|
||||
HAVE_SOCKLEN_T
|
||||
)
|
||||
@@ -565,54 +564,6 @@ if (WINDOWS)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Check how to print a Long Long integer
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES "unknown")
|
||||
set (PRINT_LL_FOUND 0)
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
|
||||
message (VERBOSE "Checking for appropriate format for 64 bit long:")
|
||||
endif ()
|
||||
set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH")
|
||||
if (${HDF_PREFIX}_SIZEOF_LONG_LONG)
|
||||
set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG")
|
||||
endif ()
|
||||
TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE
|
||||
${CMAKE_BINARY_DIR}
|
||||
${HDF_RESOURCES_EXT_DIR}/HDFTests.c
|
||||
COMPILE_DEFINITIONS "${CURRENT_TEST_DEFINITIONS}"
|
||||
RUN_OUTPUT_VARIABLE OUTPUT
|
||||
)
|
||||
if (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE)
|
||||
if (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0)
|
||||
string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}")
|
||||
set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll")
|
||||
set (PRINT_LL_FOUND 1)
|
||||
else ()
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
|
||||
message (VERBOSE "Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}")
|
||||
endif ()
|
||||
endif ()
|
||||
else ()
|
||||
file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
|
||||
"Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed\n"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (PRINT_LL_FOUND)
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
|
||||
message (VERBOSE "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}")
|
||||
endif ()
|
||||
else ()
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
|
||||
message (VERBOSE "Checking for appropriate format for 64 bit long: not found")
|
||||
endif ()
|
||||
set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL
|
||||
"Width for printf for type `long long' or `__int64', us. `ll"
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Set the flag to indicate that the machine can handle converting
|
||||
# denormalized floating-point values.
|
||||
|
||||
@@ -11,38 +11,6 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
#define SIMPLE_TEST(x) int main(){ x; return 0; }
|
||||
|
||||
#ifdef HAVE_C99_DESIGNATED_INITIALIZER
|
||||
|
||||
#ifdef FC_DUMMY_MAIN
|
||||
#ifndef FC_DUMMY_MAIN_EQ_F77
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int FC_DUMMY_MAIN()
|
||||
{ return 1;}
|
||||
#endif
|
||||
#endif
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x;
|
||||
union
|
||||
{
|
||||
int i;
|
||||
double d;
|
||||
}u;
|
||||
}di_struct_t;
|
||||
di_struct_t x =
|
||||
{ 0,
|
||||
{ .d = 0.0}};
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ATTRIBUTE
|
||||
|
||||
|
||||
+14
-18
@@ -160,6 +160,8 @@ AM_JNIFLAGS="${AM_JNIFLAGS}"
|
||||
AM_JAVACFLAGS="${AM_JAVACFLAGS}"
|
||||
AM_JAVAFLAGS="${AM_JAVAFLAGS}"
|
||||
AM_LDFLAGS="${AM_LDFLAGS}"
|
||||
|
||||
## Flags passed in by the user
|
||||
CFLAGS="${CFLAGS}"
|
||||
CXXFLAGS="${CXXFLAGS}"
|
||||
FCFLAGS="${FCFLAGS}"
|
||||
@@ -181,6 +183,14 @@ saved_user_JAVAFLAGS="$JAVAFLAGS"
|
||||
saved_user_LDFLAGS="$LDFLAGS"
|
||||
saved_user_CPPFLAGS="$CPPFLAGS"
|
||||
|
||||
## Strip out -Werror from CFLAGS since that can cause checks to fail when
|
||||
## compiling the test program fails due to warnings
|
||||
CFLAGS="`echo $CFLAGS | sed -e 's/-Werror//g'`"
|
||||
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Werror//g'`"
|
||||
FCFLAGS="`echo $FCFLAGS | sed -e 's/-Werror//g'`"
|
||||
JAVACFLAGS="`echo $JAVACFLAGS | sed -e 's/-Werror//g'`"
|
||||
CPPFLAGS="`echo $CPPFLAGS | sed -e 's/-Werror//g'`"
|
||||
|
||||
## Support F9X variable to define Fortran compiler if FC variable is
|
||||
## not used. This should be deprecated in the future.
|
||||
if test "x" = "x$FC"; then
|
||||
@@ -782,7 +792,7 @@ HDF_CXX=no
|
||||
## AC_PROG_CXX defines some macros that Automake 1.9.x uses and will
|
||||
## miss even if c++ is not enabled.
|
||||
AC_PROG_CXX
|
||||
AC_PROG_CXXCPP ## this is checked for when AC_HEADER_STDC is done
|
||||
AC_PROG_CXXCPP
|
||||
|
||||
AC_MSG_CHECKING([if c++ interface enabled])
|
||||
|
||||
@@ -907,7 +917,7 @@ esac
|
||||
|
||||
## ----------------------------------------------------------------------
|
||||
## Check which archiving tool to use. This needs to be done before
|
||||
## the AM_PROG_LIBTOOL macro.
|
||||
## the LT_INIT macro.
|
||||
##
|
||||
if test -z "$AR"; then
|
||||
AC_CHECK_PROGS([AR], [ar xar], [:], [$PATH])
|
||||
@@ -1326,7 +1336,8 @@ esac
|
||||
## Windows
|
||||
case "`uname`" in
|
||||
MINGW*)
|
||||
AC_HAVE_LIBRARY([ws2_32])
|
||||
# The Winsock library
|
||||
AC_CHECK_LIB([ws2_32], [GetUserName])
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -2100,21 +2111,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[int __attribute__((unused)) x]])],
|
||||
AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([no])])
|
||||
|
||||
AC_MSG_CHECKING([for C99 designated initialization support])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||
typedef struct {
|
||||
int x;
|
||||
union {
|
||||
int i;
|
||||
double d;
|
||||
} u;
|
||||
} di_struct_t;
|
||||
di_struct_t x = {0, { .d = 0.0}}; ]])],
|
||||
[AC_DEFINE([HAVE_C99_DESIGNATED_INITIALIZER], [1],
|
||||
[Define if the compiler understands C99 designated initialization of structs and unions])
|
||||
AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([no])])
|
||||
|
||||
## ----------------------------------------------------------------------
|
||||
## Remove old ways of determining debug/production build.
|
||||
## These were used in 1.8.x and earlier. We should probably keep these checks
|
||||
|
||||
@@ -33,19 +33,26 @@ The functions provided by the HDF5 C-API are grouped into the following
|
||||
\li Functions with \ref ASYNC "asynchronous variants"
|
||||
\li \ref api-compat-macros
|
||||
\li <a href="./deprecated.html">Deprecated functions</a>
|
||||
\li High-level Extensions
|
||||
\li \ref high_level
|
||||
<ul>
|
||||
<li><a href="https://portal.hdfgroup.org/display/HDF5/Lite">\Bold{HDF5 Lite} (H5LT)</a></li>
|
||||
<li><a href="https://portal.hdfgroup.org/display/HDF5/Images">\Bold{HDF5 Image} (H5IM)</a></li>
|
||||
<li><a href="https://portal.hdfgroup.org/display/HDF5/Tables">\Bold{HDF5 Table} (H5TB)</a></li>
|
||||
<li><a href="https://portal.hdfgroup.org/display/HDF5/Packet+Tables">\Bold{HDF5 Packet Table} (H5TB)</a></li>
|
||||
<li><a href="https://portal.hdfgroup.org/display/HDF5/Dimension+Scales">\Bold{HDF5 Dimension Scale} (H5DS)</a></li>
|
||||
<li>\ref H5LT "Lite (H5LT, H5LD)"
|
||||
<li>\ref H5IM "Images (H5IM)"
|
||||
<li>\ref H5TB "Table (H5TB)"
|
||||
<li>\ref H5PT "Packet Table (H5PT)"
|
||||
<li>\ref H5DS "Dimension Scale (H5DS)"
|
||||
<li>\ref H5DO "Optimizations (H5DO)"
|
||||
<li>\ref H5LR "Extensions (H5LR, H5LT)"
|
||||
</ul>
|
||||
</td></tr>
|
||||
<tr><td colspan="3" style="border: none;">
|
||||
\ref H5 \ref H5A \ref H5D \ref H5E \ref H5ES \ref H5F \ref H5G \ref H5I \ref H5L
|
||||
\a Core \a library: \ref H5 \ref H5A \ref H5D \ref H5E \ref H5ES \ref H5F \ref H5G \ref H5I \ref H5L
|
||||
\ref H5M \ref H5O \ref H5P \ref H5PL \ref H5R \ref H5S \ref H5T \ref H5VL \ref H5Z
|
||||
</td></tr>
|
||||
|
||||
<tr><td colspan="3" style="border: none;">
|
||||
\a High-level \a library: \ref H5LT \ref H5IM \ref H5TB \ref H5PT \ref H5DS \ref H5DO \ref H5LR
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td></tr>
|
||||
|
||||
@@ -0,0 +1,657 @@
|
||||
/** \defgroup H5LR Extensions
|
||||
*
|
||||
* <em>Working with region references, hyperslab selections,
|
||||
* and bit-fields (H5LR, H5LT)</em>
|
||||
*
|
||||
* The following reference manual entries describe high-level HDF5 C and Fortran APIs
|
||||
* for working with region references, hyperslab selections, and bit-fields.
|
||||
* These functions were created as part of a project supporting
|
||||
* NPP/NPOESS Data Production and Exploitation (
|
||||
* <a href="https://support.hdfgroup.org/projects/jpss/documentation">
|
||||
* project </a>,
|
||||
* <a href="https://gamma.hdfgroup.org/ftp/pub/outgoing/NPOESS/source">
|
||||
* software </a>).
|
||||
* While they were written to facilitate access to NPP, NPOESS, and JPSS
|
||||
* data in the HDF5 format, these functions may be useful to anyone working
|
||||
* with region references, hyperslab selections, or bit-fields.
|
||||
*
|
||||
* Note that these functions are not part of the standard HDF5 distribution;
|
||||
* the
|
||||
* <a href="https://gamma.hdfgroup.org/ftp/pub/outgoing/NPOESS/source">
|
||||
* software </a>
|
||||
* must be separately downloaded and installed.
|
||||
*
|
||||
* A comprehensive guide to this library,
|
||||
* <a href="https://support.hdfgroup.org/projects/jpss/documentation/HL/UG/NPOESS_HL-UG.pdf">
|
||||
* <em>User Guide to the HDF5 High-level Library for Handling Region References and Hyperslab Selections</em></a>
|
||||
* is available at
|
||||
* https://support.hdfgroup.org/projects/jpss/documentation/HL/UG/NPOESS_HL-UG.pdf.
|
||||
*
|
||||
* - \ref H5LRcopy_reference
|
||||
* \n Copies data from the specified dataset to a new location and
|
||||
* creates a reference to it.
|
||||
* - \ref H5LRcopy_region
|
||||
* \n Copies data from a referenced region to a region in a
|
||||
* destination dataset.
|
||||
* - \ref H5LRcreate_ref_to_all
|
||||
* \n Creates a dataset with the region references to the data in all
|
||||
* datasets located under a specified group in a file or creates a
|
||||
* dataset with object references to all objects (groups or datasets)
|
||||
* located under a specified group in a file.
|
||||
* - \ref H5LRcreate_region_references
|
||||
* \n Creates an array of region references using an array of paths to
|
||||
* datasets and an array of corresponding hyperslab descriptions.
|
||||
* - \ref H5LRget_region_info
|
||||
* \n Retrieves information about the data a region reference points to.
|
||||
* - \ref H5LRmake_dataset
|
||||
* \n Creates and writes a dataset containing a list of
|
||||
* region references.
|
||||
* - \ref H5LRread_region
|
||||
* \n Retrieves raw data pointed to by a region reference to
|
||||
* an application buffer.
|
||||
* - \ref H5LTcopy_region
|
||||
* \n Copies data from a specified region in a source dataset
|
||||
* to a specified region in a destination dataset.
|
||||
* - \ref H5LTread_bitfield_value
|
||||
* \n Retrieves the values of quality flags for each element
|
||||
* to the application provided buffer.
|
||||
* - \ref H5LTread_region
|
||||
* \n Reads selected data to an application buffer.
|
||||
* .
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* Make dataset functions
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5LR
|
||||
*
|
||||
* \brief Creates and writes a dataset containing a list of region references.
|
||||
*
|
||||
* \fgdta_loc_id
|
||||
* \param[in] path Path to the dataset being created
|
||||
* \param[in] type_id Datatype of the dataset
|
||||
* \param[in] buf_size Size of the \p loc_id_ref and \p buf arrays
|
||||
* \param[in] loc_id_ref Array of object identifiers; each identifier
|
||||
* describes to which HDF5 file the corresponding
|
||||
* region reference belongs to
|
||||
* \param[in] buf Array of region references
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details Given an array of size \p buf_size of region references \p buf,
|
||||
* the function will create a dataset with path \p path, at location
|
||||
* specified by \p loc_id and of a datatype specified by \p type_id,
|
||||
* and will write data associated with each region reference in the order
|
||||
* corresponding to the order of the region references in the buffer.
|
||||
* It is assumed that all referenced hyperslabs have the same dimensionality,
|
||||
* and only the size of the slowest changing dimension may differ.
|
||||
* Each reference in the \p buf array belongs to the file identified
|
||||
* by the corresponding object identifiers in the array \p loc_id_ref.
|
||||
*
|
||||
* If \p path does not exist in \p loc_id then the function will
|
||||
* create the path specified by \p path automatically.
|
||||
*
|
||||
* \version 1.1 Fortran wrapper introduced in this release.
|
||||
*
|
||||
* \since 1.0
|
||||
*
|
||||
*/
|
||||
H5_HLRDLL herr_t H5LRmake_dataset(hid_t loc_id,
|
||||
const char *path,
|
||||
hid_t type_id, const size_t buf_size,
|
||||
const hid_t *loc_id_ref,
|
||||
const hdset_reg_ref_t *buf);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* Make and manipulate dataset region references functions
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5LR
|
||||
*
|
||||
* \brief Creates an array of region references using an array of paths to
|
||||
* datasets and an array of corresponding hyperslab descriptions.
|
||||
*
|
||||
* \param[in] obj_id File identifier for the HDF5 file containing
|
||||
* the referenced regions or an object identifier
|
||||
* for any object in that file
|
||||
* \param[in] num_elem Number of elements in the \p path and
|
||||
* \p buf arrays
|
||||
* \param[in] path Array of pointers to strings, which contain
|
||||
* the paths to the target datasets for the
|
||||
* region references
|
||||
* \param[in] block_coord Array of hyperslab coordinate
|
||||
* \param[out] buf Buffer for returning an array of region
|
||||
* references
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \note **Motivation:**
|
||||
* \note H5LRcreate_region_references() is useful when creating
|
||||
* large numbers of similar region references.
|
||||
*
|
||||
* \details H5LRcreate_region_references() creates a list of region references
|
||||
* given an array of paths to datasets and another array listing the
|
||||
* corner coordinates of the corresponding hyperslabs.
|
||||
*
|
||||
* \p path parameter is an array of pointers to strings.
|
||||
*
|
||||
* \p num_elem specifies the number of region references to be created,
|
||||
* thus specifying the size of the \p path and \p _buf arrays.
|
||||
*
|
||||
* Buffer \p block_coord has size 2*rank and is the coordinates of the
|
||||
* starting point following by the coordinates of the ending point of
|
||||
* the hyperslab, repeated \p num_elem times for each hyperslab.
|
||||
* For example, creating two region references to two hyperslabs,
|
||||
* one with a rectangular hyperslab region starting at element (2,2)
|
||||
* to element (5,4) and the second rectangular region starting at
|
||||
* element (7,7) to element (9,10), results in \p block_coord
|
||||
* being {2,2,5,4, 7,7,9,10}.
|
||||
*
|
||||
* The rank of the hyperslab will be the same as the rank of the
|
||||
* target dataset. H5LRcreate_region_references() will retrieve
|
||||
* the rank for each dataset and will use those values to interpret
|
||||
* the values in the buffer. Please note that rank may vary from one
|
||||
* dataset to another.
|
||||
*
|
||||
* \version 1.1 Fortran wrapper introduced in this release.
|
||||
*
|
||||
* \since 1.0
|
||||
*
|
||||
*/
|
||||
H5_HLRDLL herr_t H5LRcreate_region_references(hid_t obj_id,
|
||||
size_t num_elem,
|
||||
const char **path,
|
||||
const hsize_t *block_coord,
|
||||
hdset_reg_ref_t *buf);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5LR
|
||||
*
|
||||
* \brief Copies data from the specified dataset to a new location and
|
||||
* creates a reference to it.
|
||||
*
|
||||
* \param[in] obj_id Identifier of any object in a file an
|
||||
* HDF5 reference belongs to
|
||||
* \param[in] ref Reference to the datasets region
|
||||
* \param[in] file Name of the destination file
|
||||
* \param[in] path Full path to the destination dataset
|
||||
* \param[in] block_coord Hyperslab coordinates in the destination
|
||||
* dataset
|
||||
* \param[out] ref_new Region reference to the new location of
|
||||
* data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details Given a data set pointed to by a region reference, the function
|
||||
* H5LRcopy_reference() will copy the hyperslab data referenced by
|
||||
* a datasets region reference into existing dataset specified by
|
||||
* its path \p path in the file with the name \p file, and to location
|
||||
* specified by the hyperslab coordinates \p block_coord. It will
|
||||
* create the region reference \p ref_new to point to the new location.
|
||||
* The number of elements in the old and newly specified regions has
|
||||
* to be the same.
|
||||
*
|
||||
* Buffer \p block_coord has size 2*rank and is the coordinates of
|
||||
* the starting point following by the coordinates of the ending
|
||||
* point of the hyperslab. For example, to extract a rectangular
|
||||
* hyperslab region starting at element (2,2) to element (5,4)
|
||||
* then \p block_coord would be {2, 2, 5, 4}.
|
||||
*
|
||||
* \version 1.1 Fortran wrapper introduced in this release.
|
||||
*
|
||||
* \since 1.0
|
||||
*
|
||||
*/
|
||||
H5_HLRDLL herr_t H5LRcopy_reference(hid_t obj_id, hdset_reg_ref_t *ref, const char *file,
|
||||
const char *path, const hsize_t *block_coord,
|
||||
hdset_reg_ref_t *ref_new);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5LR
|
||||
*
|
||||
* \brief Copies data from a referenced region to a region in a
|
||||
* destination dataset.
|
||||
*
|
||||
* \param[in] obj_id Identifier of any object in a file
|
||||
* dataset region reference belongs to
|
||||
* \param[in] ref Dataset region reference
|
||||
* \param[in] file Name of the destination file
|
||||
* \param[in] path Full path to the destination dataset
|
||||
* \param[in] block_coord Hyperslab coordinates in the destination
|
||||
* dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details Given a dataset region reference \p ref in a source file
|
||||
* specified by an identifier of any object in that file
|
||||
* \p obj_id, the function will write data to the existing
|
||||
* dataset \p path in file \p file to the simple hyperslab
|
||||
* specified by \p block_coord.
|
||||
*
|
||||
* Buffer \p block_coord has size 2*rank and is the coordinates
|
||||
* of the starting point following by the coordinates of the
|
||||
* ending point of the hyperslab. For example, to specify a
|
||||
* rectangular hyperslab destination region starting at element
|
||||
* (2,2) to element (5,4) then \p block_coord would be {2, 2, 5, 4}.
|
||||
*
|
||||
* If \p path does not exist in the destination file (as may be
|
||||
* the case when writing to a new file) then the dataset will be
|
||||
* copied directly to the \p path and \p block_coord will be
|
||||
* disregarded.
|
||||
*
|
||||
* \version 1.1 Fortran wrapper introduced in this release.
|
||||
*
|
||||
* \since 1.0
|
||||
*
|
||||
*/
|
||||
H5_HLRDLL herr_t H5LRcopy_region(hid_t obj_id,
|
||||
hdset_reg_ref_t *ref,
|
||||
const char *file,
|
||||
const char *path,
|
||||
const hsize_t *block_coord);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5LR
|
||||
*
|
||||
* \brief Creates a dataset with the region references to the data
|
||||
* in all datasets located under a specified group in a file
|
||||
* or creates a dataset with object references to all objects
|
||||
* (groups or datasets) located under a specified group in a file.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] group_path Absolute or relative path to the group
|
||||
* at which traversal starts
|
||||
* \param[in] ds_path Absolute or relative path to the dataset
|
||||
* with region references to be created
|
||||
* \param[in] index_type Index_type;
|
||||
* see valid values below in description
|
||||
* \param[in] order Order in which index is traversed;
|
||||
* see valid values below in description
|
||||
* \param[in] ref_type Reference type;
|
||||
* see valid values below in description
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LRcreate_ref_to_all() creates a dataset with the
|
||||
* region references to the data in all datasets located
|
||||
* under a specified group in a file or creates a dataset with
|
||||
* object references to all objects (groups or datasets) located
|
||||
* under a specified group in a file.
|
||||
*
|
||||
* Given a dataset path \p ds_path in a file specified by the
|
||||
* \p loc_id identifier, the function H5LRcreate_ref_to_all()
|
||||
* will create a contiguous one-dimensional dataset with the
|
||||
* region references or object references depending on the value
|
||||
* of the \p ref_type parameter. When \p ref_type is
|
||||
* #H5R_DATASET_REGION, each region reference points to all data
|
||||
* in a dataset encountered by an internally called H5Lvisit()
|
||||
* routine, which starts at the group specified by the \p loc_id
|
||||
* and \p group_path parameters. In a like manner, when
|
||||
* \p ref_type is #H5R_OBJECT, each object reference points to
|
||||
* an object (a group or a dataset) encountered by H5Lvisit().
|
||||
*
|
||||
* If \p ds_path does not exist in \p loc_id then the function
|
||||
* will create the path specified by \p ds_path automatically.
|
||||
*
|
||||
* \p index_type specifies the index to be used.
|
||||
* Valid values include the following:
|
||||
* - #H5_INDEX_NAME Alphanumeric index on name
|
||||
* - #H5_INDEX_CRT_ORDER Index on creation order
|
||||
* .
|
||||
*
|
||||
* \p order specifies the order in which objects are to be
|
||||
* inspected along the index specified in \p index_type.
|
||||
* Valid values include the following:
|
||||
* - #H5_ITER_INC Increasing order
|
||||
* - #H5_ITER_DEC Decreasing order
|
||||
* - #H5_ITER_NATIVE Fastest available order
|
||||
* .
|
||||
*
|
||||
* For more detailed information on these two parameters,
|
||||
* see H5Lvisit().
|
||||
*
|
||||
* \p ref_type specifies the type of the reference to be used.
|
||||
* Valid values include the following:
|
||||
* - #H5R_DATASET_REGION Dataset region reference
|
||||
* - #H5R_OBJECT Object reference
|
||||
* .
|
||||
*
|
||||
* \version 1.1 Fortran wrapper introduced in this release.
|
||||
*
|
||||
* \since 1.0
|
||||
*
|
||||
*/
|
||||
H5_HLRDLL herr_t H5LRcreate_ref_to_all(hid_t loc_id, const char *group_path,
|
||||
const char *ds_path, H5_index_t index_type, H5_iter_order_t order, H5R_type_t ref_type);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* Read dataset functions
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5LR
|
||||
*
|
||||
* \brief Retrieves raw data pointed to by a region reference
|
||||
* to an application buffer.
|
||||
*
|
||||
* \param[in] obj_id File identifier for the HDF5 file containing
|
||||
* the dataset with the referenced region or an
|
||||
* object identifier for any object in that file
|
||||
* \param[in] ref Region reference specifying data to be read
|
||||
* in
|
||||
* \param[in] mem_type Memory datatype of data read from referenced
|
||||
* region into the application buffer
|
||||
* \param[in,out] numelem Number of elements to be read into buffer
|
||||
* \p buf
|
||||
* \param[out] buf Buffer in which data is returned to the
|
||||
* application
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LRread_region() reads data pointed to by the region
|
||||
* reference \p ref into the buffer \p buf.
|
||||
*
|
||||
* \p numelem specifies the number of elements to be read
|
||||
* into \p buf. When the size of the reference region is unknown,
|
||||
* H5LRread_region() can be called with \p buf set to NULL;
|
||||
* the number of elements in the referenced region will be returned
|
||||
* in \p numelem.
|
||||
*
|
||||
* The buffer buf must be big enough to hold \p numelem elements
|
||||
* of type \p mem_type. For example, if data is read from the referenced
|
||||
* region into an integer buffer, \p mem_type should be #H5T_NATIVE_INT
|
||||
* and the buffer must be at least \c sizeof(int) * \p numelem bytes
|
||||
* in size. This buffer must be allocated by the application.
|
||||
*
|
||||
* \version 1.1 Fortran wrapper introduced in this release.
|
||||
*
|
||||
* \since 1.0
|
||||
*
|
||||
*/
|
||||
H5_HLRDLL herr_t H5LRread_region(hid_t obj_id,
|
||||
const hdset_reg_ref_t *ref,
|
||||
hid_t mem_type,
|
||||
size_t *numelem,
|
||||
void *buf );
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* Query dataset functions
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5LR
|
||||
*
|
||||
* \brief Retrieves information about the data a region reference
|
||||
* points to.
|
||||
*
|
||||
* \param[in] obj_id Identifier of any object in an HDF5 file
|
||||
* the region reference belongs to.
|
||||
* \param[in] ref Region reference to query
|
||||
* \param[in,out] len Size of the buffer to store \p path in.
|
||||
* NOTE: if \p *path is not NULL then \p *len
|
||||
* must be the appropriate length
|
||||
* \param[out] path Full path that a region reference points to
|
||||
* \param[out] rank The number of dimensions of the dataset
|
||||
* dimensions of the dataset pointed by
|
||||
* region reference.
|
||||
* \param[out] dtype Datatype of the dataset pointed by the
|
||||
* region reference.
|
||||
* \param[out] sel_type Type of the selection (point or hyperslab)
|
||||
* \param[in,out] numelem Number of coordinate blocks or
|
||||
* selected elements.
|
||||
* \param[out] buf Buffer containing description of the region
|
||||
* pointed by region reference
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LRget_region_info() queries information about the data
|
||||
* pointed by a region reference \p ref. It returns one of the
|
||||
* absolute paths to a dataset, length of the path, dataset’s rank
|
||||
* and datatype, description of the referenced region and type of
|
||||
* the referenced region. Any output argument can be NULL if that
|
||||
* argument does not need to be returned.
|
||||
*
|
||||
* The parameter \p obj_id is an identifier for any object in the
|
||||
* HDF5 file containing the referenced object. For example, it can
|
||||
* be an identifier of a dataset the region reference belongs to
|
||||
* or an identifier of an HDF5 file the dataset with region references
|
||||
* is stored in.
|
||||
*
|
||||
* The parameter \p ref is a region reference to query.
|
||||
*
|
||||
* The parameter \p path is a pointer to application allocated
|
||||
* buffer of size \p len+1 to return an absolute path to a dataset
|
||||
* the region reference points to.
|
||||
*
|
||||
* The parameter \p len is a length of absolute path string plus
|
||||
* the \0 string terminator. If path parameter is NULL, actual
|
||||
* length of the path (+1 for \0 string terminator) is returned to
|
||||
* application and can be used to allocate buffer path of an
|
||||
* appropriate length \p len.
|
||||
*
|
||||
* The parameter \p sel_type describes the type of the selected
|
||||
* region. Possible values can be #H5S_SEL_POINTS for point
|
||||
* selection and #H5S_SEL_HYPERSLABS for hyperslab selection.
|
||||
*
|
||||
* The parameter \p numelem describes how many elements will be
|
||||
* placed in the buffer \p buf. The number should be interpreted
|
||||
* using the value of \p sel_type.
|
||||
*
|
||||
* If value of \p sel_type is #H5S_SEL_HYPERSLABS, the parameter
|
||||
* \p buf contains \p numelem blocks of the coordinates for each
|
||||
* simple hyperslab of the referenced region. Each block has
|
||||
* length \c 2*\p rank and is organized as follows: <"start" coordinate>,
|
||||
* immediately followed by <"opposite" corner coordinate>.
|
||||
* The total size of the buffer to hold the description of the
|
||||
* region will be \c 2*\p rank*\p numelem. If region reference
|
||||
* points to a contiguous sub-array, then the value of \p numelem
|
||||
* is 1 and the block contains coordinates of the upper left and
|
||||
* lower right corners of the sub-array (or simple hyperslab).
|
||||
*
|
||||
* If value of \p sel_type is #H5S_SEL_POINTS, the parameter \p buf
|
||||
* contains \p numelem blocks of the coordinates for each selected
|
||||
* point of the referenced region. Each block has length \p rank
|
||||
* and contains coordinates of the element. The total size of the
|
||||
* buffer to hold the description of the region will be
|
||||
* \p rank* \p numelem.
|
||||
*
|
||||
*
|
||||
* \version 1.1 Fortran wrapper introduced in this release.
|
||||
*
|
||||
* \since 1.0
|
||||
*
|
||||
*/
|
||||
H5_HLRDLL herr_t H5LRget_region_info(hid_t obj_id,
|
||||
const hdset_reg_ref_t *ref,
|
||||
size_t *len,
|
||||
char *path,
|
||||
int *rank,
|
||||
hid_t *dtype,
|
||||
H5S_sel_type *sel_type,
|
||||
size_t *numelem,
|
||||
hsize_t *buf );
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* Make dataset functions
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5LR
|
||||
*
|
||||
* \brief Copies data from a specified region in a source dataset
|
||||
* to a specified region in a destination dataset
|
||||
*
|
||||
* \param[in] file_src Name of the source file
|
||||
* \param[in] path_src Full path to the source dataset
|
||||
* \param[in] block_coord_src Hyperslab coordinates in the
|
||||
* source dataset
|
||||
* \param[in] file_dest Name of the destination file
|
||||
* \param[in] path_dest Full path to the destination dataset
|
||||
* \param[in] block_coord_dset Hyperslab coordinates in the
|
||||
* destination dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details Given a path to a dataset \p path_src in a file with the
|
||||
* name \p file_src, and description of a simple hyperslab of
|
||||
* the source \p block_coord_src, the function will write data
|
||||
* to the dataset \p path_dest in file \p file_dest to the
|
||||
* simple hyperslab specified by \p block_coord_dset.
|
||||
* The arrays \p block_coord_src and \p block_coord_dset have
|
||||
* a length of 2*rank and are the coordinates of the starting
|
||||
* point following by the coordinates of the ending point of the
|
||||
* hyperslab. For example, to specify a rectangular hyperslab
|
||||
* destination region starting at element (2,2) to element (5,4)
|
||||
* then \p block_coord_dset would be {2, 2, 5, 4}.
|
||||
*
|
||||
* If \p path_dest does not exist in the destination file
|
||||
* (as may be the case when writing to a new file) then the
|
||||
* dataset will be copied directly to the \p path_dest and
|
||||
* \p block_coord_dset will be disregarded.
|
||||
*
|
||||
* \version 1.1 Fortran wrapper introduced in this release.
|
||||
*
|
||||
* \since 1.0
|
||||
*
|
||||
*/
|
||||
H5_HLRDLL herr_t H5LTcopy_region(const char *file_src,
|
||||
const char *path_src,
|
||||
const hsize_t *block_coord_src,
|
||||
const char *file_dest,
|
||||
const char *path_dest,
|
||||
const hsize_t *block_coord_dset);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* Read dataset functions
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5LR
|
||||
*
|
||||
* \brief Reads selected data to an application buffer.
|
||||
*
|
||||
* \param[in] file Name of file
|
||||
* \param[in] path Full path to a dataset
|
||||
* \param[in] block_coord Hyperslab coordinates
|
||||
* \param[in] mem_type Memory datatype, describing the buffer
|
||||
* the referenced data will be read into
|
||||
* \param[out] buf Buffer containing data from the
|
||||
* referenced region
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTread_region() reads data from a region described by
|
||||
* the hyperslab coordinates in \p block_coord, located in
|
||||
* the dataset specified by its absolute path \p path in a
|
||||
* file specified by its name \p file. Data is read into a
|
||||
* buffer \p buf of the datatype that corresponds to the
|
||||
* HDF5 datatype specified by \p mem_type.
|
||||
*
|
||||
* Buffer \p block_coord has size 2*rank and is the coordinates
|
||||
* of the starting point following by the coordinates of the
|
||||
* ending point of the hyperslab. For example, to extract a
|
||||
* rectangular hyperslab region starting at element (2,2) to
|
||||
* element (5,4) then \p block_coord would be {2, 2, 5, 4}.
|
||||
*
|
||||
* Buffer \p buf should be big enough to hold selected elements
|
||||
* of the type that corresponds to the \p mem_type
|
||||
*
|
||||
* \version 1.1 Fortran wrapper introduced in this release.
|
||||
*
|
||||
* \since 1.0
|
||||
*
|
||||
*/
|
||||
H5_HLRDLL herr_t H5LTread_region(const char *file,
|
||||
const char *path,
|
||||
const hsize_t *block_coord,
|
||||
hid_t mem_type,
|
||||
void *buf );
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5LR
|
||||
*
|
||||
* \brief Retrieves the values of quality flags for each element
|
||||
* to the application provided buffer.
|
||||
*
|
||||
* \param[in] dset_id Identifier of the dataset with bit-field values
|
||||
* \param[in] num_values Number of the values to be extracted
|
||||
* \param[in] offset Array of staring bits to be extracted from
|
||||
* the element; valid values: 0 (zero) through 7
|
||||
* \param[in] lengths Array of the number of bits to be extracted
|
||||
* for each value
|
||||
* \param[in] space Dataspace identifier, describing the elements
|
||||
* to be read from the dataset with bit-field
|
||||
* values
|
||||
* \param[out] buf Buffer to read the values in
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTread_bitfield_value() reads selected elements from a
|
||||
* dataset specified by its identifier \p dset_id, and unpacks
|
||||
* the bit-field values to a buffer \p buf.
|
||||
*
|
||||
* The parameter \p space is a space identifier that indicates
|
||||
* which elements of the dataset should be read.
|
||||
*
|
||||
* The parameter \p offset is an array of length \p num_values;
|
||||
* the i<sup>th</sup> element of the array holds the value of the
|
||||
* starting bit of the i<sup>th</sup> bit-field value.
|
||||
* Valid values are: 0 (zero) through 7.
|
||||
*
|
||||
* The parameter \p lengths is an array of length \p num_values;
|
||||
* the i<sup>th</sup> element of the array holds the number of
|
||||
* bits to be extracted for the i<sup>th</sup> bit-field value.
|
||||
* Extracted bits will be interpreted as a base-2 integer value.
|
||||
* Each value will be converted to the base-10 integer value and
|
||||
* stored in the application buffer.
|
||||
*
|
||||
* Buffer \p buf is allocated by the application and should be big
|
||||
* enough to hold \c num_sel_elem * \p num_values elements of the
|
||||
* specified type, where \c num_sel_elem is a number of the elements
|
||||
* to be read from the dataset. Data in the buffer is organized
|
||||
* as \p num_values values for the first element, followed by the
|
||||
* \p num_values values for the second element, ... , followed by
|
||||
* the \p num_values values for the
|
||||
* \c num_selected_elem<sup>th</sup> element.
|
||||
*
|
||||
* \version 1.1 Fortran wrapper introduced in this release.
|
||||
*
|
||||
* \since 1.0
|
||||
*
|
||||
*/
|
||||
H5_HLRDLL herr_t H5LTread_bitfield_value(hid_t dset_id, int num_values, const unsigned *offset,
|
||||
const unsigned *lengths, hid_t space, int *buf);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/** \page high_level High-level library
|
||||
* The high-level HDF5 library includes several sets of convenience and standard-use APIs to
|
||||
* facilitate common HDF5 operations.
|
||||
*
|
||||
* <ul>
|
||||
* <li>\ref H5LT "Lite (H5LT, H5LD)"
|
||||
* \n
|
||||
* Functions to simplify creating and manipulating datasets, attributes and other features
|
||||
* <li>\ref H5IM "Image (H5IM)"
|
||||
* \n
|
||||
* Creating and manipulating HDF5 datasets intended to be interpreted as images
|
||||
* <li>\ref H5TB "Table (H5TB)"
|
||||
* \n
|
||||
* Creating and manipulating HDF5 datasets intended to be interpreted as tables
|
||||
* <li>\ref H5PT "Packet Table (H5PT)"
|
||||
* \n
|
||||
* Creating and manipulating HDF5 datasets to support append- and read-only operations on table data
|
||||
* <li>\ref H5DS "Dimension Scale (H5DS)"
|
||||
* \n
|
||||
* Creating and manipulating HDF5 datasets that are associated with the dimension of another HDF5 dataset
|
||||
* <li>\ref H5DO "Optimizations (H5DO)"
|
||||
* \n
|
||||
* Bypassing default HDF5 behavior in order to optimize for specific use cases
|
||||
* <li>\ref H5LR "Extensions (H5LR, H5LT)"
|
||||
* \n
|
||||
* Working with region references, hyperslab selections, and bit-fields
|
||||
* </ul>
|
||||
*
|
||||
*/
|
||||
@@ -0,0 +1,220 @@
|
||||
/* -*- c-file-style: "stroustrup" -*- */
|
||||
|
||||
//! <!-- [H5DOwrite] -->
|
||||
|
||||
#include <zlib.h>
|
||||
#include <math.h>
|
||||
#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s)) * 1.001) + 12)
|
||||
:
|
||||
:
|
||||
size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
|
||||
const Bytef *z_src = (const Bytef *)(direct_buf);
|
||||
Bytef * z_dst; /* Destination buffer */
|
||||
uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
|
||||
uLong z_src_nbytes = (uLong)buf_size;
|
||||
int aggression = 9; /* Compression aggression setting */
|
||||
uint32_t filter_mask = 0;
|
||||
size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(int);
|
||||
|
||||
/* Create the data space */
|
||||
if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
|
||||
goto error;
|
||||
|
||||
/* Create a new file */
|
||||
if ((file = H5Fcreate(FILE_NAME5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
||||
goto error;
|
||||
|
||||
/* Modify dataset creation properties, i.e. enable chunking and compression */
|
||||
if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
|
||||
goto error;
|
||||
|
||||
if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0)
|
||||
goto error;
|
||||
|
||||
if ((status = H5Pset_deflate(cparms, aggression)) < 0)
|
||||
goto error;
|
||||
|
||||
/* Create a new dataset within the file using cparms creation properties */
|
||||
if ((dset_id = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms,
|
||||
H5P_DEFAULT)) < 0)
|
||||
goto error;
|
||||
|
||||
/* Initialize data for one chunk */
|
||||
for (i = n = 0; i < CHUNK_NX; i++)
|
||||
for (j = 0; j < CHUNK_NY; j++)
|
||||
direct_buf[i][j] = n++;
|
||||
|
||||
/* Allocate output (compressed) buffer */
|
||||
outbuf = malloc(z_dst_nbytes);
|
||||
z_dst = (Bytef *)outbuf;
|
||||
|
||||
/* Perform compression from the source to the destination buffer */
|
||||
ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
|
||||
|
||||
/* Check for various zlib errors */
|
||||
if (Z_BUF_ERROR == ret) {
|
||||
fprintf(stderr, "overflow");
|
||||
goto error;
|
||||
}
|
||||
else if (Z_MEM_ERROR == ret) {
|
||||
fprintf(stderr, "deflate memory error");
|
||||
goto error;
|
||||
}
|
||||
else if (Z_OK != ret) {
|
||||
fprintf(stderr, "other deflate error");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Write the compressed chunk data repeatedly to cover all the
|
||||
* * chunks in the dataset, using the direct write function. */
|
||||
for (i = 0; i < NX / CHUNK_NX; i++) {
|
||||
for (j = 0; j < NY / CHUNK_NY; j++) {
|
||||
status =
|
||||
H5DOwrite_chunk(dset_id, H5P_DEFAULT, filter_mask, offset, z_dst_nbytes, outbuf);
|
||||
offset[1] += CHUNK_NY;
|
||||
}
|
||||
offset[0] += CHUNK_NX;
|
||||
offset[1] = 0;
|
||||
}
|
||||
|
||||
/* Overwrite the first chunk with uncompressed data. Set the filter mask to
|
||||
* * indicate the compression filter is skipped */
|
||||
filter_mask = 0x00000001;
|
||||
offset[0] = offset[1] = 0;
|
||||
if (H5DOwrite_chunk(dset_id, H5P_DEFAULT, filter_mask, offset, buf_size, direct_buf) < 0)
|
||||
goto error;
|
||||
|
||||
/* Read the entire dataset back for data verification converting ints to longs */
|
||||
if (H5Dread(dataset, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, outbuf_long) < 0)
|
||||
goto error;
|
||||
|
||||
/* Data verification here */
|
||||
:
|
||||
:
|
||||
|
||||
//! <!-- [H5DOwrite] -->
|
||||
|
||||
//! <!-- [H5DOread] -->
|
||||
|
||||
#include <zlib.h>
|
||||
#include <math.h>
|
||||
#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s)) * 1.001) + 12)
|
||||
:
|
||||
:
|
||||
size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
|
||||
const Bytef *z_src = (const Bytef *)(direct_buf);
|
||||
Bytef * z_dst; /* Destination buffer */
|
||||
uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
|
||||
uLong z_src_nbytes = (uLong)buf_size;
|
||||
int aggression = 9; /* Compression aggression setting */
|
||||
uint32_t filter_mask = 0;
|
||||
size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(int);
|
||||
/* For H5DOread_chunk() */
|
||||
void * readbuf = NULL; /* Buffer for reading data */
|
||||
const Bytef *pt_readbuf; /* Point to the buffer for data read */
|
||||
hsize_t read_chunk_nbytes; /* Size of chunk on disk */
|
||||
int read_dst_buf[CHUNK_NX][CHUNK_NY]; /* Buffer to hold un-compressed data */
|
||||
|
||||
/* Create the data space */
|
||||
if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
|
||||
goto error;
|
||||
|
||||
/* Create a new file */
|
||||
if ((file = H5Fcreate(FILE_NAME5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
||||
goto error;
|
||||
|
||||
/* Modify dataset creation properties, i.e. enable chunking and compression */
|
||||
if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
|
||||
goto error;
|
||||
|
||||
if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0)
|
||||
goto error;
|
||||
|
||||
if ((status = H5Pset_deflate(cparms, aggression)) < 0)
|
||||
goto error;
|
||||
|
||||
/* Create a new dataset within the file using cparms creation properties */
|
||||
if ((dset_id = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms,
|
||||
H5P_DEFAULT)) < 0)
|
||||
goto error;
|
||||
|
||||
/* Initialize data for one chunk */
|
||||
for (i = n = 0; i < CHUNK_NX; i++)
|
||||
for (j = 0; j < CHUNK_NY; j++)
|
||||
direct_buf[i][j] = n++;
|
||||
|
||||
/* Allocate output (compressed) buffer */
|
||||
outbuf = malloc(z_dst_nbytes);
|
||||
z_dst = (Bytef *)outbuf;
|
||||
|
||||
/* Perform compression from the source to the destination buffer */
|
||||
ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
|
||||
|
||||
/* Check for various zlib errors */
|
||||
if (Z_BUF_ERROR == ret) {
|
||||
fprintf(stderr, "overflow");
|
||||
goto error;
|
||||
}
|
||||
else if (Z_MEM_ERROR == ret) {
|
||||
fprintf(stderr, "deflate memory error");
|
||||
goto error;
|
||||
}
|
||||
else if (Z_OK != ret) {
|
||||
fprintf(stderr, "other deflate error");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Write the compressed chunk data repeatedly to cover all the
|
||||
* * chunks in the dataset, using the direct write function. */
|
||||
for (i = 0; i < NX / CHUNK_NX; i++) {
|
||||
for (j = 0; j < NY / CHUNK_NY; j++) {
|
||||
status = H5DOwrite_chunk(dset_id, H5P_DEFAULT, filter_mask, offset, z_dst_nbytes, outbuf);
|
||||
offset[1] += CHUNK_NY;
|
||||
}
|
||||
offset[0] += CHUNK_NX;
|
||||
offset[1] = 0;
|
||||
}
|
||||
|
||||
if (H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
|
||||
goto error;
|
||||
|
||||
if (H5Dclose(dataset) < 0)
|
||||
goto error;
|
||||
|
||||
if ((dataset = H5Dopen2(file, DATASETNAME1, H5P_DEFAULT)) < 0)
|
||||
goto error;
|
||||
|
||||
offset[0] = CHUNK_NX;
|
||||
offset[1] = CHUNK_NY;
|
||||
|
||||
/* Get the size of the compressed chunk */
|
||||
ret = H5Dget_chunk_storage_size(dataset, offset, &read_chunk_nbytes);
|
||||
|
||||
readbuf = HDmalloc(read_chunk_nbytes);
|
||||
pt_readbuf = (const Bytef *)readbuf;
|
||||
|
||||
/* Use H5DOread_chunk() to read the chunk back */
|
||||
if ((status = H5DOread_chunk(dataset, H5P_DEFAULT, offset, &read_filter_mask, readbuf)) < 0)
|
||||
goto error;
|
||||
|
||||
ret =
|
||||
uncompress((Bytef *)read_dst_buf, (uLongf *)&buf_size, pt_readbuf, (uLong)read_chunk_nbytes);
|
||||
|
||||
/* Check for various zlib errors */
|
||||
if (Z_BUF_ERROR == ret) {
|
||||
fprintf(stderr, "error: not enough room in output buffer");
|
||||
goto error;
|
||||
}
|
||||
else if (Z_MEM_ERROR == ret) {
|
||||
fprintf(stderr, "error: not enough memory");
|
||||
goto error;
|
||||
}
|
||||
else if (Z_OK != ret) {
|
||||
fprintf(stderr, "error: corrupted input data");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Data verification here */
|
||||
:
|
||||
:
|
||||
//! <!-- [H5DOread] -->
|
||||
@@ -0,0 +1,143 @@
|
||||
/* -*- c-file-style: "stroustrup" -*- */
|
||||
|
||||
//! <!-- [first_declare] -->
|
||||
|
||||
DATASET "DSET1" {DATATYPE H5T_STD_I32LE DATASPACE SIMPLE{(4, 13) / (60, 100)} : : }
|
||||
|
||||
//! <!-- [first_declare] -->
|
||||
|
||||
//! <!-- [first_reading] -->
|
||||
|
||||
/* open the HDF5 file */
|
||||
fid = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);
|
||||
|
||||
/* open the dataset */
|
||||
did = H5Dopen2(fid, "DSET1", H5P_DEFAULT);
|
||||
:
|
||||
:
|
||||
/* define hsize_t dims[2]; */
|
||||
/* define hsize_t new_dims[2]; */
|
||||
/* get the dataset's current dimension sizes */
|
||||
H5LDget_dset_dims(did, dims);
|
||||
|
||||
/* extend the dataset by 2 */
|
||||
new_dims[0] = dims[0] + 2;
|
||||
new_dims[1] = dims[1] + 2;
|
||||
H5Dset_extent(did, new_dims)
|
||||
|
||||
/* write data to the extended dataset */
|
||||
: :
|
||||
/* get the size of the dataset's data type */
|
||||
type_size = H5LDget_dset_type_size(did, NULL);
|
||||
:
|
||||
:
|
||||
/* allocate buffer for storing selected data elements from the dataset */
|
||||
/* calculate # of selected elements from dims & new_dims */
|
||||
/* buffer size = type_size * number of selected elements */
|
||||
:
|
||||
:
|
||||
/* read the selected elements from the dataset into buf */
|
||||
H5LDget_dset_elmts(did, dims, new_dims, NULL, buf);
|
||||
:
|
||||
:
|
||||
H5Dclose(did);
|
||||
H5Fclose(fid);
|
||||
|
||||
//! <!-- [first_reading] -->
|
||||
|
||||
//! <!-- [first_output] -->
|
||||
|
||||
data for elements (0, 13), (0, 14)
|
||||
data for elements (1, 13), (1, 14)
|
||||
data for elements (2, 13), (2, 14)
|
||||
data for elements (3, 13), (3, 14)
|
||||
data for elements (4, 0), (4, 1), (4, 2)......................(4, 13), (4, 14)
|
||||
data for elements (5, 0), (5, 1), (5, 2)......................(5, 13), (5, 14)
|
||||
|
||||
//! <!-- [first_output] -->
|
||||
|
||||
|
||||
//! <!-- [second_declare] -->
|
||||
|
||||
DATASET "DSET2" {
|
||||
DATATYPE H5T_COMPOUND {
|
||||
H5T_STD_I32LE "a";
|
||||
H5T_STD_I32LE "b";
|
||||
H5T_ARRAY
|
||||
{
|
||||
[4] H5T_STD_I32LE
|
||||
}
|
||||
"c";
|
||||
H5T_STD_I32LE "d";
|
||||
H5T_STD_I32LE "e";
|
||||
H5T_COMPOUND
|
||||
{
|
||||
H5T_STD_I32LE "a";
|
||||
H5T_STD_I32LE "b";
|
||||
H5T_ARRAY
|
||||
{
|
||||
[4] H5T_STD_I32LE
|
||||
}
|
||||
"c";
|
||||
H5T_STD_I32LE "d";
|
||||
H5T_STD_I32LE "e";
|
||||
}
|
||||
"s2";
|
||||
}
|
||||
DATASPACE SIMPLE
|
||||
{
|
||||
(5) / (5)
|
||||
}
|
||||
::
|
||||
}
|
||||
|
||||
//! <!-- [second_declare] -->
|
||||
|
||||
//! <!-- [second_reading] -->
|
||||
|
||||
/* open the HDF5 file */
|
||||
fid = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);
|
||||
|
||||
/* open the dataset */
|
||||
did = H5Dopen2(fid, "DSET2", H5P_DEFAULT);
|
||||
|
||||
/* define hsize_t dims[1]; */
|
||||
/* define hsize_t new_dims[1]; */
|
||||
:
|
||||
:
|
||||
/* get the dataset's current dimension size */
|
||||
H5LDget_dset_dims(did, dims);
|
||||
|
||||
/* extend the dataset by 2 */
|
||||
new_dims[0] = dims[0] + 2;
|
||||
H5Dset_extent(did, new_dims);
|
||||
:
|
||||
:
|
||||
/* write data to the extended part of the dataset */
|
||||
:
|
||||
:
|
||||
/* #define fields "d,s2.c" */
|
||||
/* get the size of the dataset's data type for the selected fields */
|
||||
type_size = H5LDget_dset_type_size(did, fields);
|
||||
:
|
||||
:
|
||||
/* allocate buffer for storing selected data elements from the dataset */
|
||||
/* calculate # of selected elements from dims & new_dims */
|
||||
/* buffer size = type_size * number of selected elements */
|
||||
:
|
||||
:
|
||||
/* read the selected elements from the dataset into buf */
|
||||
H5LD_get_dset_elmts(did, dims, new_dims, fields, buf);
|
||||
:
|
||||
:
|
||||
H5Dclose(did);
|
||||
H5Fclose(fid);
|
||||
|
||||
//! <!-- [second_reading] -->
|
||||
|
||||
//! <!-- [second_output] -->
|
||||
|
||||
Data for element (5): integer value for "d", 4 integer values for array "s2.c"
|
||||
Data for element (6): integer value for "d", 4 integer values for array "s2.c"
|
||||
|
||||
//! <!-- [second_output] -->
|
||||
@@ -0,0 +1,27 @@
|
||||
/* -*- c-file-style: "stroustrup" -*- */
|
||||
|
||||
//! <!-- [get_attribute_info] -->
|
||||
|
||||
H5T_class_t type_class;
|
||||
size_t type_size;
|
||||
hsize_t dims[0];
|
||||
... status = H5LTget_attribute_info(file_id, "/", STRNAME, dims, &type_class, &type_size);
|
||||
if (type_class == H5T_STRING) {
|
||||
printf("Attribute is a string.\n");
|
||||
printf("String size: %i\n", type_size);
|
||||
|
||||
//! <!-- [get_attribute_info] -->
|
||||
|
||||
//! <!-- [enum] -->
|
||||
|
||||
“H5T_ENUM
|
||||
{
|
||||
H5T_NATIVE_INT;
|
||||
“Bob” 0;
|
||||
“Elena” 1;
|
||||
“Quincey” 2;
|
||||
“Frank” 3;
|
||||
}
|
||||
”
|
||||
|
||||
//! <!-- [enum] -->
|
||||
@@ -0,0 +1,43 @@
|
||||
unsigned char tmp_fill_buf[40];
|
||||
...
|
||||
|
||||
file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
|
||||
dataset_id = H5Dopen(file_id, TABLE_NAME, H5P_DEFAULT);
|
||||
datatype_id = H5Dget_type(dataset_id);
|
||||
|
||||
status = H5TBget_table_info(file_id, TABLE_NAME, &nfields, &nrecords);
|
||||
|
||||
hasfill = H5TBAget_fill(file_id, TABLE_NAME, dataset_id, tmp_fill_buf);
|
||||
|
||||
for (i = 0; i < nfields; i++) {
|
||||
member_type_id = H5Tget_member_type(datatype_id, (unsigned)i);
|
||||
native_mem_type_id = H5Tget_native_type(member_type_id, H5T_DIR_ASCEND);
|
||||
member_offset = H5Tget_member_offset(datatype_id, (unsigned)i);
|
||||
printf("member_offset: %i\n", member_offset);
|
||||
memb_class = H5Tget_class(member_type_id);
|
||||
switch (memb_class) {
|
||||
case H5T_INTEGER:
|
||||
/* convert unsigned char array to integer */
|
||||
break;
|
||||
case H5T_FLOAT:
|
||||
/* convert unsigned char array to double or float */
|
||||
|
||||
if (H5Tequal(native_mem_type_id, H5T_NATIVE_DOUBLE)) {
|
||||
}
|
||||
else if (H5Tequal(native_mem_type_id, H5T_NATIVE_FLOAT)) {
|
||||
f.i = tmp_fill_buf[member_offset] | (tmp_fill_buf[member_offset + 1] << 8) |
|
||||
(tmp_fill_buf[member_offset + 2] << 16) | (tmp_fill_buf[member_offset + 3] << 24);
|
||||
printf("Field %i Fill Value: %lf\n", i, f.f);
|
||||
}
|
||||
break;
|
||||
|
||||
case H5T_STRING:
|
||||
/* convert unsigned char array to string */
|
||||
strsize = H5Tget_size(member_type_id);
|
||||
|
||||
printf("Field %i Fill Value: ", i);
|
||||
for (j = 0; j < strsize; j++)
|
||||
printf("%c", tmp_fill_buf[member_offset + j]);
|
||||
printf("\n");
|
||||
break;
|
||||
}
|
||||
+6
-39
@@ -255,11 +255,11 @@ delete_dataset(state_t *s, const int64_t didx)
|
||||
|
||||
if (s->verbose > 0)
|
||||
fprintf(stderr, "Deleted dataset %s\n", dname);
|
||||
#if 1
|
||||
|
||||
const hid_t ds = s->dataset[didx % ndatasets];
|
||||
if (H5Dclose(ds) < 0)
|
||||
errx(EXIT_FAILURE, "H5Dclose failed");
|
||||
#endif
|
||||
|
||||
s->dataset[didx % ndatasets] = H5I_INVALID_HID;
|
||||
s->stats.datasets.deleted++;
|
||||
}
|
||||
@@ -300,22 +300,8 @@ create_dataset(state_t *s, const int64_t didx)
|
||||
static void
|
||||
create_and_write_dataset(state_t *s, const int64_t didx)
|
||||
{
|
||||
#if 0
|
||||
const int64_t gidx = didx / 2;
|
||||
const int ngroups = __arraycount(s->group);
|
||||
const hid_t g = s->group[gidx % ngroups];
|
||||
|
||||
if (H5Odisable_mdc_flushes(g) < 0)
|
||||
err(EXIT_FAILURE, "H5Odisable_mdc_flushes failed");
|
||||
#endif
|
||||
|
||||
create_dataset(s, didx);
|
||||
write_dataset(s, didx);
|
||||
|
||||
#if 0
|
||||
if (H5Oenable_mdc_flushes(g) < 0)
|
||||
err(EXIT_FAILURE, "H5Oenable_mdc_flushes failed");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -369,12 +355,9 @@ main(int argc, char **argv)
|
||||
errx(EXIT_FAILURE, "%s.%d H5Pcreate failed", __func__, __LINE__);
|
||||
}
|
||||
|
||||
config.version = H5F__CURR_VFD_SWMR_CONFIG_VERSION;
|
||||
config.tick_len = 4;
|
||||
config.max_lag = 5;
|
||||
#if 0 /* raw-data flushing is not implemented */
|
||||
config.flush_raw_data = true;
|
||||
#endif
|
||||
config.version = H5F__CURR_VFD_SWMR_CONFIG_VERSION;
|
||||
config.tick_len = 4;
|
||||
config.max_lag = 5;
|
||||
config.writer = true;
|
||||
config.md_pages_reserved = 128;
|
||||
strlcpy(config.md_file_path, "./my_md_file", sizeof(config.md_file_path));
|
||||
@@ -399,6 +382,7 @@ main(int argc, char **argv)
|
||||
s->file = H5Fcreate(s->output_file, H5F_ACC_TRUNC, fcpl, fapl);
|
||||
|
||||
H5Pclose(fapl);
|
||||
H5Pclose(fcpl);
|
||||
|
||||
if (s->file < 0)
|
||||
errx(EXIT_FAILURE, "H5Fcreate failed");
|
||||
@@ -441,23 +425,6 @@ main(int argc, char **argv)
|
||||
H5Fvfd_swmr_end_tick(s->file);
|
||||
(void)sigsuspend(&mask);
|
||||
}
|
||||
#if 0
|
||||
fprintf(stderr, "Interrupted. Cleaning up.\n");
|
||||
|
||||
int j;
|
||||
for (--i, j = 0; j < 4; j++, --i) {
|
||||
if (i % 2 == 1) {
|
||||
delete_dataset(s, i - 1);
|
||||
delete_dataset(s, i);
|
||||
delete_group(s, i / 2);
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < 4; j++) {
|
||||
assert(s->dataset[j] == H5I_INVALID_HID);
|
||||
assert(s->group[j / 2] == H5I_INVALID_HID);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (s->print_stats)
|
||||
print_stats(&s->stats);
|
||||
|
||||
@@ -202,25 +202,6 @@ matrix_read(state_t *s, int *framenop, float mat[ROWS][COLS])
|
||||
*framenop = frameno + 2;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (!s->constantrate && (lead < -2 || 2 < lead)) {
|
||||
int gain = 31250 / 4;
|
||||
const struct timespec prior_integral = s->update_integral;
|
||||
struct timespec current_interval;
|
||||
if (lead > 0)
|
||||
gain *= 2;
|
||||
struct timespec adjustment = (struct timespec){.tv_sec = 0,
|
||||
.tv_nsec = gain * MAX(MIN(4, lead), -4)};
|
||||
/* XXX clamp it XXX */
|
||||
timespecadd(&s->update_integral,
|
||||
&adjustment, &s->update_integral);
|
||||
timespecadd(&s->update_integral,
|
||||
&s->update_interval, ¤t_interval);
|
||||
if (timespeccmp(¤t_interval, &s->min_interval, <=))
|
||||
s->update_integral = prior_integral;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (frameno >= dims[0]) {
|
||||
int i, j;
|
||||
for (i = 0; i < ROWS; i++) {
|
||||
@@ -565,11 +546,6 @@ matrix_open(state_t *s, bool rw)
|
||||
config.writer = rw;
|
||||
config.md_pages_reserved = 128;
|
||||
|
||||
#if 0 /* raw-data flushing is not implemented; default open-tries is ok */
|
||||
config.flush_raw_data = true;
|
||||
config.md_open_tries = 1;
|
||||
#endif
|
||||
|
||||
strlcpy(config.md_file_path, "./my_md_file", sizeof(config.md_file_path));
|
||||
|
||||
/* Enable page buffering */
|
||||
@@ -688,10 +664,6 @@ main(int argc, char **argv)
|
||||
case READ:
|
||||
case STANDALONE:
|
||||
matrix_draw(w, mat);
|
||||
#if 0
|
||||
wmove(topw, ROWS + 3, 0);
|
||||
waddstr(topw, "\"Don't cross the streams.\"");
|
||||
#endif
|
||||
break;
|
||||
case WRITE:
|
||||
matrix_write(&s, frameno, mat);
|
||||
|
||||
@@ -209,7 +209,6 @@ CONTAINS
|
||||
! Since the name is generated in C and passed to a Fortran string, it
|
||||
! will be NULL terminated, so we need to find the end of the string.
|
||||
|
||||
len = 1
|
||||
DO len = 1, 180
|
||||
IF(name(len) .EQ. C_NULL_CHAR) EXIT
|
||||
ENDDO
|
||||
|
||||
@@ -18,6 +18,29 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**\defgroup H5DO Optimizations
|
||||
*
|
||||
* <em>Bypassing default HDF5 behavior in order to optimize for specific
|
||||
* use cases (H5DO)</em>
|
||||
*
|
||||
* HDF5 functions described is this section are implemented in the HDF5 High-level
|
||||
* library as optimized functions. These functions generally require careful setup
|
||||
* and testing as they enable an application to bypass portions of the HDF5
|
||||
* library’s I/O pipeline for performance purposes.
|
||||
*
|
||||
* These functions are distributed in the standard HDF5 distribution and are
|
||||
* available any time the HDF5 High-level library is available.
|
||||
*
|
||||
* - \ref H5DOappend
|
||||
* \n Appends data to a dataset along a specified dimension.
|
||||
* - \ref H5DOread_chunk
|
||||
* \n Reads a raw data chunk directly from a dataset in a file into a buffer (DEPRECATED)
|
||||
* - \ref H5DOwrite_chunk
|
||||
* \n Writes a raw data chunk from a buffer directly to a dataset in a file (DEPRECATED)
|
||||
* .
|
||||
*
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* "Optimized dataset" routines.
|
||||
@@ -25,6 +48,48 @@ extern "C" {
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5DO
|
||||
*
|
||||
* \brief Appends data to a dataset along a specified dimension.
|
||||
*
|
||||
* \param[in] dset_id Dataset identifier
|
||||
* \param[in] dxpl_id Dataset transfer property list identifier
|
||||
* \param[in] axis Dataset Dimension (0-based) for the append
|
||||
* \param[in] extension Number of elements to append for the
|
||||
* axis-th dimension
|
||||
* \param[in] memtype The memory datatype identifier
|
||||
* \param[in] buf Buffer with data for the append
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details The H5DOappend() routine extends a dataset by \p extension
|
||||
* number of elements along a dimension specified by a
|
||||
* dimension \p axis and writes \p buf of elements to the
|
||||
* dataset. Dimension \p axis is 0-based. Elements’ type
|
||||
* is described by \p memtype.
|
||||
*
|
||||
* This routine combines calling H5Dset_extent(),
|
||||
* H5Sselect_hyperslab(), and H5Dwrite() into a single routine
|
||||
* that simplifies application development for the common case
|
||||
* of appending elements to an existing dataset.
|
||||
*
|
||||
* For a multi-dimensional dataset, appending to one dimension
|
||||
* will write a contiguous hyperslab over the other dimensions.
|
||||
* For example, if a 3-D dataset has dimension sizes (3, 5, 8),
|
||||
* extending the 0th dimension (currently of size 3) by 3 will
|
||||
* append 3*5*8 = 120 elements (which must be pointed to by the
|
||||
* \p buffer parameter) to the dataset, making its final
|
||||
* dimension sizes (6, 5, 8).
|
||||
*
|
||||
* If a dataset has more than one unlimited dimension, any of
|
||||
* those dimensions may be appended to, although only along
|
||||
* one dimension per call to H5DOappend().
|
||||
*
|
||||
* \since 1.10.0
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension, hid_t memtype,
|
||||
const void *buf);
|
||||
|
||||
@@ -35,8 +100,142 @@ H5_HLDLL herr_t H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t e
|
||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
||||
|
||||
/* Compatibility wrappers for functionality moved to H5D */
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5DO
|
||||
*
|
||||
* \brief Writes a raw data chunk from a buffer directly to a dataset in a file.
|
||||
*
|
||||
* \param[in] dset_id Identifier for the dataset to write to
|
||||
* \param[in] dxpl_id Transfer property list identifier for
|
||||
* this I/O operation
|
||||
* \param[in] filters Mask for identifying the filters in use
|
||||
* \param[in] offset Logical position of the chunk’s first element
|
||||
* in the dataspace
|
||||
* \param[in] data_size Size of the actual data to be written in bytes
|
||||
* \param[in] buf Buffer containing data to be written to the chunk
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \deprecated This function was deprecated in favor of the function
|
||||
* H5Dwrite_chunk() of HDF5-1.10.3.
|
||||
* The functionality of H5DOwrite_chunk() was moved
|
||||
* to H5Dwrite_chunk().
|
||||
* \deprecated For compatibility, this API call has been left as a stub which
|
||||
* simply calls H5Dwrite_chunk(). New code should use H5Dwrite_chunk().
|
||||
*
|
||||
* \details The H5DOwrite_chunk() writes a raw data chunk as specified by its
|
||||
* logical \p offset in a chunked dataset \p dset_id from the application
|
||||
* memory buffer \p buf to the dataset in the file. Typically, the data
|
||||
* in \p buf is preprocessed in memory by a custom transformation, such as
|
||||
* compression. The chunk will bypass the library’s internal data
|
||||
* transfer pipeline, including filters, and will be written directly to the file.
|
||||
*
|
||||
* \p dxpl_id is a data transfer property list identifier.
|
||||
*
|
||||
* \p filters is a mask providing a record of which filters are used
|
||||
* with the chunk. The default value of the mask is zero (\c 0),
|
||||
* indicating that all enabled filters are applied. A filter is skipped
|
||||
* if the bit corresponding to the filter’s position in the pipeline
|
||||
* (<tt>0 ≤ position < 32</tt>) is turned on. This mask is saved
|
||||
* with the chunk in the file.
|
||||
*
|
||||
* \p offset is an array specifying the logical position of the first
|
||||
* element of the chunk in the dataset’s dataspace. The length of the
|
||||
* offset array must equal the number of dimensions, or rank, of the
|
||||
* dataspace. The values in \p offset must not exceed the dimension limits
|
||||
* and must specify a point that falls on a dataset chunk boundary.
|
||||
*
|
||||
* \p data_size is the size in bytes of the chunk, representing the number of
|
||||
* bytes to be read from the buffer \p buf. If the data chunk has been
|
||||
* precompressed, \p data_size should be the size of the compressed data.
|
||||
*
|
||||
* \p buf is the memory buffer containing data to be written to the chunk in the file.
|
||||
*
|
||||
* \attention Exercise caution when using H5DOread_chunk() and H5DOwrite_chunk(),
|
||||
* as they read and write data chunks directly in a file.
|
||||
* H5DOwrite_chunk() bypasses hyperslab selection, the conversion of data
|
||||
* from one datatype to another, and the filter pipeline to write the chunk.
|
||||
* Developers should have experience with these processes before
|
||||
* using this function. Please see
|
||||
* <a href="https://portal.hdfgroup.org/display/HDF5/Using+the+Direct+Chunk+Write+Function">
|
||||
* Using the Direct Chunk Write Function</a>
|
||||
* for more information.
|
||||
*
|
||||
* \note H5DOread_chunk() and H5DOwrite_chunk() are not
|
||||
* supported under parallel and do not support variable length types.
|
||||
*
|
||||
* \par Example
|
||||
* The following code illustrates the use of H5DOwrite_chunk to write
|
||||
* an entire dataset, chunk by chunk:
|
||||
* \snippet H5DO_examples.c H5DOwrite
|
||||
*
|
||||
* \version 1.10.3 Function deprecated in favor of H5Dwrite_chunk.
|
||||
*
|
||||
* \since 1.8.11
|
||||
*/
|
||||
H5_HLDLL herr_t H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
|
||||
size_t data_size, const void *buf);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5DO
|
||||
*
|
||||
* \brief Reads a raw data chunk directly from a dataset in a file into a buffer.
|
||||
*
|
||||
* \param[in] dset_id Identifier for the dataset to be read
|
||||
* \param[in] dxpl_id Transfer property list identifier for
|
||||
* this I/O operation
|
||||
* \param[in] offset Logical position of the chunk’s first
|
||||
element in the dataspace
|
||||
* \param[in,out] filters Mask for identifying the filters used
|
||||
* with the chunk
|
||||
* \param[in] buf Buffer containing the chunk read from
|
||||
* the dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \deprecated This function was deprecated in favor of the function
|
||||
* H5Dread_chunk() as of HDF5-1.10.3.
|
||||
* In HDF5 1.10.3, the functionality of H5DOread_chunk()
|
||||
* was moved to H5Dread_chunk().
|
||||
* \deprecated For compatibility, this API call has been left as a stub which
|
||||
* simply calls H5Dread_chunk(). New code should use H5Dread_chunk().
|
||||
*
|
||||
* \details The H5DOread_chunk() reads a raw data chunk as specified
|
||||
* by its logical \p offset in a chunked dataset \p dset_id
|
||||
* from the dataset in the file into the application memory
|
||||
* buffer \p buf. The data in \p buf is read directly from the file
|
||||
* bypassing the library’s internal data transfer pipeline,
|
||||
* including filters.
|
||||
*
|
||||
* \p dxpl_id is a data transfer property list identifier.
|
||||
*
|
||||
* The mask \p filters indicates which filters are used with the
|
||||
* chunk when written. A zero value indicates that all enabled filters
|
||||
* are applied on the chunk. A filter is skipped if the bit corresponding
|
||||
* to the filter’s position in the pipeline
|
||||
* (<tt>0 ≤ position < 32</tt>) is turned on.
|
||||
*
|
||||
* \p offset is an array specifying the logical position of the first
|
||||
* element of the chunk in the dataset’s dataspace. The length of the
|
||||
* offset array must equal the number of dimensions, or rank, of the
|
||||
* dataspace. The values in \p offset must not exceed the dimension
|
||||
* limits and must specify a point that falls on a dataset chunk boundary.
|
||||
*
|
||||
* \p buf is the memory buffer containing the chunk read from the dataset
|
||||
* in the file.
|
||||
*
|
||||
* \par Example
|
||||
* The following code illustrates the use of H5DOread_chunk()
|
||||
* to read a chunk from a dataset:
|
||||
* \snippet H5DO_examples.c H5DOread
|
||||
*
|
||||
* \version 1.10.3 Function deprecated in favor of H5Dread_chunk.
|
||||
*
|
||||
* \since 1.10.2, 1.8.19
|
||||
*/
|
||||
H5_HLDLL herr_t H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters /*out*/,
|
||||
void *buf /*out*/);
|
||||
|
||||
|
||||
+361
-1
@@ -19,33 +19,393 @@
|
||||
#define REFERENCE_LIST "REFERENCE_LIST"
|
||||
#define DIMENSION_LABELS "DIMENSION_LABELS"
|
||||
|
||||
/**
|
||||
* \brief Prototype for H5DSiterate_scales() operator
|
||||
*
|
||||
*/
|
||||
//! <!-- [H5DS_iterate_t_snip] -->
|
||||
typedef herr_t (*H5DS_iterate_t)(hid_t dset, unsigned dim, hid_t scale, void *visitor_data);
|
||||
//! <!-- [H5DS_iterate_t_snip] -->
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**\defgroup H5DS Dimension Scales
|
||||
*
|
||||
* <em>Creating and manipulating HDF5 datasets that are associated with
|
||||
* the dimension of another HDF5 dataset (H5DS)</em>
|
||||
*
|
||||
* \note \Bold{Programming hints:}
|
||||
* \note To use any of these functions or subroutines,
|
||||
* you must first include the relevant include file (C) or
|
||||
* module (Fortran) in your application.
|
||||
* \note The following line includes the HDF5 Dimension Scale package,
|
||||
* H5DS, in C applications:
|
||||
* \code #include "hdf5_hl.h" \endcode
|
||||
* \note This line includes the H5DS module in Fortran applications:
|
||||
* \code use h5ds \endcode
|
||||
*
|
||||
* - \ref H5DSwith_new_ref
|
||||
* \n Determines if new references are used with dimension scales.
|
||||
* - \ref H5DSattach_scale
|
||||
* \n Attach dimension scale dsid to dimension idx of dataset did.
|
||||
* - \ref H5DSdetach_scale
|
||||
* \n Detach dimension scale dsid from the dimension idx of Dataset did.
|
||||
* - \ref H5DSget_label
|
||||
* \n Read the label for dimension idx of did into buffer label.
|
||||
* - \ref H5DSget_num_scales
|
||||
* \n Determines how many Dimension Scales are attached
|
||||
* to dimension idx of did.
|
||||
* - \ref H5DSget_scale_name
|
||||
* \n Retrieves name of scale did into buffer name.
|
||||
* - \ref H5DSis_attached
|
||||
* \n Report if dimension scale dsid is currently attached
|
||||
* to dimension idx of dataset did.
|
||||
* - \ref H5DSis_scale
|
||||
* \n Determines whether dset is a Dimension Scale.
|
||||
* - \ref H5DSiterate_scales
|
||||
* \n Iterates the operation visitor through the scales
|
||||
* attached to dimension dim.
|
||||
* - \ref H5DSset_label
|
||||
* \n Set label for the dimension idx of did to the value label.
|
||||
* - \ref H5DSset_scale
|
||||
* \n Convert dataset dsid to a dimension scale,
|
||||
* with optional name, dimname.
|
||||
* .
|
||||
*
|
||||
*/
|
||||
|
||||
/* THIS IS A NEW ROUTINE NOT ON OLD PORTAL */
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5DS
|
||||
*
|
||||
* \brief Determines if new references are used with dimension scales.
|
||||
*
|
||||
* \param[in] obj_id Object identifier
|
||||
* \param[out] with_new_ref New references are used or not
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5DSwith_new_ref() takes any object identifier and checks
|
||||
* if new references are used for dimension scales. Currently,
|
||||
* new references are used when non-native VOL connector is
|
||||
* used or when H5_DIMENSION_SCALES_WITH_NEW_REF is set up
|
||||
* via configure option.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5DSwith_new_ref(hid_t obj_id, hbool_t *with_new_ref);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5DS
|
||||
*
|
||||
* \brief Attach dimension scale \p dsid to dimension \p idx of
|
||||
* dataset did.
|
||||
*
|
||||
* \param[in] did The dataset
|
||||
* \param[in] dsid The scale to be attached
|
||||
* \param[in] idx The dimension of \p did that \p dsid is associated with
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details Define Dimension Scale \p dsid to be associated with
|
||||
* dimension \p idx of dataset \p did.
|
||||
*
|
||||
* Entries are created in the #DIMENSION_LIST and
|
||||
* #REFERENCE_LIST attributes, as defined in section 4.2 of
|
||||
* <a href="https://support.hdfgroup.org/HDF5/doc/HL/H5DS_Spec.pdf">
|
||||
* HDF5 Dimension Scale Specification</a>.
|
||||
*
|
||||
* Fails if:
|
||||
* - Bad arguments
|
||||
* - If \p dsid is not a Dimension Scale
|
||||
* - If \p did is a Dimension Scale
|
||||
* (A Dimension Scale cannot have scales.)
|
||||
*
|
||||
* \note The Dimension Scale \p dsid can be attached to the
|
||||
* same dimension more than once, which has no effect.
|
||||
*/
|
||||
H5_HLDLL herr_t H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5DS
|
||||
*
|
||||
* \brief Detach dimension scale \p dsid from the dimension \p idx of dataset \p did.
|
||||
*
|
||||
* \param[in] did The dataset
|
||||
* \param[in] dsid The scale to be detached
|
||||
* \param[in] idx The dimension of \p did to detach
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details If possible, deletes association of Dimension Scale \p dsid with
|
||||
* dimension \p idx of dataset \p did. This deletes the entries in the
|
||||
* #DIMENSION_LIST and #REFERENCE_LIST attributes,
|
||||
* as defined in section 4.2 of
|
||||
* <a href="https://support.hdfgroup.org/HDF5/doc/HL/H5DS_Spec.pdf">
|
||||
* HDF5 Dimension Scale Specification</a>.
|
||||
*
|
||||
* Fails if:
|
||||
* - Bad arguments
|
||||
* - The dataset \p did or \p dsid do not exist
|
||||
* - The \p dsid is not a Dimension Scale
|
||||
* - \p dsid is not attached to \p did
|
||||
* .
|
||||
*
|
||||
* \note A scale may be associated with more than dimension of the
|
||||
* same dataset. If so, the detach operation only deletes one
|
||||
* of the associations, for \p did.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5DS
|
||||
*
|
||||
* \brief Convert dataset \p dsid to a dimension scale,
|
||||
* with optional name, \p dimname.
|
||||
*
|
||||
* \param[in] dsid The dataset to be made a Dimemsion Scale
|
||||
* \param[in] dimname The dimension name (optional), NULL if the
|
||||
* dimension has no name.
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details The dataset \p dsid is converted to a Dimension Scale dataset,
|
||||
* as defined above. Creates the CLASS attribute, set to the value
|
||||
* "DIMENSION_SCALE" and an empty #REFERENCE_LIST attribute,
|
||||
* as described in
|
||||
* <a href="https://support.hdfgroup.org/HDF5/doc/HL/H5DS_Spec.pdf">
|
||||
* HDF5 Dimension Scale Specification</a>.
|
||||
* (PDF, see section 4.2).
|
||||
*
|
||||
* If \p dimname is specified, then an attribute called NAME
|
||||
* is created, with the value \p dimname.
|
||||
*
|
||||
* Fails if:
|
||||
* - Bad arguments
|
||||
* - If \p dsid is already a scale
|
||||
* - If \p dsid is a dataset which already has dimension scales
|
||||
* .
|
||||
*
|
||||
* If the dataset was created with the Table, Image, or Palette interface [9],
|
||||
* it is not recommended to convert to a Dimension Scale.
|
||||
* (These Datasets will have a CLASS Table, Image, or Palette.)
|
||||
*
|
||||
* \todo what is [9] after Palette interface?
|
||||
*/
|
||||
H5_HLDLL herr_t H5DSset_scale(hid_t dsid, const char *dimname);
|
||||
|
||||
H5_HLDLL int H5DSget_num_scales(hid_t did, unsigned int dim);
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5DS
|
||||
*
|
||||
* \brief Determines how many Dimension Scales are attached
|
||||
* to dimension \p idx of \p did.
|
||||
*
|
||||
* \param[in] did The dataset to query
|
||||
* \param[in] idx The dimension of \p did to query
|
||||
*
|
||||
* \return Returns the number of Dimension Scales associated
|
||||
* with \p did, if successful, otherwise returns a
|
||||
* negative value.
|
||||
*
|
||||
* \details H5DSget_num_scales() determines how many Dimension
|
||||
* Scales are attached to dimension \p idx of
|
||||
* dataset \p did.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL int H5DSget_num_scales(hid_t did, unsigned int idx);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5DS
|
||||
*
|
||||
* \brief Set label for the dimension \p idx of \p did
|
||||
* to the value \p label.
|
||||
*
|
||||
* \param[in] did The dataset
|
||||
* \param[in] idx The dimension
|
||||
* \param[in] label The label
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details Sets the #DIMENSION_LABELS for dimension \p idx of
|
||||
* dataset \p did. If the dimension had a label,
|
||||
* the new value replaces the old.
|
||||
*
|
||||
* Fails if:
|
||||
* - Bad arguments
|
||||
* .
|
||||
*/
|
||||
H5_HLDLL herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5DS
|
||||
*
|
||||
* \brief Read the label for dimension \p idx of \p did into buffer \p label.
|
||||
*
|
||||
* \param[in] did The dataset
|
||||
* \param[in] idx The dimension
|
||||
* \param[out] label The label
|
||||
* \param[in] size The length of the label buffer
|
||||
*
|
||||
* \return Upon success, size of label or zero if no label found.
|
||||
* Negative if fail.
|
||||
*
|
||||
* \details Returns the value of the #DIMENSION_LABELS for
|
||||
* dimension \p idx of dataset \p did, if set.
|
||||
* Up to \p size characters of the name are copied into
|
||||
* the buffer \p label. If the label is longer than
|
||||
* \p size, it will be truncated to fit. The parameter
|
||||
* \p size is set to the size of the returned \p label.
|
||||
*
|
||||
* If \p did has no label, the return value of
|
||||
* \p label is NULL.
|
||||
*
|
||||
* Fails if:
|
||||
* - Bad arguments
|
||||
* .
|
||||
*/
|
||||
H5_HLDLL ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5DS
|
||||
*
|
||||
* \brief Retrieves name of scale \p did into buffer \p name.
|
||||
*
|
||||
* \param[in] did Dimension scale identifier
|
||||
* \param[out] name Buffer to contain the returned name
|
||||
* \param[in] size Size in bytes, of the \p name buffer
|
||||
*
|
||||
* \return Upon success, the length of the scale name or zero if no name found.
|
||||
* Negative if fail.
|
||||
*
|
||||
* \details H5DSget_scale_name() retrieves the name attribute
|
||||
* for scale \p did.
|
||||
*
|
||||
* Up to \p size characters of the scale name are returned
|
||||
* in \p name; additional characters, if any, are not returned
|
||||
* to the user application.
|
||||
*
|
||||
* If the length of the name, which determines the required value of
|
||||
* \p size, is unknown, a preliminary H5DSget_scale_name() call can
|
||||
* be made by setting \p name to NULL. The return value of this call
|
||||
* will be the size of the scale name; that value plus one (1) can then
|
||||
* be assigned to \p size for a second H5DSget_scale_name() call,
|
||||
* which will retrieve the actual name. (The value passed in with the
|
||||
* parameter \p size must be one greater than size in bytes of the actual
|
||||
* name in order to accommodate the null terminator;
|
||||
* if \p size is set to the exact size of the name, the last byte
|
||||
* passed back will contain the null terminator and the last character
|
||||
* will be missing from the name passed back to the calling application.)
|
||||
*/
|
||||
H5_HLDLL ssize_t H5DSget_scale_name(hid_t did, char *name, size_t size);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5DS
|
||||
*
|
||||
* \brief Determines whether \p did is a Dimension Scale.
|
||||
*
|
||||
* \param[in] did The dataset to query
|
||||
*
|
||||
* \return \htri_t
|
||||
*
|
||||
* \details H5DSis_scale() determines if \p did is a Dimension Scale,
|
||||
* i.e., has class="DIMENSION_SCALE").
|
||||
*
|
||||
*/
|
||||
H5_HLDLL htri_t H5DSis_scale(hid_t did);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5DS
|
||||
*
|
||||
* \brief Iterates the operation visitor through the scales
|
||||
* attached to dimension \p dim.
|
||||
*
|
||||
* \param[in] did The dataset
|
||||
* \param[in] dim The dimension of dataset \p did
|
||||
* \param[in,out] idx Input the index to start iterating,
|
||||
* output the next index to visit.
|
||||
* If NULL, start at the first position.
|
||||
* \param[in] visitor The visitor function
|
||||
* \param[in] visitor_data Arbitrary data to pass to the
|
||||
* visitor function
|
||||
*
|
||||
* \return Returns the return value of the last operator if it was
|
||||
* non-zero, or zero if all scales were processed.
|
||||
*
|
||||
* \details H5DSiterate_scales() iterates over the scales attached to
|
||||
* dimension \p dim of dataset \p did. For each scale in the
|
||||
* list, the \p visitor_data and some additional information,
|
||||
* specified below, are passed to the \p visitor function.
|
||||
* The iteration begins with the \p idx object in the
|
||||
* group and the next element to be processed by the operator
|
||||
* is returned in \p idx. If \p idx is NULL, then the
|
||||
* iterator starts at the first group member; since no
|
||||
* stopping point is returned in this case,
|
||||
* the iterator cannot be restarted if one of the calls
|
||||
* to its operator returns non-zero.
|
||||
*
|
||||
* The prototype for \ref H5DS_iterate_t is:
|
||||
* \snippet this H5DS_iterate_t_snip
|
||||
*
|
||||
* The operation receives the Dimension Scale dataset
|
||||
* identifier, \p scale, and the pointer to the operator
|
||||
* data passed in to H5DSiterate_scales(), \p visitor_data.
|
||||
*
|
||||
* The return values from an operator are:
|
||||
*
|
||||
* - Zero causes the iterator to continue, returning zero
|
||||
* when all group members have been processed.
|
||||
* - Positive causes the iterator to immediately return that
|
||||
* positive value, indicating short-circuit success.
|
||||
* The iterator can be restarted at the next group member.
|
||||
* - Negative causes the iterator to immediately return
|
||||
* that value, indicating failure. The iterator can be
|
||||
* restarted at the next group member.
|
||||
* .
|
||||
*
|
||||
* H5DSiterate_scales() assumes that the scales of the
|
||||
* dimension identified by \p dim remain unchanged through
|
||||
* the iteration. If the membership changes during the iteration,
|
||||
* the function's behavior is undefined.
|
||||
*/
|
||||
H5_HLDLL herr_t H5DSiterate_scales(hid_t did, unsigned int dim, int *idx, H5DS_iterate_t visitor,
|
||||
void *visitor_data);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5DS
|
||||
*
|
||||
* \brief Report if dimension scale \p dsid is currently attached to
|
||||
* dimension \p idx of dataset \p did.
|
||||
*
|
||||
* \param[in] did The dataset
|
||||
* \param[in] dsid The scale to be attached
|
||||
* \param[in] idx The dimension of \p did that \p dsid is associated with
|
||||
*
|
||||
* \return \htri_t
|
||||
*
|
||||
* \details Report if dimension scale \p dsid is currently attached to
|
||||
* dimension \p idx of dataset \p did.
|
||||
*
|
||||
* Fails if:
|
||||
* - Bad arguments
|
||||
* - If \p dsid is not a Dimension Scale
|
||||
* - The \p dsid is not a Dimension Scale
|
||||
* - If \p did is a Dimension Scale (A Dimension Scale cannot have scales.)
|
||||
* .
|
||||
*
|
||||
*/
|
||||
H5_HLDLL htri_t H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -18,33 +18,326 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**\defgroup H5IM Images
|
||||
*
|
||||
* <em>Creating and manipulating HDF5 datasets intended to be
|
||||
* interpreted as images (H5IM)</em>
|
||||
*
|
||||
* The specification for the Images API is presented in another
|
||||
* document: \ref IMG
|
||||
* This version of the API is primarily concerned with two dimensional raster
|
||||
* data similar to HDF4 Raster Images.
|
||||
* The HDF5 Images API uses the \ref H5LT HDF5 API.
|
||||
*
|
||||
* \note \Bold{Programming hints:}
|
||||
* \note To use any of these functions or subroutines,
|
||||
* you must first include the relevant include file (C) or
|
||||
* module (Fortran) in your application.
|
||||
* \note The following line includes the HDF5 Images package, H5IM,
|
||||
* in C applications:
|
||||
* \code #include "hdf5_hl.h" \endcode
|
||||
* \note This line includes the H5IM module in Fortran applications:
|
||||
* \code use h5im \endcode
|
||||
*
|
||||
* - \ref H5IMget_image_info
|
||||
* \n Gets information about an image dataset (dimensions,
|
||||
* interlace mode and number of associated palettes).
|
||||
* - \ref H5IMget_npalettes
|
||||
* \n Gets the number of palettes associated to an image.
|
||||
* - \ref H5IMget_palette
|
||||
* \n Gets the palette dataset.
|
||||
* - \ref H5IMget_palette_info
|
||||
* \n Gets information about a palette dataset (dimensions).
|
||||
* - \ref H5IMis_image
|
||||
* \n Inquires if a dataset is an image
|
||||
* - \ref H5IMis_palette
|
||||
* \n Inquires if a dataset is a palette.
|
||||
* - \ref H5IMlink_palette
|
||||
* \n Attaches a palette to an image.
|
||||
* - \ref H5IMmake_image_8bit
|
||||
* \n Creates and writes an image.
|
||||
* - \ref H5IMmake_image_24bit
|
||||
* \n Creates and writes a true color image.
|
||||
* - \ref H5IMmake_palette
|
||||
* \n Creates and writes a palette.
|
||||
* - \ref H5IMread_image
|
||||
* \n Reads image data from disk.
|
||||
* - \ref H5IMunlink_palette
|
||||
* \n Dettaches a palette from an image.
|
||||
* .
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5IM
|
||||
*
|
||||
* \brief Creates and writes an image.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to create
|
||||
* \param[in] width The width of the image
|
||||
* \param[in] height The height of the image
|
||||
* \param[in] buffer Buffer with data to be written to the dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5IMmake_image_8bit() creates and writes a dataset named
|
||||
* \p dset_name attached to the file or group specified by the
|
||||
* identifier \p loc_id. Attributes conforming to the HDF5 Image
|
||||
* and Palette specification for an indexed image are attached to
|
||||
* the dataset, thus identifying it as an image. The image data is
|
||||
* of the type #H5T_NATIVE_UCHAR. An indexed image is an image in
|
||||
* which each each pixel information storage is an index to a
|
||||
* table palette.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5IMmake_image_8bit(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height,
|
||||
const unsigned char *buffer);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5IM
|
||||
*
|
||||
* \brief Creates and writes a true color image.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to create
|
||||
* \param[in] width The width of the image
|
||||
* \param[in] height The height of the image
|
||||
* \param[in] interlace String defining the interlace mode
|
||||
* \param[in] buffer Buffer with data to be written to the dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5IMmake_image_24bit() creates and writes a dataset named
|
||||
* \p dset_name attached to the file or group specified by the
|
||||
* identifier \p loc_id. This function defines a true color image
|
||||
* conforming to the HDF5 Image and Palette specification.
|
||||
* The function assumes that the image data is of the type
|
||||
* #H5T_NATIVE_UCHAR.
|
||||
*
|
||||
* A true color image is an image where the pixel storage contains
|
||||
* several color planes. In a 24 bit RGB color model, these planes
|
||||
* are red, green and blue. In a true color image the stream of bytes
|
||||
* can be stored in several different ways, thus defining the
|
||||
* interlace (or interleaving) mode. The 2 most used types of interlace mode
|
||||
* are interlace by pixel and interlace by plane. In the 24 bit RGB color
|
||||
* model example, interlace by plane means all the red components for the
|
||||
* entire dataset are stored first, followed by all the green components,
|
||||
* and then by all the blue components. Interlace by pixel in this example
|
||||
* means that for each pixel the sequence red, green, blue is defined.
|
||||
* In this function, the interlace mode is defined in the parameter
|
||||
* \p interlace, a string that can have the values INTERLACE_PIXEL
|
||||
* or INTERLACE_PLANE.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5IMmake_image_24bit(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height,
|
||||
const char *interlace, const unsigned char *buffer);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5IM
|
||||
*
|
||||
* \brief Gets information about an image dataset
|
||||
* (dimensions, interlace mode and number of associated palettes).
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset
|
||||
* \param[out] width The width of the image
|
||||
* \param[out] height The height of the image
|
||||
* \param[out] planes The number of color planes of the image
|
||||
* \param[out] interlace The interlace mode of the image
|
||||
* \param[out] npals The number of palettes associated to the image
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5IMget_image_info() gets information about an image
|
||||
* named \p dset_name attached to the file or group specified
|
||||
* by the identifier \p loc_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5IMget_image_info(hid_t loc_id, const char *dset_name, hsize_t *width, hsize_t *height,
|
||||
hsize_t *planes, char *interlace, hssize_t *npals);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5IM
|
||||
*
|
||||
* \brief Reads image data from disk.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to create
|
||||
* \param[out] buffer Buffer with data to store the image
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5IMread_image() reads a dataset named \p dset_name
|
||||
* attached to the file or group specified by the
|
||||
* identifier \p loc_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5IMread_image(hid_t loc_id, const char *dset_name, unsigned char *buffer);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5IM
|
||||
*
|
||||
* \brief Creates and writes a palette.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] pal_name The name of the palette
|
||||
* \param[in] pal_dims An array of the size of the palette dimensions
|
||||
* \param[in] pal_data Buffer with data to be written to the dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5IMmake_palette() creates and writes a dataset
|
||||
* named \p pal_name. Attributes conforming to the HDF5 Image and
|
||||
* Palette specification are attached to the dataset, thus
|
||||
* identifying it as a palette. The palette data is of the
|
||||
* type #H5T_NATIVE_UCHAR.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5IMmake_palette(hid_t loc_id, const char *pal_name, const hsize_t *pal_dims,
|
||||
const unsigned char *pal_data);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5IM
|
||||
*
|
||||
* \brief Attaches a palette to an image.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] image_name The name of the dataset to attach the palette to
|
||||
* \param[in] pal_name The name of the palette
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5IMlink_palette() attaches a palette named \p pal_name
|
||||
* to an image specified by \p image_name. The image dataset
|
||||
* may or not already have an attached palette. If it has,
|
||||
* the array of palette references is extended to hold the reference
|
||||
* to the new palette.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5IMlink_palette(hid_t loc_id, const char *image_name, const char *pal_name);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5IM
|
||||
*
|
||||
* \brief Dettaches a palette from an image.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] image_name The name of the image dataset
|
||||
* \param[in] pal_name The name of the palette
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5IMunlink_palette() dettaches a palette from an image
|
||||
* specified by \p image_name.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5IMunlink_palette(hid_t loc_id, const char *image_name, const char *pal_name);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5IM
|
||||
*
|
||||
* \brief Gets the number of palettes associated to an image.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] image_name The name of the image dataset
|
||||
* \param[out] npals The number of palettes
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5IMget_npalettes() gets the number of palettes associated to
|
||||
* an image specified by \p image_name.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5IMget_npalettes(hid_t loc_id, const char *image_name, hssize_t *npals);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5IM
|
||||
*
|
||||
* \brief Gets information about a palette dataset (dimensions).
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] image_name The name of the image dataset
|
||||
* \param[in] pal_number The zero based index that identifies
|
||||
* the palette
|
||||
* \param[out] pal_dims The dimensions of the palette dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5IMget_palette_info() gets the dimensions of the palette
|
||||
* dataset identified by \p pal_number (a zero based index)
|
||||
* associated to an image specified by \p image_name.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5IMget_palette_info(hid_t loc_id, const char *image_name, int pal_number, hsize_t *pal_dims);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5IM
|
||||
*
|
||||
* \brief Gets the palette dataset.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] image_name The name of the image dataset
|
||||
* \param[in] pal_number The zero based index that identifies
|
||||
* the palette
|
||||
* \param[out] pal_data The palette dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5IMget_palette() gets the palette dataset identified
|
||||
* by \p pal_number (a zero based index) associated to an
|
||||
* image specified by \p image_name.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5IMget_palette(hid_t loc_id, const char *image_name, int pal_number,
|
||||
unsigned char *pal_data);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5IM
|
||||
*
|
||||
* \brief Inquires if a dataset is an image.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset
|
||||
*
|
||||
* \return \htri_t
|
||||
*
|
||||
* \details H5IMis_image() inquires if a dataset named \p dset_name,
|
||||
* attached to the file or group specified by the identifier
|
||||
* \p loc_id, is an image based on the HDF5 Image and Palette
|
||||
* Specification.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5IMis_image(hid_t loc_id, const char *dset_name);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5IM
|
||||
*
|
||||
* \brief Inquires if a dataset is a palette
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset
|
||||
*
|
||||
* \return \htri_t
|
||||
*
|
||||
* \details H5IMis_palette() inquires if a dataset named \p dset_name,
|
||||
* attached to the file or group specified by the
|
||||
* identifier \p loc_id, is a palette based on the HDF5
|
||||
* Image and Palette Specification.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5IMis_palette(hid_t loc_id, const char *dset_name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -18,8 +18,149 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Retrieves the current dimension sizes of a dataset.
|
||||
*
|
||||
* \param[in] did The dataset identifier
|
||||
* \param[out] cur_dims The current dimension sizes of the dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LDget_dset_dims() retrieves the current dimension sizes
|
||||
* for the dataset \p did through the parameter \p cur_dims.
|
||||
* It will return failure if \p cur_dims is NULL.
|
||||
*
|
||||
* \note See Also:
|
||||
* \note Dataset Watch functions (used with \ref h5watch):
|
||||
* - H5LDget_dset_dims()
|
||||
* - H5LDget_dset_elmts()
|
||||
* - H5LDget_dset_type_size()
|
||||
* .
|
||||
*
|
||||
* \par Example:
|
||||
* See the example code in H5LDget_dset_elmts() for usage of this routine.
|
||||
*
|
||||
* \since 1.10.0
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LDget_dset_dims(hid_t did, hsize_t *cur_dims);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Returns the size in bytes of the dataset’s datatype
|
||||
*
|
||||
* \param[in] did The dataset identifier
|
||||
* \param[in] fields The pointer to a comma-separated list of fields for a compound datatype
|
||||
*
|
||||
* \return If successful, returns the size in bytes of the
|
||||
* dataset’s datatype. Otherwise, returns 0.
|
||||
*
|
||||
* \details H5LDget_dset_type_size() allows the user to find out the datatype
|
||||
* size for the dataset associated with \p did. If the
|
||||
* parameter \p fields is NULL, this routine just returns the size
|
||||
* of the dataset’s datatype. If the dataset has a compound datatype
|
||||
* and \p fields is non-NULL, this routine returns the size of the
|
||||
* datatype(s) for the selected fields specified in \p fields.
|
||||
* Note that ’,’ is the separator for the fields of a compound
|
||||
* datatype while ’.’ (dot) is the separator for a nested field.
|
||||
* Use a backslash ( \ ) to escape characters in field names that
|
||||
* conflict with these two separators.
|
||||
*
|
||||
* \note See Also:
|
||||
* \note Dataset Watch functions (used with \ref h5watch):
|
||||
* - H5LDget_dset_dims()
|
||||
* - H5LDget_dset_elmts()
|
||||
* - H5LDget_dset_type_size()
|
||||
* .
|
||||
*
|
||||
* \par Example:
|
||||
* See the example code in H5LDget_dset_elmts() for usage of this routine.
|
||||
*
|
||||
* \since 1.10.0
|
||||
*
|
||||
*/
|
||||
H5_HLDLL size_t H5LDget_dset_type_size(hid_t did, const char *fields);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Retrieves selected data from the dataset
|
||||
*
|
||||
* \param[in] did The dataset identifier
|
||||
* \param[in] prev_dims The previous dimension size of the dataset
|
||||
* \param[in] cur_dims The current dimension sizes of the dataset
|
||||
* \param[in] fields A string containing a comma-separated list
|
||||
* of fields for a compound datatype
|
||||
* \param[out] buf Buffer for storing data retrieved from the
|
||||
* dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LDget_dset_dims() retrieves selected data of the dataset
|
||||
* \p did and stores the data in the parameter \p buf.
|
||||
* The difference between the parameters \p prev_dims and
|
||||
* \p cur_dims indicates the dimension sizes of the data to be
|
||||
* selected from the dataset. Note that \p cur_dims must have
|
||||
* at least one dimension whose size is greater than the
|
||||
* corresponding dimension in \p prev_dims. Users can
|
||||
* determine the size of buf by multipling the datatype
|
||||
* size of the dataset by the number of selected elements.
|
||||
*
|
||||
* If the parameter \p fields is NULL, this routine returns
|
||||
* data for the selected elements of the dataset. If \p fields
|
||||
* is not NULL and the dataset has a compound datatype, \p fields
|
||||
* is a string containing a comma-separated list of fields.
|
||||
* Each name in \p fields specifies a field in the compound
|
||||
* datatype, and this routine returns data of the selected fields
|
||||
* for the dataset's selected elements. Note that ’,’ is the
|
||||
* separator for the fields of a compound datatype while
|
||||
* ’.’ is the separator for a nested field. Use backslash to
|
||||
* escape characters in field names that conflict with these
|
||||
* two separators.
|
||||
*
|
||||
* \note See Also:
|
||||
* \note Dataset Watch functions (used with \ref h5watch):
|
||||
* - H5LDget_dset_dims()
|
||||
* - H5LDget_dset_elmts()
|
||||
* - H5LDget_dset_type_size()
|
||||
* .
|
||||
*
|
||||
* \par Examples:
|
||||
*
|
||||
* For the first example, \c DSET1 is a two-dimensional chunked dataset with atomic type defined below:
|
||||
* \snippet H5LDget_dset_elmts.c first_declare
|
||||
*
|
||||
* The following coding sample illustrates the reading of
|
||||
* data elements appended to the dataset \c DSET1:
|
||||
* \snippet H5LDget_dset_elmts.c first_reading
|
||||
*
|
||||
* The output buffer will contain data elements selected from
|
||||
* \c DSET1 as follows:
|
||||
* \snippet H5LDget_dset_elmts.c first_output
|
||||
*
|
||||
* For the second example, DSET2 is a one-dimensional chunked dataset
|
||||
* with compound type defined below:
|
||||
* \snippet H5LDget_dset_elmts.c second_declare
|
||||
*
|
||||
* The following coding sample illustrates the reading of data elements
|
||||
* appended to the dataset \c DSET2 with compound datatype.
|
||||
* This example selects only 2 fields: the fourth field \c d and a
|
||||
* subfield of the sixth field \c s2.c:
|
||||
* \snippet H5LDget_dset_elmts.c second_reading
|
||||
*
|
||||
* The output buffer will contain data for \c d and \c s2.c
|
||||
* selected from \c DSET2 as follows:
|
||||
* \snippet H5LDget_dset_elmts.c second_output
|
||||
*
|
||||
* \since 1.10.0
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LDget_dset_elmts(hid_t did, const hsize_t *prev_dims, const hsize_t *cur_dims,
|
||||
const char *fields, void *buf);
|
||||
|
||||
|
||||
+1397
-1
@@ -35,6 +35,116 @@ typedef enum H5LT_lang_t {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**\defgroup H5LT Lite
|
||||
* <em>Functions used to simplify creating and manipulating datasets,
|
||||
* attributes and other features (H5LT, H5LD)</em>
|
||||
*
|
||||
* The HDF5 Lite API consists of higher-level functions which do
|
||||
* more operations per call than the basic HDF5 interface.
|
||||
* The purpose is to wrap intuitive functions around certain sets
|
||||
* of features in the existing APIs.
|
||||
* It has the following sets of functions listed below.
|
||||
*
|
||||
* \note \Bold{Programming hints:}
|
||||
* \note To use any of these functions or subroutines,
|
||||
* you must first include the relevant include file (C) or
|
||||
* module (Fortran) in your application.
|
||||
* \note The following line includes the HDF5 Lite package, H5LT,
|
||||
* in C applications:
|
||||
* \code #include "hdf5_hl.h" \endcode
|
||||
* \note This line includes the H5LT module in Fortran applications:
|
||||
* \code use h5lt \endcode
|
||||
*
|
||||
* - Dataset Functions
|
||||
* - Make dataset functions
|
||||
* - \ref H5LTmake_dataset
|
||||
* - \ref H5LTmake_dataset_char
|
||||
* - \ref H5LTmake_dataset_short
|
||||
* - \ref H5LTmake_dataset_int
|
||||
* - \ref H5LTmake_dataset_long
|
||||
* - \ref H5LTmake_dataset_float
|
||||
* - \ref H5LTmake_dataset_double
|
||||
* - \ref H5LTmake_dataset_string
|
||||
* .
|
||||
* - Read dataset functions
|
||||
* - \ref H5LTread_dataset
|
||||
* - \ref H5LTread_dataset_char
|
||||
* - \ref H5LTread_dataset_short
|
||||
* - \ref H5LTread_dataset_int
|
||||
* - \ref H5LTread_dataset_long
|
||||
* - \ref H5LTread_dataset_float
|
||||
* - \ref H5LTread_dataset_double
|
||||
* - \ref H5LTread_dataset_string
|
||||
* .
|
||||
* - Query dataset functions
|
||||
* - \ref H5LTfind_dataset
|
||||
* - \ref H5LTget_dataset_ndims
|
||||
* - \ref H5LTget_dataset_info
|
||||
* .
|
||||
* - Dataset watch functions
|
||||
* - \ref H5LDget_dset_dims
|
||||
* - \ref H5LDget_dset_elmts
|
||||
* - \ref H5LDget_dset_type_size
|
||||
* .
|
||||
* .
|
||||
* - Attribute Functions
|
||||
* - Set attribute functions
|
||||
* - \ref H5LTset_attribute_string
|
||||
* - \ref H5LTset_attribute_char
|
||||
* - \ref H5LTset_attribute_uchar
|
||||
* - \ref H5LTset_attribute_short
|
||||
* - \ref H5LTset_attribute_ushort
|
||||
* - \ref H5LTset_attribute_int
|
||||
* - \ref H5LTset_attribute_uint
|
||||
* - \ref H5LTset_attribute_long
|
||||
* - \ref H5LTset_attribute_long_long
|
||||
* - \ref H5LTset_attribute_ulong
|
||||
* - \ref H5LTset_attribute_ullong
|
||||
* - \ref H5LTset_attribute_float
|
||||
* - \ref H5LTset_attribute_double
|
||||
* - \ref H5LTset_attribute_f (fortran ONLY)
|
||||
* .
|
||||
* - Get attribute functions
|
||||
* - \ref H5LTget_attribute
|
||||
* - \ref H5LTget_attribute_string
|
||||
* - \ref H5LTget_attribute_char
|
||||
* - \ref H5LTget_attribute_uchar
|
||||
* - \ref H5LTget_attribute_short
|
||||
* - \ref H5LTget_attribute_ushort
|
||||
* - \ref H5LTget_attribute_int
|
||||
* - \ref H5LTget_attribute_uint
|
||||
* - \ref H5LTget_attribute_long
|
||||
* - \ref H5LTget_attribute_long_long
|
||||
* - \ref H5LTget_attribute_ulong
|
||||
* - \ref H5LTget_attribute_ullong
|
||||
* - \ref H5LTget_attribute_float
|
||||
* - \ref H5LTget_attribute_double
|
||||
* .
|
||||
* - Query attribute functions
|
||||
* - \ref H5LTfind_attribute
|
||||
* - \ref H5LTget_attribute_info
|
||||
* - \ref H5LTget_attribute_ndims
|
||||
* .
|
||||
* .
|
||||
* - Datatype Functions
|
||||
* - Datatype translation functions
|
||||
* - \ref H5LTtext_to_dtype
|
||||
* - \ref H5LTdtype_to_text
|
||||
* .
|
||||
* .
|
||||
* - File image function
|
||||
* - Open file image function
|
||||
* - \ref H5LTopen_file_image
|
||||
* .
|
||||
* .
|
||||
* - Path and object function
|
||||
* - Query path and object function
|
||||
* - \ref H5LTpath_valid
|
||||
* .
|
||||
* .
|
||||
* .
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* Make dataset functions
|
||||
@@ -42,27 +152,214 @@ extern "C" {
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes a dataset of a type \p type_id.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The Name of the dataset to create
|
||||
* \param[in] rank Number of dimensions of dataspace
|
||||
* \param[in] dims An array of the size of each dimension
|
||||
* \param[in] type_id Identifier of the datatype to use when creating the dataset
|
||||
* \param[in] buffer Buffer with data to be written to the dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTmake_dataset() creates and writes a dataset named
|
||||
* \p dset_name attached to the object specified by the
|
||||
* identifier \p loc_id.
|
||||
*
|
||||
* The parameter \p type_id can be any valid HDF5 Prdefined \ref PDTNAT;
|
||||
* For example, setting \p type_id to #H5T_NATIVE_INT will result in a dataset
|
||||
* of <em>signed \e integer datatype</em>.
|
||||
*
|
||||
* \version 1.10.0 Fortran 2003 subroutine added to accept a C address of the data buffer.
|
||||
* \version 1.8.7 Fortran subroutine modified in this release to accommodate arrays
|
||||
* with more than three dimensions.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTmake_dataset(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims,
|
||||
hid_t type_id, const void *buffer);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes a dataset.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The Name of the dataset to create
|
||||
* \param[in] rank Number of dimensions of dataspace
|
||||
* \param[in] dims An array of the size of each dimension
|
||||
* \param[in] buffer Buffer with data to be written to the dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTmake_dataset_char() creates and writes a dataset
|
||||
* named \p dset_name attached to the object specified by
|
||||
* the identifier \p loc_id.
|
||||
*
|
||||
* The dataset’s datatype will be \e character, #H5T_NATIVE_CHAR.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTmake_dataset_char(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims,
|
||||
const char *buffer);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes a dataset.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The Name of the dataset to create
|
||||
* \param[in] rank Number of dimensions of dataspace
|
||||
* \param[in] dims An array of the size of each dimension
|
||||
* \param[in] buffer Buffer with data to be written to the dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTmake_dataset_short() creates and writes a dataset
|
||||
* named \p dset_name attached to the object specified by
|
||||
* the identifier \p loc_id.
|
||||
*
|
||||
* The dataset’s datatype will be <em>short signed integer</em>,
|
||||
* #H5T_NATIVE_SHORT.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTmake_dataset_short(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims,
|
||||
const short *buffer);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes a dataset.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The Name of the dataset to create
|
||||
* \param[in] rank Number of dimensions of dataspace
|
||||
* \param[in] dims An array of the size of each dimension
|
||||
* \param[in] buffer Buffer with data to be written to the dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTmake_dataset_int() creates and writes a dataset
|
||||
* named \p dset_name attached to the object specified by
|
||||
* the identifier \p loc_id.
|
||||
*
|
||||
* The dataset’s datatype will be <em>native signed integer</em>,
|
||||
* #H5T_NATIVE_INT.
|
||||
*
|
||||
* \version Fortran subroutine modified in this release to accommodate
|
||||
* arrays with more than three dimensions.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTmake_dataset_int(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims,
|
||||
const int *buffer);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes a dataset.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The Name of the dataset to create
|
||||
* \param[in] rank Number of dimensions of dataspace
|
||||
* \param[in] dims An array of the size of each dimension
|
||||
* \param[in] buffer Buffer with data to be written to the dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTmake_dataset_long() creates and writes a dataset
|
||||
* named \p dset_name attached to the object specified by
|
||||
* the identifier \p loc_id.
|
||||
*
|
||||
* The dataset’s datatype will be <em>long signed integer</em>,
|
||||
* #H5T_NATIVE_LONG.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTmake_dataset_long(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims,
|
||||
const long *buffer);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes a dataset.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The Name of the dataset to create
|
||||
* \param[in] rank Number of dimensions of dataspace
|
||||
* \param[in] dims An array of the size of each dimension
|
||||
* \param[in] buffer Buffer with data to be written to the dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTmake_dataset_float() creates and writes a dataset
|
||||
* named \p dset_name attached to the object specified by
|
||||
* the identifier \p loc_id.
|
||||
*
|
||||
* The dataset’s datatype will be <em>native floating point</em>,
|
||||
* #H5T_NATIVE_FLOAT.
|
||||
*
|
||||
* \version 1.8.7 Fortran subroutine modified in this release to accommodate
|
||||
* arrays with more than three dimensions.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTmake_dataset_float(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims,
|
||||
const float *buffer);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes a dataset.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The Name of the dataset to create
|
||||
* \param[in] rank Number of dimensions of dataspace
|
||||
* \param[in] dims An array of the size of each dimension
|
||||
* \param[in] buffer Buffer with data to be written to the dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTmake_dataset_double() creates and writes a dataset
|
||||
* named \p dset_name attached to the object specified by
|
||||
* the identifier \p loc_id.
|
||||
*
|
||||
* The dataset’s datatype will be
|
||||
* <em>native floating-point double</em>, #H5T_NATIVE_DOUBLE.
|
||||
*
|
||||
* \version 1.8.7 Fortran subroutine modified in this release to accommodate
|
||||
* arrays with more than three dimensions.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTmake_dataset_double(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims,
|
||||
const double *buffer);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes a dataset with string datatype.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to create
|
||||
* \param[in] buf Buffer with data to be written to the dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTmake_dataset_string() creates and writes a dataset
|
||||
* named \p dset_name attached to the object specified by
|
||||
* the identifier \p loc_id.
|
||||
*
|
||||
* The dataset’s datatype will be <em>C string</em>, #H5T_C_S1.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTmake_dataset_string(hid_t loc_id, const char *dset_name, const char *buf);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -72,20 +369,169 @@ H5_HLDLL herr_t H5LTmake_dataset_string(hid_t loc_id, const char *dset_name, con
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads a dataset from disk.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to read
|
||||
* \param[in] type_id Identifier of the datatype to use when reading
|
||||
* the dataset
|
||||
* \param[out] buffer Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTread_dataset() reads a dataset named \p dset_name
|
||||
* attached to the object specified by the identifier \p loc_id.
|
||||
*
|
||||
* \version 1.10.0 Fortran 2003 subroutine added to accept a C
|
||||
* address of the data buffer.
|
||||
* \version 1.8.7 Fortran subroutine modified in this release to
|
||||
* accommodate arrays with more than three dimensions.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTread_dataset(hid_t loc_id, const char *dset_name, hid_t type_id, void *buffer);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads a dataset from disk.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to read
|
||||
* \param[out] buffer Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTread_dataset_char() reads a dataset named \p dset_name
|
||||
* attached to the object specified by the identifier \p loc_id.
|
||||
* The HDF5 datatype is #H5T_NATIVE_CHAR.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTread_dataset_char(hid_t loc_id, const char *dset_name, char *buffer);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads a dataset from disk.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to read
|
||||
* \param[out] buffer Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTread_dataset_short() reads a dataset named \p dset_name
|
||||
* attached to the object specified by the identifier \p loc_id.
|
||||
* The HDF5 datatype is #H5T_NATIVE_SHORT.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTread_dataset_short(hid_t loc_id, const char *dset_name, short *buffer);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads a dataset from disk.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to read
|
||||
* \param[out] buffer Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTread_dataset_int() reads a dataset named \p dset_name
|
||||
* attached to the object specified by the identifier \p loc_id.
|
||||
* The HDF5 datatype is #H5T_NATIVE_INT.
|
||||
*
|
||||
* \version 1.8.7 Fortran subroutine modified in this release to
|
||||
* accommodate arrays with more than three dimensions.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTread_dataset_int(hid_t loc_id, const char *dset_name, int *buffer);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads a dataset from disk.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to read
|
||||
* \param[out] buffer Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTread_dataset_long() reads a dataset named \p dset_name
|
||||
* attached to the object specified by the identifier \p loc_id.
|
||||
* The HDF5 datatype is #H5T_NATIVE_LONG.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTread_dataset_long(hid_t loc_id, const char *dset_name, long *buffer);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads a dataset from disk.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to read
|
||||
* \param[out] buffer Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTread_dataset_float() reads a dataset named \p dset_name
|
||||
* attached to the object specified by the identifier \p loc_id.
|
||||
* The HDF5 datatype is #H5T_NATIVE_FLOAT.
|
||||
*
|
||||
* \version 1.8.7 Fortran subroutine modified in this release to
|
||||
* accommodate arrays with more than three dimensions.
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTread_dataset_float(hid_t loc_id, const char *dset_name, float *buffer);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads a dataset from disk.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to read
|
||||
* \param[out] buffer Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTread_dataset_double() reads a dataset named \p dset_name
|
||||
* attached to the object specified by the identifier \p loc_id.
|
||||
* The HDF5 datatype is #H5T_NATIVE_DOUBLE.
|
||||
*
|
||||
* \version 1.8.7 Fortran subroutine modified in this release to
|
||||
* accommodate arrays with more than three dimensions.
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTread_dataset_double(hid_t loc_id, const char *dset_name, double *buffer);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads a dataset from disk.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to read
|
||||
* \param[out] buf Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTread_dataset_string() reads a dataset named \p dset_name
|
||||
* attached to the object specified by the identifier \p loc_id.
|
||||
* The HDF5 datatype is #H5T_C_S1.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTread_dataset_string(hid_t loc_id, const char *dset_name, char *buf);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -95,11 +541,67 @@ H5_HLDLL herr_t H5LTread_dataset_string(hid_t loc_id, const char *dset_name, cha
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Gets the dimensionality of a dataset
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object to
|
||||
* locate the dataset within
|
||||
* \param[in] dset_name The dataset name
|
||||
* \param[out] rank The dimensionality of the dataset
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_dataset_ndims() gets the dimensionality of a dataset
|
||||
* named \p dset_name exists attached to the object \p loc_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_dataset_ndims(hid_t loc_id, const char *dset_name, int *rank);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Retrieves information about a dataset
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object to locate
|
||||
* the dataset within
|
||||
* \param[in] dset_name The dataset name
|
||||
* \param[out] dims The dimensions of the dataset
|
||||
* \param[out] type_class The class identifier. #H5T_class_t is defined in
|
||||
* H5Tpublic.h. See H5Tget_class() for a list
|
||||
* of class types.
|
||||
* \param[out] type_size The size of the datatype in bytes
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_dataset_info() retrieves information about a dataset
|
||||
* named \p dset_name attached to the object \p loc_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_dataset_info(hid_t loc_id, const char *dset_name, hsize_t *dims,
|
||||
H5T_class_t *type_class, size_t *type_size);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Determines whether a dataset exists.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the group containing the dataset
|
||||
* \param[in] name Dataset name
|
||||
*
|
||||
* \return \htri_t
|
||||
*
|
||||
* \details H5LTfind_dataset() determines whether a dataset named
|
||||
* \p name exists in the group specified by \p loc_id.
|
||||
*
|
||||
* \p loc_id must be a group identifier and \p name must
|
||||
* specify a dataset that is a member of that group.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTfind_dataset(hid_t loc_id, const char *name);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -109,42 +611,343 @@ H5_HLDLL herr_t H5LTfind_dataset(hid_t loc_id, const char *name);
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes a string attribute.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to create the attribute within
|
||||
* \param[in] obj_name The name of the object to attach the attribute
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[in] attr_data Buffer with data to be written to the attribute
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTset_attribute_string() creates and writes a string attribute
|
||||
* named \p attr_name and attaches it to the object specified by
|
||||
* the name \p obj_name. If the attribute already exists,
|
||||
* it is overwritten.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTset_attribute_string(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
const char *attr_data);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes an attribute.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to create the attribute within
|
||||
* \param[in] obj_name The name of the object to attach the attribute
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[in] buffer Buffer with data to be written to the attribute
|
||||
* \param[in] size The size of the 1D array (one in the case of a
|
||||
* scalar attribute). This value is used by
|
||||
* H5Screate_simple() to create the dataspace.
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTset_attribute_char() creates and writes a numerical attribute
|
||||
* named \p attr_name and attaches it to the object specified by the
|
||||
* name \p obj_name. The attribute has a dimensionality of 1.
|
||||
* The HDF5 datatype of the attribute is #H5T_NATIVE_CHAR.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTset_attribute_char(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
const char *buffer, size_t size);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes an attribute.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to create the attribute within
|
||||
* \param[in] obj_name The name of the object to attach the attribute
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[in] buffer Buffer with data to be written to the attribute
|
||||
* \param[in] size The size of the 1D array (one in the case of a
|
||||
* scalar attribute). This value is used by
|
||||
* H5Screate_simple() to create the dataspace.
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTset_attribute_uchar() creates and writes a numerical attribute
|
||||
* named \p attr_name and attaches it to the object specified by the
|
||||
* name \p obj_name. The attribute has a dimensionality of 1.
|
||||
* The HDF5 datatype of the attribute is #H5T_NATIVE_UCHAR.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTset_attribute_uchar(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
const unsigned char *buffer, size_t size);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes an attribute.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to create the attribute within
|
||||
* \param[in] obj_name The name of the object to attach the attribute
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[in] buffer Buffer with data to be written to the attribute
|
||||
* \param[in] size The size of the 1D array (one in the case of a
|
||||
* scalar attribute). This value is used by
|
||||
* H5Screate_simple() to create the dataspace.
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTset_attribute_short() creates and writes a numerical attribute
|
||||
* named \p attr_name and attaches it to the object specified by the
|
||||
* name \p obj_name. The attribute has a dimensionality of 1.
|
||||
* The HDF5 datatype of the attribute is #H5T_NATIVE_SHORT.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTset_attribute_short(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
const short *buffer, size_t size);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes an attribute.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to create the attribute within
|
||||
* \param[in] obj_name The name of the object to attach the attribute
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[in] buffer Buffer with data to be written to the attribute
|
||||
* \param[in] size The size of the 1D array (one in the case of a
|
||||
* scalar attribute). This value is used by
|
||||
* H5Screate_simple() to create the dataspace.
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTset_attribute_ushort() creates and writes a numerical attribute
|
||||
* named \p attr_name and attaches it to the object specified by the
|
||||
* name \p obj_name. The attribute has a dimensionality of 1.
|
||||
* The HDF5 datatype of the attribute is #H5T_NATIVE_USHORT.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTset_attribute_ushort(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
const unsigned short *buffer, size_t size);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes an attribute.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to create the attribute within
|
||||
* \param[in] obj_name The name of the object to attach the attribute
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[in] buffer Buffer with data to be written to the attribute
|
||||
* \param[in] size The size of the 1D array (one in the case of a
|
||||
* scalar attribute). This value is used by
|
||||
* H5Screate_simple() to create the dataspace.
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTset_attribute_int() creates and writes a numerical integer
|
||||
* attribute named \p attr_name and attaches it to the object
|
||||
* specified by the name \p obj_name. The attribute has a
|
||||
* dimensionality of 1. The HDF5 datatype of the attribute
|
||||
* is #H5T_NATIVE_INT.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTset_attribute_int(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
const int *buffer, size_t size);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes an attribute.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to create the attribute within
|
||||
* \param[in] obj_name The name of the object to attach the attribute
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[in] buffer Buffer with data to be written to the attribute
|
||||
* \param[in] size The size of the 1D array (one in the case of a
|
||||
* scalar attribute). This value is used by
|
||||
* H5Screate_simple() to create the dataspace.
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTset_attribute_uint() creates and writes a numerical integer
|
||||
* attribute named \p attr_name and attaches it to the object specified
|
||||
* by the name \p obj_name. The attribute has a dimensionality of 1.
|
||||
* The HDF5 datatype of the attribute is #H5T_NATIVE_UINT.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTset_attribute_uint(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
const unsigned int *buffer, size_t size);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes an attribute.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to create the attribute within
|
||||
* \param[in] obj_name The name of the object to attach the attribute
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[in] buffer Buffer with data to be written to the attribute
|
||||
* \param[in] size The size of the 1D array (one in the case of a
|
||||
* scalar attribute). This value is used by
|
||||
* H5Screate_simple() to create the dataspace.
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTset_attribute_long() creates and writes a numerical
|
||||
* attribute named \p attr_name and attaches it to the object
|
||||
* specified by the name \p obj_name. The attribute has a
|
||||
* dimensionality of 1. The HDF5 datatype of the attribute
|
||||
* is #H5T_NATIVE_LONG.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTset_attribute_long(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
const long *buffer, size_t size);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes an attribute.
|
||||
*
|
||||
* \param[in] loc_id Location of the object to which the attribute
|
||||
* is to be attached
|
||||
* \param[in] obj_name That object's name
|
||||
* \param[in] attr_name Attribute name
|
||||
* \param[in] buffer Attribute value
|
||||
* \param[in] size Attribute size
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTset_attribute_long_long() creates and writes a numerical
|
||||
* attribute named \p attr_name and attaches it to the object
|
||||
* specified by the name \p obj_name.
|
||||
*
|
||||
* The attribute has a dimensionality of 1 and its HDF5 datatype
|
||||
* is #H5T_NATIVE_LLONG.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTset_attribute_long_long(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
const long long *buffer, size_t size);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes an attribute.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to create the attribute within
|
||||
* \param[in] obj_name The name of the object to attach the attribute
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[in] buffer Buffer with data to be written to the attribute
|
||||
* \param[in] size The size of the 1D array (one in the case of a
|
||||
* scalar attribute). This value is used by
|
||||
* H5Screate_simple() to create the dataspace.
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTset_attribute_ulong() creates and writes a numerical
|
||||
* attribute named \p attr_name and attaches it to the object
|
||||
* specified by the name \p obj_name. The attribute has a
|
||||
* dimensionality of 1. The HDF5 datatype of the attribute
|
||||
* is #H5T_NATIVE_ULONG.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTset_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
const unsigned long *buffer, size_t size);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes an attribute.
|
||||
*
|
||||
* \param[in] loc_id Location of the object to which the attribute
|
||||
* is to be attached
|
||||
* \param[in] obj_name That object's name
|
||||
* \param[in] attr_name Attribute name
|
||||
* \param[in] buffer Attribute value
|
||||
* \param[in] size Attribute size
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTset_attribute_ullong() creates and writes a numerical
|
||||
* attribute named \p attr_name and attaches it to the object
|
||||
* specified by the name \p obj_name.
|
||||
*
|
||||
* The attribute has a dimensionality of 1 and its HDF5 datatype
|
||||
* is #H5T_NATIVE_ULLONG.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTset_attribute_ullong(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
const unsigned long long *buffer, size_t size);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes an attribute.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to create the attribute within
|
||||
* \param[in] obj_name The name of the object to attach the attribute
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[in] buffer Buffer with data to be written to the attribute
|
||||
* \param[in] size The size of the 1D array (one in the case of a
|
||||
* scalar attribute). This value is used by
|
||||
* H5Screate_simple() to create the dataspace.
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTset_attribute_float() creates and writes a numerical
|
||||
* floating point attribute named \p attr_name and attaches
|
||||
* it to the object specified by the name \p obj_name.
|
||||
* The attribute has a dimensionality of 1. The HDF5 datatype
|
||||
* of the attribute is #H5T_NATIVE_FLOAT.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTset_attribute_float(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
const float *buffer, size_t size);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates and writes an attribute.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to create the attribute within
|
||||
* \param[in] obj_name The name of the object to attach the attribute
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[in] buffer Buffer with data to be written to the attribute
|
||||
* \param[in] size The size of the 1D array (one in the case of a
|
||||
* scalar attribute). This value is used by
|
||||
* H5Screate_simple() to create the dataspace.
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTset_attribute_double() creates and writes a numerical
|
||||
* attribute named \p attr_name and attaches
|
||||
* it to the object specified by the name \p obj_name.
|
||||
* The attribute has a dimensionality of 1. The HDF5 datatype
|
||||
* of the attribute is #H5T_NATIVE_DOUBLE.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTset_attribute_double(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
const double *buffer, size_t size);
|
||||
|
||||
@@ -155,42 +958,337 @@ H5_HLDLL herr_t H5LTset_attribute_double(hid_t loc_id, const char *obj_name, con
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads an attribute from disk.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to read the attribute from
|
||||
* \param[in] obj_name The name of the object that the attribute is
|
||||
* attached to
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[in] mem_type_id Identifier of the memory datatype
|
||||
* \param[out] data Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute() reads an attribute named
|
||||
* \p attr_name with the memory type \p mem_type_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
hid_t mem_type_id, void *data);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads an attribute from disk.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to read the attribute from
|
||||
* \param[in] obj_name The name of the object that the attribute is
|
||||
* attached to
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[out] data Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute_string() reads an attribute named
|
||||
* \p attr_name that is attached to the object specified
|
||||
* by the name \p obj_name. The datatype is a string.
|
||||
*
|
||||
* \version 1.8.9 The content of the buffer returned by the Fortran
|
||||
* subroutine has changed in this release:\n
|
||||
* If the returned buffer requires padding,
|
||||
* h5ltget_attribute_string_f() now employs space
|
||||
* padding; this buffer was previously returned with a C NULL terminator.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute_string(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
char *data);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads an attribute from disk.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to read the attribute from
|
||||
* \param[in] obj_name The name of the object that the attribute is
|
||||
* attached to
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[out] data Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute_char() reads an attribute named
|
||||
* \p attr_name that is attached to the object specified
|
||||
* by the name \p obj_name. The datatype of the attribute
|
||||
* is #H5T_NATIVE_CHAR.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute_char(hid_t loc_id, const char *obj_name, const char *attr_name, char *data);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads an attribute from disk.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to read the attribute from
|
||||
* \param[in] obj_name The name of the object that the attribute is
|
||||
* attached to
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[out] data Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute_uchar() reads an attribute named
|
||||
* \p attr_name that is attached to the object specified
|
||||
* by the name \p obj_name. The HDF5 datatype of the
|
||||
* attribute is #H5T_NATIVE_UCHAR
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute_uchar(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
unsigned char *data);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads an attribute from disk.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to read the attribute from
|
||||
* \param[in] obj_name The name of the object that the attribute is
|
||||
* attached to
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[out] data Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute_short() reads an attribute named
|
||||
* \p attr_name that is attached to the object specified
|
||||
* by the name \p obj_name. The HDF5 datatype of the
|
||||
* attribute is #H5T_NATIVE_SHORT
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute_short(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
short *data);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads an attribute from disk.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to read the attribute from
|
||||
* \param[in] obj_name The name of the object that the attribute is
|
||||
* attached to
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[out] data Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute_ushort() reads an attribute named
|
||||
* \p attr_name that is attached to the object specified
|
||||
* by the name \p obj_name. The HDF5 datatype of the
|
||||
* attribute is #H5T_NATIVE_USHORT.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute_ushort(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
unsigned short *data);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads an attribute from disk.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to read the attribute from
|
||||
* \param[in] obj_name The name of the object that the attribute is
|
||||
* attached to
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[out] data Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute_int() reads an attribute named
|
||||
* \p attr_name that is attached to the object specified
|
||||
* by the name \p obj_name. The HDF5 datatype of the
|
||||
* attribute is #H5T_NATIVE_INT.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute_int(hid_t loc_id, const char *obj_name, const char *attr_name, int *data);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads an attribute from disk.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to read the attribute from
|
||||
* \param[in] obj_name The name of the object that the attribute is
|
||||
* attached to
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[out] data Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute_uint() reads an attribute named
|
||||
* \p attr_name that is attached to the object specified
|
||||
* by the name \p obj_name. The HDF5 datatype of the
|
||||
* attribute is #H5T_NATIVE_INT.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute_uint(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
unsigned int *data);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads an attribute from disk.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to read the attribute from
|
||||
* \param[in] obj_name The name of the object that the attribute is
|
||||
* attached to
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[out] data Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute_long() reads an attribute named
|
||||
* \p attr_name that is attached to the object specified
|
||||
* by the name \p obj_name. The HDF5 datatype of the
|
||||
* attribute is #H5T_NATIVE_LONG.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute_long(hid_t loc_id, const char *obj_name, const char *attr_name, long *data);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads a \e long \e long attribute.
|
||||
*
|
||||
* \param[in] loc_id Location of the object to which
|
||||
* the attribute is attached
|
||||
* \param[in] obj_name That object's name
|
||||
* \param[in] attr_name Attribute name
|
||||
* \param[out] data Attribute value
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute_long_long() reads the attribute
|
||||
* specified by \p loc_id and \p obj_name.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute_long_long(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
long long *data);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads an attribute from disk.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to read the attribute from
|
||||
* \param[in] obj_name The name of the object that the attribute is
|
||||
* attached to
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[out] data Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute_ulong() reads an attribute named
|
||||
* \p attr_name that is attached to the object specified
|
||||
* by the name \p obj_name. The HDF5 datatype of the
|
||||
* attribute is #H5T_NATIVE_ULONG.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
unsigned long *data);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads an attribute from disk.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to read the attribute from
|
||||
* \param[in] obj_name The name of the object that the attribute is
|
||||
* attached to
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[out] data Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute_ullong() reads an attribute named
|
||||
* \p attr_name that is attached to the object specified
|
||||
* by the name \p obj_name. The HDF5 datatype of the
|
||||
* attribute is #H5T_NATIVE_ULLONG.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute_ullong(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
unsigned long long *data);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads an attribute from disk.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to read the attribute from
|
||||
* \param[in] obj_name The name of the object that the attribute is
|
||||
* attached to
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[out] data Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute_float() reads an attribute named
|
||||
* \p attr_name that is attached to the object specified
|
||||
* by the name \p obj_name. The HDF5 datatype of the
|
||||
* attribute is #H5T_NATIVE_FLOAT.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute_float(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
float *data);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Reads an attribute from disk.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to read the attribute from
|
||||
* \param[in] obj_name The name of the object that the attribute is
|
||||
* attached to
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[out] data Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute_double() reads an attribute named
|
||||
* \p attr_name that is attached to the object specified
|
||||
* by the name \p obj_name. The HDF5 datatype of the
|
||||
* attribute is #H5T_NATIVE_DOUBLE.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute_double(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
double *data);
|
||||
|
||||
@@ -201,8 +1299,55 @@ H5_HLDLL herr_t H5LTget_attribute_double(hid_t loc_id, const char *obj_name, con
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Gets the dimensionality of an attribute.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to read the attribute from
|
||||
* \param[in] obj_name The name of the object that the attribute is
|
||||
* attached to
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[out] rank The dimensionality of the attribute
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute_ndims() gets the dimensionality of an attribute
|
||||
* named \p attr_name that is attached to the object specified
|
||||
* by the name \p obj_name.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute_ndims(hid_t loc_id, const char *obj_name, const char *attr_name, int *rank);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Gets information about an attribute.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object (dataset or group)
|
||||
* to read the attribute from
|
||||
* \param[in] obj_name The name of the object that the attribute is
|
||||
* attached to
|
||||
* \param[in] attr_name The attribute name
|
||||
* \param[out] dims The dimensions of the attribute
|
||||
* \param[out] type_class The class identifier. #H5T_class_t is
|
||||
* defined in H5Tpublic.h. For a list of valid class
|
||||
* types see: H5Tget_class().
|
||||
* \param[out] type_size The size of the datatype in bytes
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5LTget_attribute_info() gets information about an attribute
|
||||
* named \p attr_name attached to the object specified by
|
||||
* the name \p obj_name.
|
||||
*
|
||||
* \par Example
|
||||
* \snippet H5LT_examples.c get_attribute_info
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTget_attribute_info(hid_t loc_id, const char *obj_name, const char *attr_name,
|
||||
hsize_t *dims, H5T_class_t *type_class, size_t *type_size);
|
||||
|
||||
@@ -213,7 +1358,74 @@ H5_HLDLL herr_t H5LTget_attribute_info(hid_t loc_id, const char *obj_name, const
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
H5_HLDLL hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type);
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates an HDF5 datatype given a text description.
|
||||
*
|
||||
* \param[in] text A character string containing a DDL
|
||||
* definition of the datatype to be created
|
||||
* \param[in] lang_type The language used to describe the datatype.
|
||||
* The only currently supported language is
|
||||
* #H5LT_DDL.
|
||||
*
|
||||
* \return Returns the datatype identifier(non-negative) if successful;
|
||||
* otherwise returns a negative value.
|
||||
*
|
||||
* \details Given a text description of a datatype, this function creates
|
||||
* an HDF5 datatype and returns the datatype identifier.
|
||||
* The text description of the datatype has to comply with the
|
||||
* \p lang_type definition of HDF5 datatypes.
|
||||
* Currently, only the DDL(#H5LT_DDL) is supported.
|
||||
* The complete DDL definition of HDF5 datatypes can be found in
|
||||
* the last chapter of the
|
||||
* <a href="https://portal.hdfgroup.org/display/HDF5/HDF5+User+Guides">
|
||||
* HDF5 User's Guide</a>.
|
||||
*
|
||||
* \par Example
|
||||
* An example of DDL definition of \c enum type is shown as follows.
|
||||
* \snippet H5LT_examples.c enum
|
||||
*
|
||||
*/
|
||||
H5_HLDLL hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Creates a text description of an HDF5 datatype.
|
||||
*
|
||||
* \param[in] dtype Identifier of the datatype to be converted
|
||||
* \param[out] str Buffer for the text description of the datatype
|
||||
* \param[in] lang_type The language used to describe the datatype.
|
||||
* The currently supported language is #H5LT_DDL.
|
||||
* \param[out] len The size of buffer needed to store the text description
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details Given an HDF5 datatype identifier, this function creates
|
||||
* a description of this datatype in \p lang_type language format.
|
||||
* A preliminary H5LTdtype_to_text() call can be made to determine
|
||||
* the size of the buffer needed with a NULL passed in for \p str.
|
||||
* This value is returned as \p len. That value can then be assigned
|
||||
* to len for a second H5Ttype_to_text() call, which will
|
||||
* retrieve the actual text description for the datatype.
|
||||
*
|
||||
* If \p len is not big enough for the description, the text
|
||||
* description will be truncated to fit in the buffer.
|
||||
*
|
||||
* Currently only DDL (#H5LT_DDL) is supported for \p lang_type.
|
||||
* The complete DDL definition of HDF5 data types can be found in
|
||||
* the last chapter of the
|
||||
* <a href="https://portal.hdfgroup.org/display/HDF5/HDF5+User+Guides">
|
||||
* HDF5 User's Guide</a>.
|
||||
*
|
||||
* \par Example
|
||||
* An example of DDL definition of \c enum type is shown as follows.
|
||||
* \snippet H5LT_examples.c enum
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *len);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -223,8 +1435,116 @@ H5_HLDLL herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type,
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Determines whether an attribute exists.
|
||||
*
|
||||
* \param[in] loc_id Identifier of the object to which the attribute
|
||||
* is expected to be attached
|
||||
* \param[in] name Attribute name
|
||||
*
|
||||
* \return \htri_t
|
||||
*
|
||||
* \details H5LTfind_attribute() determines whether an attribute named
|
||||
* \p name exists attached to the object specified
|
||||
* by \p loc_id.
|
||||
*
|
||||
* \p loc_id must be an object identifier and \p name
|
||||
* must specify an attribute that is expected to be attached
|
||||
* to that object.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5LTfind_attribute(hid_t loc_id, const char *name);
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Determines whether an HDF5 path is valid and, optionally,
|
||||
* whether the path resolves to an HDF5 object.
|
||||
*
|
||||
* \param[in] loc_id Identifier of an object in the file
|
||||
* \param[in] path The path to the object to check;
|
||||
* links in \p path may be of any type.
|
||||
* \param[in] check_object_valid If TRUE, determine whether the final
|
||||
* component of \p path resolves to
|
||||
* an object; if FALSE, do not check.
|
||||
*
|
||||
* \return Upon success:
|
||||
* \return If \p check_object_valid is set to \c FALSE:
|
||||
* \return Returns \c TRUE if the path is valid;
|
||||
* otherwise returns \c FALSE.
|
||||
* \return If \p check_object_valid is set to \c TRUE:
|
||||
* \return Returns \c TRUE if the path is valid and
|
||||
* resolves to an HDF5 object;
|
||||
* otherwise returns \c FALSE.
|
||||
*
|
||||
* \return Upon error, returns a negative value.
|
||||
*
|
||||
* \details H5LTpath_valid() checks the validity of \p path relative
|
||||
* to the identifier of an object, \p loc_id. Optionally,
|
||||
* \p check_object_valid can be set to determine whether the
|
||||
* final component of \p path resolves to an HDF5 object;
|
||||
* if not, the final component is a dangling link.
|
||||
*
|
||||
* The meaning of the function’s return value depends on the
|
||||
* value of \p check_object_valid:
|
||||
*
|
||||
* If \p check_object_valid is set to \c FALSE, H5LTpath_valid()
|
||||
* will check all links in \p path to verify that they exist.
|
||||
* If all the links in \p path exist, the function will
|
||||
* return \c TRUE; otherwise the function will return \c FALSE.
|
||||
*
|
||||
* If \p check_object_valid is set to \c TRUE,
|
||||
* H5LTpath_valid() will first check the links in \p path,
|
||||
* as described above. If all the links exist,
|
||||
* \p check_object_valid will then determine whether the final
|
||||
* component of \p path resolves to an actual HDF5 object.
|
||||
* H5LTpath_valid() will return \c TRUE if all the links in
|
||||
* \p path exist and the final component resolves to an
|
||||
* actual object; otherwise, it will return \c FALSE.
|
||||
*
|
||||
* \p path can be any one of the following:
|
||||
*
|
||||
* - An absolute path, which starts with a slash (\c /)
|
||||
* indicating the file’s root group, followed by the members
|
||||
* - A relative path with respect to \p loc_id
|
||||
* - A dot (\c .), if \p loc_id is the object identifier for
|
||||
* the object itself
|
||||
* .
|
||||
*
|
||||
* If \p path is an absolute path, then \p loc_id can be an
|
||||
* identifier for any object in the file as it is used only to
|
||||
* identify the file. If \p path is a relative path, then
|
||||
* \p loc_id must be a file or a group identifier.
|
||||
*
|
||||
* \note
|
||||
* <b>Note on Behavior Change:</b>
|
||||
* The behavior of H5LTpath_valid() was changed in the 1.10.0 release
|
||||
* in the case where the root group, “/”, is the value of path.
|
||||
* This change is described below:
|
||||
* - Let \p loc_id denote a valid HDF5 file identifier, and let
|
||||
* \p check_object_valid be set to true or false.
|
||||
* A call to H5LTpath_valid() with arguments \p loc_id, “/”,
|
||||
* and \p check_object_valid returns a positive value;
|
||||
* in other words, H5LTpath_valid(loc_id, "/", check_object_valid)
|
||||
* returns a positive value.
|
||||
* In HDF5 version 1.8.16, this function returns 0.
|
||||
* - Let ‘root’ denote a valid HDF5 group identifier that refers
|
||||
* to the root group of an HDF5 file, and let \p check_object_valid
|
||||
* be set to true or false.
|
||||
* A call to H5LTpath_valid() with arguments ‘root’, “/”, and
|
||||
* \p check_object_valid returns a positive value;
|
||||
* in other words, H5LTpath_valid(root, "/", check_object_valid)
|
||||
* returns a positive value.
|
||||
* In HDF5 version 1.8.16, this function returns 0.
|
||||
*
|
||||
* \version 1.10.0 Function behavior changed in this release.
|
||||
* See the “Note on Behavior Change” section above.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL htri_t H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -234,6 +1554,82 @@ H5_HLDLL htri_t H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_obj
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------
|
||||
* \ingroup H5LT
|
||||
*
|
||||
* \brief Opens an HDF5 file image in memory.
|
||||
*
|
||||
* \param[in] buf_ptr A pointer to the supplied initial image
|
||||
* \param[in] buf_size Size of the supplied buffer
|
||||
* \param[in] flags Flags specifying whether to open the image
|
||||
* read-only or read/write, whether HDF5 is to
|
||||
* take control of the buffer, and instruction
|
||||
* regarding releasing the buffer.
|
||||
*
|
||||
* \return Returns a file identifier if successful;
|
||||
* otherwise returns a negative value.
|
||||
* \warning \Bold{Failure Modes:}
|
||||
* \warning H5LTopen_file_image() will fail if either \p buf_ptr is NULL
|
||||
* or \p buf_size equals 0 (zero).
|
||||
*
|
||||
*
|
||||
* \details H5LTopen_file_image() opens the HDF5 file image that is
|
||||
* located in system memory at the address indicated by
|
||||
* \p buf_ptr of size \p buf_size.
|
||||
* H5LTopen_file_image() opens a file image with the
|
||||
* Core driver, #H5FD_CORE.
|
||||
*
|
||||
* A value of NULL for \p buf_ptr is invalid and will
|
||||
* cause the function to fail.
|
||||
*
|
||||
* A value of 0 for \p buf_size is invalid and will cause
|
||||
* the function to fail.
|
||||
*
|
||||
* The flags passed in \p flags specify whether to open the image
|
||||
* read-only or read/write, whether HDF5 is to take control of the
|
||||
* buffer, and instruction regarding releasing the buffer.
|
||||
* Valid values are:
|
||||
* - #H5LT_FILE_IMAGE_OPEN_RW
|
||||
* - Specifies opening the file image in read/write mode.
|
||||
* - Default without this flag: File image will be opened read-only.
|
||||
* .
|
||||
* - #H5LT_FILE_IMAGE_DONT_COPY
|
||||
* - Specifies to not copy the provided file image buffer;
|
||||
* the buffer will be used directly. HDF5 will release the
|
||||
* file image when finished.
|
||||
* - Default without this flag: Copy the file image buffer and
|
||||
* open the copied file image.
|
||||
* .
|
||||
* - #H5LT_FILE_IMAGE_DONT_RELEASE
|
||||
* - Specifies that HDF5 is not to release the buffer when
|
||||
* the file opened with H5LTopen_file_image() is closed;
|
||||
* releasing the buffer will be left to the application.
|
||||
* - Default without this flag: HDF5 will automatically
|
||||
* release the file image buffer after the file image is
|
||||
* closed. This flag is valid only when used with
|
||||
* #H5LT_FILE_IMAGE_DONT_COPY.
|
||||
* .
|
||||
* .
|
||||
*
|
||||
* \note **Motivation:**
|
||||
* \note H5LTopen_file_image() and other elements of HDF5
|
||||
* are used to load an image of an HDF5 file into system memory
|
||||
* and open that image as a regular HDF5 file. An application can
|
||||
* then use the file without the overhead of disk I/O.
|
||||
*
|
||||
* \note **Recommended Reading:**
|
||||
* \note This function is part of the file image operations feature set.
|
||||
* It is highly recommended to study the guide
|
||||
* <a href="https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations">
|
||||
* HDF5 File Image Operations</a> before using this feature set.\n
|
||||
* See the “See Also” section below for links to other elements of
|
||||
* HDF5 file image operations.
|
||||
*
|
||||
* \todo There is no "See Also" section???
|
||||
*
|
||||
* \since 1.8.9
|
||||
*/
|
||||
H5_HLDLL hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -18,19 +18,201 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**\defgroup H5PT Packet Table
|
||||
*
|
||||
* <em>Creating and manipulating HDF5 datasets to support append-
|
||||
* and read-only operations on table data (H5PT)</em>
|
||||
*
|
||||
* The HDF5 Packet Table API is designed to allow records to be
|
||||
* appended to and read from a table. Packet Table datasets are
|
||||
* chunked, allowing them to grow as needed.
|
||||
*
|
||||
* The Packet Table API, with the H5PT prefix, is not to be confused with
|
||||
* the H5TB Table API (H5TB prefix). The H5TB APIs are stateless
|
||||
* (H5TB Tables do not need to be opened or closed) but H5PT Packet Tables
|
||||
* require less performance overhead. Also, H5TB Tables support insertions
|
||||
* and deletions, while H5PT Packet Tables support only append operations.
|
||||
* H5TB functions should not be called on tables created with the
|
||||
* H5PT API, or vice versa.
|
||||
*
|
||||
* Packet Tables are datasets in an HDF5 file, so while their contents
|
||||
* should not be changed outside of the H5PT API calls, the datatypes of
|
||||
* Packet Tables can be queried using \ref H5Dget_type.
|
||||
* Packet Tables can also be given attributes using the normal HDF5 APIs.
|
||||
*
|
||||
* \note \Bold{Programming hints:}
|
||||
* \note The following line includes the HDF5 Packet Table package, H5PT,
|
||||
* in C applications:
|
||||
* \code #include "hdf5_hl.h" \endcode
|
||||
* Without this include, an application will not have access to
|
||||
* these functions.
|
||||
*
|
||||
* - \ref H5PTappend
|
||||
* \n Appends packets to the end of a packet table.
|
||||
* - \ref H5PTclose
|
||||
* \n Closes an open packet table.
|
||||
* - \ref H5PTcreate
|
||||
* \n Creates a packet table to store fixed-length
|
||||
* or variable-length packets.
|
||||
* - \ref H5PTcreate_fl
|
||||
* \n Creates a packet table to store fixed-length packets.
|
||||
* - \ref H5PTcreate_index
|
||||
* \n Resets a packet table's index to the first packet.
|
||||
* - \ref H5PTfree_vlen_buff
|
||||
* \n Releases memory allocated in the process of
|
||||
* reading variable-length packets.
|
||||
* - \ref H5PTget_dataset
|
||||
* \n Returns the backend dataset of this packet table.
|
||||
* - \ref H5PTget_index
|
||||
* \n Gets the current record index for a packet table
|
||||
* - \ref H5PTget_next
|
||||
* \n Reads packets from a packet table starting at the
|
||||
* current index.
|
||||
* - \ref H5PTget_num_packets
|
||||
* \n Returns the number of packets in a packet table.
|
||||
* - \ref H5PTget_type
|
||||
* \n Returns the backend datatype of this packet table.
|
||||
* - \ref H5PTis_valid
|
||||
* \n Determines whether an identifier points to a packet table.
|
||||
* - \ref H5PTis_varlen
|
||||
* \n Determines whether a packet table contains variable-length
|
||||
* or fixed-length packets.
|
||||
* - \ref H5PTopen
|
||||
* \n Opens an existing packet table.
|
||||
* - \ref H5PTread_packets
|
||||
* \n Reads a number of packets from a packet table.
|
||||
* - \ref H5PTset_index
|
||||
* \n Sets a packet table's index.
|
||||
* .
|
||||
*
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Create/Open/Close functions
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
/* NOTE: H5PTcreate is replacing H5PTcreate_fl for better name due to the
|
||||
removal of H5PTcreate_vl. H5PTcreate_fl may be retired in 1.8.19. */
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Creates a packet table to store fixed-length or
|
||||
* variable-length packets.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the packet table to create
|
||||
* \param[in] dtype_id The datatype of the packet
|
||||
* \param[in] chunk_size The size in number of table entries per chunk
|
||||
* \param[in] plist_id Identifier of the property list. Can be used to
|
||||
* specify the compression of the packet table.
|
||||
*
|
||||
* \return Returns an identifier for the new packet table or
|
||||
* #H5I_INVALID_HID on error.
|
||||
*
|
||||
* \details The H5PTcreate() creates and opens a packet table named
|
||||
* \p dset_name attached to the object specified by the
|
||||
* identifier \p loc_id. The created packet table should be closed
|
||||
* with H5PTclose(), eventually.
|
||||
*
|
||||
* The datatype, \p dtype_id, may specify any datatype, including
|
||||
* variable-length data. If \p dtype_id specifies a compound
|
||||
* datatype, one or more fields in that compound type may be
|
||||
* variable-length.
|
||||
*
|
||||
* \p chunk_size is the size in number of table entries per chunk.
|
||||
* Packet table datasets use HDF5 chunked storage
|
||||
* to allow them to grow. This value allows the user
|
||||
* to set the size of a chunk. The chunk size affects
|
||||
* performance.
|
||||
*
|
||||
* \since 1.10.0 and 1.8.17
|
||||
*
|
||||
*/
|
||||
H5_HLDLL hid_t H5PTcreate(hid_t loc_id, const char *dset_name, hid_t dtype_id, hsize_t chunk_size,
|
||||
hid_t plist_id);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Opens an existing packet table.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the packet table to open
|
||||
*
|
||||
* \return Returns an identifier for the packet table or
|
||||
* #H5I_INVALID_HID on error.
|
||||
*
|
||||
* \details H5PTopen() opens an existing packet table in the file or group
|
||||
* specified by \p loc_id. \p dset_name is the name of the packet
|
||||
* table and is used to identify it in the file. This function is
|
||||
* used to open both fixed-length packet tables and variable-length
|
||||
* packet tables. The packet table should later be closed with
|
||||
* H5PTclose().
|
||||
*
|
||||
*/
|
||||
H5_HLDLL hid_t H5PTopen(hid_t loc_id, const char *dset_name);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Closes an open packet table.
|
||||
*
|
||||
* \param[in] table_id Identifier of packet table to be closed
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details The H5PTclose() ends access to a packet table specified
|
||||
* by \p table_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5PTclose(hid_t table_id);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Creates a packet table to store fixed-length packets
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to create
|
||||
* \param[in] dtype_id The datatype of a packet.
|
||||
* \param[in] chunk_size The size in number of table entries per
|
||||
* chunk.
|
||||
* \param[in] compression The compression level;
|
||||
* a value of 0 through 9.
|
||||
*
|
||||
* \return Returns an identifier for the packet table or
|
||||
* #H5I_INVALID_HID on error.
|
||||
*
|
||||
* \deprecated This function was deprecated in favor of the function
|
||||
* H5PTcreate().
|
||||
*
|
||||
* \details The H5PTcreate_fl() creates and opens a packet table
|
||||
* named \p dset_name attached to the object specified by
|
||||
* the identifier \p loc_id. It should be closed
|
||||
* with H5PTclose().
|
||||
*
|
||||
* The datatype, \p dtype_id, may specify any datatype,
|
||||
* including variable-length data. If \p dtype_id specifies a
|
||||
* compound datatype, one or more fields in that compound type
|
||||
* may be variable-length.
|
||||
*
|
||||
* \p chunk_size is the size in number of table entries per chunk.
|
||||
* Packet table datasets use HDF5 chunked storage
|
||||
* to allow them to grow. This value allows the user
|
||||
* to set the size of a chunk. The chunk size affects
|
||||
* performance.
|
||||
*
|
||||
* \p compression is the compression level, a value of 0 through 9.
|
||||
* Level 0 is faster but offers the least compression;
|
||||
* level 9 is slower but offers maximum compression.
|
||||
* A setting of -1 indicates that no compression is desired.
|
||||
|
||||
*/
|
||||
/* This function may be removed from the packet table in release 1.8.19. */
|
||||
H5_HLDLL hid_t H5PTcreate_fl(hid_t loc_id, const char *dset_name, hid_t dtype_id, hsize_t chunk_size,
|
||||
int compression);
|
||||
@@ -39,24 +221,148 @@ H5_HLDLL hid_t H5PTcreate_fl(hid_t loc_id, const char *dset_name, hid_t dtype_id
|
||||
* Write functions
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Appends packets to the end of a packet table.
|
||||
*
|
||||
* \param[in] table_id Identifier of packet table to which
|
||||
* packets should be appended
|
||||
* \param[in] nrecords Number of packets to be appended
|
||||
* \param[in] data Buffer holding data to write
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details The H5PTappend() writes \p nrecords packets to the end of a
|
||||
* packet table specified by \p table_id. \p data is a buffer
|
||||
* containing the data to be written. For a packet table holding
|
||||
* fixed-length packets, this data should be in the packet
|
||||
* table's datatype. For a variable-length packet table,
|
||||
* the data should be in the form of #hvl_t structs.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5PTappend(hid_t table_id, size_t nrecords, const void *data);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Read functions
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Reads packets from a packet table starting at the current index.
|
||||
*
|
||||
* \param[in] table_id Identifier of packet table to read from
|
||||
* \param[in] nrecords Number of packets to be read
|
||||
* \param[out] data Buffer into which to read data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details The H5PTget_next() reads \p nrecords packets starting with
|
||||
* the "current index" from a packet table specified by \p table_id.
|
||||
* The packet table's index is set and reset with H5PTset_index()
|
||||
* and H5PTcreate_index(). \p data is a buffer into which the
|
||||
* data should be read.
|
||||
*
|
||||
* For a packet table holding variable-length records, the data
|
||||
* returned in the buffer will be in form of a #hvl_t struct
|
||||
* containing the length of the data and a pointer to it in memory.
|
||||
* The memory used by this data must be freed using H5PTfree_vlen_buff().
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5PTget_next(hid_t table_id, size_t nrecords, void *data);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Reads a number of packets from a packet table.
|
||||
*
|
||||
* \param[in] table_id Identifier of packet table to read from
|
||||
* \param[in] start Packet to start reading from
|
||||
* \param[in] nrecords Number of packets to be read
|
||||
* \param[out] data Buffer into which to read data.
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details The H5PTread_packets() reads \p nrecords packets starting at
|
||||
* packet number \p start from a packet table specified by
|
||||
* \p table_id. \p data is a buffer into which the data should
|
||||
* be read.
|
||||
*
|
||||
* For a packet table holding variable-length records, the data
|
||||
* returned in the buffer will be in form of #hvl_t structs,
|
||||
* each containing the length of the data and a pointer to it in
|
||||
* memory. The memory used by this data must be freed using
|
||||
* H5PTfree_vlen_buff().
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5PTread_packets(hid_t table_id, hsize_t start, size_t nrecords, void *data);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Inquiry functions
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Returns the number of packets in a packet table.
|
||||
*
|
||||
* \param[in] table_id Identifier of packet table to query
|
||||
* \param[out] nrecords Number of packets in packet table
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details The H5PTget_num_packets() returns by reference the number
|
||||
* of packets in a packet table specified by \p table_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5PTget_num_packets(hid_t table_id, hsize_t *nrecords);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Determines whether an identifier points to a packet table.
|
||||
*
|
||||
* \param[in] table_id Identifier to query
|
||||
*
|
||||
* \return Returns a non-negative value if \p table_id is
|
||||
* a valid packet table, otherwise returns a negative value.
|
||||
*
|
||||
* \details The H5PTis_valid() returns a non-negative value if
|
||||
* \p table_id corresponds to an open packet table,
|
||||
* and returns a negative value otherwise.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5PTis_valid(hid_t table_id);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Determines whether a packet table contains
|
||||
* variable-length or fixed-length packets.
|
||||
*
|
||||
* \param[in] table_id Packet table to query
|
||||
*
|
||||
* \return Returns 1 for a variable-length packet table,
|
||||
* 0 for fixed-length, or a negative value on error.
|
||||
*
|
||||
* \details The H5PTis_varlen() returns 1 (TRUE) if \p table_id is
|
||||
* a packet table containing variable-length records.
|
||||
* It returns 0 (FALSE) if \p table_id is a packet table
|
||||
* containing fixed-length records. If \p table_id is not a
|
||||
* packet table, a negative value is returned.
|
||||
*
|
||||
* \version 1.10.0 and 1.8.17 Function re-introduced.
|
||||
* Function had been removed in 1.8.3.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5PTis_varlen(hid_t table_id);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -66,8 +372,42 @@ H5_HLDLL herr_t H5PTis_varlen(hid_t table_id);
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Returns the backend dataset of this packet table.
|
||||
*
|
||||
* \param[in] table_id Identifier of the packet table
|
||||
*
|
||||
* \return Returns a dataset identifier or H5I_INVALID_HID on error.
|
||||
*
|
||||
* \details The H5PTget_dataset() returns the identifier of the dataset
|
||||
* storing the packet table \p table_id. This dataset identifier
|
||||
* will be closed by H5PTclose().
|
||||
*
|
||||
* \since 1.10.0 and 1.8.17
|
||||
*
|
||||
*/
|
||||
H5_HLDLL hid_t H5PTget_dataset(hid_t table_id);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Returns the backend datatype of this packet table.
|
||||
*
|
||||
* \param[in] table_id Identifier of the packet table
|
||||
*
|
||||
* \return Returns a datatype identifier or H5I_INVALID_HID on error.
|
||||
*
|
||||
* \details The H5PTget_type() returns the identifier of the datatype
|
||||
* used by the packet table \p table_id. This datatype
|
||||
* identifier will be closed by H5PTclose().
|
||||
*
|
||||
* \since 1.10.0 and 1.8.17
|
||||
*
|
||||
*/
|
||||
H5_HLDLL hid_t H5PTget_type(hid_t table_id);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -77,10 +417,63 @@ H5_HLDLL hid_t H5PTget_type(hid_t table_id);
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Resets a packet table's index to the first packet.
|
||||
*
|
||||
* \param[in] table_id Identifier of packet table whose index
|
||||
* should be initialized.
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details Each packet table keeps an index of the "current" packet
|
||||
* so that \c get_next can iterate through the packets in order.
|
||||
* H5PTcreate_index() initializes a packet table's index, and
|
||||
* should be called before using \c get_next. The index must be
|
||||
* initialized every time a packet table is created or opened;
|
||||
* this information is lost when the packet table is closed.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5PTcreate_index(hid_t table_id);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Sets a packet table's index.
|
||||
*
|
||||
* \param[in] table_id Identifier of packet table whose index is to be set
|
||||
* \param[in] pt_index The packet to which the index should point
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details Each packet table keeps an index of the "current" packet
|
||||
* so that \c get_next can iterate through the packets in order.
|
||||
* H5PTset_index() sets this index to point to a user-specified
|
||||
* packet (the packets are zero-indexed).
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5PTset_index(hid_t table_id, hsize_t pt_index);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Gets the current record index for a packet table.
|
||||
*
|
||||
* \param[in] table_id Table identifier
|
||||
* \param[out] pt_index Current record index
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details The H5PTget_index() returns the current record index
|
||||
* \p pt_index for the table identified by \p table_id.
|
||||
*
|
||||
* \since 1.8.0
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5PTget_index(hid_t table_id, hsize_t *pt_index);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -90,6 +483,29 @@ H5_HLDLL herr_t H5PTget_index(hid_t table_id, hsize_t *pt_index);
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5PT
|
||||
*
|
||||
* \brief Releases memory allocated in the process of reading
|
||||
* variable-length packets.
|
||||
*
|
||||
* \param[in] table_id Packet table whose memory should be freed.
|
||||
* \param[in] bufflen Size of \p buff
|
||||
* \param[in] buff Buffer that was used to read in variable-length
|
||||
* packets
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details When variable-length packets are read, memory is automatically
|
||||
* allocated to hold them, and must be freed. H5PTfree_vlen_buff()
|
||||
* frees this memory, and should be called whenever packets are
|
||||
* read from a variable-length packet table.
|
||||
*
|
||||
* \version 1.10.0 and 1.8.17 Function re-introduced.
|
||||
* Function had been removed in 1.8.3.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5PTfree_vlen_buff(hid_t table_id, size_t bufflen, void *buff);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -18,6 +18,64 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**\defgroup H5TB Table
|
||||
*
|
||||
* <em>Creating and manipulating HDF5 datasets intended to be
|
||||
* interpreted as tables (H5TB)</em>
|
||||
*
|
||||
* The HDF5 Table API defines a standard storage for HDF5 datasets
|
||||
* that are intended to be interpreted as tables. A table is defined
|
||||
* as a collection of records whose values are stored in fixed-length
|
||||
* fields. All records have the same structure, and all values in
|
||||
* each field have the same data type.
|
||||
*
|
||||
* \note \Bold{Programming hints:}
|
||||
* \note To use any of these functions or subroutines,
|
||||
* you must first include the relevant include file (C) or
|
||||
* module (Fortran) in your application.
|
||||
* \note The following line includes the HDF5 Table package, H5TB,
|
||||
* in C applications:
|
||||
* \code #include "hdf5_hl.h" \endcode
|
||||
* \note To include the H5TB module in Fortran applications specify:
|
||||
* \code use h5tb \endcode
|
||||
* Fortran applications must also include \ref H5open before
|
||||
* any HDF5 calls to initialize global variables and \ref H5close
|
||||
* after all HDF5 calls to close the Fortran interface.
|
||||
*
|
||||
* - Creation
|
||||
* - \ref H5TBmake_table
|
||||
* - Storage
|
||||
* - \ref H5TBappend_records (No Fortran)
|
||||
* - \ref H5TBwrite_records (No Fortran)
|
||||
* - \ref H5TBwrite_fields_name
|
||||
* - \ref H5TBwrite_fields_index
|
||||
* .
|
||||
* - Modification
|
||||
* - \ref H5TBdelete_record (No Fortran)
|
||||
* - \ref H5TBinsert_record (No Fortran)
|
||||
* - \ref H5TBadd_records_from (No Fortran)
|
||||
* - \ref H5TBcombine_tables (No Fortran)
|
||||
* - \ref H5TBinsert_field
|
||||
* - \ref H5TBdelete_field
|
||||
* .
|
||||
* - Retrieval
|
||||
* - \ref H5TBread_table
|
||||
* - \ref H5TBread_records (No Fortran)
|
||||
* - \ref H5TBread_fields_name
|
||||
* - \ref H5TBread_fields_index
|
||||
* .
|
||||
* - Query
|
||||
* - \ref H5TBget_table_info
|
||||
* - \ref H5TBget_field_info
|
||||
* .
|
||||
* - Query Table Attributes
|
||||
* - \ref H5TBAget_fill
|
||||
* - \ref H5TBAget_title
|
||||
* .
|
||||
* .
|
||||
*
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* Create functions
|
||||
@@ -25,6 +83,38 @@ extern "C" {
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
* \brief Creates and writes a table
|
||||
*
|
||||
* \param[in] table_title The title of the table
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to create
|
||||
* \param[in] nfields The number of fields
|
||||
* \param[in] nrecords The number of records
|
||||
* \param[in] type_size The size in bytes of the structure
|
||||
* associated with the table;
|
||||
* This value is obtained with \c sizeof().
|
||||
* \param[in] field_names An array containing the names of
|
||||
* the fields
|
||||
* \param[in] field_offset An array containing the offsets of
|
||||
* the fields
|
||||
* \param[in] field_types An array containing the type of
|
||||
* the fields
|
||||
* \param[in] chunk_size The chunk size
|
||||
* \param[in] fill_data Fill values data
|
||||
* \param[in] compress Flag that turns compression on or off
|
||||
* \param[in] buf Buffer with data to be written to the table
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBmake_table() creates and writes a dataset named
|
||||
* \p dset_name attached to the object specified by the
|
||||
* identifier loc_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsize_t nfields,
|
||||
hsize_t nrecords, size_t type_size, const char *field_names[],
|
||||
const size_t *field_offset, const hid_t *field_types, hsize_t chunk_size,
|
||||
@@ -37,17 +127,128 @@ H5_HLDLL herr_t H5TBmake_table(const char *table_title, hid_t loc_id, const char
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
* \brief Adds records to the end of the table
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to overwrite
|
||||
* \param[in] nrecords The number of records to append
|
||||
* \param[in] type_size The size of the structure type,
|
||||
* as calculated by \c sizeof().
|
||||
* \param[in] field_offset An array containing the offsets of
|
||||
* the fields. These offsets can be
|
||||
* calculated with the #HOFFSET macro
|
||||
* \param[in] dst_sizes An array containing the sizes of
|
||||
* the fields
|
||||
* \param[in] buf Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBappend_records() adds records to the end of the table
|
||||
* named \p dset_name attached to the object specified by the
|
||||
* identifier \p loc_id. The dataset is extended to hold the
|
||||
* new records.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBappend_records(hid_t loc_id, const char *dset_name, hsize_t nrecords, size_t type_size,
|
||||
const size_t *field_offset, const size_t *dst_sizes, const void *buf);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
* \brief Overwrites records
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to overwrite
|
||||
* \param[in] start The zero index record to start writing
|
||||
* \param[in] nrecords The number of records to write
|
||||
* \param[in] type_size The size of the structure type, as
|
||||
* calculated by \c sizeof().
|
||||
* \param[in] field_offset An array containing the offsets of
|
||||
* the fields. These offsets can be
|
||||
* calculated with the #HOFFSET macro
|
||||
* \param[in] dst_sizes An array containing the sizes of
|
||||
* the fields
|
||||
* \param[in] buf Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBwrite_records() overwrites records starting at the zero
|
||||
* index position start of the table named \p dset_name attached
|
||||
* to the object specified by the identifier \p loc_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBwrite_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords,
|
||||
size_t type_size, const size_t *field_offset, const size_t *dst_sizes,
|
||||
const void *buf);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
* \brief Overwrites fields
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to overwrite
|
||||
* \param[in] field_names The names of the fields to write
|
||||
* \param[in] start The zero index record to start writing
|
||||
* \param[in] nrecords The number of records to write
|
||||
* \param[in] type_size The size of the structure type, as
|
||||
* calculated by \c sizeof().
|
||||
* \param[in] field_offset An array containing the offsets of
|
||||
* the fields. These offsets can be
|
||||
* calculated with the #HOFFSET macro
|
||||
* \param[in] dst_sizes An array containing the sizes of
|
||||
* the fields
|
||||
* \param[in] buf Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBwrite_fields_name() overwrites one or several fields
|
||||
* specified by \p field_names with data in \p buf from a
|
||||
* dataset named \p dset_name attached to the object specified
|
||||
* by the identifier \p loc_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBwrite_fields_name(hid_t loc_id, const char *dset_name, const char *field_names,
|
||||
hsize_t start, hsize_t nrecords, size_t type_size,
|
||||
const size_t *field_offset, const size_t *dst_sizes, const void *buf);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
* \brief Overwrites fields
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to overwrite
|
||||
* \param[in] nfields The number of fields to overwrite.
|
||||
* This parameter is also the size of the
|
||||
* \p field_index array.
|
||||
* \param[in] field_index The indexes of the fields to write
|
||||
* \param[in] start The zero based index record to start writing
|
||||
* \param[in] nrecords The number of records to write
|
||||
* \param[in] type_size The size of the structure type, as
|
||||
* calculated by \c sizeof().
|
||||
* \param[in] field_offset An array containing the offsets of
|
||||
* the fields. These offsets can be
|
||||
* calculated with the #HOFFSET macro
|
||||
* \param[in] dst_sizes An array containing the sizes of
|
||||
* the fields
|
||||
* \param[in] buf Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBwrite_fields_index() overwrites one or several fields
|
||||
* specified by \p field_index with a buffer \p buf from a
|
||||
* dataset named \p dset_name attached to the object
|
||||
* specified by the identifier \p loc_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBwrite_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields,
|
||||
const int *field_index, hsize_t start, hsize_t nrecords,
|
||||
size_t type_size, const size_t *field_offset, const size_t *dst_sizes,
|
||||
@@ -60,18 +261,128 @@ H5_HLDLL herr_t H5TBwrite_fields_index(hid_t loc_id, const char *dset_name, hsiz
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
* \brief Reads a table
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to read
|
||||
* \param[in] dst_size The size of the structure type,
|
||||
* as calculated by \c sizeof()
|
||||
* \param[in] dst_offset An array containing the offsets of
|
||||
* the fields. These offsets can be
|
||||
* calculated with the #HOFFSET macro
|
||||
* \param[in] dst_sizes An array containing the sizes of
|
||||
* the fields. These sizes can be
|
||||
* calculated with the sizeof() macro.
|
||||
* \param[in] dst_buf Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBread_table() reads a table named
|
||||
* \p dset_name attached to the object specified by
|
||||
* the identifier \p loc_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBread_table(hid_t loc_id, const char *dset_name, size_t dst_size, const size_t *dst_offset,
|
||||
const size_t *dst_sizes, void *dst_buf);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
* \brief Reads one or several fields. The fields are identified by name.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to read
|
||||
* \param[in] field_names An array containing the names of the
|
||||
* fields to read
|
||||
* \param[in] start The start record to read from
|
||||
* \param[in] nrecords The number of records to read
|
||||
* \param[in] type_size The size in bytes of the structure associated
|
||||
* with the table
|
||||
* (This value is obtained with \c sizeof().)
|
||||
* \param[in] field_offset An array containing the offsets of the fields
|
||||
* \param[in] dst_sizes An array containing the size in bytes of
|
||||
* the fields
|
||||
* \param[out] buf Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBread_fields_name() reads the fields identified
|
||||
* by \p field_names from a dataset named \p dset_name
|
||||
* attached to the object specified by the identifier \p loc_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBread_fields_name(hid_t loc_id, const char *dset_name, const char *field_names,
|
||||
hsize_t start, hsize_t nrecords, size_t type_size,
|
||||
const size_t *field_offset, const size_t *dst_sizes, void *buf);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
*
|
||||
* \brief Reads one or several fields. The fields are identified by index.
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to read
|
||||
* \param[in] nfields The number of fields to read
|
||||
* (This parameter is also the size of the
|
||||
* \p field_index array.)
|
||||
* fields to read
|
||||
* \param[in] field_index The indexes of the fields to read
|
||||
* \param[in] start The start record to read from
|
||||
* \param[in] nrecords The number of records to read
|
||||
* \param[in] type_size The size in bytes of the structure associated
|
||||
* with the table
|
||||
* (This value is obtained with \c sizeof())
|
||||
* \param[in] field_offset An array containing the offsets of the fields
|
||||
* \param[in] dst_sizes An array containing the size in bytes of
|
||||
* the fields
|
||||
* \param[out] buf Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBread_fields_index() reads the fields identified
|
||||
* by \p field_index from a dataset named \p dset_name attached
|
||||
* to the object specified by the identifier \p loc_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBread_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields,
|
||||
const int *field_index, hsize_t start, hsize_t nrecords,
|
||||
size_t type_size, const size_t *field_offset, const size_t *dst_sizes,
|
||||
void *buf);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
*
|
||||
* \brief Reads records
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to read
|
||||
* \param[in] start The start record to read from
|
||||
* \param[in] nrecords The number of records to read
|
||||
* \param[in] type_size The size of the structure type,
|
||||
* as calculated by \c sizeof()
|
||||
* \param[in] dst_offset An array containing the offsets of the
|
||||
* fields. These offsets can be calculated
|
||||
* with the #HOFFSET macro
|
||||
* \param[in] dst_sizes An array containing the size in bytes of
|
||||
* the fields
|
||||
* \param[out] buf Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBread_records() reads some records identified from a dataset
|
||||
* named \p dset_name attached to the object specified by the
|
||||
* identifier \p loc_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBread_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords,
|
||||
size_t type_size, const size_t *dst_offset, const size_t *dst_sizes,
|
||||
void *buf);
|
||||
@@ -83,8 +394,52 @@ H5_HLDLL herr_t H5TBread_records(hid_t loc_id, const char *dset_name, hsize_t st
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
*
|
||||
* \brief Gets the table dimensions
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to read
|
||||
* \param[out] nfields The number of fields
|
||||
* \param[out] nrecords The number of records
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBget_table_info() retrieves the table dimensions from a
|
||||
* dataset named \p dset_name attached to the object specified
|
||||
* by the identifier \p loc_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBget_table_info(hid_t loc_id, const char *dset_name, hsize_t *nfields, hsize_t *nrecords);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
*
|
||||
* \brief Gets information about a table
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset to read
|
||||
* \param[out] field_names An array containing the names of the fields
|
||||
* \param[out] field_sizes An array containing the size of the fields
|
||||
* \param[out] field_offsets An array containing the offsets of the fields
|
||||
* \param[out] type_size The size of the HDF5 datatype associated
|
||||
* with the table. (More specifically,
|
||||
* the size in bytes of the HDF5 compound
|
||||
* datatype used to define a row, or record,
|
||||
* in the table)
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBget_field_info() gets information about a dataset
|
||||
* named \p dset_name attached to the object specified
|
||||
* by the identifier \p loc_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBget_field_info(hid_t loc_id, const char *dset_name, char *field_names[],
|
||||
size_t *field_sizes, size_t *field_offsets, size_t *type_size);
|
||||
|
||||
@@ -95,21 +450,162 @@ H5_HLDLL herr_t H5TBget_field_info(hid_t loc_id, const char *dset_name, char *fi
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
*
|
||||
* \brief Delete records
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset
|
||||
* \param[in] start The start record to delete from
|
||||
* \param[in] nrecords The number of records to delete
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBdelete_record() deletes nrecords number of records starting
|
||||
* from \p start from the middle of the table \p dset_name
|
||||
* ("pulling up" all the records after it).
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBdelete_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
*
|
||||
* \brief Insert records
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the dataset
|
||||
* \param[in] start The position to insert
|
||||
* \param[in] nrecords The number of records to insert
|
||||
* \param[in] dst_size The size in bytes of the structure
|
||||
* associated with the table
|
||||
* \param[in] dst_offset An array containing the offsets of the
|
||||
* fields
|
||||
* \param[in] dst_sizes An array containing the size in bytes of
|
||||
* the fields
|
||||
* \param[in] buf Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBinsert_record() inserts records into the middle of the table
|
||||
* ("pushing down" all the records after it)
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBinsert_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords,
|
||||
size_t dst_size, const size_t *dst_offset, const size_t *dst_sizes,
|
||||
void *buf);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
*
|
||||
* \brief Add records from first table to second table
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name1 The name of the dataset to read the records
|
||||
* \param[in] start1 The position to read the records from the
|
||||
* first table
|
||||
* \param[in] nrecords The number of records to read from the first
|
||||
* table
|
||||
* \param[in] dset_name2 The name of the dataset to write the records
|
||||
* \param[in] start2 The position to write the records on the
|
||||
* second table
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBadd_records_from() adds records from a dataset named
|
||||
* \p dset_name1 to a dataset named \p dset_name2. Both tables
|
||||
* are attached to the object specified by the identifier loc_id.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBadd_records_from(hid_t loc_id, const char *dset_name1, hsize_t start1, hsize_t nrecords,
|
||||
const char *dset_name2, hsize_t start2);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
*
|
||||
* \brief Combines records from two tables into a third
|
||||
*
|
||||
* \param[in] loc_id1 Identifier of the file or group in which
|
||||
* the first table is located
|
||||
* \param[in] dset_name1 The name of the first table to combine
|
||||
* \param[in] loc_id2 Identifier of the file or group in which
|
||||
* the second table is located
|
||||
* \param[in] dset_name2 The name of the second table to combine
|
||||
* \param[in] dset_name3 The name of the new table
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBcombine_tables() combines records from two datasets named
|
||||
* \p dset_name1 and \p dset_name2, to a new table named
|
||||
* \p dset_name3. These tables can be located on different files,
|
||||
* identified by \p loc_id1 and \p loc_id2 (identifiers obtained
|
||||
* with H5Fcreate()). They can also be located on the same file.
|
||||
* In this case one uses the same identifier for both parameters
|
||||
* \p loc_id1 and \p loc_id2. If two files are used, the third
|
||||
* table is written in the first file.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2,
|
||||
const char *dset_name2, const char *dset_name3);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
*
|
||||
* \brief Insert a new field into a table
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the table
|
||||
* \param[in] field_name The name of the field to insert
|
||||
* \param[in] field_type The data type of the field
|
||||
* \param[in] position The zero based index position where to
|
||||
* insert the field
|
||||
* \param[in] fill_data Fill value data for the field. This parameter
|
||||
* can be NULL
|
||||
* \param[in] buf Buffer with data
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBinsert_field() inserts a new field named \p field_name into
|
||||
* the table \p dset_name. Note: this function requires the table
|
||||
* to be re-created and rewritten in its entirety, and this can result
|
||||
* in some unused space in the file, and can also take a great deal of
|
||||
* time if the table is large.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name,
|
||||
hid_t field_type, hsize_t position, const void *fill_data, const void *buf);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
*
|
||||
* \brief Deletes a field from a table
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name The name of the table
|
||||
* \param[in] field_name The name of the field to delete
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBdelete_field() deletes a field named \p field_name from the
|
||||
* table \p dset_name. Note: this function requires the table to be
|
||||
* re-created and rewritten in its entirety, and this can result in
|
||||
* some unused space in the file, and can also take a great deal of
|
||||
* time if the table is large.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -119,8 +615,51 @@ H5_HLDLL herr_t H5TBdelete_field(hid_t loc_id, const char *dset_name, const char
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
*
|
||||
* \brief Reads a table's title
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[out] table_title Buffer for title name
|
||||
*
|
||||
* \return \herr_t
|
||||
*
|
||||
* \details H5TBget_title() returns the title of the table identified
|
||||
* by \p loc_id in a buffer \p table_title.
|
||||
*
|
||||
*/
|
||||
H5_HLDLL herr_t H5TBAget_title(hid_t loc_id, char *table_title);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* \ingroup H5TB
|
||||
*
|
||||
*
|
||||
* \brief Reads the table attribute fill values
|
||||
*
|
||||
* \fg_loc_id
|
||||
* \param[in] dset_name Name of table
|
||||
* \param[in] dset_id Table identifier
|
||||
* \param[out] dst_buf Buffer of fill values for table fields
|
||||
*
|
||||
* \return
|
||||
* \return A return value of 1 indicates that a fill value is present.
|
||||
* \return A return value of 0 indicates a fill value is not present.
|
||||
* \return A return value <0 indicates an error.
|
||||
*
|
||||
*
|
||||
* \details H5TBget_fill() reads the table attribute fill values into
|
||||
* the buffer \p dst_buf for the table specified by \p dset_id
|
||||
* and \p dset_name located in \p loc_id.
|
||||
*
|
||||
*
|
||||
* \par Example
|
||||
* \include H5TBAget_fill.c
|
||||
*
|
||||
*/
|
||||
H5_HLDLL htri_t H5TBAget_fill(hid_t loc_id, const char *dset_name, hid_t dset_id, unsigned char *dst_buf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
+2
-2
@@ -1564,7 +1564,7 @@ done:
|
||||
vds_prefix = (char *)H5MM_xfree(vds_prefix);
|
||||
|
||||
if (ret_value == NULL) {
|
||||
/* Free the location--casting away const*/
|
||||
/* Free the location */
|
||||
if (dataset) {
|
||||
if (shared_fo == NULL && dataset->shared) { /* Need to free shared fo */
|
||||
dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix);
|
||||
@@ -3502,7 +3502,7 @@ H5D_flush_all(H5F_t *f)
|
||||
HDassert(f);
|
||||
|
||||
/* Iterate over all the open datasets */
|
||||
if (H5I_iterate(H5I_DATASET, H5D__flush_all_cb, f, FALSE) < 0) /* Casting away const OK -QAK */
|
||||
if (H5I_iterate(H5I_DATASET, H5D__flush_all_cb, f, FALSE) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to flush cached dataset info")
|
||||
|
||||
done:
|
||||
|
||||
+28
-14
@@ -919,22 +919,20 @@ done:
|
||||
*
|
||||
* Purpose: Private version of H5FDcmp()
|
||||
*
|
||||
* Uses H5FD_ctl() to obtain the terminal VFDs for f1 and f2.
|
||||
* Typically, these are the same thing, however, if there is an
|
||||
* intervening pass through VFD (i.e. splitter or VFD SWMR
|
||||
* reader), using the terminal VFD for the comparison will avoid
|
||||
* some false negatives.
|
||||
*
|
||||
* Note, however, that we will still fail to detect the
|
||||
* case in which a given file is opened twice with different
|
||||
* terminal VFDs.
|
||||
*
|
||||
* Return: Success: A value like strcmp()
|
||||
*
|
||||
* Failure: Must never fail.
|
||||
*
|
||||
* Changes: Re-worked function to use H5FD_ctl() to obtain the terminal
|
||||
* VFDs for f1 and f2. Typically, these are the same thing,
|
||||
* however, if there is an intervening pass through VFD
|
||||
* (i.e. splitter of vfd swrmr reader vfd), using the terminal
|
||||
* VFD for the comparison will avoid some false negatives.
|
||||
*
|
||||
* Note, however, that we will still fail to detect the
|
||||
* case in which a give file is opened twice with different
|
||||
* terminal VFDs.
|
||||
*
|
||||
* JRM -- 5/5/22
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
@@ -956,9 +954,16 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2)
|
||||
|
||||
H5E_BEGIN_TRY
|
||||
{
|
||||
/* Using the generic ctl callback, which takes non-const parameters,
|
||||
* to work with const data is going to cause the compiler to complain.
|
||||
*/
|
||||
H5_GCC_CLANG_DIAG_OFF("discarded-qualifiers")
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
ctl_result = H5FD_ctl(f1, H5FD_CTL_GET_TERMINAL_VFD,
|
||||
H5FD_CTL_FAIL_IF_UNKNOWN_FLAG | H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG, NULL,
|
||||
(void **)(&term_f1));
|
||||
H5_GCC_CLANG_DIAG_ON("discarded-qualifiers")
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
}
|
||||
H5E_END_TRY;
|
||||
|
||||
@@ -977,9 +982,16 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2)
|
||||
|
||||
H5E_BEGIN_TRY
|
||||
{
|
||||
/* Using the generic ctl callback, which takes non-const parameters,
|
||||
* to work with const data is going to cause the compiler to complain.
|
||||
*/
|
||||
H5_GCC_CLANG_DIAG_OFF("discarded-qualifiers")
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
ctl_result = H5FD_ctl(f2, H5FD_CTL_GET_TERMINAL_VFD,
|
||||
H5FD_CTL_FAIL_IF_UNKNOWN_FLAG | H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG, NULL,
|
||||
(void **)(&term_f2));
|
||||
H5_GCC_CLANG_DIAG_ON("discarded-qualifiers")
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
}
|
||||
H5E_END_TRY;
|
||||
|
||||
@@ -2323,8 +2335,10 @@ H5FDget_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle /*out*/)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver")
|
||||
|
||||
done:
|
||||
if (FAIL == ret_value)
|
||||
*file_handle = NULL;
|
||||
if (FAIL == ret_value) {
|
||||
if (file_handle)
|
||||
*file_handle = NULL;
|
||||
}
|
||||
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5FDget_vfd_handle() */
|
||||
|
||||
@@ -233,6 +233,24 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf /*
|
||||
HGOTO_DONE(SUCCEED)
|
||||
#endif /* H5_HAVE_PARALLEL */
|
||||
|
||||
/* If the file is open for SWMR read access, allow access to data past
|
||||
* the end of the allocated space (the 'eoa'). This is done because the
|
||||
* eoa stored in the file's superblock might be out of sync with the
|
||||
* objects being written within the file by the application performing
|
||||
* SWMR write operations.
|
||||
*/
|
||||
if (!(file->access_flags & H5F_ACC_SWMR_READ)) {
|
||||
haddr_t eoa;
|
||||
|
||||
if (HADDR_UNDEF == (eoa = (file->cls->get_eoa)(file, type)))
|
||||
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed")
|
||||
|
||||
if ((addr + file->base_addr + size) > eoa)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu, eoa = %llu",
|
||||
(unsigned long long)(addr + file->base_addr), (unsigned long long)size,
|
||||
(unsigned long long)eoa)
|
||||
}
|
||||
|
||||
/* Dispatch to driver */
|
||||
if ((file->cls->read)(file, type, dxpl_id, addr + file->base_addr, size, buf) < 0)
|
||||
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
|
||||
|
||||
+2
-2
@@ -600,7 +600,7 @@ H5FD__vfd_swmr_create_make_believe_data(H5FD_vfd_swmr_t *_file)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static H5FD_t *
|
||||
H5FD__vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
|
||||
H5FD__vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR_UNUSED maxaddr)
|
||||
{
|
||||
H5FD_vfd_swmr_t * file = NULL;
|
||||
size_t page_buf_size;
|
||||
@@ -1802,7 +1802,7 @@ H5FD_vfd_swmr_record_elapsed_ticks(H5FD_t *_file, uint64_t elapsed)
|
||||
|
||||
H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file;
|
||||
|
||||
uint32_t elapsed_idx = MIN(elapsed, file->api_elapsed_nbuckets);
|
||||
uint64_t elapsed_idx = MIN(elapsed, file->api_elapsed_nbuckets);
|
||||
|
||||
file->api_elapsed_ticks[elapsed_idx]++;
|
||||
|
||||
|
||||
+5
-2
@@ -2938,10 +2938,13 @@ H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *n
|
||||
if (NULL == (new_fapl = (H5P_genplist_t *)H5I_object(new_fapl_id)))
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "can't get property list")
|
||||
|
||||
/* Set the character encoding on the new property list */
|
||||
/*
|
||||
* Set the private property for retrieving the backing store
|
||||
* POSIX file descriptor from the Core VFD
|
||||
*/
|
||||
want_posix_fd = TRUE;
|
||||
if (H5P_set(new_fapl, H5F_ACS_WANT_POSIX_FD_NAME, &want_posix_fd) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set character encoding")
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set property for retrieving file descriptor")
|
||||
|
||||
/* Retrieve the file handle */
|
||||
if (H5F_get_vfd_handle(f, new_fapl_id, (void **)&fd) < 0)
|
||||
|
||||
+3
-2
@@ -446,9 +446,10 @@ H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth)
|
||||
dst->user_path_r = H5RS_dup(src->user_path_r);
|
||||
}
|
||||
else {
|
||||
/* Discarding 'const' qualifier OK - QAK */
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
H5G_name_reset((H5G_name_t *)src);
|
||||
} /* end if */
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
}
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5G_name_copy() */
|
||||
|
||||
@@ -1228,7 +1228,9 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const
|
||||
/* Set up group location for soft link to start in */
|
||||
H5G_name_reset(&grp_path);
|
||||
grp_loc.path = &grp_path;
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
grp_loc.oloc = (H5O_loc_t *)src_oloc;
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
|
||||
/* Get pointer to link value in local heap */
|
||||
if ((link_name = (char *)H5HL_offset_into(heap, tmp_src_ent.cache.slink.lval_offset)) == NULL)
|
||||
|
||||
+4
-4
@@ -242,21 +242,20 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo, const H5O_linfo_t *linf
|
||||
|
||||
/* Check for format of group to create */
|
||||
if (use_at_least_v18) {
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
/* Insert link info message */
|
||||
/* (Casting away const OK - QAK) */
|
||||
if (H5O_msg_create(oloc, H5O_LINFO_ID, 0, H5O_UPDATE_TIME, (void *)linfo) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
|
||||
|
||||
/* Insert group info message */
|
||||
/* (Casting away const OK - QAK) */
|
||||
if (H5O_msg_create(oloc, H5O_GINFO_ID, H5O_MSG_FLAG_CONSTANT, 0, (void *)ginfo) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
|
||||
|
||||
/* Insert pipeline message */
|
||||
if (pline && pline->nused)
|
||||
/* (Casting away const OK - QAK) */
|
||||
if (H5O_msg_create(oloc, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, (void *)pline) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
} /* end if */
|
||||
else {
|
||||
H5O_stab_t stab; /* Symbol table message */
|
||||
@@ -398,9 +397,10 @@ H5G__obj_stab_to_new_cb(const H5O_link_t *lnk, void *_udata)
|
||||
HDassert(udata);
|
||||
|
||||
/* Insert link into group */
|
||||
/* (Casting away const OK - QAK) */
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
if (H5G_obj_insert(udata->grp_oloc, lnk->name, (H5O_link_t *)lnk, FALSE, H5O_TYPE_UNKNOWN, NULL) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5_ITER_ERROR, "can't insert link into group")
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
|
||||
+2
-3
@@ -713,18 +713,17 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to hold file open")
|
||||
|
||||
/* Reset any non-default object header messages */
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
if (ginfo != &def_ginfo)
|
||||
/* (Casting away const OK - QAK) */
|
||||
if (H5O_msg_reset(H5O_GINFO_ID, (void *)ginfo) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset group info message")
|
||||
if (linfo != &def_linfo)
|
||||
/* (Casting away const OK - QAK) */
|
||||
if (H5O_msg_reset(H5O_LINFO_ID, (void *)linfo) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset link info message")
|
||||
if (pline != &def_pline)
|
||||
/* (Casting away const OK - QAK) */
|
||||
if (H5O_msg_reset(H5O_PLINE_ID, (void *)pline) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset I/O pipeline message")
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
} /* end if */
|
||||
else
|
||||
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "component not found")
|
||||
|
||||
+4
-1
@@ -745,7 +745,9 @@ H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UN
|
||||
HDassert(len == hdr->heap_size);
|
||||
|
||||
/* Set the shared heap header's file context for this operation */
|
||||
H5_GCC_CLANG_DIAG_OFF("discarded-qualifiers")
|
||||
hdr->f = f;
|
||||
H5_GCC_CLANG_DIAG_ON("discarded-qualifiers")
|
||||
|
||||
/* Magic number */
|
||||
H5MM_memcpy(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
|
||||
@@ -1331,7 +1333,9 @@ H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG
|
||||
hdr = iblock->hdr;
|
||||
|
||||
/* Set the shared heap header's file context for this operation */
|
||||
H5_GCC_CLANG_DIAG_OFF("discarded-qualifiers")
|
||||
hdr->f = f;
|
||||
H5_GCC_CLANG_DIAG_ON("discarded-qualifiers")
|
||||
|
||||
/* Magic number */
|
||||
H5MM_memcpy(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
|
||||
@@ -1678,7 +1682,6 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata)
|
||||
chk_p -= H5HF_SIZEOF_CHKSUM;
|
||||
|
||||
/* Reset checksum field, for computing the checksum */
|
||||
/* (Casting away const OK - QAK) */
|
||||
HDmemset(chk_p, 0, (size_t)H5HF_SIZEOF_CHKSUM);
|
||||
|
||||
/* Compute checksum on entire direct block */
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
|
||||
const H5T_t *dt = (const H5T_t *)info->object;
|
||||
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
object = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */
|
||||
object = (void *)H5T_get_actual_type((H5T_t *)dt);
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
|
||||
path = H5T_nameof(object);
|
||||
|
||||
+6
-7
@@ -697,7 +697,7 @@ H5I_subst(hid_t id, const void *new_object)
|
||||
|
||||
/* Get the old object pointer to return */
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
|
||||
ret_value = (void *)info->object;
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
|
||||
/* Set the new object pointer for the ID */
|
||||
@@ -731,7 +731,7 @@ H5I_object(hid_t id)
|
||||
if (NULL != (info = H5I__find_id(id))) {
|
||||
/* Get the object pointer to return */
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
|
||||
ret_value = (void *)info->object;
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
}
|
||||
|
||||
@@ -767,7 +767,7 @@ H5I_object_verify(hid_t id, H5I_type_t type)
|
||||
if (type == H5I_TYPE(id) && NULL != (info = H5I__find_id(id))) {
|
||||
/* Get the object pointer to return */
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
|
||||
ret_value = (void *)info->object;
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
}
|
||||
|
||||
@@ -930,7 +930,7 @@ H5I__remove_common(H5I_type_info_t *type_info, hid_t id)
|
||||
type_info->last_id_info = NULL;
|
||||
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
|
||||
ret_value = (void *)info->object;
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
|
||||
if (!H5I_marking_g)
|
||||
@@ -1032,7 +1032,6 @@ H5I__dec_ref(hid_t id, void **request)
|
||||
type_info = H5I_type_info_array_g[H5I_TYPE(id)];
|
||||
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
/* (Casting away const OK -QAK) */
|
||||
if (!type_info->cls->free_func || (type_info->cls->free_func)((void *)info->object, request) >= 0) {
|
||||
/* Remove the node from the type */
|
||||
if (NULL == H5I__remove_common(type_info, id))
|
||||
@@ -1521,7 +1520,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
|
||||
* case we'll need to get the wrapped object struct (H5F_t *, etc.).
|
||||
*/
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
object = H5I__unwrap((void *)info->object, type); /* Casting away const OK */
|
||||
object = H5I__unwrap((void *)info->object, type);
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
|
||||
/* Invoke callback function */
|
||||
@@ -1713,7 +1712,7 @@ H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
|
||||
|
||||
/* Get a pointer to the VOL connector's data */
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
object = H5I__unwrap((void *)info->object, type); /* Casting away const OK */
|
||||
object = H5I__unwrap((void *)info->object, type);
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
|
||||
/* Check for a match */
|
||||
|
||||
+7
-3
@@ -595,8 +595,9 @@ H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_AT
|
||||
udata->lnk->cset = H5F_DEFAULT_CSET; /* Default character encoding for link */
|
||||
|
||||
/* Set the link's name correctly */
|
||||
/* Casting away const OK -QAK */
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
udata->lnk->name = (char *)name;
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
|
||||
/* Insert link into group */
|
||||
if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE,
|
||||
@@ -1374,9 +1375,10 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t
|
||||
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "moving a link across files is not allowed")
|
||||
|
||||
/* Give the object its new name */
|
||||
/* Casting away const okay -JML */
|
||||
HDassert(udata->lnk->name == NULL);
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
udata->lnk->name = (char *)name;
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
|
||||
/* Insert the link into the group */
|
||||
if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, H5O_TYPE_UNKNOWN, NULL) < 0)
|
||||
@@ -2123,7 +2125,9 @@ H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t
|
||||
/* Set up group location for link */
|
||||
H5G_name_reset(&lnk_grp_path);
|
||||
lnk_grp_loc.path = &lnk_grp_path;
|
||||
lnk_grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Casting away const OK -QAK */
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
lnk_grp_loc.oloc = (H5O_loc_t *)src_oloc;
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
|
||||
/* Check if the target object exists */
|
||||
if (H5G_loc_exists(&lnk_grp_loc, src_lnk->name, &tar_exists) < 0)
|
||||
|
||||
+11
-7
@@ -1432,11 +1432,13 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t
|
||||
oh->nmesgs++;
|
||||
|
||||
/* Initialize information about message */
|
||||
mesg->dirty = FALSE;
|
||||
mesg->flags = flags;
|
||||
mesg->crt_idx = crt_idx;
|
||||
mesg->native = NULL;
|
||||
mesg->raw = (uint8_t *)chunk_image; /* Casting away const OK - QAK */
|
||||
mesg->dirty = FALSE;
|
||||
mesg->flags = flags;
|
||||
mesg->crt_idx = crt_idx;
|
||||
mesg->native = NULL;
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
mesg->raw = (uint8_t *)chunk_image;
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
mesg->raw_size = mesg_size;
|
||||
mesg->chunkno = chunkno;
|
||||
|
||||
@@ -1639,10 +1641,12 @@ H5O__chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno)
|
||||
|
||||
/* Encode any dirty messages in this chunk */
|
||||
for (u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++)
|
||||
if (curr_msg->dirty && curr_msg->chunkno == chunkno)
|
||||
/* Casting away const OK -QAK */
|
||||
if (curr_msg->dirty && curr_msg->chunkno == chunkno) {
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
if (H5O_msg_flush((H5F_t *)f, oh, curr_msg) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message")
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
}
|
||||
|
||||
/* Sanity checks */
|
||||
if (oh->version > H5O_VERSION_1)
|
||||
|
||||
+10
-6
@@ -639,7 +639,6 @@ static herr_t
|
||||
H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int indent, int fwidth)
|
||||
{
|
||||
const H5O_pline_t *pline = (const H5O_pline_t *)mesg;
|
||||
size_t i, j;
|
||||
|
||||
FUNC_ENTER_PACKAGE_NOERR
|
||||
|
||||
@@ -654,10 +653,15 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int in
|
||||
pline->nalloc);
|
||||
|
||||
/* Loop over all the filters */
|
||||
for (i = 0; i < pline->nused; i++) {
|
||||
char name[32];
|
||||
for (size_t i = 0; i < pline->nused; i++) {
|
||||
/* 19 characters for text + 20 characters for largest 64-bit size_t +
|
||||
* terminal NUL = 40 characters.
|
||||
*/
|
||||
char name[64];
|
||||
|
||||
HDmemset(name, 0, 64);
|
||||
HDsnprintf(name, sizeof(name), "Filter at position %zu", i);
|
||||
|
||||
HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, name);
|
||||
HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3),
|
||||
"Filter identification:", (unsigned)(pline->filter[i].id));
|
||||
@@ -672,14 +676,14 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int in
|
||||
"Num CD values:", pline->filter[i].cd_nelmts);
|
||||
|
||||
/* Filter parameters */
|
||||
for (j = 0; j < pline->filter[i].cd_nelmts; j++) {
|
||||
for (size_t j = 0; j < pline->filter[i].cd_nelmts; j++) {
|
||||
char field_name[32];
|
||||
|
||||
HDsnprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j);
|
||||
HDfprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6), field_name,
|
||||
pline->filter[i].cd_values[j]);
|
||||
} /* end for */
|
||||
} /* end for */
|
||||
}
|
||||
}
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5O__pline_debug() */
|
||||
|
||||
+10
-134
@@ -93,7 +93,6 @@
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, \
|
||||
H5D_VDS_ERROR, HSIZE_UNDEF, -1, -1, FALSE \
|
||||
}
|
||||
#ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER
|
||||
#define H5D_DEF_STORAGE_COMPACT \
|
||||
{ \
|
||||
H5D_COMPACT, \
|
||||
@@ -142,41 +141,6 @@
|
||||
H5D_VIRTUAL, H5O_LAYOUT_VERSION_4, H5D_LOPS_VIRTUAL, {H5D_DEF_LAYOUT_CHUNK_INIT}, \
|
||||
H5D_DEF_STORAGE_VIRTUAL \
|
||||
}
|
||||
#else /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
|
||||
/* Note that the compact & chunked layout initialization values are using the
|
||||
* contiguous layout initialization in the union, because the contiguous
|
||||
* layout is first in the union. These values are overridden in the
|
||||
* H5P__init_def_layout() routine. -QAK
|
||||
*/
|
||||
#define H5D_DEF_LAYOUT_COMPACT \
|
||||
{ \
|
||||
H5D_COMPACT, H5O_LAYOUT_VERSION_DEFAULT, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, \
|
||||
{ \
|
||||
H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT \
|
||||
} \
|
||||
}
|
||||
#define H5D_DEF_LAYOUT_CONTIG \
|
||||
{ \
|
||||
H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_DEFAULT, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, \
|
||||
{ \
|
||||
H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT \
|
||||
} \
|
||||
}
|
||||
#define H5D_DEF_LAYOUT_CHUNK \
|
||||
{ \
|
||||
H5D_CHUNKED, H5O_LAYOUT_VERSION_DEFAULT, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, \
|
||||
{ \
|
||||
H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT \
|
||||
} \
|
||||
}
|
||||
#define H5D_DEF_LAYOUT_VIRTUAL \
|
||||
{ \
|
||||
H5D_VIRTUAL, H5O_LAYOUT_VERSION_4, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, \
|
||||
{ \
|
||||
H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT \
|
||||
} \
|
||||
}
|
||||
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
|
||||
|
||||
/* ======== Dataset creation properties ======== */
|
||||
/* Definitions for storage layout property */
|
||||
@@ -245,9 +209,6 @@
|
||||
|
||||
/* General routines */
|
||||
static herr_t H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout);
|
||||
#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER
|
||||
static herr_t H5P__init_def_layout(void);
|
||||
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
|
||||
|
||||
/* Property class callbacks */
|
||||
static herr_t H5P__dcrt_reg_prop(H5P_genclass_t *pclass);
|
||||
@@ -320,18 +281,10 @@ static const H5O_efl_t H5D_def_efl_g = H5D_CRT_EXT_FILE_LIST_DEF; /* Default
|
||||
static const unsigned H5O_ohdr_min_g = H5D_CRT_MIN_DSET_HDR_SIZE_DEF; /* Default object header minimization */
|
||||
|
||||
/* Defaults for each type of layout */
|
||||
#ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER
|
||||
static const H5O_layout_t H5D_def_layout_compact_g = H5D_DEF_LAYOUT_COMPACT;
|
||||
static const H5O_layout_t H5D_def_layout_contig_g = H5D_DEF_LAYOUT_CONTIG;
|
||||
static const H5O_layout_t H5D_def_layout_chunk_g = H5D_DEF_LAYOUT_CHUNK;
|
||||
static const H5O_layout_t H5D_def_layout_virtual_g = H5D_DEF_LAYOUT_VIRTUAL;
|
||||
#else /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
|
||||
static H5O_layout_t H5D_def_layout_compact_g = H5D_DEF_LAYOUT_COMPACT;
|
||||
static H5O_layout_t H5D_def_layout_contig_g = H5D_DEF_LAYOUT_CONTIG;
|
||||
static H5O_layout_t H5D_def_layout_chunk_g = H5D_DEF_LAYOUT_CHUNK;
|
||||
static H5O_layout_t H5D_def_layout_virtual_g = H5D_DEF_LAYOUT_VIRTUAL;
|
||||
static hbool_t H5P_dcrt_def_layout_init_g = FALSE;
|
||||
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__dcrt_reg_prop
|
||||
@@ -1926,47 +1879,6 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__set_layout() */
|
||||
|
||||
#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__init_def_layout
|
||||
*
|
||||
* Purpose: Set the default layout information for the various types of
|
||||
* dataset layouts
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Tuesday, January 13, 2009
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5P__init_def_layout(void)
|
||||
{
|
||||
const H5O_layout_chunk_t def_layout_chunk = H5D_DEF_LAYOUT_CHUNK_INIT;
|
||||
const H5O_storage_compact_t def_store_compact = H5D_DEF_STORAGE_COMPACT_INIT;
|
||||
const H5O_storage_chunk_t def_store_chunk = H5D_DEF_STORAGE_CHUNK_INIT;
|
||||
const H5O_storage_virtual_t def_store_virtual = H5D_DEF_STORAGE_VIRTUAL_INIT;
|
||||
|
||||
FUNC_ENTER_PACKAGE_NOERR
|
||||
|
||||
/* Initialize the default layout info for non-contigous layouts */
|
||||
H5D_def_layout_compact_g.storage.type = H5D_COMPACT;
|
||||
H5D_def_layout_compact_g.storage.u.compact = def_store_compact;
|
||||
H5D_def_layout_chunk_g.u.chunk = def_layout_chunk;
|
||||
H5D_def_layout_chunk_g.storage.type = H5D_CHUNKED;
|
||||
H5D_def_layout_chunk_g.storage.u.chunk = def_store_chunk;
|
||||
H5D_def_layout_virtual_g.storage.type = H5D_VIRTUAL;
|
||||
H5D_def_layout_virtual_g.storage.u.virt = def_store_virtual;
|
||||
|
||||
/* Note that we've initialized the default values */
|
||||
H5P_dcrt_def_layout_init_g = TRUE;
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__init_def_layout() */
|
||||
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_layout
|
||||
*
|
||||
@@ -1997,15 +1909,6 @@ H5Pset_layout(hid_t plist_id, H5D_layout_t layout_type)
|
||||
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
|
||||
HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
|
||||
|
||||
#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER
|
||||
/* If the compiler doesn't support C99 designated initializers, check if
|
||||
* the default layout structs have been initialized yet or not. *ick* -QAK
|
||||
*/
|
||||
if (!H5P_dcrt_def_layout_init_g)
|
||||
if (H5P__init_def_layout() < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info")
|
||||
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
|
||||
|
||||
/* Get pointer to correct default layout */
|
||||
switch (layout_type) {
|
||||
case H5D_COMPACT:
|
||||
@@ -2114,15 +2017,6 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
|
||||
if (!dim)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no chunk dimensions specified")
|
||||
|
||||
#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER
|
||||
/* If the compiler doesn't support C99 designated initializers, check if
|
||||
* the default layout structs have been initialized yet or not. *ick* -QAK
|
||||
*/
|
||||
if (!H5P_dcrt_def_layout_init_g)
|
||||
if (H5P__init_def_layout() < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info")
|
||||
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
|
||||
|
||||
/* Verify & initialize property's chunk dims */
|
||||
H5MM_memcpy(&chunk_layout, &H5D_def_layout_chunk_g, sizeof(H5D_def_layout_chunk_g));
|
||||
HDmemset(&chunk_layout.u.chunk.dim, 0, sizeof(chunk_layout.u.chunk.dim));
|
||||
@@ -2254,15 +2148,6 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const
|
||||
if (H5D_virtual_check_mapping_pre(vspace, src_space, H5O_VIRTUAL_STATUS_USER) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "invalid mapping selections")
|
||||
|
||||
#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER
|
||||
/* If the compiler doesn't support C99 designated initializers, check if
|
||||
* the default layout structs have been initialized yet or not. *ick* -QAK
|
||||
*/
|
||||
if (!H5P_dcrt_def_layout_init_g)
|
||||
if (H5P__init_def_layout() < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info")
|
||||
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
|
||||
|
||||
/* Get the plist structure */
|
||||
if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
|
||||
HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
|
||||
@@ -2734,15 +2619,6 @@ H5Pset_chunk_opts(hid_t plist_id, unsigned options)
|
||||
if (options & ~(H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "unknown chunk options")
|
||||
|
||||
#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER
|
||||
/* If the compiler doesn't support C99 designated initializers, check if
|
||||
* the default layout structs have been initialized yet or not. *ick* -QAK
|
||||
*/
|
||||
if (!H5P_dcrt_def_layout_init_g)
|
||||
if (H5P__init_def_layout() < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info")
|
||||
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
|
||||
|
||||
/* Get the plist structure */
|
||||
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
|
||||
HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
|
||||
@@ -2794,15 +2670,6 @@ H5Pget_chunk_opts(hid_t plist_id, unsigned *options /*out*/)
|
||||
FUNC_ENTER_API(FAIL)
|
||||
H5TRACE2("e", "ix", plist_id, options);
|
||||
|
||||
#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER
|
||||
/* If the compiler doesn't support C99 designated initializers, check if
|
||||
* the default layout structs have been initialized yet or not. *ick* -QAK
|
||||
*/
|
||||
if (!H5P_dcrt_def_layout_init_g)
|
||||
if (H5P__init_def_layout() < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info")
|
||||
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
|
||||
|
||||
/* Get the plist structure */
|
||||
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
|
||||
HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
|
||||
@@ -2995,8 +2862,17 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out
|
||||
/* Return values */
|
||||
if (name_size > 0 && name)
|
||||
HDstrncpy(name, efl.slot[idx].name, name_size);
|
||||
/* XXX: Badness!
|
||||
*
|
||||
* The offset parameter is of type off_t and the offset field of H5O_efl_entry_t
|
||||
* is HDoff_t which is a different type on Windows (off_t is a 32-bit long,
|
||||
* HDoff_t is __int64, a 64-bit type).
|
||||
*
|
||||
* In a future API reboot, we'll either want to make this parameter a haddr_t
|
||||
* or define a 64-bit HDF5-specific offset type that is platform-independent.
|
||||
*/
|
||||
if (offset)
|
||||
*offset = efl.slot[idx].offset;
|
||||
*offset = (off_t)efl.slot[idx].offset;
|
||||
if (size)
|
||||
*size = efl.slot[idx].size;
|
||||
|
||||
|
||||
+6
-1
@@ -546,8 +546,13 @@ static const hbool_t H5F_def_use_file_locking_g =
|
||||
H5F_ACS_USE_FILE_LOCKING_DEF; /* Default use file locking flag */
|
||||
static const hbool_t H5F_def_ignore_disabled_file_locks_g =
|
||||
H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_DEF; /* Default ignore disabled file locks flag */
|
||||
/* The VFD SWMR struct contains multiple large strings and triggers size
|
||||
* warnings. We'll disable this for now and revisit later.
|
||||
*/
|
||||
H5_GCC_CLANG_DIAG_OFF("larger-than=")
|
||||
static const H5F_vfd_swmr_config_t H5F_def_vfd_swmr_config_g =
|
||||
H5F_ACS_VFD_SWMR_CONFIG_DEF; /* Default vfd swmr configuration */
|
||||
H5_GCC_CLANG_DIAG_ON("larger-than=")
|
||||
/* For VFD SWMR testing only: Default to generate checksum for metadata file */
|
||||
static const H5F_generate_md_ck_t H5F_def_generate_md_ck_cb_g = H5F_ACS_GENERATE_MD_CK_CB_DEF;
|
||||
|
||||
@@ -1221,7 +1226,7 @@ done:
|
||||
*
|
||||
* Purpose: Set the file driver (DRIVER_ID) for a file access
|
||||
* property list (PLIST_ID) and supply an optional
|
||||
* struct containing the driver-specific properites
|
||||
* struct containing the driver-specific properties
|
||||
* (DRIVER_INFO). The driver properties will be copied into the
|
||||
* property list and the reference count on the driver will be
|
||||
* incremented, allowing the caller to close the driver ID but
|
||||
|
||||
@@ -5789,6 +5789,9 @@ H5_DLL herr_t H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize);
|
||||
* are null pointers then the corresponding information is not
|
||||
* returned.
|
||||
*
|
||||
* \note On Windows, off_t is typically a 32-bit signed long value, which
|
||||
* limits the valid offset that can be returned to 2 GiB.
|
||||
*
|
||||
* \version 1.6.4 \p idx parameter type changed to unsigned.
|
||||
* \since 1.0.0
|
||||
*
|
||||
|
||||
+1
-1
@@ -1076,7 +1076,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, unsigned type_id,
|
||||
ssize_t index_num;
|
||||
htri_t tri_ret;
|
||||
#ifndef NDEBUG
|
||||
unsigned deferred_type = -1U;
|
||||
unsigned deferred_type = UINT_MAX;
|
||||
#endif
|
||||
htri_t ret_value = TRUE;
|
||||
|
||||
|
||||
+1
-1
@@ -11544,7 +11544,7 @@ H5S__hyper_proj_int_iterate(H5S_hyper_span_info_t *ss_span_info, const H5S_hyper
|
||||
H5S_HYPER_PROJ_INT_ADD_SKIP(
|
||||
udata,
|
||||
H5S__hyper_spans_nelem_helper((H5S_hyper_span_info_t *)ss_span_info, 0, udata->op_gen) * count,
|
||||
FAIL); /* Casting away const OK -NAF */
|
||||
FAIL);
|
||||
|
||||
/* Clean up if we are done */
|
||||
if (depth == 0) {
|
||||
|
||||
@@ -473,35 +473,21 @@ hid_t H5T_NATIVE_INT_FAST64_g = FAIL;
|
||||
hid_t H5T_NATIVE_UINT_FAST64_g = FAIL;
|
||||
|
||||
/*
|
||||
* Alignment constraints for native types. These are initialized at run time
|
||||
* in H5Tinit.c. These alignments are mainly for offsets in HDF5 compound
|
||||
* datatype or C structures, which are different from the alignments for memory
|
||||
* address below this group of variables.
|
||||
* Alignment constraints for HDF5 types. Accessing objects of these
|
||||
* types with improper alignment invokes C undefined behavior, so the
|
||||
* library lays out objects with correct alignment, always.
|
||||
*
|
||||
* A value of N indicates that the data must be aligned on an address
|
||||
* ADDR such that 0 == ADDR mod N. When N=1 no alignment is required;
|
||||
* N=0 implies that alignment constraints were not calculated. These
|
||||
* values are used for structure alignment.
|
||||
*/
|
||||
size_t H5T_NATIVE_SCHAR_COMP_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_UCHAR_COMP_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_SHORT_COMP_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_USHORT_COMP_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_INT_COMP_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_UINT_COMP_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_LONG_COMP_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_ULONG_COMP_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_LLONG_COMP_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_ULLONG_COMP_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_FLOAT_COMP_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_DOUBLE_COMP_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_LDOUBLE_COMP_ALIGN_g = 0;
|
||||
size_t H5T_POINTER_ALIGN_g = 0;
|
||||
size_t H5T_HVL_ALIGN_g = 0;
|
||||
size_t H5T_HOBJREF_ALIGN_g = 0;
|
||||
size_t H5T_HDSETREGREF_ALIGN_g = 0;
|
||||
size_t H5T_REF_ALIGN_g = 0;
|
||||
|
||||
size_t H5T_POINTER_COMP_ALIGN_g = 0;
|
||||
size_t H5T_HVL_COMP_ALIGN_g = 0;
|
||||
size_t H5T_HOBJREF_COMP_ALIGN_g = 0;
|
||||
size_t H5T_HDSETREGREF_COMP_ALIGN_g = 0;
|
||||
size_t H5T_REF_COMP_ALIGN_g = 0;
|
||||
|
||||
/*
|
||||
* Alignment constraints for native types. These are initialized at run time
|
||||
* in H5Tinit.c
|
||||
*/
|
||||
size_t H5T_NATIVE_SCHAR_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_UCHAR_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_SHORT_ALIGN_g = 0;
|
||||
@@ -777,6 +763,9 @@ H5T_init(void)
|
||||
if (H5T__init_native() < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface")
|
||||
|
||||
if (H5T__init_native_internal() < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize integers")
|
||||
|
||||
/* Get the atomic datatype structures needed by the initialization code below */
|
||||
if (NULL == (native_schar = (H5T_t *)H5I_object(H5T_NATIVE_SCHAR_g)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object")
|
||||
|
||||
+20
-12
@@ -3266,9 +3266,10 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si
|
||||
/* If we're down to the last few elements, just wrap up */
|
||||
/* with a "real" reverse copy */
|
||||
if (safe < 2) {
|
||||
s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride;
|
||||
d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride;
|
||||
b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride;
|
||||
s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride;
|
||||
d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride;
|
||||
if (bkg)
|
||||
b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride;
|
||||
s_stride = -s_stride;
|
||||
d_stride = -d_stride;
|
||||
b_stride = -b_stride;
|
||||
@@ -3278,7 +3279,8 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si
|
||||
else {
|
||||
s = (uint8_t *)buf + (nelmts - safe) * (size_t)s_stride;
|
||||
d = (uint8_t *)buf + (nelmts - safe) * (size_t)d_stride;
|
||||
b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride;
|
||||
if (bkg)
|
||||
b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride;
|
||||
} /* end else */
|
||||
} /* end if */
|
||||
else {
|
||||
@@ -3406,8 +3408,8 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si
|
||||
/* For nested VL case, free leftover heap objects from the deeper level if the
|
||||
* length of new data elements is shorter than the old data elements.*/
|
||||
if (nested && seq_len < bg_seq_len) {
|
||||
const uint8_t *tmp;
|
||||
size_t u;
|
||||
uint8_t *tmp;
|
||||
size_t u;
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(write_to_file);
|
||||
@@ -3426,7 +3428,9 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si
|
||||
/* Advance pointers */
|
||||
s += s_stride;
|
||||
d += d_stride;
|
||||
b += b_stride;
|
||||
|
||||
if (b)
|
||||
b += b_stride;
|
||||
} /* end for */
|
||||
|
||||
/* Decrement number of elements left to convert */
|
||||
@@ -3716,9 +3720,10 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
|
||||
/* If we're down to the last few elements, just wrap up */
|
||||
/* with a "real" reverse copy */
|
||||
if (safe < 2) {
|
||||
s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride;
|
||||
d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride;
|
||||
b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride;
|
||||
s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride;
|
||||
d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride;
|
||||
if (bkg)
|
||||
b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride;
|
||||
s_stride = -s_stride;
|
||||
d_stride = -d_stride;
|
||||
b_stride = -b_stride;
|
||||
@@ -3728,7 +3733,8 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
|
||||
else {
|
||||
s = (uint8_t *)buf + (nelmts - safe) * (size_t)s_stride;
|
||||
d = (uint8_t *)buf + (nelmts - safe) * (size_t)d_stride;
|
||||
b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride;
|
||||
if (bkg)
|
||||
b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride;
|
||||
} /* end else */
|
||||
} /* end if */
|
||||
else {
|
||||
@@ -3796,7 +3802,9 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
|
||||
/* Advance pointers */
|
||||
s += s_stride;
|
||||
d += d_stride;
|
||||
b += b_stride;
|
||||
|
||||
if (b)
|
||||
b += b_stride;
|
||||
} /* end for */
|
||||
|
||||
/* Decrement number of elements left to convert */
|
||||
|
||||
+347
-15
@@ -177,13 +177,13 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
|
||||
|
||||
if (H5T_IS_VL_STRING(dtype->shared)) {
|
||||
/* Update size, offset and compound alignment for parent. */
|
||||
if (H5T__cmp_offset(comp_size, offset, sizeof(char *), (size_t)1, H5T_POINTER_COMP_ALIGN_g,
|
||||
if (H5T__cmp_offset(comp_size, offset, sizeof(char *), (size_t)1, H5T_POINTER_ALIGN_g,
|
||||
struct_align) < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset")
|
||||
} /* end if */
|
||||
else {
|
||||
/* Update size, offset and compound alignment for parent. */
|
||||
if (H5T__cmp_offset(comp_size, offset, sizeof(char), size, H5T_NATIVE_SCHAR_COMP_ALIGN_g,
|
||||
if (H5T__cmp_offset(comp_size, offset, sizeof(char), size, H5T_NATIVE_SCHAR_ALIGN_g,
|
||||
struct_align) < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset")
|
||||
} /* end else */
|
||||
@@ -208,7 +208,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type")
|
||||
|
||||
/* Update size, offset and compound alignment for parent. */
|
||||
if (H5T__cmp_offset(comp_size, offset, sizeof(char), size, H5T_NATIVE_SCHAR_COMP_ALIGN_g,
|
||||
if (H5T__cmp_offset(comp_size, offset, sizeof(char), size, H5T_NATIVE_SCHAR_ALIGN_g,
|
||||
struct_align) < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset")
|
||||
break;
|
||||
@@ -227,7 +227,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
|
||||
|
||||
/* Update size, offset and compound alignment for parent. */
|
||||
if (0 == H5T_cmp(ret_value, dt, FALSE)) {
|
||||
align = H5T_HOBJREF_COMP_ALIGN_g;
|
||||
align = H5T_HOBJREF_ALIGN_g;
|
||||
ref_size = sizeof(hobj_ref_t);
|
||||
} /* end if */
|
||||
else {
|
||||
@@ -236,12 +236,12 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type")
|
||||
|
||||
if (0 == H5T_cmp(ret_value, dt, FALSE)) {
|
||||
align = H5T_HDSETREGREF_COMP_ALIGN_g;
|
||||
align = H5T_HDSETREGREF_ALIGN_g;
|
||||
ref_size = sizeof(hdset_reg_ref_t);
|
||||
} /* end if */
|
||||
else {
|
||||
/* Only pointers to underlying opaque reference types */
|
||||
align = H5T_REF_COMP_ALIGN_g;
|
||||
align = H5T_REF_ALIGN_g;
|
||||
ref_size = sizeof(H5R_ref_t);
|
||||
} /* end else */
|
||||
} /* end else */
|
||||
@@ -479,7 +479,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype")
|
||||
|
||||
/* Update size, offset and compound alignment for parent compound type directly. */
|
||||
vl_align = H5T_HVL_COMP_ALIGN_g;
|
||||
vl_align = H5T_HVL_ALIGN_g;
|
||||
vl_size = sizeof(hvl_t);
|
||||
|
||||
if (H5T__cmp_offset(comp_size, offset, vl_size, (size_t)1, vl_align, struct_align) < 0)
|
||||
@@ -625,7 +625,7 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
|
||||
else
|
||||
tid = H5T_NATIVE_UCHAR;
|
||||
|
||||
align = H5T_NATIVE_SCHAR_COMP_ALIGN_g;
|
||||
align = H5T_NATIVE_SCHAR_ALIGN_g;
|
||||
break;
|
||||
|
||||
case H5T_NATIVE_INT_MATCH_SHORT:
|
||||
@@ -633,7 +633,7 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
|
||||
tid = H5T_NATIVE_SHORT;
|
||||
else
|
||||
tid = H5T_NATIVE_USHORT;
|
||||
align = H5T_NATIVE_SHORT_COMP_ALIGN_g;
|
||||
align = H5T_NATIVE_SHORT_ALIGN_g;
|
||||
break;
|
||||
|
||||
case H5T_NATIVE_INT_MATCH_INT:
|
||||
@@ -642,7 +642,7 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
|
||||
else
|
||||
tid = H5T_NATIVE_UINT;
|
||||
|
||||
align = H5T_NATIVE_INT_COMP_ALIGN_g;
|
||||
align = H5T_NATIVE_INT_ALIGN_g;
|
||||
break;
|
||||
|
||||
case H5T_NATIVE_INT_MATCH_LONG:
|
||||
@@ -651,7 +651,7 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
|
||||
else
|
||||
tid = H5T_NATIVE_ULONG;
|
||||
|
||||
align = H5T_NATIVE_LONG_COMP_ALIGN_g;
|
||||
align = H5T_NATIVE_LONG_ALIGN_g;
|
||||
break;
|
||||
|
||||
case H5T_NATIVE_INT_MATCH_LLONG:
|
||||
@@ -660,7 +660,7 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
|
||||
else
|
||||
tid = H5T_NATIVE_ULLONG;
|
||||
|
||||
align = H5T_NATIVE_LLONG_COMP_ALIGN_g;
|
||||
align = H5T_NATIVE_LLONG_ALIGN_g;
|
||||
break;
|
||||
|
||||
case H5T_NATIVE_INT_MATCH_UNKNOWN:
|
||||
@@ -764,17 +764,17 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
|
||||
switch (match) {
|
||||
case H5T_NATIVE_FLOAT_MATCH_FLOAT:
|
||||
tid = H5T_NATIVE_FLOAT;
|
||||
align = H5T_NATIVE_FLOAT_COMP_ALIGN_g;
|
||||
align = H5T_NATIVE_FLOAT_ALIGN_g;
|
||||
break;
|
||||
|
||||
case H5T_NATIVE_FLOAT_MATCH_DOUBLE:
|
||||
tid = H5T_NATIVE_DOUBLE;
|
||||
align = H5T_NATIVE_DOUBLE_COMP_ALIGN_g;
|
||||
align = H5T_NATIVE_DOUBLE_ALIGN_g;
|
||||
break;
|
||||
|
||||
case H5T_NATIVE_FLOAT_MATCH_LDOUBLE:
|
||||
tid = H5T_NATIVE_LDOUBLE;
|
||||
align = H5T_NATIVE_LDOUBLE_COMP_ALIGN_g;
|
||||
align = H5T_NATIVE_LDOUBLE_ALIGN_g;
|
||||
break;
|
||||
|
||||
case H5T_NATIVE_FLOAT_MATCH_UNKNOWN:
|
||||
@@ -940,3 +940,335 @@ H5T__cmp_offset(size_t *comp_size, size_t *offset, size_t elem_size, size_t nele
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5T__cmp_offset() */
|
||||
|
||||
#define TAG_ALIGNMENT(tag) (offsetof(alignments_t, tag.x) - offsetof(alignments_t, tag))
|
||||
|
||||
/* clang-format off */
|
||||
#define NATIVE_ENTRY_INITIALIZER(tag, type, precision, has_sign) { \
|
||||
.alignmentp = &H5T_NATIVE_##tag##_ALIGN_g \
|
||||
, .alignment = TAG_ALIGNMENT(tag) \
|
||||
, .hidp = &H5T_NATIVE_##tag##_g \
|
||||
, .size = sizeof(type) \
|
||||
, .atomic = { \
|
||||
.offset = 0 \
|
||||
, .prec = (precision != 0) ? precision : (sizeof(type) * 8) \
|
||||
, .lsb_pad = H5T_PAD_ZERO \
|
||||
, .msb_pad = H5T_PAD_ZERO \
|
||||
, .u.i.sign = has_sign ? H5T_SGN_2 : H5T_SGN_NONE \
|
||||
} \
|
||||
}
|
||||
/* clang-format on */
|
||||
|
||||
static H5T_order_t
|
||||
get_host_byte_order(void)
|
||||
{
|
||||
static const union {
|
||||
uint64_t u64;
|
||||
char byte[8];
|
||||
} endian_exemplar = {.byte = {1}};
|
||||
|
||||
return (endian_exemplar.u64 == 1) ? H5T_ORDER_LE : H5T_ORDER_BE;
|
||||
}
|
||||
|
||||
/* Establish `H5T_t`s for C99 integer types including fixed- and
|
||||
* minimum-width types (uint16_t, uint_least16_t, uint_fast16_t, ...).
|
||||
*
|
||||
* Also establish alignment for some miscellaneous types: pointers,
|
||||
* HDF5 references, and so on.
|
||||
*/
|
||||
herr_t
|
||||
H5T__init_native_internal(void)
|
||||
{
|
||||
/* Here we construct a type that lets us find alignment constraints
|
||||
* without using the alignof operator, which is not available in C99.
|
||||
*
|
||||
* Between each sub-struct's `char` member `c` and member `x`, the
|
||||
* compiler must insert padding to ensure proper alignment of `x`.
|
||||
* We can find the alignment constraint of each `x` by looking at
|
||||
* its offset from the beginning of its sub-struct.
|
||||
*/
|
||||
typedef struct {
|
||||
struct {
|
||||
char c;
|
||||
signed char x;
|
||||
} SCHAR;
|
||||
struct {
|
||||
char c;
|
||||
unsigned char x;
|
||||
} UCHAR;
|
||||
struct {
|
||||
char c;
|
||||
short x;
|
||||
} SHORT;
|
||||
struct {
|
||||
char c;
|
||||
unsigned short x;
|
||||
} USHORT;
|
||||
struct {
|
||||
char c;
|
||||
int x;
|
||||
} INT;
|
||||
struct {
|
||||
char c;
|
||||
unsigned int x;
|
||||
} UINT;
|
||||
struct {
|
||||
char c;
|
||||
long x;
|
||||
} LONG;
|
||||
struct {
|
||||
char c;
|
||||
unsigned long x;
|
||||
} ULONG;
|
||||
struct {
|
||||
char c;
|
||||
long long x;
|
||||
} LLONG;
|
||||
struct {
|
||||
char c;
|
||||
unsigned long long x;
|
||||
} ULLONG;
|
||||
struct {
|
||||
char c;
|
||||
int8_t x;
|
||||
} INT8;
|
||||
struct {
|
||||
char c;
|
||||
uint8_t x;
|
||||
} UINT8;
|
||||
struct {
|
||||
char c;
|
||||
int_least8_t x;
|
||||
} INT_LEAST8;
|
||||
struct {
|
||||
char c;
|
||||
uint_least8_t x;
|
||||
} UINT_LEAST8;
|
||||
struct {
|
||||
char c;
|
||||
int_fast8_t x;
|
||||
} INT_FAST8;
|
||||
struct {
|
||||
char c;
|
||||
uint_fast8_t x;
|
||||
} UINT_FAST8;
|
||||
struct {
|
||||
char c;
|
||||
int16_t x;
|
||||
} INT16;
|
||||
struct {
|
||||
char c;
|
||||
uint16_t x;
|
||||
} UINT16;
|
||||
struct {
|
||||
char c;
|
||||
int_least16_t x;
|
||||
} INT_LEAST16;
|
||||
struct {
|
||||
char c;
|
||||
uint_least16_t x;
|
||||
} UINT_LEAST16;
|
||||
struct {
|
||||
char c;
|
||||
int_fast16_t x;
|
||||
} INT_FAST16;
|
||||
struct {
|
||||
char c;
|
||||
uint_fast16_t x;
|
||||
} UINT_FAST16;
|
||||
struct {
|
||||
char c;
|
||||
int32_t x;
|
||||
} INT32;
|
||||
struct {
|
||||
char c;
|
||||
uint32_t x;
|
||||
} UINT32;
|
||||
struct {
|
||||
char c;
|
||||
int_least32_t x;
|
||||
} INT_LEAST32;
|
||||
struct {
|
||||
char c;
|
||||
uint_least32_t x;
|
||||
} UINT_LEAST32;
|
||||
struct {
|
||||
char c;
|
||||
int_fast32_t x;
|
||||
} INT_FAST32;
|
||||
struct {
|
||||
char c;
|
||||
uint_fast32_t x;
|
||||
} UINT_FAST32;
|
||||
struct {
|
||||
char c;
|
||||
int64_t x;
|
||||
} INT64;
|
||||
struct {
|
||||
char c;
|
||||
uint64_t x;
|
||||
} UINT64;
|
||||
struct {
|
||||
char c;
|
||||
int_least64_t x;
|
||||
} INT_LEAST64;
|
||||
struct {
|
||||
char c;
|
||||
uint_least64_t x;
|
||||
} UINT_LEAST64;
|
||||
struct {
|
||||
char c;
|
||||
int_fast64_t x;
|
||||
} INT_FAST64;
|
||||
struct {
|
||||
char c;
|
||||
uint_fast64_t x;
|
||||
} UINT_FAST64;
|
||||
struct {
|
||||
char c;
|
||||
void *x;
|
||||
} pointer;
|
||||
struct {
|
||||
char c;
|
||||
hvl_t x;
|
||||
} hvl;
|
||||
struct {
|
||||
char c;
|
||||
hobj_ref_t x;
|
||||
} hobjref;
|
||||
struct {
|
||||
char c;
|
||||
hdset_reg_ref_t x;
|
||||
} hdsetregref;
|
||||
struct {
|
||||
char c;
|
||||
H5R_ref_t x;
|
||||
} ref;
|
||||
} alignments_t;
|
||||
|
||||
/* Describe a C99 type, `type`, and tell where to write its
|
||||
* H5T_t identifier and alignment. Tables of these descriptions
|
||||
* drive the initialization of `H5T_t`s.
|
||||
*/
|
||||
typedef struct {
|
||||
/* Pointer to the global variable that receives the
|
||||
* alignment of `type`:
|
||||
*/
|
||||
size_t *alignmentp;
|
||||
size_t alignment; // natural alignment of `type`
|
||||
/* Pointer to the global variable that receives the
|
||||
* identifier for `type`'s H5T_t:
|
||||
*/
|
||||
hid_t * hidp;
|
||||
size_t size; // sizeof(`type`)
|
||||
H5T_atomic_t atomic; // `type` facts such as signedness
|
||||
} native_int_t;
|
||||
|
||||
typedef struct {
|
||||
const native_int_t *table;
|
||||
size_t nelmts;
|
||||
} native_int_table_t;
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
/* Version 19.10 of the PGI C compiler croaks on the following
|
||||
* tables if they are `static`, so make them `static` only if
|
||||
* some other compiler is used.
|
||||
*/
|
||||
#if defined(__PGIC__) && __PGIC__ == 19 && __PGIC_MINOR__ == 10
|
||||
# define static_unless_buggy_pgic
|
||||
#else
|
||||
# define static_unless_buggy_pgic static
|
||||
#endif
|
||||
|
||||
/* The library compiles with a limit on `static` object size, so
|
||||
* I broke this table into three.
|
||||
*/
|
||||
static_unless_buggy_pgic const native_int_t table1[] = {
|
||||
NATIVE_ENTRY_INITIALIZER(SCHAR, signed char, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(UCHAR, unsigned char, 0, false)
|
||||
, NATIVE_ENTRY_INITIALIZER(SHORT, short, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(USHORT, unsigned short, 0, false)
|
||||
, NATIVE_ENTRY_INITIALIZER(INT, int, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(UINT, unsigned int, 0, false)
|
||||
, NATIVE_ENTRY_INITIALIZER(INT, int, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(UINT, unsigned int, 0, false)
|
||||
, NATIVE_ENTRY_INITIALIZER(LONG, long, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(ULONG, unsigned long, 0, false)
|
||||
, NATIVE_ENTRY_INITIALIZER(LLONG, long long, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(ULLONG, unsigned long long, 0, false)
|
||||
};
|
||||
static_unless_buggy_pgic const native_int_t table2[] = {
|
||||
NATIVE_ENTRY_INITIALIZER(INT8, int8_t, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(UINT8, uint8_t, 0, false)
|
||||
, NATIVE_ENTRY_INITIALIZER(INT_LEAST8, int_least8_t, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(UINT_LEAST8, uint_least8_t, 0, false)
|
||||
, NATIVE_ENTRY_INITIALIZER(INT_FAST8, int_fast8_t, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(UINT_FAST8, uint_fast8_t, 0, false)
|
||||
, NATIVE_ENTRY_INITIALIZER(INT16, int16_t, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(UINT16, uint16_t, 0, false)
|
||||
, NATIVE_ENTRY_INITIALIZER(INT_LEAST16, int_least16_t, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(UINT_LEAST16, uint_least16_t, 0, false)
|
||||
, NATIVE_ENTRY_INITIALIZER(INT_FAST16, int_fast16_t, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(UINT_FAST16, uint_fast16_t, 0, false)
|
||||
};
|
||||
static_unless_buggy_pgic const native_int_t table3[] = {
|
||||
NATIVE_ENTRY_INITIALIZER(INT32, int32_t, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(UINT32, uint32_t, 0, false)
|
||||
, NATIVE_ENTRY_INITIALIZER(INT_LEAST32, int_least32_t, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(UINT_LEAST32, uint_least32_t, 0, false)
|
||||
, NATIVE_ENTRY_INITIALIZER(INT_FAST32, int_fast32_t, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(UINT_FAST32, uint_fast32_t, 0, false)
|
||||
, NATIVE_ENTRY_INITIALIZER(INT64, int64_t, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(UINT64, uint64_t, 0, false)
|
||||
, NATIVE_ENTRY_INITIALIZER(INT_LEAST64, int_least64_t, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(UINT_LEAST64, uint_least64_t, 0, false)
|
||||
, NATIVE_ENTRY_INITIALIZER(INT_FAST64, int_fast64_t, 0, true)
|
||||
, NATIVE_ENTRY_INITIALIZER(UINT_FAST64, uint_fast64_t, 0, false)
|
||||
};
|
||||
static_unless_buggy_pgic const native_int_table_t table_table[] = {
|
||||
{table1, NELMTS(table1)}
|
||||
, {table2, NELMTS(table2)}
|
||||
, {table3, NELMTS(table3)}
|
||||
};
|
||||
#undef static_unless_buggy_pgic
|
||||
/* clang-format on */
|
||||
|
||||
size_t i, j;
|
||||
H5T_order_t byte_order = get_host_byte_order();
|
||||
|
||||
for (i = 0; i < NELMTS(table_table); i++) {
|
||||
const native_int_t *table = table_table[i].table;
|
||||
size_t nelmts = table_table[i].nelmts;
|
||||
|
||||
/* For each C99 type in `table`, create its H5T_t,
|
||||
* register a hid_t for the H5T_t, and record the type's
|
||||
* alignment and hid_t in the variables named by the
|
||||
* table.
|
||||
*/
|
||||
for (j = 0; j < nelmts; j++) {
|
||||
H5T_t *dt;
|
||||
|
||||
if (NULL == (dt = H5T__alloc()))
|
||||
return FAIL;
|
||||
|
||||
dt->shared->state = H5T_STATE_IMMUTABLE;
|
||||
dt->shared->type = H5T_INTEGER;
|
||||
dt->shared->size = table[j].size;
|
||||
dt->shared->u.atomic = table[j].atomic;
|
||||
dt->shared->u.atomic.order = byte_order;
|
||||
*table[j].alignmentp = table[j].alignment;
|
||||
|
||||
if ((*table[j].hidp = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
H5T_POINTER_ALIGN_g = TAG_ALIGNMENT(pointer);
|
||||
H5T_HVL_ALIGN_g = TAG_ALIGNMENT(hvl);
|
||||
H5T_HOBJREF_ALIGN_g = TAG_ALIGNMENT(hobjref);
|
||||
H5T_HDSETREGREF_ALIGN_g = TAG_ALIGNMENT(hdsetregref);
|
||||
H5T_REF_ALIGN_g = TAG_ALIGNMENT(ref);
|
||||
|
||||
return SUCCEED;
|
||||
}
|
||||
|
||||
+17
-20
@@ -287,7 +287,7 @@ typedef herr_t (*H5T_vlen_setnull_func_t)(H5VL_object_t *file, void *_vl, void *
|
||||
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);
|
||||
typedef herr_t (*H5T_vlen_delete_func_t)(H5VL_object_t *file, void *_vl);
|
||||
|
||||
/* VL datatype callbacks */
|
||||
typedef struct H5T_vlen_class_t {
|
||||
@@ -388,26 +388,22 @@ typedef herr_t (*H5T_operator_t)(H5T_t *dt, void *op_data /*in,out*/);
|
||||
H5_DLLVAR const unsigned H5O_dtype_ver_bounds[H5F_LIBVER_NBOUNDS];
|
||||
|
||||
/*
|
||||
* Alignment information for native types. A value of N indicates that the
|
||||
* data must be aligned on an address ADDR such that 0 == ADDR mod N. When
|
||||
* N=1 no alignment is required; N=0 implies that alignment constraints were
|
||||
* not calculated. These alignment info is only for H5Tget_native_type.
|
||||
* These values are used for structure alignment.
|
||||
* Alignment constraints for HDF5 types. Accessing objects of these
|
||||
* types with improper alignment invokes C undefined behavior, so the
|
||||
* library lays out objects with correct alignment, always.
|
||||
*
|
||||
* A value of N indicates that the data must be aligned on an address
|
||||
* ADDR such that 0 == ADDR mod N. When N=1 no alignment is required;
|
||||
* N=0 implies that alignment constraints were not calculated. These
|
||||
* values are used for structure alignment.
|
||||
*
|
||||
* This alignment info is only for H5Tget_native_type.
|
||||
*/
|
||||
H5_DLLVAR size_t H5T_NATIVE_SCHAR_COMP_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_NATIVE_SHORT_COMP_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_NATIVE_INT_COMP_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_NATIVE_LONG_COMP_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_NATIVE_LLONG_COMP_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_NATIVE_FLOAT_COMP_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_NATIVE_DOUBLE_COMP_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_NATIVE_LDOUBLE_COMP_ALIGN_g;
|
||||
|
||||
H5_DLLVAR size_t H5T_POINTER_COMP_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_HVL_COMP_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_HOBJREF_COMP_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_HDSETREGREF_COMP_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_REF_COMP_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_POINTER_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_HVL_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_HOBJREF_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_HDSETREGREF_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_REF_ALIGN_g;
|
||||
|
||||
/*
|
||||
* Alignment information for native types. A value of N indicates that the
|
||||
@@ -473,6 +469,7 @@ H5FL_EXTERN(H5T_shared_t);
|
||||
|
||||
/* Common functions */
|
||||
H5_DLL herr_t H5T__init_native(void);
|
||||
H5_DLL herr_t H5T__init_native_internal(void);
|
||||
H5_DLL H5T_t *H5T__create(H5T_class_t type, size_t size);
|
||||
H5_DLL H5T_t *H5T__alloc(void);
|
||||
H5_DLL herr_t H5T__free(H5T_t *dt);
|
||||
|
||||
+11
-2
@@ -638,8 +638,8 @@ done:
|
||||
*/
|
||||
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 H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t dst_size,
|
||||
void H5_ATTR_UNUSED *bg_buf)
|
||||
H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf,
|
||||
size_t H5_ATTR_NDEBUG_UNUSED dst_size, void H5_ATTR_UNUSED *bg_buf)
|
||||
{
|
||||
H5F_t * src_f = NULL;
|
||||
hid_t file_id = H5I_INVALID_HID;
|
||||
@@ -753,6 +753,14 @@ done:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
* It is the correct thing to do to have the reference buffer
|
||||
* be const-qualified here, but the VOL "blob specific" routine
|
||||
* needs a non-const pointer since an operation might modify
|
||||
* the "blob". Disable this warning here (at least temporarily)
|
||||
* for this reason.
|
||||
*/
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
static herr_t
|
||||
H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull)
|
||||
{
|
||||
@@ -792,6 +800,7 @@ H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5T__ref_disk_isnull() */
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5T__ref_disk_setnull
|
||||
|
||||
+8
-8
@@ -76,7 +76,7 @@ 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);
|
||||
static herr_t H5T__vlen_disk_delete(H5VL_object_t *file, void *_vl);
|
||||
|
||||
/*********************/
|
||||
/* Public Variables */
|
||||
@@ -917,9 +917,9 @@ static herr_t
|
||||
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)
|
||||
{
|
||||
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 */
|
||||
uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
|
||||
uint8_t *bg = (uint8_t *)_bg; /* Pointer to the old data hvl_t */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_PACKAGE
|
||||
|
||||
@@ -957,10 +957,10 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl)
|
||||
H5T__vlen_disk_delete(H5VL_object_t *file, void *_vl)
|
||||
{
|
||||
const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_PACKAGE
|
||||
|
||||
@@ -981,7 +981,7 @@ H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl)
|
||||
/* Set up VOL callback arguments */
|
||||
vol_cb_args.op_type = H5VL_BLOB_DELETE;
|
||||
|
||||
if (H5VL_blob_specific(file, (void *)vl, &vol_cb_args) < 0) /* Casting away 'const' OK -QAK */
|
||||
if (H5VL_blob_specific(file, vl, &vol_cb_args) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob")
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
|
||||
+30
-657
@@ -49,11 +49,6 @@ static const char *FileHeader = "\n\
|
||||
#include "H5Tpublic.h"
|
||||
#include "H5Rpublic.h"
|
||||
|
||||
/* Disable warning about cast increasing the alignment of the target type,
|
||||
* that's _exactly_ what this code is probing. -QAK
|
||||
*/
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-align")
|
||||
|
||||
#if defined(__has_attribute)
|
||||
#if __has_attribute(no_sanitize_address)
|
||||
#define HDF_NO_UBSAN __attribute__((no_sanitize_address))
|
||||
@@ -66,30 +61,6 @@ H5_GCC_CLANG_DIAG_OFF("cast-align")
|
||||
|
||||
#define MAXDETECT 64
|
||||
|
||||
/* The ALIGNMENT test code may generate the SIGBUS, SIGSEGV, or SIGILL signals.
|
||||
* We use setjmp/longjmp in the signal handlers for recovery. But setjmp/longjmp
|
||||
* do not necessary restore the signal blocking status while sigsetjmp/siglongjmp
|
||||
* do. If sigsetjmp/siglongjmp are not supported, need to use sigprocmask to
|
||||
* unblock the signal before doing longjmp.
|
||||
*/
|
||||
/* Define H5SETJMP/H5LONGJMP depending on if sigsetjmp/siglongjmp are */
|
||||
/* supported. */
|
||||
#if defined(H5_HAVE_SIGSETJMP) && defined(H5_HAVE_SIGLONGJMP)
|
||||
/* Always save blocked signals to be restored by siglongjmp. */
|
||||
#define H5JMP_BUF sigjmp_buf
|
||||
#define H5SETJMP(buf) HDsigsetjmp(buf, 1)
|
||||
#define H5LONGJMP(buf, val) HDsiglongjmp(buf, val)
|
||||
#define H5HAVE_SIGJMP /* sigsetjmp/siglongjmp are supported. */
|
||||
#else
|
||||
#define H5JMP_BUF jmp_buf
|
||||
#define H5SETJMP(buf) HDsetjmp(buf)
|
||||
#define H5LONGJMP(buf, val) HDlongjmp(buf, val)
|
||||
#endif
|
||||
|
||||
/* ALIGNMENT and signal-handling status codes */
|
||||
#define STA_NoALIGNMENT 0x0001 /* No ALIGNMENT Test */
|
||||
#define STA_NoHandlerVerify 0x0002 /* No signal handler Tests */
|
||||
|
||||
/*
|
||||
* This structure holds information about a type that
|
||||
* was detected.
|
||||
@@ -105,27 +76,18 @@ typedef struct detected_t {
|
||||
unsigned int mpos, msize, imp; /* information about mantissa */
|
||||
unsigned int epos, esize; /* information about exponent */
|
||||
unsigned long bias; /* exponent bias for floating pt */
|
||||
unsigned int align; /* required byte alignment */
|
||||
unsigned int comp_align; /* alignment for structure */
|
||||
} detected_t;
|
||||
|
||||
/* This structure holds structure alignment for pointers, vlen and reference
|
||||
* types. */
|
||||
typedef struct malign_t {
|
||||
const char * name;
|
||||
unsigned int comp_align; /* alignment for structure */
|
||||
} malign_t;
|
||||
|
||||
FILE *rawoutstream = NULL;
|
||||
|
||||
/* global variables types detection code */
|
||||
H5_GCC_DIAG_OFF("larger-than=")
|
||||
static detected_t d_g[MAXDETECT];
|
||||
H5_GCC_DIAG_ON("larger-than=")
|
||||
static malign_t m_g[MAXDETECT];
|
||||
static volatile int nd_g = 0, na_g = 0;
|
||||
static volatile int nd_g = 0;
|
||||
|
||||
static void print_results(int nd, detected_t *d, int na, malign_t *m);
|
||||
static void print_results(int nd, detected_t *d);
|
||||
static void iprint(detected_t *);
|
||||
static int byte_cmp(int, const void *, const void *, const unsigned char *);
|
||||
static unsigned int bit_cmp(unsigned int, int *, void *, void *, const unsigned char *);
|
||||
@@ -134,23 +96,8 @@ static unsigned int imp_bit(unsigned int, int *, void *, void *, const unsigned
|
||||
static unsigned int find_bias(unsigned int, unsigned int, int *, void *);
|
||||
static void precision(detected_t *);
|
||||
static void print_header(void);
|
||||
static void detect_C89_integers(void);
|
||||
static void detect_C89_floats(void);
|
||||
static void detect_C99_integers(void);
|
||||
static void detect_C99_floats(void);
|
||||
static void detect_C99_integers8(void);
|
||||
static void detect_C99_integers16(void);
|
||||
static void detect_C99_integers32(void);
|
||||
static void detect_C99_integers64(void);
|
||||
static void detect_alignments(void);
|
||||
static unsigned int align_g[] = {1, 2, 4, 8, 16};
|
||||
static int align_status_g = 0; /* ALIGNMENT Signal Status */
|
||||
static int sigbus_handler_called_g = 0; /* how many times called */
|
||||
static int sigsegv_handler_called_g = 0; /* how many times called */
|
||||
static int sigill_handler_called_g = 0; /* how many times called */
|
||||
static int signal_handler_tested_g = 0; /* how many times tested */
|
||||
static int verify_signal_handlers(int signum, void (*handler)(int));
|
||||
static H5JMP_BUF jbuf_g;
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: precision
|
||||
@@ -163,104 +110,11 @@ static H5JMP_BUF jbuf_g;
|
||||
static void
|
||||
precision(detected_t *d)
|
||||
{
|
||||
unsigned int n;
|
||||
|
||||
if (0 == d->msize) {
|
||||
/*
|
||||
* An integer. The permutation can have negative values at the
|
||||
* beginning or end which represent padding of bytes. We must adjust
|
||||
* the precision and offset accordingly.
|
||||
*/
|
||||
if (d->perm[0] < 0) {
|
||||
/*
|
||||
* Lower addresses are padded.
|
||||
*/
|
||||
for (n = 0; n < d->size && d->perm[n] < 0; n++)
|
||||
/*void*/;
|
||||
d->precision = 8 * (d->size - n);
|
||||
d->offset = 0;
|
||||
}
|
||||
else if (d->perm[d->size - 1] < 0) {
|
||||
/*
|
||||
* Higher addresses are padded.
|
||||
*/
|
||||
for (n = 0; n < d->size && d->perm[d->size - (n + 1)]; n++)
|
||||
/*void*/;
|
||||
d->precision = 8 * (d->size - n);
|
||||
d->offset = 8 * n;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* No padding.
|
||||
*/
|
||||
d->precision = 8 * d->size;
|
||||
d->offset = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* A floating point */
|
||||
d->offset = MIN3(d->mpos, d->epos, d->sign);
|
||||
d->precision = d->msize + d->esize + 1;
|
||||
}
|
||||
/* A floating point */
|
||||
d->offset = MIN3(d->mpos, d->epos, d->sign);
|
||||
d->precision = d->msize + d->esize + 1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: DETECT_I/DETECT_BYTE
|
||||
*
|
||||
* Purpose: These macro takes a type like `int' and a base name like
|
||||
* `nati' and detects the byte order. The VAR is used to
|
||||
* construct the names of the C variables defined.
|
||||
*
|
||||
* DETECT_I is used for types that are larger than one byte,
|
||||
* DETECT_BYTE is used for types that are exactly one byte.
|
||||
*
|
||||
* Return: void
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#define DETECT_I_BYTE_CORE(TYPE, VAR, INFO, DETECT_TYPE) \
|
||||
{ \
|
||||
DETECT_TYPE _v; \
|
||||
int _i, _j; \
|
||||
unsigned char *_x; \
|
||||
\
|
||||
HDmemset(&INFO, 0, sizeof(INFO)); \
|
||||
INFO.varname = #VAR; \
|
||||
INFO.size = sizeof(TYPE); \
|
||||
\
|
||||
for (_i = sizeof(DETECT_TYPE), _v = 0; _i > 0; --_i) \
|
||||
_v = (DETECT_TYPE)((DETECT_TYPE)(_v << 8) + (DETECT_TYPE)_i); \
|
||||
\
|
||||
for (_i = 0, _x = (unsigned char *)&_v; _i < (signed)sizeof(DETECT_TYPE); _i++) { \
|
||||
_j = (*_x++) - 1; \
|
||||
HDassert(_j < (signed)sizeof(DETECT_TYPE)); \
|
||||
INFO.perm[_i] = _j; \
|
||||
} /* end for */ \
|
||||
\
|
||||
INFO.sign = ('U' != *(#VAR)); \
|
||||
precision(&(INFO)); \
|
||||
ALIGNMENT(TYPE, INFO); \
|
||||
if (!HDstrcmp(INFO.varname, "SCHAR") || !HDstrcmp(INFO.varname, "SHORT") || \
|
||||
!HDstrcmp(INFO.varname, "INT") || !HDstrcmp(INFO.varname, "LONG") || \
|
||||
!HDstrcmp(INFO.varname, "LLONG")) { \
|
||||
COMP_ALIGNMENT(TYPE, INFO.comp_align); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DETECT_BYTE(TYPE, VAR, INFO) \
|
||||
{ \
|
||||
HDcompile_assert(sizeof(TYPE) == 1); \
|
||||
\
|
||||
DETECT_I_BYTE_CORE(TYPE, VAR, INFO, int) \
|
||||
}
|
||||
|
||||
#define DETECT_I(TYPE, VAR, INFO) \
|
||||
{ \
|
||||
HDcompile_assert(sizeof(TYPE) > 1); \
|
||||
\
|
||||
DETECT_I_BYTE_CORE(TYPE, VAR, INFO, TYPE) \
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: DETECT_F
|
||||
*
|
||||
@@ -351,28 +205,12 @@ precision(detected_t *d)
|
||||
_v1 = (TYPE)1.0L; \
|
||||
INFO.bias = find_bias(INFO.epos, INFO.esize, INFO.perm, &_v1); \
|
||||
precision(&(INFO)); \
|
||||
ALIGNMENT(TYPE, INFO); \
|
||||
if (!HDstrcmp(INFO.varname, "FLOAT") || !HDstrcmp(INFO.varname, "DOUBLE") || \
|
||||
!HDstrcmp(INFO.varname, "LDOUBLE")) { \
|
||||
COMP_ALIGNMENT(TYPE, INFO.comp_align); \
|
||||
} \
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: DETECT_M
|
||||
*
|
||||
* Purpose: This macro takes only miscellaneous structures or pointer.
|
||||
* It constructs the names and decides the alignment in structure.
|
||||
*
|
||||
* Return: void
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#define DETECT_M(TYPE, VAR, INFO) \
|
||||
{ \
|
||||
INFO.name = #VAR; \
|
||||
COMP_ALIGNMENT(TYPE, INFO.comp_align); \
|
||||
}
|
||||
|
||||
/* Detect alignment for C structure */
|
||||
#define COMP_ALIGNMENT(TYPE, COMP_ALIGN) \
|
||||
{ \
|
||||
@@ -384,140 +222,6 @@ precision(detected_t *d)
|
||||
COMP_ALIGN = (unsigned int)((char *)(&(s.x)) - (char *)(&s)); \
|
||||
}
|
||||
|
||||
#define ALIGNMENT(TYPE, INFO) \
|
||||
{ \
|
||||
char *volatile _buf = NULL; \
|
||||
TYPE _val = 1, _val2; \
|
||||
volatile size_t _ano = 0; \
|
||||
void (*_handler)(int) = HDsignal(SIGBUS, sigbus_handler); \
|
||||
void (*_handler2)(int) = HDsignal(SIGSEGV, sigsegv_handler); \
|
||||
void (*_handler3)(int) = HDsignal(SIGILL, sigill_handler); \
|
||||
\
|
||||
_buf = (char *)HDmalloc(sizeof(TYPE) + align_g[NELMTS(align_g) - 1]); \
|
||||
if (H5SETJMP(jbuf_g)) \
|
||||
_ano++; \
|
||||
if (_ano < NELMTS(align_g)) { \
|
||||
*((TYPE *)(_buf + align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \
|
||||
_val2 = *((TYPE *)(_buf + align_g[_ano])); /*possible SIGBUS or SEGSEGV*/ \
|
||||
/* Cray Check: This section helps detect alignment on Cray's */ \
|
||||
/* vector machines (like the SV1) which mask off */ \
|
||||
/* pointer values when pointing to non-word aligned */ \
|
||||
/* locations with pointers that are supposed to be */ \
|
||||
/* word aligned. -QAK */ \
|
||||
HDmemset(_buf, 0xff, sizeof(TYPE) + align_g[NELMTS(align_g) - 1]); \
|
||||
/*How to handle VAX types?*/ \
|
||||
if (INFO.perm[0]) /* Big-Endian */ \
|
||||
HDmemcpy(_buf + align_g[_ano] + (INFO.size - ((INFO.offset + INFO.precision) / 8)), \
|
||||
((char *)&_val) + (INFO.size - ((INFO.offset + INFO.precision) / 8)), \
|
||||
(size_t)(INFO.precision / 8)); \
|
||||
else /* Little-Endian */ \
|
||||
HDmemcpy(_buf + align_g[_ano] + (INFO.offset / 8), ((char *)&_val) + (INFO.offset / 8), \
|
||||
(size_t)(INFO.precision / 8)); \
|
||||
_val2 = *((TYPE *)(_buf + align_g[_ano])); \
|
||||
H5_GCC_CLANG_DIAG_OFF("float-equal") \
|
||||
if (_val != _val2) \
|
||||
H5LONGJMP(jbuf_g, 1); \
|
||||
H5_GCC_CLANG_DIAG_ON("float-equal") \
|
||||
/* End Cray Check */ \
|
||||
(INFO.align) = align_g[_ano]; \
|
||||
} \
|
||||
else { \
|
||||
(INFO.align) = 0; \
|
||||
fprintf(stderr, "unable to calculate alignment for %s\n", #TYPE); \
|
||||
} \
|
||||
HDfree(_buf); \
|
||||
HDsignal(SIGBUS, _handler); /*restore original handler*/ \
|
||||
HDsignal(SIGSEGV, _handler2); /*restore original handler*/ \
|
||||
HDsignal(SIGILL, _handler3); /*restore original handler*/ \
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: sigsegv_handler
|
||||
*
|
||||
* Purpose: Handler for SIGSEGV. We use signal() instead of sigaction()
|
||||
* because it's more portable to non-Posix systems. Although
|
||||
* it's not nearly as nice to work with, it does the job for
|
||||
* this simple stuff.
|
||||
*
|
||||
* Return: Returns via H5LONGJMP to jbuf_g.
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
sigsegv_handler(int H5_ATTR_UNUSED signo)
|
||||
{
|
||||
#if !defined(H5HAVE_SIGJMP) && defined(H5_HAVE_SIGPROCMASK)
|
||||
/* Use sigprocmask to unblock the signal if sigsetjmp/siglongjmp are not */
|
||||
/* supported. */
|
||||
sigset_t set;
|
||||
|
||||
HDsigemptyset(&set);
|
||||
HDsigaddset(&set, SIGSEGV);
|
||||
HDsigprocmask(SIG_UNBLOCK, &set, NULL);
|
||||
#endif
|
||||
|
||||
sigsegv_handler_called_g++;
|
||||
HDsignal(SIGSEGV, sigsegv_handler);
|
||||
H5LONGJMP(jbuf_g, SIGSEGV);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: sigbus_handler
|
||||
*
|
||||
* Purpose: Handler for SIGBUS. We use signal() instead of sigaction()
|
||||
* because it's more portable to non-Posix systems. Although
|
||||
* it's not nearly as nice to work with, it does the job for
|
||||
* this simple stuff.
|
||||
*
|
||||
* Return: Returns via H5LONGJMP to jbuf_g.
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
sigbus_handler(int H5_ATTR_UNUSED signo)
|
||||
{
|
||||
#if !defined(H5HAVE_SIGJMP) && defined(H5_HAVE_SIGPROCMASK)
|
||||
/* Use sigprocmask to unblock the signal if sigsetjmp/siglongjmp are not */
|
||||
/* supported. */
|
||||
sigset_t set;
|
||||
|
||||
HDsigemptyset(&set);
|
||||
HDsigaddset(&set, SIGBUS);
|
||||
HDsigprocmask(SIG_UNBLOCK, &set, NULL);
|
||||
#endif
|
||||
|
||||
sigbus_handler_called_g++;
|
||||
HDsignal(SIGBUS, sigbus_handler);
|
||||
H5LONGJMP(jbuf_g, SIGBUS);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: sigill_handler
|
||||
*
|
||||
* Purpose: Handler for SIGILL. We use signal() instead of sigaction()
|
||||
* because it's more portable to non-Posix systems. Although
|
||||
* it's not nearly as nice to work with, it does the job for
|
||||
* this simple stuff.
|
||||
*
|
||||
* Return: Returns via H5LONGJMP to jbuf_g.
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
sigill_handler(int H5_ATTR_UNUSED signo)
|
||||
{
|
||||
#if !defined(H5HAVE_SIGJMP) && defined(H5_HAVE_SIGPROCMASK)
|
||||
/* Use sigprocmask to unblock the signal if sigsetjmp/siglongjmp are not */
|
||||
/* supported. */
|
||||
sigset_t set;
|
||||
|
||||
HDsigemptyset(&set);
|
||||
HDsigaddset(&set, SIGILL);
|
||||
HDsigprocmask(SIG_UNBLOCK, &set, NULL);
|
||||
#endif
|
||||
|
||||
sigill_handler_called_g++;
|
||||
HDsignal(SIGILL, sigill_handler);
|
||||
H5LONGJMP(jbuf_g, SIGILL);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: print_results
|
||||
*
|
||||
@@ -527,7 +231,7 @@ sigill_handler(int H5_ATTR_UNUSED signo)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
print_results(int nd, detected_t *d, int na, malign_t *misc_align)
|
||||
print_results(int nd, detected_t *d)
|
||||
{
|
||||
int byte_order = 0; /*byte order of data types*/
|
||||
int i, j;
|
||||
@@ -645,10 +349,9 @@ H5T__init_native(void)\n\
|
||||
if(NULL == (dt = H5T__alloc()))\n\
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, \"datatype allocation failed\")\n\
|
||||
dt->shared->state = H5T_STATE_IMMUTABLE;\n\
|
||||
dt->shared->type = H5T_%s;\n\
|
||||
dt->shared->type = H5T_FLOAT;\n\
|
||||
dt->shared->size = %d;\n",
|
||||
d[i].msize ? "FLOAT" : "INTEGER", /*class */
|
||||
d[i].size); /*size */
|
||||
d[i].size); /*size */
|
||||
|
||||
if (byte_order == -1)
|
||||
fprintf(rawoutstream, "\
|
||||
@@ -669,46 +372,36 @@ H5T__init_native(void)\n\
|
||||
d[i].precision); /*precision */
|
||||
/*HDassert((d[i].perm[0]>0)==(byte_order>0));*/ /* Double-check that byte-order doesn't change */
|
||||
|
||||
if (0 == d[i].msize) {
|
||||
/* The part unique to fixed point types */
|
||||
fprintf(rawoutstream, "\
|
||||
dt->shared->u.atomic.u.i.sign = H5T_SGN_%s;\n",
|
||||
d[i].sign ? "2" : "NONE");
|
||||
}
|
||||
else {
|
||||
/* The part unique to floating point types */
|
||||
fprintf(rawoutstream, "\
|
||||
dt->shared->u.atomic.u.f.sign = %d;\n\
|
||||
dt->shared->u.atomic.u.f.epos = %d;\n\
|
||||
dt->shared->u.atomic.u.f.esize = %d;\n\
|
||||
dt->shared->u.atomic.u.f.ebias = 0x%08lx;\n\
|
||||
dt->shared->u.atomic.u.f.mpos = %d;\n\
|
||||
dt->shared->u.atomic.u.f.msize = %d;\n\
|
||||
dt->shared->u.atomic.u.f.norm = H5T_NORM_%s;\n\
|
||||
dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO;\n",
|
||||
d[i].sign, /*sign location */
|
||||
d[i].epos, /*exponent loc */
|
||||
d[i].esize, /*exponent size */
|
||||
(unsigned long)(d[i].bias), /*exponent bias */
|
||||
d[i].mpos, /*mantissa loc */
|
||||
d[i].msize, /*mantissa size */
|
||||
d[i].imp ? "IMPLIED" : "NONE"); /*normalization */
|
||||
}
|
||||
/* The part unique to floating point types */
|
||||
fprintf(rawoutstream, "\
|
||||
dt->shared->u.atomic.u.f.sign = %d;\n\
|
||||
dt->shared->u.atomic.u.f.epos = %d;\n\
|
||||
dt->shared->u.atomic.u.f.esize = %d;\n\
|
||||
dt->shared->u.atomic.u.f.ebias = 0x%08lx;\n\
|
||||
dt->shared->u.atomic.u.f.mpos = %d;\n\
|
||||
dt->shared->u.atomic.u.f.msize = %d;\n\
|
||||
dt->shared->u.atomic.u.f.norm = H5T_NORM_%s;\n\
|
||||
dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO;\n",
|
||||
d[i].sign, /*sign location */
|
||||
d[i].epos, /*exponent loc */
|
||||
d[i].esize, /*exponent size */
|
||||
(unsigned long)(d[i].bias), /*exponent bias */
|
||||
d[i].mpos, /*mantissa loc */
|
||||
d[i].msize, /*mantissa size */
|
||||
d[i].imp ? "IMPLIED" : "NONE"); /*normalization */
|
||||
|
||||
/* Register the type */
|
||||
fprintf(rawoutstream, "\
|
||||
if((H5T_NATIVE_%s_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)\n\
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \"can't register ID for built-in datatype\")\n",
|
||||
d[i].varname);
|
||||
fprintf(rawoutstream, " H5T_NATIVE_%s_ALIGN_g = %lu;\n", d[i].varname,
|
||||
(unsigned long)(d[i].align));
|
||||
|
||||
/* Variables for alignment of compound datatype */
|
||||
if (!HDstrcmp(d[i].varname, "SCHAR") || !HDstrcmp(d[i].varname, "SHORT") ||
|
||||
!HDstrcmp(d[i].varname, "INT") || !HDstrcmp(d[i].varname, "LONG") ||
|
||||
!HDstrcmp(d[i].varname, "LLONG") || !HDstrcmp(d[i].varname, "FLOAT") ||
|
||||
!HDstrcmp(d[i].varname, "DOUBLE") || !HDstrcmp(d[i].varname, "LDOUBLE")) {
|
||||
fprintf(rawoutstream, " H5T_NATIVE_%s_COMP_ALIGN_g = %lu;\n", d[i].varname,
|
||||
fprintf(rawoutstream, " H5T_NATIVE_%s_ALIGN_g = %lu;\n", d[i].varname,
|
||||
(unsigned long)(d[i].comp_align));
|
||||
}
|
||||
}
|
||||
@@ -727,12 +420,6 @@ H5T__init_native(void)\n\
|
||||
"BE");
|
||||
}
|
||||
|
||||
/* Structure alignment for pointers, vlen and reference types */
|
||||
fprintf(rawoutstream, "\n /* Structure alignment for pointers, vlen and reference types */\n");
|
||||
for (j = 0; j < na; j++)
|
||||
fprintf(rawoutstream, " H5T_%s_COMP_ALIGN_g = %lu;\n", misc_align[j].name,
|
||||
(unsigned long)(misc_align[j].comp_align));
|
||||
|
||||
fprintf(rawoutstream, "\
|
||||
\n\
|
||||
done:\n\
|
||||
@@ -745,42 +432,6 @@ done:\n\
|
||||
\n\
|
||||
FUNC_LEAVE_NOAPI(ret_value);\n} /* end H5T__init_native() */\n");
|
||||
|
||||
/* Print the ALIGNMENT and signal-handling status as comments */
|
||||
fprintf(rawoutstream, "\n"
|
||||
"/****************************************/\n"
|
||||
"/* ALIGNMENT and signal-handling status */\n"
|
||||
"/****************************************/\n");
|
||||
if (align_status_g & STA_NoALIGNMENT)
|
||||
fprintf(rawoutstream, "/* ALIGNAMENT test is not available */\n");
|
||||
if (align_status_g & STA_NoHandlerVerify)
|
||||
fprintf(rawoutstream, "/* Signal handlers verify test is not available */\n");
|
||||
/* The following is available in H5pubconf.h. Printing them here for */
|
||||
/* convenience. */
|
||||
#ifdef H5_HAVE_SIGSETJMP
|
||||
fprintf(rawoutstream, "/* sigsetjmp() support: yes */\n");
|
||||
#else
|
||||
fprintf(rawoutstream, "/* sigsetjmp() support: no */\n");
|
||||
#endif
|
||||
#ifdef H5_HAVE_SIGLONGJMP
|
||||
fprintf(rawoutstream, "/* siglongjmp() support: yes */\n");
|
||||
#else
|
||||
fprintf(rawoutstream, "/* siglongjmp() support: no */\n");
|
||||
#endif
|
||||
#ifdef H5_HAVE_SIGPROCMASK
|
||||
fprintf(rawoutstream, "/* sigprocmask() support: yes */\n");
|
||||
#else
|
||||
fprintf(rawoutstream, "/* sigprocmask() support: no */\n");
|
||||
#endif
|
||||
|
||||
/* Print the statistics of signal handlers called for debugging */
|
||||
fprintf(rawoutstream, "\n"
|
||||
"/******************************/\n"
|
||||
"/* signal handlers statistics */\n"
|
||||
"/******************************/\n");
|
||||
fprintf(rawoutstream, "/* signal_handlers tested: %d times */\n", signal_handler_tested_g);
|
||||
fprintf(rawoutstream, "/* sigbus_handler called: %d times */\n", sigbus_handler_called_g);
|
||||
fprintf(rawoutstream, "/* sigsegv_handler called: %d times */\n", sigsegv_handler_called_g);
|
||||
fprintf(rawoutstream, "/* sigill_handler called: %d times */\n", sigill_handler_called_g);
|
||||
} /* end print_results() */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -820,7 +471,7 @@ iprint(detected_t *d)
|
||||
unsigned int j;
|
||||
|
||||
for (j = 8; j > 0; --j) {
|
||||
if (k == d->sign && d->msize) {
|
||||
if (k == d->sign) {
|
||||
HDfputc('S', rawoutstream);
|
||||
}
|
||||
else if (k >= d->epos && k < d->epos + d->esize) {
|
||||
@@ -829,14 +480,8 @@ iprint(detected_t *d)
|
||||
else if (k >= d->mpos && k < d->mpos + d->msize) {
|
||||
HDfputc('M', rawoutstream);
|
||||
}
|
||||
else if (d->msize) {
|
||||
HDfputc('?', rawoutstream); /*unknown floating point bit */
|
||||
}
|
||||
else if (d->sign) {
|
||||
HDfputc('I', rawoutstream);
|
||||
}
|
||||
else {
|
||||
HDfputc('U', rawoutstream);
|
||||
HDfputc('?', rawoutstream); /*unknown floating point bit */
|
||||
}
|
||||
--k;
|
||||
}
|
||||
@@ -853,22 +498,7 @@ iprint(detected_t *d)
|
||||
/*
|
||||
* Is there an implicit bit in the mantissa.
|
||||
*/
|
||||
if (d->msize) {
|
||||
fprintf(rawoutstream, " * Implicit bit? %s\n", d->imp ? "yes" : "no");
|
||||
}
|
||||
|
||||
/*
|
||||
* Alignment
|
||||
*/
|
||||
if (0 == d->align) {
|
||||
fprintf(rawoutstream, " * Alignment: NOT CALCULATED\n");
|
||||
}
|
||||
else if (1 == d->align) {
|
||||
fprintf(rawoutstream, " * Alignment: none\n");
|
||||
}
|
||||
else {
|
||||
fprintf(rawoutstream, " * Alignment: %lu\n", (unsigned long)(d->align));
|
||||
}
|
||||
fprintf(rawoutstream, " * Implicit bit? %s\n", d->imp ? "yes" : "no");
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -1221,35 +851,6 @@ bit.\n";
|
||||
fprintf(rawoutstream, "\n */\n\n");
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: detect_C89_integers
|
||||
*
|
||||
* Purpose: Detect C89 integer types
|
||||
*
|
||||
* Return: void
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void HDF_NO_UBSAN
|
||||
detect_C89_integers(void)
|
||||
{
|
||||
DETECT_BYTE(signed char, SCHAR, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(short, SHORT, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(unsigned short, USHORT, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(int, INT, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(unsigned int, UINT, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(long, LONG, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(unsigned long, ULONG, d_g[nd_g]);
|
||||
nd_g++;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: detect_C89_floats
|
||||
*
|
||||
@@ -1267,131 +868,6 @@ detect_C89_floats(void)
|
||||
nd_g++;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: detect_C99_integers8
|
||||
*
|
||||
* Purpose: Detect C99 8 bit integer types
|
||||
*
|
||||
* Return: void
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void HDF_NO_UBSAN
|
||||
detect_C99_integers8(void)
|
||||
{
|
||||
DETECT_BYTE(int8_t, INT8, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_BYTE(uint8_t, UINT8, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_BYTE(int_least8_t, INT_LEAST8, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_BYTE(uint_least8_t, UINT_LEAST8, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_BYTE(int_fast8_t, INT_FAST8, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_BYTE(uint_fast8_t, UINT_FAST8, d_g[nd_g]);
|
||||
nd_g++;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: detect_C99_integers16
|
||||
*
|
||||
* Purpose: Detect C99 16 bit integer types
|
||||
*
|
||||
* Return: void
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void HDF_NO_UBSAN
|
||||
detect_C99_integers16(void)
|
||||
{
|
||||
DETECT_I(int16_t, INT16, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(uint16_t, UINT16, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(int_least16_t, INT_LEAST16, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(uint_least16_t, UINT_LEAST16, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(int_fast16_t, INT_FAST16, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(uint_fast16_t, UINT_FAST16, d_g[nd_g]);
|
||||
nd_g++;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: detect_C99_integers32
|
||||
*
|
||||
* Purpose: Detect C99 32 bit integer types
|
||||
*
|
||||
* Return: void
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void HDF_NO_UBSAN
|
||||
detect_C99_integers32(void)
|
||||
{
|
||||
DETECT_I(int32_t, INT32, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(uint32_t, UINT32, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(int_least32_t, INT_LEAST32, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(uint_least32_t, UINT_LEAST32, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(int_fast32_t, INT_FAST32, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(uint_fast32_t, UINT_FAST32, d_g[nd_g]);
|
||||
nd_g++;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: detect_C99_integers64
|
||||
*
|
||||
* Purpose: Detect C99 64 bit integer types
|
||||
*
|
||||
* Return: void
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void HDF_NO_UBSAN
|
||||
detect_C99_integers64(void)
|
||||
{
|
||||
DETECT_I(int64_t, INT64, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(uint64_t, UINT64, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(int_least64_t, INT_LEAST64, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(uint_least64_t, UINT_LEAST64, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(int_fast64_t, INT_FAST64, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(uint_fast64_t, UINT_FAST64, d_g[nd_g]);
|
||||
nd_g++;
|
||||
|
||||
DETECT_I(long long, LLONG, d_g[nd_g]);
|
||||
nd_g++;
|
||||
DETECT_I(unsigned long long, ULLONG, d_g[nd_g]);
|
||||
nd_g++;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: detect_C99_integers
|
||||
*
|
||||
* Purpose: Detect C99 integer types
|
||||
*
|
||||
* Return: void
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void HDF_NO_UBSAN
|
||||
detect_C99_integers(void)
|
||||
{
|
||||
/* break it down to more subroutines so that each module subroutine */
|
||||
/* is smaller and takes less time to compile with optimization on. */
|
||||
detect_C99_integers8();
|
||||
detect_C99_integers16();
|
||||
detect_C99_integers32();
|
||||
detect_C99_integers64();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: detect_C99_floats
|
||||
*
|
||||
@@ -1418,87 +894,6 @@ detect_C99_floats(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: detect_alignments
|
||||
*
|
||||
* Purpose: Detect structure alignments
|
||||
*
|
||||
* Return: void
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void HDF_NO_UBSAN
|
||||
detect_alignments(void)
|
||||
{
|
||||
/* Detect structure alignment for pointers, vlen and reference types */
|
||||
DETECT_M(void *, POINTER, m_g[na_g]);
|
||||
na_g++;
|
||||
DETECT_M(hvl_t, HVL, m_g[na_g]);
|
||||
na_g++;
|
||||
DETECT_M(hobj_ref_t, HOBJREF, m_g[na_g]);
|
||||
na_g++;
|
||||
DETECT_M(hdset_reg_ref_t, HDSETREGREF, m_g[na_g]);
|
||||
na_g++;
|
||||
DETECT_M(H5R_ref_t, REF, m_g[na_g]);
|
||||
na_g++;
|
||||
}
|
||||
|
||||
/* Verify the signal handler for signal signum works correctly multiple times.
|
||||
* One possible cause of failure is that the signal handling is blocked or
|
||||
* changed to SIG_DFL after H5LONGJMP.
|
||||
* Return 0 for success, -1 for failure.
|
||||
*/
|
||||
static int
|
||||
verify_signal_handlers(int signum, void (*handler)(int))
|
||||
{
|
||||
#if defined(__has_feature) /* Clang */
|
||||
#if __has_feature(address_sanitizer) || __has_feature(thread_sanitizer)
|
||||
/* Under the address and thread sanitizers, don't raise any signals. */
|
||||
return 0;
|
||||
#endif
|
||||
#elif defined(__SANITIZE_ADDRESS__) || defined(__SANITIZE_THREAD__) /* GCC */
|
||||
return 0;
|
||||
#endif
|
||||
void (*save_handler)(int) = HDsignal(signum, handler);
|
||||
volatile int i, val;
|
||||
int ntries = 5;
|
||||
volatile int nfailures = 0;
|
||||
volatile int nsuccesses = 0;
|
||||
|
||||
for (i = 0; i < ntries; i++) {
|
||||
val = H5SETJMP(jbuf_g);
|
||||
if (val == 0) {
|
||||
/* send self the signal to trigger the handler */
|
||||
signal_handler_tested_g++;
|
||||
HDraise(signum);
|
||||
/* Should not reach here. Record error. */
|
||||
nfailures++;
|
||||
}
|
||||
else {
|
||||
if (val == signum) {
|
||||
/* return from signum handler. Record a success. */
|
||||
nsuccesses++;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Unknown return value (%d) from H5SETJMP", val);
|
||||
nfailures++;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* restore save handler, check results and report failures */
|
||||
HDsignal(signum, save_handler);
|
||||
if (nfailures > 0 || nsuccesses != ntries) {
|
||||
fprintf(stderr,
|
||||
"verify_signal_handlers for signal %d did %d tries. "
|
||||
"Found %d failures and %d successes\n",
|
||||
signum, ntries, nfailures, nsuccesses);
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
/* all succeeded */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: main
|
||||
*
|
||||
@@ -1527,35 +922,15 @@ main(int argc, char *argv[])
|
||||
if (!rawoutstream)
|
||||
rawoutstream = stdout;
|
||||
|
||||
/* verify the SIGBUS and SIGSEGV handlers work properly */
|
||||
if (verify_signal_handlers(SIGBUS, sigbus_handler) != 0) {
|
||||
fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigbus_handler", SIGBUS);
|
||||
}
|
||||
if (verify_signal_handlers(SIGSEGV, sigsegv_handler) != 0) {
|
||||
fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigsegv_handler", SIGSEGV);
|
||||
}
|
||||
if (verify_signal_handlers(SIGILL, sigill_handler) != 0) {
|
||||
fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigill_handler", SIGILL);
|
||||
}
|
||||
|
||||
print_header();
|
||||
|
||||
/* C89 integer types */
|
||||
detect_C89_integers();
|
||||
|
||||
/* C99 integer types */
|
||||
detect_C99_integers();
|
||||
|
||||
/* C89 floating point types */
|
||||
detect_C89_floats();
|
||||
|
||||
/* C99 floating point types */
|
||||
detect_C99_floats();
|
||||
|
||||
/* Detect structure alignment */
|
||||
detect_alignments();
|
||||
|
||||
print_results(nd_g, d_g, na_g, m_g);
|
||||
print_results(nd_g, d_g);
|
||||
|
||||
if (rawoutstream && rawoutstream != stdout) {
|
||||
if (HDfclose(rawoutstream))
|
||||
@@ -1566,5 +941,3 @@ main(int argc, char *argv[])
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
H5_GCC_CLANG_DIAG_ON("cast-align")
|
||||
|
||||
+2717
-4051
File diff suppressed because it is too large
Load Diff
+66
-30
@@ -179,11 +179,18 @@ verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_c
|
||||
|
||||
if (H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0)
|
||||
TEST_ERROR;
|
||||
CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info");
|
||||
VERIFY(size, exp_chk_size, "H5Dget_chunk_info, chunk size");
|
||||
VERIFY(read_flt_msk, exp_flt_msk, "H5Dget_chunk_info, filter mask");
|
||||
VERIFY(out_offset[0], exp_offset[0], "H5Dget_chunk_info, offset[0]");
|
||||
VERIFY(out_offset[1], exp_offset[1], "H5Dget_chunk_info, offset[1]");
|
||||
|
||||
if (HADDR_UNDEF == addr)
|
||||
FAIL_PUTS_ERROR("address cannot be HADDR_UNDEF");
|
||||
if (size != exp_chk_size)
|
||||
FAIL_PUTS_ERROR("unexpected chunk size");
|
||||
if (read_flt_msk != exp_flt_msk)
|
||||
FAIL_PUTS_ERROR("unexpected filter mask");
|
||||
if (out_offset[0] != exp_offset[0])
|
||||
FAIL_PUTS_ERROR("unexpected offset[0]");
|
||||
if (out_offset[1] != exp_offset[1])
|
||||
FAIL_PUTS_ERROR("unexpected offset[1]");
|
||||
|
||||
return SUCCEED;
|
||||
|
||||
error:
|
||||
@@ -213,9 +220,14 @@ verify_get_chunk_info_by_coord(hid_t dset, hsize_t *offset, hsize_t exp_chk_size
|
||||
/* Get info of the chunk at logical coordinates specified by offset */
|
||||
if (H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
|
||||
TEST_ERROR;
|
||||
CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord");
|
||||
VERIFY(size, exp_chk_size, "H5Dget_chunk_info_by_coord, chunk size");
|
||||
VERIFY(read_flt_msk, exp_flt_msk, "H5Dget_chunk_info_by_coord, filter mask");
|
||||
|
||||
if (HADDR_UNDEF == addr)
|
||||
FAIL_PUTS_ERROR("address cannot be HADDR_UNDEF");
|
||||
if (size != exp_chk_size)
|
||||
FAIL_PUTS_ERROR("unexpected chunk size");
|
||||
if (read_flt_msk != exp_flt_msk)
|
||||
FAIL_PUTS_ERROR("unexpected filter mask");
|
||||
|
||||
return SUCCEED;
|
||||
|
||||
error:
|
||||
@@ -245,8 +257,12 @@ verify_empty_chunk_info(hid_t dset, hsize_t *offset)
|
||||
/* Get info of the chunk at logical coordinates specified by offset */
|
||||
if (H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
|
||||
TEST_ERROR;
|
||||
VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address");
|
||||
VERIFY(size, EMPTY_CHK_SIZE, "H5Dget_chunk_info_by_coord, chunk size");
|
||||
|
||||
if (HADDR_UNDEF != addr)
|
||||
FAIL_PUTS_ERROR("address was not HADDR_UNDEF");
|
||||
if (EMPTY_CHK_SIZE != size)
|
||||
FAIL_PUTS_ERROR("size was not EMPTY_CHK_SIZE");
|
||||
|
||||
return SUCCEED;
|
||||
|
||||
error:
|
||||
@@ -428,12 +444,14 @@ verify_idx_nchunks(hid_t dset, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsi
|
||||
/* Get and verify the number of chunks */
|
||||
if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
|
||||
TEST_ERROR;
|
||||
VERIFY(nchunks, exp_num_chunks, "H5Dget_num_chunks, number of chunks");
|
||||
if (nchunks != exp_num_chunks)
|
||||
FAIL_PUTS_ERROR("unexpected number of chunks");
|
||||
|
||||
/* Get and verify the number of chunks again, passing in H5S_ALL */
|
||||
if (H5Dget_num_chunks(dset, H5S_ALL, &nchunks) < 0)
|
||||
TEST_ERROR;
|
||||
VERIFY(nchunks, exp_num_chunks, "H5Dget_num_chunks, number of chunks");
|
||||
if (nchunks != exp_num_chunks)
|
||||
FAIL_PUTS_ERROR("unexpected number of chunks");
|
||||
|
||||
return SUCCEED;
|
||||
|
||||
@@ -603,7 +621,8 @@ test_get_chunk_info_highest_v18(hid_t fapl)
|
||||
/* Get and verify the number of chunks written */
|
||||
if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
|
||||
TEST_ERROR;
|
||||
VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks");
|
||||
if (NUM_CHUNKS_WRITTEN != nchunks)
|
||||
FAIL_PUTS_ERROR("unexpected number of chunks");
|
||||
|
||||
/* Get and verify info of the last written chunk again, passing in H5S_ALL
|
||||
this time */
|
||||
@@ -666,7 +685,8 @@ test_get_chunk_info_highest_v18(hid_t fapl)
|
||||
/* Verify that the number of chunks is 0 */
|
||||
if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
|
||||
TEST_ERROR;
|
||||
VERIFY(nchunks, NO_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks");
|
||||
if (NO_CHUNK_WRITTEN != nchunks)
|
||||
FAIL_PUTS_ERROR("unexpected number of chunks");
|
||||
|
||||
/* Attempt to get info of a chunk from an empty dataset, should fail */
|
||||
chk_index = OUTOFRANGE_CHK_INDEX;
|
||||
@@ -1128,7 +1148,8 @@ test_chunk_info_fixed_array(const char *filename, hid_t fapl)
|
||||
/* Get and verify the number of chunks written */
|
||||
if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
|
||||
TEST_ERROR;
|
||||
VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks");
|
||||
if (NUM_CHUNKS_WRITTEN != nchunks)
|
||||
FAIL_PUTS_ERROR("unexpected number of chunks");
|
||||
|
||||
/* Get and verify info of each written chunk */
|
||||
chk_index = 0;
|
||||
@@ -1271,7 +1292,8 @@ test_chunk_info_extensible_array(const char *filename, hid_t fapl)
|
||||
/* Get and verify the number of chunks written */
|
||||
if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
|
||||
TEST_ERROR;
|
||||
VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks");
|
||||
if (NUM_CHUNKS_WRITTEN != nchunks)
|
||||
FAIL_PUTS_ERROR("unexpected number of chunks");
|
||||
|
||||
/* Get and verify info of each written chunk */
|
||||
chk_index = 0;
|
||||
@@ -1419,7 +1441,8 @@ test_chunk_info_version2_btrees(const char *filename, hid_t fapl)
|
||||
/* Get and verify the number of chunks written */
|
||||
if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
|
||||
TEST_ERROR;
|
||||
VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks");
|
||||
if (NUM_CHUNKS_WRITTEN != nchunks)
|
||||
FAIL_PUTS_ERROR("unexpected number of chunks");
|
||||
|
||||
/* Go through all written chunks, get their info and verify the values */
|
||||
chk_index = 0;
|
||||
@@ -1602,7 +1625,8 @@ test_basic_query(hid_t fapl)
|
||||
/* Get the number of chunks and verify that no chunk has been written */
|
||||
if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
|
||||
TEST_ERROR;
|
||||
VERIFY(nchunks, NO_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks");
|
||||
if (NO_CHUNK_WRITTEN != nchunks)
|
||||
FAIL_PUTS_ERROR("unexpected number of chunks");
|
||||
|
||||
/* Initialize the array of chunk data for the single chunk */
|
||||
for (ii = 0; ii < CHUNK_NX; ii++)
|
||||
@@ -1618,7 +1642,8 @@ test_basic_query(hid_t fapl)
|
||||
/* Get and verify that one chunk had been written */
|
||||
if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
|
||||
TEST_ERROR;
|
||||
VERIFY(nchunks, ONE_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks");
|
||||
if (ONE_CHUNK_WRITTEN != nchunks)
|
||||
FAIL_PUTS_ERROR("unexpected number of chunks");
|
||||
|
||||
/* Get and verify info of the first and only chunk */
|
||||
if (verify_get_chunk_info(dset, H5S_ALL, 0, CHK_SIZE, offset, flt_msk) == FAIL)
|
||||
@@ -1649,7 +1674,8 @@ test_basic_query(hid_t fapl)
|
||||
/* Get and verify that two chunks had been written */
|
||||
if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
|
||||
TEST_ERROR;
|
||||
VERIFY(nchunks, TWO_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks");
|
||||
if (TWO_CHUNKS_WRITTEN != nchunks)
|
||||
FAIL_PUTS_ERROR("unexpected number of chunks");
|
||||
|
||||
/* Get and verify info of the first written chunk in the dataset, its
|
||||
offset should be (0,0) */
|
||||
@@ -1685,20 +1711,28 @@ test_basic_query(hid_t fapl)
|
||||
if (H5Dchunk_iter(dset, H5P_DEFAULT, &iter_cb, &udata) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
VERIFY(udata.last_index, 1, "Iterator did not iterate all chunks");
|
||||
VERIFY(chunk_infos[0].offset[0], 0, "Offset mismatch");
|
||||
VERIFY(chunk_infos[0].offset[1], 0, "Offset mismatch");
|
||||
VERIFY(chunk_infos[0].filter_mask, 0, "Filter mismatch");
|
||||
VERIFY(chunk_infos[0].nbytes, 96, "Size mismatch");
|
||||
if (udata.last_index != 1)
|
||||
FAIL_PUTS_ERROR("Iterator did not iterate over all chunks");
|
||||
if (chunk_infos[0].offset[0] != 0)
|
||||
FAIL_PUTS_ERROR("offset[0] mismatch");
|
||||
if (chunk_infos[0].offset[1] != 0)
|
||||
FAIL_PUTS_ERROR("offset[1] mismatch");
|
||||
if (chunk_infos[0].filter_mask != 0)
|
||||
FAIL_PUTS_ERROR("filter mask mismatch");
|
||||
if (chunk_infos[0].nbytes != 96)
|
||||
FAIL_PUTS_ERROR("size mismatch");
|
||||
|
||||
VERIFY(chunk_infos[1].offset[0], 1, "Offset mismatch");
|
||||
VERIFY(chunk_infos[1].offset[1], 1, "Offset mismatch");
|
||||
if (chunk_infos[1].offset[0] != 1)
|
||||
FAIL_PUTS_ERROR("offset[0] mismatch");
|
||||
if (chunk_infos[1].offset[1] != 1)
|
||||
FAIL_PUTS_ERROR("offset[1] mismatch");
|
||||
|
||||
/* Iterate and stop after one iteration */
|
||||
cptr = &(chunk_infos[0]);
|
||||
if (H5Dchunk_iter(dset, H5P_DEFAULT, &iter_cb_stop, &cptr) < 0)
|
||||
TEST_ERROR;
|
||||
VERIFY(cptr, &(chunk_infos[1]), "Verification of halted iterator failed\n");
|
||||
if (cptr != &(chunk_infos[1]))
|
||||
FAIL_PUTS_ERROR("Verification of halted iterator failed");
|
||||
|
||||
/* Iterate and fail after one iteration */
|
||||
cptr = &(chunk_infos[0]);
|
||||
@@ -1709,7 +1743,8 @@ test_basic_query(hid_t fapl)
|
||||
H5E_END_TRY;
|
||||
if (ret >= 0)
|
||||
TEST_ERROR;
|
||||
VERIFY(cptr, &(chunk_infos[1]), "Verification of halted iterator failed\n");
|
||||
if (cptr != &(chunk_infos[1]))
|
||||
FAIL_PUTS_ERROR("Verification of halted iterator failed");
|
||||
|
||||
/* Release resourse */
|
||||
if (H5Dclose(dset) < 0)
|
||||
@@ -2102,7 +2137,8 @@ test_flt_msk_with_skip_compress(hid_t fapl)
|
||||
/* Get and verify the number of chunks written */
|
||||
if (H5Dget_num_chunks(dset, H5S_ALL, &nchunks) < 0)
|
||||
TEST_ERROR;
|
||||
VERIFY(nchunks, ONE_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks");
|
||||
if (ONE_CHUNK_WRITTEN != nchunks)
|
||||
FAIL_PUTS_ERROR("unexpected number of chunks");
|
||||
|
||||
/* Get and verify info of the first and only chunk */
|
||||
chk_index = 0;
|
||||
|
||||
@@ -939,8 +939,10 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
|
||||
H5R_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */
|
||||
|
||||
/* Loop over elements in buffers */
|
||||
H5_GCC_CLANG_DIAG_OFF("cast-qual")
|
||||
ref_buf1 = (H5R_ref_t *)buf1;
|
||||
ref_buf2 = (H5R_ref_t *)buf2;
|
||||
H5_GCC_CLANG_DIAG_ON("cast-qual")
|
||||
for (u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) {
|
||||
hid_t obj1_id, obj2_id; /* IDs for objects referenced */
|
||||
H5O_type_t obj1_type, obj2_type; /* Types of objects referenced */
|
||||
|
||||
+30
-15
@@ -97,36 +97,51 @@ error:
|
||||
static int
|
||||
swmr_fapl_augment(hid_t fapl, const char *filename, uint32_t max_lag)
|
||||
{
|
||||
H5F_vfd_swmr_config_t config = {.version = H5F__CURR_VFD_SWMR_CONFIG_VERSION,
|
||||
.tick_len = 4,
|
||||
.max_lag = max_lag,
|
||||
.writer = true,
|
||||
.maintain_metadata_file = true,
|
||||
.generate_updater_files = false,
|
||||
.md_pages_reserved = 128};
|
||||
char * bname = NULL;
|
||||
char * dname = NULL;
|
||||
H5F_vfd_swmr_config_t *config = NULL;
|
||||
char * bname = NULL;
|
||||
char * dname = NULL;
|
||||
|
||||
if (NULL == (config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))))
|
||||
goto error;
|
||||
|
||||
config->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION;
|
||||
config->tick_len = 4;
|
||||
config->max_lag = max_lag;
|
||||
config->writer = TRUE;
|
||||
config->maintain_metadata_file = TRUE;
|
||||
config->generate_updater_files = FALSE;
|
||||
config->md_pages_reserved = 128;
|
||||
|
||||
if (H5_dirname(filename, &dname) < 0) {
|
||||
HDfprintf(stderr, "H5_dirname() failed\n");
|
||||
return -1;
|
||||
goto error;
|
||||
}
|
||||
if (H5_basename(filename, &bname) < 0) {
|
||||
HDfprintf(stderr, "H5_basename() failed\n");
|
||||
return -1;
|
||||
goto error;
|
||||
}
|
||||
HDsnprintf(config.md_file_path, sizeof(config.md_file_path), "%s", dname);
|
||||
HDsnprintf(config.md_file_name, sizeof(config.md_file_name), "%s.shadow", bname);
|
||||
HDsnprintf(config->md_file_path, sizeof(config->md_file_path), "%s", dname);
|
||||
HDsnprintf(config->md_file_name, sizeof(config->md_file_name), "%s.shadow", bname);
|
||||
|
||||
HDfree(dname);
|
||||
HDfree(bname);
|
||||
|
||||
/* Enable VFD SWMR configuration */
|
||||
if (H5Pset_vfd_swmr_config(fapl, &config) < 0) {
|
||||
if (H5Pset_vfd_swmr_config(fapl, config) < 0) {
|
||||
HDfprintf(stderr, "H5Pset_vrd_swmr_config failed\n");
|
||||
return -1;
|
||||
goto error;
|
||||
}
|
||||
|
||||
HDfree(config);
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
HDfree(dname);
|
||||
HDfree(bname);
|
||||
HDfree(config);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
||||
+21
-21
@@ -171,7 +171,7 @@ do
|
||||
$testdir/swmr_generator -q $compress $index_type
|
||||
if test $? -ne 0; then
|
||||
echo generator had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
|
||||
# Launch the Generator with SWMR_WRITE
|
||||
@@ -179,7 +179,7 @@ do
|
||||
$testdir/swmr_generator -q -s $compress $index_type
|
||||
if test $? -ne 0; then
|
||||
echo generator had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
|
||||
# Check for error and exit if one occurred
|
||||
@@ -217,7 +217,7 @@ do
|
||||
seed=""
|
||||
$testdir/swmr_reader -q $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n &
|
||||
pid_readers="$pid_readers $!"
|
||||
n=$((n + 1))
|
||||
n=`expr $n + 1`
|
||||
done
|
||||
$DPRINT pid_readers=$pid_readers
|
||||
$IFDEBUG ps
|
||||
@@ -229,7 +229,7 @@ do
|
||||
wait $xpid
|
||||
if test $? -ne 0; then
|
||||
echo reader had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -238,7 +238,7 @@ do
|
||||
wait $pid_writer
|
||||
if test $? -ne 0; then
|
||||
echo writer had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
|
||||
# Check for error and exit if one occurred
|
||||
@@ -263,7 +263,7 @@ do
|
||||
$testdir/swmr_generator -q -s $compress $index_type
|
||||
if test $? -ne 0; then
|
||||
echo generator had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
|
||||
# Remove any possible writer message file before launching writer
|
||||
@@ -289,7 +289,7 @@ do
|
||||
seed=""
|
||||
$testdir/swmr_reader -q $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n &
|
||||
pid_readers="$pid_readers $!"
|
||||
n=$((n + 1))
|
||||
n=`expr $n + 1`
|
||||
done
|
||||
$DPRINT pid_readers=$pid_readers
|
||||
$IFDEBUG ps
|
||||
@@ -301,7 +301,7 @@ do
|
||||
wait $xpid
|
||||
if test $? -ne 0; then
|
||||
echo reader had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -310,7 +310,7 @@ do
|
||||
wait $pid_writer
|
||||
if test $? -ne 0; then
|
||||
echo writer had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
|
||||
# Check for error and exit if one occurred
|
||||
@@ -352,7 +352,7 @@ do
|
||||
seed=""
|
||||
$testdir/swmr_remove_reader -q $Nsecs_rem $seed 2>&1 |tee swmr_reader.out.$n &
|
||||
pid_readers="$pid_readers $!"
|
||||
n=$((n + 1))
|
||||
n=`expr $n + 1`
|
||||
done
|
||||
$DPRINT pid_readers=$pid_readers
|
||||
$IFDEBUG ps
|
||||
@@ -364,7 +364,7 @@ do
|
||||
wait $xpid
|
||||
if test $? -ne 0; then
|
||||
echo reader had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -373,7 +373,7 @@ do
|
||||
wait $pid_writer
|
||||
if test $? -ne 0; then
|
||||
echo writer had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
|
||||
# Check for error and exit if one occurred
|
||||
@@ -398,7 +398,7 @@ do
|
||||
$testdir/swmr_generator -q $compress $index_type
|
||||
if test $? -ne 0; then
|
||||
echo generator had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
|
||||
# Launch the Writer (not in parallel - just to rebuild the datasets)
|
||||
@@ -407,7 +407,7 @@ do
|
||||
$testdir/swmr_writer -q $Nrecords $seed
|
||||
if test $? -ne 0; then
|
||||
echo writer had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
|
||||
# Remove any possible writer message file before launching writer
|
||||
@@ -433,7 +433,7 @@ do
|
||||
seed=""
|
||||
$testdir/swmr_remove_reader -q $Nsecs_addrem $seed 2>&1 |tee swmr_reader.out.$n &
|
||||
pid_readers="$pid_readers $!"
|
||||
n=$((n + 1))
|
||||
n=`expr $n + 1`
|
||||
done
|
||||
$DPRINT pid_readers=$pid_readers
|
||||
$IFDEBUG ps
|
||||
@@ -445,7 +445,7 @@ do
|
||||
wait $xpid
|
||||
if test $? -ne 0; then
|
||||
echo reader had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -454,7 +454,7 @@ do
|
||||
wait $pid_writer
|
||||
if test $? -ne 0; then
|
||||
echo writer had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
|
||||
# Check for error and exit if one occurred
|
||||
@@ -482,7 +482,7 @@ do
|
||||
$testdir/swmr_generator -q $compress $index_type $seed
|
||||
if test $? -ne 0; then
|
||||
echo generator had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
|
||||
# Remove any possible writer message file before launching writer
|
||||
@@ -504,7 +504,7 @@ do
|
||||
# The sparse reader spits out a LOT of data so it's set to 'quiet'
|
||||
$testdir/swmr_sparse_reader -q $Nrecs_spa 2>&1 |tee swmr_reader.out.$n &
|
||||
pid_readers="$pid_readers $!"
|
||||
n=$((n + 1))
|
||||
n=`expr $n + 1`
|
||||
done
|
||||
$DPRINT pid_readers=$pid_readers
|
||||
$IFDEBUG ps
|
||||
@@ -514,7 +514,7 @@ do
|
||||
wait $pid_writer
|
||||
if test $? -ne 0; then
|
||||
echo writer had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
|
||||
# Collect exit code of the readers
|
||||
@@ -523,7 +523,7 @@ do
|
||||
wait $xpid
|
||||
if test $? -ne 0; then
|
||||
echo reader had error
|
||||
nerrors=$((nerrors + 1))
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
+25
-14
@@ -95,7 +95,10 @@ static const char *namebases[] = {FILENAME, FILENAME2, FILENAME3, FNAME, NULL};
|
||||
/* Size of "flags" field in the updater file header */
|
||||
#define UD_SIZE_2 2
|
||||
|
||||
#define Swap2Bytes(val) ((((val) >> 8) & 0x00FF) | (((val) << 8) & 0xFF00))
|
||||
/* Note that bitwise operations often perform integral promotion, so you have
|
||||
* to cast the result to avoid warnings.
|
||||
*/
|
||||
#define Swap2Bytes(val) (uint16_t)((((val) >> 8) & 0x00FF) | (((val) << 8) & 0xFF00))
|
||||
|
||||
#define Swap8Bytes(val) \
|
||||
((((val) >> 56) & 0x00000000000000FF) | (((val) >> 40) & 0x000000000000FF00) | \
|
||||
@@ -4861,14 +4864,14 @@ error:
|
||||
static unsigned
|
||||
test_updater_generate_md_checksums(hid_t orig_fapl, hbool_t file_create)
|
||||
{
|
||||
char filename[FILE_NAME_LEN]; /* Filename to use */
|
||||
hid_t fid = H5I_INVALID_HID; /* File ID */
|
||||
hid_t fcpl = H5I_INVALID_HID; /* File creation property list ID */
|
||||
hid_t fapl = H5I_INVALID_HID; /* File access property list ID */
|
||||
H5F_vfd_swmr_config_t config; /* Configuration for VFD SWMR */
|
||||
H5F_generate_md_ck_cb_t cb_info; /* Callback */
|
||||
H5F_t * f = NULL; /* Internal file object pointer */
|
||||
char * md_file_path_name;
|
||||
char filename[FILE_NAME_LEN]; /* Filename to use */
|
||||
hid_t fid = H5I_INVALID_HID; /* File ID */
|
||||
hid_t fcpl = H5I_INVALID_HID; /* File creation property list ID */
|
||||
hid_t fapl = H5I_INVALID_HID; /* File access property list ID */
|
||||
H5F_vfd_swmr_config_t * config = NULL; /* Configuration for VFD SWMR */
|
||||
H5F_generate_md_ck_cb_t cb_info; /* Callback */
|
||||
H5F_t * f = NULL; /* Internal file object pointer */
|
||||
char * md_file_path_name = NULL;
|
||||
|
||||
if (file_create) {
|
||||
TESTING("VFD SWMR updater generate checksums for metadata file with H5Fcreate");
|
||||
@@ -4879,16 +4882,19 @@ test_updater_generate_md_checksums(hid_t orig_fapl, hbool_t file_create)
|
||||
|
||||
h5_fixname(namebase4, orig_fapl, filename, sizeof(filename));
|
||||
|
||||
if (NULL == (config = HDmalloc(sizeof(H5F_vfd_swmr_config_t))))
|
||||
TEST_ERROR;
|
||||
|
||||
/* config, tick_len, max_lag, presume_posix_semantics, writer,
|
||||
* maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved,
|
||||
* md_file_path, md_file_name, updater_file_path */
|
||||
init_vfd_swmr_config(&config, 4, 7, FALSE, TRUE, TRUE, TRUE, TRUE, 2, NULL, MD_FILE, UD_FILE);
|
||||
init_vfd_swmr_config(config, 4, 7, FALSE, TRUE, TRUE, TRUE, TRUE, 2, NULL, MD_FILE, UD_FILE);
|
||||
|
||||
if ((fapl = H5Pcopy(orig_fapl)) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
|
||||
/* fapl, use_latest_format, only_meta_page, page_buf_size, config */
|
||||
if (vfd_swmr_fapl_augment(fapl, TRUE, FALSE, 4096, &config) < 0)
|
||||
if (vfd_swmr_fapl_augment(fapl, TRUE, FALSE, 4096, config) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
|
||||
if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, 4096)) < 0) {
|
||||
@@ -4935,11 +4941,13 @@ test_updater_generate_md_checksums(hid_t orig_fapl, hbool_t file_create)
|
||||
FAIL_STACK_ERROR;
|
||||
|
||||
/* Verify contents of checksum file and updater files */
|
||||
if (verify_ud_chk(md_file_path_name, config.updater_file_path) < 0)
|
||||
if (verify_ud_chk(md_file_path_name, config->updater_file_path) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* It's important to clean up the checksum and updater files. */
|
||||
clean_chk_ud_files(md_file_path_name, config.updater_file_path);
|
||||
clean_chk_ud_files(md_file_path_name, config->updater_file_path);
|
||||
|
||||
HDfree(config);
|
||||
|
||||
PASSED();
|
||||
|
||||
@@ -4955,7 +4963,10 @@ error:
|
||||
H5E_END_TRY;
|
||||
|
||||
/* It's important to clean up the chechsum and updater files. */
|
||||
clean_chk_ud_files(md_file_path_name, config.updater_file_path);
|
||||
if (md_file_path_name && config)
|
||||
clean_chk_ud_files(md_file_path_name, config->updater_file_path);
|
||||
|
||||
HDfree(config);
|
||||
|
||||
return 1;
|
||||
|
||||
|
||||
@@ -66,16 +66,6 @@ typedef struct {
|
||||
hbool_t use_vfd_swmr; /* For -S option */
|
||||
} state_t;
|
||||
|
||||
/* Initializations for state_t */
|
||||
#define ALL_HID_INITIALIZER \
|
||||
(state_t) \
|
||||
{ \
|
||||
.file = H5I_INVALID_HID, .one_by_one_sid = H5I_INVALID_HID, .filename = "", \
|
||||
.filetype = H5T_NATIVE_UINT32, .asteps = 0, .csteps = 1, .dattrs = 0, .use_np = TRUE, \
|
||||
.use_vfd_swmr = TRUE, .compact = FALSE, .contig = FALSE, .chunked = FALSE, .vl_attr = FALSE, \
|
||||
.mod_attr = FALSE, .update_interval = READER_WAIT_TICKS \
|
||||
}
|
||||
|
||||
/* Structure to hold info for different dataset types */
|
||||
typedef struct {
|
||||
hid_t compact_did; /* ID for compact dataset */
|
||||
@@ -226,7 +216,23 @@ state_init(state_t *s, int argc, const char *const *argv)
|
||||
const char * s_opts = "pgkvmbqSNa:d:u:c:";
|
||||
struct h5_long_options l_opts[] = {{NULL, 0, '\0'}};
|
||||
|
||||
*s = ALL_HID_INITIALIZER;
|
||||
s->file = H5I_INVALID_HID;
|
||||
s->one_by_one_sid = H5I_INVALID_HID;
|
||||
s->filetype = H5T_NATIVE_UINT32;
|
||||
s->asteps = 0;
|
||||
s->csteps = 1;
|
||||
s->dattrs = 0;
|
||||
s->use_np = TRUE;
|
||||
s->use_vfd_swmr = TRUE;
|
||||
s->compact = FALSE;
|
||||
s->contig = FALSE;
|
||||
s->chunked = FALSE;
|
||||
s->vl_attr = FALSE;
|
||||
s->mod_attr = FALSE;
|
||||
s->update_interval = READER_WAIT_TICKS;
|
||||
|
||||
HDmemset(s->filename, 0, PATH_MAX);
|
||||
HDmemset(s->progname, 0, PATH_MAX);
|
||||
|
||||
if (H5_basename(argv[0], &tfile) < 0) {
|
||||
HDprintf("H5_basename failed\n");
|
||||
@@ -1956,21 +1962,30 @@ error:
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
hid_t fapl = H5I_INVALID_HID;
|
||||
hid_t fcpl = H5I_INVALID_HID;
|
||||
hbool_t writer = FALSE;
|
||||
state_t s;
|
||||
const char * personality;
|
||||
H5F_vfd_swmr_config_t config;
|
||||
np_state_t np;
|
||||
dsets_state_t ds;
|
||||
hid_t fapl = H5I_INVALID_HID;
|
||||
hid_t fcpl = H5I_INVALID_HID;
|
||||
hbool_t writer = FALSE;
|
||||
state_t * s = NULL;
|
||||
const char * personality;
|
||||
H5F_vfd_swmr_config_t *config = NULL;
|
||||
np_state_t np;
|
||||
dsets_state_t ds;
|
||||
|
||||
if (!state_init(&s, argc, (const char *const *)argv)) {
|
||||
if (NULL == (s = HDcalloc(1, sizeof(state_t)))) {
|
||||
HDprintf("memory allocation failed");
|
||||
TEST_ERROR;
|
||||
}
|
||||
if (NULL == (config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t)))) {
|
||||
HDprintf("memory allocation failed");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (!state_init(s, argc, (const char *const *)argv)) {
|
||||
HDprintf("state_init() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
personality = HDstrstr(s.progname, "vfd_swmr_attrdset_");
|
||||
personality = HDstrstr(s->progname, "vfd_swmr_attrdset_");
|
||||
|
||||
if (personality != NULL && HDstrcmp(personality, "vfd_swmr_attrdset_writer") == 0)
|
||||
writer = TRUE;
|
||||
@@ -1984,10 +1999,10 @@ main(int argc, char **argv)
|
||||
/* config, tick_len, max_lag, presume_posix_semantics, writer,
|
||||
* maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved,
|
||||
* md_file_path, md_file_name, updater_file_path */
|
||||
init_vfd_swmr_config(&config, 4, 7, FALSE, writer, TRUE, FALSE, TRUE, 128, "./", "attrdset-shadow", NULL);
|
||||
init_vfd_swmr_config(config, 4, 7, FALSE, writer, TRUE, FALSE, TRUE, 128, "./", "attrdset-shadow", NULL);
|
||||
|
||||
/* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */
|
||||
if ((fapl = vfd_swmr_create_fapl(TRUE, s.use_vfd_swmr, TRUE, 4096, &config)) < 0) {
|
||||
if ((fapl = vfd_swmr_create_fapl(TRUE, s->use_vfd_swmr, TRUE, 4096, config)) < 0) {
|
||||
HDprintf("vfd_swmr_create_fapl() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -1999,41 +2014,41 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (writer) {
|
||||
if ((s.file = H5Fcreate(s.filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) {
|
||||
if ((s->file = H5Fcreate(s->filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) {
|
||||
HDprintf("H5Fcreate failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (!create_dsets(&s, &ds)) {
|
||||
if (!create_dsets(s, &ds)) {
|
||||
HDprintf("create_dsets() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((s.file = H5Fopen(s.filename, H5F_ACC_RDONLY, fapl)) < 0) {
|
||||
if ((s->file = H5Fopen(s->filename, H5F_ACC_RDONLY, fapl)) < 0) {
|
||||
HDprintf("H5Fopen failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
if (!open_dsets(&s, &ds)) {
|
||||
if (!open_dsets(s, &ds)) {
|
||||
HDprintf("open_dsets() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initiailze named pipes */
|
||||
if (s.use_np && !np_init(&np, writer)) {
|
||||
if (s->use_np && !np_init(&np, writer)) {
|
||||
HDprintf("np_init() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (writer) {
|
||||
if (!perform_dsets_operations(&s, &ds, &config, &np)) {
|
||||
if (!perform_dsets_operations(s, &ds, config, &np)) {
|
||||
HDprintf("perform_dsets_operations() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!verify_dsets_operations(&s, &ds, &config, &np)) {
|
||||
if (!verify_dsets_operations(s, &ds, config, &np)) {
|
||||
HDprintf("verify_dsets_operations() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2054,21 +2069,24 @@ main(int argc, char **argv)
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (H5Fclose(s.file) < 0) {
|
||||
if (H5Fclose(s->file) < 0) {
|
||||
HDprintf("H5Fclose failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (H5Sclose(s.one_by_one_sid) < 0) {
|
||||
if (H5Sclose(s->one_by_one_sid) < 0) {
|
||||
HDprintf("H5Sclose failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (s.use_np && !np_close(&np, writer)) {
|
||||
if (s->use_np && !np_close(&np, writer)) {
|
||||
HDprintf("np_close() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
HDfree(s);
|
||||
HDfree(config);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
error:
|
||||
@@ -2076,22 +2094,25 @@ error:
|
||||
{
|
||||
H5Pclose(fapl);
|
||||
H5Pclose(fcpl);
|
||||
H5Fclose(s.file);
|
||||
H5Sclose(s.one_by_one_sid);
|
||||
H5Fclose(s->file);
|
||||
H5Sclose(s->one_by_one_sid);
|
||||
}
|
||||
H5E_END_TRY;
|
||||
|
||||
if (s.use_np && np.fd_writer_to_reader >= 0)
|
||||
if (s->use_np && np.fd_writer_to_reader >= 0)
|
||||
HDclose(np.fd_writer_to_reader);
|
||||
|
||||
if (s.use_np && np.fd_reader_to_writer >= 0)
|
||||
if (s->use_np && np.fd_reader_to_writer >= 0)
|
||||
HDclose(np.fd_reader_to_writer);
|
||||
|
||||
if (s.use_np && !writer) {
|
||||
if (s->use_np && !writer) {
|
||||
HDremove(np.fifo_writer_to_reader);
|
||||
HDremove(np.fifo_reader_to_writer);
|
||||
}
|
||||
|
||||
HDfree(s);
|
||||
HDfree(config);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
} /* main */
|
||||
|
||||
|
||||
+196
-191
@@ -129,20 +129,22 @@ typedef struct _sources {
|
||||
hid_t ul, ur, bl, br;
|
||||
} sources_t;
|
||||
|
||||
#define MANY_FILES 4
|
||||
#define N_FILES 4
|
||||
|
||||
typedef struct {
|
||||
hid_t * dataset;
|
||||
sources_t * sources;
|
||||
hid_t file[MANY_FILES];
|
||||
hid_t file[N_FILES];
|
||||
hid_t dapl, filetype, memspace, one_by_one_sid, quadrant_dcpl;
|
||||
unsigned ndatasets;
|
||||
const char *filename[MANY_FILES];
|
||||
const char *filename[N_FILES];
|
||||
char progname[PATH_MAX];
|
||||
struct {
|
||||
quadrant_t ul, ur, bl, br, src;
|
||||
} quadrants;
|
||||
unsigned int depth, cols, rows;
|
||||
unsigned int depth;
|
||||
unsigned int cols;
|
||||
unsigned int rows;
|
||||
unsigned int asteps;
|
||||
unsigned int nsteps;
|
||||
unsigned int part_chunk;
|
||||
@@ -187,61 +189,10 @@ typedef struct {
|
||||
struct timespec time;
|
||||
} exchange_info_t;
|
||||
|
||||
/* Initializations for np_state_t */
|
||||
#define NP_INITIALIZER \
|
||||
(np_state_t) \
|
||||
{ \
|
||||
.fifo_writer_to_reader = "./fifo_bigset_writer_to_reader", \
|
||||
.fifo_reader_to_writer = "./fifo_bigset_reader_to_writer", .fd_writer_to_reader = -1, \
|
||||
.fd_reader_to_writer = -1, .notify = 0, .verify = 0 \
|
||||
}
|
||||
|
||||
static inline state_t
|
||||
state_initializer(void)
|
||||
{
|
||||
return (state_t){.memspace = H5I_INVALID_HID,
|
||||
.dapl = H5I_INVALID_HID,
|
||||
.file = {H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID},
|
||||
.filetype = H5T_NATIVE_UINT32,
|
||||
.one_by_one_sid = H5I_INVALID_HID,
|
||||
.quadrant_dcpl = H5I_INVALID_HID,
|
||||
.depth = DEPTH,
|
||||
.rows = ROWS,
|
||||
.cols = COLS,
|
||||
.ndatasets = 5,
|
||||
.asteps = 10,
|
||||
.nsteps = 100,
|
||||
.part_chunk = 0,
|
||||
.skip_chunk = SKIP_CHUNK,
|
||||
.over_extend = 1,
|
||||
.filename = {"", "", "", ""},
|
||||
.expand_2d = false,
|
||||
.test_3d = false,
|
||||
.vds = vds_off,
|
||||
.use_vfd_swmr = true,
|
||||
.use_legacy_swmr = false,
|
||||
.use_named_pipe = true,
|
||||
.use_aux_proc = false,
|
||||
.do_perf = false,
|
||||
.cross_chunk_read = false,
|
||||
.writer = true,
|
||||
.fixed_array = false,
|
||||
.one_dee_max_dims = {ROWS, H5S_UNLIMITED},
|
||||
.chunk_dims = {ROWS, COLS},
|
||||
.fsp_size = FSP_SIZE,
|
||||
.page_buf_size = PAGE_BUF_SIZE,
|
||||
.tick_len = TICK_LEN,
|
||||
.max_lag = MAX_LAG,
|
||||
.flush_raw_data = false,
|
||||
.mdc_init_size = 0,
|
||||
.chunk_cache_size = 0,
|
||||
.deflate_level = 0,
|
||||
.ival = (struct timespec){.tv_sec = MAX_READ_LEN_IN_SECONDS, .tv_nsec = 0}};
|
||||
}
|
||||
|
||||
static bool state_init(state_t *, int, char **);
|
||||
|
||||
static hsize_t two_dee_max_dims[RANK2], three_dee_max_dims[RANK3];
|
||||
static hsize_t two_dee_max_dims[RANK2];
|
||||
static hsize_t three_dee_max_dims[RANK3];
|
||||
|
||||
static void
|
||||
usage(const char *progname)
|
||||
@@ -324,7 +275,6 @@ state_init(state_t *s, int argc, char **argv)
|
||||
{
|
||||
unsigned long tmp;
|
||||
int opt;
|
||||
unsigned i;
|
||||
const hsize_t dims = 1;
|
||||
char * tfile = NULL;
|
||||
char * end;
|
||||
@@ -336,7 +286,49 @@ state_init(state_t *s, int argc, char **argv)
|
||||
const char * s_opts = "ACFMNPRSTVa:bc:d:e:f:g:j:k:l:m:n:o:p:qr:s:tu:v:w:";
|
||||
struct h5_long_options l_opts[] = {{NULL, 0, '\0'}};
|
||||
|
||||
*s = state_initializer();
|
||||
s->memspace = H5I_INVALID_HID;
|
||||
s->dapl = H5I_INVALID_HID;
|
||||
s->filetype = H5T_NATIVE_UINT32;
|
||||
s->one_by_one_sid = H5I_INVALID_HID;
|
||||
s->quadrant_dcpl = H5I_INVALID_HID;
|
||||
s->depth = DEPTH;
|
||||
s->rows = ROWS;
|
||||
s->cols = COLS;
|
||||
s->ndatasets = 5;
|
||||
s->asteps = 10;
|
||||
s->nsteps = 100;
|
||||
s->part_chunk = 0;
|
||||
s->skip_chunk = SKIP_CHUNK;
|
||||
s->over_extend = 1;
|
||||
s->expand_2d = false;
|
||||
s->test_3d = false;
|
||||
s->vds = vds_off;
|
||||
s->use_vfd_swmr = true;
|
||||
s->use_legacy_swmr = false;
|
||||
s->use_named_pipe = true;
|
||||
s->use_aux_proc = false;
|
||||
s->do_perf = false;
|
||||
s->cross_chunk_read = false;
|
||||
s->writer = true, s->fixed_array = false, s->one_dee_max_dims[0] = ROWS;
|
||||
s->one_dee_max_dims[1] = H5S_UNLIMITED;
|
||||
s->chunk_dims[0] = ROWS;
|
||||
s->chunk_dims[1] = COLS;
|
||||
s->fsp_size = FSP_SIZE;
|
||||
s->page_buf_size = PAGE_BUF_SIZE;
|
||||
s->tick_len = TICK_LEN;
|
||||
s->max_lag = MAX_LAG;
|
||||
s->flush_raw_data = false;
|
||||
s->mdc_init_size = 0;
|
||||
s->chunk_cache_size = 0;
|
||||
s->deflate_level = 0;
|
||||
|
||||
s->ival.tv_sec = MAX_READ_LEN_IN_SECONDS;
|
||||
s->ival.tv_nsec = 0;
|
||||
|
||||
for (int i = 0; i < N_FILES; i++) {
|
||||
s->file[i] = H5I_INVALID_HID;
|
||||
s->filename[i] = "";
|
||||
}
|
||||
|
||||
if (H5_basename(argv[0], &tfile) < 0) {
|
||||
HDfprintf(stderr, "H5_basename failed\n");
|
||||
@@ -448,9 +440,10 @@ state_init(state_t *s, int argc, char **argv)
|
||||
s->part_chunk = (unsigned)tmp;
|
||||
else if (opt == 'l') {
|
||||
/* Translate the tick number to time represented by the timespec struct */
|
||||
float time = (float)(((unsigned)tmp * TICK_LEN) / 10.0);
|
||||
unsigned sec = (unsigned)time;
|
||||
unsigned nsec = (unsigned)((time - sec) * 10 * 1000 * 1000);
|
||||
unsigned n_ticks = (unsigned)tmp * TICK_LEN;
|
||||
float time = (float)n_ticks / 10.0F;
|
||||
long sec = (long)time;
|
||||
long nsec = (long)((time - (float)sec) * 10 * 1000 * 1000);
|
||||
|
||||
s->ival.tv_sec = sec;
|
||||
s->ival.tv_nsec = nsec;
|
||||
@@ -666,7 +659,7 @@ state_init(state_t *s, int argc, char **argv)
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
for (i = 0; i < s->ndatasets; i++) {
|
||||
for (unsigned i = 0; i < s->ndatasets; i++) {
|
||||
s->dataset[i] = H5I_INVALID_HID;
|
||||
s->sources[i].ul = s->sources[i].ur = s->sources[i].bl = s->sources[i].br = H5I_INVALID_HID;
|
||||
}
|
||||
@@ -938,7 +931,12 @@ error:
|
||||
static bool
|
||||
np_init(np_state_t *np, bool writer)
|
||||
{
|
||||
*np = NP_INITIALIZER;
|
||||
np->fifo_writer_to_reader = "./fifo_bigset_writer_to_reader";
|
||||
np->fifo_reader_to_writer = "./fifo_bigset_reader_to_writer";
|
||||
np->fd_writer_to_reader = -1;
|
||||
np->fd_reader_to_writer = -1;
|
||||
np->notify = 0;
|
||||
np->verify = 0;
|
||||
|
||||
/*
|
||||
* Use two named pipes(FIFO) to coordinate the writer and reader for
|
||||
@@ -1028,11 +1026,11 @@ error:
|
||||
|
||||
/* Wait for the writer's notice before starting validation */
|
||||
static int
|
||||
reader_verify(np_state_t np, int verify)
|
||||
reader_verify(np_state_t *np, int verify)
|
||||
{
|
||||
int notify;
|
||||
|
||||
if (HDread(np.fd_writer_to_reader, ¬ify, sizeof(int)) < 0) {
|
||||
if (HDread(np->fd_writer_to_reader, ¬ify, sizeof(int)) < 0) {
|
||||
HDfprintf(stderr, "HDread failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -1103,7 +1101,7 @@ error:
|
||||
* This time period is from the writer finishing dataset creation to the reader finishing
|
||||
* the validation of dataset creation */
|
||||
static int
|
||||
reader_check_time_and_notify_writer(np_state_t *np, state_t s)
|
||||
reader_check_time_and_notify_writer(np_state_t *np, state_t *s)
|
||||
{
|
||||
struct timespec last = {0, 0};
|
||||
|
||||
@@ -1116,7 +1114,7 @@ reader_check_time_and_notify_writer(np_state_t *np, state_t s)
|
||||
/* If the dataset validation takes longer than the expected time, issue a warning.
|
||||
* This time period is from the writer finishing dataset creation to the reader finishing
|
||||
* the validation of dataset creation */
|
||||
if (below_speed_limit(&last, &(s.ival))) {
|
||||
if (below_speed_limit(&last, &(s->ival))) {
|
||||
AT();
|
||||
HDfprintf(stderr, "Warning: dataset validation took too long to finish\n");
|
||||
}
|
||||
@@ -1242,14 +1240,13 @@ md_ck_cb(char *md_file_path, uint64_t updater_seq_num)
|
||||
if (chk_fp && HDfclose(chk_fp) != 0)
|
||||
FAIL_STACK_ERROR;
|
||||
|
||||
if (buf)
|
||||
HDfree(buf);
|
||||
HDfree(buf);
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
if (buf)
|
||||
HDfree(buf);
|
||||
HDfree(buf);
|
||||
|
||||
if (md_fp)
|
||||
HDfclose(md_fp);
|
||||
if (chk_fp)
|
||||
@@ -1580,13 +1577,13 @@ error:
|
||||
}
|
||||
|
||||
static bool
|
||||
create_dsets(state_t s)
|
||||
create_dsets(state_t *s)
|
||||
{
|
||||
struct timespec start_time, end_time;
|
||||
unsigned int which;
|
||||
|
||||
/* For checking the time spent in dataset creation. It's for running the writer alone */
|
||||
if (s.do_perf) {
|
||||
if (s->do_perf) {
|
||||
if (HDclock_gettime(CLOCK_MONOTONIC, &start_time) == -1) {
|
||||
HDfprintf(stderr, "HDclock_gettime failed");
|
||||
TEST_ERROR;
|
||||
@@ -1596,14 +1593,14 @@ create_dsets(state_t s)
|
||||
/* Create NDATASETS datasets as the reader is doing verification. So no communication with
|
||||
* the reader during the creation of datasets.
|
||||
*/
|
||||
for (which = 0; which < s.ndatasets; which++)
|
||||
if (!create_extensible_dset(&s, which)) {
|
||||
for (which = 0; which < s->ndatasets; which++)
|
||||
if (!create_extensible_dset(s, which)) {
|
||||
HDfprintf(stderr, "create_extensible_dset failed: number %u\n", which);
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* For checking the time spent in dataset creation. It's for running the writer alone */
|
||||
if (s.do_perf) {
|
||||
if (s->do_perf) {
|
||||
if (HDclock_gettime(CLOCK_MONOTONIC, &end_time) == -1) {
|
||||
HDfprintf(stderr, "HDclock_gettime failed");
|
||||
TEST_ERROR;
|
||||
@@ -1642,7 +1639,7 @@ error:
|
||||
}
|
||||
|
||||
static mat_t *
|
||||
newmat(state_t s)
|
||||
newmat(state_t *s)
|
||||
{
|
||||
mat_t *mat;
|
||||
|
||||
@@ -1650,31 +1647,31 @@ newmat(state_t s)
|
||||
* If partial chunk is enabled, the chunk size along the growing dimension
|
||||
* is replaced with the partial size
|
||||
*/
|
||||
if (s.test_3d) {
|
||||
if (s.part_chunk) {
|
||||
mat = HDmalloc(sizeof(*mat) + (s.part_chunk * s.rows * s.cols - 1) * sizeof(mat->elt[0]));
|
||||
mat->depth = s.part_chunk;
|
||||
if (s->test_3d) {
|
||||
if (s->part_chunk) {
|
||||
mat = HDmalloc(sizeof(*mat) + (s->part_chunk * s->rows * s->cols - 1) * sizeof(mat->elt[0]));
|
||||
mat->depth = s->part_chunk;
|
||||
}
|
||||
else {
|
||||
mat = HDmalloc(sizeof(*mat) + (s.depth * s.rows * s.cols - 1) * sizeof(mat->elt[0]));
|
||||
mat->depth = s.depth;
|
||||
mat = HDmalloc(sizeof(*mat) + (s->depth * s->rows * s->cols - 1) * sizeof(mat->elt[0]));
|
||||
mat->depth = s->depth;
|
||||
}
|
||||
|
||||
mat->rows = s.rows;
|
||||
mat->cols = s.cols;
|
||||
mat->rows = s->rows;
|
||||
mat->cols = s->cols;
|
||||
}
|
||||
else {
|
||||
if (s.part_chunk && !s.expand_2d) {
|
||||
mat = HDmalloc(sizeof(*mat) + (s.rows * s.part_chunk - 1) * sizeof(mat->elt[0]));
|
||||
if (s->part_chunk && !s->expand_2d) {
|
||||
mat = HDmalloc(sizeof(*mat) + (s->rows * s->part_chunk - 1) * sizeof(mat->elt[0]));
|
||||
mat->depth = 1;
|
||||
mat->rows = s.rows;
|
||||
mat->cols = s.part_chunk;
|
||||
mat->rows = s->rows;
|
||||
mat->cols = s->part_chunk;
|
||||
}
|
||||
else {
|
||||
mat = HDmalloc(sizeof(*mat) + (s.rows * s.cols - 1) * sizeof(mat->elt[0]));
|
||||
mat = HDmalloc(sizeof(*mat) + (s->rows * s->cols - 1) * sizeof(mat->elt[0]));
|
||||
mat->depth = 1;
|
||||
mat->rows = s.rows;
|
||||
mat->cols = s.cols;
|
||||
mat->rows = s->rows;
|
||||
mat->cols = s->cols;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1771,7 +1768,7 @@ verify_matrix(mat_t *mat, unsigned int which, base_t base)
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
calc_total_steps(state_t s)
|
||||
calc_total_steps(state_t *s)
|
||||
{
|
||||
unsigned int total_steps = 0;
|
||||
|
||||
@@ -1781,20 +1778,20 @@ calc_total_steps(state_t s)
|
||||
* 60. When the size of the partial chunk along the growing dimension is 5
|
||||
* (treated as the new chunk size), the number of steps becomes 12.
|
||||
*/
|
||||
if (s.test_3d) {
|
||||
if (s.part_chunk)
|
||||
total_steps = s.nsteps * s.depth / s.part_chunk;
|
||||
if (s->test_3d) {
|
||||
if (s->part_chunk)
|
||||
total_steps = s->nsteps * s->depth / s->part_chunk;
|
||||
else
|
||||
total_steps = s.nsteps;
|
||||
total_steps = s->nsteps;
|
||||
}
|
||||
else if (s.expand_2d) {
|
||||
total_steps = s.nsteps;
|
||||
else if (s->expand_2d) {
|
||||
total_steps = s->nsteps;
|
||||
}
|
||||
else {
|
||||
if (s.part_chunk)
|
||||
total_steps = s.nsteps * s.cols / s.part_chunk;
|
||||
if (s->part_chunk)
|
||||
total_steps = s->nsteps * s->cols / s->part_chunk;
|
||||
else
|
||||
total_steps = s.nsteps;
|
||||
total_steps = s->nsteps;
|
||||
}
|
||||
|
||||
return total_steps;
|
||||
@@ -2010,7 +2007,6 @@ verify_extensible_dset(state_t *s, unsigned int which, mat_t *mat, unsigned fini
|
||||
hsize_t size2[RANK2], size3[RANK3];
|
||||
base_t base, last;
|
||||
unsigned int nchunks, step, ofs;
|
||||
int i;
|
||||
h5_retry_t retry;
|
||||
hbool_t do_try; /* more tries remain */
|
||||
|
||||
@@ -2173,7 +2169,7 @@ error:
|
||||
}
|
||||
|
||||
static bool
|
||||
verify_dsets(state_t s, np_state_t *np, mat_t *mat)
|
||||
verify_dsets(state_t *s, np_state_t *np, mat_t *mat)
|
||||
{
|
||||
unsigned finished_step = 0;
|
||||
unsigned which;
|
||||
@@ -2189,16 +2185,16 @@ verify_dsets(state_t s, np_state_t *np, mat_t *mat)
|
||||
/* Receive the notice of the writer finishing creation,
|
||||
* including the number of chunks finished and the timestamp
|
||||
*/
|
||||
if (s.use_named_pipe && HDread(np->fd_writer_to_reader, &last, sizeof(last)) < 0) {
|
||||
if (s->use_named_pipe && HDread(np->fd_writer_to_reader, &last, sizeof(last)) < 0) {
|
||||
HDfprintf(stderr, "HDread failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
for (which = 0; which < s.ndatasets; which++) {
|
||||
for (which = 0; which < s->ndatasets; which++) {
|
||||
/* Verify the chunks starting from the finished one in last round
|
||||
* to the ones written in this round
|
||||
*/
|
||||
if (!verify_extensible_dset(&s, which, mat, finished_step, last.step)) {
|
||||
if (!verify_extensible_dset(s, which, mat, finished_step, last.step)) {
|
||||
HDfprintf(stderr, "verify_extensible_dset failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2210,7 +2206,7 @@ verify_dsets(state_t s, np_state_t *np, mat_t *mat)
|
||||
/* Make sure the chunk verification doesn't take longer than the expected time.
|
||||
* This time period is from the writer finishing chunks to the reader finishing
|
||||
* the validation of the chunks */
|
||||
if (s.use_named_pipe && below_speed_limit(&(last.time), &(s.ival))) {
|
||||
if (s->use_named_pipe && below_speed_limit(&(last.time), &(s->ival))) {
|
||||
AT();
|
||||
HDfprintf(stderr, "Warning: verify_extensible_dset took too long to finish\n");
|
||||
}
|
||||
@@ -2218,7 +2214,7 @@ verify_dsets(state_t s, np_state_t *np, mat_t *mat)
|
||||
/* For checking the time lapse between the writer's finishing writing a batch of chunks
|
||||
* within a tick and the reader's finishing verifying those chunks
|
||||
*/
|
||||
if (s.use_named_pipe && s.do_perf) {
|
||||
if (s->use_named_pipe && s->do_perf) {
|
||||
if (HDclock_gettime(CLOCK_MONOTONIC, &end_time) == -1) {
|
||||
HDfprintf(stderr, "HDclock_gettime failed");
|
||||
TEST_ERROR;
|
||||
@@ -2238,7 +2234,7 @@ verify_dsets(state_t s, np_state_t *np, mat_t *mat)
|
||||
} while (finished_step < total_steps);
|
||||
|
||||
/* Print out the performance information */
|
||||
if (s.use_named_pipe && s.do_perf && counter)
|
||||
if (s->use_named_pipe && s->do_perf && counter)
|
||||
HDfprintf(stdout, "Dataset verification: mean time = %lf, max time = %lf, min time = %lf\n",
|
||||
total_time / (double)counter, max_time, min_time);
|
||||
|
||||
@@ -2456,20 +2452,20 @@ error:
|
||||
}
|
||||
|
||||
static bool
|
||||
write_dsets(state_t s, np_state_t *np, mat_t *mat)
|
||||
write_dsets(state_t *s, np_state_t *np, mat_t *mat)
|
||||
{
|
||||
unsigned last_step, step, total_steps, which;
|
||||
unsigned long long old_tick_num;
|
||||
H5F_t * f = NULL;
|
||||
struct timespec start_time, end_time;
|
||||
|
||||
if (NULL == (f = (H5F_t *)H5VL_object(s.file[0]))) {
|
||||
if (NULL == (f = (H5F_t *)H5VL_object(s->file[0]))) {
|
||||
HDfprintf(stderr, "H5VL_object failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* For checking the time spent in writing data. It's for running the writer alone */
|
||||
if (s.do_perf) {
|
||||
if (s->do_perf) {
|
||||
if (HDclock_gettime(CLOCK_MONOTONIC, &start_time) == -1) {
|
||||
HDfprintf(stderr, "HDclock_gettime failed");
|
||||
TEST_ERROR;
|
||||
@@ -2488,10 +2484,10 @@ write_dsets(state_t s, np_state_t *np, mat_t *mat)
|
||||
for (step = 0; step < total_steps; step++) {
|
||||
/* Write as many as chunks before the tick number changes */
|
||||
if (f->shared->tick_num == old_tick_num) {
|
||||
if (!s.skip_chunk || (s.skip_chunk && step % s.skip_chunk != 0)) {
|
||||
for (which = 0; which < s.ndatasets; which++) {
|
||||
if (!s->skip_chunk || (s->skip_chunk && step % s->skip_chunk != 0)) {
|
||||
for (which = 0; which < s->ndatasets; which++) {
|
||||
dbgf(2, "step %d which %d\n", step, which);
|
||||
if (!write_extensible_dset(&s, which, step, mat)) {
|
||||
if (!write_extensible_dset(s, which, step, mat)) {
|
||||
HDfprintf(stderr, "write_extensible_dset failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2504,7 +2500,7 @@ write_dsets(state_t s, np_state_t *np, mat_t *mat)
|
||||
*/
|
||||
if (f->shared->tick_num > old_tick_num || step == (total_steps - 1)) {
|
||||
last_step = step + 1;
|
||||
if (s.use_named_pipe && notify_reader(np, last_step) < 0) {
|
||||
if (s->use_named_pipe && notify_reader(np, last_step) < 0) {
|
||||
HDfprintf(stderr, "notify_reader failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2514,7 +2510,7 @@ write_dsets(state_t s, np_state_t *np, mat_t *mat)
|
||||
}
|
||||
|
||||
/* For checking the time spent in writing data. It's for running the writer alone */
|
||||
if (s.do_perf) {
|
||||
if (s->do_perf) {
|
||||
double throughput;
|
||||
double time_passed;
|
||||
|
||||
@@ -2526,13 +2522,13 @@ write_dsets(state_t s, np_state_t *np, mat_t *mat)
|
||||
time_passed = TIME_PASSED(start_time, end_time);
|
||||
|
||||
/* Calculate the write speed */
|
||||
if (s.test_3d)
|
||||
if (s->test_3d)
|
||||
throughput =
|
||||
((double)(sizeof(unsigned int) * s.depth * s.rows * s.cols * s.nsteps * s.ndatasets)) /
|
||||
((double)(sizeof(unsigned int) * s->depth * s->rows * s->cols * s->nsteps * s->ndatasets)) /
|
||||
time_passed;
|
||||
else
|
||||
throughput =
|
||||
((double)(sizeof(unsigned int) * s.rows * s.cols * s.nsteps * s.ndatasets)) / time_passed;
|
||||
((double)(sizeof(unsigned int) * s->rows * s->cols * s->nsteps * s->ndatasets)) / time_passed;
|
||||
|
||||
/* Print out the performance information */
|
||||
HDfprintf(stdout,
|
||||
@@ -2550,14 +2546,20 @@ error:
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
mat_t * mat = NULL;
|
||||
hid_t fcpl = H5I_INVALID_HID;
|
||||
unsigned which;
|
||||
state_t s;
|
||||
np_state_t np;
|
||||
size_t i;
|
||||
mat_t * mat = NULL;
|
||||
hid_t fcpl = H5I_INVALID_HID;
|
||||
state_t * s = NULL;
|
||||
np_state_t * np = NULL;
|
||||
H5F_vfd_swmr_config_t *config = NULL;
|
||||
|
||||
if (!state_init(&s, argc, argv)) {
|
||||
if (NULL == (s = HDcalloc(1, sizeof(state_t))))
|
||||
TEST_ERROR;
|
||||
if (NULL == (np = HDcalloc(1, sizeof(np_state_t))))
|
||||
TEST_ERROR;
|
||||
if (NULL == (config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))))
|
||||
TEST_ERROR;
|
||||
|
||||
if (!state_init(s, argc, argv)) {
|
||||
HDfprintf(stderr, "state_init failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2568,18 +2570,19 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Set fs_strategy (file space strategy) and fs_page_size (file space page size) */
|
||||
if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, s.fsp_size)) < 0) {
|
||||
if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, s->fsp_size)) < 0) {
|
||||
HDfprintf(stderr, "vfd_swmr_create_fcpl failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
for (i = 0; i < NELMTS(s.file); i++) {
|
||||
hid_t fapl;
|
||||
H5F_vfd_swmr_config_t config;
|
||||
H5AC_cache_config_t mdc_config;
|
||||
for (size_t i = 0; i < NELMTS(s->file); i++) {
|
||||
hid_t fapl;
|
||||
H5AC_cache_config_t mdc_config;
|
||||
|
||||
if (s.vds != vds_multi && i > 0) {
|
||||
s.file[i] = s.file[0];
|
||||
HDmemset(config, 0, sizeof(H5F_vfd_swmr_config_t));
|
||||
|
||||
if (s->vds != vds_multi && i > 0) {
|
||||
s->file[i] = s->file[0];
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2591,29 +2594,29 @@ main(int argc, char **argv)
|
||||
|
||||
/* If using the auxiliary process, the writer creates the updater files.
|
||||
* The reader uses the metadata file generated by the auxiliary process. */
|
||||
if (s.writer) {
|
||||
init_vfd_swmr_config(&config, s.tick_len, s.max_lag, FALSE, s.writer, FALSE, TRUE,
|
||||
s.flush_raw_data, 128, "./", "bigset-shadow-%zu", "bigset_updater", i);
|
||||
if (s->writer) {
|
||||
init_vfd_swmr_config(config, s->tick_len, s->max_lag, FALSE, s->writer, FALSE, TRUE,
|
||||
s->flush_raw_data, 128, "./", "bigset-shadow-%zu", "bigset_updater", i);
|
||||
}
|
||||
else {
|
||||
init_vfd_swmr_config(&config, s.tick_len, s.max_lag, FALSE, s.writer, TRUE, FALSE,
|
||||
s.flush_raw_data, 128, "./", "mdfile", NULL);
|
||||
init_vfd_swmr_config(config, s->tick_len, s->max_lag, FALSE, s->writer, TRUE, FALSE,
|
||||
s->flush_raw_data, 128, "./", "mdfile", NULL);
|
||||
}
|
||||
#else
|
||||
|
||||
if (s.vds == vds_multi || s.vds == vds_single) {
|
||||
init_vfd_swmr_config(&config, s.tick_len, s.max_lag, TRUE, s.writer, TRUE, FALSE,
|
||||
s.flush_raw_data, 128, "", "", NULL);
|
||||
if (s->vds == vds_multi || s->vds == vds_single) {
|
||||
init_vfd_swmr_config(config, s->tick_len, s->max_lag, TRUE, s->writer, TRUE, FALSE,
|
||||
s->flush_raw_data, 128, "", "%s", NULL, "");
|
||||
}
|
||||
else {
|
||||
init_vfd_swmr_config(&config, s.tick_len, s.max_lag, FALSE, s.writer, TRUE, FALSE,
|
||||
s.flush_raw_data, 128, "./", "bigset-shadow-%zu", NULL, i);
|
||||
init_vfd_swmr_config(config, s->tick_len, s->max_lag, FALSE, s->writer, TRUE, FALSE,
|
||||
s->flush_raw_data, 128, "./", "bigset-shadow-%zu", NULL, i);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */
|
||||
if ((fapl = vfd_swmr_create_fapl(true, s.use_vfd_swmr, true, s.page_buf_size, &config)) < 0) {
|
||||
if ((fapl = vfd_swmr_create_fapl(true, s->use_vfd_swmr, true, s->page_buf_size, config)) < 0) {
|
||||
HDfprintf(stderr, "vfd_swmr_create_fapl failed");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2621,7 +2624,7 @@ main(int argc, char **argv)
|
||||
/* Set the initial size for the metadata cache between 1 and 32 in megabytes.
|
||||
* Zero means using the default value, which is no-op.
|
||||
*/
|
||||
if (s.mdc_init_size) {
|
||||
if (s->mdc_init_size) {
|
||||
mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
|
||||
|
||||
if (H5Pget_mdc_config(fapl, &mdc_config) < 0) {
|
||||
@@ -2631,7 +2634,7 @@ main(int argc, char **argv)
|
||||
|
||||
/* Convert the value to megabytes */
|
||||
mdc_config.set_initial_size = TRUE;
|
||||
mdc_config.initial_size = s.mdc_init_size * 1024 * 1024;
|
||||
mdc_config.initial_size = s->mdc_init_size * 1024 * 1024;
|
||||
|
||||
if (H5Pset_mdc_config(fapl, &mdc_config) < 0) {
|
||||
HDfprintf(stderr, "H5Pset_mdc_config failed");
|
||||
@@ -2652,11 +2655,11 @@ main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
s.file[i] = s.writer ? H5Fcreate(s.filename[i], H5F_ACC_TRUNC, fcpl, fapl)
|
||||
: H5Fopen(s.filename[i], H5F_ACC_RDONLY, fapl);
|
||||
s->file[i] = s->writer ? H5Fcreate(s->filename[i], H5F_ACC_TRUNC, fcpl, fapl)
|
||||
: H5Fopen(s->filename[i], H5F_ACC_RDONLY, fapl);
|
||||
|
||||
if (s.file[i] == H5I_INVALID_HID) {
|
||||
HDfprintf(stderr, s.writer ? "H5Fcreate failed" : "H5Fopen failed");
|
||||
if (s->file[i] == H5I_INVALID_HID) {
|
||||
HDfprintf(stderr, s->writer ? "H5Fcreate failed" : "H5Fopen failed");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
@@ -2667,15 +2670,15 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Initiailze named pipes */
|
||||
if (s.use_named_pipe && !np_init(&np, s.writer)) {
|
||||
if (s->use_named_pipe && !np_init(np, s->writer)) {
|
||||
HDfprintf(stderr, "np_init() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (s.writer) {
|
||||
if (s->writer) {
|
||||
/* Writer tells reader to start */
|
||||
np.notify = 1;
|
||||
if (s.use_named_pipe && HDwrite(np.fd_writer_to_reader, &np.notify, sizeof(int)) < 0) {
|
||||
np->notify = 1;
|
||||
if (s->use_named_pipe && HDwrite(np->fd_writer_to_reader, &(np->notify), sizeof(int)) < 0) {
|
||||
HDfprintf(stderr, "HDwrite failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2687,18 +2690,16 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Call H5Fvfd_swmr_end_tick to end the tick. No communication with the reader in this step */
|
||||
if (s.use_vfd_swmr && s.use_named_pipe) {
|
||||
unsigned long j;
|
||||
|
||||
if (s.vds != vds_multi) {
|
||||
if (H5Fvfd_swmr_end_tick(s.file[0]) < 0) {
|
||||
if (s->use_vfd_swmr && s->use_named_pipe) {
|
||||
if (s->vds != vds_multi) {
|
||||
if (H5Fvfd_swmr_end_tick(s->file[0]) < 0) {
|
||||
HDfprintf(stderr, "H5Fvfd_swmr_end_tick failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (j = 0; j < NELMTS(s.file); j++)
|
||||
if (H5Fvfd_swmr_end_tick(s.file[j]) < 0) {
|
||||
for (unsigned long j = 0; j < NELMTS(s->file); j++)
|
||||
if (H5Fvfd_swmr_end_tick(s->file[j]) < 0) {
|
||||
HDfprintf(stderr, "H5Fvfd_swmr_end_tick failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2707,29 +2708,29 @@ main(int argc, char **argv)
|
||||
|
||||
/* Notify the reader of finishing dataset creation by sending the timestamp
|
||||
* and wait for the reader to finish validation before proceeding */
|
||||
np.verify = 2;
|
||||
if (s.use_named_pipe && notify_and_wait_for_reader(&s, &np) < 0) {
|
||||
np->verify = 2;
|
||||
if (s->use_named_pipe && notify_and_wait_for_reader(s, np) < 0) {
|
||||
HDfprintf(stderr, "notify_and_wait_for_reader failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* Enable the Legacy SWMR writing mode if specified */
|
||||
if (s.use_legacy_swmr && H5Fstart_swmr_write(s.file[0]) < 0) {
|
||||
if (s->use_legacy_swmr && H5Fstart_swmr_write(s->file[0]) < 0) {
|
||||
HDfprintf(stderr, "failed to start the Legacy SWMR writing mode\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* Start to write chunks. The writer writes as many chunks as possible within a tick, then
|
||||
* notify the reader. But it doesn't receive back the reader's notice. */
|
||||
if (!write_dsets(s, &np, mat)) {
|
||||
if (!write_dsets(s, np, mat)) {
|
||||
HDfprintf(stderr, "write_dsets failed");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Wait for the writer's notice before starting the validation of dataset creation */
|
||||
np.verify = 1;
|
||||
if (s.use_named_pipe && reader_verify(np, np.verify) < 0) {
|
||||
np->verify = 1;
|
||||
if (s->use_named_pipe && reader_verify(np, np->verify) < 0) {
|
||||
HDfprintf(stderr, "reader_verify failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2737,7 +2738,7 @@ main(int argc, char **argv)
|
||||
/* Open all the datasets as the writer is creating them. No communication with
|
||||
* the writer during this step.
|
||||
*/
|
||||
if (!open_extensible_dset(&s)) {
|
||||
if (!open_extensible_dset(s)) {
|
||||
HDfprintf(stderr, "open_extensible_dset failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2746,8 +2747,8 @@ main(int argc, char **argv)
|
||||
* Make sure the dataset creation doesn't take longer than the expected time.
|
||||
* This time period is from the writer finishing dataset creation to the reader finishing
|
||||
* the validation of dataset creation */
|
||||
np.notify = 2;
|
||||
if (s.use_named_pipe && reader_check_time_and_notify_writer(&np, s) < 0) {
|
||||
np->notify = 2;
|
||||
if (s->use_named_pipe && reader_check_time_and_notify_writer(np, s) < 0) {
|
||||
HDfprintf(stderr, "reader_check_time_and_notify_writer failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2755,14 +2756,14 @@ main(int argc, char **argv)
|
||||
/* Once the reader starts to verify the datasets, it doesn't notify the writer any info.
|
||||
* Both the reader and writer finish by themselves.
|
||||
*/
|
||||
if (!verify_dsets(s, &np, mat)) {
|
||||
if (!verify_dsets(s, np, mat)) {
|
||||
HDfprintf(stderr, "verify_dsets failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
for (which = 0; which < s.ndatasets; which++)
|
||||
if (!close_extensible_dset(&s, which)) {
|
||||
for (unsigned which = 0; which < s->ndatasets; which++)
|
||||
if (!close_extensible_dset(s, which)) {
|
||||
HDfprintf(stderr, "close_extensible_dset failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2772,18 +2773,20 @@ main(int argc, char **argv)
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (s.use_named_pipe && !np_close(&np, s.writer)) {
|
||||
if (s->use_named_pipe && !np_close(np, s->writer)) {
|
||||
HDfprintf(stderr, "np_close() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (!state_destroy(&s)) {
|
||||
if (!state_destroy(s)) {
|
||||
HDfprintf(stderr, "state_destroy failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (mat)
|
||||
HDfree(mat);
|
||||
HDfree(mat);
|
||||
HDfree(s);
|
||||
HDfree(np);
|
||||
HDfree(config);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
@@ -2792,24 +2795,26 @@ error:
|
||||
{
|
||||
H5Pclose(fcpl);
|
||||
|
||||
for (i = 0; i < NELMTS(s.file); i++)
|
||||
H5Fclose(s.file[i]);
|
||||
for (size_t i = 0; i < NELMTS(s->file); i++)
|
||||
H5Fclose(s->file[i]);
|
||||
}
|
||||
H5E_END_TRY;
|
||||
|
||||
if (s.use_named_pipe && np.fd_writer_to_reader >= 0)
|
||||
HDclose(np.fd_writer_to_reader);
|
||||
if (s->use_named_pipe && np->fd_writer_to_reader >= 0)
|
||||
HDclose(np->fd_writer_to_reader);
|
||||
|
||||
if (s.use_named_pipe && np.fd_reader_to_writer >= 0)
|
||||
HDclose(np.fd_reader_to_writer);
|
||||
if (s->use_named_pipe && np->fd_reader_to_writer >= 0)
|
||||
HDclose(np->fd_reader_to_writer);
|
||||
|
||||
if (s.use_named_pipe && !s.writer) {
|
||||
HDremove(np.fifo_writer_to_reader);
|
||||
HDremove(np.fifo_reader_to_writer);
|
||||
if (s->use_named_pipe && !s->writer) {
|
||||
HDremove(np->fifo_writer_to_reader);
|
||||
HDremove(np->fifo_reader_to_writer);
|
||||
}
|
||||
|
||||
if (mat)
|
||||
HDfree(mat);
|
||||
HDfree(mat);
|
||||
HDfree(s);
|
||||
HDfree(np);
|
||||
HDfree(config);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -93,17 +93,6 @@ typedef struct {
|
||||
unsigned int ydecrs; /* -y <ydecrs> option */
|
||||
} state_t;
|
||||
|
||||
/* Initializations for state_t */
|
||||
#define ALL_HID_INITIALIZER \
|
||||
(state_t) \
|
||||
{ \
|
||||
.filename = "", .file = H5I_INVALID_HID, .filetype = H5T_NATIVE_UINT32, \
|
||||
.update_interval = READER_WAIT_TICKS, .csteps = 1, .use_np = true, .use_vfd_swmr = true, \
|
||||
.use_filter = false, .flush_raw_data = true, .single_index = false, .implicit_index = false, \
|
||||
.fa_index = false, .ea_index = false, .bt2_index = false, .rows = 10, .cols = 5, .gwrites = 0, \
|
||||
.pwrites = 0, .twrites = 0, .lwrites = 0, .xincrs = 0, .ydecrs = 0 \
|
||||
}
|
||||
|
||||
/* Structure to hold info for different dataset types */
|
||||
typedef struct {
|
||||
hsize_t chunk_dims[2]; /* Chunk dimensions for all datasets except single_did */
|
||||
@@ -268,7 +257,30 @@ state_init(state_t *s, int argc, char **argv)
|
||||
const char * s_opts = "siferom:n:x:y:g:p:t:l:bqSNUu:c:";
|
||||
struct h5_long_options l_opts[] = {{NULL, 0, '\0'}};
|
||||
|
||||
*s = ALL_HID_INITIALIZER;
|
||||
s->file = H5I_INVALID_HID;
|
||||
s->filetype = H5T_NATIVE_UINT32;
|
||||
s->update_interval = READER_WAIT_TICKS;
|
||||
s->csteps = 1;
|
||||
s->use_np = TRUE;
|
||||
s->use_vfd_swmr = TRUE;
|
||||
s->use_filter = FALSE;
|
||||
s->flush_raw_data = TRUE;
|
||||
s->single_index = FALSE;
|
||||
s->implicit_index = FALSE;
|
||||
s->fa_index = FALSE;
|
||||
s->ea_index = FALSE;
|
||||
s->bt2_index = FALSE;
|
||||
s->rows = 10;
|
||||
s->cols = 5;
|
||||
s->gwrites = 0;
|
||||
s->pwrites = 0;
|
||||
s->twrites = 0;
|
||||
s->lwrites = 0;
|
||||
s->xincrs = 0;
|
||||
s->ydecrs = 0;
|
||||
|
||||
HDmemset(s->filename, 0, PATH_MAX);
|
||||
HDmemset(s->progname, 0, PATH_MAX);
|
||||
|
||||
if (H5_basename(argv[0], &tfile) < 0) {
|
||||
HDprintf("H5_basename failed\n");
|
||||
@@ -2283,21 +2295,30 @@ error:
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
hid_t fapl = H5I_INVALID_HID;
|
||||
hid_t fcpl = H5I_INVALID_HID;
|
||||
bool writer = false;
|
||||
state_t s;
|
||||
const char * personality;
|
||||
H5F_vfd_swmr_config_t config;
|
||||
np_state_t np;
|
||||
dsets_state_t ds;
|
||||
hid_t fapl = H5I_INVALID_HID;
|
||||
hid_t fcpl = H5I_INVALID_HID;
|
||||
bool writer = false;
|
||||
state_t * s = NULL;
|
||||
const char * personality;
|
||||
H5F_vfd_swmr_config_t *config = NULL;
|
||||
np_state_t np;
|
||||
dsets_state_t ds;
|
||||
|
||||
if (!state_init(&s, argc, argv)) {
|
||||
if (NULL == (s = HDcalloc(1, sizeof(state_t)))) {
|
||||
HDprintf("memory allocation failed");
|
||||
TEST_ERROR;
|
||||
}
|
||||
if (NULL == (config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t)))) {
|
||||
HDprintf("memory allocation failed");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (!state_init(s, argc, argv)) {
|
||||
HDprintf("state_init() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
personality = HDstrstr(s.progname, "vfd_swmr_dsetchks_");
|
||||
personality = HDstrstr(s->progname, "vfd_swmr_dsetchks_");
|
||||
|
||||
if (personality != NULL && HDstrcmp(personality, "vfd_swmr_dsetchks_writer") == 0)
|
||||
writer = true;
|
||||
@@ -2311,11 +2332,11 @@ main(int argc, char **argv)
|
||||
/* config, tick_len, max_lag, presume_posix_semantics, writer,
|
||||
* maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved,
|
||||
* md_file_path, md_file_name, updater_file_path */
|
||||
init_vfd_swmr_config(&config, 4, 7, FALSE, writer, TRUE, FALSE, s.flush_raw_data, 128, "./",
|
||||
init_vfd_swmr_config(config, 4, 7, FALSE, writer, TRUE, FALSE, s->flush_raw_data, 128, "./",
|
||||
"dsetchks-shadow", NULL);
|
||||
|
||||
/* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */
|
||||
if ((fapl = vfd_swmr_create_fapl(true, s.use_vfd_swmr, true, 4096, &config)) < 0) {
|
||||
if ((fapl = vfd_swmr_create_fapl(true, s->use_vfd_swmr, true, 4096, config)) < 0) {
|
||||
HDprintf("vfd_swmr_create_fapl() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2327,43 +2348,43 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (writer) {
|
||||
if ((s.file = H5Fcreate(s.filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) {
|
||||
if ((s->file = H5Fcreate(s->filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) {
|
||||
HDprintf("H5Fcreate failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (!create_dsets(&s, &ds)) {
|
||||
if (!create_dsets(s, &ds)) {
|
||||
HDprintf("create_dsets() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((s.file = H5Fopen(s.filename, H5F_ACC_RDONLY, fapl)) < 0) {
|
||||
if ((s->file = H5Fopen(s->filename, H5F_ACC_RDONLY, fapl)) < 0) {
|
||||
HDprintf("H5Fopen failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
if (!open_dsets(&s, &ds)) {
|
||||
if (!open_dsets(s, &ds)) {
|
||||
HDprintf("open_dsets() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initiailze named pipes */
|
||||
if (s.use_np && !np_init(&np, writer)) {
|
||||
if (s->use_np && !np_init(&np, writer)) {
|
||||
HDprintf("np_init() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (writer) {
|
||||
|
||||
if (!perform_dsets_operations(&s, &ds, &config, &np)) {
|
||||
if (!perform_dsets_operations(s, &ds, config, &np)) {
|
||||
HDprintf("perform_dsets_operations() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if (!verify_dsets_operations(&s, &ds, &config, &np, false)) {
|
||||
if (!verify_dsets_operations(s, &ds, config, &np, false)) {
|
||||
HDprintf("perform_dsets_operations() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2384,9 +2405,9 @@ main(int argc, char **argv)
|
||||
* Nothing needs to be done for -x or -y options
|
||||
* (increase and decrease dataset dimension sizes).
|
||||
*/
|
||||
if (!s.flush_raw_data && !s.xincrs && !s.ydecrs && s.use_np) {
|
||||
if (!s->flush_raw_data && !s->xincrs && !s->ydecrs && s->use_np) {
|
||||
|
||||
if (!closing_on_noflush(writer, &s, &ds, &config, &np))
|
||||
if (!closing_on_noflush(writer, s, &ds, config, &np))
|
||||
TEST_ERROR;
|
||||
}
|
||||
else {
|
||||
@@ -2396,17 +2417,20 @@ main(int argc, char **argv)
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (H5Fclose(s.file) < 0) {
|
||||
if (H5Fclose(s->file) < 0) {
|
||||
HDprintf("H5Fclose failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (s.use_np && !np_close(&np, writer)) {
|
||||
if (s->use_np && !np_close(&np, writer)) {
|
||||
HDprintf("np_close() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
HDfree(s);
|
||||
HDfree(config);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
error:
|
||||
@@ -2414,21 +2438,24 @@ error:
|
||||
{
|
||||
H5Pclose(fapl);
|
||||
H5Pclose(fcpl);
|
||||
H5Fclose(s.file);
|
||||
H5Fclose(s->file);
|
||||
}
|
||||
H5E_END_TRY;
|
||||
|
||||
if (s.use_np && np.fd_writer_to_reader >= 0)
|
||||
if (s->use_np && np.fd_writer_to_reader >= 0)
|
||||
HDclose(np.fd_writer_to_reader);
|
||||
|
||||
if (s.use_np && np.fd_reader_to_writer >= 0)
|
||||
if (s->use_np && np.fd_reader_to_writer >= 0)
|
||||
HDclose(np.fd_reader_to_writer);
|
||||
|
||||
if (s.use_np && !writer) {
|
||||
if (s->use_np && !writer) {
|
||||
HDremove(np.fifo_writer_to_reader);
|
||||
HDremove(np.fifo_reader_to_writer);
|
||||
}
|
||||
|
||||
HDfree(s);
|
||||
HDfree(config);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
@@ -91,17 +91,6 @@ typedef struct {
|
||||
unsigned int lastwrite; /* The last operation (-s, -r, -l or -w) performed. */
|
||||
} state_t;
|
||||
|
||||
/* Initializations for state_t */
|
||||
#define ALL_HID_INITIALIZER \
|
||||
(state_t) \
|
||||
{ \
|
||||
.filename = "", .file = H5I_INVALID_HID, .filetype = H5T_NATIVE_UINT32, \
|
||||
.update_interval = READER_WAIT_TICKS, .csteps = 1, .use_np = true, .use_vfd_swmr = true, \
|
||||
.flush_raw_data = true, .compact = false, .compact_write = false, .compact_elmts = MAX_COMPACT_ELMS, \
|
||||
.contig = false, .rows = 10, .cols = 5, .swrites = 0, .rwrites = 0, .lwrites = 0, .wwrites = 0, \
|
||||
.lastwrite = 0, .obj_ref = false, .reg_ref = false \
|
||||
}
|
||||
|
||||
/* Structure to hold info for different dataset types */
|
||||
typedef struct {
|
||||
hid_t compact_did; /* ID for compact dataset */
|
||||
@@ -270,7 +259,29 @@ state_init(state_t *s, int argc, char **argv)
|
||||
const char * s_opts = "pte:gkm:n:s:r:l:w:bqSNUORu:c:";
|
||||
struct h5_long_options l_opts[] = {{NULL, 0, '\0'}};
|
||||
|
||||
*s = ALL_HID_INITIALIZER;
|
||||
s->file = H5I_INVALID_HID;
|
||||
s->filetype = H5T_NATIVE_UINT32;
|
||||
s->update_interval = READER_WAIT_TICKS;
|
||||
s->csteps = 1;
|
||||
s->use_np = TRUE;
|
||||
s->use_vfd_swmr = TRUE;
|
||||
s->flush_raw_data = TRUE;
|
||||
s->compact = FALSE;
|
||||
s->compact_write = FALSE;
|
||||
s->compact_elmts = MAX_COMPACT_ELMS;
|
||||
s->contig = FALSE;
|
||||
s->rows = 10;
|
||||
s->cols = 5;
|
||||
s->swrites = 0;
|
||||
s->rwrites = 0;
|
||||
s->lwrites = 0;
|
||||
s->wwrites = 0;
|
||||
s->lastwrite = 0;
|
||||
s->obj_ref = FALSE;
|
||||
s->reg_ref = FALSE;
|
||||
|
||||
HDmemset(s->filename, 0, PATH_MAX);
|
||||
HDmemset(s->progname, 0, PATH_MAX);
|
||||
|
||||
if (H5_basename(argv[0], &tfile) < 0) {
|
||||
HDprintf("H5_basename failed\n");
|
||||
@@ -2203,21 +2214,26 @@ error:
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
hid_t fapl = H5I_INVALID_HID;
|
||||
hid_t fcpl = H5I_INVALID_HID;
|
||||
bool writer = FALSE;
|
||||
state_t s;
|
||||
const char * personality;
|
||||
H5F_vfd_swmr_config_t config;
|
||||
np_state_t np;
|
||||
dsets_state_t ds;
|
||||
hid_t fapl = H5I_INVALID_HID;
|
||||
hid_t fcpl = H5I_INVALID_HID;
|
||||
bool writer = FALSE;
|
||||
state_t * s = NULL;
|
||||
const char * personality;
|
||||
H5F_vfd_swmr_config_t *config = NULL;
|
||||
np_state_t np;
|
||||
dsets_state_t ds;
|
||||
|
||||
if (!state_init(&s, argc, argv)) {
|
||||
if (NULL == (s = HDcalloc(1, sizeof(state_t))))
|
||||
TEST_ERROR;
|
||||
if (NULL == (config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))))
|
||||
TEST_ERROR;
|
||||
|
||||
if (!state_init(s, argc, argv)) {
|
||||
HDprintf("state_init() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
personality = HDstrstr(s.progname, "vfd_swmr_dsetops_");
|
||||
personality = HDstrstr(s->progname, "vfd_swmr_dsetops_");
|
||||
|
||||
if (personality != NULL && HDstrcmp(personality, "vfd_swmr_dsetops_writer") == 0)
|
||||
writer = true;
|
||||
@@ -2231,11 +2247,11 @@ main(int argc, char **argv)
|
||||
/* config, tick_len, max_lag, presume_posix_semantics, writer,
|
||||
* maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved,
|
||||
* md_file_path, md_file_name, updater_file_path */
|
||||
init_vfd_swmr_config(&config, 4, 7, FALSE, writer, TRUE, FALSE, s.flush_raw_data, 128, "./",
|
||||
init_vfd_swmr_config(config, 4, 7, FALSE, writer, TRUE, FALSE, s->flush_raw_data, 128, "./",
|
||||
"dsetops-shadow", NULL);
|
||||
|
||||
/* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */
|
||||
if ((fapl = vfd_swmr_create_fapl(true, s.use_vfd_swmr, true, 4096, &config)) < 0) {
|
||||
if ((fapl = vfd_swmr_create_fapl(true, s->use_vfd_swmr, true, 4096, config)) < 0) {
|
||||
HDprintf("vfd_swmr_create_fapl() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2247,43 +2263,43 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (writer) {
|
||||
if ((s.file = H5Fcreate(s.filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) {
|
||||
if ((s->file = H5Fcreate(s->filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) {
|
||||
HDprintf("H5Fcreate failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (!create_dsets(&s, &ds)) {
|
||||
if (!create_dsets(s, &ds)) {
|
||||
HDprintf("create_dsets() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((s.file = H5Fopen(s.filename, H5F_ACC_RDONLY, fapl)) < 0) {
|
||||
if ((s->file = H5Fopen(s->filename, H5F_ACC_RDONLY, fapl)) < 0) {
|
||||
HDprintf("H5Fopen failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
if (!open_dsets(&s, &ds)) {
|
||||
if (!open_dsets(s, &ds)) {
|
||||
HDprintf("open_dsets() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initiailze named pipes */
|
||||
if (s.use_np && !np_init(&np, writer)) {
|
||||
if (s->use_np && !np_init(&np, writer)) {
|
||||
HDprintf("np_init() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (writer) {
|
||||
|
||||
if (!perform_dsets_operations(&s, &ds, &config, &np)) {
|
||||
if (!perform_dsets_operations(s, &ds, config, &np)) {
|
||||
HDprintf("perform_dsets_operations() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if (!verify_dsets_operations(&s, &ds, &config, &np, false)) {
|
||||
if (!verify_dsets_operations(s, &ds, config, &np, false)) {
|
||||
HDprintf("perform_dsets_operations() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -2299,9 +2315,9 @@ main(int argc, char **argv)
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (!s.flush_raw_data && s.use_np) {
|
||||
if (!s->flush_raw_data && s->use_np) {
|
||||
|
||||
if (!closing_on_noflush(writer, &s, &ds, &config, &np))
|
||||
if (!closing_on_noflush(writer, s, &ds, config, &np))
|
||||
TEST_ERROR;
|
||||
}
|
||||
else {
|
||||
@@ -2311,17 +2327,20 @@ main(int argc, char **argv)
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (H5Fclose(s.file) < 0) {
|
||||
if (H5Fclose(s->file) < 0) {
|
||||
HDprintf("H5Fclose failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (s.use_np && !np_close(&np, writer)) {
|
||||
if (s->use_np && !np_close(&np, writer)) {
|
||||
HDprintf("np_close() failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
HDfree(s);
|
||||
HDfree(config);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
error:
|
||||
@@ -2329,21 +2348,24 @@ error:
|
||||
{
|
||||
H5Pclose(fapl);
|
||||
H5Pclose(fcpl);
|
||||
H5Fclose(s.file);
|
||||
H5Fclose(s->file);
|
||||
}
|
||||
H5E_END_TRY;
|
||||
|
||||
if (s.use_np && np.fd_writer_to_reader >= 0)
|
||||
if (s->use_np && np.fd_writer_to_reader >= 0)
|
||||
HDclose(np.fd_writer_to_reader);
|
||||
|
||||
if (s.use_np && np.fd_reader_to_writer >= 0)
|
||||
if (s->use_np && np.fd_reader_to_writer >= 0)
|
||||
HDclose(np.fd_reader_to_writer);
|
||||
|
||||
if (s.use_np && !writer) {
|
||||
if (s->use_np && !writer) {
|
||||
HDremove(np.fifo_writer_to_reader);
|
||||
HDremove(np.fifo_reader_to_writer);
|
||||
}
|
||||
|
||||
HDfree(s);
|
||||
HDfree(config);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
+104
-73
@@ -138,15 +138,6 @@ typedef struct {
|
||||
int np_verify;
|
||||
} state_t;
|
||||
|
||||
#define ALL_HID_INITIALIZER \
|
||||
(state_t) \
|
||||
{ \
|
||||
.file = H5I_INVALID_HID, .one_by_one_sid = H5I_INVALID_HID, .filename = "", \
|
||||
.filetype = H5T_NATIVE_UINT32, .nsteps = 10000, .use_vfd_swmr = true, .old_style_grp = false, \
|
||||
.use_named_pipes = true, .w_sleep_len = 112, .tick_len = 4, .max_lag = 7, .ps = 4096, .pbs = 4096, \
|
||||
.del_grp = false, .np_fd_w_to_r = -1, .np_fd_r_to_w = -1, .np_notify = 0, .np_verify = 0 \
|
||||
}
|
||||
|
||||
/*
|
||||
* Operator function to be called by H5Literate.
|
||||
*/
|
||||
@@ -189,7 +180,26 @@ state_init(state_t *s, int argc, char **argv)
|
||||
char * tfile = NULL;
|
||||
char * end;
|
||||
|
||||
*s = ALL_HID_INITIALIZER;
|
||||
s->file = H5I_INVALID_HID;
|
||||
s->one_by_one_sid = H5I_INVALID_HID;
|
||||
s->filetype = H5T_NATIVE_UINT32;
|
||||
s->nsteps = 1000;
|
||||
s->use_vfd_swmr = true;
|
||||
s->old_style_grp = false;
|
||||
s->use_named_pipes = true;
|
||||
s->w_sleep_len = 112;
|
||||
s->tick_len = 4;
|
||||
s->max_lag = 7;
|
||||
s->ps = 4096;
|
||||
s->pbs = 4096;
|
||||
s->del_grp = false;
|
||||
s->np_fd_w_to_r = -1;
|
||||
s->np_fd_r_to_w = -1;
|
||||
s->np_notify = 0;
|
||||
s->np_verify = 0;
|
||||
|
||||
HDmemset(s->filename, 0, PATH_MAX);
|
||||
HDmemset(s->progname, 0, PATH_MAX);
|
||||
|
||||
if (H5_basename(argv[0], &tfile) < 0) {
|
||||
HDprintf("H5_basename failed\n");
|
||||
@@ -280,8 +290,8 @@ state_init(state_t *s, int argc, char **argv)
|
||||
return true;
|
||||
|
||||
error:
|
||||
if (tfile)
|
||||
HDfree(tfile);
|
||||
HDfree(tfile);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -409,16 +419,24 @@ np_rd_send(state_t *s)
|
||||
* A boolean input parameter is used to choose
|
||||
* either reader or writer.
|
||||
* Return:
|
||||
* None
|
||||
* True if succeed
|
||||
* False if an error occurs in sending the message.
|
||||
*/
|
||||
static void
|
||||
static bool
|
||||
np_send_error(state_t *s, bool writer)
|
||||
{
|
||||
int fd = writer ? s->np_fd_w_to_r : s->np_fd_r_to_w;
|
||||
|
||||
s->np_notify = -1;
|
||||
if (writer)
|
||||
HDwrite(s->np_fd_w_to_r, &(s->np_notify), sizeof(int));
|
||||
|
||||
if (HDwrite(fd, &(s->np_notify), sizeof(int)) < 0) {
|
||||
H5_FAILED();
|
||||
AT();
|
||||
HDprintf("HDwrite failed\n");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
HDwrite(s->np_fd_r_to_w, &(s->np_notify), sizeof(int));
|
||||
return true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -513,27 +531,33 @@ error:
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
hid_t fapl = H5I_INVALID_HID, fcpl = H5I_INVALID_HID;
|
||||
unsigned step;
|
||||
bool writer = false;
|
||||
state_t s;
|
||||
const char * personality;
|
||||
H5F_vfd_swmr_config_t config;
|
||||
const char * fifo_writer_to_reader = "./fifo_group_writer_to_reader";
|
||||
const char * fifo_reader_to_writer = "./fifo_group_reader_to_writer";
|
||||
int fd_writer_to_reader = -1, fd_reader_to_writer = -1;
|
||||
int notify = 0, verify = 0;
|
||||
bool wg_ret = false;
|
||||
hid_t fapl = H5I_INVALID_HID;
|
||||
hid_t fcpl = H5I_INVALID_HID;
|
||||
unsigned step;
|
||||
bool writer = false;
|
||||
state_t * s = NULL;
|
||||
const char * personality;
|
||||
H5F_vfd_swmr_config_t *config = NULL;
|
||||
const char * fifo_writer_to_reader = "./fifo_group_writer_to_reader";
|
||||
const char * fifo_reader_to_writer = "./fifo_group_reader_to_writer";
|
||||
int fd_writer_to_reader = -1, fd_reader_to_writer = -1;
|
||||
int notify = 0, verify = 0;
|
||||
bool wg_ret = false;
|
||||
|
||||
struct timespec start_time, end_time;
|
||||
double temp_time;
|
||||
|
||||
if (!state_init(&s, argc, argv)) {
|
||||
if (NULL == (s = HDcalloc(1, sizeof(state_t))))
|
||||
TEST_ERROR;
|
||||
if (NULL == (config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))))
|
||||
TEST_ERROR;
|
||||
|
||||
if (!state_init(s, argc, argv)) {
|
||||
HDprintf("state_init failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
personality = HDstrstr(s.progname, "vfd_swmr_gfail_");
|
||||
personality = HDstrstr(s->progname, "vfd_swmr_gfail_");
|
||||
|
||||
if (personality != NULL && HDstrcmp(personality, "vfd_swmr_gfail_writer") == 0)
|
||||
writer = true;
|
||||
@@ -547,7 +571,7 @@ main(int argc, char **argv)
|
||||
/* config, tick_len, max_lag, presume_posix_semantics, writer,
|
||||
* maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved,
|
||||
* md_file_path, md_file_name, updater_file_path */
|
||||
init_vfd_swmr_config(&config, s.tick_len, s.max_lag, FALSE, writer, TRUE, FALSE, TRUE, 128, "./",
|
||||
init_vfd_swmr_config(config, s->tick_len, s->max_lag, FALSE, writer, TRUE, FALSE, TRUE, 128, "./",
|
||||
"group-shadow", NULL);
|
||||
|
||||
/* If old-style option is chosen, use the earliest file format(H5F_LIBVER_EARLIEST)
|
||||
@@ -555,23 +579,23 @@ main(int argc, char **argv)
|
||||
* vfd_swmr_create_fapl. Otherwise, the latest file format(H5F_LIBVER_LATEST)
|
||||
* should be used as the second parameter of H5Pset_libver_bound().
|
||||
* Also pass the use_vfd_swmr, only_meta_page, page_buf_size, config to vfd_swmr_create_fapl().*/
|
||||
if ((fapl = vfd_swmr_create_fapl(!s.old_style_grp, s.use_vfd_swmr, true, s.pbs, &config)) < 0) {
|
||||
if ((fapl = vfd_swmr_create_fapl(!s->old_style_grp, s->use_vfd_swmr, true, s->pbs, config)) < 0) {
|
||||
HDprintf("vfd_swmr_create_fapl failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* Set fs_strategy (file space strategy) and fs_page_size (file space page size) */
|
||||
if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, s.ps)) < 0) {
|
||||
if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, s->ps)) < 0) {
|
||||
HDprintf("vfd_swmr_create_fcpl() failed");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (writer)
|
||||
s.file = H5Fcreate(s.filename, H5F_ACC_TRUNC, fcpl, fapl);
|
||||
s->file = H5Fcreate(s->filename, H5F_ACC_TRUNC, fcpl, fapl);
|
||||
else
|
||||
s.file = H5Fopen(s.filename, H5F_ACC_RDONLY, fapl);
|
||||
s->file = H5Fopen(s->filename, H5F_ACC_RDONLY, fapl);
|
||||
|
||||
if (s.file < 0) {
|
||||
if (s->file < 0) {
|
||||
HDprintf("H5Fcreate/open failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -580,7 +604,7 @@ main(int argc, char **argv)
|
||||
* two-way communication.
|
||||
* One is for the writer to write to the reader.
|
||||
* The other one is for the reader to signal the writer. */
|
||||
if (s.use_named_pipes && writer) {
|
||||
if (s->use_named_pipes && writer) {
|
||||
/* Writer creates two named pipes(FIFO) */
|
||||
if (HDmkfifo(fifo_writer_to_reader, 0600) < 0) {
|
||||
HDprintf("HDmkfifo failed\n");
|
||||
@@ -594,74 +618,74 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Both the writer and reader open the pipes */
|
||||
if (s.use_named_pipes && (fd_writer_to_reader = HDopen(fifo_writer_to_reader, O_RDWR)) < 0) {
|
||||
if (s->use_named_pipes && (fd_writer_to_reader = HDopen(fifo_writer_to_reader, O_RDWR)) < 0) {
|
||||
HDprintf("HDopen failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (s.use_named_pipes && (fd_reader_to_writer = HDopen(fifo_reader_to_writer, O_RDWR)) < 0) {
|
||||
if (s->use_named_pipes && (fd_reader_to_writer = HDopen(fifo_reader_to_writer, O_RDWR)) < 0) {
|
||||
HDprintf("HDopen failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* Pass the named pipe information to the struct of state_t s, for attribute tests.*/
|
||||
if (s.use_named_pipes) {
|
||||
s.np_fd_w_to_r = fd_writer_to_reader;
|
||||
s.np_fd_r_to_w = fd_reader_to_writer;
|
||||
s.np_notify = notify;
|
||||
s.np_verify = verify;
|
||||
if (s->use_named_pipes) {
|
||||
s->np_fd_w_to_r = fd_writer_to_reader;
|
||||
s->np_fd_r_to_w = fd_reader_to_writer;
|
||||
s->np_notify = notify;
|
||||
s->np_verify = verify;
|
||||
}
|
||||
|
||||
if (writer) {
|
||||
|
||||
for (step = 0; step < s.nsteps; step++) {
|
||||
for (step = 0; step < s->nsteps; step++) {
|
||||
dbgf(2, "writer: step %d\n", step);
|
||||
|
||||
wg_ret = create_group(&s, step);
|
||||
wg_ret = create_group(s, step);
|
||||
if (wg_ret == false) {
|
||||
if (s.use_named_pipes)
|
||||
np_send_error(&s, true);
|
||||
if (s->use_named_pipes && !np_send_error(s, true))
|
||||
HDprintf("Error message send failed\n");
|
||||
HDprintf("create groups failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
if (s.use_named_pipes && np_wr_send_receive(&s) == false) {
|
||||
if (s->use_named_pipes && np_wr_send_receive(s) == false) {
|
||||
HDprintf("writer: write group - verification failed.\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* Delete 1000 groups if the del_grp option is true. */
|
||||
if (s.del_grp && s.nsteps > 1000) {
|
||||
if (s->del_grp && s->nsteps > 1000) {
|
||||
HDprintf("Deleting groups. \n");
|
||||
for (step = s.nsteps - 1; step >= (s.nsteps - 1000); step--) {
|
||||
for (step = s->nsteps - 1; step >= (s->nsteps - 1000); step--) {
|
||||
dbgf(2, "writer: deleting step %d\n", step);
|
||||
|
||||
wg_ret = delete_group(&s, step);
|
||||
wg_ret = delete_group(s, step);
|
||||
if (wg_ret == false) {
|
||||
HDprintf("delete group_operations failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
/* end tick,may be not necessary. */
|
||||
if (H5Fvfd_swmr_end_tick(s.file) < 0)
|
||||
if (H5Fvfd_swmr_end_tick(s->file) < 0)
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* May be necessary for the writer to wait a longer time before
|
||||
closing the file.
|
||||
The default value is 112 tenths of a second(4*s.tick_len*s.max_lag)
|
||||
if tick_len is 4 and max_lag is 7.
|
||||
*/
|
||||
decisleep(s.w_sleep_len);
|
||||
* closing the file.
|
||||
* The default value is 112 tenths of a second(4*s.tick_len*s.max_lag)
|
||||
* if tick_len is 4 and max_lag is 7.
|
||||
*/
|
||||
decisleep(s->w_sleep_len);
|
||||
}
|
||||
else { /*Reader */
|
||||
if (s.use_named_pipes) {
|
||||
if (false == np_rd_receive(&s)) {
|
||||
else { /* Reader */
|
||||
if (s->use_named_pipes) {
|
||||
if (false == np_rd_receive(s)) {
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
dbgf(2, "reader receives the message.\n");
|
||||
if (np_rd_send(&s) == false) {
|
||||
if (np_rd_send(s) == false) {
|
||||
TEST_ERROR;
|
||||
}
|
||||
dbgf(2, "reader sends the message.\n ");
|
||||
@@ -673,7 +697,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
HDprintf("Reader: call back function: check group names.\n");
|
||||
if (H5Literate(s.file, H5_INDEX_NAME, H5_ITER_NATIVE, NULL, op_func, NULL) < 0) {
|
||||
if (H5Literate(s->file, H5_INDEX_NAME, H5_ITER_NATIVE, NULL, op_func, NULL) < 0) {
|
||||
HDprintf("H5Literate failed \n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -695,29 +719,29 @@ main(int argc, char **argv)
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (H5Sclose(s.one_by_one_sid) < 0) {
|
||||
if (H5Sclose(s->one_by_one_sid) < 0) {
|
||||
HDprintf("H5Sclose failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (H5Fclose(s.file) < 0) {
|
||||
if (H5Fclose(s->file) < 0) {
|
||||
HDprintf("H5Fclose failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* Both the writer and reader close the named pipes */
|
||||
if (s.use_named_pipes && HDclose(fd_writer_to_reader) < 0) {
|
||||
if (s->use_named_pipes && HDclose(fd_writer_to_reader) < 0) {
|
||||
HDprintf("HDclose failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (s.use_named_pipes && HDclose(fd_reader_to_writer) < 0) {
|
||||
if (s->use_named_pipes && HDclose(fd_reader_to_writer) < 0) {
|
||||
HDprintf("HDclose failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* Reader finishes last and deletes the named pipes */
|
||||
if (s.use_named_pipes && !writer) {
|
||||
if (s->use_named_pipes && !writer) {
|
||||
if (HDremove(fifo_writer_to_reader) != 0) {
|
||||
HDprintf("HDremove failed\n");
|
||||
TEST_ERROR;
|
||||
@@ -729,6 +753,9 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
HDfree(s);
|
||||
HDfree(config);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
error:
|
||||
@@ -736,24 +763,28 @@ error:
|
||||
{
|
||||
H5Pclose(fapl);
|
||||
H5Pclose(fcpl);
|
||||
H5Sclose(s.one_by_one_sid);
|
||||
H5Fclose(s.file);
|
||||
H5Sclose(s->one_by_one_sid);
|
||||
H5Fclose(s->file);
|
||||
}
|
||||
H5E_END_TRY;
|
||||
|
||||
if (s.use_named_pipes && fd_writer_to_reader >= 0)
|
||||
if (s->use_named_pipes && fd_writer_to_reader >= 0)
|
||||
HDclose(fd_writer_to_reader);
|
||||
|
||||
if (s.use_named_pipes && fd_reader_to_writer >= 0)
|
||||
if (s->use_named_pipes && fd_reader_to_writer >= 0)
|
||||
HDclose(fd_reader_to_writer);
|
||||
|
||||
if (s.use_named_pipes && !writer) {
|
||||
if (s->use_named_pipes && !writer) {
|
||||
HDremove(fifo_writer_to_reader);
|
||||
HDremove(fifo_reader_to_writer);
|
||||
}
|
||||
|
||||
HDfree(s);
|
||||
HDfree(config);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
|
||||
Operator function. Prints the name and type of the object
|
||||
|
||||
+107
-88
@@ -97,18 +97,6 @@ typedef struct {
|
||||
unsigned int nglevels;
|
||||
} state_t;
|
||||
|
||||
#define ALL_HID_INITIALIZER \
|
||||
(state_t) \
|
||||
{ \
|
||||
.file = H5I_INVALID_HID, .one_by_one_sid = H5I_INVALID_HID, .filename = "", \
|
||||
.filetype = H5T_NATIVE_UINT32, .asteps = 1, .nsteps = 100, .use_vfd_swmr = true, \
|
||||
.old_style_grp = false, .grp_op_pattern = ' ', .grp_op_test = false, .at_pattern = ' ', \
|
||||
.attr_test = false, .tick_len = 4, .max_lag = 7, .gperf = false, .glog = false, .min_gc_time = 100., \
|
||||
.max_gc_time = 0., .mean_gc_time = 0., .total_gc_time = 0., .total_time = 0., .mean_time = 0., \
|
||||
.fo_total_time = 0., .fc_total_time = 0., .num_attrs = 1, .vlstr_test = false, .ps = 4096, \
|
||||
.pbs = 4096, .nglevels = 0 \
|
||||
}
|
||||
|
||||
static void
|
||||
usage(const char *progname)
|
||||
{
|
||||
@@ -209,7 +197,37 @@ state_init(state_t *s, int argc, char **argv)
|
||||
char * tfile = NULL;
|
||||
char * end;
|
||||
|
||||
*s = ALL_HID_INITIALIZER;
|
||||
s->file = H5I_INVALID_HID;
|
||||
s->one_by_one_sid = H5I_INVALID_HID;
|
||||
s->filetype = H5T_NATIVE_UINT32;
|
||||
s->asteps = 1;
|
||||
s->nsteps = 100;
|
||||
s->use_vfd_swmr = TRUE;
|
||||
s->old_style_grp = FALSE;
|
||||
s->grp_op_pattern = ' ';
|
||||
s->grp_op_test = FALSE;
|
||||
s->at_pattern = ' ';
|
||||
s->attr_test = FALSE;
|
||||
s->tick_len = 4;
|
||||
s->max_lag = 7;
|
||||
s->gperf = FALSE;
|
||||
s->glog = FALSE;
|
||||
s->min_gc_time = 100;
|
||||
s->max_gc_time = 100;
|
||||
s->mean_gc_time = 0.0;
|
||||
s->total_gc_time = 0.0;
|
||||
s->total_time = 0.0;
|
||||
s->mean_time = 0.0;
|
||||
s->fo_total_time = 0.0;
|
||||
s->fc_total_time = 0.0;
|
||||
s->num_attrs = 1;
|
||||
s->vlstr_test = FALSE;
|
||||
s->ps = 4096;
|
||||
s->pbs = 4096;
|
||||
s->nglevels = 0;
|
||||
|
||||
HDmemset(s->filename, 0, PATH_MAX);
|
||||
HDmemset(s->progname, 0, PATH_MAX);
|
||||
|
||||
if (H5_basename(argv[0], &tfile) < 0) {
|
||||
HDprintf("H5_basename failed\n");
|
||||
@@ -2773,22 +2791,31 @@ error:
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
hid_t fapl = H5I_INVALID_HID, fcpl = H5I_INVALID_HID;
|
||||
unsigned step;
|
||||
bool writer = false;
|
||||
state_t s;
|
||||
const char * personality;
|
||||
H5F_vfd_swmr_config_t config;
|
||||
bool wg_ret = false;
|
||||
struct timespec start_time, end_time;
|
||||
unsigned int num_elems_per_level = 0;
|
||||
hid_t fapl = H5I_INVALID_HID, fcpl = H5I_INVALID_HID;
|
||||
unsigned step;
|
||||
bool writer = false;
|
||||
state_t * s = NULL;
|
||||
const char * personality;
|
||||
H5F_vfd_swmr_config_t *config = NULL;
|
||||
bool wg_ret = false;
|
||||
struct timespec start_time, end_time;
|
||||
unsigned int num_elems_per_level = 0;
|
||||
|
||||
if (!state_init(&s, argc, argv)) {
|
||||
if (NULL == (s = HDcalloc(1, sizeof(state_t)))) {
|
||||
HDprintf("memory allocation failed");
|
||||
TEST_ERROR;
|
||||
}
|
||||
if (NULL == (config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t)))) {
|
||||
HDprintf("memory allocation failed");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (!state_init(s, argc, argv)) {
|
||||
HDprintf("state_init failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
personality = HDstrstr(s.progname, "vfd_swmr_gperf_");
|
||||
personality = HDstrstr(s->progname, "vfd_swmr_gperf_");
|
||||
|
||||
if (personality != NULL && HDstrcmp(personality, "vfd_swmr_gperf_writer") == 0)
|
||||
writer = true;
|
||||
@@ -2807,69 +2834,66 @@ main(int argc, char **argv)
|
||||
/* config, tick_len, max_lag, presume_posix_semantics, writer,
|
||||
* maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved,
|
||||
* md_file_path, md_file_name, updater_file_path */
|
||||
init_vfd_swmr_config(&config, s.tick_len, s.max_lag, FALSE, writer, TRUE, FALSE, FALSE, 128, "./",
|
||||
init_vfd_swmr_config(config, s->tick_len, s->max_lag, FALSE, writer, TRUE, FALSE, FALSE, 128, "./",
|
||||
"group-shadow", NULL);
|
||||
|
||||
/* If the log flag is on, create the log file log-test under the current directory. */
|
||||
if (s.glog == true)
|
||||
init_vfd_swmr_log(&config, "./log-test");
|
||||
if (s->glog == true)
|
||||
init_vfd_swmr_log(config, "./log-test");
|
||||
|
||||
/* If old-style option is chosen, use the earliest file format(H5F_LIBVER_EARLIEST)
|
||||
* as the second parameter of H5Pset_libver_bound() that is called by
|
||||
* vfd_swmr_create_fapl. Otherwise, the latest file format(H5F_LIBVER_LATEST)
|
||||
* should be used as the second parameter of H5Pset_libver_bound().
|
||||
* Also pass the use_vfd_swmr, only_meta_page, page buffer size, config to vfd_swmr_create_fapl().*/
|
||||
if ((fapl = vfd_swmr_create_fapl(!s.old_style_grp, s.use_vfd_swmr, true, s.pbs, &config)) < 0) {
|
||||
if ((fapl = vfd_swmr_create_fapl(!s->old_style_grp, s->use_vfd_swmr, true, s->pbs, config)) < 0) {
|
||||
HDprintf("vfd_swmr_create_fapl failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* Set fs_strategy (file space strategy) and fs_page_size (file space page size) */
|
||||
if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, s.ps)) < 0) {
|
||||
if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, s->ps)) < 0) {
|
||||
HDprintf("vfd_swmr_create_fcpl() failed");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (s.nglevels > 0) {
|
||||
if (s.grp_op_pattern != ' ' || s.at_pattern != ' ') {
|
||||
if (s->nglevels > 0) {
|
||||
if (s->grp_op_pattern != ' ' || s->at_pattern != ' ') {
|
||||
HDprintf("For nested group creation test, only the default option is supported.\n");
|
||||
HDprintf("Please re-run the tests with the appropriate option.\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (s.gperf) {
|
||||
|
||||
if (s->gperf) {
|
||||
if (HDclock_gettime(CLOCK_MONOTONIC, &start_time) == -1) {
|
||||
HDfprintf(stderr, "HDclock_gettime failed");
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
s.file = H5Fcreate(s.filename, H5F_ACC_TRUNC, fcpl, fapl);
|
||||
|
||||
if (s.gperf) {
|
||||
s->file = H5Fcreate(s->filename, H5F_ACC_TRUNC, fcpl, fapl);
|
||||
|
||||
if (s->gperf) {
|
||||
if (HDclock_gettime(CLOCK_MONOTONIC, &end_time) == -1) {
|
||||
HDfprintf(stderr, "HDclock_gettime failed");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
s.fo_total_time = TIME_PASSED(start_time, end_time);
|
||||
s->fo_total_time = TIME_PASSED(start_time, end_time);
|
||||
}
|
||||
|
||||
if (s.file < 0) {
|
||||
if (s->file < 0) {
|
||||
HDprintf("H5Fcreate failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* If generating nested groups, calculate the maximum number of
|
||||
elements per level. */
|
||||
if (s.nglevels > 0)
|
||||
num_elems_per_level = obtain_tree_level_elems(s.nsteps, s.nglevels);
|
||||
|
||||
if (s.gperf) {
|
||||
if (s->nglevels > 0)
|
||||
num_elems_per_level = obtain_tree_level_elems(s->nsteps, s->nglevels);
|
||||
|
||||
if (s->gperf) {
|
||||
if (HDclock_gettime(CLOCK_MONOTONIC, &start_time) == -1) {
|
||||
HDfprintf(stderr, "HDclock_gettime failed");
|
||||
TEST_ERROR;
|
||||
@@ -2877,20 +2901,18 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* If generating nested groups */
|
||||
if (s.nglevels > 0) {
|
||||
|
||||
if (s->nglevels > 0) {
|
||||
/* for the recursive call, the groups under the root is treated as one level */
|
||||
wg_ret = gen_tree_struct(&s, s.nglevels + 1, num_elems_per_level, s.file);
|
||||
wg_ret = gen_tree_struct(s, s->nglevels + 1, num_elems_per_level, s->file);
|
||||
if (wg_ret == false) {
|
||||
HDprintf("write nested group failed at group counter %u\n", grp_counter);
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (step = 0; step < s.nsteps; step++) {
|
||||
|
||||
for (step = 0; step < s->nsteps; step++) {
|
||||
dbgf(2, "writer: step %d\n", step);
|
||||
wg_ret = group_operations(&s, step);
|
||||
wg_ret = group_operations(s, step);
|
||||
if (wg_ret == false) {
|
||||
HDprintf("write_group failed at step %d\n", step);
|
||||
TEST_ERROR;
|
||||
@@ -2898,17 +2920,15 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (s.gperf) {
|
||||
|
||||
if (s->gperf) {
|
||||
if (HDclock_gettime(CLOCK_MONOTONIC, &end_time) == -1) {
|
||||
|
||||
HDfprintf(stderr, "HDclock_gettime failed");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
s.total_time = TIME_PASSED(start_time, end_time);
|
||||
s.mean_time = s.total_time / s.nsteps;
|
||||
s.mean_gc_time = s.total_gc_time / s.nsteps;
|
||||
s->total_time = TIME_PASSED(start_time, end_time);
|
||||
s->mean_time = s->total_time / s->nsteps;
|
||||
s->mean_gc_time = s->total_gc_time / s->nsteps;
|
||||
}
|
||||
|
||||
if (H5Pclose(fapl) < 0) {
|
||||
@@ -2921,68 +2941,61 @@ main(int argc, char **argv)
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (H5Sclose(s.one_by_one_sid) < 0) {
|
||||
if (H5Sclose(s->one_by_one_sid) < 0) {
|
||||
HDprintf("H5Sclose failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (s.gperf) {
|
||||
|
||||
if (s->gperf) {
|
||||
if (HDclock_gettime(CLOCK_MONOTONIC, &start_time) == -1) {
|
||||
|
||||
HDfprintf(stderr, "HDclock_gettime failed");
|
||||
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (H5Fclose(s.file) < 0) {
|
||||
if (H5Fclose(s->file) < 0) {
|
||||
HDprintf("H5Fclose failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (s.gperf) {
|
||||
|
||||
if (s->gperf) {
|
||||
if (HDclock_gettime(CLOCK_MONOTONIC, &end_time) == -1) {
|
||||
|
||||
HDfprintf(stderr, "HDclock_gettime failed");
|
||||
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
s.fc_total_time = TIME_PASSED(start_time, end_time);
|
||||
s->fc_total_time = TIME_PASSED(start_time, end_time);
|
||||
}
|
||||
|
||||
/* Performance statistics summary */
|
||||
if (s.gperf) {
|
||||
if (s->gperf) {
|
||||
|
||||
if (verbosity != 0) {
|
||||
|
||||
HDfprintf(stdout, "\nPerformance Test Configuration: ");
|
||||
if (s.use_vfd_swmr)
|
||||
if (s->use_vfd_swmr)
|
||||
HDfprintf(stdout, " Using VFD SWMR \n");
|
||||
else
|
||||
HDfprintf(stdout, " Not using VFD SWMR \n");
|
||||
|
||||
if (s.old_style_grp)
|
||||
if (s->old_style_grp)
|
||||
HDfprintf(stdout, " Groups: Created via the earliest file format(old-style) \n");
|
||||
else
|
||||
HDfprintf(stdout, " Groups: Created via the latest file format(new-style) \n");
|
||||
|
||||
HDfprintf(stdout, "\n");
|
||||
|
||||
HDfprintf(stdout, "The length of a tick = %u\n", s.tick_len);
|
||||
HDfprintf(stdout, "The maximum expected lag(in ticks)= %u\n", s.max_lag);
|
||||
HDfprintf(stdout, "The page size(in bytes) = %u\n", s.ps);
|
||||
HDfprintf(stdout, "The page buffer size(in bytes) = %u\n", s.pbs);
|
||||
HDfprintf(stdout, "The length of a tick = %u\n", s->tick_len);
|
||||
HDfprintf(stdout, "The maximum expected lag(in ticks)= %u\n", s->max_lag);
|
||||
HDfprintf(stdout, "The page size(in bytes) = %u\n", s->ps);
|
||||
HDfprintf(stdout, "The page buffer size(in bytes) = %u\n", s->pbs);
|
||||
HDfprintf(stdout, "\n");
|
||||
HDfprintf(stdout, "Number of groups = %u\n", s.nsteps);
|
||||
HDfprintf(stdout, "Group Nested levels = %u\n", s.nglevels);
|
||||
HDfprintf(stdout, "Number of attributes = %u\n", s.num_attrs);
|
||||
HDfprintf(stdout, "Number of groups = %u\n", s->nsteps);
|
||||
HDfprintf(stdout, "Group Nested levels = %u\n", s->nglevels);
|
||||
HDfprintf(stdout, "Number of attributes = %u\n", s->num_attrs);
|
||||
HDfprintf(stdout, "Number of element per attribute = 1\n");
|
||||
if (s.vlstr_test)
|
||||
if (s->vlstr_test)
|
||||
HDfprintf(stdout, "Attribute datatype is variable length string. \n");
|
||||
else if (s.filetype == H5T_STD_U32BE)
|
||||
else if (s->filetype == H5T_STD_U32BE)
|
||||
HDfprintf(stdout, "Attribute datatype is big-endian unsigned 32-bit integer.\n");
|
||||
else
|
||||
HDfprintf(stdout, "Attribute datatype is native unsigned 32-bit integer.\n");
|
||||
@@ -2990,19 +3003,22 @@ main(int argc, char **argv)
|
||||
HDfprintf(stdout, "\n");
|
||||
HDfprintf(stdout,
|
||||
"(If the nested level is 0, all the groups are created directly under the root.)\n\n");
|
||||
HDfprintf(stdout, "group creation maximum time =%lf\n", s.max_gc_time);
|
||||
HDfprintf(stdout, "group creation minimum time =%lf\n", s.min_gc_time);
|
||||
HDfprintf(stdout, "group creation maximum time =%lf\n", s->max_gc_time);
|
||||
HDfprintf(stdout, "group creation minimum time =%lf\n", s->min_gc_time);
|
||||
}
|
||||
|
||||
HDfprintf(stdout, "group creation total time = %lf\n", s.total_gc_time);
|
||||
HDfprintf(stdout, "group creation mean time(per group) = %lf\n", s.mean_gc_time);
|
||||
HDfprintf(stdout, "group creation and attributes generation total time = %lf\n", s.total_time);
|
||||
HDfprintf(stdout, "group creation total time = %lf\n", s->total_gc_time);
|
||||
HDfprintf(stdout, "group creation mean time(per group) = %lf\n", s->mean_gc_time);
|
||||
HDfprintf(stdout, "group creation and attributes generation total time = %lf\n", s->total_time);
|
||||
HDfprintf(stdout, "group creation and attributes generation mean time(per group) = %lf\n",
|
||||
s.mean_time);
|
||||
HDfprintf(stdout, "H5Fcreate time = %lf\n", s.fo_total_time);
|
||||
HDfprintf(stdout, "H5Fclose time = %lf\n", s.fc_total_time);
|
||||
s->mean_time);
|
||||
HDfprintf(stdout, "H5Fcreate time = %lf\n", s->fo_total_time);
|
||||
HDfprintf(stdout, "H5Fclose time = %lf\n", s->fc_total_time);
|
||||
}
|
||||
|
||||
HDfree(config);
|
||||
HDfree(s);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
error:
|
||||
@@ -3010,11 +3026,14 @@ error:
|
||||
{
|
||||
H5Pclose(fapl);
|
||||
H5Pclose(fcpl);
|
||||
H5Sclose(s.one_by_one_sid);
|
||||
H5Fclose(s.file);
|
||||
H5Sclose(s->one_by_one_sid);
|
||||
H5Fclose(s->file);
|
||||
}
|
||||
H5E_END_TRY;
|
||||
|
||||
HDfree(config);
|
||||
HDfree(s);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
+115
-79
@@ -51,17 +51,6 @@ typedef struct {
|
||||
int np_verify;
|
||||
} state_t;
|
||||
|
||||
#define ALL_HID_INITIALIZER \
|
||||
(state_t) \
|
||||
{ \
|
||||
.file = H5I_INVALID_HID, .one_by_one_sid = H5I_INVALID_HID, .filename = "", \
|
||||
.filetype = H5T_NATIVE_UINT32, .asteps = 10, .csteps = 10, .nsteps = 100, \
|
||||
.update_interval = READER_WAIT_TICKS, .use_vfd_swmr = TRUE, .old_style_grp = FALSE, \
|
||||
.use_named_pipes = TRUE, .grp_op_pattern = ' ', .grp_op_test = FALSE, .at_pattern = ' ', \
|
||||
.attr_test = FALSE, .tick_len = 4, .max_lag = 7, .ps = 4096, .pbs = 4096, .np_fd_w_to_r = -1, \
|
||||
.np_fd_r_to_w = -1, .np_notify = 0, .np_verify = 0 \
|
||||
}
|
||||
|
||||
static void
|
||||
usage(const char *progname)
|
||||
{
|
||||
@@ -155,7 +144,31 @@ state_init(state_t *s, int argc, char **argv)
|
||||
const char * s_opts = "SGa:bc:n:Nqu:t:m:B:s:A:O:";
|
||||
struct h5_long_options l_opts[] = {{NULL, 0, '\0'}};
|
||||
|
||||
*s = ALL_HID_INITIALIZER;
|
||||
s->file = H5I_INVALID_HID;
|
||||
s->one_by_one_sid = H5I_INVALID_HID;
|
||||
s->filetype = H5T_NATIVE_UINT32;
|
||||
s->asteps = 10;
|
||||
s->csteps = 10;
|
||||
s->nsteps = 100;
|
||||
s->update_interval = READER_WAIT_TICKS;
|
||||
s->use_vfd_swmr = TRUE;
|
||||
s->old_style_grp = FALSE;
|
||||
s->use_named_pipes = TRUE;
|
||||
s->grp_op_pattern = ' ';
|
||||
s->grp_op_test = FALSE;
|
||||
s->at_pattern = ' ';
|
||||
s->attr_test = FALSE;
|
||||
s->tick_len = 4;
|
||||
s->max_lag = 7;
|
||||
s->ps = 4096;
|
||||
s->pbs = 4096;
|
||||
s->np_fd_w_to_r = -1;
|
||||
s->np_fd_r_to_w = -1;
|
||||
s->np_notify = 0;
|
||||
s->np_verify = 0;
|
||||
|
||||
HDmemset(s->filename, 0, PATH_MAX);
|
||||
HDmemset(s->progname, 0, PATH_MAX);
|
||||
|
||||
if (H5_basename(argv[0], &tfile) < 0) {
|
||||
HDprintf("H5_basename failed\n");
|
||||
@@ -461,16 +474,24 @@ np_rd_send(state_t *s)
|
||||
* A boolean input parameter is used to choose
|
||||
* either reader or writer.
|
||||
* Return:
|
||||
* None
|
||||
* True if succeed
|
||||
* False if an error occurs in sending the message.
|
||||
*/
|
||||
static void
|
||||
np_send_error(state_t *s, hbool_t writer)
|
||||
static bool
|
||||
np_send_error(state_t *s, bool writer)
|
||||
{
|
||||
int fd = writer ? s->np_fd_w_to_r : s->np_fd_r_to_w;
|
||||
|
||||
s->np_notify = -1;
|
||||
if (writer)
|
||||
HDwrite(s->np_fd_w_to_r, &(s->np_notify), sizeof(int));
|
||||
|
||||
if (HDwrite(fd, &(s->np_notify), sizeof(int)) < 0) {
|
||||
H5_FAILED();
|
||||
AT();
|
||||
HDprintf("HDwrite failed\n");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
HDwrite(s->np_fd_r_to_w, &(s->np_notify), sizeof(int));
|
||||
return true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -892,7 +913,8 @@ del_one_attr(state_t *s, hid_t obj_id, hbool_t is_dense, hbool_t is_vl_or_ohrc,
|
||||
|
||||
error:
|
||||
if (s->use_named_pipes && s->attr_test == TRUE)
|
||||
np_send_error(s, TRUE);
|
||||
if (!np_send_error(s, TRUE))
|
||||
HDfprintf(stderr, "Sending error message failed");
|
||||
|
||||
error2:
|
||||
return FALSE;
|
||||
@@ -4974,25 +4996,30 @@ verify_group_operations(state_t *s, unsigned int which)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
hid_t fapl = H5I_INVALID_HID, fcpl = H5I_INVALID_HID;
|
||||
unsigned step;
|
||||
hbool_t writer = FALSE;
|
||||
state_t s;
|
||||
const char * personality;
|
||||
H5F_vfd_swmr_config_t config;
|
||||
const char * fifo_writer_to_reader = "./fifo_group_writer_to_reader";
|
||||
const char * fifo_reader_to_writer = "./fifo_group_reader_to_writer";
|
||||
int fd_writer_to_reader = -1, fd_reader_to_writer = -1;
|
||||
int notify = 0, verify = 0;
|
||||
hbool_t wg_ret = FALSE;
|
||||
hbool_t vg_ret = FALSE;
|
||||
hid_t fapl = H5I_INVALID_HID, fcpl = H5I_INVALID_HID;
|
||||
unsigned step;
|
||||
hbool_t writer = FALSE;
|
||||
state_t * s = NULL;
|
||||
const char * personality;
|
||||
H5F_vfd_swmr_config_t *config = NULL;
|
||||
const char * fifo_writer_to_reader = "./fifo_group_writer_to_reader";
|
||||
const char * fifo_reader_to_writer = "./fifo_group_reader_to_writer";
|
||||
int fd_writer_to_reader = -1, fd_reader_to_writer = -1;
|
||||
int notify = 0, verify = 0;
|
||||
hbool_t wg_ret = FALSE;
|
||||
hbool_t vg_ret = FALSE;
|
||||
|
||||
if (!state_init(&s, argc, argv)) {
|
||||
if (NULL == (s = HDcalloc(1, sizeof(state_t))))
|
||||
TEST_ERROR;
|
||||
if (NULL == (config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))))
|
||||
TEST_ERROR;
|
||||
|
||||
if (!state_init(s, argc, argv)) {
|
||||
HDprintf("state_init failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
personality = HDstrstr(s.progname, "vfd_swmr_group_");
|
||||
personality = HDstrstr(s->progname, "vfd_swmr_group_");
|
||||
|
||||
if (personality != NULL && HDstrcmp(personality, "vfd_swmr_group_writer") == 0)
|
||||
writer = TRUE;
|
||||
@@ -5006,7 +5033,7 @@ main(int argc, char **argv)
|
||||
/* config, tick_len, max_lag, presume_posix_semantics, writer,
|
||||
* maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved,
|
||||
* md_file_path, md_file_name, updater_file_path */
|
||||
init_vfd_swmr_config(&config, s.tick_len, s.max_lag, FALSE, writer, TRUE, FALSE, TRUE, 128, "./",
|
||||
init_vfd_swmr_config(config, s->tick_len, s->max_lag, FALSE, writer, TRUE, FALSE, TRUE, 128, "./",
|
||||
"group-shadow", NULL);
|
||||
|
||||
/* If old-style option is chosen, use the earliest file format(H5F_LIBVER_EARLIEST)
|
||||
@@ -5014,23 +5041,23 @@ main(int argc, char **argv)
|
||||
* vfd_swmr_create_fapl. Otherwise, the latest file format(H5F_LIBVER_LATEST)
|
||||
* should be used as the second parameter of H5Pset_libver_bound().
|
||||
* Also pass the use_vfd_swmr, only_meta_page, page_buf_size, config to vfd_swmr_create_fapl().*/
|
||||
if ((fapl = vfd_swmr_create_fapl(!s.old_style_grp, s.use_vfd_swmr, TRUE, s.pbs, &config)) < 0) {
|
||||
if ((fapl = vfd_swmr_create_fapl(!s->old_style_grp, s->use_vfd_swmr, TRUE, s->pbs, config)) < 0) {
|
||||
HDprintf("vfd_swmr_create_fapl failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* Set fs_strategy (file space strategy) and fs_page_size (file space page size) */
|
||||
if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, s.ps)) < 0) {
|
||||
if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, s->ps)) < 0) {
|
||||
HDprintf("vfd_swmr_create_fcpl() failed");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (writer)
|
||||
s.file = H5Fcreate(s.filename, H5F_ACC_TRUNC, fcpl, fapl);
|
||||
s->file = H5Fcreate(s->filename, H5F_ACC_TRUNC, fcpl, fapl);
|
||||
else
|
||||
s.file = H5Fopen(s.filename, H5F_ACC_RDONLY, fapl);
|
||||
s->file = H5Fopen(s->filename, H5F_ACC_RDONLY, fapl);
|
||||
|
||||
if (s.file < 0) {
|
||||
if (s->file < 0) {
|
||||
HDprintf("H5Fcreate/open failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -5039,7 +5066,7 @@ main(int argc, char **argv)
|
||||
* two-way communication so that the two sides can move forward together.
|
||||
* One is for the writer to write to the reader.
|
||||
* The other one is for the reader to signal the writer. */
|
||||
if (s.use_named_pipes && writer) {
|
||||
if (s->use_named_pipes && writer) {
|
||||
/* Writer creates two named pipes(FIFO) */
|
||||
if (HDmkfifo(fifo_writer_to_reader, 0600) < 0) {
|
||||
HDprintf("HDmkfifo failed\n");
|
||||
@@ -5053,22 +5080,22 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Both the writer and reader open the pipes */
|
||||
if (s.use_named_pipes && (fd_writer_to_reader = HDopen(fifo_writer_to_reader, O_RDWR)) < 0) {
|
||||
if (s->use_named_pipes && (fd_writer_to_reader = HDopen(fifo_writer_to_reader, O_RDWR)) < 0) {
|
||||
HDprintf("HDopen failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (s.use_named_pipes && (fd_reader_to_writer = HDopen(fifo_reader_to_writer, O_RDWR)) < 0) {
|
||||
if (s->use_named_pipes && (fd_reader_to_writer = HDopen(fifo_reader_to_writer, O_RDWR)) < 0) {
|
||||
HDprintf("HDopen failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* Pass the named pipe information to the struct of state_t s, for attribute tests.*/
|
||||
if (s.use_named_pipes) {
|
||||
s.np_fd_w_to_r = fd_writer_to_reader;
|
||||
s.np_fd_r_to_w = fd_reader_to_writer;
|
||||
s.np_notify = notify;
|
||||
s.np_verify = verify;
|
||||
if (s->use_named_pipes) {
|
||||
s->np_fd_w_to_r = fd_writer_to_reader;
|
||||
s->np_fd_r_to_w = fd_reader_to_writer;
|
||||
s->np_notify = notify;
|
||||
s->np_verify = verify;
|
||||
}
|
||||
|
||||
/* For attribute test, force the named pipe to communicate in every step.
|
||||
@@ -5076,34 +5103,35 @@ main(int argc, char **argv)
|
||||
* If the named pipe is not forced to communicate in every step, the reader may go ahead
|
||||
* to verify the group and the attribute operations before the writer has a chance to
|
||||
* carry out the corresponding operations. */
|
||||
if (s.attr_test && s.use_named_pipes)
|
||||
s.csteps = 1;
|
||||
if (s->attr_test && s->use_named_pipes)
|
||||
s->csteps = 1;
|
||||
|
||||
/* For group operation test, force the named pipe to communicate in every step. */
|
||||
if (s.grp_op_test && s.use_named_pipes)
|
||||
s.csteps = 1;
|
||||
if (s->grp_op_test && s->use_named_pipes)
|
||||
s->csteps = 1;
|
||||
|
||||
if (writer) {
|
||||
for (step = 0; step < s.nsteps; step++) {
|
||||
for (step = 0; step < s->nsteps; step++) {
|
||||
dbgf(2, "writer: step %d\n", step);
|
||||
|
||||
wg_ret = group_operations(&s, step);
|
||||
wg_ret = group_operations(s, step);
|
||||
|
||||
if (wg_ret == FALSE) {
|
||||
|
||||
/* At communication interval, notifies the reader about the failure and quit */
|
||||
if (s.use_named_pipes && s.attr_test != TRUE && s.grp_op_test != TRUE && step % s.csteps == 0)
|
||||
np_send_error(&s, TRUE);
|
||||
if (s->use_named_pipes && s->attr_test != TRUE && s->grp_op_test != TRUE &&
|
||||
step % s->csteps == 0)
|
||||
np_send_error(s, TRUE);
|
||||
HDprintf("write_group failed at step %d\n", step);
|
||||
TEST_ERROR;
|
||||
}
|
||||
else {
|
||||
|
||||
/* At communication interval, notifies the reader and waits for its response */
|
||||
if (s.use_named_pipes && s.attr_test != TRUE && s.grp_op_test != TRUE &&
|
||||
step % s.csteps == 0) {
|
||||
if (s->use_named_pipes && s->attr_test != TRUE && s->grp_op_test != TRUE &&
|
||||
step % s->csteps == 0) {
|
||||
|
||||
if (np_wr_send_receive(&s) == FALSE) {
|
||||
if (np_wr_send_receive(s) == FALSE) {
|
||||
HDprintf("writer: write group - verification failed.\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -5112,39 +5140,41 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (step = 0; step < s.nsteps; step++) {
|
||||
for (step = 0; step < s->nsteps; step++) {
|
||||
dbgf(1, "reader: step %d\n", step);
|
||||
|
||||
/* At communication interval, waits for the writer to finish creation before starting verification
|
||||
*/
|
||||
if (s.use_named_pipes && s.attr_test != TRUE && s.grp_op_test != TRUE && step % s.csteps == 0) {
|
||||
if (FALSE == np_rd_receive(&s)) {
|
||||
if (s->use_named_pipes && s->attr_test != TRUE && s->grp_op_test != TRUE &&
|
||||
step % s->csteps == 0) {
|
||||
if (FALSE == np_rd_receive(s)) {
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* For the default test, wait for a few ticks for the update to happen */
|
||||
if (s.use_named_pipes && s.attr_test == FALSE)
|
||||
decisleep(config.tick_len * s.update_interval);
|
||||
if (s->use_named_pipes && s->attr_test == FALSE)
|
||||
decisleep(config->tick_len * s->update_interval);
|
||||
|
||||
vg_ret = verify_group_operations(&s, step);
|
||||
vg_ret = verify_group_operations(s, step);
|
||||
|
||||
if (vg_ret == FALSE) {
|
||||
|
||||
HDprintf("verify_group_operations failed\n");
|
||||
|
||||
/* At communication interval, tell the writer about the failure and exit */
|
||||
if (s.use_named_pipes && s.attr_test != TRUE && s.grp_op_test != TRUE && step % s.csteps == 0)
|
||||
np_send_error(&s, FALSE);
|
||||
if (s->use_named_pipes && s->attr_test != TRUE && s->grp_op_test != TRUE &&
|
||||
step % s->csteps == 0)
|
||||
np_send_error(s, FALSE);
|
||||
TEST_ERROR;
|
||||
}
|
||||
else {
|
||||
|
||||
/* Send back the same notify value for acknowledgement to tell the writer
|
||||
* move to the next step. */
|
||||
if (s.use_named_pipes && s.attr_test != TRUE && s.grp_op_test != TRUE &&
|
||||
step % s.csteps == 0) {
|
||||
if (np_rd_send(&s) == FALSE) {
|
||||
if (s->use_named_pipes && s->attr_test != TRUE && s->grp_op_test != TRUE &&
|
||||
step % s->csteps == 0) {
|
||||
if (np_rd_send(s) == FALSE) {
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
@@ -5162,29 +5192,29 @@ main(int argc, char **argv)
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (H5Sclose(s.one_by_one_sid) < 0) {
|
||||
if (H5Sclose(s->one_by_one_sid) < 0) {
|
||||
HDprintf("H5Sclose failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (H5Fclose(s.file) < 0) {
|
||||
if (H5Fclose(s->file) < 0) {
|
||||
HDprintf("H5Fclose failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* Both the writer and reader close the named pipes */
|
||||
if (s.use_named_pipes && HDclose(fd_writer_to_reader) < 0) {
|
||||
if (s->use_named_pipes && HDclose(fd_writer_to_reader) < 0) {
|
||||
HDprintf("HDclose failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (s.use_named_pipes && HDclose(fd_reader_to_writer) < 0) {
|
||||
if (s->use_named_pipes && HDclose(fd_reader_to_writer) < 0) {
|
||||
HDprintf("HDclose failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* Reader finishes last and deletes the named pipes */
|
||||
if (s.use_named_pipes && !writer) {
|
||||
if (s->use_named_pipes && !writer) {
|
||||
if (HDremove(fifo_writer_to_reader) != 0) {
|
||||
HDprintf("HDremove failed\n");
|
||||
TEST_ERROR;
|
||||
@@ -5196,6 +5226,9 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
HDfree(config);
|
||||
HDfree(s);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
error:
|
||||
@@ -5203,22 +5236,25 @@ error:
|
||||
{
|
||||
H5Pclose(fapl);
|
||||
H5Pclose(fcpl);
|
||||
H5Sclose(s.one_by_one_sid);
|
||||
H5Fclose(s.file);
|
||||
H5Sclose(s->one_by_one_sid);
|
||||
H5Fclose(s->file);
|
||||
}
|
||||
H5E_END_TRY;
|
||||
|
||||
if (s.use_named_pipes && fd_writer_to_reader >= 0)
|
||||
if (s->use_named_pipes && fd_writer_to_reader >= 0)
|
||||
HDclose(fd_writer_to_reader);
|
||||
|
||||
if (s.use_named_pipes && fd_reader_to_writer >= 0)
|
||||
if (s->use_named_pipes && fd_reader_to_writer >= 0)
|
||||
HDclose(fd_reader_to_writer);
|
||||
|
||||
if (s.use_named_pipes && !writer) {
|
||||
if (s->use_named_pipes && !writer) {
|
||||
HDremove(fifo_writer_to_reader);
|
||||
HDremove(fifo_reader_to_writer);
|
||||
}
|
||||
|
||||
HDfree(config);
|
||||
HDfree(s);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,29 +70,6 @@ typedef struct {
|
||||
hbool_t first_proc;
|
||||
} state_t;
|
||||
|
||||
/* Assign the initialized values to struct state_t declared above */
|
||||
static inline state_t
|
||||
state_initializer(void)
|
||||
{
|
||||
return (state_t){.file = {H5I_INVALID_HID, H5I_INVALID_HID},
|
||||
.filename = {"", ""},
|
||||
.r_dsetid = H5I_INVALID_HID,
|
||||
.dtype = H5T_NATIVE_UINT32,
|
||||
.fapl = H5I_INVALID_HID,
|
||||
.fcpl = H5I_INVALID_HID,
|
||||
.rows = DATA_ROWS,
|
||||
.cols = DATA_COLS,
|
||||
.rank = DATA_RANK,
|
||||
.dims = {DATA_ROWS, DATA_COLS},
|
||||
.max_lag = 7,
|
||||
.tick_len = 4,
|
||||
.ps = 4096,
|
||||
.pbs = 4096,
|
||||
.check_interval = 1,
|
||||
.use_vfd_swmr = TRUE,
|
||||
.first_proc = TRUE};
|
||||
}
|
||||
|
||||
/* Obtain the data value at index [i][j] for the 2D matrix.
|
||||
All the routines related to the matrix are adapted from the vfd_swmr_bigset_writer.c. */
|
||||
static uint32_t
|
||||
@@ -120,18 +97,18 @@ error:
|
||||
|
||||
/* Allocate memory for the 2-D matrix. */
|
||||
static mat_t *
|
||||
newmat(state_t s)
|
||||
newmat(state_t *s)
|
||||
{
|
||||
mat_t *mat;
|
||||
|
||||
mat = HDmalloc(sizeof(*mat) + (s.rows * s.cols - 1) * sizeof(mat->elt[0]));
|
||||
mat = HDmalloc(sizeof(*mat) + (s->rows * s->cols - 1) * sizeof(mat->elt[0]));
|
||||
if (mat == NULL) {
|
||||
HDfprintf(stderr, "HDmalloc failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
mat->rows = s.rows;
|
||||
mat->cols = s.cols;
|
||||
mat->rows = s->rows;
|
||||
mat->cols = s->cols;
|
||||
|
||||
return mat;
|
||||
|
||||
@@ -254,7 +231,26 @@ state_init(state_t *s, int argc, char **argv)
|
||||
const char * s_opts = "Sqc:r:t:m:B:s:u:";
|
||||
struct h5_long_options l_opts[] = {{NULL, 0, '\0'}};
|
||||
|
||||
*s = state_initializer();
|
||||
s->file[0] = H5I_INVALID_HID;
|
||||
s->file[1] = H5I_INVALID_HID;
|
||||
s->filename[0] = "";
|
||||
s->filename[1] = "";
|
||||
s->r_dsetid = H5I_INVALID_HID;
|
||||
s->dtype = H5T_NATIVE_UINT32;
|
||||
s->fapl = H5I_INVALID_HID;
|
||||
s->fcpl = H5I_INVALID_HID;
|
||||
s->rows = DATA_ROWS;
|
||||
s->cols = DATA_COLS;
|
||||
s->rank = DATA_RANK;
|
||||
s->dims[0] = DATA_ROWS;
|
||||
s->dims[1] = DATA_COLS;
|
||||
s->max_lag = 7;
|
||||
s->tick_len = 4;
|
||||
s->ps = 4096;
|
||||
s->pbs = 4096;
|
||||
s->check_interval = 1;
|
||||
s->use_vfd_swmr = TRUE;
|
||||
s->first_proc = TRUE;
|
||||
|
||||
if (H5_basename(argv[0], &tfile) < 0) {
|
||||
HDprintf("H5_basename failed\n");
|
||||
@@ -362,16 +358,19 @@ static hbool_t
|
||||
indep_init_vfd_swmr_config_plist(state_t *s, hbool_t writer, const char *mdf_name)
|
||||
{
|
||||
|
||||
H5F_vfd_swmr_config_t config;
|
||||
H5F_vfd_swmr_config_t *config = NULL;
|
||||
|
||||
if (NULL == (config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))))
|
||||
TEST_ERROR;
|
||||
|
||||
/* config, tick_len, max_lag, presume_posix_semantics, writer,
|
||||
* maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved,
|
||||
* md_file_path, md_file_name, updater_file_path */
|
||||
init_vfd_swmr_config(&config, s->tick_len, s->max_lag, FALSE, writer, TRUE, FALSE, TRUE, 128, "./",
|
||||
init_vfd_swmr_config(config, s->tick_len, s->max_lag, FALSE, writer, TRUE, FALSE, TRUE, 128, "./",
|
||||
mdf_name, NULL);
|
||||
|
||||
/* Pass the use_vfd_swmr, only_meta_page, page buffer size, config to vfd_swmr_create_fapl().*/
|
||||
if ((s->fapl = vfd_swmr_create_fapl(TRUE, s->use_vfd_swmr, TRUE, s->pbs, &config)) < 0) {
|
||||
if ((s->fapl = vfd_swmr_create_fapl(TRUE, s->use_vfd_swmr, TRUE, s->pbs, config)) < 0) {
|
||||
HDprintf("vfd_swmr_create_fapl failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -382,9 +381,12 @@ indep_init_vfd_swmr_config_plist(state_t *s, hbool_t writer, const char *mdf_nam
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
HDfree(config);
|
||||
|
||||
return TRUE;
|
||||
|
||||
error:
|
||||
HDfree(config);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -628,12 +630,14 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
hbool_t writer = TRUE;
|
||||
state_t s;
|
||||
hbool_t ret = FALSE;
|
||||
unsigned i;
|
||||
mat_t * mat = NULL;
|
||||
state_t *s = NULL;
|
||||
mat_t * mat = NULL;
|
||||
hbool_t ret = FALSE;
|
||||
|
||||
if (!state_init(&s, argc, argv)) {
|
||||
if (NULL == (s = HDcalloc(1, sizeof(state_t))))
|
||||
TEST_ERROR;
|
||||
|
||||
if (!state_init(s, argc, argv)) {
|
||||
HDfprintf(stderr, "state_init failed\n");
|
||||
TEST_ERROR;
|
||||
}
|
||||
@@ -644,70 +648,70 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* The first process writes a dataset in the first file and then reads a dataset from the second file.*/
|
||||
if (s.first_proc) {
|
||||
if (s->first_proc) {
|
||||
|
||||
writer = TRUE;
|
||||
if (FALSE == indep_init_vfd_swmr_config_plist(&s, writer, "file1-shadow")) {
|
||||
HDfprintf(stderr, "Writer: Cannot initialize file property lists for file %s\n", s.filename[0]);
|
||||
if (FALSE == indep_init_vfd_swmr_config_plist(s, writer, "file1-shadow")) {
|
||||
HDfprintf(stderr, "Writer: Cannot initialize file property lists for file %s\n", s->filename[0]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
s.file[0] = H5Fcreate(s.filename[0], H5F_ACC_TRUNC, s.fcpl, s.fapl);
|
||||
if (s.file[0] < 0) {
|
||||
HDfprintf(stderr, "H5Fcreate failed for the file %s\n", s.filename[0]);
|
||||
s->file[0] = H5Fcreate(s->filename[0], H5F_ACC_TRUNC, s->fcpl, s->fapl);
|
||||
if (s->file[0] < 0) {
|
||||
HDfprintf(stderr, "H5Fcreate failed for the file %s\n", s->filename[0]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
ret = write_dataset(&s, mat);
|
||||
ret = write_dataset(s, mat);
|
||||
if (ret == FALSE) {
|
||||
HDfprintf(stderr, "write_dataset failed for the file %s\n", s.filename[0]);
|
||||
HDfprintf(stderr, "write_dataset failed for the file %s\n", s->filename[0]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* writer makes repeated HDF5 API calls
|
||||
* to trigger EOT at approximately the correct time */
|
||||
for (i = 0; i < s.max_lag + 1; i++) {
|
||||
decisleep(s.tick_len);
|
||||
for (unsigned i = 0; i < s->max_lag + 1; i++) {
|
||||
decisleep(s->tick_len);
|
||||
H5E_BEGIN_TRY
|
||||
{
|
||||
H5Aexists(s.file[0], "nonexistent");
|
||||
H5Aexists(s->file[0], "nonexistent");
|
||||
}
|
||||
H5E_END_TRY;
|
||||
}
|
||||
|
||||
if (FALSE == close_pl(&s)) {
|
||||
HDfprintf(stderr, "Fail to close file property lists for writing the file %s.\n", s.filename[0]);
|
||||
if (FALSE == close_pl(s)) {
|
||||
HDfprintf(stderr, "Fail to close file property lists for writing the file %s.\n", s->filename[0]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
writer = FALSE;
|
||||
if (FALSE == indep_init_vfd_swmr_config_plist(&s, writer, "file2-shadow")) {
|
||||
HDfprintf(stderr, "Reader: Cannot initialize file property lists for file %s\n", s.filename[1]);
|
||||
if (FALSE == indep_init_vfd_swmr_config_plist(s, writer, "file2-shadow")) {
|
||||
HDfprintf(stderr, "Reader: Cannot initialize file property lists for file %s\n", s->filename[1]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
s.file[1] = H5Fopen(s.filename[1], H5F_ACC_RDONLY, s.fapl);
|
||||
if (s.file[1] < 0) {
|
||||
HDfprintf(stderr, "H5Fopen failed for the file %s\n", s.filename[1]);
|
||||
s->file[1] = H5Fopen(s->filename[1], H5F_ACC_RDONLY, s->fapl);
|
||||
if (s->file[1] < 0) {
|
||||
HDfprintf(stderr, "H5Fopen failed for the file %s\n", s->filename[1]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
ret = read_vrfy_dataset(&s, mat);
|
||||
ret = read_vrfy_dataset(s, mat);
|
||||
if (ret == FALSE) {
|
||||
HDfprintf(stderr, "read and verify dataset failed for file %s\n", s.filename[1]);
|
||||
HDfprintf(stderr, "read and verify dataset failed for file %s\n", s->filename[1]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (FALSE == close_pl(&s)) {
|
||||
HDfprintf(stderr, "Fail to close file property lists for reading the file %s.\n", s.filename[1]);
|
||||
if (FALSE == close_pl(s)) {
|
||||
HDfprintf(stderr, "Fail to close file property lists for reading the file %s.\n", s->filename[1]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (H5Fclose(s.file[0]) < 0) {
|
||||
HDfprintf(stderr, "fail to close HDF5 file %s \n", s.filename[0]);
|
||||
if (H5Fclose(s->file[0]) < 0) {
|
||||
HDfprintf(stderr, "fail to close HDF5 file %s \n", s->filename[0]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (H5Fclose(s.file[1]) < 0) {
|
||||
HDfprintf(stderr, "fail to close HDF5 file %s \n", s.filename[1]);
|
||||
if (H5Fclose(s->file[1]) < 0) {
|
||||
HDfprintf(stderr, "fail to close HDF5 file %s \n", s->filename[1]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
@@ -717,88 +721,88 @@ main(int argc, char **argv)
|
||||
* then writes a dataset in the second file for the first process to read.
|
||||
*/
|
||||
writer = FALSE;
|
||||
if (FALSE == indep_init_vfd_swmr_config_plist(&s, writer, "file1-shadow")) {
|
||||
HDfprintf(stderr, "Reader: Cannot initialize file property lists for file %s\n", s.filename[0]);
|
||||
if (FALSE == indep_init_vfd_swmr_config_plist(s, writer, "file1-shadow")) {
|
||||
HDfprintf(stderr, "Reader: Cannot initialize file property lists for file %s\n", s->filename[0]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
s.file[0] = H5Fopen(s.filename[0], H5F_ACC_RDONLY, s.fapl);
|
||||
if (s.file[0] < 0) {
|
||||
HDfprintf(stderr, "H5Fopen failed for the file %s\n", s.filename[0]);
|
||||
s->file[0] = H5Fopen(s->filename[0], H5F_ACC_RDONLY, s->fapl);
|
||||
if (s->file[0] < 0) {
|
||||
HDfprintf(stderr, "H5Fopen failed for the file %s\n", s->filename[0]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
ret = read_vrfy_dataset(&s, mat);
|
||||
ret = read_vrfy_dataset(s, mat);
|
||||
if (ret == FALSE) {
|
||||
HDfprintf(stderr, "read and verify dataset failed for file %s\n", s.filename[0]);
|
||||
HDfprintf(stderr, "read and verify dataset failed for file %s\n", s->filename[0]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (FALSE == close_pl(&s)) {
|
||||
HDfprintf(stderr, "Fail to close file property lists for reading the file %s.\n", s.filename[0]);
|
||||
if (FALSE == close_pl(s)) {
|
||||
HDfprintf(stderr, "Fail to close file property lists for reading the file %s.\n", s->filename[0]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
writer = TRUE;
|
||||
if (FALSE == indep_init_vfd_swmr_config_plist(&s, writer, "file2-shadow")) {
|
||||
HDfprintf(stderr, "writer: Cannot initialize file property lists for file %s\n", s.filename[1]);
|
||||
if (FALSE == indep_init_vfd_swmr_config_plist(s, writer, "file2-shadow")) {
|
||||
HDfprintf(stderr, "writer: Cannot initialize file property lists for file %s\n", s->filename[1]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
s.file[1] = H5Fcreate(s.filename[1], H5F_ACC_TRUNC, s.fcpl, s.fapl);
|
||||
if (s.file[1] < 0) {
|
||||
HDfprintf(stderr, "H5Fcreate failed for the file %s\n", s.filename[1]);
|
||||
s->file[1] = H5Fcreate(s->filename[1], H5F_ACC_TRUNC, s->fcpl, s->fapl);
|
||||
if (s->file[1] < 0) {
|
||||
HDfprintf(stderr, "H5Fcreate failed for the file %s\n", s->filename[1]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
ret = write_dataset(&s, mat);
|
||||
ret = write_dataset(s, mat);
|
||||
if (ret == FALSE) {
|
||||
HDfprintf(stderr, "write_dataset failed for the file %s\n", s.filename[1]);
|
||||
HDfprintf(stderr, "write_dataset failed for the file %s\n", s->filename[1]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* writer makes repeated HDF5 API calls
|
||||
* to trigger EOT at approximately the correct time */
|
||||
for (i = 0; i < s.max_lag + 1; i++) {
|
||||
decisleep(s.tick_len);
|
||||
for (unsigned i = 0; i < s->max_lag + 1; i++) {
|
||||
decisleep(s->tick_len);
|
||||
H5E_BEGIN_TRY
|
||||
{
|
||||
H5Aexists(s.file[1], "nonexistent");
|
||||
H5Aexists(s->file[1], "nonexistent");
|
||||
}
|
||||
H5E_END_TRY;
|
||||
}
|
||||
|
||||
if (FALSE == close_pl(&s)) {
|
||||
HDfprintf(stderr, "Fail to close file property lists for writing the file %s.\n", s.filename[1]);
|
||||
if (FALSE == close_pl(s)) {
|
||||
HDfprintf(stderr, "Fail to close file property lists for writing the file %s.\n", s->filename[1]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (H5Fclose(s.file[0]) < 0) {
|
||||
HDfprintf(stderr, "fail to close HDF5 file %s \n", s.filename[0]);
|
||||
if (H5Fclose(s->file[0]) < 0) {
|
||||
HDfprintf(stderr, "fail to close HDF5 file %s \n", s->filename[0]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
if (H5Fclose(s.file[1]) < 0) {
|
||||
HDfprintf(stderr, "fail to close HDF5 file %s \n", s.filename[1]);
|
||||
if (H5Fclose(s->file[1]) < 0) {
|
||||
HDfprintf(stderr, "fail to close HDF5 file %s \n", s->filename[1]);
|
||||
TEST_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (mat)
|
||||
HDfree(mat);
|
||||
HDfree(mat);
|
||||
HDfree(s);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY
|
||||
{
|
||||
H5Pclose(s.fapl);
|
||||
H5Pclose(s.fcpl);
|
||||
H5Fclose(s.file[0]);
|
||||
H5Fclose(s.file[1]);
|
||||
H5Pclose(s->fapl);
|
||||
H5Pclose(s->fcpl);
|
||||
H5Fclose(s->file[0]);
|
||||
H5Fclose(s->file[1]);
|
||||
}
|
||||
H5E_END_TRY;
|
||||
|
||||
if (mat)
|
||||
HDfree(mat);
|
||||
HDfree(mat);
|
||||
HDfree(s);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
|
||||
#ifndef H5_HAVE_WIN32_API
|
||||
|
||||
#include <err.h>
|
||||
|
||||
/****************/
|
||||
/* Local Macros */
|
||||
/****************/
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
|
||||
#ifndef H5_HAVE_WIN32_API
|
||||
|
||||
#include <err.h>
|
||||
|
||||
typedef enum _step { CREATE = 0, LENGTHEN, SHORTEN, DELETE, NSTEPS } step_t;
|
||||
|
||||
static hbool_t caught_out_of_bounds = FALSE;
|
||||
@@ -61,22 +59,29 @@ usage(const char *progname)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
hid_t fapl, fid, space, type;
|
||||
hid_t dset[2];
|
||||
char * content[2];
|
||||
hid_t fapl = H5I_INVALID_HID;
|
||||
hid_t fid = H5I_INVALID_HID;
|
||||
hid_t space = H5I_INVALID_HID;
|
||||
hid_t type = H5I_INVALID_HID;
|
||||
hid_t dset[2] = {H5I_INVALID_HID, H5I_INVALID_HID};
|
||||
char * content[2] = {NULL, NULL};
|
||||
char name[2][96];
|
||||
int opt, i, ntimes = 100;
|
||||
int opt;
|
||||
int ntimes = 100;
|
||||
unsigned long tmp;
|
||||
hbool_t use_vfd_swmr = TRUE;
|
||||
char * end;
|
||||
const uint64_t delay_ns = 1100 * 1000; /* 1.1 ms */
|
||||
testsel_t sel = TEST_NONE;
|
||||
H5F_vfd_swmr_config_t config;
|
||||
H5F_vfd_swmr_config_t *config;
|
||||
const char * s_opts = "Sn:qt:";
|
||||
struct h5_long_options l_opts[] = {{NULL, 0, '\0'}};
|
||||
|
||||
HDassert(H5T_C_S1 != H5I_INVALID_HID);
|
||||
|
||||
if (NULL == (config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))))
|
||||
PUTS_ERROR("memory allocation failed");
|
||||
|
||||
while ((opt = H5_get_option(argc, (const char *const *)argv, s_opts, l_opts)) != EOF) {
|
||||
switch (opt) {
|
||||
case 'S':
|
||||
@@ -85,12 +90,21 @@ main(int argc, char **argv)
|
||||
case 'n':
|
||||
errno = 0;
|
||||
tmp = HDstrtoul(H5_optarg, &end, 0);
|
||||
if (end == optarg || *end != '\0')
|
||||
errx(EXIT_FAILURE, "couldn't parse `-n` argument `%s`", H5_optarg);
|
||||
else if (errno != 0)
|
||||
err(EXIT_FAILURE, "couldn't parse `-n` argument `%s`", H5_optarg);
|
||||
else if (tmp > INT_MAX)
|
||||
errx(EXIT_FAILURE, "`-n` argument `%lu` too large", tmp);
|
||||
if (end == optarg || *end != '\0') {
|
||||
HDfprintf(stderr, "couldn't parse `-n` argument `%s`", H5_optarg);
|
||||
AT();
|
||||
goto error;
|
||||
}
|
||||
else if (errno != 0) {
|
||||
HDfprintf(stderr, "couldn't parse `-n` argument `%s`", H5_optarg);
|
||||
AT();
|
||||
goto error;
|
||||
}
|
||||
else if (tmp > INT_MAX) {
|
||||
HDfprintf(stderr, "`-n` argument `%lu` too large", tmp);
|
||||
AT();
|
||||
goto error;
|
||||
}
|
||||
ntimes = (int)tmp;
|
||||
break;
|
||||
case 'q':
|
||||
@@ -113,40 +127,34 @@ main(int argc, char **argv)
|
||||
argc -= H5_optind;
|
||||
|
||||
if (argc > 0)
|
||||
errx(EXIT_FAILURE, "unexpected command-line arguments");
|
||||
PUTS_ERROR("unexpected command-line arguments");
|
||||
|
||||
/* config, tick_len, max_lag, presume_posix_semantics, writer,
|
||||
* maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved,
|
||||
* md_file_path, md_file_name, updater_file_path */
|
||||
init_vfd_swmr_config(&config, 4, 7, FALSE, false, TRUE, FALSE, TRUE, 128, "./", "vlstr-shadow", NULL);
|
||||
init_vfd_swmr_config(config, 4, 7, FALSE, false, TRUE, FALSE, TRUE, 128, "./", "vlstr-shadow", NULL);
|
||||
|
||||
/* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */
|
||||
fapl = vfd_swmr_create_fapl(TRUE, use_vfd_swmr, sel == TEST_OOB, 4096, &config);
|
||||
if ((fapl = vfd_swmr_create_fapl(TRUE, use_vfd_swmr, sel == TEST_OOB, 4096, config)) < 0)
|
||||
STACK_ERROR;
|
||||
|
||||
if (fapl < 0)
|
||||
errx(EXIT_FAILURE, "vfd_swmr_create_fapl");
|
||||
|
||||
fid = H5Fopen("vfd_swmr_vlstr.h5", H5F_ACC_RDONLY, fapl);
|
||||
if ((fid = H5Fopen("vfd_swmr_vlstr.h5", H5F_ACC_RDONLY, fapl)) < 0)
|
||||
STACK_ERROR;
|
||||
|
||||
/* Create the VL string datatype and a scalar dataspace */
|
||||
if ((type = H5Tcopy(H5T_C_S1)) == H5I_INVALID_HID)
|
||||
errx(EXIT_FAILURE, "H5Tcopy");
|
||||
STACK_ERROR;
|
||||
|
||||
if (H5Tset_size(type, H5T_VARIABLE) < 0)
|
||||
errx(EXIT_FAILURE, "H5Tset_size");
|
||||
space = H5Screate(H5S_SCALAR);
|
||||
|
||||
if (space == H5I_INVALID_HID)
|
||||
errx(EXIT_FAILURE, "H5Screate");
|
||||
|
||||
if (fid == H5I_INVALID_HID)
|
||||
errx(EXIT_FAILURE, "H5Fcreate");
|
||||
STACK_ERROR;
|
||||
if ((space = H5Screate(H5S_SCALAR)) < 0)
|
||||
STACK_ERROR;
|
||||
|
||||
/* content 0 seq 1 short
|
||||
* content 1 seq 1 long long long long long long long long
|
||||
* content 1 seq 1 medium medium medium
|
||||
*/
|
||||
for (i = 0; !caught_out_of_bounds && i < ntimes; (i % 2 == 0) ? H5_nanosleep(delay_ns) : 0, i++) {
|
||||
for (int i = 0; !caught_out_of_bounds && i < ntimes; i++) {
|
||||
estack_state_t es;
|
||||
const int ndsets = 2;
|
||||
const int which = i % ndsets;
|
||||
@@ -159,7 +167,8 @@ main(int argc, char **argv)
|
||||
|
||||
dbgf(2, "iteration %d which %d", i, which);
|
||||
(void)HDsnprintf(name[which], sizeof(name[which]), "dset-%d", which);
|
||||
es = disable_estack();
|
||||
es = disable_estack();
|
||||
|
||||
dset[which] = H5Dopen2(fid, name[which], H5P_DEFAULT);
|
||||
restore_estack(es);
|
||||
if (caught_out_of_bounds || dset[which] == H5I_INVALID_HID) {
|
||||
@@ -185,6 +194,9 @@ main(int argc, char **argv)
|
||||
HDfree(content[which]);
|
||||
content[which] = NULL;
|
||||
}
|
||||
|
||||
if (i % 2 == 0)
|
||||
H5_nanosleep(delay_ns);
|
||||
}
|
||||
|
||||
if (caught_out_of_bounds)
|
||||
@@ -194,16 +206,15 @@ main(int argc, char **argv)
|
||||
HDfprintf(stderr, "read NULL\n");
|
||||
|
||||
if (H5Pclose(fapl) < 0)
|
||||
errx(EXIT_FAILURE, "H5Pclose(fapl)");
|
||||
|
||||
STACK_ERROR;
|
||||
if (H5Tclose(type) < 0)
|
||||
errx(EXIT_FAILURE, "H5Tclose");
|
||||
|
||||
STACK_ERROR;
|
||||
if (H5Sclose(space) < 0)
|
||||
errx(EXIT_FAILURE, "H5Sclose");
|
||||
|
||||
STACK_ERROR;
|
||||
if (H5Fclose(fid) < 0)
|
||||
errx(EXIT_FAILURE, "H5Fclose");
|
||||
STACK_ERROR;
|
||||
|
||||
HDfree(config);
|
||||
|
||||
if (sel == TEST_OOB)
|
||||
return caught_out_of_bounds ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
@@ -211,6 +222,18 @@ main(int argc, char **argv)
|
||||
return read_null ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY
|
||||
{
|
||||
H5Pclose(fapl);
|
||||
H5Tclose(type);
|
||||
H5Sclose(space);
|
||||
H5Fclose(fid);
|
||||
}
|
||||
H5E_END_TRY;
|
||||
|
||||
HDfree(config);
|
||||
}
|
||||
|
||||
#else /* H5_HAVE_WIN32_API */
|
||||
|
||||
@@ -24,32 +24,35 @@
|
||||
|
||||
#ifndef H5_HAVE_WIN32_API
|
||||
|
||||
#include <err.h>
|
||||
|
||||
enum _step { CREATE = 0, LENGTHEN, SHORTEN, DELETE, NSTEPS } step_t;
|
||||
|
||||
static hbool_t caught_out_of_bounds = FALSE;
|
||||
|
||||
static void
|
||||
static herr_t
|
||||
write_vl_dset(hid_t dset, hid_t type, hid_t space, char *data)
|
||||
{
|
||||
if (H5Dwrite(dset, type, space, space, H5P_DEFAULT, &data) < 0)
|
||||
errx(EXIT_FAILURE, "%s: H5Dwrite", __func__);
|
||||
STACK_ERROR;
|
||||
if (H5Dflush(dset) < 0)
|
||||
errx(EXIT_FAILURE, "%s: H5Dflush", __func__);
|
||||
STACK_ERROR;
|
||||
|
||||
return SUCCEED;
|
||||
error:
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
static hid_t
|
||||
create_vl_dset(hid_t file, hid_t type, hid_t space, const char *name)
|
||||
{
|
||||
hid_t dset;
|
||||
hid_t dset = H5I_INVALID_HID;
|
||||
|
||||
dset = H5Dcreate2(file, name, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
|
||||
if (dset == H5I_INVALID_HID)
|
||||
errx(EXIT_FAILURE, "H5Dcreate2");
|
||||
if ((dset = H5Dcreate2(file, name, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
||||
STACK_ERROR;
|
||||
|
||||
return dset;
|
||||
|
||||
error:
|
||||
return H5I_INVALID_HID;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -87,8 +90,12 @@ usage(const char *progname)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
hid_t fapl, fcpl, fid, space, type;
|
||||
hid_t dset[2];
|
||||
hid_t fapl = H5I_INVALID_HID;
|
||||
hid_t fcpl = H5I_INVALID_HID;
|
||||
hid_t fid = H5I_INVALID_HID;
|
||||
hid_t space = H5I_INVALID_HID;
|
||||
hid_t type = H5I_INVALID_HID;
|
||||
hid_t dset[2] = {H5I_INVALID_HID, H5I_INVALID_HID};
|
||||
char content[2][96];
|
||||
char name[2][96];
|
||||
H5F_t * f;
|
||||
@@ -102,12 +109,15 @@ main(int argc, char **argv)
|
||||
hbool_t use_vfd_swmr = TRUE;
|
||||
const uint64_t delay_ns = 100 * 1000 * 1000; /* 100 ms */
|
||||
testsel_t sel = TEST_NONE;
|
||||
H5F_vfd_swmr_config_t config;
|
||||
const char * s_opts = "SWfn:qt:";
|
||||
struct h5_long_options l_opts[] = {{NULL, 0, '\0'}};
|
||||
H5F_vfd_swmr_config_t *config = NULL;
|
||||
const char * s_opts = "SWfn:qt:";
|
||||
struct h5_long_options l_opts[] = {{NULL, 0, '\0'}};
|
||||
|
||||
HDassert(H5T_C_S1 != H5I_INVALID_HID);
|
||||
|
||||
if (NULL == (config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))))
|
||||
PUTS_ERROR("unable to allocate memory");
|
||||
|
||||
while ((opt = H5_get_option(argc, (const char *const *)argv, s_opts, l_opts)) != EOF) {
|
||||
switch (opt) {
|
||||
case 'S':
|
||||
@@ -122,12 +132,21 @@ main(int argc, char **argv)
|
||||
case 'n':
|
||||
errno = 0;
|
||||
tmp = HDstrtoul(H5_optarg, &end, 0);
|
||||
if (end == H5_optarg || *end != '\0')
|
||||
errx(EXIT_FAILURE, "couldn't parse `-n` argument `%s`", H5_optarg);
|
||||
else if (errno != 0)
|
||||
err(EXIT_FAILURE, "couldn't parse `-n` argument `%s`", H5_optarg);
|
||||
else if (tmp > INT_MAX)
|
||||
errx(EXIT_FAILURE, "`-n` argument `%lu` too large", tmp);
|
||||
if (end == H5_optarg || *end != '\0') {
|
||||
HDfprintf(stderr, "couldn't parse `-n` argument `%s`", H5_optarg);
|
||||
AT();
|
||||
goto error;
|
||||
}
|
||||
else if (errno != 0) {
|
||||
HDfprintf(stderr, "couldn't parse `-n` argument `%s`", H5_optarg);
|
||||
AT();
|
||||
goto error;
|
||||
}
|
||||
else if (tmp > INT_MAX) {
|
||||
HDfprintf(stderr, "`-n` argument `%lu` too large", tmp);
|
||||
AT();
|
||||
goto error;
|
||||
}
|
||||
ntimes = (int)tmp;
|
||||
break;
|
||||
case 'q':
|
||||
@@ -150,53 +169,48 @@ main(int argc, char **argv)
|
||||
argc -= H5_optind;
|
||||
|
||||
if (argc > 0)
|
||||
errx(EXIT_FAILURE, "unexpected command-line arguments");
|
||||
PUTS_ERROR("unexpected command-line arguments");
|
||||
|
||||
/* config, tick_len, max_lag, presume_posix_semantics, writer,
|
||||
* maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved,
|
||||
* md_file_path, md_file_name, updater_file_path */
|
||||
init_vfd_swmr_config(&config, 4, 7, FALSE, true, TRUE, FALSE, TRUE, 128, "./", "vlstr-shadow", NULL);
|
||||
init_vfd_swmr_config(config, 4, 7, FALSE, true, TRUE, FALSE, TRUE, 128, "./", "vlstr-shadow", NULL);
|
||||
|
||||
/* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */
|
||||
fapl = vfd_swmr_create_fapl(TRUE, use_vfd_swmr, sel == TEST_OOB, 4096, &config);
|
||||
|
||||
if (fapl < 0)
|
||||
errx(EXIT_FAILURE, "vfd_swmr_create_fapl");
|
||||
if ((fapl = vfd_swmr_create_fapl(TRUE, use_vfd_swmr, sel == TEST_OOB, 4096, config)) < 0)
|
||||
STACK_ERROR;
|
||||
|
||||
/* Set fs_strategy (file space strategy) and fs_page_size (file space page size) */
|
||||
if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, 4096)) < 0)
|
||||
errx(EXIT_FAILURE, "vfd_swmr_create_fcpl");
|
||||
STACK_ERROR;
|
||||
|
||||
fid = H5Fcreate("vfd_swmr_vlstr.h5", H5F_ACC_TRUNC, fcpl, fapl);
|
||||
if ((fid = H5Fcreate("vfd_swmr_vlstr.h5", H5F_ACC_TRUNC, fcpl, fapl)) < 0)
|
||||
STACK_ERROR;
|
||||
|
||||
/* Create the VL string datatype and a scalar dataspace, or a
|
||||
* fixed-length string datatype and a simple dataspace.
|
||||
*/
|
||||
if ((type = H5Tcopy(H5T_C_S1)) == H5I_INVALID_HID)
|
||||
errx(EXIT_FAILURE, "H5Tcopy");
|
||||
STACK_ERROR;
|
||||
|
||||
if (!variable) {
|
||||
if (H5Tset_size(type, 32) < 0)
|
||||
errx(EXIT_FAILURE, "H5Tset_size");
|
||||
space = H5Screate_simple(1, &dims, NULL);
|
||||
STACK_ERROR;
|
||||
if ((space = H5Screate_simple(1, &dims, NULL)) < 0)
|
||||
STACK_ERROR;
|
||||
}
|
||||
else {
|
||||
if (H5Tset_size(type, H5T_VARIABLE) < 0)
|
||||
errx(EXIT_FAILURE, "H5Tset_size");
|
||||
space = H5Screate(H5S_SCALAR);
|
||||
STACK_ERROR;
|
||||
if ((space = H5Screate(H5S_SCALAR)) < 0)
|
||||
STACK_ERROR;
|
||||
}
|
||||
|
||||
if (space == H5I_INVALID_HID)
|
||||
errx(EXIT_FAILURE, "H5Screate");
|
||||
|
||||
if ((f = H5VL_object_verify(fid, H5I_FILE)) == NULL)
|
||||
errx(EXIT_FAILURE, "H5VL_object_verify");
|
||||
STACK_ERROR;
|
||||
|
||||
cache = f->shared->cache;
|
||||
|
||||
if (fid == H5I_INVALID_HID)
|
||||
errx(EXIT_FAILURE, "H5Fcreate");
|
||||
|
||||
block_signals(&oldsigs);
|
||||
|
||||
print_cache_hits(cache);
|
||||
@@ -217,27 +231,29 @@ main(int argc, char **argv)
|
||||
(void)HDsnprintf(content[which], sizeof(content[which]), "content %d seq %d short", which,
|
||||
seq);
|
||||
dset[which] = create_vl_dset(fid, type, space, name[which]);
|
||||
write_vl_dset(dset[which], type, space, content[which]);
|
||||
if (write_vl_dset(dset[which], type, space, content[which]) < 0)
|
||||
PUTS_ERROR("failed to write to VL dataset");
|
||||
break;
|
||||
case LENGTHEN:
|
||||
(void)HDsnprintf(content[which], sizeof(content[which]),
|
||||
"content %d seq %d long long long long long long long long", which, seq);
|
||||
write_vl_dset(dset[which], type, space, content[which]);
|
||||
if (write_vl_dset(dset[which], type, space, content[which]) < 0)
|
||||
PUTS_ERROR("failed to write to VL dataset");
|
||||
break;
|
||||
case SHORTEN:
|
||||
(void)HDsnprintf(content[which], sizeof(content[which]),
|
||||
"content %d seq %d medium medium medium", which, seq);
|
||||
write_vl_dset(dset[which], type, space, content[which]);
|
||||
if (write_vl_dset(dset[which], type, space, content[which]) < 0)
|
||||
PUTS_ERROR("failed to write to VL dataset");
|
||||
break;
|
||||
case DELETE:
|
||||
if (H5Dclose(dset[which]) < 0)
|
||||
errx(EXIT_FAILURE, "H5Dclose");
|
||||
if (H5Ldelete(fid, name[which], H5P_DEFAULT) < 0) {
|
||||
errx(EXIT_FAILURE, "%s: H5Ldelete(, \"%s\", ) failed", __func__, name[which]);
|
||||
}
|
||||
STACK_ERROR;
|
||||
if (H5Ldelete(fid, name[which], H5P_DEFAULT) < 0)
|
||||
STACK_ERROR;
|
||||
break;
|
||||
default:
|
||||
errx(EXIT_FAILURE, "%s: unknown step %d", __func__, step);
|
||||
PUTS_ERROR("Unknown operation");
|
||||
}
|
||||
|
||||
if (caught_out_of_bounds) {
|
||||
@@ -254,21 +270,35 @@ main(int argc, char **argv)
|
||||
restore_signals(&oldsigs);
|
||||
|
||||
if (H5Pclose(fapl) < 0)
|
||||
errx(EXIT_FAILURE, "H5Pclose(fapl)");
|
||||
|
||||
STACK_ERROR;
|
||||
if (H5Pclose(fcpl) < 0)
|
||||
errx(EXIT_FAILURE, "H5Pclose(fcpl)");
|
||||
|
||||
STACK_ERROR;
|
||||
if (H5Tclose(type) < 0)
|
||||
errx(EXIT_FAILURE, "H5Tclose");
|
||||
|
||||
STACK_ERROR;
|
||||
if (H5Sclose(space) < 0)
|
||||
errx(EXIT_FAILURE, "H5Sclose");
|
||||
|
||||
STACK_ERROR;
|
||||
if (H5Fclose(fid) < 0)
|
||||
errx(EXIT_FAILURE, "H5Fclose");
|
||||
STACK_ERROR;
|
||||
|
||||
HDfree(config);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
error:
|
||||
|
||||
H5E_BEGIN_TRY
|
||||
{
|
||||
H5Pclose(fapl);
|
||||
H5Pclose(fcpl);
|
||||
H5Tclose(type);
|
||||
H5Sclose(space);
|
||||
H5Fclose(fid);
|
||||
}
|
||||
H5E_END_TRY;
|
||||
|
||||
HDfree(config);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
#else /* H5_HAVE_WIN32_API */
|
||||
|
||||
+46
-27
@@ -33,14 +33,14 @@ typedef struct _shared_ticks {
|
||||
uint64_t reader_tick;
|
||||
} shared_ticks_t;
|
||||
|
||||
int fd_writer_to_reader = -1, fd_reader_to_writer = -1;
|
||||
const char * fifo_writer_to_reader = "./fifo_writer_to_reader";
|
||||
const char * fifo_reader_to_writer = "./fifo_reader_to_writer";
|
||||
hbool_t use_vfd_swmr = TRUE;
|
||||
hbool_t use_named_pipe = TRUE;
|
||||
hbool_t print_estack = FALSE;
|
||||
static H5F_vfd_swmr_config_t swmr_config;
|
||||
static hbool_t writer;
|
||||
int fd_writer_to_reader = -1, fd_reader_to_writer = -1;
|
||||
const char * fifo_writer_to_reader = "./fifo_writer_to_reader";
|
||||
const char * fifo_reader_to_writer = "./fifo_reader_to_writer";
|
||||
hbool_t use_vfd_swmr = TRUE;
|
||||
hbool_t use_named_pipe = TRUE;
|
||||
hbool_t print_estack = FALSE;
|
||||
static H5F_vfd_swmr_config_t *swmr_config = NULL;
|
||||
static hbool_t writer;
|
||||
struct timespec ival = {MAX_READ_LEN_IN_SECONDS, 0}; /* Expected maximal time for reader's validation */
|
||||
|
||||
zoo_config_t config = {.proc_num = 0,
|
||||
@@ -138,9 +138,10 @@ parse_command_line_options(int argc, char **argv)
|
||||
|
||||
{
|
||||
/* Translate the tick number to time represented by the timespec struct */
|
||||
float time = (float)(((unsigned)tmpl * TICK_LEN) / 10.0);
|
||||
unsigned sec = (unsigned)time;
|
||||
unsigned nsec = (unsigned)((time - sec) * 10 * 1000 * 1000);
|
||||
long n_ticks = (long)tmpl * TICK_LEN;
|
||||
float time = (float)n_ticks / 10.0F;
|
||||
long sec = (long)time;
|
||||
long nsec = (long)((time - (float)sec) * 10 * 1000 * 1000);
|
||||
|
||||
ival.tv_sec = sec;
|
||||
ival.tv_nsec = nsec;
|
||||
@@ -247,8 +248,8 @@ notify_and_wait_for_reader(hid_t fid, int verify)
|
||||
|
||||
/* During the wait, writer makes repeated HDF5 API calls so as to trigger
|
||||
* EOT at approximately the correct time */
|
||||
for (i = 0; i < swmr_config.max_lag + 1; i++) {
|
||||
decisleep(swmr_config.tick_len);
|
||||
for (i = 0; i < swmr_config->max_lag + 1; i++) {
|
||||
decisleep(swmr_config->tick_len);
|
||||
|
||||
H5E_BEGIN_TRY
|
||||
{
|
||||
@@ -443,15 +444,29 @@ error:
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
hid_t fapl = H5I_INVALID_HID, fcpl = H5I_INVALID_HID, fid = H5I_INVALID_HID;
|
||||
H5F_t * f;
|
||||
H5C_t * cache;
|
||||
struct timespec lastmsgtime = {.tv_sec = 0, .tv_nsec = 0};
|
||||
char * progname = NULL;
|
||||
char * personality;
|
||||
estack_state_t es;
|
||||
H5F_vfd_swmr_config_t vfd_swmr_config;
|
||||
int notify = 0, verify = 0;
|
||||
hid_t fapl = H5I_INVALID_HID, fcpl = H5I_INVALID_HID, fid = H5I_INVALID_HID;
|
||||
H5F_t * f;
|
||||
H5C_t * cache;
|
||||
struct timespec lastmsgtime = {.tv_sec = 0, .tv_nsec = 0};
|
||||
char * progname = NULL;
|
||||
char * personality;
|
||||
estack_state_t es;
|
||||
H5F_vfd_swmr_config_t *vfd_swmr_config = NULL;
|
||||
int notify = 0, verify = 0;
|
||||
|
||||
if (NULL == (vfd_swmr_config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t)))) {
|
||||
H5_FAILED();
|
||||
AT();
|
||||
HDprintf("memory allocation failed");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (NULL == (swmr_config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t)))) {
|
||||
H5_FAILED();
|
||||
AT();
|
||||
HDprintf("memory allocation failed");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (H5_basename(argv[0], &progname) < 0) {
|
||||
H5_FAILED();
|
||||
@@ -478,19 +493,19 @@ main(int argc, char **argv)
|
||||
/* config, tick_len, max_lag, presume_posix_semantics, writer,
|
||||
* maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved,
|
||||
* md_file_path, md_file_name, updater_file_path */
|
||||
init_vfd_swmr_config(&vfd_swmr_config, TICK_LEN, 7, FALSE, writer, TRUE, FALSE, TRUE, 128, "./",
|
||||
init_vfd_swmr_config(vfd_swmr_config, TICK_LEN, 7, FALSE, writer, TRUE, FALSE, TRUE, 128, "./",
|
||||
"zoo-shadow", NULL);
|
||||
|
||||
/* ? turn off use latest format argument via 1st argument? since later on it reset to early format */
|
||||
/* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */
|
||||
if ((fapl = vfd_swmr_create_fapl(TRUE, use_vfd_swmr, TRUE, 4096, &vfd_swmr_config)) < 0) {
|
||||
if ((fapl = vfd_swmr_create_fapl(TRUE, use_vfd_swmr, TRUE, 4096, vfd_swmr_config)) < 0) {
|
||||
H5_FAILED();
|
||||
AT();
|
||||
HDprintf("vfd_swmr_create_fapl");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (use_vfd_swmr && H5Pget_vfd_swmr_config(fapl, &swmr_config) < 0) {
|
||||
if (use_vfd_swmr && H5Pget_vfd_swmr_config(fapl, swmr_config) < 0) {
|
||||
H5_FAILED();
|
||||
AT();
|
||||
HDprintf("H5Pget_vfd_swmr_config failed");
|
||||
@@ -656,8 +671,9 @@ main(int argc, char **argv)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (progname)
|
||||
HDfree(progname);
|
||||
HDfree(progname);
|
||||
HDfree(vfd_swmr_config);
|
||||
HDfree(swmr_config);
|
||||
|
||||
if (use_named_pipe && close_named_pipes() < 0) {
|
||||
H5_FAILED();
|
||||
@@ -688,5 +704,8 @@ error:
|
||||
HDremove(fifo_reader_to_writer);
|
||||
}
|
||||
|
||||
HDfree(vfd_swmr_config);
|
||||
HDfree(swmr_config);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
+10
-2
@@ -69,14 +69,22 @@ test_encode_decode(hid_t orig_pl, int mpi_rank, int recv_proc)
|
||||
HDfree(rbuf);
|
||||
} /* end if */
|
||||
|
||||
if (0 == mpi_rank)
|
||||
if (0 == mpi_rank) {
|
||||
/* gcc 11 complains about passing MPI_STATUSES_IGNORE as an MPI_Status
|
||||
* array. See the discussion here:
|
||||
*
|
||||
* https://github.com/pmodels/mpich/issues/5687
|
||||
*/
|
||||
H5_GCC_DIAG_OFF("stringop-overflow")
|
||||
MPI_Waitall(2, req, MPI_STATUSES_IGNORE);
|
||||
H5_GCC_DIAG_ON("stringop-overflow")
|
||||
}
|
||||
|
||||
if (NULL != sbuf)
|
||||
HDfree(sbuf);
|
||||
|
||||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -457,7 +457,7 @@ parse_args(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: getenv_all
|
||||
@@ -478,14 +478,9 @@ parse_args(int argc, char **argv)
|
||||
* Programmer: Leon Arber
|
||||
* 4/4/05
|
||||
*
|
||||
* Modifications:
|
||||
* Use original getenv if MPI is not initialized. This happens
|
||||
* one uses the PHDF5 library to build a serial nature code.
|
||||
* Albert 2006/04/07
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
char *
|
||||
static char *
|
||||
getenv_all(MPI_Comm comm, int root, const char *name)
|
||||
{
|
||||
int mpi_size, mpi_rank, mpi_initialized, mpi_finalized;
|
||||
@@ -539,7 +534,9 @@ getenv_all(MPI_Comm comm, int root, const char *name)
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
/* use original getenv */
|
||||
/* Use the original getenv if MPI is not initialized. This happens
|
||||
* if you use the parallel HDF5 library to build a serial program.
|
||||
*/
|
||||
if (env)
|
||||
HDfree(env);
|
||||
env = HDgetenv(name);
|
||||
|
||||
@@ -146,7 +146,7 @@ do_pio(parameters param)
|
||||
file_descr fd;
|
||||
iotype iot;
|
||||
|
||||
char fname[FILENAME_MAX];
|
||||
char *fname = NULL;
|
||||
long nf;
|
||||
long ndsets;
|
||||
off_t nbytes; /*number of bytes per dataset */
|
||||
@@ -168,6 +168,9 @@ do_pio(parameters param)
|
||||
/* IO type */
|
||||
iot = param.io_type;
|
||||
|
||||
if (NULL == (fname = HDcalloc(FILENAME_MAX, sizeof(char))))
|
||||
GOTOERROR(FAIL);
|
||||
|
||||
switch (iot) {
|
||||
case MPIO:
|
||||
fd.mpifd = MPI_FILE_NULL;
|
||||
@@ -283,7 +286,7 @@ do_pio(parameters param)
|
||||
char base_name[256];
|
||||
|
||||
HDsnprintf(base_name, sizeof(base_name), "#pio_tmp_%lu", nf);
|
||||
pio_create_filename(iot, base_name, fname, sizeof(fname));
|
||||
pio_create_filename(iot, base_name, fname, FILENAME_MAX);
|
||||
if (pio_debug_level > 0)
|
||||
HDfprintf(output, "rank %d: data filename=%s\n", pio_mpi_rank_g, fname);
|
||||
|
||||
@@ -365,8 +368,8 @@ done:
|
||||
}
|
||||
|
||||
/* release generic resources */
|
||||
if (buffer)
|
||||
HDfree(buffer);
|
||||
HDfree(buffer);
|
||||
HDfree(fname);
|
||||
res.ret_code = ret_code;
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ do_sio(parameters param, results *res)
|
||||
/* Open file for write */
|
||||
|
||||
HDstrcpy(base_name, "#sio_tmp");
|
||||
sio_create_filename(iot, base_name, fname, sizeof(fname), ¶m);
|
||||
sio_create_filename(iot, base_name, fname, FILENAME_MAX, ¶m);
|
||||
|
||||
if (sio_debug_level > 0)
|
||||
HDfprintf(output, "data filename=%s\n", fname);
|
||||
|
||||
Reference in New Issue
Block a user