This commit is contained in:
Binh-Minh Ribler 2018-12-23 00:18:42 -06:00
commit c3f51c52d0
319 changed files with 21343 additions and 12133 deletions

View File

@ -756,6 +756,13 @@ if (BUILD_TESTING)
mark_as_advanced (HDF5_TEST_FHEAP_VFD)
endif ()
option (HDF5_TEST_VOL "Execute tests with different VOL connectors" OFF)
mark_as_advanced (HDF5_TEST_VOL)
if (HDF5_TEST_VOL)
option (HDF5_TEST_FHEAP_VOL "Execute fheap test with different VOL connectors" ON)
mark_as_advanced (HDF5_TEST_FHEAP_VOL)
endif ()
option (HDF_TEST_EXPRESS "Control testing framework (0-3)" "0")
mark_as_advanced (HDF_TEST_EXPRESS)

View File

@ -171,7 +171,6 @@
./examples/h5_vds-percival.c
./examples/h5_vds-percival-unlim.c
./examples/h5_vds-percival-unlim-maxmin.c
./examples/h5_vol_external_log_native.c
./examples/testh5cc.sh.in
./examples/README
@ -890,11 +889,21 @@
./src/H5TS.c
./src/H5TSprivate.h
./src/H5VL.c
./src/H5VLcallback.c
./src/H5VLint.c
./src/H5VLmodule.h
./src/H5VLnative.c
./src/H5VLnative.h
./src/H5VLnative_attr.c
./src/H5VLnative_dataset.c
./src/H5VLnative_datatype.c
./src/H5VLnative_file.c
./src/H5VLnative_group.c
./src/H5VLnative_link.c
./src/H5VLnative_object.c
./src/H5VLnative_private.h
./src/H5VLpassthru.c
./src/H5VLpassthru.h
./src/H5VLpkg.h
./src/H5VLprivate.h
./src/H5VLpublic.h
@ -1146,7 +1155,6 @@
./test/test_filters_le.h5
./test/test_filters_be.h5
./test/gen_filters.c
./test/chunk_info.c
./test/vds.c
./test/vds_swmr.h
./test/vds_swmr_gen.c
@ -1388,14 +1396,17 @@
./tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err
./tools/test/h5format_convert/testfiles/h5fc_v_non_chunked.ddl
./tools/test/h5format_convert/testfiles/h5fc_d_file.ddl
./tools/test/h5format_convert/testfiles/h5fc_d_file.ddl.err
./tools/test/h5format_convert/testfiles/h5fc_d_file-d.ddl
./tools/test/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl
./tools/test/h5format_convert/testfiles/h5fc_dname.ddl
./tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl
./tools/test/h5format_convert/testfiles/h5fc_dname.err
./tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl.err
./tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl.err
./tools/test/h5format_convert/testfiles/h5fc_help.ddl
./tools/test/h5format_convert/testfiles/h5fc_v_all.ddl
./tools/test/h5format_convert/testfiles/h5fc_nooption.ddl
./tools/test/h5format_convert/testfiles/h5fc_v_n_1d.ddl
./tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl
./tools/test/h5format_convert/testfiles/h5fc_non_v3.h5
./tools/test/h5format_convert/testfiles/h5fc_edge_v3.h5
./tools/test/h5format_convert/testfiles/h5fc_err_level.h5
@ -1465,6 +1476,11 @@
./tools/test/h5ls/vds_prefix/tvds-4.ls
./tools/test/h5ls/vds_prefix/tvds-5.ls
# h5ls test error files
./tools/test/h5ls/errfiles/nosuchfile.err
./tools/test/h5ls/errfiles/textlinksrc-nodangle-1.err
./tools/test/h5ls/errfiles/tgroup-1.err
# h5copy sources
./tools/src/h5copy/Makefile.am
./tools/src/h5copy/h5copy.c
@ -1520,10 +1536,11 @@
./tools/test/misc/testfiles/h5clear_less_after_size.ddl
./tools/test/misc/testfiles/h5clear_less_before_size.ddl
./tools/test/misc/testfiles/h5clear_missing_file.ddl
./tools/test/misc/testfiles/h5clear_missing_file.err
./tools/test/misc/testfiles/h5clear_noclose_after_size.ddl
./tools/test/misc/testfiles/h5clear_noclose_before_size.ddl
./tools/test/misc/testfiles/h5clear_no_mdc_image.ddl
./tools/test/misc/testfiles/h5clear_open_fail.ddl
./tools/test/misc/testfiles/h5clear_no_mdc_image.err
./tools/test/misc/testfiles/h5clear_open_fail.err
./tools/test/misc/testfiles/h5clear_status_noclose_after_size.ddl
./tools/test/misc/testfiles/h5clear_usage.ddl
./tools/test/misc/testfiles/h5clear_user_equal_after_size.ddl
@ -1577,10 +1594,6 @@
./tools/test/h5stat/testh5stat.sh.in
./tools/test/h5stat/testfiles/h5stat_dims1.ddl
./tools/test/h5stat/testfiles/h5stat_dims2.ddl
./tools/test/h5stat/testfiles/h5stat_err1_dims.ddl
./tools/test/h5stat/testfiles/h5stat_err1_links.ddl
./tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl
./tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl
./tools/test/h5stat/testfiles/h5stat_err_old_fill.h5
./tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl
./tools/test/h5stat/testfiles/h5stat_err_old_layout.h5
@ -1618,6 +1631,15 @@
./tools/test/h5stat/testfiles/h5stat_threshold.h5
./tools/test/h5stat/testfiles/h5stat_tsohm.ddl
./tools/test/h5stat/testfiles/h5stat_tsohm.h5
./tools/test/h5stat/testfiles/h5stat_err_refcount.err
./tools/test/h5stat/testfiles/h5stat_err_old_layout.err
./tools/test/h5stat/testfiles/h5stat_err_old_fill.err
./tools/test/h5stat/testfiles/h5stat_err1_dims.err
./tools/test/h5stat/testfiles/h5stat_err1_links.err
./tools/test/h5stat/testfiles/h5stat_err1_numattrs.err
./tools/test/h5stat/testfiles/h5stat_err2_numattrs.err
./tools/test/h5stat/testfiles/h5stat_notexist.err
./tools/test/h5stat/testfiles/h5stat_nofile.err
# h5dump test files
./tools/testfiles/charsets.h5
@ -2279,7 +2301,6 @@
./tools/test/h5diff/testfiles/h5diff_600.txt
./tools/test/h5diff/testfiles/h5diff_601.txt
./tools/test/h5diff/testfiles/h5diff_601_ERR.err
./tools/test/h5diff/testfiles/h5diff_601_ERR.txt
./tools/test/h5diff/testfiles/h5diff_603.txt
./tools/test/h5diff/testfiles/h5diff_604.txt
./tools/test/h5diff/testfiles/h5diff_605.txt
@ -2386,21 +2407,12 @@
./tools/test/h5diff/testfiles/h5diff_452.txt
./tools/test/h5diff/testfiles/h5diff_453.txt
./tools/test/h5diff/testfiles/h5diff_454.txt
./tools/test/h5diff/testfiles/h5diff_454_ERR.err
./tools/test/h5diff/testfiles/h5diff_454_ERR.txt
./tools/test/h5diff/testfiles/dangling_link.err
./tools/test/h5diff/testfiles/h5diff_455.txt
./tools/test/h5diff/testfiles/h5diff_455_ERR.err
./tools/test/h5diff/testfiles/h5diff_455_ERR.txt
./tools/test/h5diff/testfiles/h5diff_456.txt
./tools/test/h5diff/testfiles/h5diff_457.txt
./tools/test/h5diff/testfiles/h5diff_457_ERR.err
./tools/test/h5diff/testfiles/h5diff_457_ERR.txt
./tools/test/h5diff/testfiles/h5diff_458.txt
./tools/test/h5diff/testfiles/h5diff_458_ERR.err
./tools/test/h5diff/testfiles/h5diff_458_ERR.txt
./tools/test/h5diff/testfiles/h5diff_459.txt
./tools/test/h5diff/testfiles/h5diff_459_ERR.err
./tools/test/h5diff/testfiles/h5diff_459_ERR.txt
./tools/test/h5diff/testfiles/h5diff_465.txt
./tools/test/h5diff/testfiles/h5diff_466.txt
./tools/test/h5diff/testfiles/h5diff_467.txt
@ -2490,6 +2502,7 @@
./tools/test/h5diff/testfiles/tudfilter.h5
./tools/test/h5diff/testfiles/tudfilter2.h5
./tools/test/h5diff/testfiles/h5diff_ud.txt
./tools/test/h5diff/testfiles/h5diff_udfail.err
./tools/test/h5diff/testfiles/h5diff_udfail.txt
./tools/test/h5diff/testfiles/diff_strings1.h5
./tools/test/h5diff/testfiles/diff_strings2.h5
@ -2590,6 +2603,7 @@
./tools/test/h5copy/testfiles/h5copy_extlinks_src.h5
./tools/test/h5copy/testfiles/h5copy_extlinks_trg.h5
./tools/test/h5copy/testfiles/h5copy_extlinks_src.out.ls
./tools/test/h5copy/testfiles/h5copy_misc1.err
./tools/test/h5copy/testfiles/h5copy_misc1.out
./tools/test/h5copy/testfiles/h5copytst_new.h5
./tools/test/h5copy/testfiles/h5copytst_new.out.ls
@ -2758,16 +2772,17 @@
# expected test output from testing h5watch
#
./hl/tools/testfiles/w-err-cmpd1.ddl
./hl/tools/testfiles/w-err-cmpd2.ddl
./hl/tools/testfiles/w-err-cmpd3.ddl
./hl/tools/testfiles/w-err-cmpd4.ddl
./hl/tools/testfiles/w-err-cmpd5.ddl
./hl/tools/testfiles/w-err-dset1.ddl
./hl/tools/testfiles/w-err-dset2.ddl
./hl/tools/testfiles/w-err-dset-nomax.ddl
./hl/tools/testfiles/w-err-dset-none.ddl
./hl/tools/testfiles/w-err-file.ddl
./hl/tools/testfiles/w-err-std.ddl
./hl/tools/testfiles/w-err-cmpd1.err
./hl/tools/testfiles/w-err-cmpd2.err
./hl/tools/testfiles/w-err-cmpd3.err
./hl/tools/testfiles/w-err-cmpd4.err
./hl/tools/testfiles/w-err-cmpd5.err
./hl/tools/testfiles/w-err-dset1.err
./hl/tools/testfiles/w-err-dset2.err
./hl/tools/testfiles/w-err-dset-nomax.err
./hl/tools/testfiles/w-err-dset-none.err
./hl/tools/testfiles/w-err-file.err
./hl/tools/testfiles/w-err-poll0.ddl
./hl/tools/testfiles/w-err-poll.ddl
./hl/tools/testfiles/w-err-width.ddl
@ -2877,6 +2892,8 @@
./java/src/jni/h5sImp.h
./java/src/jni/h5tImp.c
./java/src/jni/h5tImp.h
./java/src/jni/h5vlImp.c
./java/src/jni/h5vlImp.h
./java/src/jni/h5zImp.c
./java/src/jni/h5zImp.h
@ -3115,6 +3132,7 @@
./java/test/testfiles/JUnit-TestH5Tparams.txt
./java/test/testfiles/JUnit-TestH5Tbasic.txt
./java/test/testfiles/JUnit-TestH5T.txt
./java/test/testfiles/JUnit-TestH5VL.txt
./java/test/testfiles/JUnit-TestH5Z.txt
./java/test/h5ex_g_iterate.orig
./java/test/TestH5.java
@ -3152,6 +3170,7 @@
./java/test/TestH5Tparams.java
./java/test/TestH5Tbasic.java
./java/test/TestH5T.java
./java/test/TestH5VL.java
./java/test/TestH5Z.java
./java/test/TestAll.java
@ -3196,6 +3215,7 @@
./config/cmake/UseJavaSymlinks.cmake
./config/cmake/userblockTest.cmake
./config/cmake/vfdTest.cmake
./config/cmake/volTest.cmake
./config/cmake/wait_H5Tinit.cmake
./config/cmake_ext_mod/ConfigureChecks.cmake
@ -3236,6 +3256,7 @@
./c++/src/CMakeLists.txt
./c++/test/CMakeLists.txt
./c++/test/CMakeTests.cmake
./c++/test/CMakeVFDTests.cmake
./examples/CMakeLists.txt
./examples/CMakeTests.cmake
./examples/run-all-ex.sh
@ -3275,10 +3296,12 @@
./test/CMakeLists.txt
./test/CMakeTests.cmake
./test/CMakeVFDTests.cmake
./test/CMakeVOLTests.cmake
./test/flushrefreshTest.cmake
./test/ShellTests.cmake
./testpar/CMakeLists.txt
./testpar/CMakeTests.cmake
./testpar/CMakeVFDTests.cmake
./tools/CMakeLists.txt
./tools/lib/CMakeLists.txt
./tools/src/CMakeLists.txt
@ -3311,6 +3334,7 @@
./tools/src/h5repack/CMakeLists.txt
./tools/test/h5repack/CMakeLists.txt
./tools/test/h5repack/CMakeTests.cmake
./tools/test/h5repack/CMakeVFDTests.cmake
./tools/src/h5stat/CMakeLists.txt
./tools/test/h5stat/CMakeLists.txt
./tools/test/h5stat/CMakeTests.cmake

View File

@ -186,6 +186,15 @@ check-vfd:
fi; \
done
# Run tests with different Virtual Object Layer Connectors.
# Currently, only invoke check-vol in the test directory.
check-vol:
for d in src test; do \
if test $$d != .; then \
(cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
fi; \
done
# Automake wants to make config.status depend on configure. This
# makes sense, but config.status can't always be regenerated
# properly, which can cause builds to fail.

View File

@ -40,6 +40,7 @@ make distclean: remove all files generated by make, make check, or
make check-p: Only run parallel tests
make check-s: Only run serial tests
make check-vfd: Run tests with each virtual file driver
make check-vol: Run tests with each virtual object layer connector
HDF5 uses Automake, so any standard Automake targets not listed here
should also work.

View File

@ -132,6 +132,7 @@ DISPLAYUSAGE()
Usage: $PROGNAME [all] [checkout] [ftp <URL> [diff] [test] [srcdir] [release] [help]
[clean] [distclean] [echo] [deploy <dir>] [deploydir <dir>]
[zlib <zlib_path>] [releasedir <dir>] [srcdirname <dir>] [check-vfd]
[check-vol]
[exec <command>] [module-load <module-list>] [op-configure <option>]
[--<option>]
all: Run all commands (checkout, test & release)
@ -169,6 +170,8 @@ Usage: $PROGNAME [all] [checkout] [ftp <URL> [diff] [test] [srcdir] [release] [h
[Default is $ReleaseDir_default]
check-vfd:
Run make check-vfd instead of just make check.
check-vol:
Run make check-vol instead of just make check.
exttest <testscript>;
Run testscript;
exec <command>:
@ -422,6 +425,9 @@ while [ $# -gt 0 ] ; do
check-vfd)
CHECKVAL=check-vfd
;;
check-vol)
CHECKVAL=check-vol
;;
module-load)
shift
if [ $# -lt 1 ]; then

View File

@ -68,6 +68,7 @@ $Source = "";
"unsigned" => "Iu",
"unsigned int" => "Iu",
"uint32_t" => "Iu",
"uint64_t" => "UL",
"H5I_type_t" => "It",
"H5G_link_t" => "Ll", #Same as H5L_type_t now
"H5L_type_t" => "Ll",
@ -98,6 +99,7 @@ $Source = "";
"unsigned long long" => "UL",
"H5VL_attr_get_t" => "Va",
"H5VL_attr_specific_t" => "Vb",
"H5VL_class_value_t" => "VC",
"H5VL_dataset_get_t" => "Vc",
"H5VL_dataset_specific_t" => "Vd",
"H5VL_datatype_get_t" => "Ve",
@ -111,6 +113,7 @@ $Source = "";
"H5VL_link_specific_t" => "Vm",
"H5VL_object_get_t" => "Vn",
"H5VL_object_specific_t" => "Vo",
"H5VL_request_specific_t" => "Vr",
"void" => "x",
"FILE" => "x",
"H5A_operator_t" => "x",
@ -167,6 +170,7 @@ $Source = "";
"H5VL_t" => "x",
"H5VL_class_t" => "x",
"H5VL_loc_params_t" => "x",
"H5VL_request_notify_t" => "x",
"H5Z_func_t" => "x",
"H5Z_filter_func_t" => "x",
"va_list" => "x",
@ -315,7 +319,7 @@ sub rewrite_func ($$$$$) {
# Ignored due to NO TRACE comment.
} elsif ($body =~ s/((\n[ \t]*)H5TRACE\d+\s*\(.*?\);)\n/"$2$trace"/es) {
# Replaced an H5TRACE macro.
} elsif ($body=~s/((\n[ \t]*)FUNC_ENTER\w*\s*(\(.*?\))?;??)\n/"$1$2$trace"/es) {
} elsif ($body=~s/((\n[ \t]*)FUNC_ENTER\w*[ \t]*(\(.*?\))?;??)\n/"$1$2$trace"/es) {
# Added an H5TRACE macro after a FUNC_ENTER macro.
} else {
errmesg $file, $name, "unable to insert tracing information";

View File

@ -174,7 +174,6 @@ H5I_type_t IdComponent::getHDFObjType() const
/// \li \c H5I_DATASPACE
/// \li \c H5I_DATASET
/// \li \c H5I_ATTR
/// \li \c H5I_REFERENCE (DEPRECATED)
/// \li \c H5I_VFL
/// \li \c H5I_VOL
/// \li \c H5I_GENPROP_CLS
@ -228,7 +227,6 @@ bool IdComponent::isValid(hid_t an_id)
/// \li \c H5I_DATASPACE
/// \li \c H5I_DATASET
/// \li \c H5I_ATTR
/// \li \c H5I_REFERENCE (DEPRECATED)
/// \li \c H5I_VFL
/// \li \c H5I_VOL
/// \li \c H5I_GENPROP_CLS

View File

@ -149,7 +149,6 @@ PropList::PropList(const hid_t plist_id) : IdComponent()
case H5I_DATASPACE:
case H5I_DATASET:
case H5I_ATTR:
case H5I_REFERENCE:
case H5I_VFL:
case H5I_VOL:
case H5I_ERROR_CLASS:

View File

@ -47,55 +47,12 @@ else ()
endif ()
set_tests_properties (CPP_testhdf5 PROPERTIES DEPENDS CPP_testhdf5-clear-objects)
##############################################################################
##############################################################################
### V F D T E S T S ###
##############################################################################
##############################################################################
if (HDF5_TEST_VFD)
set (VFD_LIST
sec2
stdio
core
split
multi
family
)
if (DIRECT_VFD)
set (VFD_LIST ${VFD_LIST} direct)
endif ()
macro (ADD_VFD_TEST vfdname resultcode)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}")
add_test (
NAME CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects
COMMAND ${CMAKE_COMMAND}
-E remove
tattr_basic.h5
tattr_compound.h5
tattr_dtype.h5
tattr_multi.h5
tattr_scalar.h5
tfattrs.h5
titerate.h5
)
add_test (
NAME CPP_VFD-${vfdname}-cpp_testhdf5
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:cpp_testhdf5>"
-D "TEST_ARGS:STRING="
-D "TEST_VFD:STRING=${vfdname}"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_OUTPUT=cpp_testhdf5"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects)
set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT 30)
endif ()
endmacro ()
# Run test with different Virtual File Driver
foreach (vfd ${VFD_LIST})
ADD_VFD_TEST (${vfd} 0)
endforeach ()
include (CMakeVFDTests.cmake)
endif ()

View File

@ -0,0 +1,65 @@
#
# Copyright by The HDF Group.
# All rights reserved.
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
##############################################################################
##############################################################################
### T E S T I N G ###
##############################################################################
##############################################################################
set (VFD_LIST
sec2
stdio
core
split
multi
family
)
if (DIRECT_VFD)
set (VFD_LIST ${VFD_LIST} direct)
endif ()
macro (ADD_VFD_TEST vfdname resultcode)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}")
add_test (
NAME CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects
COMMAND ${CMAKE_COMMAND}
-E remove
tattr_basic.h5
tattr_compound.h5
tattr_dtype.h5
tattr_multi.h5
tattr_scalar.h5
tfattrs.h5
titerate.h5
)
add_test (
NAME CPP_VFD-${vfdname}-cpp_testhdf5
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:cpp_testhdf5>"
-D "TEST_ARGS:STRING="
-D "TEST_VFD:STRING=${vfdname}"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_OUTPUT=cpp_testhdf5"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects)
set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT 30)
endif ()
endmacro ()
# Run test with different Virtual File Driver
foreach (vfd ${VFD_LIST})
ADD_VFD_TEST (${vfd} 0)
endforeach ()

View File

@ -857,11 +857,6 @@ void test_links()
{
hid_t fapl_id, fapl2_id; /* File access property lists */
unsigned new_format; /* Whether to use the new format or not */
const char *envval;
envval = HDgetenv("HDF5_DRIVER");
if(envval == NULL)
envval = "nomatch";
fapl_id = h5_fileaccess();

View File

@ -32,9 +32,6 @@ endif ()
if (NOT TEST_CLASSPATH)
message (STATUS "Require TEST_CLASSPATH to be defined")
endif ()
if (NOT TEST_REFERENCE)
message (FATAL_ERROR "Require TEST_REFERENCE to be defined")
endif ()
if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT})
file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT})
@ -44,14 +41,6 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err)
endif ()
# if there is not an error reference file add the error output to the stdout file
if (NOT TEST_ERRREF)
if (NOT SKIP_APPEND)
# append error file since skip was not defined
set (ERROR_APPEND 1)
endif ()
endif ()
if (NOT TEST_LOG_LEVEL)
set (LOG_LEVEL "info")
else ()
@ -131,54 +120,56 @@ message (STATUS "COMMAND Error: ${TEST_ERROR}")
# compare output files to references unless this must be skipped
if (NOT TEST_SKIP_COMPARE)
if (WIN32 AND NOT MINGW)
file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
endif ()
if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE})
if (WIN32 AND NOT MINGW)
file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
endif ()
# now compare the output with the reference
execute_process (
COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
RESULT_VARIABLE TEST_RESULT
)
if (NOT "${TEST_RESULT}" STREQUAL "0")
set (TEST_RESULT 0)
file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
list (LENGTH test_act len_act)
file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
list (LENGTH test_ref len_ref)
if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0")
math (EXPR _FP_LEN "${len_ref} - 1")
foreach (line RANGE 0 ${_FP_LEN})
list (GET test_act ${line} str_act)
list (GET test_ref ${line} str_ref)
if (NOT "${str_act}" STREQUAL "${str_ref}")
if (NOT "${str_act}" STREQUAL "")
set (TEST_RESULT 1)
message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
# now compare the output with the reference
execute_process (
COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
RESULT_VARIABLE TEST_RESULT
)
if (NOT "${TEST_RESULT}" STREQUAL "0")
set (TEST_RESULT 0)
file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
list (LENGTH test_act len_act)
file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
list (LENGTH test_ref len_ref)
if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0")
math (EXPR _FP_LEN "${len_ref} - 1")
foreach (line RANGE 0 ${_FP_LEN})
list (GET test_act ${line} str_act)
list (GET test_ref ${line} str_ref)
if (NOT "${str_act}" STREQUAL "${str_ref}")
if (NOT "${str_act}" STREQUAL "")
set (TEST_RESULT 1)
message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
endif ()
endif ()
endforeach ()
else ()
if ("${len_act}" STREQUAL "0")
message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty")
endif ()
if ("${len_ref}" STREQUAL "0")
message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty")
endif ()
endforeach ()
else ()
if ("${len_act}" STREQUAL "0")
message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty")
endif ()
if ("${len_ref}" STREQUAL "0")
message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty")
if (NOT "${len_act}" STREQUAL "${len_ref}")
set (TEST_RESULT 1)
endif ()
endif ()
if (NOT "${len_act}" STREQUAL "${len_ref}")
set (TEST_RESULT 1)
message (STATUS "COMPARE Result: ${TEST_RESULT}")
# again, if return value is !=0 scream and shout
if (NOT "${TEST_RESULT}" STREQUAL "0")
message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}")
endif ()
endif ()
message (STATUS "COMPARE Result: ${TEST_RESULT}")
# again, if return value is !=0 scream and shout
if (NOT "${TEST_RESULT}" STREQUAL "0")
message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}")
endif ()
# now compare the .err file with the error reference, if supplied
if (TEST_ERRREF)
if (WIN32 AND NOT MINGW)
@ -217,7 +208,7 @@ if (NOT TEST_SKIP_COMPARE)
if ("${len_ref}" STREQUAL "0")
message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty")
endif ()
endif()
endif ()
if (NOT "${len_act}" STREQUAL "${len_ref}")
set (TEST_RESULT 1)
endif ()
@ -226,7 +217,7 @@ if (NOT TEST_SKIP_COMPARE)
message (STATUS "COMPARE Result: ${TEST_RESULT}")
# again, if return value is !=0 scream and shout
if (NOT ${TEST_RESULT} STREQUAL 0)
if (NOT "${TEST_RESULT}" STREQUAL "0")
message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}")
endif ()
endif ()

View File

@ -58,12 +58,13 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN
### ext libs from git
#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=GIT")
### ext libs on system
#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=NO")
#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include")
#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include")
### disable ext zlib building
### disable using ext zlib
#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF")
### disable ext szip building
### disable using ext szip
#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF")
#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF")

View File

@ -32,9 +32,9 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
endif ()
# if there is not an error reference file add the error output to the stdout file
if (NOT TEST_ERRREF)
set (ERROR_APPEND 1)
endif ()
#if (NOT TEST_ERRREF)
# set (ERROR_APPEND 1)
#endif ()
message (STATUS "USING ${TEST_VFD} ON COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}")

View File

@ -0,0 +1,76 @@
#
# Copyright by The HDF Group.
# All rights reserved.
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
# volTest.cmake executes a command and captures the output in a file. Command uses specified VOL.
# Exit status of command can also be compared.
# arguments checking
if (NOT TEST_PROGRAM)
message (FATAL_ERROR "Require TEST_PROGRAM to be defined")
endif ()
if (NOT TEST_FOLDER)
message ( FATAL_ERROR "Require TEST_FOLDER to be defined")
endif ()
if (NOT TEST_VOL)
message (FATAL_ERROR "Require TEST_VOL to be defined")
endif ()
if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT})
file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT})
endif ()
if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err)
endif ()
# if there is not an error reference file add the error output to the stdout file
#if (NOT TEST_ERRREF)
# set (ERROR_APPEND 1)
#endif ()
message (STATUS "USING ${TEST_VOL} ON COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}")
set (ENV{HDF5_VOL_CONNECTOR} "${TEST_VOL}")
# run the test program, capture the stdout/stderr and the result var
execute_process (
COMMAND ${TEST_PROGRAM} ${TEST_ARGS}
WORKING_DIRECTORY ${TEST_FOLDER}
RESULT_VARIABLE TEST_RESULT
OUTPUT_FILE ${TEST_OUTPUT}.out
ERROR_FILE ${TEST_OUTPUT}.err
OUTPUT_VARIABLE TEST_OUT
ERROR_VARIABLE TEST_ERROR
)
message (STATUS "COMMAND Result: ${TEST_RESULT}")
# if the .err file exists and ERRROR_APPEND is enabled
if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT}.out "${TEST_STREAM}")
endif ()
# if the return value is !=${TEST_EXPECT} bail out
if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}")
if (NOT TEST_NOERRDISPLAY)
if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.out)
file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.out TEST_STREAM)
message (STATUS "Output USING ${TEST_VOL}:\n${TEST_STREAM}")
endif ()
endif ()
message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}")
endif ()
message (STATUS "COMMAND Error: ${TEST_ERROR}")
# everything went fine...
message ("Passed: The ${TEST_PROGRAM} program used vol ${TEST_VOL}")

View File

@ -26,9 +26,6 @@ endif ()
if (NOT TEST_EXPECT)
message (STATUS "Require TEST_EXPECT to be defined")
endif ()
if (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE)
message (FATAL_ERROR "Require TEST_REFERENCE to be defined")
endif ()
if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT})
file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT})
@ -38,11 +35,6 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err)
endif ()
# if there is not an error reference file add the error output to the stdout file
if (NOT TEST_ERRREF)
set (ERROR_APPEND 1)
endif ()
message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}")
if (TEST_LIBRARY_DIRECTORY)
@ -96,9 +88,21 @@ endif ()
message (STATUS "COMMAND Result: ${TEST_RESULT}")
# if the .err file exists and ERRROR_APPEND is enabled
if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
if (TEST_MASK_FILE)
STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}")
endif ()
# remove special output
string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
if (NOT ERROR_APPEND)
# append error output to the stdout output file
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}")
else ()
# write back to original .err file
file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
endif ()
endif ()
# append the test result status with a predefined text
@ -119,6 +123,11 @@ endif ()
message (STATUS "COMMAND Error: ${TEST_ERROR}")
# remove special output
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
# if the output file needs Storage text removed
if (TEST_MASK)
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
@ -173,63 +182,65 @@ endif ()
# compare output files to references unless this must be skipped
if (NOT TEST_SKIP_COMPARE)
if (WIN32 AND NOT MINGW)
file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
endif ()
if (NOT TEST_SORT_COMPARE)
# now compare the output with the reference
execute_process (
COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
RESULT_VARIABLE TEST_RESULT
)
else ()
file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1)
file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2)
list (SORT v1)
list (SORT v2)
if (NOT v1 STREQUAL v2)
set(TEST_RESULT 1)
if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE})
if (WIN32 AND NOT MINGW)
file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
endif ()
endif ()
if (NOT "${TEST_RESULT}" STREQUAL "0")
set (TEST_RESULT 0)
file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
list (LENGTH test_act len_act)
file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
list (LENGTH test_ref len_ref)
if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0")
math (EXPR _FP_LEN "${len_ref} - 1")
foreach (line RANGE 0 ${_FP_LEN})
list (GET test_act ${line} str_act)
list (GET test_ref ${line} str_ref)
if (NOT "${str_act}" STREQUAL "${str_ref}")
if (NOT "${str_act}" STREQUAL "")
set (TEST_RESULT 1)
message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
endif ()
endif ()
endforeach ()
if (NOT TEST_SORT_COMPARE)
# now compare the output with the reference
execute_process (
COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
RESULT_VARIABLE TEST_RESULT
)
else ()
if ("${len_act}" STREQUAL "0")
message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty")
endif ()
if ("${len_ref}" STREQUAL "0")
message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty")
file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1)
file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2)
list (SORT v1)
list (SORT v2)
if (NOT v1 STREQUAL v2)
set(TEST_RESULT 1)
endif ()
endif ()
if (NOT "${len_act}" STREQUAL "${len_ref}")
set (TEST_RESULT 1)
if (NOT "${TEST_RESULT}" STREQUAL "0")
set (TEST_RESULT 0)
file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
list (LENGTH test_act len_act)
file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
list (LENGTH test_ref len_ref)
if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0")
math (EXPR _FP_LEN "${len_ref} - 1")
foreach (line RANGE 0 ${_FP_LEN})
list (GET test_act ${line} str_act)
list (GET test_ref ${line} str_ref)
if (NOT "${str_act}" STREQUAL "${str_ref}")
if (NOT "${str_act}" STREQUAL "")
set (TEST_RESULT 1)
message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
endif ()
endif ()
endforeach ()
else ()
if ("${len_act}" STREQUAL "0")
message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty")
endif ()
if ("${len_ref}" STREQUAL "0")
message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty")
endif ()
endif ()
if (NOT "${len_act}" STREQUAL "${len_ref}")
set (TEST_RESULT 1)
endif ()
endif ()
endif ()
message (STATUS "COMPARE Result: ${TEST_RESULT}")
message (STATUS "COMPARE Result: ${TEST_RESULT}")
# again, if return value is !=0 scream and shout
if (NOT "${TEST_RESULT}" STREQUAL "0")
message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}")
# again, if return value is !=0 scream and shout
if (NOT "${TEST_RESULT}" STREQUAL "0")
message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}")
endif ()
endif ()
# now compare the .err file with the error reference, if supplied
@ -260,7 +271,7 @@ if (NOT TEST_SKIP_COMPARE)
if (NOT "${str_act}" STREQUAL "")
set (TEST_RESULT 1)
message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
endif ()
endif ()
endif ()
endforeach ()
else ()
@ -285,5 +296,27 @@ if (NOT TEST_SKIP_COMPARE)
endif ()
endif ()
if (TEST_GREP_COMPARE)
# now grep the output with the reference
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
# TEST_REFERENCE should always be matched
string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM})
string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT)
if ("${TEST_RESULT}" STREQUAL "0")
message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}")
endif ()
string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM})
if ("${TEST_EXPECT}" STREQUAL "1")
# TEST_EXPECT (1) interperts TEST_FILTER as NOT to match
string (LENGTH "${TEST_MATCH}" TEST_RESULT)
if (NOT "${TEST_RESULT}" STREQUAL "0")
message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}")
endif ()
endif ()
endif ()
# everything went fine...
message ("Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}")
message ("${TEST_PROGRAM} Passed")

View File

@ -97,7 +97,8 @@ CHECK_CLEANFILES=*.chkexe *.chklog *.clog *.clog2
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
build-tests check-clean check-install check-p check-s check-vfd \
install-doc lib progs tests uninstall-doc _exec_check-s _test help
check-vol install-doc lib progs tests uninstall-doc _exec_check-s \
_test help
help:
@$(top_srcdir)/bin/makehelp

View File

@ -131,27 +131,42 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
echo "============================" > $${log}; \
fi; \
if test "X$(FORTRAN_API)" = "Xyes"; then \
echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
if test -n "$(REALTIMEOUTPUT)"; then \
echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log}; \
echo "Fortran API: Test log for $${tname} $(TEST_FLAGS)" | tee -a $${log}; \
else \
echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
echo "Fortran API: Test log for $${tname} $(TEST_FLAGS)" >> $${log}; \
fi; \
elif test "X$(CXX_API)" = "Xyes"; then \
echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \
if test -n "$(REALTIMEOUTPUT)"; then \
echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log};\
echo "C++ API: Test log for $${tname} $(TEST_FLAGS)" | tee -a $${log};\
else \
echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\
echo "C++ API: Test log for $${tname} $(TEST_FLAGS)" >> $${log};\
fi; \
else \
echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
echo "Testing: $${tname} $(TEST_FLAGS)"; \
if test -n "$(REALTIMEOUTPUT)"; then \
echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log}; \
echo "Test log for $${tname} $(TEST_FLAGS)" | tee -a $${log}; \
else \
echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
echo "Test log for $${tname} $(TEST_FLAGS)" >> $${log}; \
fi; \
fi; \
if test -n "$(REALTIMEOUTPUT)"; then \
if test -n "$(HDF5_VOL_CONNECTOR)"; then \
echo "VOL connector: $(HDF5_VOL_CONNECTOR)" | tee -a $${log}; \
fi; \
if test -n "$(HDF5_DRIVER)"; then \
echo "Virtual file driver (VFD): $(HDF5_DRIVER)" | tee -a $${log}; \
fi; \
else \
if test -n "$(HDF5_VOL_CONNECTOR)"; then \
echo "VOL connector: $(HDF5_VOL_CONNECTOR)" >> $${log}; \
fi; \
if test -n "$(HDF5_DRIVER)"; then \
echo "Virtual file driver (VFD): $(HDF5_DRIVER)" >> $${log}; \
fi; \
fi; \
if test -n "$(REALTIMEOUTPUT)"; then \
echo "============================" | tee -a $${log}; \
else \
@ -266,3 +281,15 @@ check-vfd: $(LIB) $(PROGS) $(chk_TESTS)
HDF5_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \
fi; \
done
# Run test with different Virtual Object Layer Connector
check-vol: $(LIB) $(PROGS) $(chk_TESTS)
@for vol in $(VOL_LIST) dummy; do \
if test "$$vol" != dummy; then \
echo "============================"; \
echo "Testing VOL Connector: \"$$vol\""; \
echo "============================"; \
$(MAKE) $(AM_MAKEFLAGS) check-clean || exit 1; \
HDF5_VOL_CONNECTOR="$$vol" $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \
fi; \
done

View File

@ -37,7 +37,6 @@ set (examples
h5_vds-percival
h5_vds-percival-unlim
h5_vds-percival-unlim-maxmin
h5_vol_external_log_native
)
foreach (example ${examples})

View File

@ -181,9 +181,9 @@
### Windows pops up a modal permission dialog on this test
if (H5_HAVE_PARALLEL AND NOT WIN32)
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME EXAMPLES-ph5example COMMAND $<TARGET_FILE:ph5example>)
add_test (NAME EXAMPLES_PAR-ph5example COMMAND $<TARGET_FILE:ph5example>)
else ()
add_test (NAME EXAMPLES-ph5example COMMAND "${CMAKE_COMMAND}"
add_test (NAME EXAMPLES_PAR-ph5example COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:ph5example>"
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
@ -195,14 +195,14 @@
)
endif ()
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (EXAMPLES-ph5example PROPERTIES DEPENDS ${last_test})
set_tests_properties (EXAMPLES_PAR-ph5example PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "EXAMPLES-ph5example")
set (last_test "EXAMPLES_PAR-ph5example")
if (BUILD_SHARED_LIBS)
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME EXAMPLES-shared-ph5example COMMAND $<TARGET_FILE:ph5example-shared>)
add_test (NAME EXAMPLES_PAR-shared-ph5example COMMAND $<TARGET_FILE:ph5example-shared>)
else ()
add_test (NAME EXAMPLES-shared-ph5example COMMAND "${CMAKE_COMMAND}"
add_test (NAME EXAMPLES_PAR-shared-ph5example COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:ph5example-shared>"
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
@ -213,10 +213,10 @@
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
set_tests_properties (EXAMPLES-shared-ph5example PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared)
set_tests_properties (EXAMPLES_PAR-shared-ph5example PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (EXAMPLES-shared-ph5example PROPERTIES DEPENDS ${last_test})
set_tests_properties (EXAMPLES_PAR-shared-ph5example PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "EXAMPLES-shared-ph5example")
set (last_test "EXAMPLES_PAR-shared-ph5example")
endif ()
endif ()

View File

@ -37,8 +37,7 @@ EXAMPLE_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \
h5_group h5_select h5_attribute h5_mount h5_reference h5_drivers \
h5_ref2reg h5_extlink h5_elink_unix2win h5_shared_mesg h5_vds h5_vds-exc \
h5_vds-exclim h5_vds-eiger h5_vds-simpleIO h5_vds-percival \
h5_vds-percival-unlim h5_vds-percival-unlim-maxmin \
h5_vol_external_log_native
h5_vds-percival-unlim h5_vds-percival-unlim-maxmin
TEST_SCRIPT=testh5cc.sh
TEST_EXAMPLES_SCRIPT=$(INSTALL_SCRIPT_FILES)
@ -51,8 +50,7 @@ INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c \
h5_reference.c h5_drivers.c h5_extlink.c h5_elink_unix2win.c \
h5_ref2reg.c h5_shared_mesg.c ph5example.c h5_vds.c h5_vds-exc.c \
h5_vds-exclim.c h5_vds-eiger.c h5_vds-simpleIO.c h5_vds-percival.c \
h5_vds-percival-unlim.c h5_vds-percival-unlim-maxmin.c \
h5_vol_external_log_native.c
h5_vds-percival-unlim.c h5_vds-percival-unlim-maxmin.c
@ -129,7 +127,6 @@ h5_vds-simpleIO: $(srcdir)/h5_vds-simpleIO.c
h5_vds-percival: $(srcdir)/h5_vds-percival.c
h5_vds-percival-unlim: $(srcdir)/h5_vds-percival-unlim.c
h5_vds-percival-unlim-maxmin: $(srcdir)/h5_vds-percival-unlim-maxmin.c
h5_vol_external_log_native: $(srcdir)/h5_vol_external_log_native.c
if BUILD_SHARED_SZIP_CONDITIONAL
LD_LIBRARY_PATH=$(LL_PATH)

View File

@ -208,7 +208,7 @@ static void extlink_prefix_example(void)
* that a path was supplied in the udata.
*/
static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group,
const void *udata, size_t udata_size, hid_t lapl_id);
const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id);
static void soft_link_example(void)
{
@ -277,7 +277,7 @@ static void soft_link_example(void)
*/
static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group,
const void *udata, size_t udata_size, hid_t lapl_id)
const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id)
{
const char *target = (const char *) udata;
hid_t ret_value;

View File

@ -1,489 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "hdf5.h"
#define LOG 502
static herr_t H5VL_log_init(hid_t vipl_id);
static herr_t H5VL_log_term(hid_t vtpl_id);
/* Datatype callbacks */
static void *H5VL_log_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req);
static void *H5VL_log_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_log_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL_log_datatype_close(void *dt, hid_t dxpl_id, void **req);
/* Dataset callbacks */
static void *H5VL_log_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
static void *H5VL_log_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_log_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, void *buf, void **req);
static herr_t H5VL_log_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
static herr_t H5VL_log_dataset_close(void *dset, hid_t dxpl_id, void **req);
/* File callbacks */
static void *H5VL_log_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
static void *H5VL_log_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_log_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL_log_file_close(void *file, hid_t dxpl_id, void **req);
/* Group callbacks */
static void *H5VL_log_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_log_group_close(void *grp, hid_t dxpl_id, void **req);
/* Link callbacks */
/* Object callbacks */
static void *H5VL_log_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req);
static herr_t H5VL_log_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
hid_t native_driver_id = -1;
static const H5VL_class_t H5VL_log_g = {
0,
LOG,
"log", /* name */
H5VL_log_init, /* initialize */
H5VL_log_term, /* terminate */
sizeof(hid_t),
NULL,
NULL,
{ /* attribute_cls */
NULL, /* H5VL_log_attr_create, */ /* create */
NULL, /* H5VL_log_attr_open, */ /* open */
NULL, /* H5VL_log_attr_read, */ /* read */
NULL, /* H5VL_log_attr_write, */ /* write */
NULL, /* H5VL_log_attr_get, */ /* get */
NULL, /* H5VL_log_attr_specific, */ /* specific */
NULL, /* H5VL_log_attr_optional, */ /* optional */
NULL /* H5VL_log_attr_close */ /* close */
},
{ /* dataset_cls */
H5VL_log_dataset_create, /* create */
H5VL_log_dataset_open, /* open */
H5VL_log_dataset_read, /* read */
H5VL_log_dataset_write, /* write */
NULL, /* H5VL_log_dataset_get, */ /* get */
NULL, /* H5VL_log_dataset_specific, */ /* specific */
NULL, /* H5VL_log_dataset_optional, */ /* optional */
H5VL_log_dataset_close /* close */
},
{ /* datatype_cls */
H5VL_log_datatype_commit, /* commit */
H5VL_log_datatype_open, /* open */
H5VL_log_datatype_get, /* get_size */
NULL, /* H5VL_log_datatype_specific, */ /* specific */
NULL, /* H5VL_log_datatype_optional, */ /* optional */
H5VL_log_datatype_close /* close */
},
{ /* file_cls */
H5VL_log_file_create, /* create */
H5VL_log_file_open, /* open */
H5VL_log_file_get, /* get */
NULL, /* H5VL_log_file_specific, */ /* specific */
NULL, /* H5VL_log_file_optional, */ /* optional */
H5VL_log_file_close /* close */
},
{ /* group_cls */
H5VL_log_group_create, /* create */
NULL, /* H5VL_log_group_open, */ /* open */
NULL, /* H5VL_log_group_get, */ /* get */
NULL, /* H5VL_log_group_specific, */ /* specific */
NULL, /* H5VL_log_group_optional, */ /* optional */
H5VL_log_group_close /* close */
},
{ /* link_cls */
NULL, /* H5VL_log_link_create, */ /* create */
NULL, /* H5VL_log_link_copy, */ /* copy */
NULL, /* H5VL_log_link_move, */ /* move */
NULL, /* H5VL_log_link_get, */ /* get */
NULL, /* H5VL_log_link_specific, */ /* specific */
NULL /* H5VL_log_link_optional, */ /* optional */
},
{ /* object_cls */
H5VL_log_object_open, /* open */
NULL, /* H5VL_log_object_copy, */ /* copy */
NULL, /* H5VL_log_object_get, */ /* get */
H5VL_log_object_specific, /* specific */
NULL /* H5VL_log_object_optional, */ /* optional */
},
{
NULL,
NULL,
NULL
},
NULL
};
typedef struct H5VL_log_t {
void *under_object;
} H5VL_log_t;
static herr_t
visit_cb(hid_t oid, const char *name, const H5O_info_t *oinfo, void *udata)
{
ssize_t len;
char n[25];
if(H5Iget_type(oid) == H5I_GROUP) {
len = H5VLget_driver_name(oid, n, 50);
printf ("Visiting GROUP VOL name = %s %lu\n", n, (unsigned long)len);
}
if(H5Iget_type(oid) == H5I_DATASET)
printf("visiting dataset\n");
if(H5Iget_type(oid) == H5I_DATATYPE)
printf("visiting datatype\n");
return 1;
}
int
main(int argc, char **argv)
{
const char file_name[]="large_dataset.h5";
const char group_name[]="/Group";
const char dataset_name[]="Data";
char fullpath[500];
hid_t file_id;
hid_t group_id;
hid_t dataspaceId;
hid_t datasetId;
hid_t acc_tpl;
hid_t under_fapl;
hid_t vol_id, vol_id2;
hid_t int_id;
hid_t attr;
hid_t space;
const unsigned int nelem=60;
int *data;
unsigned int i;
hsize_t dims[1];
ssize_t len;
char name[25];
static hsize_t ds_size[2] = {10, 20};
under_fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_native(under_fapl);
assert(H5VLis_driver_registered("native") == 1);
vol_id = H5VLregister_driver(&H5VL_log_g);
assert(vol_id > 0);
assert(H5VLis_driver_registered("log") == 1);
vol_id2 = H5VLget_driver_id("log");
H5VLinitialize(vol_id2, H5P_DEFAULT);
H5VLclose(vol_id2);
native_driver_id = H5VLget_driver_id("native");
assert(native_driver_id > 0);
acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
H5Pset_vol(acc_tpl, vol_id, &under_fapl);
file_id = H5Fcreate(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl);
len = H5VLget_driver_name(file_id, name, 25);
printf("FILE VOL name = %s %lu\n", name, (unsigned long)len);
group_id = H5Gcreate2(file_id, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
len = H5VLget_driver_name(group_id, name, 50);
printf("GROUP VOL name = %s %lu\n", name, (unsigned long)len);
int_id = H5Tcopy(H5T_NATIVE_INT);
H5Tcommit2(file_id, "int", int_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
len = H5VLget_driver_name(int_id, name, 50);
printf("DT COMMIT name = %s %lu\n", name, (unsigned long)len);
H5Tclose(int_id);
int_id = H5Topen2(file_id, "int", H5P_DEFAULT);
len = H5VLget_driver_name(int_id, name, 50);
printf("DT OPEN name = %s %lu\n", name, (unsigned long)len);
H5Tclose(int_id);
int_id = H5Oopen(file_id,"int",H5P_DEFAULT);
len = H5VLget_driver_name(int_id, name, 50);
printf("DT OPEN name = %s %lu\n", name, (unsigned long)len);
len = H5Fget_name(file_id, name, 50);
printf("name = %lu %s\n", (unsigned long)len, name);
data = malloc(sizeof(int)*nelem);
for(i = 0; i < nelem; ++i)
data[i] = i;
dims [0] = 60;
dataspaceId = H5Screate_simple(1, dims, NULL);
space = H5Screate_simple (2, ds_size, ds_size);
sprintf(fullpath,"%s/%s",group_name,dataset_name);
datasetId = H5Dcreate2(file_id,fullpath,H5T_NATIVE_INT,dataspaceId,H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
H5Sclose(dataspaceId);
len = H5VLget_driver_name(datasetId, name, 50);
printf ("DSET name = %s %lu\n", name, (unsigned long)len);
H5Dwrite(datasetId, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
H5Dclose(datasetId);
H5Ovisit2(file_id, H5_INDEX_NAME, H5_ITER_NATIVE, visit_cb, NULL, H5O_INFO_ALL);
free(data);
H5Oclose(int_id);
H5Sclose (space);
H5Gclose(group_id);
H5Fclose(file_id);
H5Pclose(acc_tpl);
H5Pclose(under_fapl);
H5VLclose(native_driver_id);
H5VLterminate(vol_id, H5P_DEFAULT);
H5VLunregister_driver(vol_id);
assert(H5VLis_driver_registered("log") == 0);
return EXIT_SUCCESS;
}
static herr_t
H5VL_log_init(hid_t vipl_id)
{
printf("------- LOG INIT\n");
return 1;
}
static herr_t
H5VL_log_term(hid_t vtpl_id)
{
printf("------- LOG TERM\n");
return 1;
}
static void *
H5VL_log_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req)
{
hid_t under_fapl;
H5VL_log_t *file;
file = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t));
under_fapl = *((hid_t *)H5Pget_vol_info(fapl_id));
file->under_object = H5VLfile_create(name, flags, fcpl_id, under_fapl, dxpl_id, req);
printf("------- LOG H5Fcreate\n");
return (void *)file;
}
static void *
H5VL_log_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req)
{
hid_t under_fapl;
H5VL_log_t *file;
file = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t));
under_fapl = *((hid_t *)H5Pget_vol_info(fapl_id));
file->under_object = H5VLfile_open(name, flags, under_fapl, dxpl_id, req);
printf("------- LOG H5Fopen\n");
return (void *)file;
}
static herr_t
H5VL_log_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
{
H5VL_log_t *f = (H5VL_log_t *)file;
H5VLfile_get(f->under_object, native_driver_id, get_type, dxpl_id, req, arguments);
printf("------- LOG H5Fget %d\n", get_type);
return 1;
}
static herr_t
H5VL_log_file_close(void *file, hid_t dxpl_id, void **req)
{
H5VL_log_t *f = (H5VL_log_t *)file;
H5VLfile_close(f->under_object, native_driver_id, dxpl_id, req);
free(f);
printf("------- LOG H5Fclose\n");
return 1;
}
static void *
H5VL_log_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name,
hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
{
H5VL_log_t *group;
H5VL_log_t *o = (H5VL_log_t *)obj;
group = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t));
group->under_object = H5VLgroup_create(o->under_object, loc_params, native_driver_id, name, gcpl_id, gapl_id, dxpl_id, req);
printf("------- LOG H5Gcreate\n");
return (void *)group;
}
static herr_t
H5VL_log_group_close(void *grp, hid_t dxpl_id, void **req)
{
H5VL_log_t *g = (H5VL_log_t *)grp;
H5VLgroup_close(g->under_object, native_driver_id, dxpl_id, req);
free(g);
printf("------- LOG H5Gclose\n");
return 1;
}
static void *
H5VL_log_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name,
hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req)
{
H5VL_log_t *dt;
H5VL_log_t *o = (H5VL_log_t *)obj;
dt = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t));
dt->under_object = H5VLdatatype_commit(o->under_object, loc_params, native_driver_id, name,
type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req);
printf("------- LOG H5Tcommit\n");
return dt;
}
static void *
H5VL_log_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req)
{
H5VL_log_t *dt;
H5VL_log_t *o = (H5VL_log_t *)obj;
dt = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t));
dt->under_object = H5VLdatatype_open(o->under_object, loc_params, native_driver_id, name, tapl_id, dxpl_id, req);
printf("------- LOG H5Topen\n");
return (void *)dt;
}
static herr_t
H5VL_log_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
{
H5VL_log_t *o = (H5VL_log_t *)dt;
herr_t ret_value;
ret_value = H5VLdatatype_get(o->under_object, native_driver_id, get_type, dxpl_id, req, arguments);
printf("------- LOG datatype get\n");
return ret_value;
}
static herr_t
H5VL_log_datatype_close(void *dt, hid_t dxpl_id, void **req)
{
H5VL_log_t *type = (H5VL_log_t *)dt;
assert(type->under_object);
H5VLdatatype_close(type->under_object, native_driver_id, dxpl_id, req);
free(type);
printf("------- LOG H5Tclose\n");
return 1;
}
static void *
H5VL_log_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req)
{
H5VL_log_t *new_obj;
H5VL_log_t *o = (H5VL_log_t *)obj;
new_obj = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t));
new_obj->under_object = H5VLobject_open(o->under_object, loc_params, native_driver_id, opened_type, dxpl_id, req);
printf("------- LOG H5Oopen\n");
return (void *)new_obj;
}
static herr_t
H5VL_log_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type,
hid_t dxpl_id, void **req, va_list arguments)
{
H5VL_log_t *o = (H5VL_log_t *)obj;
H5VLobject_specific(o->under_object, loc_params, native_driver_id, specific_type, dxpl_id, req, arguments);
printf("------- LOG Object specific\n");
return 1;
}
static void *
H5VL_log_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
{
H5VL_log_t *dset;
H5VL_log_t *o = (H5VL_log_t *)obj;
dset = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t));
dset->under_object = H5VLdataset_create(o->under_object, loc_params, native_driver_id, name, dcpl_id, dapl_id, dxpl_id, req);
printf("------- LOG H5Dcreate\n");
return (void *)dset;
}
static void *
H5VL_log_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req)
{
H5VL_log_t *dset;
H5VL_log_t *o = (H5VL_log_t *)obj;
dset = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t));
dset->under_object = H5VLdataset_open(o->under_object, loc_params, native_driver_id, name, dapl_id, dxpl_id, req);
printf("------- LOG H5Dopen\n");
return (void *)dset;
}
static herr_t
H5VL_log_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, void *buf, void **req)
{
H5VL_log_t *d = (H5VL_log_t *)dset;
H5VLdataset_read(d->under_object, native_driver_id, mem_type_id, mem_space_id, file_space_id,
plist_id, buf, req);
printf("------- LOG H5Dread\n");
return 1;
}
static herr_t
H5VL_log_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, const void *buf, void **req)
{
H5VL_log_t *d = (H5VL_log_t *)dset;
H5VLdataset_write(d->under_object, native_driver_id, mem_type_id, mem_space_id, file_space_id,
plist_id, buf, req);
printf("------- LOG H5Dwrite\n");
return 1;
}
static herr_t
H5VL_log_dataset_close(void *dset, hid_t dxpl_id, void **req)
{
H5VL_log_t *d = (H5VL_log_t *)dset;
H5VLdataset_close(d->under_object, native_driver_id, dxpl_id, req);
free(d);
printf("------- LOG H5Dclose\n");
return 1;
}

View File

@ -139,9 +139,7 @@ then
RunTest h5_vds-percival-unlim-maxmin&&\
rm h5_vds-percival-unlim-maxmin &&\
RunTest h5_vds &&\
rm h5_vds &&\
RunTest h5_vol_external_log_native &&\
rm h5_vol_external_log_native); then
rm h5_vds); then
EXIT_VALUE=${EXIT_SUCCESS}
else
EXIT_VALUE=${EXIT_FAILURE}

View File

@ -18,16 +18,16 @@
set (H5WATCH_TEST_FILES
w-help1.ddl
w-err-cmpd1.ddl
w-err-cmpd2.ddl
w-err-cmpd3.ddl
w-err-cmpd4.ddl
w-err-cmpd5.ddl
w-err-dset1.ddl
w-err-dset2.ddl
w-err-dset-nomax.ddl
w-err-dset-none.ddl
w-err-file.ddl
w-err-cmpd1.err
w-err-cmpd2.err
w-err-cmpd3.err
w-err-cmpd4.err
w-err-cmpd5.err
w-err-dset1.err
w-err-dset2.err
w-err-dset-nomax.err
w-err-dset-none.err
w-err-file.err
w-err-poll.ddl
w-err-poll0.ddl
w-err-width.ddl
@ -86,6 +86,25 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes
endif ()
endmacro ()
macro (ADD_H5_ERR_TEST resultfile resultcode)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5WATCH_ARGS-h5watch-${resultfile}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5watch>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=${resultfile}.mty"
-D "TEST_ERRREF=${resultfile}.err"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES DEPENDS ${last_test})
set (last_test "H5WATCH_ARGS-h5watch-${resultfile}")
endif ()
endmacro ()
macro (ADD_H5_WATCH resultfile resultcode)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@ -162,20 +181,20 @@ if (NOT SWMR_INCOMPAT)
ADD_H5_TEST (w-help1 0 --help)
#
# Tests on expected failures
ADD_H5_TEST (w-err-dset1 1 WATCH.h5)
ADD_H5_TEST (w-err-dset2 1 WATCH.h5/group/DSET_CMPD)
ADD_H5_TEST (w-err-dset-none 1 WATCH.h5/DSET_NONE)
ADD_H5_TEST (w-err-dset-nomax 1 WATCH.h5/DSET_NOMAX)
ADD_H5_TEST (w-err-file 1 ../WATCH.h5/DSET_CMPD)
ADD_H5_ERR_TEST (w-err-dset1 1 WATCH.h5)
ADD_H5_ERR_TEST (w-err-dset2 1 WATCH.h5/group/DSET_CMPD)
ADD_H5_ERR_TEST (w-err-dset-none 1 WATCH.h5/DSET_NONE)
ADD_H5_ERR_TEST (w-err-dset-nomax 1 WATCH.h5/DSET_NOMAX)
ADD_H5_ERR_TEST (w-err-file 1 ../WATCH.h5/DSET_CMPD)
ADD_H5_TEST (w-err-width 1 --width=-8 WATCH.h5/DSET_ONE)
ADD_H5_TEST (w-err-poll 1 --polling=-8 WATCH.h5/DSET_ONE)
ADD_H5_TEST (w-err-poll0 1 --polling=0 WATCH.h5/DSET_ONE)
#
# Tests on invalid field names via --fields option for a compound typed dataset: DSET_CMPD
ADD_H5_TEST (w-err-cmpd1 1 --fields=fieldx WATCH.h5/DSET_CMPD)
ADD_H5_TEST (w-err-cmpd2 1 --fields=field1,field2. WATCH.h5/DSET_CMPD)
ADD_H5_TEST (w-err-cmpd3 1 --fields=field1,field2, WATCH.h5/DSET_CMPD)
ADD_H5_TEST (w-err-cmpd4 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD)
ADD_H5_TEST (w-err-cmpd5 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD)
ADD_H5_ERR_TEST (w-err-cmpd1 1 --fields=fieldx WATCH.h5/DSET_CMPD)
ADD_H5_ERR_TEST (w-err-cmpd2 1 --fields=field1,field2. WATCH.h5/DSET_CMPD)
ADD_H5_ERR_TEST (w-err-cmpd3 1 --fields=field1,field2, WATCH.h5/DSET_CMPD)
ADD_H5_ERR_TEST (w-err-cmpd4 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD)
ADD_H5_ERR_TEST (w-err-cmpd5 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD)
#
endif ()

View File

@ -32,19 +32,19 @@ fi
#echo
#exit 0
H5WATCH=h5watch # The tool name
H5WATCH_BIN=`pwd`/$H5WATCH # The path of H5WATCH
EXTEND_DSET=extend_dset # Routine to extend the dataset when watching
EXTEND_BIN=`pwd`/$EXTEND_DSET # The path of EXTEND_DSET
H5WATCH=h5watch # The tool name
H5WATCH_BIN=`pwd`/$H5WATCH # The path of H5WATCH
EXTEND_DSET=extend_dset # Routine to extend the dataset when watching
EXTEND_BIN=`pwd`/$EXTEND_DSET # The path of EXTEND_DSET
#
EXIT_SUCCESS=0
EXIT_FAILURE=1
#
GEN_TEST=h5watchgentest # Generate HDF5 file with various datasets
GEN_TEST_BIN=`pwd`/$GEN_TEST # Path of the binary GEN_TEST
GEN_TEST=h5watchgentest # Generate HDF5 file with various datasets
GEN_TEST_BIN=`pwd`/$GEN_TEST # Path of the binary GEN_TEST
WATCHFILE=`pwd`/WATCH.h5 # The HDF5 file generated to test h5watch
TESTFILE=TEST.h5 # The temporary file (a copy of WATCH.h5) used by tests
TRY_MAX=30 # Try running the test again
TRY_MAX=30 # Try running the test again
#
# These 3 defines should be the same as the defines in ./extend_dset.c
WRITER_MESSAGE=writer_message # The message file created by the "extend" process
@ -53,7 +53,7 @@ MESSAGE_TIMEOUT=300 # Message timeout length in secs
#
CMP='cmp -s'
DIFF='diff -c'
NLINES=20 # Max. lines of output to display if test fails
NLINES=20 # Max. lines of output to display if test fails
#
# Mac OS: just to make sure echo "backslash backslash" behaves properly
if test `uname -s` = 'Darwin'; then
@ -83,9 +83,9 @@ TESTING() {
# Overall algorithm:
#
# Run a test and print PASSED or FAILED
# If a test did not return with the expected return code,
# If a test did not return with the expected return code,
# increment the `nerrors' global variable and (if $verbose is set) display up to $NLINES
# lines of the actual output from the test.
# lines of the actual output from the test.
# If the test did return the expected code,
# compare the actual output with the expected output;
# If the outputs are the same, print PASSED,
@ -137,7 +137,54 @@ TOOLTEST() {
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
rm -f $actual $actual_err
rm -f $actual $actual_err
fi
}
#
# TOOLTEST_ERR():
# same as toolset only compare error file
#
# Arguments:
#
# $1 -- expected output
# $2 -- expected return code
# $3 and on -- arguments for h5watch
TOOLTEST_ERR() {
expect="$srcdir/../testfiles/$1"
expect_err="$srcdir/../testfiles/`basename $1 .ddl`.err"
actual="../testfiles/`basename $1 .ddl`.out"
actual_err="../testfiles/`basename $1 .ddl`.out.err"
shift
retvalexpect=$1
shift
# Run test.
TESTING $H5WATCH $@
(
$RUNSERIAL $H5WATCH_BIN "$@"
) > $actual 2>$actual_err
exitcode=$?
if [ $exitcode -ne $retvalexpect ]; then
$ECHO "*FAILED*"
nerrors="`expr $nerrors + 1`"
if [ yes = "$verbose" ]; then
$ECHO "test returned with exit code $exitcode"
$ECHO "test output: (up to $NLINES lines)"
head -$NLINES $actual
$ECHO "***end of test output***"
$ECHO ""
fi
elif $CMP $expect_err $actual_err; then
$ECHO " PASSED"
else
$ECHO "*FAILED*"
$ECHO " Expected result differs from actual result"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect_err $actual_err |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
rm -f $actual $actual_err
fi
}
@ -176,15 +223,15 @@ do
# Wait for message from "extend_dset" process to start h5watch--
# To wait for the writer message file or till the maximum # of seconds is reached
# This performs similar function as the routine h5_wait_message() in test/h5test.c
mexist=0 # Indicate whether the message file is found
t0=`date +%s` # Get current time in seconds
difft=0 # Initialize the time difference
while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out
mexist=0 # Indicate whether the message file is found
t0=`date +%s` # Get current time in seconds
difft=0 # Initialize the time difference
while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out
do
t1=`date +%s` # Get current time in seconds
difft=`expr $t1 - $t0` # Calculate the time difference
t1=`date +%s` # Get current time in seconds
difft=`expr $t1 - $t0` # Calculate the time difference
if [ -e $WRITER_MESSAGE ]; then # If message file is found:
mexist=1 # indicate the message file is found
mexist=1 # indicate the message file is found
rm $WRITER_MESSAGE # remove the message file
break # get out of the while loop
fi
@ -211,8 +258,8 @@ do
wait $extend_pid # Wait for "extend" process to complete
extend_exit=$? # Collect "extend" process' exit code
sleep 1 # Sleep to make sure output is flushed
kill $watch_pid # Kill h5watch
wait $watch_pid # Wait for "h5watch" process to complete
kill $watch_pid # Kill h5watch
wait $watch_pid # Wait for "h5watch" process to complete
#
if [ $extend_exit -ne 0 ]; then # Error returned from "extend" process
$ECHO "*FAILED*"
@ -265,7 +312,7 @@ done;
# DSET_ONE: one-dimensional dataset #
# DSET_TWO: two-dimensional dataset #
# DSET_CMPD: one-dimensional dataset with compound type #
# DSET_CMPD_ESC: one-dimensional dataset with compound type & escape/separator characters #
# DSET_CMPD_ESC: one-dimensional dataset with compound type & escape/separator characters #
# DSET_CMPD_TWO: two-dimensional dataset with compound type #
# #
# The following datasets are one-dimensional, chunked, max. dimension setting: #
@ -282,11 +329,11 @@ done;
#################################################################################################
# #
# Tests on expected failures: #
# Invalid file name #
# Unable to find dataset, invalid dataset #
# DSET_NONE and DSET_NOMAX #
# Invalid input to options --width and --polling #
# Invalid field names for -f option #
# Invalid file name #
# Unable to find dataset, invalid dataset #
# DSET_NONE and DSET_NOMAX #
# Invalid input to options --width and --polling #
# Invalid field names for -f option #
# #
#################################################################################################
#
@ -296,21 +343,21 @@ $GEN_TEST_BIN
TOOLTEST w-help1.ddl 0 --help
#
# Tests on expected failures
TOOLTEST w-err-dset1.ddl 1 WATCH.h5
TOOLTEST w-err-dset2.ddl 1 WATCH.h5/group/DSET_CMPD
TOOLTEST w-err-dset-none.ddl 1 WATCH.h5/DSET_NONE
TOOLTEST w-err-dset-nomax.ddl 1 WATCH.h5/DSET_NOMAX
TOOLTEST w-err-file.ddl 1 ../WATCH.h5/DSET_CMPD
TOOLTEST_ERR w-err-dset1.ddl 1 WATCH.h5
TOOLTEST_ERR w-err-dset2.ddl 1 WATCH.h5/group/DSET_CMPD
TOOLTEST_ERR w-err-dset-none.ddl 1 WATCH.h5/DSET_NONE
TOOLTEST_ERR w-err-dset-nomax.ddl 1 WATCH.h5/DSET_NOMAX
TOOLTEST_ERR w-err-file.ddl 1 ../WATCH.h5/DSET_CMPD
TOOLTEST w-err-width.ddl 1 --width=-8 WATCH.h5/DSET_ONE
TOOLTEST w-err-poll.ddl 1 --polling=-8 WATCH.h5/DSET_ONE
TOOLTEST w-err-poll0.ddl 1 --polling=0 WATCH.h5/DSET_ONE
#
# Tests on invalid field names via --fields option for a compound typed dataset: DSET_CMPD
TOOLTEST w-err-cmpd1.ddl 1 --fields=fieldx WATCH.h5/DSET_CMPD
TOOLTEST w-err-cmpd2.ddl 1 --fields=field1,field2. WATCH.h5/DSET_CMPD
TOOLTEST w-err-cmpd3.ddl 1 --fields=field1,field2, WATCH.h5/DSET_CMPD
TOOLTEST w-err-cmpd4.ddl 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD
TOOLTEST w-err-cmpd5.ddl 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD
TOOLTEST_ERR w-err-cmpd1.ddl 1 --fields=fieldx WATCH.h5/DSET_CMPD
TOOLTEST_ERR w-err-cmpd2.ddl 1 --fields=field1,field2. WATCH.h5/DSET_CMPD
TOOLTEST_ERR w-err-cmpd3.ddl 1 --fields=field1,field2, WATCH.h5/DSET_CMPD
TOOLTEST_ERR w-err-cmpd4.ddl 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD
TOOLTEST_ERR w-err-cmpd5.ddl 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD
#
echo "DONE WITH 1st SET OF TESTS"
#

View File

@ -1,2 +1 @@
Opened "WATCH.h5" with sec2 driver.
h5watch error: error in processing <list_of_fields>

View File

@ -1,2 +1 @@
Opened "WATCH.h5" with sec2 driver.
h5watch error: error in processing <list_of_fields>

View File

@ -1,2 +1 @@
Opened "WATCH.h5" with sec2 driver.
h5watch error: error in processing <list_of_fields>

View File

@ -1,2 +1 @@
Opened "WATCH.h5" with sec2 driver.
h5watch error: error in processing <list_of_fields>

View File

@ -0,0 +1 @@
h5watch error: error in processing <list_of_fields>

View File

@ -1,2 +1 @@
Opened "WATCH.h5" with sec2 driver.
h5watch error: "/DSET_NOMAX" should have unlimited or max. dimension setting

View File

@ -1,2 +1 @@
Opened "WATCH.h5" with sec2 driver.
h5watch error: "/DSET_NONE" should be a chunked or virtual dataset

View File

@ -1,2 +1 @@
Opened "WATCH.h5" with sec2 driver.
h5watch error: no dataset specified

View File

@ -1,2 +1 @@
Opened "WATCH.h5" with sec2 driver.
h5watch error: unable to open dataset "/group/DSET_CMPD"

View File

@ -499,9 +499,9 @@ public class H5 implements java.io.Serializable {
private synchronized static native boolean H5is_library_threadsafe();
// /////// unimplemented ////////
// H5_DLL herr_t H5free_memory(void *mem);
// H5_DLL void *H5allocate_memory(size_t size, hbool_t clear);
// H5_DLL void *H5resize_memory(void *mem, size_t size);
// herr_t H5free_memory(void *mem);
// void *H5allocate_memory(size_t size, hbool_t clear);
// void *H5resize_memory(void *mem, size_t size);
// ////////////////////////////////////////////////////////////
// //
@ -852,7 +852,8 @@ public class H5 implements java.io.Serializable {
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
**/
public static long H5Aget_space(long attr_id) throws HDF5LibraryException {
public static long H5Aget_space(long attr_id) throws HDF5LibraryException
{
long id = _H5Aget_space(attr_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Aget_space add {}", id);
@ -888,7 +889,8 @@ public class H5 implements java.io.Serializable {
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
**/
public static long H5Aget_type(long attr_id) throws HDF5LibraryException {
public static long H5Aget_type(long attr_id) throws HDF5LibraryException
{
long id = _H5Aget_type(attr_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Aget_type add {}", id);
@ -918,8 +920,9 @@ public class H5 implements java.io.Serializable {
* @exception NullPointerException
* - Name is null.
**/
public static long H5Aopen(long obj_id, String attr_name, long aapl_id) throws HDF5LibraryException,
NullPointerException {
public static long H5Aopen(long obj_id, String attr_name, long aapl_id)
throws HDF5LibraryException, NullPointerException
{
long id = _H5Aopen(obj_id, attr_name, aapl_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Aopen add {}", id);
@ -959,7 +962,8 @@ public class H5 implements java.io.Serializable {
* - Name is null.
**/
public static long H5Aopen_by_idx(long loc_id, String obj_name, int idx_type, int order, long n, long aapl_id,
long lapl_id) throws HDF5LibraryException, NullPointerException {
long lapl_id) throws HDF5LibraryException, NullPointerException
{
long id = _H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Aopen_by_idx add {}", id);
@ -994,7 +998,8 @@ public class H5 implements java.io.Serializable {
* - obj_name is null.
**/
public static long H5Aopen_by_name(long loc_id, String obj_name, String attr_name, long aapl_id, long lapl_id)
throws HDF5LibraryException, NullPointerException {
throws HDF5LibraryException, NullPointerException
{
long id = _H5Aopen_by_name(loc_id, obj_name, attr_name, aapl_id, lapl_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Aopen_by_name add {}", id);
@ -1015,8 +1020,10 @@ public class H5 implements java.io.Serializable {
* IN: Identifier of an attribute to read.
* @param mem_type_id
* IN: Identifier of the attribute datatype (in memory).
* @param buf
* IN: Buffer for data to be read.
* @param obj
* Buffer to store data read from the file.
* @param isCriticalPinning
* request lock on data reference.
*
* @return a non-negative value if successful
*
@ -1025,9 +1032,19 @@ public class H5 implements java.io.Serializable {
* @exception NullPointerException
* - data buffer is null.
**/
public synchronized static native int H5Aread(long attr_id, long mem_type_id, byte[] buf)
public synchronized static native int H5Aread(long attr_id, long mem_type_id, byte[] obj, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Aread(long attr_id, long mem_type_id, byte[] buf) throws HDF5LibraryException, NullPointerException
{
return H5Aread(attr_id, mem_type_id, buf, true);
}
public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException
{
return H5Aread(attr_id, mem_type_id, obj, true);
}
/**
* H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with
* mem_type_id. The entire attribute is read into data object from the file.
@ -1038,31 +1055,143 @@ public class H5 implements java.io.Serializable {
* IN: Identifier of the attribute datatype (in memory).
* @param obj
* IN: Object for data to be read.
* @param isCriticalPinning
* request lock on data reference.
*
* @return a non-negative value if successful
*
* @exception HDF5Exception
* - Failure in the data conversion.
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception NullPointerException
* - data buffer is null. See public synchronized static native int H5Aread( )
**/
public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj) throws HDF5Exception,
NullPointerException {
HDFArray theArray = new HDFArray(obj);
byte[] buf = theArray.emptyBytes();
public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj, boolean isCriticalPinning)
throws HDF5Exception, HDF5LibraryException, NullPointerException
{
int status = -1;
boolean is1D = false;
// This will raise an exception if there is an error
int status = H5Aread(attr_id, mem_type_id, buf);
Class dataClass = obj.getClass();
if (!dataClass.isArray()) {
throw (new HDF5JavaException("H5Aread: data is not an array"));
}
// No exception: status really ought to be OK
if (status >= 0) {
obj = theArray.arrayify(buf);
String cname = dataClass.getName();
is1D = (cname.lastIndexOf('[') == cname.indexOf('['));
char dname = cname.charAt(cname.lastIndexOf("[") + 1);
log.trace("H5Aread: cname={} is1D={} dname={}", cname, is1D, dname);
if (is1D && (dname == 'B')) {
log.trace("H5Aread_dname_B");
status = H5Aread(attr_id, mem_type_id, (byte[]) obj, isCriticalPinning);
}
else if (is1D && (dname == 'S')) {
log.trace("H5Aread_dname_S");
status = H5Aread_short(attr_id, mem_type_id, (short[]) obj, isCriticalPinning);
}
else if (is1D && (dname == 'I')) {
log.trace("H5Aread_dname_I");
status = H5Aread_int(attr_id, mem_type_id, (int[]) obj, isCriticalPinning);
}
else if (is1D && (dname == 'J')) {
log.trace("H5Aread_dname_J");
status = H5Aread_long(attr_id, mem_type_id, (long[]) obj, isCriticalPinning);
}
else if (is1D && (dname == 'F')) {
log.trace("H5Aread_dname_F");
status = H5Aread_float(attr_id, mem_type_id, (float[]) obj, isCriticalPinning);
}
else if (is1D && (dname == 'D')) {
log.trace("H5Aread_dname_D");
status = H5Aread_double(attr_id, mem_type_id, (double[]) obj, isCriticalPinning);
}
else if ((H5.H5Tdetect_class(mem_type_id, HDF5Constants.H5T_REFERENCE) && (is1D && (dataClass.getComponentType() == String.class))) || H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) {
log.trace("H5Aread_reg_ref");
status = H5Aread_reg_ref(attr_id, mem_type_id, (String[]) obj);
}
else if (is1D && (dataClass.getComponentType() == String.class)) {
log.trace("H5Aread_string type");
status = H5Aread_string(attr_id, mem_type_id, (String[]) obj);
}
else {
// Create a data buffer to hold the data into a Java Array
HDFArray theArray = new HDFArray(obj);
byte[] buf = theArray.emptyBytes();
log.trace("H5Aread_else");
// This will raise an exception if there is an error
status = H5Aread(attr_id, mem_type_id, buf, isCriticalPinning);
// No exception: status really ought to be OK
if (status >= 0) {
obj = theArray.arrayify(buf);
}
// clean up these: assign 'null' as hint to gc()
buf = null;
theArray = null;
}
return status;
}
public synchronized static native int H5AreadVL(long attr_id, long mem_type_id, String[] buf)
public synchronized static native int H5Aread_double(long attr_id, long mem_type_id, double[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Aread_double(long attr_id, long mem_type_id, double[] buf)
throws HDF5LibraryException, NullPointerException
{
return H5Aread_double(attr_id, mem_type_id, buf, true);
}
public synchronized static native int H5Aread_float(long attr_id, long mem_type_id, float[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Aread_float(long attr_id, long mem_type_id, float[] buf)
throws HDF5LibraryException, NullPointerException
{
return H5Aread_float(attr_id, mem_type_id, buf, true);
}
public synchronized static native int H5Aread_int(long attr_id, long mem_type_id, int[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Aread_int(long attr_id, long mem_type_id, int[] buf)
throws HDF5LibraryException, NullPointerException
{
return H5Aread_int(attr_id, mem_type_id, buf, true);
}
public synchronized static native int H5Aread_long(long attr_id, long mem_type_id, long[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Aread_long(long attr_id, long mem_type_id, long[] buf)
throws HDF5LibraryException, NullPointerException
{
return H5Aread_long(attr_id, mem_type_id, buf, true);
}
public synchronized static native int H5Aread_reg_ref(long attr_id, long mem_type_id, String[] buf)
throws HDF5LibraryException, NullPointerException;
public synchronized static native int H5Aread_short(long attr_id, long mem_type_id, short[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Aread_short(long attr_id, long mem_type_id, short[] buf)
throws HDF5LibraryException, NullPointerException
{
return H5Aread_short(attr_id, mem_type_id, buf, true);
}
public synchronized static native int H5AreadVL(long attr_id, long mem_type_id, Object[] buf)
throws HDF5LibraryException, NullPointerException;
public synchronized static native int H5Aread_string(long attr_id, long mem_type_id, String[] buf)
throws HDF5LibraryException, NullPointerException;
public synchronized static native int H5Aread_VLStrings(long attr_id, long mem_type_id, Object[] buf)
throws HDF5LibraryException, NullPointerException;
public synchronized static native int H5AreadComplex(long attr_id, long mem_type_id, String[] buf)
@ -1123,7 +1252,9 @@ public class H5 implements java.io.Serializable {
* @param mem_type_id
* IN: Identifier of the attribute datatype (in memory).
* @param buf
* IN: Data to be written.
* IN: Buffer with data to be written to the file.
* @param isCriticalPinning
* IN: request lock on data reference.
*
* @return a non-negative value if successful
*
@ -1132,9 +1263,21 @@ public class H5 implements java.io.Serializable {
* @exception NullPointerException
* - data is null.
**/
public synchronized static native int H5Awrite(long attr_id, long mem_type_id, byte[] buf)
public synchronized static native int H5Awrite(long attr_id, long mem_type_id, byte[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Awrite(long attr_id, long mem_type_id, byte[] buf)
throws HDF5LibraryException, NullPointerException
{
return H5Awrite(attr_id, mem_type_id, buf, true);
}
public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj)
throws HDF5Exception, HDF5LibraryException, NullPointerException
{
return H5Awrite(attr_id, mem_type_id, obj, true);
}
/**
* H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with
* mem_type_id. The entire attribute is written from data object to the file.
@ -1145,28 +1288,140 @@ public class H5 implements java.io.Serializable {
* IN: Identifier of the attribute datatype (in memory).
* @param obj
* IN: Data object to be written.
* @param isCriticalPinning
* request lock on data reference.
*
* @return a non-negative value if successful
*
* @exception HDF5Exception
* - Failure in the data conversion.
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception NullPointerException
* - data object is null
**/
public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj, boolean isCriticalPinning)
throws HDF5Exception, HDF5LibraryException, NullPointerException
{
int status = -1;
boolean is1D = false;
Class dataClass = obj.getClass();
if (!dataClass.isArray()) {
throw (new HDF5JavaException("H5Dwrite: data is not an array"));
}
String cname = dataClass.getName();
is1D = (cname.lastIndexOf('[') == cname.indexOf('['));
char dname = cname.charAt(cname.lastIndexOf("[") + 1);
if (is1D && (dname == 'B')) {
status = H5Awrite(attr_id, mem_type_id, (byte[]) obj, isCriticalPinning);
}
else if (is1D && (dname == 'S')) {
status = H5Awrite_short(attr_id, mem_type_id, (short[]) obj, isCriticalPinning);
}
else if (is1D && (dname == 'I')) {
status = H5Awrite_int(attr_id, mem_type_id, (int[]) obj, isCriticalPinning);
}
else if (is1D && (dname == 'J')) {
status = H5Awrite_long(attr_id, mem_type_id, (long[]) obj, isCriticalPinning);
}
else if (is1D && (dname == 'F')) {
status = H5Awrite_float(attr_id, mem_type_id, (float[]) obj, isCriticalPinning);
}
else if (is1D && (dname == 'D')) {
status = H5Awrite_double(attr_id, mem_type_id, (double[]) obj, isCriticalPinning);
}
else if (is1D && (dataClass.getComponentType() == String.class)) {
log.trace("H5Dwrite_string type");
status = H5Awrite_string(attr_id, mem_type_id, (String[]) obj);
}
else {
HDFArray theArray = new HDFArray(obj);
byte[] buf = theArray.byteify();
status = H5Awrite(attr_id, mem_type_id, buf);
buf = null;
theArray = null;
}
return status;
}
public synchronized static native int H5Awrite_double(long attr_id, long mem_type_id, double[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Awrite_double(long attr_id, long mem_type_id, double[] buf)
throws HDF5LibraryException, NullPointerException
{
return H5Awrite_double(attr_id, mem_type_id, buf, true);
}
public synchronized static native int H5Awrite_float(long attr_id, long mem_type_id, float[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Awrite_float(long attr_id, long mem_type_id, float[] buf)
throws HDF5LibraryException, NullPointerException
{
return H5Awrite_float(attr_id, mem_type_id, buf, true);
}
public synchronized static native int H5Awrite_int(long attr_id, long mem_type_id, int[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Awrite_int(long attr_id, long mem_type_id, int[] buf)
throws HDF5LibraryException, NullPointerException
{
return H5Awrite_int(attr_id, mem_type_id, buf, true);
}
public synchronized static native int H5Awrite_long(long attr_id, long mem_type_id, long[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Awrite_long(long attr_id, long mem_type_id, long[] buf)
throws HDF5LibraryException, NullPointerException
{
return H5Awrite_long(attr_id, mem_type_id, buf, true);
}
public synchronized static native int H5Awrite_short(long attr_id, long mem_type_id, short[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Awrite_short(long attr_id, long mem_type_id, short[] buf)
throws HDF5LibraryException, NullPointerException
{
return H5Awrite_short(attr_id, mem_type_id, buf, true);
}
public synchronized static native int H5Awrite_string(long attr_id, long mem_type_id, String[] buf)
throws HDF5LibraryException, NullPointerException;
public synchronized static native int H5AwriteVL(long attr_id, long mem_type_id, Object[] buf)
throws HDF5LibraryException, NullPointerException;
/**
* H5Awrite_VLStrings writes a variable length String dataset, specified by its identifier attr_id, from
* the application memory buffer buf into the file.
*
* ---- contributed by Rosetta Biosoftware
*
* @param attr_id
* Identifier of the attribute read from.
* @param mem_type_id
* Identifier of the memory datatype.
* @param buf
* Buffer with data to be written to the file.
*
* @return a non-negative value if successful
*
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception NullPointerException
* - data object is null. See public synchronized static native int H5Awrite(int attr_id, int
* mem_type_id, byte[] buf);
* - name is null.
**/
public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj)
throws HDF5Exception, NullPointerException
{
HDFArray theArray = new HDFArray(obj);
byte[] buf = theArray.byteify();
int retVal = H5Awrite(attr_id, mem_type_id, buf);
buf = null;
theArray = null;
return retVal;
}
public synchronized static native int H5AwriteVL(long attr_id, long mem_type_id, String[] buf)
public synchronized static native int H5Awrite_VLStrings(long attr_id, long mem_type_id, Object[] buf)
throws HDF5LibraryException, NullPointerException;
/**
@ -1614,8 +1869,8 @@ public class H5 implements java.io.Serializable {
* @exception NullPointerException
* - name is null.
**/
public static long H5Dopen(long loc_id, String name, long dapl_id) throws HDF5LibraryException,
NullPointerException {
public static long H5Dopen(long loc_id, String name, long dapl_id) throws HDF5LibraryException, NullPointerException
{
long id = _H5Dopen2(loc_id, name, dapl_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Dopen add {}", id);
@ -1664,12 +1919,14 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException {
long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException
{
return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException {
long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException
{
return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true);
}
@ -1703,7 +1960,8 @@ public class H5 implements java.io.Serializable {
**/
public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException,
NullPointerException {
NullPointerException
{
int status = -1;
boolean is1D = false;
@ -1734,7 +1992,8 @@ public class H5 implements java.io.Serializable {
}
else if (is1D && (dname == 'J')) {
log.trace("H5Dread_dname_J");
status = H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj);
status = H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj,
isCriticalPinning);
}
else if (is1D && (dname == 'F')) {
log.trace("H5Dread_dname_F");
@ -1783,7 +2042,8 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dread_double(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException {
long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException
{
return H5Dread_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@ -1792,7 +2052,8 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dread_float(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException {
long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException
{
return H5Dread_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@ -1801,7 +2062,8 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dread_int(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException {
long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException
{
return H5Dread_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@ -1810,22 +2072,21 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dread_long(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException {
long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException
{
return H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
public synchronized static native int H5Dread_reg_ref(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException;
public synchronized static native int H5Dread_reg_ref_data(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException;
public synchronized static native int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, short[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException {
long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException
{
return H5Dread_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@ -1929,12 +2190,14 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException {
long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException
{
return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException {
long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException
{
return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true);
}
@ -1968,7 +2231,8 @@ public class H5 implements java.io.Serializable {
**/
public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException,
NullPointerException {
NullPointerException
{
int status = -1;
boolean is1D = false;
@ -2031,7 +2295,8 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dwrite_double(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException {
long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException
{
return H5Dwrite_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@ -2040,7 +2305,8 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dwrite_float(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException {
long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException
{
return H5Dwrite_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@ -2049,7 +2315,8 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dwrite_int(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException {
long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException
{
return H5Dwrite_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@ -2058,7 +2325,8 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dwrite_long(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException {
long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException
{
return H5Dwrite_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@ -2067,7 +2335,8 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dwrite_short(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException {
long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException
{
return H5Dwrite_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@ -2133,10 +2402,10 @@ public class H5 implements java.io.Serializable {
public synchronized static native void H5Drefresh(long dset_id) throws HDF5LibraryException;
// /////// unimplemented ////////
// H5_DLL herr_t H5Ddebug(hid_t dset_id);
// H5_DLL herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes);
// H5_DLL herr_t H5Dformat_convert(hid_t dset_id);
// H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type);
// herr_t H5Ddebug(hid_t dset_id);
// herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes);
// herr_t H5Dformat_convert(hid_t dset_id);
// herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type);
// herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
// size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data);
@ -2808,9 +3077,28 @@ public class H5 implements java.io.Serializable {
* - Error from the HDF-5 Library.
* @exception NullPointerException
* - name is null.
*
* @deprecated As of HDF5 1.10.5 in favor of H5Fis_accessible.
**/
public synchronized static native boolean H5Fis_hdf5(String name) throws HDF5LibraryException, NullPointerException;
/**
* H5Fis_accessible determines if the file can be opened with the given fapl.
*
* @param name
* IN: File name to check.
* @param file_id
* IN: File identifier for a currently-open HDF5 file
*
* @return true if file is accessible, false if not.
*
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception NullPointerException
* - name is null.
**/
public synchronized static native boolean H5Fis_accessible(String name, long file_id) throws HDF5LibraryException, NullPointerException;
/**
* H5Fmount mounts the file specified by child_id onto the group specified by loc_id and name using the mount
* properties plist_id.
@ -2942,20 +3230,20 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
// /////// unimplemented ////////
// H5_DLL herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa);
// H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment);
// herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa);
// herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment);
// ssize_t H5Fget_file_image(hid_t file_id, void * buf_ptr, size_t buf_len);
// herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info);
// ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/);
// H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high);
// H5_DLL herr_t H5Fformat_convert(hid_t fid);
// H5_DLL herr_t H5Freset_page_buffering_stats(hid_t file_id);
// H5_DLL herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2],
// herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high);
// herr_t H5Fformat_convert(hid_t fid);
// herr_t H5Freset_page_buffering_stats(hid_t file_id);
// herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2],
// unsigned hits[2], unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]);
// H5_DLL herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_size);
// herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_size);
// #ifdef H5_HAVE_PARALLEL
// H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
// H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);
// herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
// herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);
// #endif /* H5_HAVE_PARALLEL */
// /**
@ -3015,25 +3303,25 @@ public class H5 implements java.io.Serializable {
// ////////////////////////////////////////////////////////////
// /////// unimplemented ////////
// H5_DLL hid_t H5FDregister(const H5FD_class_t *cls);
// H5_DLL herr_t H5FDunregister(hid_t driver_id);
// H5_DLL H5FD_t *H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
// H5_DLL herr_t H5FDclose(H5FD_t *file);
// H5_DLL int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2);
// H5_DLL int H5FDquery(const H5FD_t *f, unsigned long *flags);
// H5_DLL haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
// H5_DLL herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size);
// H5_DLL haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type);
// H5_DLL herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa);
// H5_DLL haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type);
// H5_DLL herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void**file_handle);
// H5_DLL herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/);
// H5_DLL herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf);
// H5_DLL herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
// H5_DLL herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
// H5_DLL herr_t H5FDlock(H5FD_t *file, hbool_t rw);
// H5_DLL herr_t H5FDunlock(H5FD_t *file);
// H5_DLL herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/);
// hid_t H5FDregister(const H5FD_class_t *cls);
// herr_t H5FDunregister(hid_t driver_id);
// H5FD_t *H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
// herr_t H5FDclose(H5FD_t *file);
// int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2);
// int H5FDquery(const H5FD_t *f, unsigned long *flags);
// haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
// herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size);
// haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type);
// herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa);
// haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type);
// herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void**file_handle);
// herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/);
// herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf);
// herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
// herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
// herr_t H5FDlock(H5FD_t *file, hbool_t rw);
// herr_t H5FDunlock(H5FD_t *file);
// herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/);
// ////////////////////////////////////////////////////////////
// //
@ -3506,7 +3794,7 @@ public class H5 implements java.io.Serializable {
// ////////////////////////////////////////////////////////////
// //
// H5I: HDF5 1.8 Identifier Interface API Functions //
// H5I: HDF5 Identifier Interface API Functions //
// //
// ////////////////////////////////////////////////////////////
@ -3662,12 +3950,20 @@ public class H5 implements java.io.Serializable {
// hid_t H5Iregister(H5I_type_t type, const void *object);
// typedef herr_t (*H5I_free_t)(void *);
// H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func);
// void *H5Iremove_verify(hid_t id, H5I_type_t id_type);
// Type of the function to compare objects & keys
// typedef int (*H5I_search_func_t)(void *obj, hid_t id, void *key);
// void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key);
// Type of the H5Iiterate callback function
// typedef herr_t (*H5I_iterate_func_t)(hid_t id, void *udata);
// herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data);
// //////////////////////////////////////////////////////////////////
// H5L: Link Interface Functions //
// //////////////////////////////////////////////////////////////////
@ -4695,9 +4991,9 @@ public class H5 implements java.io.Serializable {
public synchronized static native void H5Orefresh(long object_id) throws HDF5LibraryException;
// /////// unimplemented ////////
// H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id);
// H5_DLL herr_t H5Oenable_mdc_flushes(hid_t object_id);
// H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled);
// herr_t H5Odisable_mdc_flushes(hid_t object_id);
// herr_t H5Oenable_mdc_flushes(hid_t object_id);
// herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled);
// ////////////////////////////////////////////////////////////
// //
@ -4982,6 +5278,27 @@ public class H5 implements java.io.Serializable {
private synchronized static native long _H5Pcopy(long plist) throws HDF5LibraryException;
// Define property list class callback function pointer types
// typedef herr_t (*H5P_cls_create_func_t)(hid_t prop_id, void *create_data);
// typedef herr_t (*H5P_cls_copy_func_t)(hid_t new_prop_id, hid_t old_prop_id, void *copy_data);
// typedef herr_t (*H5P_cls_close_func_t)(hid_t prop_id, void *close_data);
// Define property list callback function pointer types
// typedef herr_t (*H5P_prp_cb1_t)(const char *name, size_t size, void *value);
// typedef herr_t (*H5P_prp_cb2_t)(hid_t prop_id, const char *name, size_t size, void *value);
// typedef H5P_prp_cb1_t H5P_prp_create_func_t;
// typedef H5P_prp_cb2_t H5P_prp_set_func_t;
// typedef H5P_prp_cb2_t H5P_prp_get_func_t;
// typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *size);
// typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value);
// typedef H5P_prp_cb2_t H5P_prp_delete_func_t;
// typedef H5P_prp_cb1_t H5P_prp_copy_func_t;
// typedef int (*H5P_prp_compare_func_t)(const void *value1, const void *value2, size_t size);
// typedef H5P_prp_cb1_t H5P_prp_close_func_t;
// Define property list iteration function type
// typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data);
public static long H5Pcreate_class_nocb(long parent_class, String name) throws HDF5LibraryException {
long id = _H5Pcreate_class_nocb(parent_class, name);
if (id > 0) {
@ -6145,6 +6462,11 @@ public class H5 implements java.io.Serializable {
public synchronized static native void H5Pset_evict_on_close(long fapl_id, boolean evict_on_close)
throws HDF5LibraryException;
// ///// unimplemented /////
// herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info);
// herr_t H5Pget_vol_id(hid_t plist_id, hid_t *vol_id);
// herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info);
// Dataset creation property list (DCPL) routines //
/**
@ -7523,13 +7845,13 @@ public class H5 implements java.io.Serializable {
// herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size);
// #ifdef H5_HAVE_PARALLEL
// herr_t H5Pset_all_coll_metadata_ops(hid_t accpl_id, hbool_t is_collective);
// H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective);
// herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective);
// herr_t H5Pset_coll_metadata_write(hid_t fapl_id, hbool_t is_collective);
// herr_t H5Pget_coll_metadata_write(hid_t fapl_id, hbool_t *is_collective);
// #endif /* H5_HAVE_PARALLEL */
// H5_DLL herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr);
// H5_DLL herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/);
// H5_DLL herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per, unsigned min_raw_per);
// herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr);
// herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/);
// herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per, unsigned min_raw_per);
// herr_t H5Pget_page_buffer_size(hid_t fapl_id, size_t *buf_size, unsigned *min_meta_perc, unsigned *min_raw_perc);
// herr_t H5Pset_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t func, void *user_data);
// herr_t H5Pget_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t *func, void **user_data);
@ -7552,9 +7874,9 @@ public class H5 implements java.io.Serializable {
// herr_t H5Pget_type_conv_cb(hid_t plist, H5T_conv_except_func_t *func, void **op_data)
// herr_t H5Pset_type_conv_cb( hid_t plist, H5T_conv_except_func_t func, void *op_data)
// #ifdef H5_HAVE_PARALLEL
// H5_DLL herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode);
// H5_DLL herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode);
// H5_DLL herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause, uint32_t *global_no_collective_cause);
// herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode);
// herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode);
// herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause, uint32_t *global_no_collective_cause);
// #endif /* H5_HAVE_PARALLEL */
// Link creation property list (LCPL) routines //
@ -8497,16 +8819,17 @@ public class H5 implements java.io.Serializable {
// /////// unimplemented ////////
// #ifdef NEW_HYPERSLAB_API
// H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op,
// hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op,
// const hsize_t start[],
// const hsize_t _stride[],
// const hsize_t count[],
// const hsize_t _block[]);
// H5_DLL herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op,
// herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op,
// hid_t space2_id);
// H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op,
// hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op,
// hid_t space2_id);
// #endif /* NEW_HYPERSLAB_API */
// herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id);
@ -9983,6 +10306,25 @@ public class H5 implements java.io.Serializable {
// H5T_conv_t func)
// throws HDF5LibraryException, NullPointerException;
// ////////////////////////////////////////////////////////////
// //
// H5VL: VOL Interface Functions //
// //
// ////////////////////////////////////////////////////////////
/// VOL Connector Functionality
public synchronized static native long H5VLregister_connector_by_name(String connector_name, long vipl_id);
public synchronized static native long H5VLregister_connector_by_value(int connector_value, long vipl_id);
public synchronized static native boolean H5VLis_connector_registered(String name);
public synchronized static native long H5VLget_connector_id(String name);
public synchronized static native String H5VLget_connector_name(long object_id);
public synchronized static native void H5VLclose(long connector_id);
public synchronized static native void H5VLunregister_connector(long connector_id);
// /////// unimplemented ////////
// hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id);
// ////////////////////////////////////////////////////////////
// //
// H5Z: Filter Interface Functions //
@ -9995,9 +10337,9 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Zunregister(int filter) throws HDF5LibraryException, NullPointerException;
// /////// unimplemented ////////
// herr_t H5Zregister(const void *cls);
}
// /////// unimplemented ////////
// herr_t H5Zregister(const void *cls);

View File

@ -195,6 +195,11 @@ public class HDF5Constants {
public static final long H5E_WALK_UPWARD = H5E_WALK_UPWARD();
public static final long H5E_WRITEERROR = H5E_WRITEERROR();
private static final int H5ES_STATUS_IN_PROGRESS = H5ES_STATUS_IN_PROGRESS();
private static final int H5ES_STATUS_SUCCEED = H5ES_STATUS_SUCCEED();
private static final int H5ES_STATUS_FAIL = H5ES_STATUS_FAIL();
private static final int H5ES_STATUS_CANCELED = H5ES_STATUS_CANCELED();
public static final int H5F_ACC_CREAT = H5F_ACC_CREAT();
public static final int H5F_ACC_EXCL = H5F_ACC_EXCL();
public static final int H5F_ACC_RDONLY = H5F_ACC_RDONLY();
@ -315,7 +320,6 @@ public class HDF5Constants {
public static final int H5I_GROUP = H5I_GROUP();
public static final int H5I_INVALID_HID = H5I_INVALID_HID();
public static final int H5I_NTYPES = H5I_NTYPES();
public static final int H5I_REFERENCE = H5I_REFERENCE();
public static final int H5I_UNINIT = H5I_UNINIT();
public static final int H5I_VFL = H5I_VFL();
public static final int H5I_VOL = H5I_VOL();
@ -390,7 +394,10 @@ public class HDF5Constants {
public static final int H5PL_TYPE_ERROR = H5PL_TYPE_ERROR();
public static final int H5PL_TYPE_FILTER = H5PL_TYPE_FILTER();
public static final int H5PL_TYPE_VOL = H5PL_TYPE_VOL();
public static final int H5PL_TYPE_NONE = H5PL_TYPE_NONE();
public static final int H5PL_FILTER_PLUGIN = H5PL_FILTER_PLUGIN();
public static final int H5PL_VOL_PLUGIN = H5PL_VOL_PLUGIN();
public static final int H5PL_ALL_PLUGIN = H5PL_ALL_PLUGIN();
public static final int H5R_BADTYPE = H5R_BADTYPE();
@ -626,6 +633,18 @@ public class HDF5Constants {
public static final long H5T_VARIABLE = H5T_VARIABLE();
public static final int H5T_VLEN = H5T_VLEN();
public static final int H5T_VL_T = H5T_VL_T();
public static final int H5VL_CAP_FLAG_NONE = H5VL_CAP_FLAG_NONE();
public static final int H5VL_CAP_FLAG_THREADSAFE = H5VL_CAP_FLAG_THREADSAFE();
public static final long H5VL_NATIVE = H5VL_NATIVE();
public static final String H5VL_NATIVE_NAME = H5VL_NATIVE_NAME();
public static final int H5VL_NATIVE_VALUE = H5VL_NATIVE_VALUE();
public static final int H5VL_NATIVE_VERSION = H5VL_NATIVE_VERSION();
public static final int H5_VOL_INVALID = H5_VOL_INVALID();
public static final int H5_VOL_NATIVE = H5_VOL_NATIVE();
public static final int H5_VOL_RESERVED = H5_VOL_RESERVED();
public static final int H5_VOL_MAX = H5_VOL_MAX();
public static final int H5Z_CB_CONT = H5Z_CB_CONT();
public static final int H5Z_CB_ERROR = H5Z_CB_ERROR();
public static final int H5Z_CB_FAIL = H5Z_CB_FAIL();
@ -990,6 +1009,14 @@ public class HDF5Constants {
private static native final long H5E_WRITEERROR();
private static native final int H5ES_STATUS_IN_PROGRESS();
private static native final int H5ES_STATUS_SUCCEED();
private static native final int H5ES_STATUS_FAIL();
private static native final int H5ES_STATUS_CANCELED();
private static native final int H5F_ACC_CREAT();
private static native final int H5F_ACC_EXCL();
@ -1222,8 +1249,6 @@ public class HDF5Constants {
private static native final int H5I_NTYPES();
private static native final int H5I_REFERENCE();
private static native final int H5I_UNINIT();
private static native final int H5I_VFL();
@ -1364,10 +1389,16 @@ public class HDF5Constants {
private static native final int H5PL_TYPE_FILTER();
private static native final int H5PL_TYPE_VOL();
private static native final int H5PL_TYPE_NONE();
private static native final int H5PL_FILTER_PLUGIN();
private static native final int H5PL_ALL_PLUGIN();
private static native final int H5PL_VOL_PLUGIN();
private static native final int H5R_BADTYPE();
private static native final int H5R_DATASET_REGION();
@ -1834,6 +1865,26 @@ public class HDF5Constants {
private static native final int H5T_VL_T();
private static native final int H5VL_CAP_FLAG_NONE();
private static native final int H5VL_CAP_FLAG_THREADSAFE();
private static native final long H5VL_NATIVE();
private static native final String H5VL_NATIVE_NAME();
private static native final int H5VL_NATIVE_VALUE();
private static native final int H5VL_NATIVE_VERSION();
private static native final int H5_VOL_INVALID();
private static native final int H5_VOL_NATIVE();
private static native final int H5_VOL_RESERVED();
private static native final int H5_VOL_MAX();
private static native final int H5Z_CB_CONT();
private static native final int H5Z_CB_ERROR();

View File

@ -19,6 +19,7 @@ set (HDF5_JAVA_JNI_CSRCS
${HDF5_JAVA_JNI_SOURCE_DIR}/h5sImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5tImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5util.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5vlImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5zImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/nativeData.c
)
@ -40,6 +41,7 @@ set (HDF5_JAVA_JNI_CHDRS
${HDF5_JAVA_JNI_SOURCE_DIR}/h5sImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5tImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5util.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5vlImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5zImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/nativeData.h
)
@ -48,7 +50,9 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
########### JNI libraries always must be built shared ###############
add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JAVA_JNI_CHDRS})
target_include_directories(${HDF5_JAVA_JNI_LIB_TARGET} PRIVATE ${HDF5_BINARY_DIR} ${HDF5_JAVA_JNI_SOURCE_DIR})
target_include_directories(${HDF5_JAVA_JNI_LIB_TARGET}
PRIVATE "${HDF5_BINARY_DIR};${HDF5_JAVA_JNI_SOURCE_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
)
TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED)
target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIBSH_TARGET})
set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni)

View File

@ -34,7 +34,7 @@ libhdf5_java_la_LDFLAGS = -avoid-version -shared -export-dynamic -version-info $
# Source files for the library
libhdf5_java_la_SOURCES=exceptionImp.c h5Constants.c nativeData.c h5util.c h5Imp.c \
h5aImp.c h5dImp.c h5eImp.c h5fImp.c h5gImp.c h5iImp.c h5lImp.c h5oImp.c \
h5pImp.c h5plImp.c h5rImp.c h5sImp.c h5tImp.c h5zImp.c
h5pImp.c h5plImp.c h5rImp.c h5sImp.c h5tImp.c h5vlImp.c h5zImp.c
# HDF5 Java (JNI) library depends on HDF5 Library.
libhdf5_java_la_LIBADD=$(LIBHDF5)

View File

@ -21,8 +21,10 @@
extern "C" {
#endif /* __cplusplus */
#include <jni.h>
#include "hdf5.h"
#include <jni.h>
#include <stdlib.h>
#include "h5jni.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
@ -352,6 +354,15 @@ Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1UPWARD(JNIEnv *env, jclass cls) { retu
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5E_1WRITEERROR(JNIEnv *env, jclass cls) { return H5E_WRITEERROR; }
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1IN_1PROGRESS(JNIEnv *env, jclass cls) { return H5ES_STATUS_IN_PROGRESS; }
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1SUCCEED(JNIEnv *env, jclass cls) { return H5ES_STATUS_SUCCEED; }
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1FAIL(JNIEnv *env, jclass cls) { return H5ES_STATUS_FAIL; }
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1CANCELED(JNIEnv *env, jclass cls) { return H5ES_STATUS_CANCELED; }
/* Java does not have unsigned native types */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
@ -603,8 +614,6 @@ Java_hdf_hdf5lib_HDF5Constants_H5I_1DATASET(JNIEnv *env, jclass cls) { return H5
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5I_1ATTR(JNIEnv *env, jclass cls) { return H5I_ATTR; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5I_1REFERENCE(JNIEnv *env, jclass cls) { return H5I_REFERENCE; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5I_1VFL(JNIEnv *env, jclass cls) { return H5I_VFL; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5I_1VOL(JNIEnv *env, jclass cls) { return H5I_VOL; }
@ -763,8 +772,14 @@ Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1ERROR(JNIEnv *env, jclass cls) { retu
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1FILTER(JNIEnv *env, jclass cls) { return H5PL_TYPE_FILTER; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1VOL(JNIEnv *env, jclass cls) { return H5PL_TYPE_VOL; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1NONE(JNIEnv *env, jclass cls) { return H5PL_TYPE_NONE; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5PL_1FILTER_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_FILTER_PLUGIN; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5PL_1VOL_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_VOL_PLUGIN; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5PL_1ALL_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_ALL_PLUGIN; }
JNIEXPORT jint JNICALL
@ -1238,6 +1253,28 @@ Java_hdf_hdf5lib_HDF5Constants_H5T_1VLEN(JNIEnv *env, jclass cls) { return H5T_V
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5T_1VL_1T(JNIEnv *env, jclass cls) { return sizeof(hvl_t); }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5VL_1CAP_1FLAG_1NONE(JNIEnv *env, jclass cls) { return H5VL_CAP_FLAG_NONE; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5VL_1CAP_1FLAG_1THREADSAFE(JNIEnv *env, jclass cls) { return H5VL_CAP_FLAG_THREADSAFE; }
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE(JNIEnv *env, jclass cls) { return H5VL_NATIVE; }
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1NAME(JNIEnv *env, jclass cls) { return (jstring)ENVPTR->NewStringUTF(ENVPAR H5VL_NATIVE_NAME); }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1VALUE(JNIEnv *env, jclass cls) { return H5VL_NATIVE_VALUE; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1VERSION(JNIEnv *env, jclass cls) { return H5VL_NATIVE_VERSION; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1INVALID(JNIEnv *env, jclass cls) { return H5_VOL_INVALID; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1NATIVE(JNIEnv *env, jclass cls) { return H5_VOL_NATIVE; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1RESERVED(JNIEnv *env, jclass cls) { return H5_VOL_RESERVED; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1MAX(JNIEnv *env, jclass cls) { return H5_VOL_MAX; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1CONT(JNIEnv *env, jclass cls) { return H5Z_CB_CONT; }
JNIEXPORT jint JNICALL

File diff suppressed because it is too large Load Diff

View File

@ -49,15 +49,6 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Aopen_1idx
(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite
* Signature: (JJ[B)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite
(JNIEnv *, jclass, jlong, jlong, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread
@ -65,7 +56,115 @@ Java_hdf_hdf5lib_H5_H5Awrite
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aread
(JNIEnv *, jclass, jlong, jlong, jbyteArray);
(JNIEnv *, jclass, jlong, jlong, jbyteArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite
* Signature: (JJ[B)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite
(JNIEnv *, jclass, jlong, jlong, jbyteArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread_short
* Signature: (JJ[SZ)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aread_1short
(JNIEnv*, jclass, jlong, jlong, jshortArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite_short
* Signature: (JJ[SZ)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite_1short
(JNIEnv*, jclass, jlong, jlong, jshortArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread_int
* Signature: (JJ[IZ)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aread_1int
(JNIEnv*, jclass, jlong, jlong, jintArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite_int
* Signature: (JJ[IZ)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite_1int
(JNIEnv*, jclass, jlong, jlong, jintArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread_long
* Signature: (JJ[JZ)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aread_1long
(JNIEnv*, jclass, jlong, jlong, jlongArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite_long
* Signature: (JJ[JZ)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite_1long
(JNIEnv*, jclass, jlong, jlong, jlongArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread_float
* Signature: (JJ[FZ)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aread_1float
(JNIEnv*, jclass, jlong, jlong, jfloatArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite_float
* Signature: (JJ[FZ)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite_1float
(JNIEnv*, jclass, jlong, jlong, jfloatArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread_double
* Signature: (JJ[DZ)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aread_1double
(JNIEnv*, jclass, jlong, jlong, jdoubleArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite_double
* Signature: (JJ[DZ)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite_1double
(JNIEnv*, jclass, jlong, jlong, jdoubleArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5AreadVL
* Signature: (JJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5AreadVL
(JNIEnv *, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
@ -78,12 +177,48 @@ Java_hdf_hdf5lib_H5_H5AwriteVL
/*
* Class: hdf_hdf5lib_H5
* Method: H5AreadVL
* Method: H5Aread_string
* Signature: (JJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5AreadVL
(JNIEnv *, jclass, jlong, jlong, jobjectArray);
Java_hdf_hdf5lib_H5_H5Aread_1string
(JNIEnv*, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite_string
* Signature: (JJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite_1string
(JNIEnv*, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread_VLStrings
* Signature: (JJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aread_1VLStrings
(JNIEnv*, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite_VLStrings
* Signature: (JJ[B)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite_1VLStrings
(JNIEnv*, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread_reg_ref
* Signature: (JJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref
(JNIEnv*, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5

View File

@ -1572,84 +1572,6 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref */
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dread_reg_ref_data
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data
(JNIEnv *env, jclass clss,
jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
{
herr_t status = -1;
h5str_t h5str;
size_t size;
hdset_reg_ref_t *ref_data;
jint i;
jint n;
jstring jstr;
hid_t region_obj;
H5S_sel_type region_type;
hid_t region = -1;
hid_t did = (hid_t) dataset_id;
hid_t tid = (hid_t) mem_type_id;
hid_t mem_sid = (hid_t) mem_space_id;
hid_t file_sid = (hid_t) file_space_id;
n = ENVPTR->GetArrayLength(ENVPAR buf);
size = sizeof(hdset_reg_ref_t); /*H5Tget_size(tid);*/
ref_data = (hdset_reg_ref_t*)HDmalloc(size * (size_t)n);
if (ref_data == NULL) {
h5JNIFatalError(env, "H5Dread_reg_ref_data: failed to allocate buff for read");
return -1;
} /* end if */
status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, ref_data);
if (status < 0) {
HDfree(ref_data);
h5JNIFatalError(env, "H5Dread_reg_ref_data: failed to read data");
return -1;
} /* end if */
HDmemset(&h5str, 0, sizeof(h5str_t));
h5str_new(&h5str, 1024);
for (i=0; i<n; i++) {
h5str.s[0] = '\0';
/* get name of the dataset the region reference points to using H5Rget_name */
region_obj = H5Rdereference2(did, H5P_DEFAULT, H5R_DATASET_REGION, ref_data[i]);
if (region_obj >= 0) {
region = H5Rget_region(did, H5R_DATASET_REGION, ref_data[i]);
if (region >= 0) {
region_type = H5Sget_select_type(region);
if(region_type==H5S_SEL_POINTS) {
h5str_dump_region_points_data(&h5str, region, region_obj);
} /* end if */
else {
h5str_dump_region_blocks_data(&h5str, region, region_obj);
} /* end else */
H5Sclose(region);
} /* end if */
H5Dclose(region_obj);
} /* end if */
jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s);
ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
} /* end for */
h5str_free(&h5str);
HDfree(ref_data);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data */
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Dcreate2

View File

@ -250,7 +250,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1VLStrings
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dwrite_VLStrings
* Signature: (JJJJJ[BZ)I
* Signature: (JJJJJ[B)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings
@ -265,15 +265,6 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dread_reg_ref_data
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data
(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Dcreate2

View File

@ -166,6 +166,33 @@ Java_hdf_hdf5lib_H5_H5Fis_1hdf5
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Fis_1hdf5 */
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fis_accessible
* Signature: (Ljava/lang/String;J)Z
*/
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Fis_1accessible
(JNIEnv *env, jclass clss, jstring name, jlong file_id)
{
htri_t bval = JNI_FALSE;
const char *fileName;
PIN_JAVA_STRING(name, fileName);
if (fileName != NULL) {
bval = H5Fis_accessible(fileName, (hid_t)file_id);
UNPIN_JAVA_STRING(name, fileName);
if (bval > 0)
bval = JNI_TRUE;
else if (bval < 0)
h5libraryError(env);
}
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Fis_1accessible */
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_create_plist
@ -177,7 +204,7 @@ Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist
{
hid_t retVal = -1;
retVal = H5Fget_create_plist((hid_t)file_id );
retVal = H5Fget_create_plist((hid_t)file_id);
if (retVal < 0)
h5libraryError(env);

View File

@ -66,6 +66,15 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Fis_1hdf5
(JNIEnv*, jclass, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fis_accessible
* Signature: (Ljava/lang/String;J)Z
*/
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Fis_1ccessible
(JNIEnv*, jclass, jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_create_plist

206
java/src/jni/h5vlImp.c Normal file
View File

@ -0,0 +1,206 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* For details of the HDF libraries, see the HDF Documentation at:
* http://hdfgroup.org/HDF5/doc/
*
*/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "hdf5.h"
#include <jni.h>
#include <stdlib.h>
#include "h5jni.h"
#include "h5vlImp.h"
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLregister_connector_by_name
* Signature: (Ljava/lang/String;J)J
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name
(JNIEnv *env, jclass clss, jobject connector_name, jlong vipl_id)
{
hid_t status = -1;
const char *vlName;
PIN_JAVA_STRING(connector_name, vlName);
if (vlName != NULL) {
status = H5VLregister_connector_by_name(vlName, (hid_t)vipl_id);
UNPIN_JAVA_STRING(connector_name, vlName);
if (status < 0)
h5libraryError(env);
}
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name */
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLregister_connector_by_value
* Signature: (IJ)J
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value
(JNIEnv *env, jclass clss, jint connector_value, jlong vipl_id)
{
hid_t status = H5VLregister_connector_by_value((H5VL_class_value_t)connector_value, (hid_t)vipl_id);
if (status < 0)
h5libraryError(env);
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value */
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLis_connector_registered
* Signature: (Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered
(JNIEnv *env, jclass clss, jobject connector_name)
{
htri_t bval = JNI_FALSE;
const char *vlName;
PIN_JAVA_STRING(connector_name, vlName);
if (vlName != NULL) {
bval = H5VLis_connector_registered(vlName);
UNPIN_JAVA_STRING(connector_name, vlName);
if (bval > 0)
bval = JNI_TRUE;
else if (bval < 0)
h5libraryError(env);
}
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered */
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLget_connector_id
* Signature: (Ljava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5VLget_1connector_1id
(JNIEnv *env, jclass clss, jobject connector_name)
{
hid_t status = -1;
const char *vlName;
PIN_JAVA_STRING(connector_name, vlName);
if (vlName != NULL) {
status = H5VLget_connector_id(vlName);
UNPIN_JAVA_STRING(connector_name, vlName);
if (status < 0)
h5libraryError(env);
}
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1id */
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLget_connector_name
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5VLget_1connector_1name
(JNIEnv *env, jclass clss, jlong object_id)
{
char *vlName;
ssize_t buf_size;
ssize_t status;
jstring str = NULL;
/* get the length of the comment */
buf_size = H5VLget_connector_name((hid_t)object_id, NULL, 0);
if (buf_size < 0) {
H5Eprint2(H5E_DEFAULT, NULL);
h5badArgument(env, "H5VLget_connector_name: buf_size < 0");
} /* end if */
else if (buf_size > 0) {
buf_size++; /* add extra space for the null terminator */
vlName = (char *)HDmalloc(sizeof(char) * (size_t)buf_size);
if (vlName == NULL) {
/* exception -- out of memory */
h5outOfMemory(env, "H5VLget_connector_name: malloc failed");
} /* end if */
else {
status = H5VLget_connector_name((hid_t)object_id, vlName, (size_t)buf_size);
if (status < 0) {
h5libraryError(env);
} /* end if */
else {
/* may throw OutOfMemoryError */
str = ENVPTR->NewStringUTF(ENVPAR vlName);
if (str == NULL) {
h5JNIFatalError(env, "H5VLget_connector_name: return string not allocated");
} /* end if */
} /* end else */
HDfree(vlName);
}
} /* end else if */
return (jstring)str;
} /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1name */
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLclose
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5VLclose
(JNIEnv *env, jclass clss, jlong connector_id)
{
herr_t retValue = H5VLclose((hid_t)connector_id);
if (retValue < 0)
h5libraryError(env);
} /* end Java_hdf_hdf5lib_H5_H5VLclose */
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLunregister_connector
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5VLunregister_1connector
(JNIEnv *env, jclass clss, jlong connector_id)
{
herr_t retValue = H5VLunregister_connector((hid_t)connector_id);
if (retValue < 0)
h5libraryError(env);
} /* end Java_hdf_hdf5lib_H5_H5VLunregister_1connector */
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */

91
java/src/jni/h5vlImp.h Normal file
View File

@ -0,0 +1,91 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <jni.h>
/* Header for class hdf_hdf5lib_H5_H5VL */
#ifndef _Included_hdf_hdf5lib_H5_H5VL
#define _Included_hdf_hdf5lib_H5_H5VL
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLregister_connector_by_name
* Signature: (Ljava/lang/String;J)J
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name
(JNIEnv *, jclass, jobject, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLregister_connector_by_value
* Signature: (IJ)J
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value
(JNIEnv *, jclass, jint, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLis_connector_registered
* Signature: (Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5VLis_connector_registered
(JNIEnv *, jclass, jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLget_connector_id
* Signature: (Ljava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5VLget_1connector_1id
(JNIEnv *, jclass, jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLget_connector_name
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5VLget_1connector_1name
(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLclose
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5VLclose
(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLunregister_connector
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5VLunregister_1connector
(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
#endif /* _Included_hdf_hdf5lib_H5_H5VL */

View File

@ -38,6 +38,7 @@ set (HDF5_JAVA_TEST_SOURCES
TestH5Ocreate
TestH5Ocopy
TestH5PL
TestH5VL
TestH5Z
)

View File

@ -69,6 +69,7 @@ noinst_JAVA = \
TestH5Ocreate.java \
TestH5Ocopy.java \
TestH5PL.java \
TestH5VL.java \
TestH5Z.java \
TestH5E.java \
TestH5Edefault.java \

View File

@ -81,6 +81,19 @@ public class TestH5Fbasic {
assertTrue(isH5 == true);
}
@Test
public void testH5Fis_accessible() {
boolean isH5 = false;
try {
isH5 = H5.H5Fis_accessible(H5_FILE, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fis_accessible failed on " + H5_FILE + ": " + err);
}
assertTrue(isH5 == true);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Fcreate_EXCL() throws Throwable {
H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_EXCL,

View File

@ -59,6 +59,11 @@ public class TestH5Fparams {
H5.H5Fis_hdf5(null);
}
@Test(expected = NullPointerException.class)
public void testH5Fis_accessible_null() throws Throwable {
H5.H5Fis_accessible(null, -1);
}
@Test(expected = NullPointerException.class)
public void testH5Fmount_null() throws Throwable {
H5.H5Fmount(-1, null, -1, HDF5Constants.H5P_DEFAULT);

117
java/test/TestH5VL.java Normal file
View File

@ -0,0 +1,117 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
package test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import java.io.File;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5VL {
@Rule public TestName testname = new TestName();
private final void _deleteFile(String filename) {
File file = new File(filename);
if (file.exists()) {
try {file.delete();} catch (SecurityException e) {}
}
}
@Before
public void checkOpenIDs() {
assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
System.out.print(testname.getMethodName());
}
@After
public void nextTestName() {
System.out.println();
}
@Test
public void testH5VLnative_init() {
try {
boolean is_registered;
is_registered = H5.H5VLis_connector_registered(HDF5Constants.H5VL_NATIVE_NAME);
assertTrue("H5.H5VLis_connector_registered H5VL_NATIVE_NAME", is_registered);
is_registered = H5.H5VLis_connector_registered("FAKE_VOL_NAME");
assertFalse("H5.H5VLis_connector_registered FAKE_VOL_NAME", is_registered);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5VLis_connector_registered " + err);
}
}
@Test
public void testH5VLget_connector_id() {
try {
long native_id = H5.H5VLget_connector_id(HDF5Constants.H5VL_NATIVE_NAME);
assertTrue("H5.H5VLget_connector_id H5VL_NATIVE_NAME", native_id >= 0);
assertEquals(HDF5Constants.H5VL_NATIVE, native_id);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5VLget_connector_id " + err);
}
}
@Test
public void testH5VLget_connector_name() {
String H5_FILE = "testFvl.h5";
long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
try {
String native_name = H5.H5VLget_connector_name(H5fid);
assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME)==0);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5VLget_connector_name " + err);
}
finally {
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
}
_deleteFile(H5_FILE);
}
}
@Test(expected = HDF5LibraryException.class)
public void testH5VLclose_NegativeID() throws Throwable {
H5.H5VLclose(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5VLunregister_connector_NegativeID() throws Throwable {
H5.H5VLunregister_connector(-1);
}
}

View File

@ -101,6 +101,7 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5Obasic.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Ocreate.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Ocopy.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5PL.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5VL.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Z.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5E.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Edefault.txt
@ -989,6 +990,27 @@ else
test yes = "$verbose" && $DIFF JUnit-TestH5PL.txt JUnit-TestH5PL.out |sed 's/^/ /'
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5VL"
TESTING JUnit-TestH5VL
($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5VL > JUnit-TestH5VL.ext)
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
-e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5VL.ext > JUnit-TestH5VL.out
if diff JUnit-TestH5VL.out JUnit-TestH5VL.txt > /dev/null; then
echo " PASSED JUnit-TestH5VL"
else
echo "**FAILED** JUnit-TestH5VL"
echo " Expected result differs from actual result"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF JUnit-TestH5VL.txt JUnit-TestH5VL.out |sed 's/^/ /'
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Z"
TESTING JUnit-TestH5Z
($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Z > JUnit-TestH5Z.ext)

View File

@ -38,17 +38,20 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
minor: Unable to open file
#001: (file name) line (number) in H5VL_file_open(): open failed
major: Virtual Object Layer
minor: Unable to initialize object
#002: (file name) line (number) in H5VL_native_file_open(): unable to open file
minor: Can't open object
#002: (file name) line (number) in H5VL__file_open(): open failed
major: Virtual Object Layer
minor: Can't open object
#003: (file name) line (number) in H5VL__native_file_open(): unable to open file
major: File accessibility
minor: Unable to open file
#003: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1
#004: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1
major: File accessibility
minor: Unable to open file
#004: (file name) line (number) in H5FD_open(): open failed
#005: (file name) line (number) in H5FD_open(): open failed
major: Virtual File Layer
minor: Unable to initialize object
#005: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2
#006: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2
major: File accessibility
minor: Unable to open file
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
@ -57,16 +60,19 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
minor: Unable to open file
#001: (file name) line (number) in H5VL_file_open(): open failed
major: Virtual Object Layer
minor: Unable to initialize object
#002: (file name) line (number) in H5VL_native_file_open(): unable to open file
minor: Can't open object
#002: (file name) line (number) in H5VL__file_open(): open failed
major: Virtual Object Layer
minor: Can't open object
#003: (file name) line (number) in H5VL__native_file_open(): unable to open file
major: File accessibility
minor: Unable to open file
#003: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1
#004: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1
major: File accessibility
minor: Unable to open file
#004: (file name) line (number) in H5FD_open(): open failed
#005: (file name) line (number) in H5FD_open(): open failed
major: Virtual File Layer
minor: Unable to initialize object
#005: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2
#006: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2
major: File accessibility
minor: Unable to open file

View File

@ -9,6 +9,7 @@ JUnit version 4.11
.testH5Freopen_closed
.testH5Freset_mdc_hit_rate_stats
.testH5Fget_name
.testH5Fis_accessible
.testH5Fcreate
.testH5Fclear_elink_file_cache
.testH5Fclose_twice
@ -17,5 +18,5 @@ JUnit version 4.11
Time: XXXX
OK (15 tests)
OK (16 tests)

View File

@ -1,4 +1,5 @@
JUnit version 4.11
.testH5Fis_accessible_null
.testH5Fcreate_null
.testH5Fflush_local
.testH5Fget_info
@ -13,5 +14,5 @@ JUnit version 4.11
Time: XXXX
OK (11 tests)
OK (12 tests)

View File

@ -0,0 +1,11 @@
JUnit version 4.11
.testH5VLget_connector_id
.testH5VLnative_init
.testH5VLget_connector_name
.testH5VLclose_NegativeID
.testH5VLunregister_connector_NegativeID
Time: XXXX
OK (5 tests)

View File

@ -651,6 +651,7 @@ HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries"
HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF
HDF_TEST_EXPRESS "Control testing framework (0-3)" "0"
HDF5_TEST_VFD "Execute tests with different VFDs" OFF
HDF5_TEST_VOL "Execute tests with different VOL connectors" OFF
HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF
HDF5_USE_18_API_DEFAULT "Use the HDF5 1.8.x API by default" OFF
HDF5_USE_110_API_DEFAULT "Use the HDF5 1.10.x API by default" OFF

View File

@ -48,6 +48,15 @@ New Features
Configuration:
-------------
- Keep stderr and stdout separate in tests
Changed test handling of output capture. Tests now keep the stderr
output separate from the stdout output. It is up to the test to decide
which output to check against a reference. Also added the option
to grep for a string in either output.
(ADB - 2018/12/12, HDFFV-10632)
- Add toolchain and cross-compile support
Added info on using a toolchain file to INSTALL_CMAKE.txt. A
@ -111,37 +120,6 @@ New Features
(ADB - 2018/07/16)
- Incorrectly installed private header files were removed from
CMake installs.
The CMake build files incorrectly flagged the following header files
as public and installed them. They are private and will no longer be
installed.
HDF5 library private package files (H5Xpkg.h)
H5Edefin.h
H5Einit.h
H5Eterm.h
H5LTparse.h
h5diff.h
h5tools_dump.h
h5tools.h
h5tools_ref.h
h5tools_str.h
h5tools_utils.h
h5trav.h
(DER - 2018/10/26, HDFFV-10614, 10609)
- Autotools installs now install H5FDwindows.h
This is simply to align the installed header files between the
autotools and CMake. H5FDwindows.h has no functionality on
non-Windows systems.
(DER - 2018/10/26, HDFFV-10614)
Library:
--------
- Allow pre-generated H5Tinit.c and H5make_libsettings.c to be used.
@ -151,23 +129,11 @@ New Features
(ADB - 2018/09/18, HDFFV-10332)
- Remove H5I_REFERENCE from the library
- Several empty public header files where removed from the distribution
This ID class was never used by the library and has been removed.
The following files were empty placeholders. They are for internal
packages that are unlikely to ever have public functionality and have
thus been removed.
H5Bpublic.h
H5B2public.h
H5FSpublic.h
H5HFpublic.h
H5HGpublic.h
H5HLpublic.h
They were only installed in CMake builds.
(DER - 2018/10/26, HDFFV-10614)
(DER - 2018/12/08, HDFFV-10252)
Parallel Library:
@ -230,6 +196,23 @@ New Features
Java Library:
----------------
- Duplicate the data read/write functions of Datasets for Attributes.
Region references could not be displayed for attributes as they could
for datasets. Datasets had overloaded read and write functions for different
datatypes that were not available for attributes. After adding similar
functions, attribute region references work normally.
(ADB - 2018/12/12, HDFVIEW-4)
- Removed H5I_REFERENCE from the Java wrappers
This ID class was never used by the library and has been removed
from the Java wrappers.
(DER - 2018/12/08, HDFFV-10252)
Tools:
------
@ -331,7 +314,11 @@ Bug Fixes since HDF5-1.10.3 release
Fortran
--------
-
- Made Fortran specific subroutines PRIVATE in generic procedures.
Effected generic procedures were functions in H5A, H5D, H5P, H5R and H5T.
(MSB, 2018/12/04, HDFFV-10511)
Tools
-----
@ -517,19 +504,6 @@ Bug Fixes since HDF5-1.10.2 release
(LRK - 2018/07/18, HDFFV-10475)
- The --enable-debug/production configure flags are listed as 'deprecated'
when they should really be listed as 'removed'.
In the autotools overhaul several years ago, we removed these flags and
implemented a new --enable-build-mode= flag. This was done because we
changed the semantics of the modes and didn't want users to silently
be exposed to them. The newer system is also more flexible and us to
add other modes (like 'clean').
The --enable-debug/production flags are now listed as removed.
(DER - 2018/05/31, HDFFV-10505)
- Moved the location of gcc attribute.
The gcc attribute(no_sanitize), named as the macro HDF_NO_UBSAN,

View File

@ -625,11 +625,21 @@ IDE_GENERATED_PROPERTIES ("H5UC" "${H5UC_HDRS}" "${H5UC_SOURCES}" )
set (H5VL_SOURCES
${HDF5_SRC_DIR}/H5VL.c
${HDF5_SRC_DIR}/H5VLcallback.c
${HDF5_SRC_DIR}/H5VLint.c
${HDF5_SRC_DIR}/H5VLnative.c
${HDF5_SRC_DIR}/H5VLnative_attr.c
${HDF5_SRC_DIR}/H5VLnative_dataset.c
${HDF5_SRC_DIR}/H5VLnative_datatype.c
${HDF5_SRC_DIR}/H5VLnative_file.c
${HDF5_SRC_DIR}/H5VLnative_group.c
${HDF5_SRC_DIR}/H5VLnative_link.c
${HDF5_SRC_DIR}/H5VLnative_object.c
${HDF5_SRC_DIR}/H5VLpassthru.c
)
set (H5VL_HDRS
${HDF5_SRC_DIR}/H5VLnative.h
${HDF5_SRC_DIR}/H5VLpassthru.h
${HDF5_SRC_DIR}/H5VLpublic.h
)
IDE_GENERATED_PROPERTIES ("H5VL" "${H5VL_HDRS}" "${H5VL_SOURCES}" )
@ -866,8 +876,8 @@ set (H5_PRIVATE_HEADERS
${HDF5_SRC_DIR}/H5UCprivate.h
${HDF5_SRC_DIR}/H5VLpkg.h
${HDF5_SRC_DIR}/H5VLnative_private.h
${HDF5_SRC_DIR}/H5VLpkg.h
${HDF5_SRC_DIR}/H5VLprivate.h
${HDF5_SRC_DIR}/H5VMprivate.h
@ -948,10 +958,13 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c)
)
add_custom_command (
OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
COMMAND ${HDF5_BATCH_CMD}
ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT}
COMMAND ${CMAKE_COMMAND}
ARGS -E echo "Executed batch command to create H5Tinit.c"
COMMAND ${CMAKE_COMMAND}
ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
DEPENDS H5detect
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
)
@ -961,31 +974,62 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c)
if (BUILD_SHARED_LIBS)
add_custom_command (
OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c
${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
COMMAND ${CMAKE_COMMAND}
ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit_created
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
)
set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
endif ()
else ()
add_custom_command (
OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5detect>
ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
COMMAND ${CMAKE_COMMAND}
ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
DEPENDS H5detect
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
)
if (BUILD_SHARED_LIBS)
add_custom_command (
OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c
${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
COMMAND ${CMAKE_COMMAND}
ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
)
set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
endif ()
endif ()
set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE)
else ()
add_custom_command (
OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
)
if (BUILD_SHARED_LIBS)
add_custom_command (
OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
COMMAND ${CMAKE_COMMAND}
ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
)
set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
endif ()
endif ()
add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c)
@ -999,8 +1043,11 @@ target_link_libraries (H5make_libsettings
add_custom_command (
OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c
${HDF5_BINARY_DIR}/gen_SRCS.stamp2
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5make_libsettings>
ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c
COMMAND ${CMAKE_COMMAND}
ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2
DEPENDS H5make_libsettings
WORKING_DIRECTORY ${HDF5_BINARY_DIR}
)
@ -1008,9 +1055,13 @@ set_source_files_properties (${HDF5_BINARY_DIR}/H5lib_settings.c PROPERTIES GENE
if (BUILD_SHARED_LIBS)
add_custom_command (
OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c
${HDF5_BINARY_DIR}/shared/shared_gen_SRCS.stamp2
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different "${HDF5_BINARY_DIR}/H5lib_settings.c" "${HDF5_BINARY_DIR}/shared/H5lib_settings.c"
COMMAND ${CMAKE_COMMAND}
ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2
DEPENDS ${HDF5_BINARY_DIR}/H5lib_settings.c
WORKING_DIRECTORY ${HDF5_BINARY_DIR}
)
set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE)
endif ()
@ -1023,8 +1074,8 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF)
# Add H5Tinit source to build - generated by H5detect/CMake at configure time
#-----------------------------------------------------------------------------
set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c)
add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2)
add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${gen_SRCS})
add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS})
target_include_directories(${HDF5_LIB_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
@ -1053,8 +1104,8 @@ set (install_targets ${HDF5_LIB_TARGET})
if (BUILD_SHARED_LIBS)
set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c)
add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2)
add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${shared_gen_SRCS})
add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS})
target_include_directories(${HDF5_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"

122
src/H5A.c
View File

@ -296,18 +296,17 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the attribute */
if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, attr_name,
acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@ -349,7 +348,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id,
hid_t lapl_id)
{
void *attr = NULL; /* attr token from VOL plugin */
void *attr = NULL; /* attr token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5P_genplist_t *plist; /* Property list pointer */
H5VL_loc_params_t loc_params;
@ -402,18 +401,17 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the attribute */
if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, attr_name,
acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
if(attr && H5VL_attr_close (attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@ -442,7 +440,7 @@ done:
hid_t
H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id)
{
void *attr = NULL; /* attr token from VOL driver */
void *attr = NULL; /* attr token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID;
@ -471,18 +469,17 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls,
attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name)
/* Register the attribute and get an ID for it */
if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@ -514,7 +511,7 @@ hid_t
H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
hid_t aapl_id, hid_t lapl_id)
{
void *attr = NULL; /* attr token from VOL driver */
void *attr = NULL; /* attr token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID;
@ -554,18 +551,17 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls,
attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute")
/* Register the attribute and get an ID for it */
if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
if(attr && H5VL_attr_close (attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@ -646,18 +642,17 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls,
NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@ -702,8 +697,7 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
/* Write the attribute data */
if((ret_value = H5VL_attr_write(vol_obj->data, vol_obj->driver->cls,
dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
if((ret_value = H5VL_attr_write(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute")
done:
@ -745,8 +739,7 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL")
/* Read the attribute data */
if((ret_value = H5VL_attr_read(vol_obj->data, vol_obj->driver->cls,
dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
if((ret_value = H5VL_attr_read(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute")
done:
@ -784,8 +777,7 @@ H5Aget_space(hid_t attr_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
/* Get the dataspace */
if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_SPACE,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute")
done:
@ -812,7 +804,7 @@ done:
hid_t
H5Aget_type(hid_t attr_id)
{
H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@ -823,8 +815,7 @@ H5Aget_type(hid_t attr_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
/* Get the datatype */
if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_TYPE,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute")
done:
@ -867,8 +858,7 @@ H5Aget_create_plist(hid_t attr_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
/* Get the acpl */
if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_ACPL,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_ACPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get creation property list for attribute")
done:
@ -918,9 +908,7 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf)
loc_params.obj_type = H5I_get_type(attr_id);
/* Get the attribute name */
if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_NAME,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
loc_params, buf_size, buf, &ret_value) < 0)
if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, buf_size, buf, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name")
done:
@ -985,8 +973,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the name */
if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_NAME,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, size, name, &ret_value) < 0)
if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, size, name, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get name")
done:
@ -1025,8 +1012,7 @@ H5Aget_storage_size(hid_t attr_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute")
/* Get the storage size */
if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_STORAGE_SIZE,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, 0, "unable to get acpl")
done:
@ -1060,13 +1046,14 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo)
/* Check arguments */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
if(!ainfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "attribute_info parameter cannot be NULL")
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(attr_id);
/* Get the attribute information */
if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0)
if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@ -1122,8 +1109,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the attribute information */
if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo, attr_name) < 0)
if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo, attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@ -1186,8 +1172,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the attribute information */
if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0)
if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@ -1238,10 +1223,9 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
/* Rename the attribute */
if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_RENAME,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name)) < 0)
if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
}
} /* end if */
done:
FUNC_LEAVE_API(ret_value)
@ -1299,10 +1283,9 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Rename the attribute */
if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_RENAME,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name)) < 0)
if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
}
} /* end if */
done:
FUNC_LEAVE_API(ret_value)
@ -1377,9 +1360,7 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Iterate over attributes */
if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_ITER,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
idx_type, order, idx, op, op_data)) < 0)
if((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, idx, op, op_data)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
done:
@ -1467,9 +1448,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Iterate over attributes */
if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_ITER,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
idx_type, order, idx, op, op_data)) < 0)
if((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, idx, op, op_data)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed");
done:
@ -1522,8 +1501,7 @@ H5Adelete(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Delete the attribute */
if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name)) < 0)
if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@ -1581,8 +1559,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Delete the attribute */
if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name)) < 0)
if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@ -1652,8 +1629,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Delete the attribute through the VOL */
if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL)) < 0)
if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@ -1731,8 +1707,7 @@ H5Aexists(hid_t obj_id, const char *attr_name)
loc_params.obj_type = H5I_get_type(obj_id);
/* Check if the attribute exists */
if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_EXISTS,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:
@ -1786,8 +1761,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
loc_params.obj_type = H5I_get_type(loc_id);
/* Check existence of attribute */
if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_EXISTS,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:

View File

@ -45,6 +45,8 @@
#include "H5Opkg.h" /* Object headers */
#include "H5VLprivate.h" /* Virtual object layer */
#include "H5VLnative_private.h" /* Native VOL connector */
/****************/
/* Local Macros */
@ -114,8 +116,8 @@ hid_t
H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t acpl_id)
{
void *attr = NULL; /* attr token from VOL plugin */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
void *attr = NULL; /* attr token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@ -156,18 +158,17 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the attribute */
if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, name,
acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
done:
/* Clean up on failure */
if(H5I_INVALID_HID == ret_value)
if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@ -199,8 +200,8 @@ done:
hid_t
H5Aopen_name(hid_t loc_id, const char *name)
{
void *attr = NULL; /* attr token from VOL plugin */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
void *attr = NULL; /* attr token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@ -218,22 +219,21 @@ H5Aopen_name(hid_t loc_id, const char *name)
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
if (NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls,
name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Clean up on failure */
if(H5I_INVALID_HID == ret_value)
if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@ -265,8 +265,8 @@ done:
hid_t
H5Aopen_idx(hid_t loc_id, unsigned idx)
{
void *attr = NULL; /* attr token from VOL plugin */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
void *attr = NULL; /* attr token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@ -291,18 +291,17 @@ H5Aopen_idx(hid_t loc_id, unsigned idx)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls,
NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Clean up on failure */
if(H5I_INVALID_HID == ret_value)
if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@ -330,7 +329,7 @@ done:
int
H5Aget_num_attrs(hid_t loc_id)
{
H5VL_object_t *vol_obj;
H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
H5O_info_t oinfo;
int ret_value = -1;
@ -341,13 +340,12 @@ H5Aget_num_attrs(hid_t loc_id)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
/* get the location object */
/* Get the location object */
if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Get the number of attributes for the object */
if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, &oinfo, H5O_INFO_ALL) < 0)
if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, &oinfo, H5O_INFO_ALL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object")
H5_CHECKED_ASSIGN(ret_value, int, oinfo.num_attrs, hsize_t);
@ -397,18 +395,23 @@ done:
herr_t
H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data)
{
herr_t ret_value; /* Return value */
H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
FUNC_ENTER_API(H5_ITER_ERROR)
H5TRACE4("e", "i*Iux*x", loc_id, attr_num, op, op_data);
/* check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "location is not valid for an attribute")
/* Get the location object */
if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier")
/* Call attribute iteration routine */
if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
if((ret_value = H5VL_attr_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_ATTR_ITERATE_OLD, loc_id, attr_num, op, op_data)) < 0)
HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes");
done:
FUNC_LEAVE_API(ret_value)

View File

@ -43,7 +43,6 @@
#include "H5Opkg.h" /* Object headers */
#include "H5SMprivate.h" /* Shared Object Header Messages */
#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5VLnative_private.h" /* Native VOL driver */
/****************/
@ -924,7 +923,7 @@ H5A__get_type(H5A_t *attr)
* two level IDs, where the VOL object is a copy of the
* returned datatype
*/
if ((ret_value = H5VL_native_register(H5I_DATATYPE, dt, TRUE)) < 0)
if ((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
}
else {
@ -1156,7 +1155,7 @@ H5A__close_cb(H5VL_object_t *attr_vol_obj)
HDassert(attr_vol_obj);
/* Close the attribute */
if((ret_value = H5VL_attr_close(attr_vol_obj->data, attr_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
if((ret_value = H5VL_attr_close(attr_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute")
/* Free the VOL object */
@ -2621,7 +2620,7 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5
H5G_name_t obj_path; /* Opened object group hier. path */
H5O_loc_t obj_oloc; /* Opened object object location */
hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
hid_t obj_loc_id = (-1); /* ID for object located */
hid_t obj_loc_id = H5I_INVALID_HID; /* ID for object located */
H5A_attr_iter_op_t attr_op; /* Attribute operator */
void *temp_obj = NULL;
H5I_type_t obj_type;
@ -2648,7 +2647,7 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object");
/* Get an ID for the object */
if((obj_loc_id = H5VL_native_register(obj_type, temp_obj, TRUE)) < 0)
if((obj_loc_id = H5VL_wrap_register(obj_type, temp_obj, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype");
/* Call internal attribute iteration routine */
@ -2660,7 +2659,7 @@ done:
if(obj_loc_id != H5I_INVALID_HID) {
if(H5I_dec_app_ref(obj_loc_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object");
}
} /* end if */
else if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location");
@ -2689,7 +2688,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op,
hsize_t idx; /* Index of attribute to start iterating at */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
FUNC_ENTER_PACKAGE_NOERR
/* Build attribute operator info */
attr_op.op_type = H5A_ATTR_OP_APP;
@ -2700,13 +2699,12 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op,
/* Call internal attribute iteration routine */
if((ret_value = H5A__iterate_common(loc_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, &idx, &attr_op, op_data)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes")
HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
/* Translate hsize_t index value to legacy unsigned index value*/
if(attr_num)
*attr_num = (unsigned)idx;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__iterate_old() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */

View File

@ -22,10 +22,6 @@
#include "H5Opublic.h" /* Object Headers */
#include "H5Tpublic.h" /* Datatypes */
#ifdef __cplusplus
extern "C" {
#endif
/* Information struct for attribute (for H5Aget_info/H5Aget_info_by_idx) */
typedef struct {
hbool_t corder_valid; /* Indicate if creation order is valid */
@ -38,7 +34,19 @@ typedef struct {
typedef herr_t (*H5A_operator2_t)(hid_t location_id/*in*/,
const char *attr_name/*in*/, const H5A_info_t *ainfo/*in*/, void *op_data/*in,out*/);
/* Public function prototypes */
/********************/
/* Public Variables */
/********************/
/*********************/
/* Public Prototypes */
/*********************/
#ifdef __cplusplus
extern "C" {
#endif
H5_DLL hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id,
hid_t space_id, hid_t acpl_id, hid_t aapl_id);
H5_DLL hid_t H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,

View File

@ -125,7 +125,6 @@
(*head)->ctx.H5_GLUE(PROP_FIELD,_set) = TRUE; \
} /* end if */ \
}
#endif /* H5_HAVE_PARALLEL */
/* Macro for the duplicated code to test and set properties for a property list */
#define H5CX_SET_PROP(PROP_NAME, PROP_FIELD) \
@ -140,6 +139,7 @@
if(H5P_set((*head)->ctx.dxpl, PROP_NAME, &(*head)->ctx.PROP_FIELD) < 0) \
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, NULL, "error setting filter mask xfer property") \
} /* end if */
#endif /* H5_HAVE_PARALLEL */
/******************/
@ -267,6 +267,10 @@ typedef struct H5CX_t {
/* Cached LAPL properties */
size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */
/* Cached VOL properties */
void *vol_wrap_ctx; /* VOL plugin's "wrap context" for creating IDs */
hbool_t vol_wrap_ctx_valid; /* Whether VOL plugin's "wrap context" for creating IDs is valid */
} H5CX_t;
/* Typedef for nodes on the API context stack */
@ -916,6 +920,40 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_set_loc() */
/*-------------------------------------------------------------------------
* Function: H5CX_set_vol_wrap_ctx
*
* Purpose: Sets the VOL object wrapping context for an operation.
*
* Return: Non-negative on success / Negative on failure
*
* Programmer: Quincey Koziol
* October 14, 2018
*
*-------------------------------------------------------------------------
*/
herr_t
H5CX_set_vol_wrap_ctx(void *vol_wrap_ctx)
{
H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(head && *head);
/* Set the API context value */
(*head)->ctx.vol_wrap_ctx = vol_wrap_ctx;
/* Mark the value as valid */
(*head)->ctx.vol_wrap_ctx_valid = TRUE;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_set_vol_wrap_ctx() */
/*-------------------------------------------------------------------------
* Function: H5CX_get_dxpl
@ -968,6 +1006,42 @@ H5CX_get_lapl(void)
FUNC_LEAVE_NOAPI((*head)->ctx.lapl_id)
} /* end H5CX_get_lapl() */
/*-------------------------------------------------------------------------
* Function: H5CX_get_vol_wrap_ctx
*
* Purpose: Retrieves the VOL object wrapping context for an operation.
*
* Return: Non-negative on success / Negative on failure
*
* Programmer: Quincey Koziol
* October 14, 2018
*
*-------------------------------------------------------------------------
*/
herr_t
H5CX_get_vol_wrap_ctx(void **vol_wrap_ctx)
{
H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_wrap_ctx);
HDassert(head && *head);
/* Check for value that was set */
if((*head)->ctx.vol_wrap_ctx_valid)
/* Get the value */
*vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx;
else
*vol_wrap_ctx = NULL;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_vol_wrap_ctx() */
/*-------------------------------------------------------------------------
* Function: H5CX_get_tag
@ -2501,7 +2575,9 @@ H5CX__pop_common(void)
ret_value = (*head);
(*head) = (*head)->next;
#ifdef H5_HAVE_PARALLEL
done:
#endif /* H5_HAVE_PARALLEL */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX__pop_common() */

View File

@ -63,10 +63,12 @@ H5_DLL void H5CX_set_lapl(hid_t lapl_id);
H5_DLL herr_t H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
hid_t loc_id, hbool_t is_collective);
H5_DLL herr_t H5CX_set_loc(hid_t loc_id);
H5_DLL herr_t H5CX_set_vol_wrap_ctx(void *wrap_ctx);
/* "Getter" routines for API context info */
H5_DLL hid_t H5CX_get_dxpl(void);
H5_DLL hid_t H5CX_get_lapl(void);
H5_DLL herr_t H5CX_get_vol_wrap_ctx(void **wrap_ctx);
H5_DLL haddr_t H5CX_get_tag(void);
H5_DLL H5AC_ring_t H5CX_get_ring(void);
#ifdef H5_HAVE_PARALLEL

View File

@ -472,11 +472,11 @@ H5C_get_mdc_image_info(H5C_t * cache_ptr, haddr_t *image_addr, hsize_t *image_le
if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry")
if(image_addr == NULL || image_len == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad image_addr or image_len on entry")
*image_addr = cache_ptr->image_addr;
*image_len = cache_ptr->image_len;
if(image_addr)
*image_addr = cache_ptr->image_addr;
if(image_len)
*image_len = cache_ptr->image_len;
done:
FUNC_LEAVE_NOAPI(ret_value)

View File

@ -29,6 +29,8 @@
#include "H5Iprivate.h" /* IDs */
#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5VLnative_private.h" /* Native VOL connector */
/****************/
/* Local Macros */
@ -158,17 +160,16 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the dataset */
if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls,
name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */
if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle")
if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle")
done:
if(H5I_INVALID_HID == ret_value)
if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
@ -211,7 +212,7 @@ hid_t
H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
hid_t dapl_id)
{
void *dset = NULL; /* dset token from VOL plugin */
void *dset = NULL; /* dset token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
@ -250,19 +251,17 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the dataset */
if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls,
NULL, dcpl_id, dapl_id,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, NULL, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */
if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
if(dset && H5VL_dataset_close (dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
@ -287,7 +286,7 @@ done:
hid_t
H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id)
{
void *dset = NULL; /* dset token from VOL plugin */
void *dset = NULL; /* dset token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@ -314,18 +313,18 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id)
loc_params.obj_type = H5I_get_type(loc_id);
/* Open the dataset */
if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->driver->cls, name,
dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (dset = H5VL_dataset_open(vol_obj, &loc_params, name, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset")
/* Register an atom for the dataset */
if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
done:
if(H5I_INVALID_HID == ret_value)
if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dopen2() */
@ -391,8 +390,7 @@ H5Dget_space(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
/* Get the dataspace */
if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace")
done:
@ -423,8 +421,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
/* Get dataspace status */
if((ret_value = H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE_STATUS,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, allocation)) < 0)
if((ret_value = H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE_STATUS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, allocation)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status")
done:
@ -459,8 +456,7 @@ H5Dget_type(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
/* get the datatype */
if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_TYPE,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
done:
@ -498,8 +494,7 @@ H5Dget_create_plist(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
/* Get the dataset creation property list */
if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_DCPL,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties")
done:
@ -554,8 +549,7 @@ H5Dget_access_plist(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
/* Get the dataset access property list */
if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_DAPL,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties")
done:
@ -592,8 +586,7 @@ H5Dget_storage_size(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier")
/* Get the storage size */
if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_STORAGE_SIZE,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size")
done:
@ -626,8 +619,7 @@ H5Dget_offset(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier")
/* Get the offset */
if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_OFFSET,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset")
done:
@ -840,8 +832,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
vlen_bufsize.mspace_id = H5I_INVALID_HID;
/* Get a copy of the dataset's dataspace */
if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0)
if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace")
/* Create a scalar for the memory dataspace */
@ -922,8 +913,7 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[])
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Set the extent */
if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_SET_EXTENT,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0)
if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent")
done:
@ -961,8 +951,7 @@ H5Dflush(hid_t dset_id)
* XXX: Note that we need to pass the ID to the VOL since the H5F_flush_cb_t
* callback needs it and that's in the public API.
*/
if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_FLUSH,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0)
if((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset")
done:
@ -997,8 +986,7 @@ H5Drefresh(hid_t dset_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Refresh the dataset object */
if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_REFRESH,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0)
if((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset")
done:
@ -1041,8 +1029,7 @@ H5Dformat_convert(hid_t dset_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Convert the dataset */
if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_DATASET_FORMAT_CONVERT) < 0)
if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_FORMAT_CONVERT) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format")
done:
@ -1078,8 +1065,7 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL")
/* Get the chunk indexing type */
if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0)
if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type")
done:
@ -1120,8 +1106,7 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL")
/* Get the dataset creation property list */
if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0)
if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk")
done:

View File

@ -40,7 +40,7 @@
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5VLprivate.h" /* VOL plugins */
#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@ -113,7 +113,7 @@ hid_t
H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t dcpl_id)
{
void *dset = NULL; /* dset token from VOL plugin */
void *dset = NULL; /* dset token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
@ -161,17 +161,16 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the dataset through the VOL */
if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, dcpl_id,
H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */
if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
if (H5I_INVALID_HID == ret_value)
if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
@ -198,7 +197,7 @@ done:
hid_t
H5Dopen1(hid_t loc_id, const char *name)
{
void *dset = NULL; /* dset token from VOL plugin */
void *dset = NULL; /* dset token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@ -221,17 +220,16 @@ H5Dopen1(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the dataset */
if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->driver->cls, name,
H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (dset = H5VL_dataset_open(vol_obj, &loc_params, name, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset")
/* Get an atom for the dataset */
if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
done:
if(H5I_INVALID_HID == ret_value)
if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
@ -275,8 +273,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
/* Get the dataspace pointer for the dataset */
if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) < 0)
if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataspace")
if(H5I_INVALID_HID == sid)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "received an invalid dataspace from the dataset")
@ -306,8 +303,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[])
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Increase size */
if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_SET_EXTENT,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0)
if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to extend dataset")
done:

View File

@ -21,17 +21,16 @@
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5FOprivate.h" /* File objects */
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5VLnative_private.h" /* Native VOL driver */
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5FOprivate.h" /* File objects */
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@ -301,7 +300,7 @@ H5D__close_cb(H5VL_object_t *dset_vol_obj)
HDassert(dset_vol_obj);
/* Close the dataset */
if(H5VL_dataset_close(dset_vol_obj->data, dset_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(H5VL_dataset_close(dset_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset");
done:
@ -975,7 +974,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
/* Get the dataset's datatype */
if(NULL == (dt = (const H5T_t *)H5I_object(type_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
/* If this is a named datatype, get the pointer via the VOL driver */
/* If this is a named datatype, get the pointer via the VOL plugin */
type = (const H5T_t *)H5T_get_actual_type(dt);
/* Check if the datatype is "sensible" for use in a dataset */
@ -1962,12 +1961,12 @@ H5D_oloc(H5D_t *dataset)
*-------------------------------------------------------------------------
*/
H5G_name_t *
H5D_nameof(H5D_t *dataset)
H5D_nameof(const H5D_t *dataset)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_LEAVE_NOAPI(dataset ? &(dataset->path) : (H5G_name_t *)NULL)
FUNC_LEAVE_NOAPI(dataset ? (H5G_name_t *)&(dataset->path) : (H5G_name_t *)NULL)
} /* end H5D_nameof() */
@ -2460,10 +2459,7 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id,
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point")
/* Read in the point (with the custom VL memory allocator) */
if(H5VL_dataset_read(vol_obj->data, vol_obj->driver->cls,
type_id, vlen_bufsize->mspace_id,
vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT,
vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0)
if(H5VL_dataset_read(vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point")
done:
@ -3402,13 +3398,12 @@ H5D__get_type(const H5D_t *dset)
* two-level IDs, where the VOL object is a copy of the
* returned datatype.
*/
if((ret_value = H5VL_native_register(H5I_DATATYPE, dt, TRUE)) < 0)
if((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
}
else {
} /* end if */
else
if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
}
done:
if(ret_value < 0)

View File

@ -30,6 +30,8 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Sprivate.h" /* Dataspace */
#include "H5VLnative_private.h" /* Native VOL connector */
#ifdef H5_HAVE_PARALLEL
/* Remove this if H5R_DATASET_REGION is no longer used in this file */
#include "H5Rpublic.h"
@ -191,8 +193,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
H5CX_set_dxpl(dxpl_id);
/* Read the data */
if ((ret_value = H5VL_dataset_read(vol_obj->data, vol_obj->driver->cls, mem_type_id, mem_space_id,
file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0)
if ((ret_value = H5VL_dataset_read(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
done:
@ -243,8 +244,7 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil
H5CX_set_dxpl(dxpl_id);
/* Read the raw chunk */
if (H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, dxpl_id,
H5_REQUEST_NULL, H5VL_DATASET_CHUNK_READ, offset, filters, buf) < 0)
if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_CHUNK_READ, offset, filters, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data")
done:
@ -315,8 +315,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
H5CX_set_dxpl(dxpl_id);
/* Write the data */
if ((ret_value = H5VL_dataset_write(vol_obj->data, vol_obj->driver->cls, mem_type_id, mem_space_id,
file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0)
if ((ret_value = H5VL_dataset_write(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
done:
@ -373,8 +372,7 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of
H5CX_set_dxpl(dxpl_id);
/* Write chunk */
if (H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, dxpl_id,
H5_REQUEST_NULL, H5VL_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0)
if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data")
done:

View File

@ -110,15 +110,6 @@ typedef struct H5D_type_info_t {
hbool_t bkg_buf_allocated; /* Whether the background buffer was allocated */
} H5D_type_info_t;
/* types for dataset optional VOL operations */
typedef enum H5VL_dataset_optional_t {
H5VL_DATASET_FORMAT_CONVERT, /* H5Dformat_convert (internal) */
H5VL_DATASET_GET_CHUNK_INDEX_TYPE, /* H5Dget_chunk_index_type */
H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, /* H5Dget_chunk_storage_size */
H5VL_DATASET_CHUNK_READ, /* H5Dchunk_read */
H5VL_DATASET_CHUNK_WRITE, /* H5Dchunk_write */
} H5VL_dataset_optional_t;
/* Forward declaration of structs used below */
struct H5D_io_info_t;
struct H5D_chunk_map_t;

View File

@ -158,7 +158,7 @@ H5_DLL herr_t H5D_close(H5D_t *dataset);
H5_DLL herr_t H5D_mult_refresh_close(hid_t dset_id);
H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset);
H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset);
H5_DLL H5G_name_t *H5D_nameof(H5D_t *dataset);
H5_DLL H5G_name_t *H5D_nameof(const H5D_t *dataset);
H5_DLL H5T_t *H5D_typeof(const H5D_t *dset);
H5_DLL herr_t H5D_flush_all(const H5F_t *f);
H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset);

View File

@ -104,17 +104,6 @@ typedef enum H5D_vds_view_t {
/* Callback for H5Pset_append_flush() in a dataset access property list */
typedef herr_t (*H5D_append_cb_t)(hid_t dataset_id, hsize_t *cur_dims, void *op_data);
/********************/
/* Public Variables */
/********************/
/*********************/
/* Public Prototypes */
/*********************/
#ifdef __cplusplus
extern "C" {
#endif
/* Define the operator function pointer for H5Diterate() */
typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim,
const hsize_t *point, void *operator_data);
@ -128,6 +117,18 @@ typedef herr_t (*H5D_scatter_func_t)(const void **src_buf/*out*/,
typedef herr_t (*H5D_gather_func_t)(const void *dst_buf,
size_t dst_buf_bytes_used, void *op_data);
/********************/
/* Public Variables */
/********************/
/*********************/
/* Public Prototypes */
/*********************/
#ifdef __cplusplus
extern "C" {
#endif
H5_DLL hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id,
hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id);
H5_DLL hid_t H5Dcreate_anon(hid_t file_id, hid_t type_id, hid_t space_id,

View File

@ -58,7 +58,6 @@
#include "H5Oprivate.h" /* Object headers */
#include "H5Pprivate.h" /* Property Lists */
#include "H5Sprivate.h" /* Dataspaces */
#include "H5VLnative_private.h" /* Native VOL driver */
#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@ -2963,7 +2962,6 @@ static herr_t
H5D__virtual_refresh_source_dset(H5D_t **dset)
{
hid_t temp_id = H5I_INVALID_HID; /* Temporary dataset identifier */
hid_t native_vol_id = H5I_INVALID_HID; /* ID for the native VOL driver */
H5VL_object_t *vol_obj = NULL; /* VOL object stored with the ID */
herr_t ret_value = SUCCEED; /* Return value */
@ -2972,12 +2970,8 @@ H5D__virtual_refresh_source_dset(H5D_t **dset)
/* Sanity check */
HDassert(dset && *dset);
/* Get the native VOL driver's ID */
if((native_vol_id = H5VL_native_get_driver_id()) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get native VOL driver ID")
/* Get a temporary identifier for this source dataset */
if((temp_id = H5VL_register_using_vol_id(H5I_DATASET, *dset, native_vol_id, FALSE)) < 0)
if((temp_id = H5VL_wrap_register(H5I_DATASET, *dset, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID")
/* Refresh source dataset */
@ -2987,7 +2981,8 @@ H5D__virtual_refresh_source_dset(H5D_t **dset)
/* Discard the identifier & replace the dataset */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_remove(temp_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID")
*dset = (H5D_t *)(vol_obj->data);
if(NULL == (*dset = (H5D_t *)H5VL_object_data(vol_obj)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve library object from VOL object")
vol_obj->data = NULL;
done:
@ -2995,7 +2990,7 @@ done:
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_refresh_source_dsets() */
} /* end H5D__virtual_refresh_source_dset() */
/*-------------------------------------------------------------------------

View File

@ -29,7 +29,7 @@ typedef enum H5ES_status_t {
H5ES_STATUS_IN_PROGRESS, /* Operation has not yet completed */
H5ES_STATUS_SUCCEED, /* Operation has completed, successfully */
H5ES_STATUS_FAIL, /* Operation has completed, but failed */
H5ES_STATUS_CANCEL /* Operation has not completed and has been cancelled */
H5ES_STATUS_CANCELED /* Operation has not completed and was canceled */
} H5ES_status_t;

340
src/H5F.c
View File

@ -38,15 +38,31 @@
#include "H5Tprivate.h" /* Datatypes */
#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5VLnative_private.h" /* Native VOL connector */
/****************/
/* Local Macros */
/****************/
/******************/
/* Local Typedefs */
/******************/
/* User data for traversal routine to get ID counts */
typedef struct {
size_t obj_count; /* Number of objects counted so far */
unsigned types; /* Types of objects to be counted */
} H5F_trav_obj_cnt_t;
/* User data for traversal routine to get ID lists */
typedef struct {
size_t max_objs; /* Maximum # of IDs to record */
hid_t *oid_list; /* Array of recorded IDs*/
size_t obj_count; /* Number of objects counted so far */
} H5F_trav_obj_ids_t;
/********************/
/* Package Typedefs */
@ -199,12 +215,12 @@ H5F__close_cb(H5VL_object_t *file_vol_obj)
HDassert(file_vol_obj);
/* Close the file */
if(H5VL_file_close(file_vol_obj->data, file_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file");
if(H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
/* Free the VOL object */
if(H5VL_free_object(file_vol_obj) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object");
HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object")
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -239,8 +255,7 @@ H5Fget_create_plist(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
/* Retrieve the file creation property list */
if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_FCPL,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
if(H5VL_file_get(vol_obj, H5VL_FILE_GET_FCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties")
done:
@ -280,8 +295,7 @@ H5Fget_access_plist(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
/* Retrieve the file's access property list */
if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_FAPL,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
if(H5VL_file_get(vol_obj, H5VL_FILE_GET_FAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list")
done:
@ -308,7 +322,7 @@ H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id,
FUNC_ENTER_STATIC_NOERR
*(udata->obj_count) = *(udata->obj_count) + 1;
udata->obj_count++;
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F_get_all_count_cb */
@ -350,42 +364,38 @@ H5Fget_obj_count(hid_t file_id, unsigned types)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id")
/* Get the count */
if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_OBJ_COUNT,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, &ret_value) < 0)
if(H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, &ret_value) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)")
}
/* If we passed in the 'special' ID, get the count for everything open in the
* library, iterating over all open files and getting the object count for each.
*
* XXX: Consider making this a helper function in H5I.
*/
else {
H5F_trav_obj_cnt_t udata;
udata.obj_count = &ret_value;
/* Set up callback context */
udata.types = types | H5F_OBJ_LOCAL;
udata.obj_count = 0;
if(types & H5F_OBJ_FILE) {
if(types & H5F_OBJ_FILE)
if(H5I_iterate(H5I_FILE, H5F__get_all_count_cb, &udata, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed");
}
if(types & H5F_OBJ_DATASET) {
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed")
if(types & H5F_OBJ_DATASET)
if(H5I_iterate(H5I_DATASET, H5F__get_all_count_cb, &udata, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed");
}
if(types & H5F_OBJ_GROUP) {
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed")
if(types & H5F_OBJ_GROUP)
if(H5I_iterate(H5I_GROUP, H5F__get_all_count_cb, &udata, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed");
}
if(types & H5F_OBJ_DATATYPE) {
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed")
if(types & H5F_OBJ_DATATYPE)
if(H5I_iterate(H5I_DATATYPE, H5F__get_all_count_cb, &udata, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed");
}
if(types & H5F_OBJ_ATTR) {
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed")
if(types & H5F_OBJ_ATTR)
if(H5I_iterate(H5I_ATTR, H5F__get_all_count_cb, &udata, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed");
}
}
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed")
/* Set return value */
ret_value = (ssize_t)udata.obj_count;
} /* end else */
done:
FUNC_LEAVE_API(ret_value)
@ -411,11 +421,12 @@ H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void *key)
FUNC_ENTER_STATIC_NOERR
if(*udata->obj_count >= udata->max_objs)
if(udata->obj_count >= udata->max_objs)
HGOTO_DONE(H5_ITER_STOP);
udata->oid_list[*udata->obj_count] = obj_id;
*(udata->obj_count) = *(udata->obj_count) + 1;
/* Add the ID to the array */
udata->oid_list[udata->obj_count] = obj_id;
udata->obj_count++;
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -430,6 +441,9 @@ done:
* NOTE: Type mismatch - You can ask for more objects than can be
* returned.
*
* NOTE: Currently, the IDs' ref counts are not incremented. Is this
* intentional and documented?
*
* Return: Success: The number of IDs in oid_list
*
* Failure: -1
@ -462,14 +476,12 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
/* Get the IDs */
if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_OBJ_IDS,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0)
if(H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_IDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)")
}
} /* end if */
/* If we passed in the 'special' ID, get the count for everything open in the
* library, iterating over all open files and getting the object count for each.
*
* XXX: Consider making this a helper function in H5I.
* XXX: Note that the RM states that passing in a negative value for max_objs
* gets you all the objects. This technically works, but is clearly wrong
* behavior since max_objs is an unsigned type.
@ -477,31 +489,30 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list)
else {
H5F_trav_obj_ids_t udata;
/* Set up callback context */
udata.max_objs = max_objs;
udata.oid_list = oid_list;
udata.obj_count = &ret_value;
udata.obj_count = 0;
if(types & H5F_OBJ_FILE) {
if(types & H5F_OBJ_FILE)
if(H5I_iterate(H5I_FILE, H5F__get_all_ids_cb, &udata, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed");
}
if(types & H5F_OBJ_DATASET) {
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed")
if(types & H5F_OBJ_DATASET)
if(H5I_iterate(H5I_DATASET, H5F__get_all_ids_cb, &udata, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed");
}
if(types & H5F_OBJ_GROUP) {
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed")
if(types & H5F_OBJ_GROUP)
if(H5I_iterate(H5I_GROUP, H5F__get_all_ids_cb, &udata, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed");
}
if(types & H5F_OBJ_DATATYPE) {
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed")
if(types & H5F_OBJ_DATATYPE)
if(H5I_iterate(H5I_DATATYPE, H5F__get_all_ids_cb, &udata, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed");
}
if(types & H5F_OBJ_ATTR) {
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed")
if(types & H5F_OBJ_ATTR)
if(H5I_iterate(H5I_ATTR, H5F__get_all_ids_cb, &udata, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed");
}
}
HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed")
/* Set return value */
ret_value = (ssize_t)udata.obj_count;
} /* end else */
done:
FUNC_LEAVE_API(ret_value)
@ -536,8 +547,7 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Retrieve the VFD handle for the file */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle")
done:
@ -574,8 +584,7 @@ H5Fis_accessible(const char *name, hid_t fapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list")
/* Check if file is accessible */
if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0)
if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5")
done:
@ -611,12 +620,9 @@ done:
hid_t
H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
{
void *new_file = NULL; /* file struct for new file */
H5F_t *new_file = NULL; /* File struct for new file */
H5P_genplist_t *plist; /* Property list pointer */
H5VL_class_t *cls = NULL; /* VOL Class structure for callback info */
H5VL_t *driver = NULL; /* VOL driver struct */
H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */
H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
hid_t ret_value; /* return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@ -650,10 +656,8 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* get the VOL info from the fapl */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list")
if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get vol driver info")
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL driver ID")
if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
/* Adjust bit flags by turning on the creation bit and making sure that
* the EXCL or TRUNC bit is set. All newly-created files are opened for
@ -664,21 +668,12 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
flags |= H5F_ACC_RDWR | H5F_ACC_CREAT;
/* Create a new file or truncate an existing file through the VOL */
if(NULL == (new_file = H5VL_file_create(cls, filename, flags, fcpl_id, fapl_id,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (new_file = (H5F_t *)H5VL_file_create(&connector_prop, filename, flags, fcpl_id, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file")
/* Setup VOL driver struct */
if(NULL == (driver = H5FL_CALLOC(H5VL_t)))
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VL info struct")
driver->cls = cls;
driver->id = driver_prop.driver_id;
if(H5I_inc_ref(driver->id, FALSE) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver")
/* Get an atom for the file */
if((ret_value = H5VL_register(H5I_FILE, new_file, driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
done:
FUNC_LEAVE_API(ret_value)
@ -707,12 +702,10 @@ done:
hid_t
H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
{
void *new_file = NULL; /* file struct for new file */
H5P_genplist_t *plist; /* Property list pointer */
H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */
H5VL_class_t *cls = NULL; /* VOL class structure for callback info */
H5VL_t *driver = NULL; /* VOL driver struct */
hid_t ret_value; /* return value */
H5F_t *new_file = NULL; /* File struct for new file */
H5P_genplist_t *plist; /* Property list pointer */
H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
hid_t ret_value; /* return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "*sIui", filename, flags, fapl_id);
@ -739,26 +732,16 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
/* Get the VOL info from the fapl */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list")
if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL driver info")
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL driver ID")
if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
/* Open the file through the VOL layer */
if(NULL == (new_file = H5VL_file_open(cls, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (new_file = (H5F_t *)H5VL_file_open(&connector_prop, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file")
/* Setup VOL driver struct */
if(NULL == (driver = H5FL_CALLOC(H5VL_t)))
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VL info struct")
driver->cls = cls;
driver->id = driver_prop.driver_id;
if(H5I_inc_ref(driver->id, FALSE) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver")
/* Get an ID for the file */
if((ret_value = H5VL_register(H5I_FILE, new_file, driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
done:
FUNC_LEAVE_API(ret_value)
@ -789,17 +772,15 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
/* Get the type of object we're flushing + sanity check */
obj_type = H5I_get_type(object_id);
if(H5I_FILE != obj_type && H5I_GROUP != obj_type && H5I_DATATYPE != obj_type &&
H5I_DATASET != obj_type && H5I_ATTR != obj_type) {
H5I_DATASET != obj_type && H5I_ATTR != obj_type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
}
/* get the file object */
if(NULL == (vol_obj = H5VL_vol_object(object_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Flush the object */
if(H5VL_file_specific(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_FLUSH,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, scope) < 0)
if(H5VL_file_specific(vol_obj, H5VL_FILE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)obj_type, (int)scope) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file")
done:
@ -863,7 +844,7 @@ hid_t
H5Freopen(hid_t file_id)
{
H5VL_object_t *vol_obj = NULL;
void *file; /* File token from VOL driver */
H5F_t *file = NULL; /* File struct for new file */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@ -874,17 +855,16 @@ H5Freopen(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
/* Reopen the file */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_REOPEN, &file) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL driver")
if(H5VL_file_specific(vol_obj, H5VL_FILE_REOPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &file) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL connector")
/* Make sure that worked */
if(NULL == file)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file")
/* Get an atom for the file */
if((ret_value = H5VL_register(H5I_FILE, file, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
if((ret_value = H5VL_register(H5I_FILE, file, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
done:
/* XXX (VOL MERGE): If registration fails, file will not be closed */
@ -919,10 +899,9 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Get the flags */
if((ret_value = H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_INTENT,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0)
if((ret_value = H5VL_file_get(vol_obj, H5VL_FILE_GET_INTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags")
}
} /* end if */
done:
FUNC_LEAVE_API(ret_value)
@ -954,8 +933,7 @@ H5Fget_freespace(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
/* Get the amount of free space in the file */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FREE_SPACE, &ret_value) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space")
done:
@ -990,8 +968,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the file size */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_SIZE, size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
done:
@ -1041,8 +1018,8 @@ done:
ssize_t
H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len)
{
H5VL_object_t *vol_obj; /* File object for file ID */
ssize_t ret_value; /* Return value */
H5VL_object_t *vol_obj; /* File object for file ID */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "i*xz", file_id, buf_ptr, buf_len);
@ -1052,8 +1029,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID")
/* Get the file image */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image")
done:
@ -1093,8 +1069,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Get the metadata cache configuration */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_CONF, config_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration")
done:
@ -1127,8 +1102,7 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Set the metadata cache configuration */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_MDC_CONFIG, config_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration")
done:
@ -1164,8 +1138,7 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the current hit rate */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_HR, hit_rate_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate")
done:
@ -1202,9 +1175,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the size data */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE,
max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_SIZE, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size")
done:
@ -1242,8 +1213,7 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Reset the hit rate statistic */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate")
done:
@ -1277,7 +1247,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size)
{
H5VL_object_t *vol_obj = NULL;
H5I_type_t type;
ssize_t ret_value = -1;
ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", obj_id, name, size);
@ -1292,8 +1262,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
/* Get the filename via the VOL */
if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_NAME,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, size, name, &ret_value) < 0)
if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)type, size, name, &ret_value) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file name")
done:
@ -1338,8 +1307,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the file information */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
H5VL_FILE_GET_INFO, type, finfo) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_INFO, (int)type, finfo) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
done:
@ -1375,8 +1343,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the retry info */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info")
done:
@ -1415,8 +1382,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0")
/* Get the free-space section information in the file */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, (int)type, nsects) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections")
done:
@ -1449,8 +1415,7 @@ H5Fclear_elink_file_cache(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Release the EFC */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
done:
@ -1509,9 +1474,8 @@ H5Fstart_swmr_write(hid_t file_id)
if(H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* start SWMR writing */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0)
/* Start SWMR writing */
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_START_SWMR_WRITE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing")
done:
@ -1543,8 +1507,7 @@ H5Fstart_mdc_logging(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* Call mdc logging function */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_START_MDC_LOGGING) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_START_MDC_LOGGING) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging")
done:
@ -1577,8 +1540,7 @@ H5Fstop_mdc_logging(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* Call mdc logging function */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_STOP_MDC_LOGGING) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging")
done:
@ -1612,8 +1574,7 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* Call mdc logging function */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status")
done:
@ -1633,13 +1594,10 @@ done:
*
*-------------------------------------------------------------------------
*/
/* XXX (VOL MERGE): This could go in the native VOL driver under 'optional'
*/
herr_t
H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high)
{
H5VL_object_t *vol_obj; /* File as VOL object */
H5F_t *f; /* File */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@ -1648,15 +1606,14 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high)
/* Check args */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID")
f = (H5F_t *)(vol_obj->data);
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Call internal set_libver_bounds function */
if(H5F__set_libver_bounds(f, low, high) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds")
/* Set the library's version bounds */
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, low, high) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds")
done:
FUNC_LEAVE_API(ret_value)
@ -1692,8 +1649,7 @@ H5Fformat_convert(hid_t file_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Convert the format */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_FORMAT_CONVERT) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_FORMAT_CONVERT) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format")
done:
@ -1724,8 +1680,7 @@ H5Freset_page_buffering_stats(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Reset the statistics */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_RESET_PAGE_BUFFERING_STATS) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering")
done:
@ -1760,9 +1715,7 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats")
/* Get the statistics */
if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, H5VL_FILE_GET_PAGE_BUFFERING_STATS,
accesses, hits, misses, evictions, bypasses) < 0)
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS, accesses, hits, misses, evictions, bypasses) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering")
done:
@ -1786,21 +1739,19 @@ done:
herr_t
H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len)
{
H5F_t *file; /* File object for file ID */
H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*a*h", file_id, image_addr, image_len);
/* Check args */
if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
if(NULL == image_addr || NULL == image_len)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL image addr or image len")
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* Go get the address and size of the cache image */
if(H5AC_get_mdc_image_info(file->shared->cache, image_addr, image_len) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO, image_addr, image_len) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
done:
FUNC_LEAVE_API(ret_value)
@ -1820,29 +1771,23 @@ done:
herr_t
H5Fget_eoa(hid_t file_id, haddr_t *eoa)
{
H5F_t *file; /* File object for file ID */
haddr_t rel_eoa; /* Relative address of EOA */
H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*a", file_id, eoa);
/* Check args */
if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* This public routine will work only for drivers with this feature enabled.*/
/* We might introduce a new feature flag in the future */
if(!H5F_HAS_FEATURE(file, H5FD_FEAT_SUPPORTS_SWMR_IO))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine")
/* Only do work if valid pointer to fill in */
if(eoa) {
/* Retrieve the EOA for the file */
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_EOA, eoa) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA")
} /* end if */
/* The real work */
if(HADDR_UNDEF == (rel_eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT)))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed")
/* (Note compensating for base address subtraction in internal routine) */
if(eoa)
*eoa = rel_eoa + H5FD_get_base_addr(file->shared->lf);
done:
FUNC_LEAVE_API(ret_value)
} /* H5Fget_eoa() */
@ -1859,30 +1804,19 @@ done:
herr_t
H5Fincrement_filesize(hid_t file_id, hsize_t increment)
{
H5F_t *file; /* File object for file ID */
haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */
herr_t ret_value = SUCCEED; /* Return value */
H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ih", file_id, increment);
/* Check args */
if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* This public routine will work only for drivers with this feature enabled.*/
/* We might introduce a new feature flag in the future */
if(!H5F_HAS_FEATURE(file, H5FD_FEAT_SUPPORTS_SWMR_IO))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine")
/* Get the maximum of EOA and EOF */
if(H5F__get_max_eof_eoa(file, &max_eof_eoa) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ")
/* Set EOA to the maximum value + increment */
/* H5FD_set_eoa() will add base_addr to max_eof_eoa */
if(H5FD_set_eoa(file->shared->lf, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed")
/* Increment the file size */
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_INCR_FILESIZE, increment) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size")
done:
FUNC_LEAVE_API(ret_value)

View File

@ -54,6 +54,7 @@ typedef struct H5FD_core_t {
haddr_t eof; /* current allocated size */
size_t increment; /* multiples for mem allocation */
hbool_t backing_store; /* write to file name on flush */
hbool_t write_tracking; /* Whether to track writes */
size_t bstore_page_size; /* backing store page size */
int fd; /* backing store file descriptor */
/* Information for determining uniqueness of a file with a backing store */
@ -93,10 +94,14 @@ typedef struct H5FD_core_t {
typedef struct H5FD_core_fapl_t {
size_t increment; /* how much to grow memory */
hbool_t backing_store; /* write to file name on flush */
hbool_t write_tracking; /* Whether to track writes */
size_t page_size; /* Page size for tracked writes */
} H5FD_core_fapl_t;
/* Allocate memory in multiples of this size by default */
#define H5FD_CORE_INCREMENT 8192
#define H5FD_CORE_INCREMENT 8192
#define H5FD_CORE_WRITE_TRACKING_FLAG FALSE
#define H5FD_CORE_WRITE_TRACKING_PAGE_SIZE 524288
/* These macros check for overflow of various quantities. These macros
* assume that file_offset_t is signed and haddr_t and size_t are unsigned.
@ -464,6 +469,100 @@ H5FD__core_term(void)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD__core_term() */
/*-------------------------------------------------------------------------
* Function: H5Pset_core_write_tracking
*
* Purpose: Enables/disables core VFD write tracking and page
* aggregation size.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Dana Robinson
* Tuesday, April 8, 2014
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size)
{
H5P_genplist_t *plist; /* Property list pointer */
H5FD_core_fapl_t fa; /* Core VFD info */
const H5FD_core_fapl_t *old_fa; /* Old core VFD info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ibz", plist_id, is_enabled, page_size);
/* The page size cannot be zero */
if(page_size == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page_size cannot be zero")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_PLIST, H5E_BADATOM, FAIL, "can't find object for ID")
if(H5FD_CORE != H5P_peek_driver(plist))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver")
if(NULL == (old_fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist)))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info")
/* Set VFD info values */
HDmemset(&fa, 0, sizeof(H5FD_core_fapl_t));
fa.increment = old_fa->increment;
fa.backing_store = old_fa->backing_store;
fa.write_tracking = is_enabled;
fa.page_size = page_size;
/* Set the property values & the driver for the FAPL */
if(H5P_set_driver(plist, H5FD_CORE, &fa) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set core VFD as driver")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_core_write_tracking() */
/*-------------------------------------------------------------------------
* Function: H5Pget_core_write_tracking
*
* Purpose: Gets information about core VFD write tracking and page
* aggregation size.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Dana Robinson
* Tuesday, April 8, 2014
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_core_write_tracking(hid_t plist_id, hbool_t *is_enabled, size_t *page_size)
{
H5P_genplist_t *plist; /* Property list pointer */
const H5FD_core_fapl_t *fa; /* Core VFD info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*b*z", plist_id, is_enabled, page_size);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_PLIST, H5E_BADATOM, FAIL, "can't find object for ID")
if(H5FD_CORE != H5P_peek_driver(plist))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver")
if(NULL == (fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist)))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info")
/* Get values */
if(is_enabled)
*is_enabled = fa->write_tracking;
if(page_size)
*page_size = fa->page_size;
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_core_write_tracking() */
/*-------------------------------------------------------------------------
* Function: H5Pset_fapl_core
@ -482,9 +581,9 @@ H5FD__core_term(void)
herr_t
H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store)
{
H5FD_core_fapl_t fa;
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value;
H5P_genplist_t *plist; /* Property list pointer */
H5FD_core_fapl_t fa; /* Core VFD info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "izb", fapl_id, increment, backing_store);
@ -493,10 +592,16 @@ H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store)
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
/* Set VFD info values */
HDmemset(&fa, 0, sizeof(H5FD_core_fapl_t));
fa.increment = increment;
fa.backing_store = backing_store;
fa.write_tracking = H5FD_CORE_WRITE_TRACKING_FLAG;
fa.page_size = H5FD_CORE_WRITE_TRACKING_PAGE_SIZE;
ret_value = H5P_set_driver(plist, H5FD_CORE, &fa);
/* Set the property values & the driver for the FAPL */
if(H5P_set_driver(plist, H5FD_CORE, &fa) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set core VFD as driver")
done:
FUNC_LEAVE_API(ret_value)
@ -518,9 +623,9 @@ done:
herr_t
H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_store /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
const H5FD_core_fapl_t *fa;
herr_t ret_value = SUCCEED; /* Return value */
H5P_genplist_t *plist; /* Property list pointer */
const H5FD_core_fapl_t *fa; /* Core VFD info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ixx", fapl_id, increment, backing_store);
@ -559,7 +664,7 @@ static void *
H5FD__core_fapl_get(H5FD_t *_file)
{
H5FD_core_t *file = (H5FD_core_t*)_file;
H5FD_core_fapl_t *fa;
H5FD_core_fapl_t *fa; /* Core VFD info */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@ -569,6 +674,8 @@ H5FD__core_fapl_get(H5FD_t *_file)
fa->increment = file->increment;
fa->backing_store = (hbool_t)(file->fd >= 0);
fa->write_tracking = file->write_tracking;
fa->page_size = file->bstore_page_size;
/* Set return value */
ret_value = fa;
@ -776,35 +883,28 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
} /* end if */
} /* end if */
/* Get the write tracking & page size */
file->write_tracking = fa->write_tracking;
file->bstore_page_size = fa->page_size;
/* Set up write tracking if the backing store is on */
file->dirty_list = NULL;
if(fa->backing_store) {
hbool_t write_tracking_flag = FALSE; /* what the user asked for */
hbool_t use_write_tracking = FALSE; /* what we're actually doing */
/* Get the write tracking flag */
if(H5P_get(plist, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, &write_tracking_flag) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get core VFD write tracking flag");
/* Get the page size */
if(H5P_get(plist, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, &(file->bstore_page_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get core VFD write tracking page size");
/* default is to have write tracking OFF for create (hence the check to see
* if the user explicitly set a page size) and ON with the default page size
* on open (when not read-only).
*/
/* Only use write tracking if the file is open for writing */
use_write_tracking =
TRUE == write_tracking_flag /* user asked for write tracking */
&& !(o_flags & O_RDONLY) /* file is open for writing (i.e. not read-only) */
&& file->bstore_page_size != 0; /* page size is not zero */
use_write_tracking = (TRUE == fa->write_tracking) /* user asked for write tracking */
&& !(o_flags & O_RDONLY) /* file is open for writing (i.e. not read-only) */
&& (file->bstore_page_size != 0); /* page size is not zero */
/* initialize the dirty list */
if(use_write_tracking) {
if(use_write_tracking)
if(NULL == (file->dirty_list = H5SL_create(H5SL_TYPE_HADDR, NULL)))
HGOTO_ERROR(H5E_SLIST, H5E_CANTCREATE, NULL, "can't create core vfd dirty region list");
} /* end if */
} /* end if */
/* Set return value */

View File

@ -291,6 +291,7 @@ H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbu
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
HDmemset(&fa, 0, sizeof(H5FD_direct_fapl_t));
if(boundary != 0)
fa.mboundary = boundary;
else
@ -417,7 +418,7 @@ static void *
H5FD_direct_fapl_copy(const void *_old_fa)
{
const H5FD_direct_fapl_t *old_fa = (const H5FD_direct_fapl_t*)_old_fa;
H5FD_direct_fapl_t *new_fa = H5MM_malloc(sizeof(H5FD_direct_fapl_t));
H5FD_direct_fapl_t *new_fa = H5MM_calloc(sizeof(H5FD_direct_fapl_t));
FUNC_ENTER_NOAPI_NOINIT_NOERR

View File

@ -329,6 +329,8 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, si
if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
HDmemset(&fa, 0, sizeof(H5FD_log_fapl_t));
/* This shallow copy is correct! The string will be properly
* copied deep down in the H5P code.
*/

View File

@ -319,6 +319,7 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info)
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator")
/* Initialize driver specific properties */
HDmemset(&fa, 0, sizeof(H5FD_mpio_fapl_t));
fa.comm = comm;
fa.info = info;

View File

@ -497,6 +497,7 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map,
* Initialize driver specific information. No need to copy it into the FA
* struct since all members will be copied by H5Pset_driver().
*/
memset(&fa, 0, sizeof(H5FD_multi_fapl_t));
memcpy(fa.memb_map, memb_map, H5FD_MEM_NTYPES*sizeof(H5FD_mem_t));
memcpy(fa.memb_fapl, memb_fapl, H5FD_MEM_NTYPES*sizeof(hid_t));
memcpy(fa.memb_name, memb_name, H5FD_MEM_NTYPES*sizeof(char*));
@ -892,7 +893,7 @@ static void *
H5FD_multi_fapl_copy(const void *_old_fa)
{
const H5FD_multi_fapl_t *old_fa = (const H5FD_multi_fapl_t*)_old_fa;
H5FD_multi_fapl_t *new_fa = (H5FD_multi_fapl_t *)malloc(sizeof(H5FD_multi_fapl_t));
H5FD_multi_fapl_t *new_fa = (H5FD_multi_fapl_t *)calloc(1, sizeof(H5FD_multi_fapl_t));
int nerrors = 0;
static const char *func="H5FD_multi_fapl_copy"; /* Function Name for error reporting */

View File

@ -104,11 +104,10 @@ H5FD__supports_swmr_test(const char *vfd_name)
FUNC_ENTER_NOAPI_NOINIT_NOERR
if(!vfd_name || !HDstrcmp(vfd_name, ""))
if(!vfd_name || !HDstrcmp(vfd_name, "") || !HDstrcmp(vfd_name, "nomatch"))
ret_value = TRUE;
else
ret_value = !HDstrcmp(vfd_name, "log")
|| !HDstrcmp(vfd_name, "sec2");
ret_value = !HDstrcmp(vfd_name, "log") || !HDstrcmp(vfd_name, "sec2");
FUNC_LEAVE_NOAPI(ret_value)

View File

@ -42,6 +42,8 @@
#include "H5Iprivate.h" /* IDs */
#include "H5SMprivate.h" /* Shared object header messages */
#include "H5VLnative_private.h" /* Native VOL connector */
/****************/
/* Local Macros */
@ -96,7 +98,8 @@
herr_t
H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
{
H5F_t *f; /* Top file in mount hierarchy */
H5VL_object_t *vol_obj = NULL;
H5I_type_t type;
H5F_info2_t finfo2; /* Current file info struct */
herr_t ret_value = SUCCEED; /* Return value */
@ -107,27 +110,17 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
if(!finfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
/* For file IDs, get the file object directly
*
* (This prevents the H5G_loc() call from returning the file pointer for
* the top file in a mount hierarchy)
*/
if(H5I_get_type(obj_id) == H5I_FILE ) {
if(NULL == (f = (H5F_t *)H5VL_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
}
else {
H5G_loc_t loc; /* Object location */
/* Check the type */
type = H5I_get_type(obj_id);
if(H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Get symbol table entry */
if(H5G_loc(obj_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID")
f = loc.oloc->file;
}
HDassert(f->shared);
/* Get the file object */
if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the current file info */
if(H5F__get_info(f, &finfo2) < 0)
/* Get the file information */
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_INFO, type, &finfo2) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
/* Copy the compatible fields into the older struct */
@ -165,12 +158,11 @@ H5Fis_hdf5(const char *name)
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "no file name specified")
/* call the private is_HDF5 function */
if((ret_value = H5F__is_hdf5(name, H5P_FILE_ACCESS_DEFAULT)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable open file")
/* Check if file is accessible */
if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5P_FILE_ACCESS_DEFAULT, name, &ret_value) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable to determine if file is accessible as HDF5")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fis_hdf5() */
@ -209,16 +201,13 @@ done:
*
*-------------------------------------------------------------------------
*/
/* XXX (VOL MERGE): This could go in the native VOL driver under 'optional'.
*/
herr_t
H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
{
H5VL_object_t *vol_obj; /* File as VOL object */
H5F_t *f; /* File */
H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */
H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */
herr_t ret_value = SUCCEED; /* Return value */
H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */
H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ib", file_id, latest_format);
@ -226,17 +215,20 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
/* Check args */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID")
f = (H5F_t *)(vol_obj->data);
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* 'low' and 'high' are both initialized to LATEST.
* If latest format is not expected, set 'low' to EARLIEST
*/
*/
if(!latest_format)
low = H5F_LIBVER_EARLIEST;
/* Call private set_libver_bounds function to set the bounds */
if(H5F__set_libver_bounds(f, low, high) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds")
/* Set the library's version bounds */
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, (int)low, (int)high) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds")
done:
FUNC_LEAVE_API(ret_value)

View File

@ -37,8 +37,9 @@
#include "H5Pprivate.h" /* Property lists */
#include "H5SMprivate.h" /* Shared Object Header Messages */
#include "H5Tprivate.h" /* Datatypes */
#include "H5VLprivate.h" /* VOL drivers */
#include "H5VLnative_private.h" /* Native VOL driver */
#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5VLnative_private.h" /* Native VOL connector */
/****************/
@ -75,10 +76,12 @@ typedef struct H5F_olist_t {
/* Local Prototypes */
/********************/
static herr_t H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info);
static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr);
static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key);
static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/);
static char *H5F__getenv_prefix_name(char **env_prefix/*in,out*/);
static H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf);
static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name);
static herr_t H5F__flush_phase1(H5F_t *f);
static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing);
@ -105,6 +108,50 @@ H5FL_DEFINE(H5F_t);
H5FL_DEFINE(H5F_file_t);
/*-------------------------------------------------------------------------
* Function: H5F__set_vol_conn
*
* Purpose: Set the VOL connector ID and info for a file.
*
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
static herr_t
H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info)
{
void *new_connector_info = NULL; /* Copy of connector info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(file);
/* Copy connector info, if it exists */
if(vol_info) {
H5VL_class_t *connector; /* Pointer to connector */
/* Retrieve the connector for the ID */
if(NULL == (connector = (H5VL_class_t *)H5I_object(vol_id)))
HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Allocate and copy connector info */
if(H5VL_copy_connector_info(connector, &new_connector_info, vol_info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "connector info copy failed")
} /* end if */
/* Cache the connector ID & info for the container */
file->shared->vol_id = vol_id;
file->shared->vol_info = new_connector_info;
if(H5I_inc_ref(file->shared->vol_id, FALSE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__set_vol_conn() */
/*-------------------------------------------------------------------------
* Function: H5F_get_access_plist
@ -129,6 +176,7 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
H5P_genplist_t *old_plist; /* Old property list */
H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */
hbool_t driver_prop_copied = FALSE; /* Whether the driver property has been set up */
H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
unsigned efc_size = 0;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@ -141,60 +189,60 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
if((ret_value = H5P_copy_plist(old_plist, app_ref)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "can't copy file access property list")
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "can't copy file access property list")
if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(ret_value)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
/* Copy properties of the file access property list */
if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, &(f->shared->mdc_initCacheCfg)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.")
if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(f->shared->rdcc_nslots)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache number of slots")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache number of slots")
if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(f->shared->rdcc_nbytes)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache byte size")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache byte size")
if(H5P_set(new_plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &(f->shared->rdcc_w0)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set preempt read chunks")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set preempt read chunks")
if(H5P_set(new_plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment threshold")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment threshold")
if(H5P_set(new_plist, H5F_ACS_ALIGN_NAME, &(f->shared->alignment)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment")
if(H5P_set(new_plist, H5F_ACS_GARBG_COLCT_REF_NAME, &(f->shared->gc_ref)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set garbage collect reference")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set garbage collect reference")
if(H5P_set(new_plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(f->shared->meta_aggr.alloc_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set metadata cache size")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set metadata cache size")
if(H5P_set(new_plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't sieve buffer size")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't sieve buffer size")
if(H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->sdata_aggr.alloc_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'small data' cache size")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'small data' cache size")
if(H5P_set(new_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &f->shared->low_bound) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'low' bound for library format versions")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'low' bound for library format versions")
if(H5P_set(new_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &f->shared->high_bound) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'high' bound for library format versions")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'high' bound for library format versions")
if(H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->read_attempts)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag")
if(H5P_set(new_plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback")
if(f->shared->efc)
efc_size = H5F__efc_max_nfiles(f->shared->efc);
if(H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set elink file cache size")
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set elink file cache size")
if(f->shared->page_buf != NULL) {
if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &(f->shared->page_buf->max_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set page buffer size")
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set page buffer size")
if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &(f->shared->page_buf->min_meta_perc)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum metadata fraction of page buffer")
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum metadata fraction of page buffer")
if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &(f->shared->page_buf->min_raw_perc)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum raw data fraction of page buffer")
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum raw data fraction of page buffer")
} /* end if */
#ifdef H5_HAVE_PARALLEL
if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag")
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag")
if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag")
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag")
#endif /* H5_HAVE_PARALLEL */
if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.")
/* Prepare the driver property */
driver_prop.driver_id = f->shared->lf->driver_id;
@ -203,13 +251,19 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
/* Set the driver property */
if(H5P_set(new_plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver ID & info")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver ID & info")
/* Set the VOL connector property */
connector_prop.connector_id = f->shared->vol_id;
connector_prop.connector_info = f->shared->vol_info;
if(H5P_set(new_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector ID & info")
/* Set the file close degree appropriately */
if(f->shared->fc_degree == H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->lf->cls->fc_degree)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree")
else if(f->shared->fc_degree != H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->fc_degree)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree")
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree")
done:
/* Release the copy of the driver info, if it was set up */
@ -307,11 +361,11 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
if(types & H5F_OBJ_LOCAL) {
olist.file_info.local = TRUE;
olist.file_info.ptr.file = f;
}
} /* end if */
else {
olist.file_info.local = FALSE;
olist.file_info.ptr.shared = f ? f->shared : NULL;
}
} /* end else */
/* Iterate through file IDs to count the number, and put their
* IDs on the object list. */
@ -319,7 +373,7 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_FILE;
if(H5I_iterate(H5I_FILE, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(1)")
}
} /* end if */
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@ -330,8 +384,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_DATASET;
if(H5I_iterate(H5I_DATASET, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(2)")
}
}
} /* end if */
} /* end if */
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@ -342,8 +396,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_GROUP;
if(H5I_iterate(H5I_GROUP, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(3)")
}
}
} /* end if */
} /* end if */
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@ -354,8 +408,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_DATATYPE;
if(H5I_iterate(H5I_DATATYPE, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(4)")
}
}
} /* end if */
} /* end if */
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@ -366,8 +420,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_ATTR;
if(H5I_iterate(H5I_ATTR, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(5)")
}
}
} /* end if */
} /* end if */
/* Set the number of objects currently open */
*obj_id_count_ptr = obj_id_count;
@ -409,8 +463,8 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
(!olist->file_info.ptr.shared ||
(olist->file_info.ptr.shared && ((H5F_t*)obj_ptr)->shared == olist->file_info.ptr.shared)))) {
add_obj = TRUE;
}
}
} /* end if */
} /* end if */
else { /* Either count opened object IDs or put the IDs on the list */
H5O_loc_t *oloc; /* Group entry info for object */
@ -438,7 +492,6 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
case H5I_BADID:
case H5I_FILE:
case H5I_DATASPACE:
case H5I_REFERENCE:
case H5I_VFL:
case H5I_VOL:
case H5I_GENPROP_CLS:
@ -460,7 +513,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
(!olist->file_info.ptr.shared && olist->obj_type != H5I_DATATYPE) ||
(oloc && oloc->file && oloc->file->shared == olist->file_info.ptr.shared)))) {
add_obj = TRUE;
}
} /* end if */
} /* end else */
if(add_obj) {
@ -468,7 +521,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
if(olist->obj_id_list) {
olist->obj_id_list[olist->list_index] = obj_id;
olist->list_index++;
}
} /* end if */
/* Increment the number of open objects */
if(olist->obj_id_count)
@ -481,7 +534,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
*/
if(olist->max_nobjs > 0 && olist->list_index >= olist->max_nobjs)
HGOTO_DONE(H5_ITER_STOP) /* Indicate that the iterator should stop */
}
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -835,13 +888,13 @@ done:
*
*-------------------------------------------------------------------------
*/
H5F_t *
static H5F_t *
H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
{
H5F_t *f = NULL;
H5F_t *ret_value = NULL;
FUNC_ENTER_PACKAGE
FUNC_ENTER_STATIC
if(NULL == (f = H5FL_CALLOC(H5F_t)))
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure")
@ -1005,12 +1058,12 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_
f->shared->feature_flags &= ~(unsigned)H5FD_FEAT_ACCUMULATE_METADATA;
if(H5FD_set_feature_flags(f->shared->lf, f->shared->feature_flags) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set feature_flags in VFD")
}
} /* end if */
else {
/* If no value for read attempts has been set, use the default */
if(!f->shared->read_attempts)
f->shared->read_attempts = H5F_METADATA_READ_ATTEMPTS;
}
} /* end else */
/* Determine the # of bins for metdata read retries */
if(H5F_set_retries(f) < 0)
@ -1036,6 +1089,16 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_
if(H5P_get(plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get object flush cb info")
/* Get the VOL connector info */
{
H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get VOL connector info")
if(H5F__set_vol_conn(f, connector_prop.connector_id, connector_prop.connector_info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't cache VOL connector info")
} /* end block */
/* Create a metadata cache with the specified number of elements.
* The cache might be created with a different number of elements and
* the access property list should be updated to reflect that.
@ -1296,6 +1359,25 @@ H5F__dest(H5F_t *f, hbool_t flush)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close property list")
/* Clean up the cached VOL connector ID & info */
if(f->shared->vol_info) {
H5VL_class_t *connector; /* Pointer to connector */
/* Retrieve the connector for the ID */
if(NULL == (connector = (H5VL_class_t *)H5I_object(f->shared->vol_id)))
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Free the connector info */
if(H5VL_free_connector_info(connector, f->shared->vol_info) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
} /* end if */
if(f->shared->vol_id > 0)
if(H5I_dec_ref(f->shared->vol_id) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close VOL connector ID")
/* Close the file */
if(H5FD_close(f->shared->lf) < 0)
/* Push error, but keep going*/
@ -1535,7 +1617,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* Create the 'top' file structure */
if(NULL == (file = H5F__new(NULL, flags, fcpl_id, fapl_id, lf))) {
/* If this is the only time the file has been opened and the struct
* returned is NULL, H5FD_close() will never be called via H5F_dest()
* returned is NULL, H5FD_close() will never be called via H5F__dest()
* so we have to close lf here before heading to the error handling.
*/
if(H5FD_close(lf) < 0)
@ -1634,16 +1716,6 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
*/
if(H5P_get(a_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file close degree")
/* This is a private property to clear the status_flags in the super block */
/* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */
if(H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) {
if(H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags")
else if(clear)
file->shared->sblock->status_flags = 0;
} /* end if */
if(shared->nrefs == 1) {
if(fc_degree == H5F_CLOSE_DEFAULT)
shared->fc_degree = lf->cls->fc_degree;
@ -1657,6 +1729,15 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match")
} /* end if */
/* This is a private property to clear the status_flags in the super block */
/* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */
if(H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) {
if(H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags")
else if(clear)
file->shared->sblock->status_flags = 0;
} /* end if */
/* Record the evict-on-close MDC behavior. If it's the first time opening
* the file, set it to access property list value; if it's the second time
* or later, verify that the access property list value matches the value
@ -2099,7 +2180,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
/* Delay flush until the shared file struct is closed, in H5F__dest. If the
* application called H5Fclose, it would have been flushed in that function
* (unless it will have been flushed in H5F_dest anyways).
* (unless it will have been flushed in H5F__dest anyways).
*/
/* Destroy the H5F_t struct and decrement the reference count for the
@ -2135,7 +2216,7 @@ done:
H5F_t *
H5F__reopen(H5F_t *f)
{
H5F_t *ret_value = NULL;
H5F_t *ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@ -2166,7 +2247,7 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
H5F_get_id(H5F_t *file, hbool_t app_ref)
H5F_get_id(H5F_t *file)
{
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@ -2175,16 +2256,16 @@ H5F_get_id(H5F_t *file, hbool_t app_ref)
HDassert(file);
if(H5I_find_id(file, H5I_FILE, &ret_value) < 0 || H5I_INVALID_HID == ret_value) {
/* resurrect the ID - Register an ID with the native driver */
if((ret_value = H5VL_native_register(H5I_FILE, file, app_ref)) < 0)
/* resurrect the ID - Register an ID with the native connector */
if((ret_value = H5VL_wrap_register(H5I_FILE, file, FALSE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
file->id_exists = TRUE;
}
} /* end if */
else {
/* Increment reference count on existing ID */
if(H5I_inc_ref(ret_value, app_ref) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed")
}
if(H5I_inc_ref(ret_value, FALSE) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "incrementing file ID failed")
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -2999,6 +3080,7 @@ H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr)
HDassert(f->shared);
/* Dispatch to driver */
/* (H5FD_set_eoa() will add base_addr to addr) */
if(H5FD_set_eoa(f->shared->lf, type, addr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed")
@ -3234,7 +3316,7 @@ H5F__start_swmr_write(H5F_t *f)
H5G_name_t *obj_paths = NULL; /* Group hierarchy path */
size_t u; /* Local index variable */
hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */
H5VL_t *vol_driver = NULL; /* VOL driver for the file */
H5VL_t *vol_connector = NULL; /* VOL connector for the file */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@ -3274,16 +3356,16 @@ H5F__start_swmr_write(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
/* Get the # of opened named datatypes and attributes */
if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE|H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0)
if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE | H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
if(nt_attr_count)
if(nt_attr_count > 0)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "named datatypes and/or attributes opened in the file")
/* Get the # of opened datasets and groups */
if(H5F_get_obj_count(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0)
if(H5F_get_obj_count(f, H5F_OBJ_GROUP | H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
if(grp_dset_count) {
if(grp_dset_count > 0) {
/* Allocate space for group and object locations */
if((obj_ids = (hid_t *) H5MM_malloc(grp_dset_count * sizeof(hid_t))) == NULL)
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for hid_t")
@ -3298,17 +3380,20 @@ H5F__start_swmr_write(H5F_t *f)
if(H5F_get_obj_ids(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed")
/* Save the VOL driver for the refresh step */
/* Save the VOL connector and the object wrapping context for the refresh step */
if(grp_dset_count > 0) {
H5VL_object_t *vol_obj = NULL;
H5VL_object_t *vol_obj;
/* Get the VOL object for one of the IDs */
if(NULL == (vol_obj = H5VL_vol_object(obj_ids[0])))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "invalid object identifier")
vol_driver = vol_obj->driver;
}
/* Get the (top) connector for the ID */
vol_connector = vol_obj->connector;
} /* end if */
/* Refresh opened objects (groups, datasets) in the file */
/* Gather information about opened objects (groups, datasets) in the file */
/* (For refresh later on) */
for(u = 0; u < grp_dset_count; u++) {
H5O_loc_t *oloc; /* object location */
H5G_loc_t tmp_loc;
@ -3369,10 +3454,9 @@ H5F__start_swmr_write(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to evict file's cached information")
/* Refresh (reopen) the objects (groups & datasets) in the file */
for(u = 0; u < grp_dset_count; u++) {
if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_driver, TRUE) < 0)
for(u = 0; u < grp_dset_count; u++)
if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_connector, TRUE) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object")
}
/* Unlock the file */
if(H5FD_unlock(f->shared->lf) < 0)
@ -3482,3 +3566,152 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__format_convert() */
/*---------------------------------------------------------------------------
* Function: H5F__get_file
*
* Purpose: Utility routine to get file struct for an object
*
* Returns: SUCCESS: A pointer to the H5F_t struct for the file
* associated with the object.
* FAILURE: NULL
*
*---------------------------------------------------------------------------
*/
H5F_t *
H5F__get_file(void *obj, H5I_type_t type)
{
H5F_t *ret_value = NULL; /* File pointer */
H5O_loc_t *oloc = NULL; /* Object location for ID */
FUNC_ENTER_PACKAGE
switch(type) {
case H5I_FILE:
ret_value = (H5F_t *)obj;
break;
case H5I_GROUP:
oloc = H5G_oloc((H5G_t *)obj);
break;
case H5I_DATATYPE:
oloc = H5T_oloc((H5T_t *)obj);
break;
case H5I_DATASET:
oloc = H5D_oloc((H5D_t *)obj);
break;
case H5I_ATTR:
oloc = H5A_oloc((H5A_t *)obj);
break;
case H5I_UNINIT:
case H5I_BADID:
case H5I_DATASPACE:
case H5I_VFL:
case H5I_VOL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
case H5I_ERROR_CLASS:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
} /* end switch */
/* Set return value for objects (not files) */
if(oloc)
ret_value = oloc->file;
/* Couldn't find a file struct */
if(!ret_value)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "object is not associated with a file")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__get_file */
/*-------------------------------------------------------------------------
* Function: H5F__get_file_id
*
* Purpose: The package version of H5Iget_file_id(), obtains the file
* ID given an object ID.
*
* Return: Success: The file ID associated with the object
* Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5F__get_file_id(H5F_t *file)
{
hid_t file_id = H5I_INVALID_HID; /* File ID */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_PACKAGE
/* Check if the file's ID already exists */
if(H5I_find_id(file, H5I_FILE, &file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed")
/* If the ID does not exist, register it with the VOL connector */
if(H5I_INVALID_HID == file_id) {
if((file_id = H5VL_wrap_register(H5I_FILE, file, TRUE)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
file->id_exists = TRUE;
} /* end if */
else {
/* Increment ref count on existing ID */
if(H5I_inc_ref(file_id, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed")
} /* end else */
/* Set return value */
ret_value = file_id;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__get_file_id() */
/*-------------------------------------------------------------------------
* Function: H5F_get_file_id
*
* Purpose: The private version of H5Iget_file_id(), obtains the file
* ID given an object ID.
*
* Return: Success: The file ID associated with the object
* Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5F_get_file_id(hid_t obj_id, H5I_type_t type)
{
H5VL_object_t *vol_obj; /* File info */
hid_t file_id = H5I_INVALID_HID; /* File ID for object */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
/* Get the object pointer */
if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier")
/* Get the file through the VOL */
if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FILE_ID, (int)type, &file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file ID")
if(H5I_INVALID_HID == file_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file ID through the VOL")
/* Set return value */
ret_value = file_id;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_get_file_id() */

View File

@ -477,13 +477,12 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
if(NULL == (child_vol_obj = (H5VL_object_t *)H5I_object(child_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object")
/* Check if both objects are associated with the same VOL plugin */
if(loc_vol_obj->driver->cls->value != child_vol_obj->driver->cls->value)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL driver")
/* Check if both objects are associated with the same VOL connector */
if(loc_vol_obj->connector->cls->value != child_vol_obj->connector->cls->value)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL connector")
/* Perform the mount operation */
if(H5VL_file_specific(loc_vol_obj->data, loc_vol_obj->driver->cls, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, loc_type, name, child_vol_obj->data, plist_id) < 0)
if(H5VL_file_specific(loc_vol_obj, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)loc_type, name, child_vol_obj->data, plist_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
done:
@ -535,8 +534,7 @@ H5Funmount(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
/* Perform the unmount operation */
if(H5VL_file_specific(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_UNMOUNT,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name) < 0)
if(H5VL_file_specific(vol_obj, H5VL_FILE_UNMOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)loc_type, name) < 0)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file")
done:

View File

@ -292,7 +292,7 @@ struct H5F_file_t {
/* begin on file access/create */
char *mdc_log_location; /* location of mdc log */
hid_t fcpl_id; /* File creation property list ID */
H5F_close_degree_t fc_degree; /* File close behavior degree */
H5F_close_degree_t fc_degree; /* File close behavior degree */
hbool_t evict_on_close; /* If the file's objects should be evicted from the metadata cache on close */
size_t rdcc_nslots; /* Size of raw data chunk cache (slots) */
size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */
@ -310,6 +310,10 @@ struct H5F_file_t {
H5FO_t *open_objs; /* Open objects in file */
H5UC_t *grp_btree_shared; /* Ref-counted group B-tree node info */
/* Cached VOL connector ID & info */
hid_t vol_id; /* ID of VOL connector for the container */
void *vol_info; /* Copy of VOL connector info for container */
/* File space allocation information */
H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
hsize_t fs_threshold; /* Free space section threshold */
@ -378,47 +382,6 @@ struct H5F_t {
#endif /* H5_HAVE_PARALLEL */
};
/* types for file optional VOL operations */
typedef enum H5VL_file_optional_t {
H5VL_FILE_CLEAR_ELINK_CACHE, /* Clear external link cache */
H5VL_FILE_GET_FILE_IMAGE, /* file image */
H5VL_FILE_GET_FREE_SECTIONS, /* file free selections */
H5VL_FILE_GET_FREE_SPACE, /* file freespace */
H5VL_FILE_GET_INFO, /* file info */
H5VL_FILE_GET_MDC_CONF, /* file metadata cache configuration */
H5VL_FILE_GET_MDC_HR, /* file metadata cache hit rate */
H5VL_FILE_GET_MDC_SIZE, /* file metadata cache size */
H5VL_FILE_GET_SIZE, /* file size */
H5VL_FILE_GET_VFD_HANDLE, /* file VFD handle */
H5VL_FILE_REOPEN, /* reopen the file */
H5VL_FILE_RESET_MDC_HIT_RATE, /* get metadata cache hit rate */
H5VL_FILE_SET_MDC_CONFIG, /* set metadata cache configuration */
H5VL_FILE_GET_METADATA_READ_RETRY_INFO,
H5VL_FILE_START_SWMR_WRITE,
H5VL_FILE_START_MDC_LOGGING,
H5VL_FILE_STOP_MDC_LOGGING,
H5VL_FILE_GET_MDC_LOGGING_STATUS,
H5VL_FILE_SET_LATEST_FORMAT,
H5VL_FILE_FORMAT_CONVERT,
H5VL_FILE_RESET_PAGE_BUFFERING_STATS,
H5VL_FILE_GET_PAGE_BUFFERING_STATS,
H5VL_FILE_GET_MDC_IMAGE_INFO
} H5VL_file_optional_t;
/* User data for traversal routine to get ID counts */
typedef struct {
ssize_t *obj_count; /* number of objects counted so far */
unsigned types; /* types of objects to be counted */
} H5F_trav_obj_cnt_t;
/* User data for traversal routine to get ID lists */
/* XXX (VOL MERGE): Should the type of obj_count and max_objs be identical? */
typedef struct {
size_t max_objs;
hid_t *oid_list;
ssize_t *obj_count; /* number of objects counted so far */
} H5F_trav_obj_ids_t;
/*****************************/
/* Package Private Variables */
@ -437,7 +400,6 @@ H5FL_EXTERN(H5F_file_t);
/* General routines */
H5_DLL H5F_t *H5F__reopen(H5F_t *f);
H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf);
H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush);
H5_DLL herr_t H5F__flush(H5F_t *f);
H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t fapl_id);
@ -447,6 +409,8 @@ H5_DLL herr_t H5F__format_convert(H5F_t *f);
H5_DLL herr_t H5F__start_swmr_write(H5F_t *f);
H5_DLL herr_t H5F__close(H5F_t *f);
H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high);
H5_DLL H5F_t *H5F__get_file(void *obj, H5I_type_t type);
H5_DLL hid_t H5F__get_file_id(H5F_t *file);
/* File mount related routines */
H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id);
@ -506,6 +470,7 @@ H5_DLL herr_t H5F__get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t
H5_DLL herr_t H5F__check_cached_stab_test(hid_t file_id);
H5_DLL herr_t H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr);
H5_DLL herr_t H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr);
H5_DLL htri_t H5F__same_file_test(hid_t file_id1, hid_t file_id2);
#endif /* H5F_TESTING */
#endif /* _H5Fpkg_H */

View File

@ -479,7 +479,7 @@ typedef struct H5F_t H5F_t;
#define H5F_ACS_SDATA_BLOCK_SIZE_NAME "sdata_block_size" /* Minimum "small data" allocation block size (when aggregating "small" raw data allocations) */
#define H5F_ACS_GARBG_COLCT_REF_NAME "gc_ref" /* Garbage-collect references */
#define H5F_ACS_FILE_DRV_NAME "vfd_info" /* File driver ID & info */
#define H5F_ACS_VOL_DRV_NAME "vol_driver_info" /* VOL driver ID & info */
#define H5F_ACS_VOL_CONN_NAME "vol_connector_info" /* VOL connector ID & info */
#define H5F_ACS_CLOSE_DEGREE_NAME "close_degree" /* File close degree */
#define H5F_ACS_FAMILY_OFFSET_NAME "family_offset" /* Offset position in file for family file driver */
#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */
@ -500,9 +500,7 @@ typedef struct H5F_t H5F_t;
#define H5F_ACS_USE_MDC_LOGGING_NAME "use_mdc_logging" /* Whether to use metadata cache logging */
#define H5F_ACS_MDC_LOG_LOCATION_NAME "mdc_log_location" /* Name of metadata cache log location */
#define H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME "start_mdc_log_on_access" /* Whether logging starts on file create/open */
#define H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME "core_write_tracking_flag" /* Whether or not core VFD backing store write tracking is enabled */
#define H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME "evict_on_close_flag" /* Whether or not the metadata cache will evict objects on close */
#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME "core_write_tracking_page_size" /* The page size in kiB when core VFD write tracking is enabled */
#define H5F_ACS_COLL_MD_WRITE_FLAG_NAME "collective_metadata_write" /* property indicating whether metadata writes are done collectively or not */
#define H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME "mdc_initCacheImageCfg" /* Initial metadata cache image creation configuration */
#define H5F_ACS_PAGE_BUFFER_SIZE_NAME "page_buffer_size" /* the maximum size for the page buffer cache */
@ -716,6 +714,7 @@ typedef enum H5F_prefix_open_t {
/* Private functions */
H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/);
H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type);
/* Functions that retrieve values from the file struct */
H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f);
@ -734,7 +733,7 @@ H5_DLL H5F_t *H5F_get_parent(const H5F_t *f);
H5_DLL unsigned H5F_get_nmounts(const H5F_t *f);
H5_DLL unsigned H5F_get_read_attempts(const H5F_t *f);
H5_DLL hid_t H5F_get_access_plist(H5F_t *f, hbool_t app_ref);
H5_DLL hid_t H5F_get_id(H5F_t *file, hbool_t app_ref);
H5_DLL hid_t H5F_get_id(H5F_t *file);
H5_DLL herr_t H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_id_count_ptr);
H5_DLL herr_t H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list, hbool_t app_ref, size_t *obj_id_count_ptr);
H5_DLL hsize_t H5F_get_pgend_meta_thres(const H5F_t *f);

View File

@ -218,11 +218,13 @@ typedef struct H5F_retry_info_t {
typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *udata);
/*********************/
/* Public Prototypes */
/*********************/
#ifdef __cplusplus
extern "C" {
#endif
/* Functions in H5F.c */
H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id);
H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags,
hid_t create_plist, hid_t access_plist);

View File

@ -904,7 +904,7 @@ H5F_get_eoa(const H5F_t *f, H5FD_mem_t type)
/* Dispatch to driver */
if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f->shared->lf, type)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
done:
FUNC_LEAVE_NOAPI(ret_value)

View File

@ -233,3 +233,37 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__get_sbe_addr_test() */
/*-------------------------------------------------------------------------
* Function: H5F__same_file_test
*
* Purpose: Check if two file IDs refer to the same underlying file.
*
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Oct 13, 2018
*
*-------------------------------------------------------------------------
*/
htri_t
H5F__same_file_test(hid_t file_id1, hid_t file_id2)
{
H5F_t *file1, *file2; /* File info */
htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
/* Check arguments */
if(NULL == (file1 = (H5F_t *)H5VL_object_verify(file_id1, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
if(NULL == (file2 = (H5F_t *)H5VL_object_verify(file_id2, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* If they are using the same underlying "shared" file struct, they are the same file */
ret_value = (file1->shared == file2->shared);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__same_file_test() */

View File

@ -278,7 +278,7 @@ H5G__close_cb(H5VL_object_t *grp_vol_obj)
HDassert(grp_vol_obj);
/* Close the group */
if(H5VL_group_close(grp_vol_obj->data, grp_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(H5VL_group_close(grp_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group")
/* Free the VOL object */
@ -351,13 +351,13 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* Get the gcpl structure and set the link properties on it */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
if (H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set property value for lcpl id")
/* get the location object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
/* Get the location object */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Set the location parameters */
@ -365,17 +365,16 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the group */
if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, name,
gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
done:
if(H5I_INVALID_HID == ret_value)
if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
@ -440,23 +439,22 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
/* get the location object */
/* Get the location object */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the group */
if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, NULL,
gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, NULL, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
@ -482,9 +480,9 @@ hid_t
H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
{
void *grp = NULL; /* Group opened */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, name, gapl_id);
@ -506,17 +504,17 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
/* Open the group */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->driver->cls,
name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group")
/* Register an ID for the group */
if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
if(H5I_INVALID_HID == ret_value)
if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
@ -550,8 +548,7 @@ H5Gget_create_plist(hid_t group_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID")
/* Get the group creation property list for the group */
if(H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_GCPL,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_GCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list")
done:
@ -593,8 +590,7 @@ H5Gget_info(hid_t loc_id, H5G_info_t *group_info)
/* Retrieve the group's information */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = id_type;
if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0)
if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, group_info) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
done:
@ -636,7 +632,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info,
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the location object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set up location parameters */
@ -646,8 +642,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info,
loc_params.obj_type = H5I_get_type(loc_id);
/* Retrieve the group's information */
if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0)
if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, group_info) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
done:
@ -693,7 +688,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info")
/* get the location object */
/* Get the location object */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
@ -707,8 +702,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
loc_params.obj_type = H5I_get_type(loc_id);
/* Retrieve the group's information */
if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0)
if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, group_info) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
done:
@ -779,8 +773,7 @@ H5Gflush(hid_t group_id)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Flush group's metadata to file */
if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_FLUSH,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0)
if(H5VL_group_specific(vol_obj, H5VL_GROUP_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group")
done:
@ -818,8 +811,7 @@ H5Grefresh(hid_t group_id)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Refresh group's metadata */
if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_REFRESH,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0)
if(H5VL_group_specific(vol_obj, H5VL_GROUP_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")
done:

View File

@ -572,71 +572,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__compact_lookup_by_idx() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
* Function: H5G__compact_get_type_by_idx
*
* Purpose: Returns the type of objects in the group by giving index.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* Sep 12, 2005
*
*-------------------------------------------------------------------------
*/
H5G_obj_t
H5G__compact_get_type_by_idx(H5O_loc_t *oloc, const H5O_linfo_t *linfo,
hsize_t idx)
{
H5G_link_table_t ltable = {0, NULL}; /* Link table */
H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */
FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(oloc);
/* Build table of all link messages */
if(H5G__compact_build_table(oloc, linfo, H5_INDEX_NAME, H5_ITER_INC, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5G_UNKNOWN, "can't create link message table")
/* Check for going out of bounds */
if(idx >= ltable.nlinks)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound")
/* Determine type of object */
if(ltable.lnks[idx].type == H5L_TYPE_SOFT)
ret_value = H5G_LINK;
else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN)
ret_value = H5G_UDLINK;
else if(ltable.lnks[idx].type == H5L_TYPE_HARD){
H5O_loc_t tmp_oloc; /* Temporary object location */
H5O_type_t obj_type; /* Type of object at location */
/* Build temporary object location */
tmp_oloc.file = oloc->file;
tmp_oloc.addr = ltable.lnks[idx].u.hard.addr;
/* Get the type of the object */
if(H5O_obj_type(&tmp_oloc, &obj_type) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type")
/* Map to group object type */
if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type)))
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type")
} else {
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "unknown link type")
} /* end else */
done:
/* Release link table */
if(ltable.lnks && H5G__link_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__compact_get_type_by_idx() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */

View File

@ -1777,80 +1777,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__dense_delete() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
* Function: H5G__dense_get_type_by_idx
*
* Purpose: Returns the type of objects in the group by giving index.
*
* Note: This routine assumes a lookup on the link name index in
* increasing order and isn't currently set up to be as
* flexible as other routines in this code module, because
* the H5Gget_objtype_by_idx that it's supporting is
* deprecated.
*
* Return: Success: Non-negative, object type
* Failure: Negative
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
* Sep 19 2006
*
*-------------------------------------------------------------------------
*/
H5G_obj_t
H5G__dense_get_type_by_idx(H5F_t *f, H5O_linfo_t *linfo, hsize_t idx)
{
H5G_link_table_t ltable = {0, NULL}; /* Table of links */
H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */
FUNC_ENTER_PACKAGE
/*
* Check arguments.
*/
HDassert(f);
HDassert(linfo);
/* Build the table of links for this group */
if(H5G__dense_build_table(f, linfo, H5_INDEX_NAME, H5_ITER_INC, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "error building table of links")
/* Check for going out of bounds */
if(idx >= ltable.nlinks)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "index out of bound")
/* Determine type of object */
if(ltable.lnks[idx].type == H5L_TYPE_SOFT)
ret_value = H5G_LINK;
else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN)
ret_value = H5G_UDLINK;
else if(ltable.lnks[idx].type == H5L_TYPE_HARD) {
H5O_loc_t tmp_oloc; /* Temporary object location */
H5O_type_t obj_type; /* Type of object at location */
/* Build temporary object location */
tmp_oloc.file = f;
tmp_oloc.addr = ltable.lnks[idx].u.hard.addr;
/* Get the type of the object */
if(H5O_obj_type(&tmp_oloc, &obj_type) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type")
/* Map to group object type */
if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type)))
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type")
} else {
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "unknown link type")
} /* end else */
done:
/* Release link table */
if(ltable.lnks && H5G__link_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__dense_get_type_by_idx() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */

View File

@ -43,7 +43,9 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5Pprivate.h" /* Property lists */
#include "H5VLprivate.h" /* VOL plugins */
#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5VLnative_private.h" /* Native VOL connector */
/****************/
@ -72,13 +74,9 @@ typedef struct {
/********************/
/* Local Prototypes */
/********************/
static herr_t H5G__get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
static herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name,
hbool_t follow_link, H5G_stat_t *statbuf/*out*/);
static H5G_obj_t H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@ -172,7 +170,7 @@ hid_t
H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
{
void *grp = NULL; /* New group created */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */
@ -227,6 +225,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get property value for lcpl id")
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@ -235,13 +234,12 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the group */
if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, tmp_gcpl,
H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
if(H5I_INVALID_HID != tmp_gcpl && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT)
@ -249,7 +247,7 @@ done:
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list")
if(H5I_INVALID_HID == ret_value)
if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
@ -276,10 +274,10 @@ done:
hid_t
H5Gopen1(hid_t loc_id, const char *name)
{
void *grp = NULL; /* Group opened */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
void *grp = NULL; /* Group opened */
H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "i*s", loc_id, name);
@ -297,17 +295,16 @@ H5Gopen1(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the group */
if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->driver->cls, name, H5P_DEFAULT,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group")
/* Get an atom for the group */
if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
if(H5I_INVALID_HID == ret_value)
if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
@ -348,9 +345,10 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
/* Create link */
if(type == H5L_TYPE_HARD) {
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
H5VL_object_t tmp_vol_obj; /* Temporary object token of */
loc_params1.type = H5VL_OBJECT_BY_NAME;
loc_params1.obj_type = H5I_get_type(cur_loc_id);
@ -371,13 +369,16 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target loc params")
/* Construct a temporary VOL object */
tmp_vol_obj.data = NULL;
tmp_vol_obj.connector = vol_obj->connector;
/* Create the link through the VOL */
if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, vol_obj->driver->cls,
lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
}
} /* end if */
else if(type == H5L_TYPE_SOFT) {
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
loc_params.type = H5VL_OBJECT_BY_NAME;
@ -394,10 +395,9 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
/* Create the link through the VOL */
if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls,
lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
}
} /* end else-if */
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid link type")
@ -441,8 +441,8 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
/* Create the appropriate kind of link */
if(type == H5L_TYPE_HARD) {
H5VL_object_t *vol_obj1 = NULL; /* object token of loc_id */
H5VL_object_t *vol_obj2 = NULL; /* object token of loc_id */
H5VL_object_t *vol_obj1; /* Object token of loc_id */
H5VL_object_t *vol_obj2; /* Object token of loc_id */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
@ -469,12 +469,11 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target name")
/* Create the link through the VOL */
if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2, vol_obj2->driver->cls,
lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
}
} /* end if */
else if(type == H5L_TYPE_SOFT) {
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
/* Soft links only need one location, the new_loc_id, but it's possible that
@ -496,10 +495,9 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
/* Create the link through the VOL */
if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls,
lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
}
} /* end else-if */
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type")
@ -518,10 +516,10 @@ done:
herr_t
H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name)
{
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
herr_t ret_value = SUCCEED; /* Return value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*s*s", src_loc_id, src_name, dst_name);
@ -544,8 +542,7 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Move the link */
if((ret_value = H5VL_link_move(vol_obj->data, loc_params1, NULL, loc_params2, vol_obj->driver->cls,
H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
if(H5VL_link_move(vol_obj, &loc_params1, NULL, &loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link")
done:
@ -564,9 +561,9 @@ herr_t
H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name)
{
H5VL_object_t *vol_obj1 = NULL; /* object token of src_id */
H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */
H5VL_loc_params_t loc_params1;
H5VL_object_t *vol_obj2 = NULL; /* object token of dst_id */
H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */
H5VL_loc_params_t loc_params2;
herr_t ret_value = SUCCEED; /* Return value */
@ -582,27 +579,24 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
loc_params1.loc_data.loc_by_name.name = src_name;
loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
loc_params1.obj_type = H5I_get_type(src_loc_id);
/* Set location parameter for destination object */
loc_params2.type = H5VL_OBJECT_BY_NAME;
loc_params2.loc_data.loc_by_name.name = dst_name;
loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
loc_params2.obj_type = H5I_get_type(dst_loc_id);
if(H5L_SAME_LOC != src_loc_id) {
if(H5L_SAME_LOC != src_loc_id)
/* get the location object */
if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
}
if(H5L_SAME_LOC != dst_loc_id) {
if(H5L_SAME_LOC != dst_loc_id)
/* get the location object */
if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
}
/* Move the link */
if((ret_value = H5VL_link_move(vol_obj1->data, loc_params1, vol_obj2->data, loc_params2,
vol_obj1->driver->cls, H5P_DEFAULT, H5P_DEFAULT,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
if(H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link")
done:
@ -620,7 +614,7 @@ done:
herr_t
H5Gunlink(hid_t loc_id, const char *name)
{
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@ -645,8 +639,7 @@ H5Gunlink(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Delete the link */
if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
done:
@ -665,7 +658,7 @@ done:
herr_t
H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
{
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@ -690,8 +683,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the link value */
if((ret_value = H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size)) < 0)
if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value")
done:
@ -719,14 +711,13 @@ done:
herr_t
H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
{
H5G_loc_t loc; /* Group's location */
herr_t ret_value = SUCCEED; /* Return value */
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*s*s", loc_id, name, comment);
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
@ -734,8 +725,18 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Fill in location struct fields */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = name;
loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set the comment */
if(H5G_loc_set_comment(&loc, name, comment) < 0)
if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_SET_COMMENT, &loc_params, comment) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value")
done:
@ -769,26 +770,39 @@ done:
int
H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf)
{
H5G_loc_t loc; /* Group's location */
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
ssize_t op_ret; /* Return value from operation */
int ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
FUNC_ENTER_API(-1)
H5TRACE4("Is", "i*sz*s", loc_id, name, bufsize, buf);
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, -1, "no name specified")
if(bufsize > 0 && !buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, -1, "no buffer specified")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, -1, "can't set collective metadata read info")
/* Fill in location struct fields */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = name;
loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "invalid location identifier")
/* Get the comment */
if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value")
if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_COMMENT, &loc_params, buf, bufsize, &op_ret) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, -1, "unable to get comment value")
/* Set return value */
ret_value = (int)op_ret;
done:
FUNC_LEAVE_API(ret_value)
@ -823,18 +837,17 @@ herr_t
H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
void *op_data)
{
H5G_loc_t loc; /* Location of object */
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
H5G_link_iterate_t lnk_op; /* Link operator */
hsize_t last_obj; /* Index of last object looked at */
hsize_t idx; /* Internal location to hold index */
hsize_t idx; /* Internal location to hold index */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*s*Isx*x", loc_id, name, idx_p, op, op_data);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_p && *idx_p < 0)
@ -850,9 +863,19 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
lnk_op.op_type = H5G_LINK_OP_OLD;
lnk_op.op_func.op_old = op;
/* Call private function */
if((ret_value = H5G_iterate(&loc, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed")
/* Fill out location struct */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = name;
loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the object pointer */
if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier")
/* Call private iteration function, through VOL callback */
if((ret_value = H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_GROUP_ITERATE_OLD, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0)
HERROR(H5E_SYM, H5E_BADITER, "error iterating over group's links");
/* Set the index we stopped at */
if(idx_p)
@ -882,29 +905,35 @@ done:
herr_t
H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs)
{
H5G_loc_t loc; /* Location of object */
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5I_type_t id_type; /* Type of ID */
H5VL_loc_params_t loc_params;
H5G_info_t grp_info; /* Group information */
H5O_type_t obj_type; /* Type of object at location */
herr_t ret_value = SUCCEED;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", loc_id, num_objs);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
if(H5O_obj_type(loc.oloc, &obj_type) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type")
if(obj_type != H5O_TYPE_GROUP)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
id_type = H5I_get_type(loc_id);
if(!(H5I_GROUP == id_type || H5I_FILE == id_type))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID")
if(!num_objs)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects")
/* Retrieve information about the group */
if(H5G__obj_info(loc.oloc, &grp_info) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine # of objects")
/* Fill in location struct fields */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = id_type;
/* Set the number of objects [sic: links] in the group */
/* Get group location */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the group's information */
if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, &grp_info) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
/* Set the number of objects [i.e. links] in the group */
*num_objs = grp_info.nlinks;
done:
@ -931,23 +960,40 @@ done:
*/
herr_t
H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link,
H5G_stat_t *statbuf/*out*/)
H5G_stat_t *statbuf/*out*/)
{
H5G_loc_t loc; /* Group's location */
herr_t ret_value = SUCCEED; /* Return value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf);
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Get info */
if(H5G__get_objinfo(&loc, name, follow_link, statbuf) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Retrieve object info, if pointer to struct is given */
if(statbuf) {
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
/* Fill out location struct */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = name;
loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
if(H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_GROUP_GET_OBJINFO, &loc_params, (unsigned)follow_link, statbuf) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name)
} /* end if */
done:
FUNC_LEAVE_API(ret_value)
@ -972,6 +1018,7 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c
H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/)
{
H5G_trav_goi_t *udata = (H5G_trav_goi_t *)_udata; /* User data passed in */
H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@ -980,48 +1027,43 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c
if(lnk == NULL && obj_loc == NULL)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name)
/* Only modify user's buffer if it's available */
if(udata->statbuf) {
H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */
/* Common code to retrieve the file's fileno */
if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno")
/* Common code to retrieve the file's fileno */
if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno")
/* Info for soft and UD links is gotten by H5L_get_info. If we have
* a hard link, follow it and get info on the object
*/
if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) {
H5O_info_t oinfo; /* Object information */
/* Info for soft and UD links is gotten by H5L_get_info. If we have
* a hard link, follow it and get info on the object
*/
if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) {
H5O_info_t oinfo; /* Object information */
/* Go retrieve the object information */
/* (don't need index & heap info) */
HDassert(obj_loc);
if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_HDR) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info")
/* Go retrieve the object information */
/* (don't need index & heap info) */
HDassert(obj_loc);
if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_HDR) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info")
/* Get mapped object type */
statbuf->type = H5G_map_obj_type(oinfo.type);
/* Get mapped object type */
statbuf->type = H5G_map_obj_type(oinfo.type);
/* Get object number (i.e. address) for object */
statbuf->objno[0] = (unsigned long)(oinfo.addr);
/* Get object number (i.e. address) for object */
statbuf->objno[0] = (unsigned long)(oinfo.addr);
#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
statbuf->objno[1] = (unsigned long)(oinfo.addr >> 8 * sizeof(long));
statbuf->objno[1] = (unsigned long)(oinfo.addr >> 8 * sizeof(long));
#else
statbuf->objno[1] = 0;
statbuf->objno[1] = 0;
#endif
/* Get # of hard links pointing to object */
statbuf->nlink = oinfo.rc;
/* Get # of hard links pointing to object */
statbuf->nlink = oinfo.rc;
/* Get modification time for object */
statbuf->mtime = oinfo.ctime;
/* Get modification time for object */
statbuf->mtime = oinfo.ctime;
/* Retrieve the object header information */
statbuf->ohdr.size = oinfo.hdr.space.total;
statbuf->ohdr.free = oinfo.hdr.space.free;
statbuf->ohdr.nmesgs = oinfo.hdr.nmesgs;
statbuf->ohdr.nchunks = oinfo.hdr.nchunks;
} /* end if */
/* Retrieve the object header information */
statbuf->ohdr.size = oinfo.hdr.space.total;
statbuf->ohdr.free = oinfo.hdr.space.free;
statbuf->ohdr.nmesgs = oinfo.hdr.nmesgs;
statbuf->ohdr.nchunks = oinfo.hdr.nchunks;
} /* end if */
done:
@ -1049,22 +1091,22 @@ done:
*
*-------------------------------------------------------------------------
*/
static herr_t
herr_t
H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link,
H5G_stat_t *statbuf/*out*/)
{
H5G_trav_goi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
FUNC_ENTER_PACKAGE
/* Sanity checks */
HDassert(loc);
HDassert(name && *name);
HDassert(statbuf);
/* Reset stat buffer, if one was given */
if(statbuf)
HDmemset(statbuf, 0, sizeof(H5G_stat_t));
/* Reset stat buffer */
HDmemset(statbuf, 0, sizeof(H5G_stat_t));
/* Set up user data for retrieving information */
udata.statbuf = statbuf;
@ -1072,12 +1114,11 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link,
udata.loc_file = loc->oloc->file;
/* Traverse the group hierarchy to locate the object to get info about */
if(H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : H5G_TARGET_SLINK|H5G_TARGET_UDLINK),
H5G__get_objinfo_cb, &udata) < 0)
if(H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : (H5G_TARGET_SLINK | H5G_TARGET_UDLINK)), H5G__get_objinfo_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist")
/* If we're pointing at a soft or UD link, get the real link length and type */
if(statbuf && follow_link == 0) {
if(follow_link == 0) {
H5L_info_t linfo; /* Link information buffer */
herr_t ret;
@ -1129,24 +1170,33 @@ done:
ssize_t
H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size)
{
H5G_loc_t loc; /* Object location */
H5O_type_t obj_type; /* Type of object at location */
ssize_t ret_value;
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("Zs", "ih*sz", loc_id, idx, name, size);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
if(H5O_obj_type(loc.oloc, &obj_type) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type")
if(obj_type != H5O_TYPE_GROUP)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set collective metadata read info")
/* Fill in location struct fields */
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = ".";
loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_NAME;
loc_params.loc_data.loc_by_idx.order = H5_ITER_INC;
loc_params.loc_data.loc_by_idx.n = idx;
loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Call internal function */
if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name")
if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get object name")
done:
FUNC_LEAVE_API(ret_value)
@ -1171,82 +1221,39 @@ done:
H5G_obj_t
H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
{
H5G_loc_t loc; /* Object location */
H5G_obj_t ret_value;
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
H5O_info_t oinfo; /* Object info (contains object type) */
unsigned fields; /* Which fields in object info to populate */
H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_API(H5G_UNKNOWN)
H5TRACE2("Go", "ih", loc_id, idx);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID")
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = ".";
loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_NAME;
loc_params.loc_data.loc_by_idx.order = H5_ITER_INC;
loc_params.loc_data.loc_by_idx.n = idx;
loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
loc_params.obj_type = H5I_get_type(loc_id);
/* Call internal function*/
if(H5G_UNKNOWN == (ret_value = H5G__obj_get_type_by_idx(loc.oloc, idx)))
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type")
/* Get the location object */
if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier")
/* Retrieve the object's basic information (which includes its type) */
fields = H5O_INFO_BASIC;
if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, &oinfo, fields) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info")
/* Map to group object type */
if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(oinfo.type)))
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gget_objtype_by_idx() */
/*-------------------------------------------------------------------------
* Function: H5G__obj_get_type_by_idx
*
* Purpose: Private function for H5Gget_objtype_by_idx.
* Returns the type of objects in the group by giving index.
*
* Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3)
*
* Failure: Negative
*
* Programmer: Raymond Lu
* Nov 20, 2002
*
*-------------------------------------------------------------------------
*/
static H5G_obj_t
H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx)
{
H5O_linfo_t linfo; /* Link info message */
htri_t linfo_exists; /* Whether the link info message exists */
H5O_type_t obj_type; /* Type of object at location */
H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */
FUNC_ENTER_STATIC_TAG(oloc->addr)
/* Sanity check */
HDassert(oloc);
/* Check args */
if(H5O_obj_type(oloc, &obj_type) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type")
if(obj_type != H5O_TYPE_GROUP)
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "not a group")
/* Attempt to get the link info for this group */
if((linfo_exists = H5G__obj_get_linfo(oloc, &linfo)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't check for link info message")
if(linfo_exists) {
if(H5F_addr_defined(linfo.fheap_addr)) {
/* Get the object's name from the dense link storage */
if((ret_value = H5G__dense_get_type_by_idx(oloc->file, &linfo, idx)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
} /* end if */
else {
/* Get the object's type from the link messages */
if((ret_value = H5G__compact_get_type_by_idx(oloc, &linfo, idx)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
} /* end else */
} /* end if */
else {
/* Get the object's type from the symbol table */
if((ret_value = H5G__stab_get_type_by_idx(oloc, idx)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
} /* end else */
done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5G__obj_get_type_by_idx() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */

View File

@ -39,7 +39,6 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
#include "H5VLnative_private.h" /* Native VOL driver */
/****************/
@ -579,7 +578,7 @@ H5G_oloc(H5G_t *grp)
*-------------------------------------------------------------------------
*/
H5G_name_t *
H5G_nameof(H5G_t *grp)
H5G_nameof(const H5G_t *grp)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@ -808,7 +807,7 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name,
*/
if(NULL == (grp = H5G__open_name(loc, group_name)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
if((gid = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0)
if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
/* Set up user data for callback */
@ -1070,7 +1069,7 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
/* Register an ID for the starting group */
if((gid = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0)
if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
/* Get the location of the starting group */

View File

@ -210,9 +210,6 @@ H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc)
break;
}
case H5I_REFERENCE:
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of reference")
case H5I_DATASPACE:
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of dataspace")

Some files were not shown because too many files have changed in this diff Show More