summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorM. Scot Breitenfeld <brtnfld@hdfgroup.org>2019-03-07 20:47:38 (GMT)
committerM. Scot Breitenfeld <brtnfld@hdfgroup.org>2019-03-07 20:47:38 (GMT)
commit07fde1e25c51e1c4294248311104ef02dbb7da21 (patch)
treeeeeebf3da31ab3a47716759985c375203cf04976 /src
parent5a51c3677e25e8426d6cd8532baa46244d645cf9 (diff)
parent8d2a047c25d2bd34c52c8d437802c309a9ae0985 (diff)
downloadhdf5-07fde1e25c51e1c4294248311104ef02dbb7da21.zip
hdf5-07fde1e25c51e1c4294248311104ef02dbb7da21.tar.gz
hdf5-07fde1e25c51e1c4294248311104ef02dbb7da21.tar.bz2
Merge branch 'develop' into H10621
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt83
-rw-r--r--src/H5A.c18
-rw-r--r--src/H5AC.c728
-rw-r--r--src/H5ACdbg.c115
-rw-r--r--src/H5AClog.c1105
-rw-r--r--src/H5ACpkg.h69
-rw-r--r--src/H5ACprivate.h6
-rw-r--r--src/H5Adense.c35
-rw-r--r--src/H5Adeprec.c6
-rw-r--r--src/H5Apkg.h15
-rw-r--r--src/H5Apublic.h18
-rw-r--r--src/H5B.c6
-rw-r--r--src/H5Bdbg.c6
-rw-r--r--src/H5C.c74
-rw-r--r--src/H5CX.c273
-rw-r--r--src/H5CXprivate.h9
-rw-r--r--src/H5Cdbg.c36
-rw-r--r--src/H5Cimage.c4
-rw-r--r--src/H5Clog.c946
-rw-r--r--src/H5Clog.h114
-rw-r--r--src/H5Clog_json.c1364
-rw-r--r--src/H5Clog_trace.c1007
-rw-r--r--src/H5Cmpio.c12
-rw-r--r--src/H5Cpkg.h50
-rw-r--r--src/H5Cprivate.h22
-rw-r--r--src/H5Cquery.c58
-rw-r--r--src/H5Ctag.c26
-rw-r--r--src/H5D.c8
-rw-r--r--src/H5Dchunk.c166
-rw-r--r--src/H5Dearray.c4
-rw-r--r--src/H5Dfarray.c4
-rw-r--r--src/H5Dint.c257
-rw-r--r--src/H5Dio.c45
-rw-r--r--src/H5Dmpio.c197
-rw-r--r--src/H5Dpkg.h9
-rw-r--r--src/H5Dprivate.h9
-rw-r--r--src/H5Dpublic.h23
-rw-r--r--src/H5E.c14
-rw-r--r--src/H5EAdbg.c6
-rw-r--r--src/H5EAtest.c2
-rw-r--r--src/H5Eint.c44
-rw-r--r--src/H5F.c166
-rw-r--r--src/H5FAtest.c2
-rw-r--r--src/H5FDcore.c182
-rw-r--r--src/H5FDdirect.c24
-rw-r--r--src/H5FDfamily.c19
-rw-r--r--src/H5FDlog.c38
-rw-r--r--src/H5FDmpio.c868
-rw-r--r--src/H5FDmulti.c25
-rw-r--r--src/H5FDsec2.c38
-rw-r--r--src/H5FL.c8
-rw-r--r--src/H5Fdeprec.c6
-rw-r--r--src/H5Fefc.c16
-rw-r--r--src/H5Fint.c94
-rw-r--r--src/H5Fmount.c4
-rw-r--r--src/H5Fmpi.c2
-rw-r--r--src/H5Fpkg.h32
-rw-r--r--src/H5Fprivate.h8
-rw-r--r--src/H5Fpublic.h9
-rw-r--r--src/H5Fquery.c19
-rw-r--r--src/H5Gdeprec.c28
-rw-r--r--src/H5Gloc.c3
-rw-r--r--src/H5Gname.c1
-rw-r--r--src/H5Gpkg.h16
-rw-r--r--src/H5Gpublic.h9
-rw-r--r--src/H5Gtest.c1
-rw-r--r--src/H5HFdbg.c2
-rw-r--r--src/H5I.c1
-rw-r--r--src/H5Ipublic.h4
-rw-r--r--src/H5L.c4
-rw-r--r--src/H5O.c21
-rw-r--r--src/H5Oattr.c7
-rw-r--r--src/H5Obogus.c4
-rw-r--r--src/H5Ocache.c20
-rw-r--r--src/H5Odeprec.c12
-rw-r--r--src/H5Ofill.c24
-rw-r--r--src/H5Oflush.c1
-rw-r--r--src/H5Oint.c275
-rw-r--r--src/H5Omessage.c25
-rw-r--r--src/H5Omtime.c2
-rw-r--r--src/H5Oname.c2
-rw-r--r--src/H5Opkg.h2
-rw-r--r--src/H5Oprivate.h24
-rw-r--r--src/H5Opublic.h7
-rw-r--r--src/H5Osdspace.c8
-rw-r--r--src/H5PB.c2
-rw-r--r--src/H5PLint.c17
-rw-r--r--src/H5PLpath.c10
-rw-r--r--src/H5PLpkg.h4
-rw-r--r--src/H5PLplugin_cache.c2
-rw-r--r--src/H5Pdcpl.c104
-rw-r--r--src/H5Pdxpl.c3
-rw-r--r--src/H5Pfapl.c111
-rw-r--r--src/H5Ppublic.h5
-rw-r--r--src/H5R.c8
-rw-r--r--src/H5Rdeprec.c2
-rw-r--r--src/H5Rint.c38
-rw-r--r--src/H5S.c406
-rw-r--r--src/H5ST.c16
-rw-r--r--src/H5Sall.c248
-rw-r--r--src/H5Sdbg.c18
-rw-r--r--src/H5Shyper.c4304
-rw-r--r--src/H5Smpio.c818
-rw-r--r--src/H5Snone.c499
-rw-r--r--src/H5Spkg.h32
-rw-r--r--src/H5Spoint.c779
-rw-r--r--src/H5Sprivate.h32
-rw-r--r--src/H5Spublic.h61
-rw-r--r--src/H5Sselect.c416
-rw-r--r--src/H5Stest.c57
-rw-r--r--src/H5T.c109
-rw-r--r--src/H5Tcommit.c4
-rw-r--r--src/H5Tconv.c2
-rw-r--r--src/H5Torder.c4
-rw-r--r--src/H5Tprivate.h1
-rw-r--r--src/H5VL.c87
-rw-r--r--src/H5VLcallback.c197
-rw-r--r--src/H5VLint.c46
-rw-r--r--src/H5VLnative.c3501
-rw-r--r--src/H5VLnative.h58
-rw-r--r--src/H5VLnative_attr.c597
-rw-r--r--src/H5VLnative_dataset.c575
-rw-r--r--src/H5VLnative_datatype.c265
-rw-r--r--src/H5VLnative_file.c830
-rw-r--r--src/H5VLnative_group.c363
-rw-r--r--src/H5VLnative_link.c435
-rw-r--r--src/H5VLnative_object.c482
-rw-r--r--src/H5VLnative_private.h88
-rw-r--r--src/H5VLpassthru.c821
-rw-r--r--src/H5VLprivate.h2
-rw-r--r--src/H5VLpublic.h73
-rw-r--r--src/H5VM.c2
-rw-r--r--src/H5Z.c2
-rw-r--r--src/H5Zscaleoffset.c5
-rw-r--r--src/H5Ztrans.c4
-rw-r--r--src/H5dbg.c2
-rw-r--r--src/H5err.txt2
-rw-r--r--src/H5private.h17
-rw-r--r--src/H5system.c59
-rw-r--r--src/H5timer.c16
-rw-r--r--src/H5trace.c191
-rw-r--r--src/H5win32defs.h8
-rw-r--r--src/Makefile.am11
-rw-r--r--src/libhdf5.settings.in1
144 files changed, 13693 insertions, 12215 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cd81ba5..83240bd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -39,7 +39,6 @@ IDE_GENERATED_PROPERTIES ("H5A" "${H5A_HDRS}" "${H5A_SOURCES}" )
set (H5AC_SOURCES
${HDF5_SRC_DIR}/H5AC.c
${HDF5_SRC_DIR}/H5ACdbg.c
- ${HDF5_SRC_DIR}/H5AClog.c
${HDF5_SRC_DIR}/H5ACmpio.c
${HDF5_SRC_DIR}/H5ACproxy_entry.c
)
@@ -81,6 +80,8 @@ set (H5C_SOURCES
${HDF5_SRC_DIR}/H5Cepoch.c
${HDF5_SRC_DIR}/H5Cimage.c
${HDF5_SRC_DIR}/H5Clog.c
+ ${HDF5_SRC_DIR}/H5Clog_json.c
+ ${HDF5_SRC_DIR}/H5Clog_trace.c
${HDF5_SRC_DIR}/H5Cmpio.c
${HDF5_SRC_DIR}/H5Cprefetched.c
${HDF5_SRC_DIR}/H5Cquery.c
@@ -628,6 +629,13 @@ set (H5VL_SOURCES
${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
@@ -772,6 +780,7 @@ set (H5_PRIVATE_HEADERS
${HDF5_SRC_DIR}/H5B2pkg.h
${HDF5_SRC_DIR}/H5B2private.h
+ ${HDF5_SRC_DIR}/H5Clog.h
${HDF5_SRC_DIR}/H5Cpkg.h
${HDF5_SRC_DIR}/H5Cprivate.h
@@ -869,6 +878,7 @@ set (H5_PRIVATE_HEADERS
${HDF5_SRC_DIR}/H5UCprivate.h
+ ${HDF5_SRC_DIR}/H5VLnative_private.h
${HDF5_SRC_DIR}/H5VLpkg.h
${HDF5_SRC_DIR}/H5VLprivate.h
@@ -933,6 +943,27 @@ if (BUILD_SHARED_LIBS)
file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared")
endif ()
+if (LOCAL_BATCH_TEST)
+ if (LOCAL_BATCH_SCRIPT_COMMAND STREQUAL "raybsub")
+ configure_file (
+ ${HDF5_SOURCE_DIR}/bin/batch/${LOCAL_BATCH_SCRIPT_COMMAND}
+ ${HDF5_BINARY_DIR}/${LOCAL_BATCH_SCRIPT_COMMAND} ESCAPE_QUOTES @ONLY
+ )
+ endif ()
+ if (LOCAL_BATCH_SCRIPT_NAME)
+ configure_file (
+ ${HDF5_SOURCE_DIR}/bin/batch/${LOCAL_BATCH_SCRIPT_NAME}.in.cmake
+ ${HDF5_BINARY_DIR}/${LOCAL_BATCH_SCRIPT_NAME} ESCAPE_QUOTES @ONLY
+ )
+ endif ()
+ if (LOCAL_BATCH_SCRIPT_PARALLEL_NAME)
+ configure_file (
+ ${HDF5_SOURCE_DIR}/bin/batch/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}.in.cmake
+ ${HDF5_BINARY_DIR}/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME} ESCAPE_QUOTES @ONLY
+ )
+ endif ()
+endif ()
+
if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c)
add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c)
target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
@@ -950,10 +981,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}
)
@@ -963,31 +997,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)
@@ -1001,8 +1066,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}
)
@@ -1010,9 +1078,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 ()
@@ -1025,8 +1097,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}>"
@@ -1046,6 +1118,11 @@ target_link_libraries (${HDF5_LIB_TARGET}
PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
PUBLIC $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}>
)
+if (NOT WIN32)
+ target_link_libraries (${HDF5_LIB_TARGET}
+ PUBLIC $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ )
+endif ()
set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET})
H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC 0)
set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries)
@@ -1055,8 +1132,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}>"
diff --git a/src/H5A.c b/src/H5A.c
index 0d20912..9c3ad7e 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -951,6 +951,8 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
if(!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(!name && size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name cannot be NULL if size is non-zero")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
@@ -1046,6 +1048,8 @@ 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);
@@ -1199,10 +1203,16 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name)
H5TRACE3("e", "i*s*s", loc_id, old_name, new_name);
/* check arguments */
- if(!old_name || !new_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil")
if(H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
+ if(!old_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "old attribute name cannot be NULL")
+ if(!*old_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "old attribute name cannot be an empty string")
+ if(!new_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new attribute name cannot be NULL")
+ if(!*new_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new attribute name cannot be an empty string")
/* Avoid thrashing things if the names are the same */
if(HDstrcmp(old_name, new_name)) {
@@ -1358,7 +1368,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, &loc_params, 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:
@@ -1446,7 +1456,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, &loc_params, 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:
diff --git a/src/H5AC.c b/src/H5AC.c
index 9894e39..dc88fd4 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -30,22 +30,24 @@
/****************/
#include "H5ACmodule.h" /* This source code file is part of the H5AC module */
-#define H5F_FRIEND /* Suppress error about including H5Fpkg */
+#define H5C_FRIEND /* Suppress error about including H5Cpkg */
+#define H5F_FRIEND /* Suppress error about including H5Fpkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACpkg.h" /* Metadata cache */
-#include "H5Cprivate.h" /* Cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5SLprivate.h" /* Skip Lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACpkg.h" /* Metadata cache */
+#include "H5Clog.h" /* Cache logging */
+#include "H5Cpkg.h" /* Cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5SLprivate.h" /* Skip Lists */
/****************/
@@ -128,7 +130,7 @@ static const H5AC_class_t *const H5AC_class_s[] = {
H5AC_DRVRINFO, /* (26) driver info block (supplements superblock) */
H5AC_EPOCH_MARKER, /* (27) epoch marker - always internal to cache */
H5AC_PROXY_ENTRY, /* (28) cache entry proxy */
- H5AC_PREFETCHED_ENTRY /* (29) prefetched entry - always internal to cache */
+ H5AC_PREFETCHED_ENTRY /* (29) prefetched entry - always internal to cache */
};
@@ -178,13 +180,16 @@ H5AC__init_package(void)
#ifdef H5_HAVE_PARALLEL
/* check whether to enable strict collective function calling
- sanity checks using MPI barriers */
+ * sanity checks using MPI barriers
+ */
{
const char *s; /* String for environment variables */
s = HDgetenv("H5_COLL_API_SANITY_CHECK");
- if(s && HDisdigit(*s))
- H5_coll_api_sanity_check_g = (hbool_t)HDstrtol(s, NULL, 0);
+ if(s && HDisdigit(*s)) {
+ long env_val = HDstrtol(s, NULL, 0);
+ H5_coll_api_sanity_check_g = (0 == env_val) ? FALSE : TRUE;
+ }
}
#endif /* H5_HAVE_PARALLEL */
@@ -344,7 +349,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co
aux_ptr->sync_point_done = NULL;
aux_ptr->p0_image_len = 0;
- sprintf(prefix, "%d:", mpi_rank);
+ HDsprintf(prefix, "%d:", mpi_rank);
if(mpi_rank == 0) {
if(NULL == (aux_ptr->d_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
@@ -403,15 +408,13 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "H5C_set_prefix() failed")
#endif /* H5_HAVE_PARALLEL */
- /* Turn on metadata cache logging, if being used */
- if(H5F_USE_MDC_LOGGING(f)) {
- if(H5C_set_up_logging(f->shared->cache, H5F_MDC_LOG_LOCATION(f), H5F_START_MDC_LOG_ON_ACCESS(f)) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTINIT, FAIL, "mdc logging setup failed")
-
- /* Write the log header regardless of current logging status */
- if(H5AC__write_create_cache_log_msg(f->shared->cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
- } /* end if */
+ /* Turn on metadata cache logging, if being used
+ * This will be JSON until we create a special API call. Trace output
+ * is generated when logging is controlled by the struct.
+ */
+ if(H5F_USE_MDC_LOGGING(f))
+ if(H5C_log_set_up(f->shared->cache, H5F_MDC_LOG_LOCATION(f), H5C_LOG_STYLE_JSON, H5F_START_MDC_LOG_ON_ACCESS(f)) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging setup failed")
/* Set the cache parameters */
if(H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0)
@@ -431,6 +434,11 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co
HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "auto resize configuration failed")
done:
+ /* If currently logging, generate a message */
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_create_cache_msg(f->shared->cache, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
#ifdef H5_HAVE_PARALLEL
/* if there is a failure, try to tidy up the auxiliary structure */
if(ret_value < 0) {
@@ -469,6 +477,8 @@ done:
herr_t
H5AC_dest(H5F_t *f)
{
+ hbool_t log_enabled; /* TRUE if logging was set up */
+ hbool_t curr_logging; /* TRUE if currently logging */
#ifdef H5_HAVE_PARALLEL
H5AC_aux_t * aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
@@ -486,18 +496,16 @@ H5AC_dest(H5F_t *f)
H5AC_stats(f);
#endif /* H5AC_DUMP_STATS_ON_CLOSE */
-#if H5AC__TRACE_FILE_ENABLED
- if(H5AC__close_trace_file(f->shared->cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__close_trace_file() failed")
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
- if(H5F_USE_MDC_LOGGING(f)) {
- /* Write the log footer regardless of current logging status */
- if(H5AC__write_destroy_cache_log_msg(f->shared->cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
- if(H5C_tear_down_logging(f->shared->cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "mdc logging tear-down failed")
- } /* end if */
+ /* Check if log messages are being emitted */
+ if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to get logging status")
+ if(log_enabled && curr_logging)
+ if(H5C_log_write_destroy_cache_msg(f->shared->cache) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+ /* Tear down logging */
+ if(log_enabled)
+ if(H5C_log_tear_down(f->shared->cache) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging tear-down failed")
#ifdef H5_HAVE_PARALLEL
/* destroying the cache, so clear all collective entries */
@@ -565,8 +573,6 @@ done:
herr_t
H5AC_evict(H5F_t *f)
{
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -576,10 +582,6 @@ H5AC_evict(H5F_t *f)
HDassert(f->shared);
HDassert(f->shared->cache);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
/* Evict all entries in the cache except the pinned superblock entry */
if(H5C_evict(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't evict cache")
@@ -587,9 +589,9 @@ H5AC_evict(H5F_t *f)
done:
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_evict_cache_log_msg(f->shared->cache, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_evict_cache_msg(f->shared->cache, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_evict() */
@@ -613,12 +615,6 @@ herr_t
H5AC_expunge_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
unsigned flags)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -631,36 +627,14 @@ H5AC_expunge_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
HDassert(type->serialize);
HDassert(H5F_addr_defined(addr));
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
-#if H5AC__TRACE_FILE_ENABLED
-{
- H5AC_t * cache_ptr = f->shared->cache;
-
- /* For the expunge entry call, only the addr, and type id are really
- * necessary in the trace file. Write the return value to catch occult
- * errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- sprintf(trace, "%s 0x%lx %d", FUNC, (unsigned long)addr, (int)(type->id));
-}
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
if(H5C_expunge_entry(f, type, addr, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "H5C_expunge_entry() failed")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_expunge_entry_log_msg(f->shared->cache, addr, type->id, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_expunge_entry_msg(f->shared->cache, addr, type->id, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_expunge_entry() */
@@ -689,12 +663,6 @@ done:
herr_t
H5AC_flush(H5F_t *f)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -704,18 +672,6 @@ H5AC_flush(H5F_t *f)
HDassert(f->shared);
HDassert(f->shared->cache);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
-#if H5AC__TRACE_FILE_ENABLED
- /* For the flush, only the flags are really necessary in the trace file.
- * Write the result to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- sprintf(trace, "%s", FUNC);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
#ifdef H5_HAVE_PARALLEL
/* flushing the cache, so clear all collective entries */
if(H5C_clear_coll_entries(f->shared->cache, FALSE) < 0)
@@ -732,15 +688,10 @@ H5AC_flush(H5F_t *f)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_flush_cache_log_msg(f->shared->cache, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_flush_cache_msg(f->shared->cache, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_flush() */
@@ -873,13 +824,6 @@ herr_t
H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
unsigned int flags)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- size_t trace_entry_size = 0;
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -893,26 +837,9 @@ H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
HDassert(H5F_addr_defined(addr));
HDassert(thing);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
/* Check for invalid access request */
if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file")
-
-#if H5AC__TRACE_FILE_ENABLED
- /* For the insert, only the addr, size, type id and flags are really
- * necessary in the trace file. Write the result to catch occult
- * errors.
- *
- * Note that some data is not available right now -- put what we can
- * in the trace buffer now, and fill in the rest at the end.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- sprintf(trace, "%s 0x%lx %d 0x%x", FUNC, (unsigned long)addr, type->id,
- flags);
-#endif /* H5AC__TRACE_FILE_ENABLED */
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file")
#if H5AC_DO_TAGGING_SANITY_CHECKS
if(!H5C_get_ignore_tags(f->shared->cache) && H5AC__verify_tag(type) < 0)
@@ -923,12 +850,6 @@ H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
if(H5C_insert_entry(f, type, addr, thing, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C_insert_entry() failed")
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- /* make note of the entry size */
- trace_entry_size = ((H5C_cache_entry_t *)thing)->size;
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
#ifdef H5_HAVE_PARALLEL
{
H5AC_aux_t *aux_ptr;
@@ -947,14 +868,10 @@ H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
#endif /* H5_HAVE_PARALLEL */
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s %d %d\n", trace, (int)trace_entry_size, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_insert_entry_log_msg(f->shared->cache, addr, type->id, flags, ((H5C_cache_entry_t *)thing)->size, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_insert_entry_msg(f->shared->cache, addr, type->id, flags, ((H5C_cache_entry_t *)thing)->size, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_insert_entry() */
@@ -1011,12 +928,6 @@ done:
herr_t
H5AC_mark_entry_dirty(void *thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1030,19 +941,6 @@ H5AC_mark_entry_dirty(void *thing)
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
-#if H5AC__TRACE_FILE_ENABLED
- /* For the mark pinned or protected entry dirty call, only the addr
- * is really necessary in the trace file. Write the result to catch
- * occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing)))
- sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(entry_ptr->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
#ifdef H5_HAVE_PARALLEL
{
H5AC_aux_t *aux_ptr;
@@ -1059,15 +957,10 @@ H5AC_mark_entry_dirty(void *thing)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned or protected entry dirty")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_mark_dirty_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_mark_entry_dirty_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_dirty() */
@@ -1076,7 +969,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5AC_mark_entry_clean
*
- * Purpose: Mark a pinned entry as dirty. The target
+ * Purpose: Mark a pinned entry as clean. The target
* entry MUST be pinned.
*
* Return: Non-negative on success/Negative on failure
@@ -1089,12 +982,6 @@ done:
herr_t
H5AC_mark_entry_clean(void *thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1104,23 +991,9 @@ H5AC_mark_entry_clean(void *thing)
/* Sanity check */
HDassert(thing);
-#if H5AC__TRACE_FILE_ENABLED
- /* For the mark pinned or protected entry clean call, only the addr
- * is really necessary in the trace file. Write the result to catch
- * occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing)))
- sprintf(trace, "%s 0x%lx", FUNC,
- (unsigned long)(((H5C_cache_entry_t *)thing)->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
#ifdef H5_HAVE_PARALLEL
{
H5AC_aux_t *aux_ptr;
@@ -1137,15 +1010,10 @@ H5AC_mark_entry_clean(void *thing)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "can't mark pinned or protected entry clean")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_mark_clean_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_mark_entry_clean_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_clean() */
@@ -1167,12 +1035,6 @@ done:
herr_t
H5AC_mark_entry_unserialized(void *thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1186,32 +1048,14 @@ H5AC_mark_entry_unserialized(void *thing)
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
-#if H5AC__TRACE_FILE_ENABLED
- /* For the mark entry unserialized call, only the addr
- * is really necessary in the trace file. Write the result to catch
- * occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing)))
- sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(entry_ptr->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get logging status")
-
if(H5C_mark_entry_unserialized(thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKUNSERIALIZED, FAIL, "can't mark entry unserialized")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_mark_unserialized_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_mark_unserialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_unserialized() */
@@ -1233,12 +1077,6 @@ done:
herr_t
H5AC_mark_entry_serialized(void *thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1248,36 +1086,17 @@ H5AC_mark_entry_serialized(void *thing)
/* Sanity check */
HDassert(thing);
-#if H5AC__TRACE_FILE_ENABLED
- /* For the mark entry serializedn call, only the addr
- * is really necessary in the trace file. Write the result to catch
- * occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing)))
- sprintf(trace, "%s 0x%lx", FUNC,
- (unsigned long)(((H5C_cache_entry_t *)thing)->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get logging status")
-
if(H5C_mark_entry_serialized(thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL, "can't mark entry serialized")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_mark_serialized_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_mark_serialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_serialized() */
@@ -1300,15 +1119,9 @@ done:
herr_t
H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
#ifdef H5_HAVE_PARALLEL
H5AC_aux_t *aux_ptr;
#endif /* H5_HAVE_PARALLEL */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1321,20 +1134,6 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne
HDassert(H5F_addr_defined(new_addr));
HDassert(H5F_addr_ne(old_addr, new_addr));
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
-#if H5AC__TRACE_FILE_ENABLED
- /* For the move call, only the old addr and new addr are really
- * necessary in the trace file. Include the type id so we don't have to
- * look it up. Also write the result to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- sprintf(trace, "%s 0x%lx 0x%lx %d", FUNC, (unsigned long)old_addr,
- (unsigned long)new_addr, (int)(type->id));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
#ifdef H5_HAVE_PARALLEL
/* Log moving the entry */
if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache)))
@@ -1353,15 +1152,10 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne
#endif /* H5_HAVE_PARALLEL */
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_move_entry_log_msg(f->shared->cache, old_addr, new_addr, type->id, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_move_entry_msg(f->shared->cache, old_addr, new_addr, type->id, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_move_entry() */
@@ -1383,12 +1177,6 @@ done:
herr_t
H5AC_pin_protected_entry(void *thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1398,37 +1186,19 @@ H5AC_pin_protected_entry(void *thing)
/* Sanity check */
HDassert(thing);
-#if H5AC__TRACE_FILE_ENABLED
- /* For the pin protected entry call, only the addr is really necessary
- * in the trace file. Also write the result to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing)))
- sprintf(trace, "%s 0x%lx", FUNC,
- (unsigned long)(((H5C_cache_entry_t *)thing)->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
HDassert(cache_ptr);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
/* Pin entry */
if(H5C_pin_protected_entry(thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "can't pin entry")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_pin_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_pin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_pin_protected_entry() */
@@ -1488,12 +1258,6 @@ done:
herr_t
H5AC_create_flush_dependency(void * parent_thing, void * child_thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1504,35 +1268,19 @@ H5AC_create_flush_dependency(void * parent_thing, void * child_thing)
HDassert(parent_thing);
HDassert(child_thing);
-#if H5AC__TRACE_FILE_ENABLED
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(parent_thing)))
- sprintf(trace, "%s %lx %lx", FUNC,
- (unsigned long)(((H5C_cache_entry_t *)parent_thing)->addr),
- (unsigned long)(((H5C_cache_entry_t *)child_thing)->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
entry_ptr = (H5AC_info_t *)parent_thing;
cache_ptr = entry_ptr->cache_ptr;
HDassert(cache_ptr);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
/* Create the flush dependency */
if(H5C_create_flush_dependency(parent_thing, child_thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "H5C_create_flush_dependency() failed")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_create_fd_log_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_create_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_create_flush_dependency() */
@@ -1566,14 +1314,7 @@ void *
H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata,
unsigned flags)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- size_t trace_entry_size = 0;
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
void * thing = NULL; /* Pointer to native data structure for entry */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
void * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1586,10 +1327,6 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata,
HDassert(type->serialize);
HDassert(H5F_addr_defined(addr));
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "unable to get logging status")
-
/* Check for unexpected flags -- H5C__FLUSH_COLLECTIVELY_FLAG
* only permitted in the parallel case.
*/
@@ -1606,16 +1343,6 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata,
if((0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) && (0 == (flags & H5C__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "no write intent on file")
-#if H5AC__TRACE_FILE_ENABLED
- /* For the protect call, only the addr, size, type id, and flags are
- * necessary in the trace file. Also indicate whether the call was
- * successful to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- sprintf(trace, "%s 0x%lx %d 0x%x", FUNC, (unsigned long)addr,
- (int)(type->id), flags);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
#if H5AC_DO_TAGGING_SANITY_CHECKS
if(!H5C_get_ignore_tags(f->shared->cache) && H5AC__verify_tag(type) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Bad tag value")
@@ -1624,28 +1351,18 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata,
if(NULL == (thing = H5C_protect(f, type, addr, udata, flags)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_protect() failed")
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- /* Make note of the entry size */
- trace_entry_size = ((H5C_cache_entry_t *)thing)->size;
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* Set return value */
ret_value = thing;
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s %d %d\n", trace, (int)trace_entry_size, (int)(ret_value != NULL));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging) {
+ {
herr_t fake_ret_value = (NULL == ret_value) ? FAIL : SUCCEED;
- if(H5AC__write_protect_entry_log_msg(f->shared->cache, (H5AC_info_t *)thing, flags, fake_ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, NULL, "unable to emit log message")
- } /* end if */
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_protect_entry_msg(f->shared->cache, (H5AC_info_t *)thing, type->id, flags, fake_ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, NULL, "unable to emit log message")
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_protect() */
@@ -1666,12 +1383,6 @@ done:
herr_t
H5AC_resize_entry(void *thing, size_t new_size)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1681,25 +1392,10 @@ H5AC_resize_entry(void *thing, size_t new_size)
/* Sanity check */
HDassert(thing);
-#if H5AC__TRACE_FILE_ENABLED
- /* For the resize pinned entry call, only the addr, and new_size are
- * really necessary in the trace file. Write the result to catch
- * occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing)))
- sprintf(trace, "%s 0x%lx %d", FUNC,
- (unsigned long)(((H5C_cache_entry_t *)thing)->addr),
- (int)new_size);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
HDassert(cache_ptr);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
/* Resize the entry */
if(H5C_resize_entry(thing, new_size) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "can't resize entry")
@@ -1716,15 +1412,10 @@ H5AC_resize_entry(void *thing, size_t new_size)
#endif /* H5_HAVE_PARALLEL */
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_resize_entry_log_msg(cache_ptr, entry_ptr, new_size, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_resize_entry_msg(cache_ptr, entry_ptr, new_size, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_resize_entry() */
@@ -1746,12 +1437,6 @@ done:
herr_t
H5AC_unpin_entry(void *thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1761,37 +1446,19 @@ H5AC_unpin_entry(void *thing)
/* Sanity check */
HDassert(thing);
-#if H5AC__TRACE_FILE_ENABLED
- /* For the unpin entry call, only the addr is really necessary
- * in the trace file. Also write the result to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing)))
- sprintf(trace, "%s 0x%lx", FUNC,
- (unsigned long)(((H5C_cache_entry_t *)thing)->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
HDassert(cache_ptr);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
/* Unpin the entry */
if(H5C_unpin_entry(thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_unpin_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_unpin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_unpin_entry() */
@@ -1812,12 +1479,6 @@ done:
herr_t
H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1828,35 +1489,19 @@ H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing)
HDassert(parent_thing);
HDassert(child_thing);
-#if H5AC__TRACE_FILE_ENABLED
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(parent_thing)))
- sprintf(trace, "%s %llx %llx", FUNC,
- (unsigned long long)(((H5C_cache_entry_t *)parent_thing)->addr),
- (unsigned long long)(((H5C_cache_entry_t *)child_thing)->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
entry_ptr = (H5AC_info_t *)parent_thing;
cache_ptr = entry_ptr->cache_ptr;
HDassert(cache_ptr);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
/* Destroy the flush dependency */
if(H5C_destroy_flush_dependency(parent_thing, child_thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "H5C_destroy_flush_dependency() failed")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_destroy_fd_log_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_destroy_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_destroy_flush_dependency() */
@@ -1904,17 +1549,11 @@ herr_t
H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
unsigned flags)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
hbool_t dirtied;
hbool_t deleted;
#ifdef H5_HAVE_PARALLEL
H5AC_aux_t * aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1931,19 +1570,6 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
HDassert( ((H5AC_info_t *)thing)->addr == addr );
HDassert( ((H5AC_info_t *)thing)->type == type );
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
-#if H5AC__TRACE_FILE_ENABLED
- /* For the unprotect call, only the addr, type id, flags, and possible
- * new size are really necessary in the trace file. Write the return
- * value to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- sprintf(trace, "%s 0x%lx %d", FUNC, (unsigned long)addr, (int)(type->id));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
dirtied = (hbool_t)(((flags & H5AC__DIRTIED_FLAG) == H5AC__DIRTIED_FLAG) ||
(((H5AC_info_t *)thing)->dirtied));
deleted = (hbool_t)((flags & H5C__DELETED_FLAG) == H5C__DELETED_FLAG);
@@ -1984,15 +1610,10 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
#endif /* H5_HAVE_PARALLEL */
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s 0x%x %d\n", trace, (unsigned)flags, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_unprotect_entry_log_msg(f->shared->cache, (H5AC_info_t *)thing, type->id, flags, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_unprotect_entry_msg(f->shared->cache, addr, type->id, flags, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_unprotect() */
@@ -2191,12 +1812,6 @@ done:
herr_t
H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr)
{
-#if H5AC__TRACE_FILE_ENABLED
- H5AC_cache_config_t trace_config = H5AC__DEFAULT_CACHE_CONFIG;
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5C_auto_size_ctl_t internal_config;
herr_t ret_value = SUCCEED; /* Return value */
@@ -2205,18 +1820,6 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config
/* Sanity checks */
HDassert(cache_ptr);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
-#if H5AC__TRACE_FILE_ENABLED
- /* Make note of the new configuration. Don't look up the trace file
- * pointer, as that may change before we use it.
- */
- if(config_ptr != NULL)
- trace_config = *config_ptr;
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
if(cache_ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry")
#ifdef H5_HAVE_PARALLEL
@@ -2233,23 +1836,25 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config
if(H5AC_validate_config(config_ptr) != SUCCEED)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache configuration")
- if(config_ptr->open_trace_file) {
- FILE * file_ptr;
-
- if(NULL == (file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_trace_file_ptr() failed")
-
- if((!(config_ptr->close_trace_file)) && (file_ptr != NULL))
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Trace file already open")
- } /* end if */
-
- /* Close & reopen trace file, if requested */
+ /* If the cache config struct is being used to control logging, perform
+ * the open/close operations. Note that this is the only place where the
+ * struct-based control opens and closes the log files so we also have
+ * to write start/stop messages.
+ */
+ /* close */
if(config_ptr->close_trace_file)
- if(H5AC__close_trace_file(cache_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__close_trace_file() failed")
- if(config_ptr->open_trace_file)
- if(H5AC__open_trace_file(cache_ptr, config_ptr->trace_file_name) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "H5AC__open_trace_file() failed")
+ if(H5C_log_tear_down((H5C_t *)cache_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging tear-down failed")
+
+ /* open */
+ if(config_ptr->open_trace_file) {
+ /* Turn on metadata cache logging.
+ * This will be trace output until we create a special API call. JSON
+ * output is generated when logging is controlled by the H5P calls.
+ */
+ if(H5C_log_set_up((H5C_t *)cache_ptr, config_ptr->trace_file_name, H5C_LOG_STYLE_TRACE, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging setup failed")
+ }
/* Convert external configuration to internal representation */
if(H5AC__ext_config_2_int_config(config_ptr, &internal_config) < 0)
@@ -2275,52 +1880,10 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config
#endif /* H5_HAVE_PARALLEL */
done:
-#if H5AC__TRACE_FILE_ENABLED
- /* For the set cache auto resize config call, only the contents
- * of the config is necessary in the trace file. Write the return
- * value to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- HDfprintf(trace_file_ptr,
- "%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f %d %d %d %f %f %d %d %d %d %f %zu %d %d\n",
- "H5AC_set_cache_auto_resize_config",
- trace_config.version,
- (int)(trace_config.rpt_fcn_enabled),
- (int)(trace_config.open_trace_file),
- (int)(trace_config.close_trace_file),
- trace_config.trace_file_name,
- (int)(trace_config.evictions_enabled),
- (int)(trace_config.set_initial_size),
- (int)(trace_config.initial_size),
- trace_config.min_clean_fraction,
- (int)(trace_config.max_size),
- (int)(trace_config.min_size),
- trace_config.epoch_length,
- (int)(trace_config.incr_mode),
- trace_config.lower_hr_threshold,
- trace_config.increment,
- (int)(trace_config.flash_incr_mode),
- trace_config.flash_multiple,
- trace_config.flash_threshold,
- (int)(trace_config.apply_max_increment),
- (int)(trace_config.max_increment),
- (int)(trace_config.decr_mode),
- trace_config.upper_hr_threshold,
- trace_config.decrement,
- (int)(trace_config.apply_max_decrement),
- (int)(trace_config.max_decrement),
- trace_config.epochs_before_eviction,
- (int)(trace_config.apply_empty_reserve),
- trace_config.empty_reserve,
- trace_config.dirty_bytes_threshold,
- trace_config.metadata_write_strategy,
- (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_set_cache_config_log_msg(cache_ptr, config_ptr, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_set_cache_config_msg(cache_ptr, config_ptr, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_set_cache_auto_resize_config() */
@@ -2366,12 +1929,12 @@ H5AC_validate_config(H5AC_cache_config_t *config_ptr)
if(config_ptr->open_trace_file) {
size_t name_len;
- /* Can't really test the trace_file_name field without trying to
- * open the file, so we will content ourselves with a couple of
- * sanity checks on the length of the file name.
- */
- name_len = HDstrlen(config_ptr->trace_file_name);
- if(name_len == 0)
+ /* Can't really test the trace_file_name field without trying to
+ * open the file, so we will content ourselves with a couple of
+ * sanity checks on the length of the file name.
+ */
+ name_len = HDstrlen(config_ptr->trace_file_name);
+ if(name_len == 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name is empty")
else if(name_len > H5AC__MAX_TRACE_FILE_NAME_LEN)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name too long")
@@ -2840,8 +2403,18 @@ H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked)
HDassert(H5F_addr_defined(obj_addr));
HDassert(action == H5AC__SET_CORK || action == H5AC__UNCORK || action == H5AC__GET_CORKED);
- if(action == H5AC__GET_CORKED)
- HDassert(corked);
+ /* Skip the search on "tag_list" when there are no "corked" objects.
+ * This is done to mitigate the slow down when closing objects.
+ * Re-visit this optimization when we optimize tag info management
+ * in the future.
+ */
+ if(action == H5AC__GET_CORKED) {
+ HDassert(corked);
+ if(H5C_get_num_objs_corked(f->shared->cache) == 0) {
+ *corked = FALSE;
+ HGOTO_DONE(SUCCEED)
+ }
+ }
if(H5C_cork(f->shared->cache, obj_addr, action, corked) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Cannot perform the cork action")
@@ -3062,12 +2635,6 @@ H5AC_remove_entry(void *_entry)
{
H5AC_info_t *entry = (H5AC_info_t *)_entry; /* Entry to remove */
H5C_t *cache = NULL; /* Pointer to the entry's associated metadata cache */
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -3077,32 +2644,15 @@ H5AC_remove_entry(void *_entry)
cache = entry->cache_ptr;
HDassert(cache);
-#if H5AC__TRACE_FILE_ENABLED
- /* For the remove entry call, only the addr is really necessary
- * in the trace file. Also write the result to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(entry)))
- sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(entry->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get logging status")
-
/* Remove the entry from the cache*/
if(H5C_remove_entry(entry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_remove_entry_log_msg(cache, entry, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache->log_info->logging)
+ if(H5C_log_write_remove_entry_msg(cache, entry, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_remove_entry() */
diff --git a/src/H5ACdbg.c b/src/H5ACdbg.c
index c6d71a8..1235206 100644
--- a/src/H5ACdbg.c
+++ b/src/H5ACdbg.c
@@ -136,121 +136,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5AC__close_trace_file()
- *
- * Purpose: If a trace file is open, stop logging calls to the cache,
- * and close the file.
- *
- * Note that the function does nothing if there is no trace
- * file.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 6/2/06
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__close_trace_file(H5AC_t *cache_ptr)
-{
- FILE * trace_file_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- if(cache_ptr == NULL)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "NULL cache_ptr on entry.")
-
- if(NULL == (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_trace_file_ptr() failed.")
-
- if(trace_file_ptr != NULL) {
- if(H5C_set_trace_file_ptr(cache_ptr, NULL) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_trace_file_ptr() failed.")
-
- if(HDfclose(trace_file_ptr) != 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close metadata cache trace file")
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__close_trace_file() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__open_trace_file()
- *
- * Purpose: Open a trace file, and start logging calls to the cache.
- *
- * This logging is done at the H5C level, and will only take
- * place if H5C_TRACE_FILE_ENABLED (defined in H5Cprivate.h)
- * is TRUE.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 6/1/06
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__open_trace_file(H5AC_t *cache_ptr, const char *trace_file_name)
-{
- char file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + H5C__PREFIX_LEN + 2];
- FILE * file_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- HDassert(cache_ptr);
-
- /* Check args */
- if(cache_ptr == NULL)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "cache_ptr NULL on entry.")
- if(trace_file_name == NULL)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "NULL trace_file_name on entry.")
- if(HDstrlen(trace_file_name) > H5AC__MAX_TRACE_FILE_NAME_LEN)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "trace file name too long.")
- if(NULL != (file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- HGOTO_ERROR(H5E_CACHE, H5E_FILEOPEN, FAIL, "trace file already open.")
-
-#ifdef H5_HAVE_PARALLEL
-{
- H5AC_aux_t * aux_ptr;
-
- aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
- if(aux_ptr == NULL)
- sprintf(file_name, "%s", trace_file_name);
- else {
- if(aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad aux_ptr->magic.")
-
- sprintf(file_name, "%s.%d", trace_file_name, aux_ptr->mpi_rank);
- } /* end else */
-
- if(HDstrlen(file_name) > H5AC__MAX_TRACE_FILE_NAME_LEN + H5C__PREFIX_LEN + 1)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cooked trace file name too long.")
-}
-#else /* H5_HAVE_PARALLEL */
- HDsnprintf(file_name, (size_t)(H5AC__MAX_TRACE_FILE_NAME_LEN + H5C__PREFIX_LEN + 1),
- "%s", trace_file_name);
-#endif /* H5_HAVE_PARALLEL */
-
- if((file_ptr = HDfopen(file_name, "w")) == NULL)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "trace file open failed.")
-
- HDfprintf(file_ptr, "### HDF5 metadata cache trace file version 1 ###\n");
-
- if(H5C_set_trace_file_ptr(cache_ptr, file_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_trace_file_ptr() failed.")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__open_trace_file() */
-
-
-/*-------------------------------------------------------------------------
*
* Function: H5AC_get_entry_ptr_from_addr()
*
diff --git a/src/H5AClog.c b/src/H5AClog.c
deleted file mode 100644
index 51a2050..0000000
--- a/src/H5AClog.c
+++ /dev/null
@@ -1,1105 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5AClog.c
- *
- * Purpose: Functions for metadata cache logging in JSON format
- *
- *-------------------------------------------------------------------------
- */
-
-/****************/
-/* Module Setup */
-/****************/
-#include "H5ACmodule.h" /* This source code file is part of the H5AC module */
-
-/***********/
-/* Headers */
-/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACpkg.h" /* Metadata cache */
-#include "H5Cprivate.h" /* Cache */
-#include "H5Eprivate.h" /* Error handling */
-
-
-/****************/
-/* Local Macros */
-/****************/
-
-#define MSG_SIZE 128
-
-
-/******************/
-/* Local Typedefs */
-/******************/
-
-
-/********************/
-/* Package Typedefs */
-/********************/
-
-
-/********************/
-/* Local Prototypes */
-/********************/
-
-
-/*********************/
-/* Package Variables */
-/*********************/
-
-
-/*****************************/
-/* Library Private Variables */
-/*****************************/
-
-
-/*******************/
-/* Local Variables */
-/*******************/
-
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_create_cache_log_msg
- *
- * Purpose: Write a log message for cache creation.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_create_cache_log_msg(H5AC_t *cache)
-{
- char msg[MSG_SIZE];
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
-
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
- /* Since we're about to override the current logging flag,
- * check the "log enabled" flag to see if we didn't get here
- * by mistake.
- */
- if(!log_enabled)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "attempt to write opening log message when logging is disabled")
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\n\
-\"create_time\":%lld,\n\
-\"messages\":\n\
-[\n\
-"
- , (long long)HDtime(NULL));
-
- /* Have to temporarily enable logging, if it isn't currently */
- if(!curr_logging)
- if(H5C_start_logging(cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to start mdc logging")
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
- /* Stop logging, if it wasn't started originally */
- if(!curr_logging)
- if(H5C_stop_logging(cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_create_cache_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_destroy_cache_log_msg
- *
- * Purpose: Write a log message for cache destruction.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_destroy_cache_log_msg(H5AC_t *cache)
-{
- char msg[MSG_SIZE];
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
-
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
- /* Since we're about to override the current logging flag,
- * check the "log enabled" flag to see if we didn't get here
- * by mistake.
- */
- if(!log_enabled)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "attempt to write closing log message when logging is disabled")
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-],\n\
-\"close_time\":%lld,\n\
-}\n\
-"
- , (long long)HDtime(NULL));
-
- /* Have to temporarily enable logging, if it isn't currently */
- if(!curr_logging)
- if(H5C_start_logging(cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to start mdc logging")
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
- /* Stop logging, if it wasn't started originally */
- if(!curr_logging)
- if(H5C_stop_logging(cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_destroy_cache_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_evict_cache_log_msg
- *
- * Purpose: Write a log message for eviction of cache entries.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_evict_cache_log_msg(const H5AC_t *cache,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"evict\",\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_evict_cache_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_expunge_entry_log_msg
- *
- * Purpose: Write a log message for expunge of cache entries.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_expunge_entry_log_msg(const H5AC_t *cache,
- haddr_t address,
- int type_id,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"expunge\",\
-\"address\":0x%lx,\
-\"type_id\":%d,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)address, (int)type_id, (int)fxn_ret_value);
-
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_expunge_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_flush_cache_log_msg
- *
- * Purpose: Write a log message for cache flushes.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_flush_cache_log_msg(const H5AC_t *cache,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"flush\",\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_flush_cache_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_insert_entry_log_msg
- *
- * Purpose: Write a log message for insertion of cache entries.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_insert_entry_log_msg(const H5AC_t *cache,
- haddr_t address,
- int type_id,
- unsigned flags,
- size_t size,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
-
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"insert\",\
-\"address\":0x%lx,\
-\"flags\":0x%x,\
-\"type_id\":%d,\
-\"size\":%d,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)address, flags, type_id,
- (int)size, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_insert_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_mark_dirty_entry_log_msg
- *
- * Purpose: Write a log message for marking cache entries as dirty.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_mark_dirty_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"dirty\",\
-\"address\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_mark_dirty_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_mark_clean_entry_log_msg
- *
- * Purpose: Write a log message for marking cache entries as clean.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * Saturday, July 23, 2016
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_mark_clean_entry_log_msg(const H5AC_t *cache, const H5AC_info_t *entry,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE]; /* Log message buffer */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"clean\",\
-\"address\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_mark_clean_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_mark_unserialized_entry_log_msg
- *
- * Purpose: Write a log message for marking cache entries as unserialized.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * Thursday, December 22, 2016
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_mark_unserialized_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"unserialized\",\
-\"address\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_mark_unserialized_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_mark_serialize_entry_log_msg
- *
- * Purpose: Write a log message for marking cache entries as serialize.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * Thursday, December 22, 2016
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_mark_serialized_entry_log_msg(const H5AC_t *cache, const H5AC_info_t *entry,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE]; /* Log message buffer */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"serialized\",\
-\"address\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_mark_serialized_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_move_entry_log_msg
- *
- * Purpose: Write a log message for moving a cache entry.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_move_entry_log_msg(const H5AC_t *cache,
- haddr_t old_addr,
- haddr_t new_addr,
- int type_id,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"move\",\
-\"old_address\":0x%lx,\
-\"new_address\":0x%lx,\
-\"type_id\":%d,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)old_addr,
- (unsigned long)new_addr, type_id, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_move_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_pin_entry_log_msg
- *
- * Purpose: Write a log message for pinning a cache entry.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_pin_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"pin\",\
-\"address\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_pin_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_create_fd_log_msg
- *
- * Purpose: Write a log message for creating a flush dependency between
- * two cache entries.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_create_fd_log_msg(const H5AC_t *cache,
- const H5AC_info_t *parent,
- const H5AC_info_t *child,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(parent);
- HDassert(child);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"create_fd\",\
-\"parent_addr\":0x%lx,\
-\"child_addr\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)parent->addr,
- (unsigned long)child->addr, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_create_fd_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_protect_entry_log_msg
- *
- * Purpose: Write a log message for protecting a cache entry.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_protect_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- unsigned flags,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- char rw_s[16];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- if(H5AC__READ_ONLY_FLAG == flags)
- HDstrcpy(rw_s, "READ");
- else
- HDstrcpy(rw_s, "WRITE");
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"protect\",\
-\"address\":0x%lx,\
-\"readwrite\":\"%s\",\
-\"size\":%d,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- rw_s, (int)entry->size, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_protect_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_resize_entry_log_msg
- *
- * Purpose: Write a log message for resizing a cache entry.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_resize_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- size_t new_size,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"resize\",\
-\"address\":0x%lx,\
-\"new_size\":%d,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- (int)new_size, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_resize_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_unpin_entry_log_msg
- *
- * Purpose: Write a log message for unpinning a cache entry.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_unpin_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"unpin\",\
-\"address\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_unpin_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_destroy_fd_log_msg
- *
- * Purpose: Write a log message for destroying a flush dependency
- * between two cache entries.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_destroy_fd_log_msg(const H5AC_t *cache,
- const H5AC_info_t *parent,
- const H5AC_info_t *child,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(parent);
- HDassert(child);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"destroy_fd\",\
-\"parent_addr\":0x%lx,\
-\"child_addr\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)parent->addr,
- (unsigned long)child->addr, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_destroy_fd_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_unprotect_entry_log_msg
- *
- * Purpose: Write a log message for unprotecting a cache entry.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_unprotect_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- int type_id,
- unsigned flags,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"unprotect\",\
-\"address\":0x%lx,\
-\"id\":%d,\
-\"flags\":%x,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- type_id, flags, (int)fxn_ret_value);
-
- HDsnprintf(msg, MSG_SIZE, " ");
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_unprotect_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_set_cache_config_log_msg
- *
- * Purpose: Write a log message for setting the cache configuration.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_set_cache_config_log_msg(const H5AC_t *cache,
- const H5AC_cache_config_t *config,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(config);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"set_config\",\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (int)fxn_ret_value);
-
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_set_cache_config_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_remove_entry_log_msg
- *
- * Purpose: Write a log message for removing a cache entry.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * September 17, 2016
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_remove_entry_log_msg(const H5AC_t *cache, const H5AC_info_t *entry,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"remove\",\
-\"address\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_remove_entry_log_msg() */
-
diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h
index 9bf84bf..8997382 100644
--- a/src/H5ACpkg.h
+++ b/src/H5ACpkg.h
@@ -433,74 +433,5 @@ H5_DLL herr_t H5AC__set_write_done_callback(H5C_t * cache_ptr,
void (* write_done)(void));
#endif /* H5_HAVE_PARALLEL */
-/* Trace file routines */
-H5_DLL herr_t H5AC__close_trace_file(H5AC_t *cache_ptr);
-H5_DLL herr_t H5AC__open_trace_file(H5AC_t *cache_ptr, const char *trace_file_name);
-
-/* Cache logging routines */
-H5_DLL herr_t H5AC__write_create_cache_log_msg(H5AC_t *cache);
-H5_DLL herr_t H5AC__write_destroy_cache_log_msg(H5AC_t *cache);
-H5_DLL herr_t H5AC__write_evict_cache_log_msg(const H5AC_t *cache,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_expunge_entry_log_msg(const H5AC_t *cache,
- haddr_t address,
- int type_id,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_flush_cache_log_msg(const H5AC_t *cache,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_insert_entry_log_msg(const H5AC_t *cache,
- haddr_t address,
- int type_id,
- unsigned flags,
- size_t size,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_mark_dirty_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_mark_clean_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry, herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_mark_unserialized_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry, herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_mark_serialized_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry, herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_move_entry_log_msg(const H5AC_t *cache,
- haddr_t old_addr,
- haddr_t new_addr,
- int type_id,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_pin_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_create_fd_log_msg(const H5AC_t *cache,
- const H5AC_info_t *parent,
- const H5AC_info_t *child,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_protect_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- unsigned flags,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_resize_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- size_t new_size,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_unpin_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_destroy_fd_log_msg(const H5AC_t *cache,
- const H5AC_info_t *parent,
- const H5AC_info_t *child,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_unprotect_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- int type_id,
- unsigned flags,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_set_cache_config_log_msg(const H5AC_t *cache,
- const H5AC_cache_config_t *config,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_remove_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value);
-
#endif /* _H5ACpkg_H */
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 0e8620d..e1fdedf 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -35,12 +35,6 @@
#include "H5Pprivate.h" /* Property lists */
#include "H5SLprivate.h" /* Skip lists */
-#ifdef H5_METADATA_TRACE_FILE
-#define H5AC__TRACE_FILE_ENABLED 1
-#else /* H5_METADATA_TRACE_FILE */
-#define H5AC__TRACE_FILE_ENABLED 0
-#endif /* H5_METADATA_TRACE_FILE */
-
/* Global metadata tag values */
#define H5AC__INVALID_TAG (haddr_t)0
#define H5AC__IGNORE_TAG (haddr_t)1
diff --git a/src/H5Adense.c b/src/H5Adense.c
index 5bed82d..021fa76 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -300,18 +300,49 @@ static herr_t
H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr)
{
H5A_t const **user_attr = (H5A_t const **)_user_attr; /* User data from v2 B-tree attribute lookup */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(attr);
HDassert(user_attr);
+ HDassert(took_ownership);
+ /*
+ * If there is an attribute already stored in "user_attr",
+ * we need to free the dynamially allocated spaces for the
+ * attribute, otherwise we got infinite loop closing library due to
+ * outstanding allocation. (HDFFV-10659)
+ *
+ * This callback is used by H5A__dense_remove() to close/free the
+ * attribute stored in "user_attr" (via H5O__msg_free_real()) after
+ * the attribute node is deleted from the name index v2 B-tree.
+ * The issue is:
+ * When deleting the attribute node from the B-tree,
+ * if the attribute is found in the intermediate B-tree nodes,
+ * which may be merged/redistributed, we need to free the dynamically
+ * allocated spaces for the intermediate decoded attribute.
+ */
+ if(*user_attr != NULL) {
+ H5A_t *old_attr = *user_attr;
+ if(old_attr->shared) {
+ /* Free any dynamically allocated items */
+ if(H5A__free(old_attr) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info")
+
+ /* Destroy shared attribute struct */
+ old_attr->shared = H5FL_FREE(H5A_shared_t, old_attr->shared);
+ } /* end if */
+
+ old_attr = H5FL_FREE(H5A_t, old_attr);
+ } /* end if */
/* Take over attribute ownership */
*user_attr = attr;
*took_ownership = TRUE;
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_fnd_cb() */
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index b43e41d..b438cd2 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -45,6 +45,8 @@
#include "H5Opkg.h" /* Object headers */
#include "H5VLprivate.h" /* Virtual object layer */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
/****************/
/* Local Macros */
@@ -343,7 +345,7 @@ H5Aget_num_attrs(hid_t 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, 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);
@@ -408,7 +410,7 @@ H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data)
HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier")
/* Call attribute iteration routine */
- if((ret_value = H5VL_attr_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_ATTR_ITERATE_OLD, loc_id, attr_num, op, op_data)) < 0)
+ 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:
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index cfe9dae..91061cd 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -155,21 +155,6 @@ typedef struct {
H5A_t **attrs; /* Pointer to array of attribute pointers */
} H5A_attr_table_t;
-/* Types for optional attribute VOL operations */
-typedef enum H5VL_attr_optional_t {
- H5VL_ATTR_ITERATE_OLD /* H5Aiterate (deprecated routine) */
- /* (This enum value should have an
- * "#ifndefH5_NO_DEPRECATED_SYMBOLS"
- * around it, but the compiler
- * complains about an empty enum
- * when deprecated symbols are
- * disabled currently. When
- * another enum value is added,
- * please put the #ifdef around
- * this symbol. QAK - 2018/12/06
- */
-} H5VL_attr_optional_t;
-
/*****************************/
/* Package Private Variables */
diff --git a/src/H5Apublic.h b/src/H5Apublic.h
index 586940b..7162f6e 100644
--- a/src/H5Apublic.h
+++ b/src/H5Apublic.h
@@ -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,
diff --git a/src/H5B.c b/src/H5B.c
index 71b9020..2772bb9 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -436,8 +436,8 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
side = "LEFT";
else
side = "MIDDLE";
- fprintf(H5DEBUG(B), "H5B__split: %3u {%5.3f,%5.3f,%5.3f} %6s",
- shared->two_k, split_ratios[0], split_ratios[1], split_ratios[2], side);
+ HDfprintf(H5DEBUG(B), "H5B__split: %3u {%5.3f,%5.3f,%5.3f} %6s",
+ shared->two_k, split_ratios[0], split_ratios[1], split_ratios[2], side);
}
#endif
@@ -464,7 +464,7 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
nright = shared->two_k - nleft;
#ifdef H5B_DEBUG
if(H5DEBUG(B))
- fprintf(H5DEBUG(B), " split %3d/%-3d\n", nleft, nright);
+ HDfprintf(H5DEBUG(B), " split %3d/%-3d\n", nleft, nright);
#endif
/*
diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c
index c491783..665e826 100644
--- a/src/H5Bdbg.c
+++ b/src/H5Bdbg.c
@@ -193,13 +193,13 @@ H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata)
FUNC_ENTER_PACKAGE
if(0 == ncalls++) {
- if(H5DEBUG(B))
- fprintf(H5DEBUG(B), "H5B: debugging B-trees (expensive)\n");
+ if(H5DEBUG(B))
+ HDfprintf(H5DEBUG(B), "H5B: debugging B-trees (expensive)\n");
} /* end if */
/* Get shared info for B-tree */
if(NULL == (rc_shared = (type->get_shared)(f, udata)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared);
HDassert(shared);
diff --git a/src/H5C.c b/src/H5C.c
index a22eca0..09c5fe8 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -282,13 +282,8 @@ H5C_create(size_t max_cache_size,
cache_ptr->flush_in_progress = FALSE;
- cache_ptr->logging_enabled = FALSE;
-
- cache_ptr->currently_logging = FALSE;
-
- cache_ptr->log_file_ptr = NULL;
-
- cache_ptr->trace_file_ptr = NULL;
+ if(NULL == (cache_ptr->log_info = (H5C_log_info_t *)H5MM_calloc(sizeof(H5C_log_info_t))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed")
cache_ptr->aux_ptr = aux_ptr;
@@ -332,6 +327,7 @@ H5C_create(size_t max_cache_size,
/* Tagging Field Initializations */
cache_ptr->ignore_tags = FALSE;
+ cache_ptr->num_objs_corked = 0;
cache_ptr->slist_changed = FALSE;
cache_ptr->slist_len = 0;
@@ -493,6 +489,9 @@ done:
if(cache_ptr->tag_list != NULL)
H5SL_close(cache_ptr->tag_list);
+ if(cache_ptr->log_info != NULL)
+ H5MM_xfree(cache_ptr->log_info);
+
cache_ptr->magic = 0;
cache_ptr = H5FL_FREE(H5C_t, cache_ptr);
} /* end if */
@@ -865,6 +864,9 @@ H5C_dest(H5F_t * f)
cache_ptr->tag_list = NULL;
} /* end if */
+ if(cache_ptr->log_info != NULL)
+ H5MM_xfree(cache_ptr->log_info);
+
#ifndef NDEBUG
#if H5C_DO_SANITY_CHECKS
if(cache_ptr->get_entry_ptr_from_addr_counter > 0)
@@ -1481,31 +1483,17 @@ H5C_insert_entry(H5F_t * f,
H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr)
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
- coll_access = (H5P_USER_TRUE == f->coll_md_read ? TRUE : FALSE);
-
- /* If not explicitly disabled, get the cmdr setting from the API context */
- if(!coll_access && H5P_FORCE_FALSE != f->coll_md_read)
- coll_access = H5CX_get_coll_metadata_read();
- } /* end if */
+ if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI))
+ coll_access = H5CX_get_coll_metadata_read();
entry_ptr->coll_access = coll_access;
if(coll_access) {
H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, FAIL)
/* Make sure the size of the collective entries in the cache remain in check */
- if(H5P_USER_TRUE == f->coll_md_read) {
- if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100) {
- if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries")
- } /* end if */
- } /* end if */
- else {
- if(cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100) {
- if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries")
- } /* end if */
- } /* end else */
+ if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100)
+ if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries")
} /* end if */
#endif
@@ -2241,13 +2229,8 @@ H5C_protect(H5F_t * f,
ring = H5CX_get_ring();
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
- coll_access = (H5P_USER_TRUE == f->coll_md_read ? TRUE : FALSE);
-
- /* If not explicitly disabled, get the cmdr setting from the API context */
- if(!coll_access && H5P_FORCE_FALSE != f->coll_md_read)
- coll_access = H5CX_get_coll_metadata_read();
- } /* end if */
+ if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI))
+ coll_access = H5CX_get_coll_metadata_read();
#endif /* H5_HAVE_PARALLEL */
/* first check to see if the target is in cache */
@@ -2284,7 +2267,7 @@ H5C_protect(H5F_t * f,
the entry in their cache still have to participate in the
bcast. */
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access) {
+ if(coll_access) {
if(!(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) {
MPI_Comm comm; /* File MPI Communicator */
int mpi_code; /* MPI error code */
@@ -2599,21 +2582,11 @@ H5C_protect(H5F_t * f,
} /* end if */
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
- /* Make sure the size of the collective entries in the cache remain in check */
- if(coll_access) {
- if(H5P_USER_TRUE == f->coll_md_read) {
- if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100)
- if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries")
- } /* end if */
- else {
- if(cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100)
- if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries")
- } /* end else */
- } /* end if */
- } /* end if */
+ /* Make sure the size of the collective entries in the cache remain in check */
+ if(coll_access)
+ if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100)
+ if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries")
#endif /* H5_HAVE_PARALLEL */
done:
@@ -7728,6 +7701,8 @@ H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
/* Set the corked status for the entire object */
tag_info->corked = TRUE;
+ cache_ptr->num_objs_corked++;
+
} /* end if */
else {
/* Sanity check */
@@ -7739,6 +7714,7 @@ H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
/* Set the corked status for the entire object */
tag_info->corked = FALSE;
+ cache_ptr->num_objs_corked--;
/* Remove the tag info from the tag list, if there's no more entries with this tag */
if(0 == tag_info->entry_cnt) {
diff --git a/src/H5CX.c b/src/H5CX.c
index 1d9cf3d..c97bdcd 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -53,7 +53,7 @@
* each thread individually. The association of contexts to threads will
* be handled by the pthread library.
*
- * In order for this macro to work, H5E__get_my_stack() must be preceeded
+ * In order for this macro to work, H5CX_get_my_context() must be preceeded
* by "H5CX_node_t *ctx =".
*/
#define H5CX_get_my_context() H5CX__get_context()
@@ -186,6 +186,10 @@ typedef struct H5CX_t {
hid_t lapl_id; /* LAPL ID for API operation */
H5P_genplist_t *lapl; /* Link Access Property List */
+ /* DCPL */
+ hid_t dcpl_id; /* DCPL ID for API operation */
+ H5P_genplist_t *dcpl; /* Dataset Creation Property List */
+
/* Internal: Object tagging info */
haddr_t tag; /* Current object's tag (ohdr chunk #0 address) */
@@ -198,6 +202,7 @@ typedef struct H5CX_t {
MPI_Datatype btype; /* MPI datatype for buffer, when using collective I/O */
MPI_Datatype ftype; /* MPI datatype for file, when using collective I/O */
hbool_t mpi_file_flushing; /* Whether an MPI-opened file is being flushed */
+ hbool_t rank0_bcast; /* Whether a dataset meets read-with-rank0-and-bcast requirements */
#endif /* H5_HAVE_PARALLEL */
/* Cached DXPL properties */
@@ -261,6 +266,8 @@ typedef struct H5CX_t {
hbool_t mpio_coll_chunk_multi_ratio_coll_set; /* Whether instrumented "collective chunk multi ratio coll" value is set */
int mpio_coll_chunk_multi_ratio_ind; /* Instrumented "collective chunk multi ratio ind" value (H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME) */
hbool_t mpio_coll_chunk_multi_ratio_ind_set; /* Whether instrumented "collective chunk multi ratio ind" value is set */
+ hbool_t mpio_coll_rank0_bcast; /* Instrumented "collective chunk multi ratio ind" value (H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME) */
+ hbool_t mpio_coll_rank0_bcast_set; /* Whether instrumented "collective chunk multi ratio ind" value is set */
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
@@ -268,9 +275,15 @@ typedef struct H5CX_t {
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 */
+ /* Cached DCPL properties */
+ hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
+ hbool_t do_min_dset_ohdr_valid; /* Whether minimize dataset object header flag is valid */
+
+ /* Cached VOL settings */
+ H5VL_connector_prop_t vol_connector_prop; /* Property for VOL connector ID & info */
+ hbool_t vol_connector_prop_valid; /* Whether property for VOL connector ID & info is valid */
+ void *vol_wrap_ctx; /* VOL connector's "wrap context" for creating IDs */
+ hbool_t vol_wrap_ctx_valid; /* Whether VOL connector's "wrap context" for creating IDs is valid */
} H5CX_t;
/* Typedef for nodes on the API context stack */
@@ -320,6 +333,12 @@ typedef struct H5CX_lapl_cache_t {
size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
} H5CX_lapl_cache_t;
+/* Typedef for cached default dataset creation property list information */
+/* (Same as the cached DXPL struct, above, except for the default DCPL) */
+typedef struct H5CX_dcpl_cache_t {
+ hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
+} H5CX_dcpl_cache_t;
+
/********************/
/* Local Prototypes */
@@ -353,6 +372,9 @@ static H5CX_dxpl_cache_t H5CX_def_dxpl_cache;
/* Define a "default" link access property list cache structure to use for default LAPLs */
static H5CX_lapl_cache_t H5CX_def_lapl_cache;
+/* Define a "default" dataset creation property list cache structure to use for default DCPLs */
+static H5CX_dcpl_cache_t H5CX_def_dcpl_cache;
+
/* Declare a static free list to manage H5CX_node_t structs */
H5FL_DEFINE_STATIC(H5CX_node_t);
@@ -373,6 +395,7 @@ H5CX__init_package(void)
{
H5P_genplist_t *dx_plist; /* Data transfer property list */
H5P_genplist_t *la_plist; /* Link access property list */
+ H5P_genplist_t *dc_plist; /* Dataset creation property list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -472,6 +495,20 @@ H5CX__init_package(void)
if(H5P_get(la_plist, H5L_ACS_NLINKS_NAME, &H5CX_def_lapl_cache.nlinks) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve number of soft / UD links to traverse")
+
+ /* Reset the "default DCPL cache" information */
+ HDmemset(&H5CX_def_dcpl_cache, 0, sizeof(H5CX_dcpl_cache_t));
+
+ /* Get the default DCPL cache information */
+
+ /* Get the default dataset creation property list */
+ if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_CREATE_DEFAULT)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list")
+
+ /* Get flag to indicate whether to minimize dataset object header */
+ if(H5P_get(dc_plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &H5CX_def_dcpl_cache.do_min_dset_ohdr) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX__init_package() */
@@ -727,6 +764,35 @@ H5CX_set_dxpl(hid_t dxpl_id)
/*-------------------------------------------------------------------------
+ * Function: H5CX_set_dcpl
+ *
+ * Purpose: Sets the DCPL for the current API call context.
+ *
+ * Return: <none>
+ *
+ * Programmer: Quincey Koziol
+ * March 6, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5CX_set_dcpl(hid_t dcpl_id)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity check */
+ HDassert(*head);
+
+ /* Set the API context's DCPL to a new value */
+ (*head)->ctx.dcpl_id = dcpl_id;
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5CX_set_dcpl() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_set_lapl
*
* Purpose: Sets the LAPL for the current API call context.
@@ -810,8 +876,8 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
#ifdef H5_HAVE_PARALLEL
/* If this routine is not guaranteed to be collective (i.e. it doesn't
- * modify the structural metadata in a file), check if we should use
- * a collective metadata read.
+ * modify the structural metadata in a file), check if the application
+ * specified a collective metadata read for just this operation.
*/
if(!is_collective) {
H5P_genplist_t *plist; /* Property list pointer */
@@ -956,6 +1022,40 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_set_vol_connector_prop
+ *
+ * Purpose: Sets the VOL connector ID & info for an operation.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * January 3, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_set_vol_connector_prop(const H5VL_connector_prop_t *vol_connector_prop)
+{
+ 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 */
+ HDmemcpy(&(*head)->ctx.vol_connector_prop, vol_connector_prop, sizeof(H5VL_connector_prop_t));
+
+ /* Mark the value as valid */
+ (*head)->ctx.vol_connector_prop_valid = TRUE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_set_vol_connector_prop() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_get_dxpl
*
* Purpose: Retrieves the DXPL ID for the current API call context.
@@ -1044,6 +1144,42 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_get_vol_connector_prop
+ *
+ * Purpose: Retrieves the VOL connector ID & info for an operation.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * January 3, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop)
+{
+ 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_connector_prop);
+ HDassert(head && *head);
+
+ /* Check for value that was set */
+ if((*head)->ctx.vol_connector_prop_valid)
+ /* Get the value */
+ HDmemcpy(vol_connector_prop, &(*head)->ctx.vol_connector_prop, sizeof(H5VL_connector_prop_t));
+ else
+ HDmemset(vol_connector_prop, 0, sizeof(H5VL_connector_prop_t));
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_vol_connector_prop() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_get_tag
*
* Purpose: Retrieves the object tag for the current API call context.
@@ -1182,6 +1318,32 @@ H5CX_get_mpi_file_flushing(void)
FUNC_LEAVE_NOAPI((*head)->ctx.mpi_file_flushing)
} /* end H5CX_get_mpi_file_flushing() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_get_mpio_rank0_bcast
+ *
+ * Purpose: Retrieves if the dataset meets read-with-rank0-and-bcast requirements for the current API call context.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: M. Breitenfeld
+ * December 31, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5CX_get_mpio_rank0_bcast(void)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity check */
+ HDassert(head && *head);
+
+ FUNC_LEAVE_NOAPI((*head)->ctx.rank0_bcast)
+} /* end H5CX_get_mpio_rank0_bcast() */
#endif /* H5_HAVE_PARALLEL */
@@ -1900,6 +2062,42 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_get_dset_min_ohdr_flag
+ *
+ * Purpose: Retrieves the flag that indicates whether the dataset object
+ * header should be minimized
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * March 6, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag)
+{
+ 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(dset_min_ohdr_flag);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id);
+
+ H5CX_RETRIEVE_PROP_VALID(dcpl, H5P_DATASET_CREATE_DEFAULT, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, do_min_dset_ohdr)
+
+ /* Get the value */
+ *dset_min_ohdr_flag = (*head)->ctx.do_min_dset_ohdr;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_dset_min_ohdr_flag() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_set_tag
*
* Purpose: Sets the object tag for the current API call context.
@@ -2113,6 +2311,34 @@ H5CX_set_mpi_file_flushing(hbool_t flushing)
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_mpi_file_flushing() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_set_mpio_rank0_bcast
+ *
+ * Purpose: Sets the "dataset meets read-with-rank0-and-bcast requirements" flag for the current API call context.
+ *
+ * Return: <none>
+ *
+ * Programmer: M. Breitenfeld
+ * December 31, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity checks */
+ HDassert(head && *head);
+
+ (*head)->ctx.rank0_bcast = rank0_bcast;
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5CX_set_mpio_rank0_bcast() */
#endif /* H5_HAVE_PARALLEL */
@@ -2524,6 +2750,40 @@ H5CX_test_set_mpio_coll_chunk_multi_ratio_ind(int mpio_coll_chunk_multi_ratio_in
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_test_set_mpio_coll_chunk_multi_ratio_ind() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_test_set_mpio_coll_rank0_bcast
+ *
+ * Purpose: Sets the instrumented "read-with-rank0-bcast" flag for the current API call context.
+ *
+ * Note: Only sets value if property set in DXPL
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * January 2, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_test_set_mpio_coll_rank0_bcast(hbool_t mpio_coll_rank0_bcast)
+{
+ 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_NOINIT
+
+ /* Sanity checks */
+ HDassert(head && *head);
+ HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT ||
+ (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
+
+ H5CX_TEST_SET_PROP(H5D_XFER_COLL_RANK0_BCAST_NAME, mpio_coll_rank0_bcast)
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_test_set_mpio_coll_rank0_bcast() */
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
@@ -2568,6 +2828,7 @@ H5CX__pop_common(void)
H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME, mpio_coll_chunk_link_num_false)
H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME, mpio_coll_chunk_multi_ratio_coll)
H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME, mpio_coll_chunk_multi_ratio_ind)
+ H5CX_SET_PROP(H5D_XFER_COLL_RANK0_BCAST_NAME, mpio_coll_rank0_bcast)
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h
index 57ca5cd..51ee96b 100644
--- a/src/H5CXprivate.h
+++ b/src/H5CXprivate.h
@@ -60,21 +60,25 @@ H5_DLL hbool_t H5CX_is_def_dxpl(void);
/* "Setter" routines for API context info */
H5_DLL void H5CX_set_dxpl(hid_t dxpl_id);
H5_DLL void H5CX_set_lapl(hid_t lapl_id);
+H5_DLL void H5CX_set_dcpl(hid_t dcpl_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);
+H5_DLL herr_t H5CX_set_vol_connector_prop(const H5VL_connector_prop_t *vol_connector_prop);
/* "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 herr_t H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop);
H5_DLL haddr_t H5CX_get_tag(void);
H5_DLL H5AC_ring_t H5CX_get_ring(void);
#ifdef H5_HAVE_PARALLEL
H5_DLL hbool_t H5CX_get_coll_metadata_read(void);
H5_DLL herr_t H5CX_get_mpi_coll_datatypes(MPI_Datatype *btype, MPI_Datatype *ftype);
H5_DLL hbool_t H5CX_get_mpi_file_flushing(void);
+H5_DLL hbool_t H5CX_get_mpio_rank0_bcast(void);
#endif /* H5_HAVE_PARALLEL */
/* "Getter" routines for DXPL properties cached in API context */
@@ -102,6 +106,9 @@ H5_DLL herr_t H5CX_get_dt_conv_cb(H5T_conv_cb_t *cb_struct);
/* "Getter" routines for LAPL properties cached in API context */
H5_DLL herr_t H5CX_get_nlinks(size_t *nlinks);
+/* "Getter" routines for DCPL properties cached in API context */
+H5_DLL herr_t H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag);
+
/* "Setter" routines for API context info */
H5_DLL void H5CX_set_tag(haddr_t tag);
H5_DLL void H5CX_set_ring(H5AC_ring_t ring);
@@ -110,6 +117,7 @@ H5_DLL void H5CX_set_coll_metadata_read(hbool_t cmdr);
H5_DLL herr_t H5CX_set_mpi_coll_datatypes(MPI_Datatype btype, MPI_Datatype ftype);
H5_DLL herr_t H5CX_set_mpio_coll_opt(H5FD_mpio_collective_opt_t mpio_coll_opt);
H5_DLL void H5CX_set_mpi_file_flushing(hbool_t flushing);
+H5_DLL void H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast);
#endif /* H5_HAVE_PARALLEL */
/* "Setter" routines for DXPL properties cached in API context */
@@ -135,6 +143,7 @@ H5_DLL herr_t H5CX_test_set_mpio_coll_chunk_link_num_true(int mpio_coll_chunk_li
H5_DLL herr_t H5CX_test_set_mpio_coll_chunk_link_num_false(int mpio_coll_chunk_link_num_false);
H5_DLL herr_t H5CX_test_set_mpio_coll_chunk_multi_ratio_coll(int mpio_coll_chunk_multi_ratio_coll);
H5_DLL herr_t H5CX_test_set_mpio_coll_chunk_multi_ratio_ind(int mpio_coll_chunk_multi_ratio_ind);
+H5_DLL herr_t H5CX_test_set_mpio_coll_rank0_bcast(hbool_t rank0_bcast);
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c
index 08c70d9..1f55e86 100644
--- a/src/H5Cdbg.c
+++ b/src/H5Cdbg.c
@@ -476,42 +476,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5C_set_trace_file_ptr
- *
- * Purpose: Set the trace_file_ptr field for the cache.
- *
- * This field must either be NULL (which turns of trace
- * file logging), or be a pointer to an open file to which
- * trace file data is to be written.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 1/20/06
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C_set_trace_file_ptr(H5C_t * cache_ptr, FILE * trace_file_ptr)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* This would normally be an assert, but we need to use an HGOTO_ERROR
- * call to shut up the compiler.
- */
- if((NULL == cache_ptr) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr")
-
- cache_ptr->trace_file_ptr = trace_file_ptr;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_set_trace_file_ptr() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5C_stats
*
* Purpose: Prints statistics about the cache.
diff --git a/src/H5Cimage.c b/src/H5Cimage.c
index bdab1a3..4684630 100644
--- a/src/H5Cimage.c
+++ b/src/H5Cimage.c
@@ -1065,9 +1065,9 @@ H5C__read_cache_image(H5F_t *f, H5C_t *cache_ptr)
H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr)
#ifdef H5_HAVE_PARALLEL
- if ( aux_ptr ) {
+ if ( aux_ptr ) {
- /* Broadcast cache image */
+ /* Broadcast cache image */
if ( MPI_SUCCESS !=
(mpi_result = MPI_Bcast(cache_ptr->image_buffer,
(int)cache_ptr->image_len, MPI_BYTE,
diff --git a/src/H5Clog.c b/src/H5Clog.c
index 3353619..cf9b7e8 100644
--- a/src/H5Clog.c
+++ b/src/H5Clog.c
@@ -13,11 +13,9 @@
/*-------------------------------------------------------------------------
*
- * Created: H5Clog.c
- * May 30 2016
- * Quincey Koziol
+ * Created: H5Clog.c
*
- * Purpose: Functions for generic cache logging in JSON format
+ * Purpose: Functions for metadata cache logging
*
*-------------------------------------------------------------------------
*/
@@ -30,14 +28,12 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#ifdef H5_HAVE_PARALLEL
-#define H5AC_FRIEND /*suppress error about including H5ACpkg */
-#include "H5ACpkg.h" /* Metadata cache */
-#endif /* H5_HAVE_PARALLEL */
-#include "H5Cpkg.h" /* Metadata cache */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#define H5AC_FRIEND /* Suppress error about including H5ACpkg */
+#include "H5ACpkg.h" /* Metadata cache */
+#include "H5Cpkg.h" /* Cache */
+#include "H5Clog.h" /* Cache logging */
+#include "H5Eprivate.h" /* Error handling */
/****************/
@@ -77,133 +73,109 @@
/*-------------------------------------------------------------------------
- * Function: H5C_set_up_logging
+ * Function: H5C_log_set_up
*
* Purpose: Setup for metadata cache logging.
*
- * Metadata logging is enabled and disabled at two levels. This
- * function and the associated tear_down function open and close
- * the log file. the start_ and stop_logging functions are then
- * used to switch logging on/off. Optionally, logging can begin
- * as soon as the log file is opened (set via the start_immediately
- * parameter to this function).
- *
- * The log functionality is split between the H5C and H5AC
- * packages. Log state and direct log manipulation resides in
- * H5C. Log messages are generated in H5AC and sent to
- * the H5C_write_log_message function.
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
+ * Programmer: Dana Robinson
+ * Fall 2018
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_set_up_logging(H5C_t *cache_ptr, const char log_location[],
- hbool_t start_immediately)
+H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, hbool_t start_immediately)
{
-#ifdef H5_HAVE_PARALLEL
- H5AC_aux_t *aux_ptr = NULL;
-#endif /*H5_HAVE_PARALLEL*/
- char *file_name = NULL;
- size_t n_chars;
- herr_t ret_value = SUCCEED; /* Return value */
+ int mpi_rank = -1; /* -1 indicates serial (no MPI rank) */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- if(NULL == cache_ptr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL")
- if(H5C__H5C_T_MAGIC != cache_ptr->magic)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
- if(cache_ptr->logging_enabled)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging already set up")
- if(NULL == log_location)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL log location not allowed")
-
- /* Possibly fix up the log file name.
- * The extra 39 characters are for adding the rank to the file name
- * under parallel HDF5. 39 characters allows > 2^127 processes which
- * should be enough for anybody.
- *
- * allocation size = <path length> + dot + <rank # length> + \0
- */
- n_chars = HDstrlen(log_location) + 1 + 39 + 1;
- if(NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate memory for mdc log file name manipulation")
+ HDassert(cache);
+ HDassert(log_location);
+ /* Check logging flags */
+ if(cache->log_info->enabled)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging already set up")
+
+ /* Get the rank when MPI is in use. Logging clients will usually
+ * use that to create per-process logs.
+ */
#ifdef H5_HAVE_PARALLEL
- /* Add the rank to the log file name when MPI is in use */
- aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr);
-
- if(NULL == aux_ptr)
- HDsnprintf(file_name, n_chars, "%s", log_location);
- else {
- if(aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad aux_ptr->magic")
- HDsnprintf(file_name, n_chars, "%s.%d", log_location, aux_ptr->mpi_rank);
- } /* end else */
-#else /* H5_HAVE_PARALLEL */
- HDsnprintf(file_name, n_chars, "%s", log_location);
-#endif /* H5_HAVE_PARALLEL */
-
- /* Open log file */
- if(NULL == (cache_ptr->log_file_ptr = HDfopen(file_name, "w")))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't create mdc log file")
+ if(NULL != cache->aux_ptr)
+ mpi_rank = ((H5AC_aux_t *)(cache->aux_ptr))->mpi_rank;
+#endif /*H5_HAVE_PARALLEL*/
+
+ /* Set up logging */
+ if(H5C_LOG_STYLE_JSON == style) {
+ if(H5C_log_json_set_up(cache->log_info, log_location, mpi_rank) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to set up json logging")
+ }
+ else if(H5C_LOG_STYLE_TRACE == style) {
+ if(H5C_log_trace_set_up(cache->log_info, log_location, mpi_rank) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to set up trace logging")
+ }
+ else
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unknown logging style")
/* Set logging flags */
- cache_ptr->logging_enabled = TRUE;
- cache_ptr->currently_logging = start_immediately;
+ cache->log_info->enabled = TRUE;
+
+ /* Start logging if requested */
+ if(start_immediately)
+ if(H5C_start_logging(cache) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to start logging")
done:
- if(file_name)
- file_name = (char *)H5MM_xfree(file_name);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_set_up_logging() */
+} /* H5C_log_set_up() */
/*-------------------------------------------------------------------------
- * Function: H5C_tear_down_logging
+ * Function: H5C_log_tear_down
*
* Purpose: Tear-down for metadata cache logging.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
+ * Programmer: Dana Robinson
+ * Fall 2018
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_tear_down_logging(H5C_t *cache_ptr)
+H5C_log_tear_down(H5C_t *cache)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- if(NULL == cache_ptr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL")
- if(H5C__H5C_T_MAGIC != cache_ptr->magic)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
- if(FALSE == cache_ptr->logging_enabled)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging not enabled")
+ HDassert(cache);
- /* Unset logging flags */
- cache_ptr->logging_enabled = FALSE;
- cache_ptr->currently_logging = FALSE;
+ /* Check logging flags */
+ if(FALSE == cache->log_info->enabled)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled")
- /* Close log file */
- if(EOF == HDfclose(cache_ptr->log_file_ptr))
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problem closing mdc log file")
- cache_ptr->log_file_ptr = NULL;
+ /* Stop logging if that's going on */
+ if(cache->log_info->logging)
+ if(H5C_stop_logging(cache) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to stop logging")
+
+ /* Tear down logging */
+ if(cache->log_info->cls->tear_down_logging)
+ if(cache->log_info->cls->tear_down_logging(cache->log_info) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific tear down call failed")
+
+ /* Unset logging flags */
+ cache->log_info->enabled = FALSE;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_tear_down_logging() */
+} /* H5C_log_tear_down() */
/*-------------------------------------------------------------------------
@@ -211,37 +183,39 @@ H5C_tear_down_logging(H5C_t *cache_ptr)
*
* Purpose: Start logging metadata cache operations.
*
- * TODO: Add a function that dumps the current state of the
- * metadata cache.
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
+ * Programmer: Dana Robinson
+ * Fall 2018
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_start_logging(H5C_t *cache_ptr)
+H5C_start_logging(H5C_t *cache)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- if(NULL == cache_ptr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL")
- if(H5C__H5C_T_MAGIC != cache_ptr->magic)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
- if(FALSE == cache_ptr->logging_enabled)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging not enabled")
- if(cache_ptr->currently_logging)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging already in progress")
+ HDassert(cache);
+
+ /* Check logging flags */
+ if(FALSE == cache->log_info->enabled)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled")
+
+ /* Start logging */
+ if(cache->log_info->cls->start_logging)
+ if(cache->log_info->cls->start_logging(cache->log_info) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific start call failed")
/* Set logging flags */
- cache_ptr->currently_logging = TRUE;
+ cache->log_info->logging = TRUE;
- /* TODO - Dump cache state */
+ /* Write a log message */
+ if(cache->log_info->cls->write_start_log_msg)
+ if(cache->log_info->cls->write_start_log_msg(cache->log_info->udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write start call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -253,32 +227,41 @@ H5C_start_logging(H5C_t *cache_ptr)
*
* Purpose: Stop logging metadata cache operations.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
+ * Programmer: Dana Robinson
+ * Fall 2018
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_stop_logging(H5C_t *cache_ptr)
+H5C_stop_logging(H5C_t *cache)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- if(NULL == cache_ptr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL")
- if(H5C__H5C_T_MAGIC != cache_ptr->magic)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
- if(FALSE == cache_ptr->logging_enabled)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging not enabled")
- if(FALSE == cache_ptr->currently_logging)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging not in progress")
+ HDassert(cache);
+
+ /* Check logging flags */
+ if(FALSE == cache->log_info->enabled)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled")
+ if(FALSE == cache->log_info->logging)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not in progress")
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_stop_log_msg)
+ if(cache->log_info->cls->write_stop_log_msg(cache->log_info->udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write stop call failed")
+
+ /* Stop logging */
+ if(cache->log_info->cls->stop_logging)
+ if(cache->log_info->cls->stop_logging(cache->log_info) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific stop call failed")
/* Set logging flags */
- cache_ptr->currently_logging = FALSE;
+ cache->log_info->logging = FALSE;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -289,80 +272,705 @@ H5C_stop_logging(H5C_t *cache_ptr)
* Function: H5C_get_logging_status
*
* Purpose: Determines if the cache is actively logging (via the OUT
- * parameter).
+ * parameters).
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
+ * Programmer: Dana Robinson
+ * Fall 2018
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_logging_status(const H5C_t *cache_ptr, /*OUT*/ hbool_t *is_enabled,
+H5C_get_logging_status(const H5C_t *cache, /*OUT*/ hbool_t *is_enabled,
/*OUT*/ hbool_t *is_currently_logging)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ FUNC_ENTER_NOAPI_NOERR
+
+ /* Sanity checks */
+ HDassert(cache);
+ HDassert(is_enabled);
+ HDassert(is_currently_logging);
+
+ /* Get logging flags */
+ *is_enabled = cache->log_info->enabled;
+ *is_currently_logging = cache->log_info->logging;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5C_get_logging_status() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_create_cache_msg
+ *
+ * Purpose: Write a log message for cache creation.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_create_cache_msg(H5C_t *cache, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- if(NULL == cache_ptr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL")
- if(H5C__H5C_T_MAGIC != cache_ptr->magic)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
- if(NULL == is_enabled)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
- if(NULL == is_currently_logging)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
-
- *is_enabled = cache_ptr->logging_enabled;
- *is_currently_logging = cache_ptr->currently_logging;
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_create_cache_log_msg)
+ if(cache->log_info->cls->write_create_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write create cache call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_get_logging_status() */
+} /* H5C_log_write_create_cache_msg() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_destroy_cache_msg
+ *
+ * Purpose: Write a log message for cache destruction.
+ *
+ * NOTE: This can't print out the H5AC call return value, since we
+ * won't know that until the cache is destroyed and at that
+ * point we no longer have pointers to the logging information.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_destroy_cache_msg(H5C_t *cache)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_destroy_cache_log_msg)
+ if(cache->log_info->cls->write_destroy_cache_log_msg(cache->log_info->udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write destroy cache call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_destroy_cache_msg() */
/*-------------------------------------------------------------------------
- * Function: H5C_write_log_message
+ * Function: H5C_log_write_evict_cache_msg
*
- * Purpose: Write a message to the log file and flush the file.
- * The message string is neither modified nor freed.
+ * Purpose: Write a log message for eviction of cache entries.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
+ * Programmer: Dana Robinson
+ * Fall 2018
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_write_log_message(const H5C_t *cache_ptr, const char message[])
+H5C_log_write_evict_cache_msg(H5C_t *cache, herr_t fxn_ret_value)
{
- size_t n_chars;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_evict_cache_log_msg)
+ if(cache->log_info->cls->write_evict_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write evict cache call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_evict_cache_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_expunge_entry_msg
+ *
+ * Purpose: Write a log message for expunge of cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_expunge_entry_msg(H5C_t *cache, haddr_t address,
+ int type_id, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- if(NULL == cache_ptr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL")
- if(H5C__H5C_T_MAGIC != cache_ptr->magic)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
- if(FALSE == cache_ptr->currently_logging)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "not currently logging")
- if(NULL == message)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL log message not allowed")
-
- /* Write the log message and flush */
- n_chars = HDstrlen(message);
- if((int)n_chars != HDfprintf(cache_ptr->log_file_ptr, message))
- HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error writing log message")
- if(EOF == HDfflush(cache_ptr->log_file_ptr))
- HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error flushing log message")
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_expunge_entry_log_msg)
+ if(cache->log_info->cls->write_expunge_entry_log_msg(cache->log_info->udata, address, type_id, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write expunge entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_expunge_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_flush_cache_msg
+ *
+ * Purpose: Write a log message for cache flushes.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_flush_cache_msg(H5C_t *cache, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_flush_cache_log_msg)
+ if(cache->log_info->cls->write_flush_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific flush cache call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_flush_cache_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_insert_entry_msg
+ *
+ * Purpose: Write a log message for insertion of cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_insert_entry_msg(H5C_t *cache, haddr_t address,
+ int type_id, unsigned flags, size_t size, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_insert_entry_log_msg)
+ if(cache->log_info->cls->write_insert_entry_log_msg(cache->log_info->udata, address, type_id, flags, size, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific insert entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_insert_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_mark_entry_dirty_msg
+ *
+ * Purpose: Write a log message for marking cache entries as dirty.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_mark_entry_dirty_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_mark_entry_dirty_log_msg)
+ if(cache->log_info->cls->write_mark_entry_dirty_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark dirty entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_mark_entry_dirty_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_mark_entry_clean_msg
+ *
+ * Purpose: Write a log message for marking cache entries as clean.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_mark_entry_clean_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_mark_entry_clean_log_msg)
+ if(cache->log_info->cls->write_mark_entry_clean_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark clean entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_mark_entry_clean_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_mark_unserialized_entry_msg
+ *
+ * Purpose: Write a log message for marking cache entries as unserialized.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_mark_unserialized_entry_msg(H5C_t *cache,
+ const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_mark_unserialized_entry_log_msg)
+ if(cache->log_info->cls->write_mark_unserialized_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark unserialized entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_mark_unserialized_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_mark_serialized_entry_msg
+ *
+ * Purpose: Write a log message for marking cache entries as serialize.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_mark_serialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_mark_serialized_entry_log_msg)
+ if(cache->log_info->cls->write_mark_serialized_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark serialized entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_mark_serialized_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_move_entry_msg
+ *
+ * Purpose: Write a log message for moving a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_move_entry_msg(H5C_t *cache, haddr_t old_addr, haddr_t new_addr,
+ int type_id, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_move_entry_log_msg)
+ if(cache->log_info->cls->write_move_entry_log_msg(cache->log_info->udata, old_addr, new_addr, type_id, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific move entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_move_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_pin_entry_msg
+ *
+ * Purpose: Write a log message for pinning a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_pin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_pin_entry_log_msg)
+ if(cache->log_info->cls->write_pin_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific pin entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_pin_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_create_fd_msg
+ *
+ * Purpose: Write a log message for creating a flush dependency between
+ * two cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_create_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(parent);
+ HDassert(child);
+ if(cache->log_info->cls->write_create_fd_log_msg)
+ if(cache->log_info->cls->write_create_fd_log_msg(cache->log_info->udata, parent, child, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific create fd call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_create_fd_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_protect_entry_msg
+ *
+ * Purpose: Write a log message for protecting a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_protect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ int type_id, unsigned flags, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_protect_entry_log_msg)
+ if(cache->log_info->cls->write_protect_entry_log_msg(cache->log_info->udata, entry, type_id, flags, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific protect entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_protect_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_resize_entry_msg
+ *
+ * Purpose: Write a log message for resizing a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_resize_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ size_t new_size, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_resize_entry_log_msg)
+ if(cache->log_info->cls->write_resize_entry_log_msg(cache->log_info->udata, entry, new_size, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific resize entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_resize_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_unpin_entry_msg
+ *
+ * Purpose: Write a log message for unpinning a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_unpin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_unpin_entry_log_msg)
+ if(cache->log_info->cls->write_unpin_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific unpin entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_unpin_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_destroy_fd_msg
+ *
+ * Purpose: Write a log message for destroying a flush dependency
+ * between two cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_destroy_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(parent);
+ HDassert(child);
+ if(cache->log_info->cls->write_destroy_fd_log_msg)
+ if(cache->log_info->cls->write_destroy_fd_log_msg(cache->log_info->udata, parent, child, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific destroy fd call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_destroy_fd_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_unprotect_entry_msg
+ *
+ * Purpose: Write a log message for unprotecting a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_unprotect_entry_msg(H5C_t *cache, haddr_t address,
+ int type_id, unsigned flags, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_unprotect_entry_log_msg)
+ if(cache->log_info->cls->write_unprotect_entry_log_msg(cache->log_info->udata, address, type_id, flags, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific unprotect entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_unprotect_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_set_cache_config_msg
+ *
+ * Purpose: Write a log message for setting the cache configuration.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_set_cache_config_msg(H5C_t *cache, const H5AC_cache_config_t *config,
+ herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(config);
+ if(cache->log_info->cls->write_set_cache_config_log_msg)
+ if(cache->log_info->cls->write_set_cache_config_log_msg(cache->log_info->udata, config, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific set cache config call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_set_cache_config_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_remove_entry_msg
+ *
+ * Purpose: Write a log message for removing a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_remove_entry_log_msg)
+ if(cache->log_info->cls->write_remove_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific remove entry call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_write_log_message() */
+} /* H5C_log_write_remove_entry_msg() */
diff --git a/src/H5Clog.h b/src/H5Clog.h
new file mode 100644
index 0000000..0235c4a
--- /dev/null
+++ b/src/H5Clog.h
@@ -0,0 +1,114 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Cache logging header file
+ */
+
+#ifndef _H5Clog_H
+#define _H5Clog_H
+
+/* Get package's private header */
+#include "H5Cprivate.h" /* Cache */
+
+/**************************/
+/* Package Private Macros */
+/**************************/
+
+/****************************/
+/* Package Private Typedefs */
+/****************************/
+
+/* Forward declaration for class struct */
+typedef struct H5C_log_info_t H5C_log_info_t;
+
+/* Class for generating logging messages */
+typedef struct H5C_log_class_t {
+ const char *name; /* String for debugging */
+
+ /* Callbacks for writing log messages */
+ herr_t (*tear_down_logging)(H5C_log_info_t *log_info);
+ herr_t (*start_logging)(H5C_log_info_t *log_info);
+ herr_t (*stop_logging)(H5C_log_info_t *log_info);
+ herr_t (*write_start_log_msg)(void *udata);
+ herr_t (*write_stop_log_msg)(void *udata);
+ herr_t (*write_create_cache_log_msg)(void *udata, herr_t fxn_ret_value);
+ herr_t (*write_destroy_cache_log_msg)(void *udata);
+ herr_t (*write_evict_cache_log_msg)(void *udata, herr_t fxn_ret_value);
+ herr_t (*write_expunge_entry_log_msg)(void *udata, haddr_t address, int type_id, herr_t fxn_ret_value);
+ herr_t (*write_flush_cache_log_msg)(void *udata, herr_t fxn_ret_value);
+ herr_t (*write_insert_entry_log_msg)(void *udata, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value);
+ herr_t (*write_mark_entry_dirty_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+ herr_t (*write_mark_entry_clean_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+ herr_t (*write_mark_unserialized_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+ herr_t (*write_mark_serialized_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+ herr_t (*write_move_entry_log_msg)(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value);
+ herr_t (*write_pin_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+ herr_t (*write_create_fd_log_msg)(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+ herr_t (*write_protect_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
+ herr_t (*write_resize_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
+ herr_t (*write_unpin_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+ herr_t (*write_destroy_fd_log_msg)(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+ herr_t (*write_unprotect_entry_log_msg)(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
+ herr_t (*write_set_cache_config_log_msg)(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
+ herr_t (*write_remove_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+
+} H5C_log_class_t;
+
+/* Logging information */
+struct H5C_log_info_t {
+ hbool_t enabled; /* Was the logging set up? */
+ hbool_t logging; /* Are we currently logging? */
+ H5C_log_class_t *cls; /* Callbacks for writing log messages */
+ void *udata; /* Log-specific data */
+};
+
+
+/*****************************/
+/* Package Private Variables */
+/*****************************/
+
+
+/******************************/
+/* Package Private Prototypes */
+/******************************/
+H5_DLL herr_t H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, hbool_t start_immediately);
+H5_DLL herr_t H5C_log_tear_down(H5C_t *cache);
+
+H5_DLL herr_t H5C_log_write_create_cache_msg(H5C_t *cache, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_destroy_cache_msg(H5C_t *cache);
+H5_DLL herr_t H5C_log_write_evict_cache_msg(H5C_t *cache, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_expunge_entry_msg(H5C_t *cache, haddr_t address, int type_id, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_flush_cache_msg(H5C_t *cache, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_insert_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_mark_entry_dirty_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_mark_entry_clean_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_mark_unserialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_mark_serialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_move_entry_msg(H5C_t *cache, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_pin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_create_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_protect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_resize_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_unpin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_destroy_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_unprotect_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_set_cache_config_msg(H5C_t *cache, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+
+/* Logging-specific setup functions */
+H5_DLL herr_t H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank);
+H5_DLL herr_t H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank);
+
+#endif /* _H5Clog_H */
+
diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c
new file mode 100644
index 0000000..dd9e9b2
--- /dev/null
+++ b/src/H5Clog_json.c
@@ -0,0 +1,1364 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5Clog_json.c
+ *
+ * Purpose: Cache log implementation that emits JSON-formatted log
+ * entries for consumption by new-fangled data analysis tools.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+#include "H5Cmodule.h" /* This source code file is part of the H5C module */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Cpkg.h" /* Cache */
+#include "H5Clog.h" /* Cache logging */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+/* Max log message size */
+#define H5C_MAX_JSON_LOG_MSG_SIZE 1024
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+typedef struct H5C_log_json_udata_t {
+ FILE *outfile;
+ char *message;
+} H5C_log_json_udata_t;
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/* Internal message handling calls */
+static herr_t H5C__json_write_log_message(H5C_log_json_udata_t *json_udata);
+
+/* Log message callbacks */
+static herr_t H5C__json_tear_down_logging(H5C_log_info_t *log_info);
+static herr_t H5C__json_write_start_log_msg(void *udata);
+static herr_t H5C__json_write_stop_log_msg(void *udata);
+static herr_t H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value);
+static herr_t H5C__json_write_destroy_cache_log_msg(void *udata);
+static herr_t H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value);
+static herr_t H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, herr_t fxn_ret_value);
+static herr_t H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value);
+static herr_t H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value);
+static herr_t H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__json_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value);
+static herr_t H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+static herr_t H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
+static herr_t H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
+static herr_t H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+static herr_t H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
+static herr_t H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
+static herr_t H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Note that there's no cache set up call since that's the
+ * place where this struct is wired into the cache.
+ */
+static H5C_log_class_t H5C_json_log_class_g = {
+ "json",
+ H5C__json_tear_down_logging,
+ NULL, /* start logging */
+ NULL, /* stop logging */
+ H5C__json_write_start_log_msg,
+ H5C__json_write_stop_log_msg,
+ H5C__json_write_create_cache_log_msg,
+ H5C__json_write_destroy_cache_log_msg,
+ H5C__json_write_evict_cache_log_msg,
+ H5C__json_write_expunge_entry_log_msg,
+ H5C__json_write_flush_cache_log_msg,
+ H5C__json_write_insert_entry_log_msg,
+ H5C__json_write_mark_entry_dirty_log_msg,
+ H5C__json_write_mark_entry_clean_log_msg,
+ H5C__json_write_mark_unserialized_entry_log_msg,
+ H5C__json_write_mark_serialized_entry_log_msg,
+ H5C__json_write_move_entry_log_msg,
+ H5C__json_write_pin_entry_log_msg,
+ H5C__json_write_create_fd_log_msg,
+ H5C__json_write_protect_entry_log_msg,
+ H5C__json_write_resize_entry_log_msg,
+ H5C__json_write_unpin_entry_log_msg,
+ H5C__json_write_destroy_fd_log_msg,
+ H5C__json_write_unprotect_entry_log_msg,
+ H5C__json_write_set_cache_config_log_msg,
+ H5C__json_write_remove_entry_log_msg
+};
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_log_message
+ *
+ * Purpose: Write a message to the log file and flush the file.
+ * The message string is neither modified nor freed.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_log_message(H5C_log_json_udata_t *json_udata)
+{
+ size_t n_chars;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->outfile);
+ HDassert(json_udata->message);
+
+ /* Write the log message and flush */
+ n_chars = HDstrlen(json_udata->message);
+ if((int)n_chars != HDfprintf(json_udata->outfile, json_udata->message))
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message")
+ HDmemset((void *)(json_udata->message), 0, (size_t)(n_chars * sizeof(char)));
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_log_message() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_json_set_up
+ *
+ * Purpose: Setup for metadata cache logging.
+ *
+ * Metadata logging is enabled and disabled at two levels. This
+ * function and the associated tear_down function open and close
+ * the log file. the start_ and stop_logging functions are then
+ * used to switch logging on/off. Optionally, logging can begin
+ * as soon as the log file is opened (set via the start_immediately
+ * parameter to this function).
+ *
+ * The log functionality is split between the H5C and H5AC
+ * packages. Log state and direct log manipulation resides in
+ * H5C. Log messages are generated in H5AC and sent to
+ * the H5C__json_write_log_message function.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank)
+{
+ H5C_log_json_udata_t *json_udata = NULL;
+ char *file_name = NULL;
+ size_t n_chars;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(log_info);
+ HDassert(log_location);
+
+ /* Set up the class struct */
+ log_info->cls = &H5C_json_log_class_g;
+
+ /* Allocate memory for the JSON-specific data */
+ if(NULL == (log_info->udata = H5MM_calloc(sizeof(H5C_log_json_udata_t))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
+ json_udata = (H5C_log_json_udata_t *)(log_info->udata);
+
+ /* Allocate memory for the message buffer */
+ if(NULL == (json_udata->message = (char *)H5MM_calloc(H5C_MAX_JSON_LOG_MSG_SIZE * sizeof(char))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
+
+ /* Possibly fix up the log file name.
+ * The extra 39 characters are for adding the rank to the file name
+ * under parallel HDF5. 39 characters allows > 2^127 processes which
+ * should be enough for anybody.
+ *
+ * allocation size = "RANK_" + <rank # length> + dot + <path length> + \0
+ */
+ n_chars = 5 + 39 + 1 + HDstrlen(log_location) + 1;
+ if(NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate memory for mdc log file name manipulation")
+
+ /* Add the rank to the log file name when MPI is in use */
+ if(-1 == mpi_rank)
+ HDsnprintf(file_name, n_chars, "%s", log_location);
+ else
+ HDsnprintf(file_name, n_chars, "RANK_%d.%s", mpi_rank, log_location);
+
+ /* Open log file and set it to be unbuffered */
+ if(NULL == (json_udata->outfile = HDfopen(file_name, "w")))
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file")
+ HDsetbuf(json_udata->outfile, NULL);
+
+ done:
+ if(file_name)
+ H5MM_xfree(file_name);
+
+ /* Free and reset the log info struct on errors */
+ if(FAIL == ret_value) {
+ /* Free */
+ if(json_udata && json_udata->message)
+ H5MM_xfree(json_udata->message);
+ if(json_udata)
+ H5MM_xfree(json_udata);
+
+ /* Reset */
+ log_info->udata = NULL;
+ log_info->cls = NULL;
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_json_set_up() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_tear_down_logging
+ *
+ * Purpose: Tear-down for metadata cache logging.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_tear_down_logging(H5C_log_info_t *log_info)
+{
+ H5C_log_json_udata_t *json_udata = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(log_info);
+
+ /* Alias */
+ json_udata = (H5C_log_json_udata_t *)(log_info->udata);
+
+ /* Free the message buffer */
+ H5MM_xfree(json_udata->message);
+
+ /* Close log file */
+ if(EOF == HDfclose(json_udata->outfile))
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file")
+ json_udata->outfile = NULL;
+
+ /* Fre the udata */
+ H5MM_xfree(json_udata);
+
+ /* Reset the log class info and udata */
+ log_info->cls = NULL;
+ log_info->udata = NULL;
+
+ done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_tear_down_logging() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_start_log_msg
+ *
+ * Purpose: Write a log message when logging starts.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_start_log_msg(void *udata)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string (opens the JSON array) */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\n\
+\"HDF5 metadata cache log messages\" : [\n\
+{\
+\"timestamp\":%lld,\
+\"action\":\"logging start\"\
+},\n\
+"
+ , (long long)HDtime(NULL));
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_start_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_stop_log_msg
+ *
+ * Purpose: Write a log message when logging ends.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_stop_log_msg(void *udata)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string (closes the JSON array) */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"logging stop\"\
+}\n\
+]}\n\
+"
+ , (long long)HDtime(NULL));
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_stop_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_create_cache_log_msg
+ *
+ * Purpose: Write a log message for cache creation.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"create\",\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_create_cache_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_destroy_cache_log_msg
+ *
+ * Purpose: Write a log message for cache destruction.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_destroy_cache_log_msg(void *udata)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"destroy\"\
+},\n\
+"
+ , (long long)HDtime(NULL));
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_destroy_cache_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_evict_cache_log_msg
+ *
+ * Purpose: Write a log message for eviction of cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"evict\",\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_evict_cache_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_expunge_entry_log_msg
+ *
+ * Purpose: Write a log message for expunge of cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address,
+ int type_id, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"expunge\",\
+\"address\":0x%lx,\
+\"type_id\":%d,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)address, (int)type_id, (int)fxn_ret_value);
+
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_expunge_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_flush_cache_log_msg
+ *
+ * Purpose: Write a log message for cache flushes.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"flush\",\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_flush_cache_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_insert_entry_log_msg
+ *
+ * Purpose: Write a log message for insertion of cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address,
+ int type_id, unsigned flags, size_t size, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"insert\",\
+\"address\":0x%lx,\
+\"type_id\":%d,\
+\"flags\":0x%x,\
+\"size\":%d,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)address, type_id, flags,
+ (int)size, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_insert_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_mark_entry_dirty_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as dirty.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"dirty\",\
+\"address\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_mark_entry_dirty_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_mark_entry_clean_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as clean.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"clean\",\
+\"address\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_mark_entry_clean_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_mark_unserialized_entry_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as unserialized.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_mark_unserialized_entry_log_msg(void *udata,
+ const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"unserialized\",\
+\"address\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_mark_unserialized_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_mark_serialize_entry_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as serialize.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"serialized\",\
+\"address\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_mark_serialized_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_move_entry_log_msg
+ *
+ * Purpose: Write a log message for moving a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr,
+ int type_id, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"move\",\
+\"old_address\":0x%lx,\
+\"new_address\":0x%lx,\
+\"type_id\":%d,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)old_addr,
+ (unsigned long)new_addr, type_id, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_move_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_pin_entry_log_msg
+ *
+ * Purpose: Write a log message for pinning a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"pin\",\
+\"address\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr,
+ (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_pin_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_create_fd_log_msg
+ *
+ * Purpose: Write a log message for creating a flush dependency between
+ * two cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(parent);
+ HDassert(child);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"create_fd\",\
+\"parent_addr\":0x%lx,\
+\"child_addr\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)parent->addr,
+ (unsigned long)child->addr, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_create_fd_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_protect_entry_log_msg
+ *
+ * Purpose: Write a log message for protecting a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ int type_id, unsigned flags, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ char rw_s[16];
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ if(H5C__READ_ONLY_FLAG == flags)
+ HDstrcpy(rw_s, "READ");
+ else
+ HDstrcpy(rw_s, "WRITE");
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"protect\",\
+\"address\":0x%lx,\
+\"type_id\":%d,\
+\"readwrite\":\"%s\",\
+\"size\":%d,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr,
+ type_id, rw_s, (int)entry->size, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_protect_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_resize_entry_log_msg
+ *
+ * Purpose: Write a log message for resizing a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ size_t new_size, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"resize\",\
+\"address\":0x%lx,\
+\"new_size\":%d,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr,
+ (int)new_size, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_resize_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_unpin_entry_log_msg
+ *
+ * Purpose: Write a log message for unpinning a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"unpin\",\
+\"address\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr,
+ (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_unpin_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_destroy_fd_log_msg
+ *
+ * Purpose: Write a log message for destroying a flush dependency
+ * between two cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(parent);
+ HDassert(child);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"destroy_fd\",\
+\"parent_addr\":0x%lx,\
+\"child_addr\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)parent->addr,
+ (unsigned long)child->addr, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_destroy_fd_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_unprotect_entry_log_msg
+ *
+ * Purpose: Write a log message for unprotecting a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address,
+ int type_id, unsigned flags, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"unprotect\",\
+\"address\":0x%lx,\
+\"id\":%d,\
+\"flags\":%x,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)address,
+ type_id, flags, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_unprotect_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_set_cache_config_log_msg
+ *
+ * Purpose: Write a log message for setting the cache configuration.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config,
+ herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(config);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"set_config\",\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (int)fxn_ret_value);
+
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_set_cache_config_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_remove_entry_log_msg
+ *
+ * Purpose: Write a log message for removing a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"remove\",\
+\"address\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr,
+ (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_remove_entry_log_msg() */
+
diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c
new file mode 100644
index 0000000..7c1305c
--- /dev/null
+++ b/src/H5Clog_trace.c
@@ -0,0 +1,1007 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5Clog_trace.c
+ *
+ * Purpose: Cache log implementation that emits trace entries intended
+ * for consumption by a future 'cache replay' feature.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+#include "H5Cmodule.h" /* This source code file is part of the H5C module */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Cpkg.h" /* Cache */
+#include "H5Clog.h" /* Cache logging */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+/* Max log message size */
+#define H5C_MAX_TRACE_LOG_MSG_SIZE 2048
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+typedef struct H5C_log_trace_udata_t {
+ FILE *outfile;
+ char *message;
+} H5C_log_trace_udata_t;
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/* Internal message handling calls */
+static herr_t H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata);
+
+/* Log message callbacks */
+static herr_t H5C__trace_tear_down_logging(H5C_log_info_t *log_info);
+static herr_t H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Note that there's no cache set up call since that's the
+ * place where this struct is wired into the cache.
+ */
+static H5C_log_class_t H5C_trace_log_class_g = {
+ "trace",
+ H5C__trace_tear_down_logging,
+ NULL, /* start logging */
+ NULL, /* stop logging */
+ NULL, /* write start message */
+ NULL, /* write stop message */
+ NULL, /* write create cache message */
+ NULL, /* write destroy cache message */
+ NULL, /* write evict cache message */
+ H5C__trace_write_expunge_entry_log_msg,
+ H5C__trace_write_flush_cache_log_msg,
+ H5C__trace_write_insert_entry_log_msg,
+ H5C__trace_write_mark_entry_dirty_log_msg,
+ H5C__trace_write_mark_entry_clean_log_msg,
+ H5C__trace_write_mark_unserialized_entry_log_msg,
+ H5C__trace_write_mark_serialized_entry_log_msg,
+ H5C__trace_write_move_entry_log_msg,
+ H5C__trace_write_pin_entry_log_msg,
+ H5C__trace_write_create_fd_log_msg,
+ H5C__trace_write_protect_entry_log_msg,
+ H5C__trace_write_resize_entry_log_msg,
+ H5C__trace_write_unpin_entry_log_msg,
+ H5C__trace_write_destroy_fd_log_msg,
+ H5C__trace_write_unprotect_entry_log_msg,
+ H5C__trace_write_set_cache_config_log_msg,
+ H5C__trace_write_remove_entry_log_msg
+};
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_log_message
+ *
+ * Purpose: Write a message to the log file and flush the file.
+ * The message string is neither modified nor freed.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata)
+{
+ size_t n_chars;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->outfile);
+ HDassert(trace_udata->message);
+
+ /* Write the log message and flush */
+ n_chars = HDstrlen(trace_udata->message);
+ if((int)n_chars != HDfprintf(trace_udata->outfile, trace_udata->message))
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message")
+ HDmemset((void *)(trace_udata->message), 0, (size_t)(n_chars * sizeof(char)));
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_log_message() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_trace_set_up
+ *
+ * Purpose: Setup for metadata cache logging.
+ *
+ * Metadata logging is enabled and disabled at two levels. This
+ * function and the associated tear_down function open and close
+ * the log file. the start_ and stop_logging functions are then
+ * used to switch logging on/off. Optionally, logging can begin
+ * as soon as the log file is opened (set via the start_immediately
+ * parameter to this function).
+ *
+ * The log functionality is split between the H5C and H5AC
+ * packages. Log state and direct log manipulation resides in
+ * H5C. Log messages are generated in H5AC and sent to
+ * the H5C__trace_write_log_message function.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank)
+{
+ H5C_log_trace_udata_t *trace_udata = NULL;
+ char *file_name = NULL;
+ size_t n_chars;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(log_info);
+ HDassert(log_location);
+
+ /* Set up the class struct */
+ log_info->cls = &H5C_trace_log_class_g;
+
+ /* Allocate memory for the JSON-specific data */
+ if(NULL == (log_info->udata = H5MM_calloc(sizeof(H5C_log_trace_udata_t))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
+ trace_udata = (H5C_log_trace_udata_t *)(log_info->udata);
+
+ /* Allocate memory for the message buffer */
+ if(NULL == (trace_udata->message = (char *)H5MM_calloc(H5C_MAX_TRACE_LOG_MSG_SIZE * sizeof(char))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
+
+ /* Possibly fix up the log file name.
+ * The extra 39 characters are for adding the rank to the file name
+ * under parallel HDF5. 39 characters allows > 2^127 processes which
+ * should be enough for anybody.
+ *
+ * allocation size = <path length> + dot + <rank # length> + \0
+ */
+ n_chars = HDstrlen(log_location) + 1 + 39 + 1;
+ if(NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate memory for mdc log file name manipulation")
+
+ /* Add the rank to the log file name when MPI is in use */
+ if(-1 == mpi_rank)
+ HDsnprintf(file_name, n_chars, "%s", log_location);
+ else
+ HDsnprintf(file_name, n_chars, "%s.%d", log_location, mpi_rank);
+
+ /* Open log file and set it to be unbuffered */
+ if(NULL == (trace_udata->outfile = HDfopen(file_name, "w")))
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file")
+ HDsetbuf(trace_udata->outfile, NULL);
+
+ /* Write the header */
+ HDfprintf(trace_udata->outfile, "### HDF5 metadata cache trace file version 1 ###\n");
+
+ done:
+ if(file_name)
+ H5MM_xfree(file_name);
+
+ /* Free and reset the log info struct on errors */
+ if(FAIL == ret_value) {
+ /* Free */
+ if(trace_udata && trace_udata->message)
+ H5MM_xfree(trace_udata->message);
+ if(trace_udata)
+ H5MM_xfree(trace_udata);
+
+ /* Reset */
+ log_info->udata = NULL;
+ log_info->cls = NULL;
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_trace_set_up() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_tear_down_logging
+ *
+ * Purpose: Tear-down for metadata cache logging.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_tear_down_logging(H5C_log_info_t *log_info)
+{
+ H5C_log_trace_udata_t *trace_udata = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(log_info);
+
+ /* Alias */
+ trace_udata = (H5C_log_trace_udata_t *)(log_info->udata);
+
+ /* Free the message buffer */
+ H5MM_xfree(trace_udata->message);
+
+ /* Close log file */
+ if(EOF == HDfclose(trace_udata->outfile))
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file")
+ trace_udata->outfile = NULL;
+
+ /* Fre the udata */
+ H5MM_xfree(trace_udata);
+
+ /* Reset the log class info and udata */
+ log_info->cls = NULL;
+ log_info->udata = NULL;
+
+ done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_tear_down_logging() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_expunge_entry_log_msg
+ *
+ * Purpose: Write a log message for expunge of cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address,
+ int type_id, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_expunge_entry 0x%lx %d %d\n",
+ (unsigned long)address, type_id, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_expunge_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_flush_cache_log_msg
+ *
+ * Purpose: Write a log message for cache flushes.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_flush %d\n",
+ (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_flush_cache_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_insert_entry_log_msg
+ *
+ * Purpose: Write a log message for insertion of cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address,
+ int type_id, unsigned flags, size_t size, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_insert_entry 0x%lx %d 0x%x %d %d\n",
+ (unsigned long)address, type_id, flags, (int)size, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_insert_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_mark_entry_dirty_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as dirty.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_dirty 0x%lx %d\n",
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_mark_entry_dirty_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_mark_entry_clean_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as clean.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_clean 0x%lx %d\n",
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_mark_entry_clean_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_mark_unserialized_entry_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as unserialized.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_mark_unserialized_entry_log_msg(void *udata,
+ const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_unserialized 0x%lx %d\n",
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_mark_unserialized_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_mark_serialized_entry_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as serialize.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_serialized 0x%lx %d\n",
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_mark_serialized_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_move_entry_log_msg
+ *
+ * Purpose: Write a log message for moving a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr,
+ int type_id, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_move_entry 0x%lx 0x%lx %d %d\n",
+ (unsigned long)old_addr, (unsigned long)new_addr, type_id, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_move_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_pin_entry_log_msg
+ *
+ * Purpose: Write a log message for pinning a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_pin_protected_entry 0x%lx %d\n",
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_pin_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_create_fd_log_msg
+ *
+ * Purpose: Write a log message for creating a flush dependency between
+ * two cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(parent);
+ HDassert(child);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_create_flush_dependency 0x%lx 0x%lx %d\n",
+ (unsigned long)(parent->addr), (unsigned long)(child->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_create_fd_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_protect_entry_log_msg
+ *
+ * Purpose: Write a log message for protecting a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ int type_id, unsigned flags, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_protect 0x%lx %d 0x%x %d %d\n",
+ (unsigned long)(entry->addr), type_id, flags, (int)(entry->size), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_protect_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_resize_entry_log_msg
+ *
+ * Purpose: Write a log message for resizing a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ size_t new_size, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_resize_entry 0x%lx %d %d\n",
+ (unsigned long)(entry->addr), (int)new_size, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_resize_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_unpin_entry_log_msg
+ *
+ * Purpose: Write a log message for unpinning a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unpin_entry 0x%lx %d\n",
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_unpin_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_destroy_fd_log_msg
+ *
+ * Purpose: Write a log message for destroying a flush dependency
+ * between two cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(parent);
+ HDassert(child);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_destroy_flush_dependency 0x%lx 0x%lx %d\n",
+ (unsigned long)(parent->addr), (unsigned long)(child->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_destroy_fd_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_unprotect_entry_log_msg
+ *
+ * Purpose: Write a log message for unprotecting a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address,
+ int type_id, unsigned flags, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unprotect 0x%lx %d 0x%x %d\n",
+ (unsigned long)(address), type_id, flags, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_unprotect_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_set_cache_config_log_msg
+ *
+ * Purpose: Write a log message for setting the cache configuration.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config,
+ herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(config);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE,
+ "H5AC_set_cache_auto_resize_config %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f %d %d %d %f %f %d %d %d %d %f %zu %d %d\n",
+ config->version,
+ (int)(config->rpt_fcn_enabled),
+ (int)(config->open_trace_file),
+ (int)(config->close_trace_file),
+ config->trace_file_name,
+ (int)(config->evictions_enabled),
+ (int)(config->set_initial_size),
+ (int)(config->initial_size),
+ config->min_clean_fraction,
+ (int)(config->max_size),
+ (int)(config->min_size),
+ config->epoch_length,
+ (int)(config->incr_mode),
+ config->lower_hr_threshold,
+ config->increment,
+ (int)(config->flash_incr_mode),
+ config->flash_multiple,
+ config->flash_threshold,
+ (int)(config->apply_max_increment),
+ (int)(config->max_increment),
+ (int)(config->decr_mode),
+ config->upper_hr_threshold,
+ config->decrement,
+ (int)(config->apply_max_decrement),
+ (int)(config->max_decrement),
+ config->epochs_before_eviction,
+ (int)(config->apply_empty_reserve),
+ config->empty_reserve,
+ config->dirty_bytes_threshold,
+ config->metadata_write_strategy,
+ (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_set_cache_config_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_remove_entry_log_msg
+ *
+ * Purpose: Write a log message for removing a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_remove_entry 0x%lx %d\n",
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_remove_entry_log_msg() */
+
diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c
index ecaed62..84ec16c 100644
--- a/src/H5Cmpio.c
+++ b/src/H5Cmpio.c
@@ -214,10 +214,10 @@ H5C_apply_candidate_list(H5F_t * f,
HDmemset(tbl_buf, 0, sizeof(tbl_buf));
- sprintf(&(tbl_buf[0]), "candidate list = ");
+ HDsprintf(&(tbl_buf[0]), "candidate list = ");
for(u = 0; u < num_candidates; u++)
- sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " 0x%llx", (long long)(*(candidates_list_ptr + u)));
- sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
+ HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " 0x%llx", (long long)(*(candidates_list_ptr + u)));
+ HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
HDfprintf(stdout, "%s", tbl_buf);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
@@ -280,10 +280,10 @@ H5C_apply_candidate_list(H5F_t * f,
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
for ( i = 0; i < 1024; i++ )
tbl_buf[i] = '\0';
- sprintf(&(tbl_buf[0]), "candidate assignment table = ");
+ HDsprintf(&(tbl_buf[0]), "candidate assignment table = ");
for(i = 0; i <= mpi_size; i++)
- sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %d", candidate_assignment_table[i]);
- sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
+ HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %d", candidate_assignment_table[i]);
+ HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
HDfprintf(stdout, "%s", tbl_buf);
HDfprintf(stdout, "%s:%d: flush entries [%u, %u].\n",
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index 98d7a01..9156c0d 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -37,6 +37,7 @@
#include "H5Cprivate.h"
/* Other private headers needed by this file */
+#include "H5Clog.h" /* Cache logging */
#include "H5SLprivate.h" /* Skip lists */
/**************************/
@@ -3497,40 +3498,8 @@ typedef struct H5C_tag_info_t {
* flush_in_progress: Boolean flag indicating whether a flush is in
* progress.
*
- * trace_file_ptr: File pointer pointing to the trace file, which is used
- * to record cache operations for use in simulations and design
- * studies. This field will usually be NULL, indicating that
- * no trace file should be recorded.
- *
- * Since much of the code supporting the parallel metadata
- * cache is in H5AC, we don't write the trace file from
- * H5C. Instead, H5AC reads the trace_file_ptr as needed.
- *
- * When we get to using H5C in other places, we may add
- * code to write trace file data at the H5C level as well.
- *
- * logging_enabled: Boolean flag indicating whether cache logging
- * which is used to record cache operations for use in
- * debugging and performance analysis. When this flag is set
- * to TRUE, it means that the log file is open and ready to
- * receive log entries. It does NOT mean that cache operations
- * are currently being recorded. That is controlled by the
- * currently_logging flag (below).
- *
- * Since much of the code supporting the parallel metadata
- * cache is in H5AC, we don't write the trace file from
- * H5C. Instead, H5AC reads the trace_file_ptr as needed.
- *
- * When we get to using H5C in other places, we may add
- * code to write trace file data at the H5C level as well.
- *
- * currently_logging: Boolean flag that indicates if cache operations are
- * currently being logged. This flag is flipped by the
- * H5Fstart/stop_mdc_logging functions.
- *
- * log_file_ptr: File pointer pointing to the log file. The I/O functions
- * in stdio.h are used to write to the log file regardless of
- * the VFD selected.
+ * log_info: Information used by the MDC logging functionality.
+ * Described in H5Clog.h.
*
* aux_ptr: Pointer to void used to allow wrapper code to associate
* its data with an instance of H5C_t. The H5C cache code
@@ -3854,6 +3823,13 @@ typedef struct H5C_tag_info_t {
*
* ignore_tags: Boolean flag to disable tag validation during entry insertion.
*
+ * num_objs_corked: Unsigned integer field containing the number of objects
+ * that are "corked". The "corked" status of an object is
+ * found by searching the "tag_list". This field is added
+ * for optimization so that the skip list search on "tag_list"
+ * can be skipped if this field is zero, i.e. no "corked"
+ * objects.
+ *
* When a cache entry is protected, it must be removed from the LRU
* list(s) as it cannot be either flushed or evicted until it is unprotected.
* The following fields are used to implement the protected list (pl).
@@ -4676,10 +4652,7 @@ typedef struct H5C_tag_info_t {
struct H5C_t {
uint32_t magic;
hbool_t flush_in_progress;
- FILE * trace_file_ptr;
- hbool_t logging_enabled;
- hbool_t currently_logging;
- FILE * log_file_ptr;
+ H5C_log_info_t *log_info;
void * aux_ptr;
int32_t max_type_id;
const H5C_class_t * const *class_table_ptr;
@@ -4727,6 +4700,7 @@ struct H5C_t {
/* Fields for maintaining list of tagged entries */
H5SL_t * tag_list;
hbool_t ignore_tags;
+ uint32_t num_objs_corked;
/* Fields for tracking protected entries */
uint32_t pl_len;
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 38a86ee..d4ed6fc 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -2219,6 +2219,12 @@ typedef struct H5C_cache_image_ctl_t {
unsigned flags;
} H5C_cache_image_ctl_t;
+/* The cache logging output style */
+typedef enum H5C_log_style_t {
+ H5C_LOG_STYLE_JSON,
+ H5C_LOG_STYLE_TRACE
+} H5C_log_style_t;
+
/***************************************/
/* Library-private Function Prototypes */
/***************************************/
@@ -2227,13 +2233,6 @@ H5_DLL H5C_t *H5C_create(size_t max_cache_size, size_t min_clean_size,
int max_type_id, const H5C_class_t * const *class_table_ptr,
H5C_write_permitted_func_t check_write_permitted, hbool_t write_permitted,
H5C_log_flush_func_t log_flush, void *aux_ptr);
-H5_DLL herr_t H5C_set_up_logging(H5C_t *cache_ptr, const char log_location[], hbool_t start_immediately);
-H5_DLL herr_t H5C_tear_down_logging(H5C_t *cache_ptr);
-H5_DLL herr_t H5C_start_logging(H5C_t *cache_ptr);
-H5_DLL herr_t H5C_stop_logging(H5C_t *cache_ptr);
-H5_DLL herr_t H5C_get_logging_status(const H5C_t *cache_ptr, /*OUT*/ hbool_t *is_enabled,
- /*OUT*/ hbool_t *is_currently_logging);
-H5_DLL herr_t H5C_write_log_message(const H5C_t *cache_ptr, const char message[]);
H5_DLL void H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr, int32_t version,
double hit_rate, enum H5C_resize_status status,
size_t old_max_cache_size, size_t new_max_cache_size,
@@ -2267,8 +2266,6 @@ H5_DLL herr_t H5C_get_entry_status(const H5F_t *f, haddr_t addr,
hbool_t *image_up_to_date_ptr);
H5_DLL herr_t H5C_get_evictions_enabled(const H5C_t *cache_ptr, hbool_t *evictions_enabled_ptr);
H5_DLL void * H5C_get_aux_ptr(const H5C_t *cache_ptr);
-H5_DLL FILE *H5C_get_trace_file_ptr(const H5C_t *cache_ptr);
-H5_DLL FILE *H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr);
H5_DLL herr_t H5C_image_stats(H5C_t * cache_ptr, hbool_t print_header);
H5_DLL herr_t H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr,
void *thing, unsigned int flags);
@@ -2292,7 +2289,6 @@ H5_DLL herr_t H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr,
H5C_cache_image_ctl_t *config_ptr);
H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled);
H5_DLL herr_t H5C_set_prefix(H5C_t *cache_ptr, char *prefix);
-H5_DLL herr_t H5C_set_trace_file_ptr(H5C_t *cache_ptr, FILE *trace_file_ptr);
H5_DLL herr_t H5C_stats(H5C_t *cache_ptr, const char *cache_name,
hbool_t display_detailed_stats);
H5_DLL void H5C_stats__reset(H5C_t *cache_ptr);
@@ -2305,6 +2301,7 @@ H5_DLL herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr,
unsigned int tests);
H5_DLL herr_t H5C_ignore_tags(H5C_t *cache_ptr);
H5_DLL hbool_t H5C_get_ignore_tags(const H5C_t *cache_ptr);
+H5_DLL uint32_t H5C_get_num_objs_corked(const H5C_t *cache_ptr);
H5_DLL herr_t H5C_retag_entries(H5C_t * cache_ptr, haddr_t src_tag, haddr_t dest_tag);
H5_DLL herr_t H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked);
H5_DLL herr_t H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring);
@@ -2316,6 +2313,11 @@ H5_DLL herr_t H5C_cache_image_status(H5F_t * f, hbool_t *load_ci_ptr,
H5_DLL hbool_t H5C_cache_image_pending(const H5C_t *cache_ptr);
H5_DLL herr_t H5C_get_mdc_image_info(H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len);
+/* Logging functions */
+H5_DLL herr_t H5C_start_logging(H5C_t *cache);
+H5_DLL herr_t H5C_stop_logging(H5C_t *cache);
+H5_DLL herr_t H5C_get_logging_status(const H5C_t *cache, /*OUT*/ hbool_t *is_enabled, /*OUT*/ hbool_t *is_currently_logging);
+
#ifdef H5_HAVE_PARALLEL
H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr,
unsigned num_candidates, haddr_t *candidates_list_ptr, int mpi_rank,
diff --git a/src/H5Cquery.c b/src/H5Cquery.c
index e4f3133..51ce1c2 100644
--- a/src/H5Cquery.c
+++ b/src/H5Cquery.c
@@ -351,64 +351,6 @@ H5C_get_aux_ptr(const H5C_t *cache_ptr)
/*-------------------------------------------------------------------------
- * Function: H5C_get_trace_file_ptr
- *
- * Purpose: Get the trace_file_ptr field from the cache.
- *
- * This field will either be NULL (which indicates that trace
- * file logging is turned off), or contain a pointer to the
- * open file to which trace file data is to be written.
- *
- * Return: Non-NULL trace file pointer (can't fail)
- *
- * Programmer: John Mainzer
- * 1/20/06
- *
- *-------------------------------------------------------------------------
- */
-FILE *
-H5C_get_trace_file_ptr(const H5C_t *cache_ptr)
-{
- FUNC_ENTER_NOAPI_NOERR
-
- /* Check arguments */
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
-
- FUNC_LEAVE_NOAPI(cache_ptr->trace_file_ptr)
-} /* H5C_get_trace_file_ptr() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5C_get_trace_file_ptr_from_entry
- *
- * Purpose: Get the trace_file_ptr field from the cache, via an entry.
- *
- * This field will either be NULL (which indicates that trace
- * file logging is turned off), or contain a pointer to the
- * open file to which trace file data is to be written.
- *
- * Return: Non-NULL trace file pointer (can't fail)
- *
- * Programmer: Quincey Koziol
- * 6/9/08
- *
- *-------------------------------------------------------------------------
- */
-FILE *
-H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr)
-{
- FUNC_ENTER_NOAPI_NOERR
-
- /* Sanity checks */
- HDassert(entry_ptr);
- HDassert(entry_ptr->cache_ptr);
-
- FUNC_LEAVE_NOAPI(H5C_get_trace_file_ptr(entry_ptr->cache_ptr))
-} /* H5C_get_trace_file_ptr_from_entry() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5C_get_entry_ring
*
* Purpose: Given a file address, retrieve the ring for an entry at that
diff --git a/src/H5Ctag.c b/src/H5Ctag.c
index 0f08ede..807e68d 100644
--- a/src/H5Ctag.c
+++ b/src/H5Ctag.c
@@ -175,6 +175,32 @@ H5C_get_ignore_tags(const H5C_t *cache_ptr)
/*-------------------------------------------------------------------------
*
+ * Function: H5C_get_num_objs_corked
+ *
+ * Purpose: Retrieve the 'num_objs_corked' field for the cache
+ *
+ * Return: 'num_objs_corked' value (can't fail)
+ *
+ * Programmer: Vailin Choi; Feb 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+uint32_t
+H5C_get_num_objs_corked(const H5C_t *cache_ptr)
+{
+ FUNC_ENTER_NOAPI_NOERR
+
+ /* Sanity checks */
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+
+ /* Return value for num_objs_corked */
+ FUNC_LEAVE_NOAPI(cache_ptr->num_objs_corked)
+} /* H5C_get_num_objs_corked */
+
+
+/*-------------------------------------------------------------------------
+ *
* Function: H5C__tag_entry
*
* Purpose: Tags an entry with the provided tag (contained in the API context).
diff --git a/src/H5D.c b/src/H5D.c
index 1e16868..fc350f2 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -29,6 +29,8 @@
#include "H5Iprivate.h" /* IDs */
#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
/****************/
/* Local Macros */
@@ -1027,7 +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, 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:
@@ -1063,7 +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, 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:
@@ -1104,7 +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, 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:
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 91f3b91..dcd3a8d 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -1073,21 +1073,19 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
if((file_space_normalized = H5S_hyper_normalize_offset((H5S_t *)file_space, old_offset)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to normalize selection")
- /* Decide the number of chunks in each dimension*/
- for(u = 0; u < f_ndims; u++) {
+ /* Decide the number of chunks in each dimension */
+ for(u = 0; u < f_ndims; u++)
/* Keep the size of the chunk dimensions as hsize_t for various routines */
fm->chunk_dim[u] = fm->layout->u.chunk.dim[u];
- } /* end for */
#ifdef H5_HAVE_PARALLEL
/* Calculate total chunk in file map*/
fm->select_chunk = NULL;
if(io_info->using_mpi_vfd) {
H5_CHECK_OVERFLOW(fm->layout->u.chunk.nchunks, hsize_t, size_t);
- if(fm->layout->u.chunk.nchunks) {
+ if(fm->layout->u.chunk.nchunks)
if(NULL == (fm->select_chunk = (H5D_chunk_info_t **)H5MM_calloc((size_t)fm->layout->u.chunk.nchunks * sizeof(H5D_chunk_info_t *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
- }
} /* end if */
#endif /* H5_HAVE_PARALLEL */
@@ -1129,10 +1127,9 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
HDassert(fm->single_space);
/* Allocate the single chunk information */
- if(NULL == dataset->shared->cache.chunk.single_chunk_info) {
+ if(NULL == dataset->shared->cache.chunk.single_chunk_info)
if(NULL == (dataset->shared->cache.chunk.single_chunk_info = H5FL_MALLOC(H5D_chunk_info_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
- } /* end if */
fm->single_chunk_info = dataset->shared->cache.chunk.single_chunk_info;
HDassert(fm->single_chunk_info);
@@ -1147,10 +1144,9 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
hbool_t sel_hyper_flag; /* Whether file selection is a hyperslab */
/* Initialize skip list for chunk selections */
- if(NULL == dataset->shared->cache.chunk.sel_chunks) {
+ if(NULL == dataset->shared->cache.chunk.sel_chunks)
if(NULL == (dataset->shared->cache.chunk.sel_chunks = H5SL_create(H5SL_TYPE_HSIZE, NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for chunk selections")
- } /* end if */
fm->sel_chunks = dataset->shared->cache.chunk.sel_chunks;
HDassert(fm->sel_chunks);
@@ -1245,10 +1241,9 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
fm->mchunk_tmpl = tmp_mspace;
/* Create temporary datatypes for selection iteration */
- if(!file_type) {
+ if(!file_type)
if(NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype")
- } /* end if */
/* Create selection iterator for memory selection */
if(0 == (elmt_size = H5T_get_size(mem_type)))
@@ -1493,6 +1488,9 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t
/* Set chunk location & hyperslab size */
for(u = 0; u < fm->f_ndims; u++) {
+ /* Validate this chunk dimension */
+ if(fm->layout->u.chunk.dim[u] == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u)
HDassert(sel_start[u] == sel_end[u]);
chunk_info->scaled[u] = sel_start[u] / fm->layout->u.chunk.dim[u];
coords[u] = chunk_info->scaled[u] * fm->layout->u.chunk.dim[u];
@@ -1537,7 +1535,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5D__create_chunk_file_map_hyper
*
- * Purpose: Create all chunk selections in file.
+ * Purpose: Create all chunk selections in file, for a hyperslab selection.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1553,8 +1551,8 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
#endif /* H5_HAVE_PARALLEL */
*io_info)
{
- hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
- hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
+ hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
+ hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
hsize_t sel_points; /* Number of elements in file selection */
hsize_t start_coords[H5O_LAYOUT_NDIMS]; /* Starting coordinates of selection */
hsize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */
@@ -1569,7 +1567,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
FUNC_ENTER_STATIC
/* Sanity check */
- HDassert(fm->f_ndims>0);
+ HDassert(fm->f_ndims > 0);
/* Get number of elements selected in file */
sel_points = fm->nelmts;
@@ -1580,6 +1578,9 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
/* Set initial chunk location & hyperslab size */
for(u = 0; u < fm->f_ndims; u++) {
+ /* Validate this chunk dimension */
+ if(fm->layout->u.chunk.dim[u] == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u)
scaled[u] = start_scaled[u] = sel_start[u] / fm->layout->u.chunk.dim[u];
coords[u] = start_coords[u] = scaled[u] * fm->layout->u.chunk.dim[u];
end[u] = (coords[u] + fm->chunk_dim[u]) - 1;
@@ -1590,7 +1591,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
/* Iterate through each chunk in the dataset */
while(sel_points) {
- /* Check for intersection of temporary chunk and file selection */
+ /* Check for intersection of current chunk and file selection */
/* (Casting away const OK - QAK) */
if(TRUE == H5S_hyper_intersect_block((H5S_t *)fm->file_space, coords, end)) {
H5S_t *tmp_fchunk; /* Temporary file dataspace */
@@ -1628,7 +1629,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
/* Add temporary chunk to the list of chunks */
/* Allocate the file & memory chunk information */
- if (NULL==(new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t))) {
+ if(NULL == (new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t))) {
(void)H5S_close(tmp_fchunk);
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
} /* end if */
@@ -1636,7 +1637,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
/* Initialize the chunk information */
/* Set the chunk index */
- new_chunk_info->index=chunk_index;
+ new_chunk_info->index = chunk_index;
#ifdef H5_HAVE_PARALLEL
/* Store chunk selection information, for multi-chunk I/O */
@@ -1649,16 +1650,13 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
new_chunk_info->fspace_shared = FALSE;
/* Set the memory chunk dataspace */
- new_chunk_info->mspace=NULL;
+ new_chunk_info->mspace = NULL;
new_chunk_info->mspace_shared = FALSE;
/* Copy the chunk's scaled coordinates */
HDmemcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
new_chunk_info->scaled[fm->f_ndims] = 0;
- /* Copy the chunk's scaled coordinates */
- HDmemcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
-
/* Insert the new chunk into the skip list */
if(H5SL_insert(fm->sel_chunks, new_chunk_info, &new_chunk_info->index) < 0) {
H5D__free_chunk_info(new_chunk_info, NULL, NULL);
@@ -1682,12 +1680,11 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
chunk_index++;
/* Set current increment dimension */
- curr_dim=(int)fm->f_ndims-1;
+ curr_dim = (int)fm->f_ndims - 1;
/* Increment chunk location in fastest changing dimension */
- H5_CHECK_OVERFLOW(fm->chunk_dim[curr_dim],hsize_t,hssize_t);
- coords[curr_dim]+=fm->chunk_dim[curr_dim];
- end[curr_dim]+=fm->chunk_dim[curr_dim];
+ coords[curr_dim] += fm->chunk_dim[curr_dim];
+ end[curr_dim] += fm->chunk_dim[curr_dim];
scaled[curr_dim]++;
/* Bring chunk location back into bounds, if necessary */
@@ -1701,11 +1698,14 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
/* Decrement current dimension */
curr_dim--;
- /* Increment chunk location in current dimension */
- scaled[curr_dim]++;
- coords[curr_dim] += fm->chunk_dim[curr_dim];
- end[curr_dim] = (coords[curr_dim] + fm->chunk_dim[curr_dim]) - 1;
- } while(coords[curr_dim] > sel_end[curr_dim]);
+ /* Check for valid current dim */
+ if(curr_dim >= 0) {
+ /* Increment chunk location in current dimension */
+ scaled[curr_dim]++;
+ coords[curr_dim] += fm->chunk_dim[curr_dim];
+ end[curr_dim] = (coords[curr_dim] + fm->chunk_dim[curr_dim]) - 1;
+ } /* end if */
+ } while(curr_dim >= 0 && (coords[curr_dim] > sel_end[curr_dim]));
/* Re-calculate the index of this chunk */
chunk_index = H5VM_array_offset_pre(fm->f_ndims, fm->layout->u.chunk.down_chunks, scaled);
@@ -1737,12 +1737,12 @@ static herr_t
H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
{
H5SL_node_t *curr_node; /* Current node in skip list */
- hsize_t file_sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
- hsize_t file_sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
- hsize_t mem_sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
- hsize_t mem_sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
- hssize_t adjust[H5O_LAYOUT_NDIMS]; /* Adjustment to make to all file chunks */
- hssize_t chunk_adjust[H5O_LAYOUT_NDIMS]; /* Adjustment to make to a particular chunk */
+ hsize_t file_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
+ hsize_t file_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
+ hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
+ hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
+ hssize_t adjust[H5S_MAX_RANK]; /* Adjustment to make to all file chunks */
+ hssize_t chunk_adjust[H5S_MAX_RANK]; /* Adjustment to make to a particular chunk */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1756,7 +1756,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */
/* Get the node */
- curr_node=H5SL_first(fm->sel_chunks);
+ curr_node = H5SL_first(fm->sel_chunks);
/* Get pointer to chunk's information */
chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node);
@@ -1779,15 +1779,15 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Calculate the adjustment for memory selection from file selection */
- HDassert(fm->m_ndims==fm->f_ndims);
- for(u=0; u<fm->f_ndims; u++) {
- H5_CHECK_OVERFLOW(file_sel_start[u],hsize_t,hssize_t);
- H5_CHECK_OVERFLOW(mem_sel_start[u],hsize_t,hssize_t);
- adjust[u]=(hssize_t)file_sel_start[u]-(hssize_t)mem_sel_start[u];
+ HDassert(fm->m_ndims == fm->f_ndims);
+ for(u = 0; u < fm->f_ndims; u++) {
+ H5_CHECK_OVERFLOW(file_sel_start[u], hsize_t, hssize_t);
+ H5_CHECK_OVERFLOW(mem_sel_start[u], hsize_t, hssize_t);
+ adjust[u] = (hssize_t)file_sel_start[u] - (hssize_t)mem_sel_start[u];
} /* end for */
/* Iterate over each chunk in the chunk list */
- curr_node=H5SL_first(fm->sel_chunks);
+ curr_node = H5SL_first(fm->sel_chunks);
while(curr_node) {
H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */
@@ -1826,7 +1826,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection")
/* Get the next chunk node in the skip list */
- curr_node=H5SL_next(curr_node);
+ curr_node = H5SL_next(curr_node);
} /* end while */
} /* end else */
@@ -1970,7 +1970,7 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u
{
H5D_chunk_map_t *fm = (H5D_chunk_map_t *)_fm; /* File<->memory chunk mapping info */
H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */
- hsize_t coords_in_mem[H5O_LAYOUT_NDIMS]; /* Coordinates of element in memory */
+ hsize_t coords_in_mem[H5S_MAX_RANK]; /* Coordinates of element in memory */
hsize_t chunk_index; /* Chunk index */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1992,14 +1992,13 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u
*/
/* Get the chunk node from the skip list */
if(NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_search(fm->sel_chunks, &chunk_index)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, FAIL, "can't locate chunk in skip list")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, H5_ITER_ERROR, "can't locate chunk in skip list")
/* Check if the chunk already has a memory space */
- if(NULL == chunk_info->mspace) {
+ if(NULL == chunk_info->mspace)
/* Copy the template memory chunk dataspace */
if(NULL == (chunk_info->mspace = H5S_copy(fm->mchunk_tmpl, FALSE, FALSE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file space")
- } /* end else */
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy file space")
/* Update the "last chunk seen" information */
fm->last_index = chunk_index;
@@ -2008,21 +2007,21 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u
/* Get coordinates of selection iterator for memory */
if(H5S_SELECT_ITER_COORDS(&fm->mem_iter, coords_in_mem) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator coordinates")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, H5_ITER_ERROR, "unable to get iterator coordinates")
/* Add point to memory selection for chunk */
if(fm->msel_type == H5S_SEL_POINTS) {
if(H5S_select_elements(chunk_info->mspace, H5S_SELECT_APPEND, (size_t)1, coords_in_mem) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, H5_ITER_ERROR, "unable to select element")
} /* end if */
else {
if(H5S_hyper_add_span_element(chunk_info->mspace, fm->m_ndims, coords_in_mem) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, H5_ITER_ERROR, "unable to select element")
} /* end else */
/* Move memory selection iterator to next element in selection */
if(H5S_SELECT_ITER_NEXT(&fm->mem_iter, (size_t)1) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to move to next iterator location")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, H5_ITER_ERROR, "unable to move to next iterator location")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2908,9 +2907,6 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled,
/* Check for cached information */
if(!H5D__chunk_cinfo_cache_found(&dset->shared->cache.chunk.last, udata)) {
H5D_chk_idx_info_t idx_info; /* Chunked index info */
-#ifdef H5_HAVE_PARALLEL
- H5P_coll_md_read_flag_t temp_cmr; /* Temp value to hold the coll metadata read setting */
-#endif /* H5_HAVE_PARALLEL */
/* Compose chunked index info struct */
idx_info.f = dset->oloc.file;
@@ -2919,25 +2915,18 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled,
idx_info.storage = &dset->shared->layout.storage.u.chunk;
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) {
- /* disable collective metadata read for chunk indexes
- as it is highly unlikely that users would read the
- same chunks from all processes. MSC - might turn on
- for root node? */
- temp_cmr = H5F_COLL_MD_READ(idx_info.f);
- H5F_set_coll_md_read(idx_info.f, H5P_FORCE_FALSE);
- } /* end if */
+ /* Disable collective metadata read for chunk indexes as it is
+ * highly unlikely that users would read the same chunks from all
+ * processes.
+ */
+ if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI))
+ H5CX_set_coll_metadata_read(FALSE);
#endif /* H5_HAVE_PARALLEL */
/* Go get the chunk information */
if((dset->shared->layout.storage.u.chunk.ops->get_addr)(&idx_info, udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address")
-#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI))
- H5F_set_coll_md_read(idx_info.f, temp_cmr);
-#endif /* H5_HAVE_PARALLEL */
-
/*
* Cache the information retrieved.
*
@@ -4043,6 +4032,9 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
* assume here that all elements of space_dim are > 0. This is checked at
* the top of this function. */
for(op_dim=0; op_dim<space_ndims; op_dim++) {
+ /* Validate this chunk dimension */
+ if(chunk_dim[op_dim] == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim)
min_unalloc[op_dim] = (old_dim[op_dim] + chunk_dim[op_dim] - 1) / chunk_dim[op_dim];
max_unalloc[op_dim] = (space_dim[op_dim] - 1) / chunk_dim[op_dim];
@@ -4484,13 +4476,17 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
/* Start off with this dimension marked as not needing to be modified */
new_full_dim[op_dim] = FALSE;
+ /* Validate this chunk dimension */
+ if(chunk_dim[op_dim] == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim)
+
/* Calculate offset of first previously incomplete chunk in this
* dimension */
- old_edge_chunk_sc[op_dim] = (old_dim[op_dim] / chunk_dim[op_dim]);
+ old_edge_chunk_sc[op_dim] = (old_dim[op_dim] / chunk_dim[op_dim]);
/* Calculate the largest offset of chunks that might need to be
* modified in this dimension */
- max_edge_chunk_sc[op_dim] = MIN((old_dim[op_dim] - 1) / chunk_dim[op_dim],
+ max_edge_chunk_sc[op_dim] = MIN((old_dim[op_dim] - 1) / chunk_dim[op_dim],
MAX((space_dim[op_dim] / chunk_dim[op_dim]), 1) - 1);
/* Check for old_dim aligned with chunk boundary in this dimension, if
@@ -4626,6 +4622,8 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size")
/* Distribute evenly the number of blocks between processes. */
+ if(mpi_size == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Resulted in division by zero")
num_blocks = chunk_info->num_io / mpi_size; /* value should be the same on all procs */
/* after evenly distributing the blocks between processes, are
@@ -5066,6 +5064,10 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
HDmemset(min_mod_chunk_sc, 0, sizeof(min_mod_chunk_sc));
HDmemset(max_mod_chunk_sc, 0, sizeof(max_mod_chunk_sc));
for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) {
+ /* Validate this chunk dimension */
+ if(chunk_dim[op_dim] == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim)
+
/* Calculate the largest offset of chunks that might need to be
* modified in this dimension */
max_mod_chunk_sc[op_dim] = (old_dim[op_dim] - 1) / chunk_dim[op_dim];
@@ -5721,9 +5723,12 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
/* (background buffer has already been zeroed out, if not expanding) */
if(udata->cpy_info->expand_ref) {
size_t ref_count;
+ size_t dt_size;
/* Determine # of reference elements to copy */
- ref_count = nbytes / H5T_get_size(udata->dt_src);
+ if((dt_size = H5T_get_size(udata->dt_src)) == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "size must not be 0")
+ ref_count = nbytes / dt_size;
/* Copy the reference elements */
if(H5O_copy_expand_ref(udata->file_src, buf, udata->idx_info_dst->f, bkg, ref_count, H5T_get_ref_type(udata->dt_src), udata->cpy_info) < 0)
@@ -6281,15 +6286,16 @@ H5D__chunk_stats(const H5D_t *dset, hbool_t headers)
HGOTO_DONE(SUCCEED)
if (headers) {
- fprintf(H5DEBUG(AC), "H5D: raw data cache statistics\n");
- fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n",
+ HDfprintf(H5DEBUG(AC), "H5D: raw data cache statistics\n");
+ HDfprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n",
"Layer", "Hits", "Misses", "MissRate", "Inits", "Flushes");
- fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n",
+ HDfprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n",
"-----", "----", "------", "--------", "-----", "-------");
}
#ifdef H5AC_DEBUG
- if (H5DEBUG(AC)) headers = TRUE;
+ if (H5DEBUG(AC))
+ headers = TRUE;
#endif
if (headers) {
@@ -6300,12 +6306,12 @@ H5D__chunk_stats(const H5D_t *dset, hbool_t headers)
miss_rate = 0.0;
}
if (miss_rate > 100) {
- sprintf(ascii, "%7d%%", (int) (miss_rate + 0.5));
+ HDsprintf(ascii, "%7d%%", (int) (miss_rate + 0.5));
} else {
- sprintf(ascii, "%7.2f%%", miss_rate);
+ HDsprintf(ascii, "%7.2f%%", miss_rate);
}
- fprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n",
+ HDfprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n",
"raw data chunks", rdcc->stats.nhits, rdcc->stats.nmisses, ascii,
rdcc->stats.ninits, (long)(rdcc->stats.nflushes)-(long)(rdcc->stats.ninits));
}
diff --git a/src/H5Dearray.c b/src/H5Dearray.c
index a20145a..a8fffbc 100644
--- a/src/H5Dearray.c
+++ b/src/H5Dearray.c
@@ -437,7 +437,7 @@ H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
HDassert(elmt);
/* Print element */
- sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str,
*(const haddr_t *)elmt);
@@ -596,7 +596,7 @@ H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
HDassert(elmt);
/* Print element */
- sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str,
elmt->addr, elmt->nbytes, elmt->filter_mask);
diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c
index 372ae26..2d85e3b 100644
--- a/src/H5Dfarray.c
+++ b/src/H5Dfarray.c
@@ -434,7 +434,7 @@ H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
HDassert(elmt);
/* Print element */
- sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str,
*(const haddr_t *)elmt);
@@ -699,7 +699,7 @@ H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
HDassert(elmt);
/* Print element */
- sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str,
elmt->addr, elmt->nbytes, elmt->filter_mask);
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 6bb3343..384c66b 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -25,6 +25,7 @@
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
#include "H5FLprivate.h" /* Free Lists */
#include "H5FOprivate.h" /* File objects */
#include "H5Iprivate.h" /* IDs */
@@ -59,6 +60,9 @@ static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overw
hsize_t old_dim[]);
static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id);
static herr_t H5D__close_cb(H5VL_object_t *dset_vol_obj);
+static herr_t H5D__use_minimized_dset_headers(H5F_t *file, H5D_t *dset, hbool_t *minimize);
+static herr_t H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc);
+static size_t H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr);
/*********************/
@@ -484,6 +488,9 @@ H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type)
new_dset->dcpl_id = H5P_copy_plist(plist, FALSE);
} /* end else */
+ /* Set the DCPL for the API context */
+ H5CX_set_dcpl(new_dset->dcpl_id);
+
/* Set return value */
ret_value = new_dset;
@@ -658,6 +665,208 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5D__use_minimized_dset_headers
+ *
+ * Purpose: Compartmentalize check for file- or dcpl-set values indicating
+ * to create a "minimized" dataset object header.
+ * Upon success, write resulting value to out pointer `minimize`.
+ *
+ * Return: Success: SUCCEED (0) (non-negative value)
+ * Failure: FAIL (-1) (negative value)
+ *
+ * Programmer: Jacob Smith
+ * 16 August 2018
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__use_minimized_dset_headers(H5F_t *file, H5D_t *dset, hbool_t *minimize)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT;
+
+ HDassert(file);
+ HDassert(dset);
+ HDassert(minimize);
+
+ /* Get the dataset object header minimize flag for this call */
+ if(H5CX_get_dset_min_ohdr_flag(minimize) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset object header minimize flag from API context")
+
+ if(FALSE == *minimize)
+ *minimize = H5F_get_min_dset_ohdr(file);
+
+done:
+ if(FAIL == ret_value)
+ *minimize = FALSE;
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* H5D__use_minimized_dset_headers */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__calculate_minimium_header_size
+ *
+ * Purpose: Calculate the size required for the minimized object header.
+ *
+ * Return: Success: Positive value > 0
+ * Failure: 0
+ *
+ * Programmer: Jacob Smith
+ * 16 August 2018
+ *-------------------------------------------------------------------------
+ */
+static size_t
+H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr)
+{
+ H5T_t *type = NULL;
+ H5O_fill_t *fill_prop = NULL;
+ hbool_t use_at_least_v18 = FALSE;
+ const char continuation[1] = ""; /* requred for work-around */
+ size_t get_value = 0;
+ size_t ret_value = 0;
+
+ FUNC_ENTER_NOAPI_NOINIT;
+
+ HDassert(file);
+ HDassert(dset);
+ HDassert(ohdr);
+
+ type = dset->shared->type;
+ fill_prop = &(dset->shared->dcpl_cache.fill);
+ use_at_least_v18 = (H5F_LOW_BOUND(file) >= H5F_LIBVER_V18);
+
+ /* Datatype message size */
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_DTYPE_ID, type, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "Can't get size of datatype message")
+ ret_value += get_value;
+
+ /* Shared Dataspace message size */
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_SDSPACE_ID, dset->shared->space, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of dataspace message")
+ ret_value += get_value;
+
+ /* "Layout" message size */
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_LAYOUT_ID, &dset->shared->layout, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of layout message")
+ ret_value += get_value;
+
+ /* Fill Value message size */
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_FILL_NEW_ID, fill_prop, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of fill value message")
+ ret_value += get_value;
+
+ /* "Continuation" message size */
+ /* message pointer "continuation" is unused by raw get function, however,
+ * a null pointer would be intercepted by an assert in H5O_msg_size_oh().
+ */
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_CONT_ID, continuation, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of continuation message")
+ ret_value += get_value;
+
+ /* Fill Value (backwards compatability) message size */
+ if(fill_prop->buf && !use_at_least_v18) {
+ H5O_fill_t old_fill_prop; /* Copy for writing "old" fill value */
+
+ /* Shallow copy the fill value property */
+ /* guards against shared component modification */
+ HDmemcpy(&old_fill_prop, fill_prop, sizeof(old_fill_prop));
+
+ if (H5O_msg_reset_share(H5O_FILL_ID, &old_fill_prop) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't reset the copied fill property")
+
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_FILL_ID, &old_fill_prop, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of fill value (backwards compat) message")
+ ret_value += get_value;
+ }
+
+ /* Filter/Pipeline message size */
+ if(H5D_CHUNKED == dset->shared->layout.type) {
+ H5O_pline_t *pline = &dset->shared->dcpl_cache.pline;
+ if(pline->nused > 0) {
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_PLINE_ID, pline, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of filter message")
+ ret_value += get_value;
+ }
+ }
+
+ /* External File Link message size */
+ if(dset->shared->dcpl_cache.efl.nused > 0) {
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_EFL_ID, &dset->shared->dcpl_cache.efl, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of external file link message")
+ ret_value += get_value;
+ }
+
+ /* Modification Time message size */
+ if(H5O_HDR_STORE_TIMES & H5O_OH_GET_FLAGS(ohdr)) {
+ HDassert(H5O_OH_GET_VERSION(ohdr) >= 1); /* 1 :: H5O_VERSION_1 (H5Opkg.h) */
+
+ if(H5O_OH_GET_VERSION(ohdr) == 1) {
+ /* v1 object headers store modification time as a message */
+ time_t mtime;
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_MTIME_NEW_ID, &mtime, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of modification time message")
+ ret_value += get_value;
+ }
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* H5D__calculate_minimum_header_size */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__prepare_minimized_oh
+ *
+ * Purpose: Create an object header (H5O_t) allocated with the smallest
+ * possible size.
+ *
+ * Return: Success: SUCCEED (0) (non-negative value)
+ * Failure: FAIL (-1) (negative value)
+ *
+ * Programmer: Jacob Smith
+ * 16 August 2018
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc)
+{
+ H5O_t *oh = NULL;
+ size_t ohdr_size = 0;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT;
+
+ HDassert(file);
+ HDassert(dset);
+ HDassert(oloc);
+
+ oh = H5O__create_ohdr(file, dset->shared->dcpl_id);
+ if(NULL == oh)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "can't instantiate object header")
+
+ ohdr_size = H5D__calculate_minimum_header_size(file, dset, oh);
+ if (ohdr_size == 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "computed header size is invalid")
+
+ /* Special allocation of space for compact datsets is handled by the call here. */
+ if(H5O__apply_ohdr(file, oh, dset->shared->dcpl_id, ohdr_size, (size_t)1, oloc) == FAIL)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "can't apply object header to file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* H5D__prepare_minimized_oh */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__update_oh_info
*
* Purpose: Create and fill object header for dataset
@@ -669,17 +878,18 @@ done:
static herr_t
H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
{
- H5O_t *oh = NULL; /* Pointer to dataset's object header */
- size_t ohdr_size = H5D_MINHDR_SIZE; /* Size of dataset's object header */
- H5O_loc_t *oloc = NULL; /* Dataset's object location */
- H5O_layout_t *layout; /* Dataset's layout information */
- H5T_t *type; /* Dataset's datatype */
- H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
- H5D_fill_value_t fill_status; /* Fill value status */
- hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */
- hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
- hbool_t use_at_least_v18; /* Flag indicating to use at least v18 format versions */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_t *oh = NULL; /* Pointer to dataset's object header */
+ size_t ohdr_size = H5D_MINHDR_SIZE; /* Size of dataset's object header */
+ H5O_loc_t *oloc = NULL; /* Dataset's object location */
+ H5O_layout_t *layout; /* Dataset's layout information */
+ H5T_t *type; /* Dataset's datatype */
+ H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
+ H5D_fill_value_t fill_status; /* Fill value status */
+ hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */
+ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
+ hbool_t use_at_least_v18; /* Flag indicating to use at least v18 format versions */
+ hbool_t minimize_header = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -747,13 +957,24 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value info")
} /* end if */
- /* Add the dataset's raw data size to the size of the header, if the raw data will be stored as compact */
- if(layout->type == H5D_COMPACT)
- ohdr_size += layout->storage.u.compact.size;
+ if(H5D__use_minimized_dset_headers(file, dset, &minimize_header) == FAIL)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get minimize settings")
+
+ if(TRUE == minimize_header) {
+ if(H5D__prepare_minimized_oh(file, dset, oloc) == FAIL)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create minimized dataset object header")
+ } else {
+ /* Add the dataset's raw data size to the size of the header, if the
+ * raw data will be stored as compact
+ */
+ if(H5D_COMPACT == layout->type)
+ ohdr_size += layout->storage.u.compact.size;
+
+ /* Create an object header for the dataset */
+ if(H5O_create(file, ohdr_size, (size_t)1, dset->shared->dcpl_id, oloc/*out*/) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset object header")
+ } /* If use minimum/standard object header space */
- /* Create an object header for the dataset */
- if(H5O_create(file, ohdr_size, (size_t)1, dset->shared->dcpl_id, oloc/*out*/) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset object header")
HDassert(file == dset->oloc.file);
/* Pin the object header */
@@ -910,7 +1131,7 @@ H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
} /* end if */
else {
- if (HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) {
+ if(HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) {
/* Replace ${ORIGIN} at beginning of prefix by directory of HDF5 file */
filepath_len = HDstrlen(filepath);
prefix_len = HDstrlen(prefix);
diff --git a/src/H5Dio.c b/src/H5Dio.c
index f977b0e..2f87e38 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -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"
@@ -242,7 +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, 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:
@@ -370,7 +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, 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:
@@ -655,22 +657,12 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Various MPI based checks */
#ifdef H5_HAVE_PARALLEL
- if H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI) {
- /* If MPI based VFD is used, no VL datatype support yet. */
- /* This is because they use the global heap in the file and we don't */
- /* support parallel access of that yet */
- if(H5T_detect_class(type_info.mem_type, H5T_VLEN, FALSE) > 0)
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing VL datatypes yet")
-
- /* If MPI based VFD is used, no VL datatype support yet. */
+ if(H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI)) {
+ /* If MPI based VFD is used, no VL or region reference datatype support yet. */
/* This is because they use the global heap in the file and we don't */
/* support parallel access of that yet */
- /* We should really use H5T_detect_class() here, but it will be difficult
- * to detect the type of the reference if it is nested... -QAK
- */
- if(H5T_get_class(type_info.mem_type, TRUE) == H5T_REFERENCE &&
- H5T_get_ref_type(type_info.mem_type) == H5R_DATASET_REGION)
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing region reference datatypes yet")
+ if(H5T_is_vl_storage(type_info.mem_type) > 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing VL or region reference datatypes yet")
} /* end if */
else {
H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */
@@ -1039,16 +1031,13 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write,
if(type_info->request_nelmts == 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
- /*
- * Get a temporary buffer for type conversion unless the app has already
+ /* Get a temporary buffer for type conversion unless the app has already
* supplied one through the xfer properties. Instead of allocating a
- * buffer which is the exact size, we allocate the target size. The
- * malloc() is usually less resource-intensive if we allocate/free the
- * same size over and over.
+ * buffer which is the exact size, we allocate the target size.
*/
if(NULL == (type_info->tconv_buf = (uint8_t *)tconv_buf)) {
/* Allocate temporary buffer */
- if(NULL == (type_info->tconv_buf = H5FL_BLK_MALLOC(type_conv, target_size)))
+ if(NULL == (type_info->tconv_buf = H5FL_BLK_CALLOC(type_conv, target_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
type_info->tconv_buf_allocated = TRUE;
} /* end if */
@@ -1151,15 +1140,19 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
hbool_t local_error_message_previously_written = FALSE;
hbool_t global_error_message_previously_written = FALSE;
size_t index;
- char local_no_collective_cause_string[256] = "";
- char global_no_collective_cause_string[256] = "";
+ size_t cause_strings_len;
+ char local_no_collective_cause_string[512] = "";
+ char global_no_collective_cause_string[512] = "";
const char *cause_strings[] = { "independent I/O was requested",
"datatype conversions were required",
"data transforms needed to be applied",
"optimized MPI types flag wasn't set",
"one of the dataspaces was neither simple nor scalar",
"dataset was not contiguous or chunked",
- "parallel writes to filtered datasets are disabled" };
+ "parallel writes to filtered datasets are disabled",
+ "an error occurred while checking if collective I/O was possible" };
+
+ cause_strings_len = sizeof(cause_strings) / sizeof(cause_strings[0]);
if(H5CX_get_mpio_local_no_coll_cause(&local_no_collective_cause) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get local no collective cause value")
@@ -1168,7 +1161,7 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
/* Append each of the "reason for breaking collective I/O" error messages to the
* local and global no collective cause strings */
- for (cause = 1, index = 0; cause < H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE; cause <<= 1, index++) {
+ for (cause = 1, index = 0; (cause < H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE) && (index < cause_strings_len); cause <<= 1, index++) {
size_t cause_strlen = HDstrlen(cause_strings[index]);
if (cause & local_no_collective_cause) {
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index 2c06800..2a6c05f 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -37,7 +37,6 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
#include "H5FDprivate.h" /* File drivers */
-#include "H5FDmpi.h" /* MPI-based file drivers */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h" /* Object headers */
@@ -89,10 +88,20 @@
/******************/
/* Combine chunk address and chunk info into a struct for better performance. */
typedef struct H5D_chunk_addr_info_t {
- haddr_t chunk_addr;
- H5D_chunk_info_t chunk_info;
+ haddr_t chunk_addr;
+ H5D_chunk_info_t chunk_info;
} H5D_chunk_addr_info_t;
+/* Rank 0 Bcast values */
+typedef enum H5D_mpio_no_rank0_bcast_cause_t {
+ H5D_MPIO_RANK0_BCAST = 0x00,
+ H5D_MPIO_RANK0_NOT_H5S_ALL = 0x01,
+ H5D_MPIO_RANK0_NOT_CONTIGUOUS = 0x02,
+ H5D_MPIO_RANK0_NOT_FIXED_SIZE = 0x04,
+ H5D_MPIO_RANK0_GREATER_THAN_2GB = 0x08
+} H5D_mpio_no_rank0_bcast_cause_t;
+
+
/*
* Information about a single chunk when performing collective filtered I/O. All
* of the fields of one of these structs are initialized at the start of collective
@@ -281,8 +290,10 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space,
const H5S_t *mem_space, const H5D_type_info_t *type_info)
{
H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */
- unsigned local_cause = 0; /* Local reason(s) for breaking collective mode */
- unsigned global_cause = 0; /* Global reason(s) for breaking collective mode */
+ unsigned local_cause[2] = {0,0}; /* [0] Local reason(s) for breaking collective mode */
+ /* [1] Flag if dataset is both: H5S_ALL and small */
+ unsigned global_cause[2] = {0,0}; /* Global reason(s) for breaking collective mode */
+ htri_t is_vl_storage; /* Whether the dataset's datatype is stored in a variable-length form */
htri_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -296,36 +307,37 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space,
/* For independent I/O, get out quickly and don't try to form consensus */
if(H5CX_get_io_xfer_mode(&io_xfer_mode) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode")
+ /* Set error flag, but keep going */
+ local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE;
if(io_xfer_mode == H5FD_MPIO_INDEPENDENT)
- local_cause |= H5D_MPIO_SET_INDEPENDENT;
+ local_cause[0] |= H5D_MPIO_SET_INDEPENDENT;
/* Optimized MPI types flag must be set */
/* (based on 'HDF5_MPI_OPT_TYPES' environment variable) */
if(!H5FD_mpi_opt_types_g)
- local_cause |= H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED;
+ local_cause[0] |= H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED;
/* Don't allow collective operations if datatype conversions need to happen */
if(!type_info->is_conv_noop)
- local_cause |= H5D_MPIO_DATATYPE_CONVERSION;
+ local_cause[0] |= H5D_MPIO_DATATYPE_CONVERSION;
/* Don't allow collective operations if data transform operations should occur */
if(!type_info->is_xform_noop)
- local_cause |= H5D_MPIO_DATA_TRANSFORMS;
+ local_cause[0] |= H5D_MPIO_DATA_TRANSFORMS;
/* Check whether these are both simple or scalar dataspaces */
if(!((H5S_SIMPLE == H5S_GET_EXTENT_TYPE(mem_space) || H5S_SCALAR == H5S_GET_EXTENT_TYPE(mem_space))
&& (H5S_SIMPLE == H5S_GET_EXTENT_TYPE(file_space) || H5S_SCALAR == H5S_GET_EXTENT_TYPE(file_space))))
- local_cause |= H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES;
+ local_cause[0] |= H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES;
/* Dataset storage must be contiguous or chunked */
if(!(io_info->dset->shared->layout.type == H5D_CONTIGUOUS ||
io_info->dset->shared->layout.type == H5D_CHUNKED))
- local_cause |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET;
+ local_cause[0] |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET;
/* check if external-file storage is used */
if(io_info->dset->shared->dcpl_cache.efl.nused > 0)
- local_cause |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET;
+ local_cause[0] |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET;
/* The handling of memory space is different for chunking and contiguous
* storage. For contiguous storage, mem_space and file_space won't change
@@ -340,31 +352,84 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space,
* is less than 3. The functions needed (MPI_Mprobe and MPI_Imrecv) will
* not be available.
*/
- if (io_info->op_type == H5D_IO_OP_WRITE &&
- io_info->dset->shared->layout.type == H5D_CHUNKED &&
- io_info->dset->shared->dcpl_cache.pline.nused > 0)
- local_cause |= H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED;
+ if(io_info->op_type == H5D_IO_OP_WRITE &&
+ io_info->dset->shared->layout.type == H5D_CHUNKED &&
+ io_info->dset->shared->dcpl_cache.pline.nused > 0)
+ local_cause[0] |= H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED;
#endif
+ /* Check if we are able to do a MPI_Bcast of the data from one rank
+ * instead of having all the processes involved in the collective I/O call.
+ */
+
+ /* Check to see if the process is reading the entire dataset */
+ if(H5S_GET_SELECT_TYPE(file_space) != H5S_SEL_ALL)
+ local_cause[1] |= H5D_MPIO_RANK0_NOT_H5S_ALL;
+ /* Only perform this optimization for contigous datasets, currently */
+ else if(H5D_CONTIGUOUS != io_info->dset->shared->layout.type)
+ /* Flag to do a MPI_Bcast of the data from one proc instead of
+ * having all the processes involved in the collective I/O.
+ */
+ local_cause[1] |= H5D_MPIO_RANK0_NOT_CONTIGUOUS;
+ else if((is_vl_storage = H5T_is_vl_storage(type_info->dset_type)) < 0)
+ local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE;
+ else if(is_vl_storage)
+ local_cause[1] |= H5D_MPIO_RANK0_NOT_FIXED_SIZE;
+ else {
+ size_t type_size; /* Size of dataset's datatype */
+
+ /* Retrieve the size of the dataset's datatype */
+ if(0 == (type_size = H5T_GET_SIZE(type_info->dset_type)))
+ local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE;
+ else {
+ hssize_t snelmts; /* [Signed] # of elements in dataset's dataspace */
+
+ /* Retrieve the size of the dataset's datatype */
+ if((snelmts = H5S_GET_EXTENT_NPOINTS(file_space)) < 0)
+ local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE;
+ else {
+ hsize_t dset_size;
+
+ /* Determine dataset size */
+ dset_size = ((hsize_t)snelmts) * type_size;
+
+ /* If the size of the dataset is less than 2GB then do an MPI_Bcast
+ * of the data from one process instead of having all the processes
+ * involved in the collective I/O.
+ */
+ if(dset_size > ((hsize_t)(2.0F * H5_GB) - 1))
+ local_cause[1] |= H5D_MPIO_RANK0_GREATER_THAN_2GB;
+ } /* end else */
+ } /* end else */
+ } /* end else */
+
/* Check for independent I/O */
- if(local_cause & H5D_MPIO_SET_INDEPENDENT)
- global_cause = local_cause;
+ if(local_cause[0] & H5D_MPIO_SET_INDEPENDENT)
+ global_cause[0] = local_cause[0];
else {
int mpi_code; /* MPI error code */
/* Form consensus opinion among all processes about whether to perform
* collective I/O
*/
- if(MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_cause, &global_cause, 1, MPI_UNSIGNED, MPI_BOR, io_info->comm)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_cause, &global_cause, 2, MPI_UNSIGNED, MPI_BOR, io_info->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code)
} /* end else */
/* Set the local & global values of no-collective-cause in the API context */
- H5CX_set_mpio_local_no_coll_cause(local_cause);
- H5CX_set_mpio_global_no_coll_cause(global_cause);
+ H5CX_set_mpio_local_no_coll_cause(local_cause[0]);
+ H5CX_set_mpio_global_no_coll_cause(global_cause[0]);
+
+ /* Set read-with-rank0-and-bcast flag if possible */
+ if(global_cause[0] == 0 && global_cause[1] == 0) {
+ H5CX_set_mpio_rank0_bcast(TRUE);
+#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+ H5CX_test_set_mpio_coll_rank0_bcast(TRUE);
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+ } /* end if */
/* Set the return value, based on the global cause */
- ret_value = global_cause > 0 ? FALSE : TRUE;
+ ret_value = global_cause[0] > 0 ? FALSE : TRUE;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -735,6 +800,10 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
HDassert(type_info);
HDassert(fm);
+ /* Disable collective metadata reads for chunked dataset I/O operations
+ * in order to prevent potential hangs */
+ H5CX_set_coll_metadata_read(FALSE);
+
/* Check the optional property list for the collective chunk IO optimization option */
if(H5CX_get_mpio_chunk_opt_mode(&chunk_opt_mode) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get chunk optimization option")
@@ -2248,7 +2317,7 @@ if(H5DEBUG(D))
/* Broadcasting the MPI_IO option info. and chunk address info. */
if(MPI_SUCCESS != (mpi_code = MPI_Bcast(total_chunk_addr_array, (int)(sizeof(haddr_t) * fm->layout->u.chunk.nchunks), MPI_BYTE, (int)0, io_info->comm)))
- HMPI_GOTO_ERROR(FAIL, "MPI_BCast failed", mpi_code)
+ HMPI_GOTO_ERROR(FAIL, "MPI_BCast failed", mpi_code)
} /* end if */
/* Start at first node in chunk skip list */
@@ -2772,45 +2841,45 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
size_t mod_data_size;
/* Look up the chunk and get its file and memory dataspaces */
- if (NULL == (chunk_info = (H5D_chunk_info_t *) H5SL_search(fm->sel_chunks, &chunk_entry->index)))
+ if(NULL == (chunk_info = (H5D_chunk_info_t *) H5SL_search(fm->sel_chunks, &chunk_entry->index)))
HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, FAIL, "can't locate chunk in skip list")
/* Determine size of serialized chunk file dataspace, plus the size of
* the data being written
*/
- if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0)
+ if(H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to get encoded dataspace size")
- if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
+ if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
mod_data_size += (size_t) iter_nelmts * type_info->src_type_size;
- if (NULL == (mod_data[num_send_requests] = (unsigned char *) H5MM_malloc(mod_data_size)))
+ if(NULL == (mod_data[num_send_requests] = (unsigned char *) H5MM_malloc(mod_data_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk modification send buffer")
/* Serialize the chunk's file dataspace into the buffer */
mod_data_p = mod_data[num_send_requests];
- if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0)
+ if(H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to encode dataspace")
/* Initialize iterator for memory selection */
- if (H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size) < 0)
+ if(H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE;
/* Collect the modification data into the buffer */
- if(!H5D__gather_mem(io_info->u.wbuf, chunk_info->mspace, mem_iter, (size_t)iter_nelmts, mod_data_p))
+ if(0 == H5D__gather_mem(io_info->u.wbuf, chunk_info->mspace, mem_iter, (size_t)iter_nelmts, mod_data_p))
HGOTO_ERROR(H5E_IO, H5E_CANTGATHER, FAIL, "couldn't gather from write buffer")
/* Send modification data to new owner */
H5_CHECK_OVERFLOW(mod_data_size, size_t, int)
H5_CHECK_OVERFLOW(chunk_entry->index, hsize_t, int)
- if (MPI_SUCCESS != (mpi_code = MPI_Isend(mod_data[num_send_requests], (int) mod_data_size, MPI_BYTE,
+ if(MPI_SUCCESS != (mpi_code = MPI_Isend(mod_data[num_send_requests], (int) mod_data_size, MPI_BYTE,
chunk_entry->owners.new_owner, (int) chunk_entry->index, io_info->comm, &send_requests[num_send_requests])))
HMPI_GOTO_ERROR(FAIL, "MPI_Isend failed", mpi_code)
- if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release memory selection iterator")
mem_iter_init = FALSE;
@@ -2979,11 +3048,11 @@ H5D__mpio_filtered_collective_write_type(H5D_filtered_collective_io_info_t *chun
} /* end if */
done:
- if (write_buf_array)
+ if(write_buf_array)
H5MM_free(write_buf_array);
- if (file_offset_array)
+ if(file_offset_array)
H5MM_free(file_offset_array);
- if (length_array)
+ if(length_array)
H5MM_free(length_array);
FUNC_LEAVE_NOAPI(ret_value)
@@ -3069,8 +3138,8 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
chunk_entry->chunk_states.new_chunk.length = chunk_entry->chunk_states.chunk_current.length;
/* Currently, these chunk reads are done independently and will likely
- * cause issues with collective metadata reads enabled. In the future,
- * this should be refactored to use collective chunk reads - JTH */
+ * cause issues with collective metadata reads enabled. In the future,
+ * this should be refactored to use collective chunk reads - JTH */
/* Get the original state of parallel I/O transfer mode */
if(H5CX_get_io_xfer_mode(&xfer_mode) < 0)
@@ -3101,7 +3170,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
if (NULL == (mem_iter = (H5S_sel_iter_t *) H5MM_malloc(sizeof(H5S_sel_iter_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate memory iterator")
- if (H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size) < 0)
+ if(H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE;
@@ -3111,53 +3180,53 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
* from the current process, then apply any modifications from other processes. Finally,
* filter the newly-updated chunk.
*/
- switch (io_info->op_type) {
+ switch(io_info->op_type) {
case H5D_IO_OP_READ:
- if (NULL == (file_iter = (H5S_sel_iter_t *) H5MM_malloc(sizeof(H5S_sel_iter_t))))
+ if(NULL == (file_iter = (H5S_sel_iter_t *) H5MM_malloc(sizeof(H5S_sel_iter_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate file iterator")
- if (H5S_select_iter_init(file_iter, chunk_info->fspace, type_info->src_type_size) < 0)
+ if(H5S_select_iter_init(file_iter, chunk_info->fspace, type_info->src_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
file_iter_init = TRUE;
- if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0)
+ if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
- if (NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size)))
+ if(NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer")
- if (!H5D__gather_mem(chunk_entry->buf, chunk_info->fspace, file_iter, (size_t) iter_nelmts, tmp_gath_buf))
+ if(!H5D__gather_mem(chunk_entry->buf, chunk_info->fspace, file_iter, (size_t) iter_nelmts, tmp_gath_buf))
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't gather from chunk buffer")
- if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
+ if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
- if (H5D__scatter_mem(tmp_gath_buf, chunk_info->mspace, mem_iter, (size_t) iter_nelmts, io_info->u.rbuf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to read buffer")
+ if(H5D__scatter_mem(tmp_gath_buf, chunk_info->mspace, mem_iter, (size_t) iter_nelmts, io_info->u.rbuf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to read buffer")
break;
case H5D_IO_OP_WRITE:
- if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
+ if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
- if (NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size)))
+ if(NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer")
/* Gather modification data from the application write buffer into a temporary buffer */
- if(!H5D__gather_mem(io_info->u.wbuf, chunk_info->mspace, mem_iter, (size_t) iter_nelmts, tmp_gath_buf))
+ if(0 == H5D__gather_mem(io_info->u.wbuf, chunk_info->mspace, mem_iter, (size_t) iter_nelmts, tmp_gath_buf))
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "couldn't gather from write buffer")
- if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator")
mem_iter_init = FALSE;
/* Initialize iterator for file selection */
- if (H5S_select_iter_init(mem_iter, chunk_info->fspace, type_info->dst_type_size) < 0)
+ if(H5S_select_iter_init(mem_iter, chunk_info->fspace, type_info->dst_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
mem_iter_init = TRUE;
- if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0)
+ if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
/* Scatter the owner's modification data into the chunk data buffer according to
@@ -3166,44 +3235,44 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
if(H5D__scatter_mem(tmp_gath_buf, chunk_info->fspace, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to chunk data buffer")
- if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator")
mem_iter_init = FALSE;
- if (MPI_SUCCESS != (mpi_code = MPI_Waitall(chunk_entry->async_info.num_receive_requests,
+ if(MPI_SUCCESS != (mpi_code = MPI_Waitall(chunk_entry->async_info.num_receive_requests,
chunk_entry->async_info.receive_requests_array, MPI_STATUSES_IGNORE)))
HMPI_GOTO_ERROR(FAIL, "MPI_Waitall failed", mpi_code)
/* For each asynchronous receive call previously posted, receive the chunk modification
* buffer from another rank and update the chunk data
*/
- for (i = 0; i < (size_t) chunk_entry->async_info.num_receive_requests; i++) {
+ for(i = 0; i < (size_t) chunk_entry->async_info.num_receive_requests; i++) {
const unsigned char *mod_data_p;
/* Decode the process' chunk file dataspace */
mod_data_p = chunk_entry->async_info.receive_buffer_array[i];
- if (NULL == (dataspace = H5S_decode(&mod_data_p)))
+ if(NULL == (dataspace = H5S_decode(&mod_data_p)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTDECODE, FAIL, "unable to decode dataspace")
- if (H5S_select_iter_init(mem_iter, dataspace, type_info->dst_type_size) < 0)
+ if(H5S_select_iter_init(mem_iter, dataspace, type_info->dst_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE;
- if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(dataspace)) < 0)
+ if((iter_nelmts = H5S_GET_SELECT_NPOINTS(dataspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
/* Update the chunk data with the received modification data */
if(H5D__scatter_mem(mod_data_p, dataspace, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't scatter to write buffer")
- if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator")
mem_iter_init = FALSE;
- if (dataspace) {
- if (H5S_close(dataspace) < 0)
+ if(dataspace) {
+ if(H5S_close(dataspace) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
dataspace = NULL;
- }
+ } /* end if */
H5MM_free(chunk_entry->async_info.receive_buffer_array[i]);
} /* end for */
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 30652a5..2767aa1 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -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;
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index 4e9cda8..6fb7889 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -45,6 +45,7 @@
#define H5D_CRT_FILL_VALUE_NAME "fill_value" /* Fill value */
#define H5D_CRT_ALLOC_TIME_STATE_NAME "alloc_time_state" /* Space allocation time state */
#define H5D_CRT_EXT_FILE_LIST_NAME "efl" /* External file list */
+#define H5D_CRT_MIN_DSET_HDR_SIZE_NAME "dset_oh_minimize"/* Minimize object header */
/* ======== Dataset access property names ======== */
#define H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */
@@ -94,7 +95,13 @@
/* Definitions for all collective chunk instrumentation properties */
#define H5D_XFER_COLL_CHUNK_SIZE sizeof(unsigned)
#define H5D_XFER_COLL_CHUNK_DEF 1
-#define H5D_XFER_COLL_CHUNK_FIX 0
+
+/* General collective I/O instrumentation properties */
+#define H5D_XFER_COLL_RANK0_BCAST_NAME "coll_rank0_bcast"
+
+/* Definitions for general collective I/O instrumentation properties */
+#define H5D_XFER_COLL_RANK0_BCAST_SIZE sizeof(hbool_t)
+#define H5D_XFER_COLL_RANK0_BCAST_DEF FALSE
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
/* Default temporary buffer size */
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index a1ccda0..63f1a24 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -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,
diff --git a/src/H5E.c b/src/H5E.c
index 170133e..52b7cb7 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -1386,7 +1386,7 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line,
*/
/* Format the description */
- va_start(ap, fmt);
+ HDva_start(ap, fmt);
va_started = TRUE;
#ifdef H5_HAVE_VASPRINTF
@@ -1402,8 +1402,8 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line,
/* If the description doesn't fit into the initial buffer size, allocate more space and try again */
while((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) {
/* shutdown & restart the va_list */
- va_end(ap);
- va_start(ap, fmt);
+ HDva_end(ap);
+ HDva_start(ap, fmt);
/* Release the previous description, it's too small */
H5MM_xfree(tmp);
@@ -1421,7 +1421,7 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line,
done:
if(va_started)
- va_end(ap);
+ HDva_end(ap);
#ifdef H5_HAVE_VASPRINTF
/* Memory was allocated with HDvasprintf so it needs to be freed
* with HDfree
@@ -1484,7 +1484,7 @@ done:
*
* Purpose: Prints the error stack in some default way. This is just a
* convenience function for H5Ewalk() with a function that
- * prints error messages. Users are encouraged to write there
+ * prints error messages. Users are encouraged to write their
* own more specific error handlers.
*
* Return: SUCCEED/FAIL
@@ -1566,8 +1566,8 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi
/* Walk the error stack */
op.vers = 2;
op.u.func2 = stack_func;
- if(H5E__walk(estack, direction, &op, client_data) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
+ if((ret_value = H5E__walk(estack, direction, &op, client_data)) < 0)
+ HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack");
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c
index 1a2b973..3d6c2ed 100644
--- a/src/H5EAdbg.c
+++ b/src/H5EAdbg.c
@@ -264,7 +264,7 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde
HDfprintf(stream, "%*sData Block Addresses in Index Block:\n", indent, "");
for(u = 0; u < iblock->ndblk_addrs; u++) {
/* Print address */
- sprintf(temp_str, "Address #%u:", u);
+ HDsprintf(temp_str, "Address #%u:", u);
HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)),
temp_str,
iblock->dblk_addrs[u]);
@@ -280,7 +280,7 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde
HDfprintf(stream, "%*sSuper Block Addresses in Index Block:\n", indent, "");
for(u = 0; u < iblock->nsblk_addrs; u++) {
/* Print address */
- sprintf(temp_str, "Address #%u:", u);
+ HDsprintf(temp_str, "Address #%u:", u);
HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)),
temp_str,
iblock->sblk_addrs[u]);
@@ -371,7 +371,7 @@ H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent,
HDfprintf(stream, "%*sData Block Addresses in Super Block:\n", indent, "");
for(u = 0; u < sblock->ndblks; u++) {
/* Print address */
- sprintf(temp_str, "Address #%u:", u);
+ HDsprintf(temp_str, "Address #%u:", u);
HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)),
temp_str,
sblock->dblk_addrs[u]);
diff --git a/src/H5EAtest.c b/src/H5EAtest.c
index 7c02e16..814e64f 100644
--- a/src/H5EAtest.c
+++ b/src/H5EAtest.c
@@ -336,7 +336,7 @@ H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
HDassert(elmt);
/* Print element */
- sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str,
(unsigned long long)*(const uint64_t *)elmt);
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 540c9b1..7818879 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -422,7 +422,7 @@ done:
* Purpose: Private function to print the error stack in some default
* way. This is just a convenience function for H5Ewalk() and
* H5Ewalk2() with a function that prints error messages.
- * Users are encouraged to write there own more specific error
+ * Users are encouraged to write their own more specific error
* handlers.
*
* Return: SUCCEED/FAIL
@@ -511,10 +511,9 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o
void *client_data)
{
int i; /* Local index variable */
- herr_t status; /* Status from callback function */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(estack);
@@ -530,9 +529,9 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o
if(op->u.func1) {
H5E_error1_t old_err;
- status = SUCCEED;
+ ret_value = SUCCEED;
if(H5E_WALK_UPWARD == direction) {
- for(i = 0; i < (int)estack->nused && status >= 0; i++) {
+ for(i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++) {
/* Point to each error record on the stack and pass it to callback function.*/
old_err.maj_num = estack->slot[i].maj_num;
old_err.min_num = estack->slot[i].min_num;
@@ -541,12 +540,12 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o
old_err.desc = estack->slot[i].desc;
old_err.line = estack->slot[i].line;
- status = (op->u.func1)(i, &old_err, client_data);
+ ret_value = (op->u.func1)(i, &old_err, client_data);
} /* end for */
} /* end if */
else {
H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int);
- for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--) {
+ for(i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--) {
/* Point to each error record on the stack and pass it to callback function.*/
old_err.maj_num = estack->slot[i].maj_num;
old_err.min_num = estack->slot[i].min_num;
@@ -555,12 +554,12 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o
old_err.desc = estack->slot[i].desc;
old_err.line = estack->slot[i].line;
- status = (op->u.func1)((int)(estack->nused - (size_t)(i + 1)), &old_err, client_data);
+ ret_value = (op->u.func1)((int)(estack->nused - (size_t)(i + 1)), &old_err, client_data);
} /* end for */
} /* end else */
- if(status < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
+ if(ret_value < 0)
+ HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack");
} /* end if */
#else /* H5_NO_DEPRECATED_SYMBOLS */
HDassert(0 && "version 1 error stack walk without deprecated symbols!");
@@ -569,23 +568,22 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o
else {
HDassert(op->vers == 2);
if(op->u.func2) {
- status = SUCCEED;
+ ret_value = SUCCEED;
if(H5E_WALK_UPWARD == direction) {
- for(i = 0; i < (int)estack->nused && status >= 0; i++)
- status = (op->u.func2)((unsigned)i, estack->slot + i, client_data);
+ for(i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++)
+ ret_value = (op->u.func2)((unsigned)i, estack->slot + i, client_data);
} /* end if */
else {
H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int);
- for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--)
- status = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), estack->slot + i, client_data);
+ for(i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--)
+ ret_value = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), estack->slot + i, client_data);
} /* end else */
- if(status < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
+ if(ret_value < 0)
+ HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack");
} /* end if */
} /* end else */
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E__walk() */
@@ -706,7 +704,7 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin
*/
/* Start the variable-argument parsing */
- va_start(ap, fmt);
+ HDva_start(ap, fmt);
va_started = TRUE;
#ifdef H5_HAVE_VASPRINTF
@@ -722,8 +720,8 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin
/* If the description doesn't fit into the initial buffer size, allocate more space and try again */
while((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) {
/* shutdown & restart the va_list */
- va_end(ap);
- va_start(ap, fmt);
+ HDva_end(ap);
+ HDva_start(ap, fmt);
/* Release the previous description, it's too small */
H5MM_xfree(tmp);
@@ -741,7 +739,7 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin
done:
if(va_started)
- va_end(ap);
+ HDva_end(ap);
#ifdef H5_HAVE_VASPRINTF
/* Memory was allocated with HDvasprintf so it needs to be freed
* with HDfree
diff --git a/src/H5F.c b/src/H5F.c
index a5017d8..9df8140 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -38,6 +38,8 @@
#include "H5Tprivate.h" /* Datatypes */
#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
/****************/
/* Local Macros */
@@ -545,7 +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, 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:
@@ -651,11 +653,17 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* get the VOL info from the fapl */
+ /* 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_CONN_NAME, &connector_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
+
+ /* Stash a copy of the "top-level" connector property, before any pass-through
+ * connectors modify or unwrap it.
+ */
+ if(H5CX_set_vol_connector_prop(&connector_prop) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context")
/* 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
@@ -731,7 +739,13 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
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_CONN_NAME, &connector_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
+
+ /* Stash a copy of the "top-level" connector property, before any pass-through
+ * connectors modify or unwrap it.
+ */
+ if(H5CX_set_vol_connector_prop(&connector_prop) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context")
/* Open the file through the VOL layer */
if(NULL == (new_file = (H5F_t *)H5VL_file_open(&connector_prop, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
@@ -778,7 +792,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Flush the object */
- if(H5VL_file_specific(vol_obj, 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:
@@ -931,7 +945,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, 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:
@@ -966,7 +980,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, 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:
@@ -1027,7 +1041,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, 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:
@@ -1067,7 +1081,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, 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:
@@ -1100,7 +1114,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, 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:
@@ -1136,7 +1150,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, 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:
@@ -1173,7 +1187,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, 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:
@@ -1211,7 +1225,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, 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:
@@ -1260,7 +1274,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, 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:
@@ -1305,7 +1319,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, 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:
@@ -1333,7 +1347,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info)
H5TRACE2("e", "i*x", file_id, info);
/* Check args */
- if (!info)
+ if(!info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
/* Get the file pointer */
@@ -1341,7 +1355,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, 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:
@@ -1380,7 +1394,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, 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:
@@ -1413,7 +1427,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, 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:
@@ -1473,7 +1487,7 @@ H5Fstart_swmr_write(hid_t file_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Start SWMR writing */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0)
+ 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:
@@ -1505,8 +1519,8 @@ 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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_MDC_LOGGING) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging")
+ 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_LOGGING, FAIL, "unable to start mdc logging")
done:
FUNC_LEAVE_API(ret_value)
@@ -1538,8 +1552,8 @@ 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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging")
+ 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_LOGGING, FAIL, "unable to stop mdc logging")
done:
FUNC_LEAVE_API(ret_value)
@@ -1572,8 +1586,8 @@ 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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status")
+ 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_LOGGING, FAIL, "unable to get logging status")
done:
FUNC_LEAVE_API(ret_value)
@@ -1610,7 +1624,7 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Set the library's version bounds */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0)
+ 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:
@@ -1647,7 +1661,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, 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:
@@ -1678,7 +1692,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, 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:
@@ -1713,7 +1727,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, 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:
@@ -1748,7 +1762,7 @@ H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len)
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(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_IMAGE_INFO, image_addr, image_len) < 0)
+ 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:
@@ -1782,7 +1796,7 @@ H5Fget_eoa(hid_t file_id, haddr_t *eoa)
/* 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_FILE_GET_EOA, eoa) < 0)
+ 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 */
@@ -1813,10 +1827,96 @@ H5Fincrement_filesize(hid_t file_id, hsize_t increment)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* Increment the file size */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_INCR_FILESIZE, increment) < 0)
+ 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)
} /* H5Fincrement_filesize() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fget_dset_no_attrs_hint
+ *
+ * Purpose:
+ *
+ * Get the file-level setting to create minimized dataset object headers.
+ * Result is stored at pointer `minimize`.
+ *
+ * Return:
+ *
+ * Success: SUCCEED (0) (non-negative value)
+ * Failure: FAIL (-1) (negative value)
+ *
+ * Programmer:
+ *
+ * Jacob Smith
+ * 15 August 2018
+ *
+ * Changes: None.
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize)
+{
+ H5VL_object_t *vol_obj = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*b", file_id, minimize);
+
+ if(NULL == minimize)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "out pointer 'minimize' cannot be NULL")
+
+ vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE);
+ if(NULL == vol_obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG, minimize) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Fget_dset_no_attrs_hint */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fset_dset_no_attrs_hint
+ *
+ * Purpose:
+ *
+ * Set the file-level setting to create minimized dataset object headers.
+ *
+ * Return:
+ *
+ * Success: SUCCEED (0) (non-negative value)
+ * Failure: FAIL (-1) (negative value)
+ *
+ * Programmer:
+ *
+ * Jacob Smith
+ * 15 August 2018
+ *
+ * Changes: None.
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize)
+{
+ H5VL_object_t *vol_obj = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "ib", file_id, minimize);
+
+ vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE);
+ if(NULL == vol_obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG, minimize) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Fset_dset_no_attrs_hint */
+
diff --git a/src/H5FAtest.c b/src/H5FAtest.c
index 27cd8b7..e55d408 100644
--- a/src/H5FAtest.c
+++ b/src/H5FAtest.c
@@ -315,7 +315,7 @@ H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
HDassert(elmt);
/* Print element */
- sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str,
(unsigned long long)*(const uint64_t *)elmt);
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 2ab04dc..d1a17cd 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -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.
@@ -343,14 +348,17 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size)
HDassert(file);
- /* Write to backing store */
- if((off_t)addr != HDlseek(file->fd, (off_t)addr, SEEK_SET))
+#ifndef H5_HAVE_PREADWRITE
+ /* Seek to the correct location (if we don't have pwrite) */
+ if((HDoff_t)addr != HDlseek(file->fd, (off_t)addr, SEEK_SET))
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "error seeking in backing store")
+#endif /* H5_HAVE_PREADWRITE */
while (size > 0) {
h5_posix_io_t bytes_in = 0; /* # of bytes to write */
h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */
+ HDoff_t offset = (HDoff_t)addr;
/* Trying to write more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -361,15 +369,21 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size)
bytes_in = (h5_posix_io_t)size;
do {
+#ifdef H5_HAVE_PREADWRITE
+ bytes_wrote = HDpwrite(file->fd, ptr, bytes_in, offset);
+ offset += bytes_wrote;
+#else
bytes_wrote = HDwrite(file->fd, ptr, bytes_in);
+#endif /* H5_HAVE_PREADWRITE */
} while(-1 == bytes_wrote && EINTR == errno);
if(-1 == bytes_wrote) { /* error */
int myerrno = errno;
time_t mytime = HDtime(NULL);
- HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write to backing store failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', ptr = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), ptr, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)myoffset);
+ offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write to backing store failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', ptr = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), ptr, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset);
} /* end if */
HDassert(bytes_wrote > 0);
@@ -415,8 +429,8 @@ done:
* Purpose: Initialize this driver by registering the driver with the
* library.
*
- * Return: Success: The driver ID for the core driver.
- * Failure: Negative.
+ * Return: Success: The driver ID for the core driver
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Thursday, July 29, 1999
@@ -428,7 +442,7 @@ H5FD_core_init(void)
{
hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
if(H5I_VFL != H5I_get_type(H5FD_CORE_g))
H5FD_CORE_g = H5FD_register(&H5FD_core_g, sizeof(H5FD_class_t), FALSE);
@@ -466,6 +480,100 @@ H5FD__core_term(void)
/*-------------------------------------------------------------------------
+ * 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
*
* Purpose: Modify the file access property list to use the H5FD_CORE
@@ -482,9 +590,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 +601,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 +632,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 +673,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 +683,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;
@@ -745,6 +861,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
while(size > 0) {
h5_posix_io_t bytes_in = 0; /* # of bytes to read */
h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */
+ HDoff_t offset = (HDoff_t)0;
/* Trying to read more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -755,15 +872,21 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
bytes_in = (h5_posix_io_t)size;
do {
+#ifdef H5_HAVE_PREADWRITE
+ bytes_read = HDpread(file->fd, mem, bytes_in, offset);
+ offset += bytes_read;
+#else
bytes_read = HDread(file->fd, mem, bytes_in);
+#endif /* H5_HAVE_PREADWRITE */
} while(-1 == bytes_read && EINTR == errno);
if(-1 == bytes_read) { /* error */
int myerrno = errno;
time_t mytime = HDtime(NULL);
- HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
- HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', file->mem = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), file->mem, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)myoffset);
+ offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', file->mem = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), file->mem, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset);
} /* end if */
HDassert(bytes_read >= 0);
@@ -776,35 +899,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 */
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 906ec28..10c368a 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -206,30 +206,27 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_direct_init
+ * Function: H5FD_direct_init
*
- * Purpose: Initialize this driver by registering the driver with the
- * library.
+ * Purpose: Initialize this driver by registering the driver with the
+ * library.
*
- * Return: Success: The driver ID for the direct driver.
- *
- * Failure: Negative.
+ * Return: Success: The driver ID for the direct driver
+ * Failure: H5I_INVALID_HID
*
* Programmer: Raymond Lu
* Wednesday, 20 September 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
H5FD_direct_init(void)
{
- hid_t ret_value; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
- if (H5I_VFL!=H5I_get_type(H5FD_DIRECT_g))
+ if (H5I_VFL != H5I_get_type(H5FD_DIRECT_g))
H5FD_DIRECT_g = H5FD_register(&H5FD_direct_g,sizeof(H5FD_class_t),FALSE);
/* Set return value */
@@ -237,7 +234,7 @@ H5FD_direct_init(void)
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD_direct_init() */
/*---------------------------------------------------------------------------
@@ -291,6 +288,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 +415,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
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index e52a71a..4d40cf3 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -171,28 +171,25 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_family_init
+ * Function: H5FD_family_init
*
- * Purpose: Initialize this driver by registering the driver with the
- * library.
+ * Purpose: Initialize this driver by registering the driver with the
+ * library.
*
- * Return: Success: The driver ID for the family driver.
+ * Return: Success: The driver ID for the family driver
+ * Failure: H5I_INVALID_HID
*
- * Failure: Negative
- *
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
H5FD_family_init(void)
{
- hid_t ret_value = H5FD_FAMILY_g; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
if(H5I_VFL != H5I_get_type(H5FD_FAMILY_g))
H5FD_FAMILY_g = H5FD_register(&H5FD_family_g, sizeof(H5FD_class_t), FALSE);
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 3dcd7f5..655d7d3 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -252,8 +252,8 @@ done:
* Purpose: Initialize this driver by registering the driver with the
* library.
*
- * Return: Success: The driver ID for the log driver.
- * Failure: Negative.
+ * Return: Success: The driver ID for the log driver
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Thursday, July 29, 1999
@@ -265,7 +265,7 @@ H5FD_log_init(void)
{
hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
if(H5I_VFL != H5I_get_type(H5FD_LOG_g))
H5FD_LOG_g = H5FD_register(&H5FD_log_g, sizeof(H5FD_class_t), FALSE);
@@ -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.
*/
@@ -1189,7 +1191,8 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
} /* end if */
} /* end if */
- /* Seek to the correct location */
+#ifndef H5_HAVE_PREADWRITE
+ /* Seek to the correct location (if we don't have pread) */
if(addr != file->pos || OP_READ != file->op) {
#ifdef H5_HAVE_GETTIMEOFDAY
if(file->fa.flags & H5FD_LOG_TIME_SEEK)
@@ -1232,6 +1235,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
#endif /* H5_HAVE_GETTIMEOFDAY */
} /* end if */
} /* end if */
+#endif /* H5_HAVE_PREADWRITE */
/*
* Read data, being careful of interrupted system calls, partial results,
@@ -1245,6 +1249,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
h5_posix_io_t bytes_in = 0; /* # of bytes to read */
h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */
+ HDoff_t offset = (HDoff_t)addr;
/* Trying to read more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -1255,18 +1260,24 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
bytes_in = (h5_posix_io_t)size;
do {
+#ifdef H5_HAVE_PREADWRITE
+ bytes_read = HDpread(file->fd, buf, bytes_in, offset);
+ offset += bytes_read;
+#else
bytes_read = HDread(file->fd, buf, bytes_in);
+#endif /* H5_HAVE_PREADWRITE */
} while(-1 == bytes_read && EINTR == errno);
if(-1 == bytes_read) { /* error */
int myerrno = errno;
time_t mytime = HDtime(NULL);
- HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
if(file->fa.flags & H5FD_LOG_LOC_READ)
HDfprintf(file->logfp, "Error! Reading: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size);
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)myoffset);
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset);
} /* end if */
if(0 == bytes_read) {
@@ -1396,7 +1407,8 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
file->nwrite[tmp_addr++]++;
} /* end if */
- /* Seek to the correct location */
+#ifndef H5_HAVE_PREADWRITE
+ /* Seek to the correct location (if we don't have pwrite) */
if(addr != file->pos || OP_WRITE != file->op) {
#ifdef H5_HAVE_GETTIMEOFDAY
if(file->fa.flags & H5FD_LOG_TIME_SEEK)
@@ -1439,6 +1451,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
#endif /* H5_HAVE_GETTIMEOFDAY */
} /* end if */
} /* end if */
+#endif /* H5_HAVE_PREADWRITE */
/*
* Write the data, being careful of interrupted system calls and partial
@@ -1452,6 +1465,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
h5_posix_io_t bytes_in = 0; /* # of bytes to write */
h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */
+ HDoff_t offset = (HDoff_t)addr;
/* Trying to write more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -1462,18 +1476,24 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
bytes_in = (h5_posix_io_t)size;
do {
+#ifdef H5_HAVE_PREADWRITE
+ bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset);
+ offset += bytes_wrote;
+#else
bytes_wrote = HDwrite(file->fd, buf, bytes_in);
+#endif /* H5_HAVE_PREADWRITE */
} while(-1 == bytes_wrote && EINTR == errno);
if(-1 == bytes_wrote) { /* error */
int myerrno = errno;
time_t mytime = HDtime(NULL);
- HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
if(file->fa.flags & H5FD_LOG_LOC_WRITE)
HDfprintf(file->logfp, "Error! Writing: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size);
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)myoffset);
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset);
} /* end if */
HDassert(bytes_wrote > 0);
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 87f8b6a..3ab90aa 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -73,69 +73,69 @@ typedef struct H5FD_mpio_t {
/* Private Prototypes */
/* Callbacks */
-static herr_t H5FD_mpio_term(void);
-static void *H5FD_mpio_fapl_get(H5FD_t *_file);
-static void *H5FD_mpio_fapl_copy(const void *_old_fa);
-static herr_t H5FD_mpio_fapl_free(void *_fa);
-static H5FD_t *H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id,
+static herr_t H5FD__mpio_term(void);
+static void *H5FD__mpio_fapl_get(H5FD_t *_file);
+static void *H5FD__mpio_fapl_copy(const void *_old_fa);
+static herr_t H5FD__mpio_fapl_free(void *_fa);
+static H5FD_t *H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr);
-static herr_t H5FD_mpio_close(H5FD_t *_file);
-static herr_t H5FD_mpio_query(const H5FD_t *_f1, unsigned long *flags);
-static haddr_t H5FD_mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
-static herr_t H5FD_mpio_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
-static haddr_t H5FD_mpio_get_eof(const H5FD_t *_file, H5FD_mem_t type);
-static herr_t H5FD_mpio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle);
-static herr_t H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
+static herr_t H5FD__mpio_close(H5FD_t *_file);
+static herr_t H5FD__mpio_query(const H5FD_t *_f1, unsigned long *flags);
+static haddr_t H5FD__mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
+static herr_t H5FD__mpio_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
+static haddr_t H5FD__mpio_get_eof(const H5FD_t *_file, H5FD_mem_t type);
+static herr_t H5FD__mpio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle);
+static herr_t H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
size_t size, void *buf);
-static herr_t H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
+static herr_t H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
size_t size, const void *buf);
-static herr_t H5FD_mpio_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
-static herr_t H5FD_mpio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
-static int H5FD_mpio_mpi_rank(const H5FD_t *_file);
-static int H5FD_mpio_mpi_size(const H5FD_t *_file);
-static MPI_Comm H5FD_mpio_communicator(const H5FD_t *_file);
-static herr_t H5FD_mpio_get_info(H5FD_t *_file, void** mpi_info);
+static herr_t H5FD__mpio_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
+static herr_t H5FD__mpio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
+static int H5FD__mpio_mpi_rank(const H5FD_t *_file);
+static int H5FD__mpio_mpi_size(const H5FD_t *_file);
+static MPI_Comm H5FD__mpio_communicator(const H5FD_t *_file);
+static herr_t H5FD__mpio_get_info(H5FD_t *_file, void** mpi_info);
/* The MPIO file driver information */
static const H5FD_class_mpi_t H5FD_mpio_g = {
{ /* Start of superclass information */
"mpio", /*name */
HADDR_MAX, /*maxaddr */
- H5F_CLOSE_SEMI, /* fc_degree */
- H5FD_mpio_term, /*terminate */
+ H5F_CLOSE_SEMI, /*fc_degree */
+ H5FD__mpio_term, /*terminate */
NULL, /*sb_size */
NULL, /*sb_encode */
NULL, /*sb_decode */
sizeof(H5FD_mpio_fapl_t), /*fapl_size */
- H5FD_mpio_fapl_get, /*fapl_get */
- H5FD_mpio_fapl_copy, /*fapl_copy */
- H5FD_mpio_fapl_free, /*fapl_free */
+ H5FD__mpio_fapl_get, /*fapl_get */
+ H5FD__mpio_fapl_copy, /*fapl_copy */
+ H5FD__mpio_fapl_free, /*fapl_free */
0, /*dxpl_size */
NULL, /*dxpl_copy */
NULL, /*dxpl_free */
- H5FD_mpio_open, /*open */
- H5FD_mpio_close, /*close */
+ H5FD__mpio_open, /*open */
+ H5FD__mpio_close, /*close */
NULL, /*cmp */
- H5FD_mpio_query, /*query */
+ H5FD__mpio_query, /*query */
NULL, /*get_type_map */
NULL, /*alloc */
NULL, /*free */
- H5FD_mpio_get_eoa, /*get_eoa */
- H5FD_mpio_set_eoa, /*set_eoa */
- H5FD_mpio_get_eof, /*get_eof */
- H5FD_mpio_get_handle, /*get_handle */
- H5FD_mpio_read, /*read */
- H5FD_mpio_write, /*write */
- H5FD_mpio_flush, /*flush */
- H5FD_mpio_truncate, /*truncate */
+ H5FD__mpio_get_eoa, /*get_eoa */
+ H5FD__mpio_set_eoa, /*set_eoa */
+ H5FD__mpio_get_eof, /*get_eof */
+ H5FD__mpio_get_handle, /*get_handle */
+ H5FD__mpio_read, /*read */
+ H5FD__mpio_write, /*write */
+ H5FD__mpio_flush, /*flush */
+ H5FD__mpio_truncate, /*truncate */
NULL, /*lock */
NULL, /*unlock */
H5FD_FLMAP_DICHOTOMY /*fl_map */
}, /* End of superclass information */
- H5FD_mpio_mpi_rank, /*get_rank */
- H5FD_mpio_mpi_size, /*get_size */
- H5FD_mpio_communicator, /*get_comm */
- H5FD_mpio_get_info /*get_info */
+ H5FD__mpio_mpi_rank, /*get_rank */
+ H5FD__mpio_mpi_size, /*get_size */
+ H5FD__mpio_communicator, /*get_comm */
+ H5FD__mpio_get_info /*get_info */
};
#ifdef H5FDmpio_DEBUG
@@ -162,10 +162,13 @@ static int H5FD_mpio_Debug[256] =
/*--------------------------------------------------------------------------
NAME
H5FD__init_package -- Initialize interface-specific information
+
USAGE
herr_t H5FD__init_package()
+
RETURNS
Non-negative on success/Negative on failure
+
DESCRIPTION
Initializes any interface-specific data or routines. (Just calls
H5FD_mpio_init currently).
@@ -187,15 +190,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_init
+ * Function: H5FD_mpio_init
*
- * Purpose: Initialize this driver by registering the driver with the
- * library.
+ * Purpose: Initialize this driver by registering the driver with the
+ * library.
*
- * Return: Success: The driver ID for the mpio driver.
- * Failure: Negative.
+ * Return: Success: The driver ID for the mpio driver
+ * Failure: H5I_INVALID_HID
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, August 5, 1999
*
*-------------------------------------------------------------------------
@@ -206,10 +209,10 @@ H5FD_mpio_init(void)
#ifdef H5FDmpio_DEBUG
static int H5FD_mpio_Debug_inited = 0;
#endif /* H5FDmpio_DEBUG */
- const char *s; /* String for environment variables */
- hid_t ret_value; /* Return value */
+ const char *s; /* String for environment variables */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
/* Register the MPI-IO VFD, if it isn't already */
if(H5I_VFL != H5I_get_type(H5FD_MPIO_g))
@@ -217,8 +220,10 @@ H5FD_mpio_init(void)
/* Allow MPI buf-and-file-type optimizations? */
s = HDgetenv("HDF5_MPI_OPT_TYPES");
- if(s && HDisdigit(*s))
- H5FD_mpi_opt_types_g = (hbool_t)HDstrtol(s, NULL, 0);
+ if(s && HDisdigit(*s)) {
+ long env_val = HDstrtol(s, NULL, 0);
+ H5FD_mpi_opt_types_g = (0 == env_val) ? FALSE : TRUE;
+ }
#ifdef H5FDmpio_DEBUG
if(!H5FD_mpio_Debug_inited) {
@@ -226,12 +231,12 @@ H5FD_mpio_init(void)
s = HDgetenv("H5FD_mpio_Debug");
if(s) {
/* Set debug mask */
- while(*s) {
- H5FD_mpio_Debug[(int)*s]++;
- s++;
- } /* end while */
+ while(*s) {
+ H5FD_mpio_Debug[(int)*s]++;
+ s++;
+ } /* end while */
} /* end if */
- H5FD_mpio_Debug_inited++;
+ H5FD_mpio_Debug_inited++;
} /* end if */
#endif /* H5FDmpio_DEBUG */
@@ -244,7 +249,7 @@ done:
/*---------------------------------------------------------------------------
- * Function: H5FD_mpio_term
+ * Function: H5FD__mpio_term
*
* Purpose: Shut down the VFD
*
@@ -256,15 +261,15 @@ done:
*---------------------------------------------------------------------------
*/
static herr_t
-H5FD_mpio_term(void)
+H5FD__mpio_term(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC
/* Reset VFL ID */
- H5FD_MPIO_g=0;
+ H5FD_MPIO_g = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5FD_mpio_term() */
+} /* end H5FD__mpio_term() */
/*-------------------------------------------------------------------------
@@ -291,7 +296,6 @@ H5FD_mpio_term(void)
* are freed.
*
* Return: Success: Non-negative
- *
* Failure: Negative
*
* Programmer: Albert Cheng
@@ -309,16 +313,16 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info)
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iMcMi", fapl_id, comm, info);
+ /* Check arguments */
if(fapl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
-
- /* Check arguments */
if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list")
if(MPI_COMM_NULL == comm)
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;
@@ -346,7 +350,6 @@ done:
* modifications to the access property list do
* not affect them and it is the responsibility
* of the application to free them.
- *
* Failure: Negative
*
* Programmer: Robb Matzke
@@ -367,6 +370,7 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/)
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ixx", fapl_id, comm, info);
+ /* Check arguments */
if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list")
if(H5FD_MPIO != H5P_peek_driver(plist))
@@ -439,10 +443,9 @@ H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode)
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iDt", dxpl_id, xfer_mode);
+ /* Check arguments */
if(dxpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
-
- /* Check arguments */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
if(H5FD_MPIO_INDEPENDENT != xfer_mode && H5FD_MPIO_COLLECTIVE != xfer_mode)
@@ -466,7 +469,6 @@ done:
* Return: Success: Non-negative, with the transfer mode returned
* through the XFER_MODE argument if it is
* non-null.
- *
* Failure: Negative
*
* Programmer: Albert Cheng
@@ -483,6 +485,7 @@ H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode/*out*/)
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", dxpl_id, xfer_mode);
+ /* Check arguments */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
@@ -524,10 +527,9 @@ H5Pset_dxpl_mpio_collective_opt(hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mo
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iDc", dxpl_id, opt_mode);
+ /* Check arguments */
if(dxpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
-
- /* Check arguments */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
@@ -568,10 +570,9 @@ H5Pset_dxpl_mpio_chunk_opt(hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode)
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iDh", dxpl_id, opt_mode);
+ /* Check arguments */
if(dxpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
-
- /* Check arguments */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
@@ -610,10 +611,9 @@ H5Pset_dxpl_mpio_chunk_opt_num(hid_t dxpl_id, unsigned num_chunk_per_proc)
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iIu", dxpl_id, num_chunk_per_proc);
+ /* Check arguments */
if(dxpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
-
- /* Check arguments */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
@@ -655,10 +655,9 @@ H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_num_proc_per_ch
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iIu", dxpl_id, percent_num_proc_per_chunk);
+ /* Check arguments */
if(dxpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
-
- /* Check arguments */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
@@ -672,14 +671,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_fapl_get
+ * Function: H5FD__mpio_fapl_get
*
* Purpose: Returns a file access property list which could be used to
* create another file the same as this one.
*
* Return: Success: Ptr to new file access property list with all
* fields copied from the file pointer.
- *
* Failure: NULL
*
* Programmer: Robb Matzke
@@ -688,17 +686,19 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5FD_mpio_fapl_get(H5FD_t *_file)
+H5FD__mpio_fapl_get(H5FD_t *_file)
{
H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
H5FD_mpio_fapl_t *fa = NULL;
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
+ /* Sanity checks */
HDassert(file);
HDassert(H5FD_MPIO == file->pub.driver_id);
+ /* Check arguments */
if(NULL == (fa = (H5FD_mpio_fapl_t *)H5MM_calloc(sizeof(H5FD_mpio_fapl_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
@@ -711,16 +711,15 @@ H5FD_mpio_fapl_get(H5FD_t *_file)
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD__mpio_fapl_get() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_fapl_copy
+ * Function: H5FD__mpio_fapl_copy
*
* Purpose: Copies the mpio-specific file access properties.
*
* Return: Success: Ptr to a new property list
- *
* Failure: NULL
*
* Programmer: Albert Cheng
@@ -729,16 +728,17 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5FD_mpio_fapl_copy(const void *_old_fa)
+H5FD__mpio_fapl_copy(const void *_old_fa)
{
- void *ret_value = NULL;
const H5FD_mpio_fapl_t *old_fa = (const H5FD_mpio_fapl_t*)_old_fa;
H5FD_mpio_fapl_t *new_fa = NULL;
+ void *ret_value = NULL;
+
+ FUNC_ENTER_STATIC
- FUNC_ENTER_NOAPI_NOINIT
#ifdef H5FDmpio_DEBUG
-if (H5FD_mpio_Debug[(int)'t'])
-fprintf(stderr, "enter H5FD_mpio_fapl_copy\n");
+if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stderr, "%s: entering\n", FUNC);
#endif
if(NULL == (new_fa = (H5FD_mpio_fapl_t *)H5MM_malloc(sizeof(H5FD_mpio_fapl_t))))
@@ -748,65 +748,68 @@ fprintf(stderr, "enter H5FD_mpio_fapl_copy\n");
HDmemcpy(new_fa, old_fa, sizeof(H5FD_mpio_fapl_t));
/* Duplicate communicator and Info object. */
- if(FAIL == H5FD_mpi_comm_info_dup(old_fa->comm, old_fa->info, &new_fa->comm, &new_fa->info))
+ if(H5FD_mpi_comm_info_dup(old_fa->comm, old_fa->info, &new_fa->comm, &new_fa->info) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed")
+
+ /* Set return value */
ret_value = new_fa;
done:
- if (NULL == ret_value){
+ if(NULL == ret_value)
/* cleanup */
- if (new_fa)
+ if(new_fa)
H5MM_xfree(new_fa);
- }
#ifdef H5FDmpio_DEBUG
-if (H5FD_mpio_Debug[(int)'t'])
-fprintf(stderr, "leaving H5FD_mpio_fapl_copy\n");
+if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stderr, "%s: leaving\n", FUNC);
#endif
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_mpio_fapl_copy() */
+} /* end H5FD__mpio_fapl_copy() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_fapl_free
+ * Function: H5FD__mpio_fapl_free
*
* Purpose: Frees the mpio-specific file access properties.
*
* Return: Success: 0
- *
* Failure: -1
*
* Programmer: Albert Cheng
* Jan 8, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mpio_fapl_free(void *_fa)
+H5FD__mpio_fapl_free(void *_fa)
{
- herr_t ret_value = SUCCEED;
H5FD_mpio_fapl_t *fa = (H5FD_mpio_fapl_t*)_fa;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
- FUNC_ENTER_NOAPI_NOINIT_NOERR
#ifdef H5FDmpio_DEBUG
-if (H5FD_mpio_Debug[(int)'t'])
-fprintf(stderr, "in H5FD_mpio_fapl_free\n");
+if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stderr, "%s: Entering\n", FUNC);
#endif
+
+ /* Sanity checks */
HDassert(fa);
/* Free the internal communicator and INFO object */
- HDassert(MPI_COMM_NULL!=fa->comm);
+ HDassert(MPI_COMM_NULL != fa->comm);
H5FD_mpi_comm_info_free(&fa->comm, &fa->info);
H5MM_xfree(fa);
#ifdef H5FDmpio_DEBUG
-if (H5FD_mpio_Debug[(int)'t'])
-fprintf(stderr, "leaving H5FD_mpio_fapl_free\n");
+if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stderr, "%s: leaving\n", FUNC);
#endif
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_mpio_fapl_free() */
+} /* end H5FD__mpio_fapl_free() */
/*-------------------------------------------------------------------------
@@ -834,26 +837,27 @@ H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag)
FUNC_ENTER_NOAPI_NOINIT
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "Entering H5FD_set_mpio_atomicity\n");
+ if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stdout, "%s: Entering\n", FUNC);
#endif
- if (FALSE == flag)
+ if(FALSE == flag)
temp_flag = 0;
else
temp_flag = 1;
/* set atomicity value */
- if (MPI_SUCCESS != (mpi_code=MPI_File_set_atomicity(file->f, temp_flag)))
+ if(MPI_SUCCESS != (mpi_code = MPI_File_set_atomicity(file->f, temp_flag)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_set_atomicity", mpi_code)
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "Leaving H5FD_set_mpio_atomicity\n");
+ if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stdout, "%s: Leaving\n", FUNC);
#endif
+
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD_set_mpio_atomicity() */
/*-------------------------------------------------------------------------
@@ -881,30 +885,31 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag)
FUNC_ENTER_NOAPI_NOINIT
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "Entering H5FD_get_mpio_atomicity\n");
+ if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stdout, "%s: Entering\n", FUNC);
#endif
- /* get atomicity value */
- if (MPI_SUCCESS != (mpi_code=MPI_File_get_atomicity(file->f, &temp_flag)))
+ /* Get atomicity value */
+ if(MPI_SUCCESS != (mpi_code = MPI_File_get_atomicity(file->f, &temp_flag)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_get_atomicity", mpi_code)
- if (0 != temp_flag)
+ if(0 != temp_flag)
*flag = TRUE;
else
*flag = FALSE;
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "Leaving H5FD_get_mpio_atomicity\n");
+ if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stdout, "%s: Leaving\n", FUNC);
#endif
+
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD_get_mpio_atomicity() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_open
+ * Function: H5FD__mpio_open
*
* Purpose: Opens a file with name NAME. The FLAGS are a bit field with
* purpose similar to the second argument of open(2) and which
@@ -914,21 +919,20 @@ done:
* access. This is collective.
*
* Return: Success: A new file pointer.
- *
* Failure: NULL
*
- * Programmer:
+ * Programmer: Robert Kim Yates
* January 30, 1998
*
*-------------------------------------------------------------------------
*/
static H5FD_t *
-H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id,
- haddr_t H5_ATTR_UNUSED maxaddr)
+H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id,
+ haddr_t H5_ATTR_UNUSED maxaddr)
{
- H5FD_mpio_t *file=NULL;
+ H5FD_mpio_t *file = NULL;
MPI_File fh;
- unsigned file_opened=0; /* Flag to indicate that the file was successfully opened */
+ unsigned file_opened = 0; /* Flag to indicate that the file was successfully opened */
int mpi_amode;
int mpi_rank; /* MPI rank of this process */
int mpi_size; /* Total number of MPI processes */
@@ -941,13 +945,11 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id,
MPI_Info info_dup = MPI_INFO_NULL;
H5FD_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t']) {
- fprintf(stdout, "Entering H5FD_mpio_open(name=\"%s\", flags=0x%x, "
- "fapl_id=%d, maxaddr=%lu)\n", name, flags, (int)fapl_id, (unsigned long)maxaddr);
- }
+ if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stdout, "%s: Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", FUNC, name, flags, (int)fapl_id, (unsigned long)maxaddr);
#endif
/* Obtain a pointer to mpio-specific file access properties */
@@ -958,10 +960,9 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id,
_fa.info = MPI_INFO_NULL; /*default*/
fa = &_fa;
} /* end if */
- else {
+ else
if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_peek_driver_info(plist)))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
- } /* end else */
/* Duplicate communicator and Info object for use by this file. */
if(FAIL == H5FD_mpi_comm_info_dup(fa->comm, fa->info, &comm_dup, &info_dup))
@@ -977,21 +978,19 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id,
#ifdef H5FDmpio_DEBUG
/* Check for debug commands in the info parameter */
- {
- if(MPI_INFO_NULL != info_dup) {
- char debug_str[128];
- int flag;
-
- MPI_Info_get(fa->info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str) - 1, debug_str, &flag);
- if(flag) {
- int i;
-
- fprintf(stdout, "H5FD_mpio debug flags = '%s'\n", debug_str);
- for(i = 0; debug_str[i]/*end of string*/ && i < 128/*just in case*/; ++i)
- H5FD_mpio_Debug[(int)debug_str[i]] = 1;
- }
- }
- }
+ if(MPI_INFO_NULL != info_dup) {
+ char debug_str[128];
+ int flag;
+
+ MPI_Info_get(fa->info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str) - 1, debug_str, &flag);
+ if(flag) {
+ int i;
+
+ HDfprintf(stdout, "H5FD_mpio debug flags = '%s'\n", debug_str);
+ for(i = 0; debug_str[i]/*end of string*/ && i < 128/*just in case*/; ++i)
+ H5FD_mpio_Debug[(int)debug_str[i]] = 1;
+ } /* end if */
+ } /* end if */
#endif
if(MPI_SUCCESS != (mpi_code = MPI_File_open(comm_dup, name, mpi_amode, info_dup, &fh)))
@@ -1041,69 +1040,62 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id,
file->local_eof = file->eof;
/* Set return value */
- ret_value=(H5FD_t*)file;
+ ret_value = (H5FD_t*)file;
done:
- if(ret_value==NULL) {
+ if(ret_value == NULL) {
if(file_opened)
MPI_File_close(&fh);
- if (MPI_COMM_NULL != comm_dup)
+ if(MPI_COMM_NULL != comm_dup)
MPI_Comm_free(&comm_dup);
- if (MPI_INFO_NULL != info_dup)
+ if(MPI_INFO_NULL != info_dup)
MPI_Info_free(&info_dup);
- if (file)
+ if(file)
H5MM_xfree(file);
} /* end if */
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "Leaving H5FD_mpio_open\n" );
+ if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stdout, "%s: Leaving\n", FUNC);
#endif
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_mpio_open() */
+} /* end H5FD__mpio_open() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_close
+ * Function: H5FD__mpio_close
*
* Purpose: Closes a file. This is collective.
*
* Return: Success: Non-negative
- *
* Failure: Negative
*
* Programmer: Unknown
* January 30, 1998
*
- * Modifications:
- * Robb Matzke, 1998-02-18
- * Added the ACCESS_PARMS argument.
- *
- * Robb Matzke, 1999-08-06
- * Modified to work with the virtual file layer.
- *
- * Albert Cheng, 2003-04-17
- * Free the communicator stored.
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mpio_close(H5FD_t *_file)
+H5FD__mpio_close(H5FD_t *_file)
{
H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
int mpi_code; /* MPI return code */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "Entering H5FD_mpio_close\n");
+ if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stdout, "%s: Entering\n", FUNC);
#endif
+
+ /* Sanity checks */
HDassert(file);
- HDassert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(H5FD_MPIO == file->pub.driver_id);
/* MPI_File_close sets argument to MPI_FILE_NULL */
- if (MPI_SUCCESS != (mpi_code=MPI_File_close(&(file->f)/*in,out*/)))
+ if(MPI_SUCCESS != (mpi_code = MPI_File_close(&(file->f)/*in,out*/)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_close failed", mpi_code)
/* Clean up other stuff */
@@ -1112,45 +1104,36 @@ H5FD_mpio_close(H5FD_t *_file)
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "Leaving H5FD_mpio_close\n");
+ if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stdout, "%s: Leaving\n", FUNC);
#endif
+
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD__mpio_close() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_query
+ * Function: H5FD__mpio_query
*
* Purpose: Set the flags that this VFL driver is capable of supporting.
* (listed in H5FDpublic.h)
*
* Return: Success: non-negative
- *
* Failure: negative
*
* Programmer: Quincey Koziol
* Friday, August 25, 2000
*
- * Modifications:
- *
- * John Mainzer -- 9/21/05
- * Modified code to turn off the
- * H5FD_FEAT_ACCUMULATE_METADATA_WRITE flag.
- * With the movement of
- * all cache writes to process 0, this flag has become
- * problematic in PHDF5.
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out */)
+H5FD__mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out */)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC
/* Set the VFL feature flags that this driver supports */
if(flags) {
- *flags=0;
+ *flags = 0;
*flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */
*flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
*flags |= H5FD_FEAT_HAS_MPI; /* This driver uses MPI */
@@ -1159,83 +1142,73 @@ H5FD_mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
-}
+} /* end H5FD__mpio_query() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_get_eoa
+ * Function: H5FD__mpio_get_eoa
*
* Purpose: Gets the end-of-address marker for the file. The EOA marker
* is the first address past the last byte allocated in the
* format address space.
*
* Return: Success: The end-of-address marker.
- *
* Failure: HADDR_UNDEF
*
* Programmer: Robb Matzke
* Friday, August 6, 1999
*
- * Modifications:
- * Raymond Lu
- * 21 Dec. 2006
- * Added the parameter TYPE. It's only used for MULTI driver.
- *
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
+H5FD__mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
{
const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC
+ /* Sanity checks */
HDassert(file);
- HDassert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(H5FD_MPIO == file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->eoa)
-}
+} /* end H5FD__mpio_get_eoa() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_set_eoa
+ * Function: H5FD__mpio_set_eoa
*
* Purpose: Set the end-of-address marker for the file. This function is
* called shortly after an existing HDF5 file is opened in order
* to tell the driver where the end of the HDF5 data is located.
*
* Return: Success: 0
- *
* Failure: -1
*
* Programmer: Robb Matzke
* Friday, August 6, 1999
*
- * Modifications:
- * Raymond Lu
- * 21 Dec. 2006
- * Added the parameter TYPE. It's only used for MULTI driver.
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mpio_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr)
+H5FD__mpio_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr)
{
H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC
+ /* Sanity checks */
HDassert(file);
- HDassert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(H5FD_MPIO == file->pub.driver_id);
file->eoa = addr;
FUNC_LEAVE_NOAPI(SUCCEED)
-}
+} /* end H5FD__mpio_set_eoa() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_get_eof
+ * Function: H5FD__mpio_get_eof
*
* Purpose: Gets the end-of-file marker for the file. The EOF marker
* is the real size of the file.
@@ -1253,32 +1226,30 @@ H5FD_mpio_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr)
* file. -QAK
*
* Return: Success: The end-of-address marker.
- *
* Failure: HADDR_UNDEF
*
* Programmer: Robb Matzke
* Friday, August 6, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_mpio_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
+H5FD__mpio_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
{
const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC
+ /* Sanity checks */
HDassert(file);
- HDassert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(H5FD_MPIO == file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->eof)
-}
+} /* end H5FD__mpio_get_eof() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_get_handle
+ * Function: H5FD__mpio_get_handle
*
* Purpose: Returns the file handle of MPIO file driver.
*
@@ -1287,17 +1258,15 @@ H5FD_mpio_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
* Programmer: Raymond Lu
* Sept. 16, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mpio_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void** file_handle)
+H5FD__mpio_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void** file_handle)
{
- H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- herr_t ret_value = SUCCEED;
+ H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
if(!file_handle)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid")
@@ -1306,7 +1275,7 @@ H5FD_mpio_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void** file_handl
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD__mpio_get_handle() */
/*-------------------------------------------------------------------------
@@ -1343,7 +1312,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_read
+ * Function: H5FD__mpio_read
*
* Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR
* into buffer BUF according to data transfer properties in
@@ -1361,85 +1330,41 @@ done:
*
* Programmer: rky, 1998-01-30
*
- * Modifications:
- * Robb Matzke, 1998-02-18
- * Added the ACCESS_PARMS argument.
- *
- * rky, 1998-04-10
- * Call independent or collective MPI read, based on
- * ACCESS_PARMS.
- *
- * Albert Cheng, 1998-06-01
- * Added XFER_MODE to control independent or collective MPI
- * read.
- *
- * rky, 1998-08-16
- * Use BTYPE, FTYPE, and DISP from access parms. The guts of
- * H5FD_mpio_read and H5FD_mpio_write should be replaced by a
- * single dual-purpose routine.
- *
- * Robb Matzke, 1999-04-21
- * Changed XFER_MODE to XFER_PARMS for all H5F_*_read()
- * callbacks.
- *
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
- *
- * Robb Matzke, 1999-08-06
- * Modified to work with the virtual file layer.
- *
- * Quincey Koziol, 2002-05-14
- * Only call MPI_Get_count if we can use MPI_BYTE for the MPI type
- * for the I/O transfer. Someday we might include code to decode
- * the MPI type used for more complicated transfers and call
- * MPI_Get_count all the time.
- *
- * Quincey Koziol - 2002/06/17
- * Removed 'disp' parameter from H5FD_mpio_setup routine and use
- * the address of the dataset in MPI_File_set_view() calls, as
- * necessary.
- *
- * Quincey Koziol - 2002/06/24
- * Removed "lazy" MPI_File_set_view() calls, since they would fail
- * if the first I/O was a collective I/O using MPI derived types
- * and the next I/O was an independent I/O.
- *
- * Quincey Koziol - 2003/10/22-31
- * Restructured code massively, straightening out logic and finally
- * getting the bytes_read stuff working.
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type,
+H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type,
hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf/*out*/)
{
- H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
- MPI_Offset mpi_off;
- MPI_Status mpi_stat; /* Status from I/O operation */
- int mpi_code; /* mpi return code */
- MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */
- int size_i; /* Integer copy of 'size' to read */
+ H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
+ MPI_Offset mpi_off;
+ MPI_Status mpi_stat; /* Status from I/O operation */
+ int mpi_code; /* mpi return code */
+ MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */
+ int size_i; /* Integer copy of 'size' to read */
#if MPI_VERSION >= 3
- MPI_Count bytes_read; /* Number of bytes read in */
- MPI_Count type_size; /* MPI datatype used for I/O's size */
- MPI_Count io_size; /* Actual number of bytes requested */
- MPI_Count n;
+ MPI_Count bytes_read = 0; /* Number of bytes read in */
+ MPI_Count type_size; /* MPI datatype used for I/O's size */
+ MPI_Count io_size; /* Actual number of bytes requested */
+ MPI_Count n;
#else
- int bytes_read; /* Number of bytes read in */
- int type_size; /* MPI datatype used for I/O's size */
- int io_size; /* Actual number of bytes requested */
- int n;
+ int bytes_read = 0; /* Number of bytes read in */
+ int type_size; /* MPI datatype used for I/O's size */
+ int io_size; /* Actual number of bytes requested */
+ int n;
#endif
- hbool_t use_view_this_time = FALSE;
- herr_t ret_value = SUCCEED;
+ hbool_t use_view_this_time = FALSE;
+ hbool_t rank0_bcast = FALSE; /* If read-with-rank0-and-bcast flag was used */
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "Entering H5FD_mpio_read\n" );
+ if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stdout, "%s: Entering\n", FUNC);
#endif
+
+ /* Sanity checks */
HDassert(file);
HDassert(H5FD_MPIO==file->pub.driver_id);
HDassert(buf);
@@ -1448,21 +1373,20 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type,
HDmemset(&mpi_stat,0,sizeof(MPI_Status));
/* some numeric conversions */
- if (H5FD_mpi_haddr_to_MPIOff(addr, &mpi_off/*out*/)<0)
+ if(H5FD_mpi_haddr_to_MPIOff(addr, &mpi_off/*out*/) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off")
size_i = (int)size;
- if ((hsize_t)size_i != size)
+ if((hsize_t)size_i != size)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i")
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- fprintf(stdout, "in H5FD_mpio_read mpi_off=%ld size_i=%d\n",
- (long)mpi_off, size_i );
+ if(H5FD_mpio_Debug[(int)'r'])
+ HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i);
#endif
/* Only look for MPI views for raw data transfers */
if(type == H5FD_MEM_DRAW) {
- H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */
+ H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */
/* Get the transfer mode from the API context */
if(H5CX_get_io_xfer_mode(&xfer_mode) < 0)
@@ -1474,8 +1398,8 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type,
* us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which
* could mean "use MPI_BYTE" by convention).
*/
- if(xfer_mode==H5FD_MPIO_COLLECTIVE) {
- MPI_Datatype file_type;
+ if(xfer_mode == H5FD_MPIO_COLLECTIVE) {
+ MPI_Datatype file_type;
/* Remember that views are used */
use_view_this_time = TRUE;
@@ -1502,8 +1426,8 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type,
H5FD_mpio_collective_opt_t coll_opt_mode;
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "H5FD_mpio_read: using MPIO collective mode\n");
+ if(H5FD_mpio_Debug[(int)'r'])
+ HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC);
#endif
/* Get the collective_opt property to check whether the application wants to do IO individually. */
if(H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0)
@@ -1511,16 +1435,33 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type,
if(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) {
#ifdef H5FDmpio_DEBUG
- if(H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "H5FD_mpio_read: doing MPI collective IO\n");
+ if(H5FD_mpio_Debug[(int)'r'])
+ HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC);
#endif
- if(MPI_SUCCESS != (mpi_code = MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code)
+ /* Check whether we should read from rank 0 and broadcast to other ranks */
+ if(H5CX_get_mpio_rank0_bcast()) {
+#ifdef H5FDmpio_DEBUG
+ if(H5FD_mpio_Debug[(int)'r'])
+ HDfprintf(stdout, "%s: doing read-rank0-and-MPI_Bcast\n", FUNC);
+#endif
+ /* Indicate path we've taken */
+ rank0_bcast = TRUE;
+
+ /* Read on rank 0 Bcast to other ranks */
+ if(file->mpi_rank == 0)
+ if(MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code)
+ if(MPI_SUCCESS != (mpi_code = MPI_Bcast(buf, size_i, buf_type, 0, file->comm)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code)
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code)
} /* end if */
else {
#ifdef H5FDmpio_DEBUG
- if(H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "H5FD_mpio_read: doing MPI independent IO\n");
+ if(H5FD_mpio_Debug[(int)'r'])
+ HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC);
#endif
if(MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
@@ -1532,52 +1473,65 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type,
*/
if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, H5FD_mpi_native_g, file->info)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
- } else {
+ } /* end if */
+ else
if(MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code)
- }
- /* How many bytes were actually read? */
+ /* Only retrieve bytes read if this rank _actually_ participated in I/O */
+ if(!rank0_bcast || (rank0_bcast && file->mpi_rank == 0) ) {
+ /* How many bytes were actually read? */
#if MPI_VERSION >= 3
- if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_read)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_read)))
#else
- if (MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_read)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_read)))
#endif
- HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code)
+ } /* end if */
+
+ /* If the rank0-bcast feature was used, broadcast the # of bytes read to
+ * other ranks, which didn't perform any I/O.
+ */
+ /* NOTE: This could be optimized further to be combined with the broadcast
+ * of the data. (QAK - 2019/1/2)
+ */
+ if(rank0_bcast)
+ if(MPI_SUCCESS != MPI_Bcast(&bytes_read, 1, MPI_LONG_LONG, 0, file->comm))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", 0)
/* Get the type's size */
#if MPI_VERSION >= 3
- if (MPI_SUCCESS != (mpi_code = MPI_Type_size_x(buf_type, &type_size)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_size_x(buf_type, &type_size)))
#else
- if (MPI_SUCCESS != (mpi_code = MPI_Type_size(buf_type, &type_size)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_size(buf_type, &type_size)))
#endif
HMPI_GOTO_ERROR(FAIL, "MPI_Type_size failed", mpi_code)
/* Compute the actual number of bytes requested */
- io_size=type_size*size_i;
+ io_size = type_size * size_i;
/* Check for read failure */
- if (bytes_read<0 || bytes_read>io_size)
+ if(bytes_read < 0 || bytes_read > io_size)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed")
/*
* This gives us zeroes beyond end of physical MPI file.
*/
- if ((n=(io_size-bytes_read)) > 0)
+ if((n = (io_size - bytes_read)) > 0)
HDmemset((char*)buf+bytes_read, 0, (size_t)n);
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "Leaving H5FD_mpio_read\n" );
+ if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stdout, "%s: Leaving\n", FUNC);
#endif
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD__mpio_read() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_write
+ * Function: H5FD__mpio_write
*
* Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR
* from buffer BUF according to data transfer properties in
@@ -1589,116 +1543,16 @@ done:
*
* Return: Success: Zero. USE_TYPES and OLD_USE_TYPES in the
* access params are altered.
- *
* Failure: -1, USE_TYPES and OLD_USE_TYPES in the
* access params may be altered.
*
- * Programmer: Unknown
+ * Programmer: Robert Kim Yates
* January 30, 1998
*
- * Modifications:
- * rky, 1998-08-28
- * If the file->allsame flag is set, we assume that all the
- * procs in the relevant MPI communicator will write identical
- * data at identical offsets in the file, so only proc 0 will
- * write, and all other procs will wait for p0 to finish. This
- * is useful for writing metadata, for example. Note that we
- * don't _check_ that the data is identical. Also, the mechanism
- * we use to eliminate the redundant writes is by requiring a
- * call to H5FD_mpio_tas_allsame before the write, which is
- * rather klugey. Would it be better to pass a parameter to
- * low-level writes like H5F_block_write and H5F_low_write,
- * instead? Or...??? Also, when I created this mechanism I
- * wanted to minimize the difference in behavior between the old
- * way of doing things (i.e., all procs write) and the new way,
- * so the writes are eliminated at the very lowest level, here
- * in H5FD_mpio_write. It may be better to rethink that, and
- * short-circuit the writes at a higher level (e.g., at the
- * points in the code where H5FD_mpio_tas_allsame is called).
- *
- *
- * Robb Matzke, 1998-02-18
- * Added the ACCESS_PARMS argument.
- *
- * rky, 1998-04-10
- * Call independent or collective MPI write, based on
- * ACCESS_PARMS.
- *
- * rky, 1998-04-24
- * Removed redundant write from H5FD_mpio_write.
- *
- * Albert Cheng, 1998-06-01
- * Added XFER_MODE to control independent or collective MPI
- * write.
- *
- * rky, 1998-08-16
- * Use BTYPE, FTYPE, and DISP from access parms. The guts of
- * H5FD_mpio_read and H5FD_mpio_write should be replaced by a
- * single dual-purpose routine.
- *
- * rky, 1998-08-28
- * Added ALLSAME parameter to make all but proc 0 skip the
- * actual write.
- *
- * Robb Matzke, 1999-04-21
- * Changed XFER_MODE to XFER_PARMS for all H5FD_*_write()
- * callbacks.
- *
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
- *
- * Robb Matzke, 1999-08-06
- * Modified to work with the virtual file layer.
- *
- * Albert Cheng, 1999-12-19
- * When only-p0-write-allsame-data, p0 Bcasts the
- * ret_value to other processes. This prevents
- * a racing condition (that other processes try to
- * read the file before p0 finishes writing) and also
- * allows all processes to report the same ret_value.
- *
- * Kim Yates, Pat Weidhaas, 2000-09-26
- * Move block of coding where only p0 writes after the
- * MPI_File_set_view call.
- *
- * Quincey Koziol, 2002-05-10
- * Instead of always writing metadata from process 0, spread the
- * burden among all the processes by using a round-robin rotation
- * scheme.
- *
- * Quincey Koziol, 2002-05-10
- * Removed allsame code, keying off the type parameter instead.
- *
- * Quincey Koziol, 2002-05-14
- * Only call MPI_Get_count if we can use MPI_BYTE for the MPI type
- * for the I/O transfer. Someday we might include code to decode
- * the MPI type used for more complicated transfers and call
- * MPI_Get_count all the time.
- *
- * Quincey Koziol - 2002/06/17
- * Removed 'disp' parameter from H5FD_mpio_setup routine and use
- * the address of the dataset in MPI_File_set_view() calls, as
- * necessary.
- *
- * Quincey Koziol - 2002/06/24
- * Removed "lazy" MPI_File_set_view() calls, since they would fail
- * if the first I/O was a collective I/O using MPI derived types
- * and the next I/O was an independent I/O.
- *
- * Quincey Koziol - 2002/07/18
- * Added "block_before_meta_write" dataset transfer flag, which
- * is set during writes from a metadata cache flush and indicates
- * that all the processes must sync up before (one of them)
- * writing metadata.
- *
- * Quincey Koziol - 2003/10/22-31
- * Restructured code massively, straightening out logic and finally
- * getting the bytes_written stuff working.
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
+H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
haddr_t addr, size_t size, const void *buf)
{
H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
@@ -1720,12 +1574,14 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "Entering H5FD_mpio_write\n" );
+ if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stdout, "%s: Entering\n", FUNC);
#endif
+
+ /* Sanity checks */
HDassert(file);
HDassert(H5FD_MPIO==file->pub.driver_id);
HDassert(buf);
@@ -1745,7 +1601,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'w'])
- fprintf(stdout, "in H5FD_mpio_write mpi_off=%ld size_i=%d\n", (long)mpi_off, size_i);
+ HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i);
#endif
/* Get the transfer mode from the API context */
@@ -1785,8 +1641,8 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
H5FD_mpio_collective_opt_t coll_opt_mode;
#ifdef H5FDmpio_DEBUG
- if(H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "H5FD_mpio_write: using MPIO collective mode\n");
+ if(H5FD_mpio_Debug[(int)'w'])
+ HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC);
#endif
/* Get the collective_opt property to check whether the application wants to do IO individually. */
@@ -1795,8 +1651,8 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
if(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) {
#ifdef H5FDmpio_DEBUG
- if(H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "H5FD_mpio_write: doing MPI collective IO\n");
+ if(H5FD_mpio_Debug[(int)'w'])
+ HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC);
#endif
if(MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code)
@@ -1805,8 +1661,8 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
if(type != H5FD_MEM_DRAW)
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "Metadata Coll opt property should be collective at this point")
#ifdef H5FDmpio_DEBUG
- if(H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "H5FD_mpio_write: doing MPI independent IO\n");
+ if(H5FD_mpio_Debug[(int)'w'])
+ HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC);
#endif
if(MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code)
@@ -1815,10 +1671,10 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
/* Reset the file view when we used MPI derived types */
if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, H5FD_mpi_native_g, file->info)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
- } else {
+ } /* end if */
+ else
if(MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code)
- }
/* How many bytes were actually written? */
#if MPI_VERSION >= 3
@@ -1857,15 +1713,15 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
done:
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "proc %d: Leaving H5FD_mpio_write with ret_value=%d\n",
- file->mpi_rank, ret_value );
+ HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value );
#endif
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_mpio_write() */
+} /* end H5FD__mpio_write() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_flush
+ * Function: H5FD__mpio_flush
*
* Purpose: Makes sure that all data is on disk. This is collective.
*
@@ -1879,18 +1735,20 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
+H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
{
H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
int mpi_code; /* mpi return code */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "Entering %s\n", FUNC);
+ HDfprintf(stdout, "%s: Entering\n", FUNC);
#endif
+
+ /* Sanity checks */
HDassert(file);
HDassert(H5FD_MPIO == file->pub.driver_id);
@@ -1902,15 +1760,15 @@ H5FD_mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
done:
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "Leaving %s\n", FUNC);
+ HDfprintf(stdout, "%s: Leaving\n", FUNC);
#endif
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_mpio_flush() */
+} /* end H5FD__mpio_flush() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_truncate
+ * Function: H5FD__mpio_truncate
*
* Purpose: Make certain the file's size matches it's allocated size
*
@@ -1930,31 +1788,22 @@ done:
* Programmer: Quincey Koziol
* January 31, 2008
*
- * Changes: Heavily reworked to avoid unnecessary MPI_File_set_size()
- * calls. The hope is that these calls are superfluous in the
- * typical case, allowing us to avoid truncates most of the
- * time.
- *
- * The basic idea is to query the file system to get the
- * current eof, and only truncate if the file systems
- * conception of the eof disagrees with our eoa.
- *
- * JRM -- 10/27/17
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing)
+H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing)
{
- H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
- herr_t ret_value = SUCCEED;
+ H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "Entering %s\n", FUNC);
+ HDfprintf(stdout, "%s: Entering\n", FUNC);
#endif
+
+ /* Sanity checks */
HDassert(file);
HDassert(H5FD_MPIO == file->pub.driver_id);
@@ -2020,15 +1869,15 @@ H5FD_mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
done:
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "Leaving %s\n", FUNC);
+ HDfprintf(stdout, "%s: Leaving\n", FUNC);
#endif
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_mpio_truncate() */
+} /* end H5FD__mpio_truncate() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_mpi_rank
+ * Function: H5FD__mpio_mpi_rank
*
* Purpose: Returns the MPI rank for a process
*
@@ -2038,26 +1887,25 @@ done:
* Programmer: Quincey Koziol
* Thursday, May 16, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
-H5FD_mpio_mpi_rank(const H5FD_t *_file)
+H5FD__mpio_mpi_rank(const H5FD_t *_file)
{
const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC
+ /* Sanity checks */
HDassert(file);
- HDassert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(H5FD_MPIO == file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->mpi_rank)
-} /* end H5FD_mpio_mpi_rank() */
+} /* end H5FD__mpio_mpi_rank() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_mpi_size
+ * Function: H5FD__mpio_mpi_size
*
* Purpose: Returns the number of MPI processes
*
@@ -2067,26 +1915,25 @@ H5FD_mpio_mpi_rank(const H5FD_t *_file)
* Programmer: Quincey Koziol
* Thursday, May 16, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
-H5FD_mpio_mpi_size(const H5FD_t *_file)
+H5FD__mpio_mpi_size(const H5FD_t *_file)
{
const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC
+ /* Sanity checks */
HDassert(file);
- HDassert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(H5FD_MPIO == file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->mpi_size)
-} /* end H5FD_mpio_mpi_size() */
+} /* end H5FD__mpio_mpi_size() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_communicator
+ * Function: H5FD__mpio_communicator
*
* Purpose: Returns the MPI communicator for the file.
*
@@ -2097,22 +1944,53 @@ H5FD_mpio_mpi_size(const H5FD_t *_file)
* Programmer: Robb Matzke
* Monday, August 9, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static MPI_Comm
-H5FD_mpio_communicator(const H5FD_t *_file)
+H5FD__mpio_communicator(const H5FD_t *_file)
{
const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC
+ /* Sanity checks */
HDassert(file);
- HDassert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(H5FD_MPIO == file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->comm)
-} /* end H5FD_mpio_communicator() */
+} /* end H5FD__mpio_communicator() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__mpio_get_info
+ *
+ * Purpose: Returns the file info of MPIO file driver.
+ *
+ * Returns: Non-negative if succeed or negative if fails.
+ *
+ * Programmer: John Mainzer
+ * April 4, 2017
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+*/
+static herr_t
+H5FD__mpio_get_info(H5FD_t *_file, void **mpi_info)
+{
+ H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ if(!mpi_info)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mpi info not valid")
+
+ *mpi_info = &(file->info);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5FD__mpio_get_info() */
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index aa1b118..fac0909 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -26,11 +26,6 @@
#include <stdlib.h>
#include <string.h>
-/* Disable certain warnings in PC-Lint: */
-/*lint --emacro( {534, 830}, H5P_DEFAULT, H5P_FILE_ACCESS, H5P_DATASET_XFER) */
-/*lint --emacro( {534, 830}, H5FD_MULTI) */
-/*lint -esym( 534, H5Eclear2, H5Epush2) */
-
#include "hdf5.h"
@@ -211,16 +206,15 @@ my_strdup(const char *s)
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_init
- *
- * Purpose: Initialize this driver by registering the driver with the
- * library.
+ * Function: H5FD_multi_init
*
- * Return: Success: The driver ID for the multi driver.
+ * Purpose: Initialize this driver by registering the driver with the
+ * library.
*
- * Failure: Negative
+ * Return: Success: The driver ID for the multi driver
+ * Failure: H5I_INVALID_HID
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
*-------------------------------------------------------------------------
@@ -231,11 +225,11 @@ H5FD_multi_init(void)
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- if(H5I_VFL!=H5Iget_type(H5FD_MULTI_g))
+ if(H5I_VFL != H5Iget_type(H5FD_MULTI_g))
H5FD_MULTI_g = H5FDregister(&H5FD_multi_g);
return H5FD_MULTI_g;
-}
+} /* end H5FD_multi_init() */
/*---------------------------------------------------------------------------
@@ -497,6 +491,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 +887,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 */
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 06c008d..0054a86 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -208,8 +208,8 @@ done:
* Purpose: Initialize this driver by registering the driver with the
* library.
*
- * Return: Success: The driver ID for the sec2 driver.
- * Failure: Negative
+ * Return: Success: The driver ID for the sec2 driver
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Thursday, July 29, 1999
@@ -221,7 +221,7 @@ H5FD_sec2_init(void)
{
hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
if(H5I_VFL != H5I_get_type(H5FD_SEC2_g))
H5FD_SEC2_g = H5FD_register(&H5FD_sec2_g, sizeof(H5FD_class_t), FALSE);
@@ -682,11 +682,13 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
if(REGION_OVERFLOW(addr, size))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr)
- /* Seek to the correct location */
+#ifndef H5_HAVE_PREADWRITE
+ /* Seek to the correct location (if we don't have pread) */
if(addr != file->pos || OP_READ != file->op) {
if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
} /* end if */
+#endif /* H5_HAVE_PREADWRITE */
/* Read data, being careful of interrupted system calls, partial results,
* and the end of the file.
@@ -694,7 +696,8 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
while(size > 0) {
h5_posix_io_t bytes_in = 0; /* # of bytes to read */
- h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */
+ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */
+ HDoff_t offset = (HDoff_t)addr;
/* Trying to read more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -705,15 +708,21 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
bytes_in = (h5_posix_io_t)size;
do {
+#ifdef H5_HAVE_PREADWRITE
+ bytes_read = HDpread(file->fd, buf, bytes_in, offset);
+ offset += bytes_read;
+#else
bytes_read = HDread(file->fd, buf, bytes_in);
+#endif /* H5_HAVE_PREADWRITE */
} while(-1 == bytes_read && EINTR == errno);
if(-1 == bytes_read) { /* error */
int myerrno = errno;
time_t mytime = HDtime(NULL);
- HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)myoffset);
+ offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset);
} /* end if */
if(0 == bytes_read) {
@@ -777,11 +786,13 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
if(REGION_OVERFLOW(addr, size))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu", (unsigned long long)addr, (unsigned long long)size)
- /* Seek to the correct location */
+#ifndef H5_HAVE_PREADWRITE
+ /* Seek to the correct location (if we don't have pwrite) */
if(addr != file->pos || OP_WRITE != file->op) {
if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
} /* end if */
+#endif /* H5_HAVE_PREADWRITE */
/* Write the data, being careful of interrupted system calls and partial
* results
@@ -790,6 +801,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
h5_posix_io_t bytes_in = 0; /* # of bytes to write */
h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */
+ HDoff_t offset = (HDoff_t)addr;
/* Trying to write more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -800,15 +812,21 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
bytes_in = (h5_posix_io_t)size;
do {
+#ifdef H5_HAVE_PREADWRITE
+ bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset);
+ offset += bytes_wrote;
+#else
bytes_wrote = HDwrite(file->fd, buf, bytes_in);
+#endif /* H5_HAVE_PREADWRITE */
} while(-1 == bytes_wrote && EINTR == errno);
if(-1 == bytes_wrote) { /* error */
int myerrno = errno;
time_t mytime = HDtime(NULL);
- HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)myoffset);
+ offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset);
} /* end if */
HDassert(bytes_wrote > 0);
diff --git a/src/H5FL.c b/src/H5FL.c
index 89a580a..21bbf02 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -642,7 +642,7 @@ H5FL__reg_term(void)
tmp = H5FL_reg_gc_head.first->next;
#ifdef H5FL_DEBUG
-printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.first->list->name, (int)H5FL_reg_gc_head.first->list->allocated);
+HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.first->list->name, (int)H5FL_reg_gc_head.first->list->allocated);
#endif /* H5FL_DEBUG */
/* Check if the list has allocations outstanding */
if(H5FL_reg_gc_head.first->list->allocated > 0) {
@@ -1312,7 +1312,7 @@ H5FL__blk_term(void)
tmp = H5FL_blk_gc_head.first->next;
#ifdef H5FL_DEBUG
-printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.first->pq->name, (int)H5FL_blk_gc_head.first->pq->allocated);
+HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.first->pq->name, (int)H5FL_blk_gc_head.first->pq->allocated);
#endif /* H5FL_DEBUG */
/* Check if the list has allocations outstanding */
@@ -1780,7 +1780,7 @@ H5FL__arr_term(void)
/* Check if the list has allocations outstanding */
#ifdef H5FL_DEBUG
-printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.first->list->name, (int)H5FL_arr_gc_head.first->list->allocated);
+HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.first->list->name, (int)H5FL_arr_gc_head.first->list->allocated);
#endif /* H5FL_DEBUG */
if(H5FL_arr_gc_head.first->list->allocated > 0) {
/* Add free list to the list of nodes with allocations open still */
@@ -2408,7 +2408,7 @@ H5FL__fac_term_all(void)
tmp = H5FL_fac_gc_head.first->next;
#ifdef H5FL_DEBUG
-printf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_head.first->list->size, (int)H5FL_fac_gc_head.first->list->allocated);
+HDprintf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_head.first->list->size, (int)H5FL_fac_gc_head.first->list->allocated);
#endif /* H5FL_DEBUG */
/* The list cannot have any allocations outstanding */
diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c
index dfc1441..18e915f 100644
--- a/src/H5Fdeprec.c
+++ b/src/H5Fdeprec.c
@@ -42,6 +42,8 @@
#include "H5Iprivate.h" /* IDs */
#include "H5SMprivate.h" /* Shared object header messages */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
/****************/
/* Local Macros */
@@ -118,7 +120,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the file information */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, &finfo2) < 0)
+ 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 */
@@ -225,7 +227,7 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
low = H5F_LIBVER_EARLIEST;
/* Set the library's version bounds */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0)
+ 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:
diff --git a/src/H5Fefc.c b/src/H5Fefc.c
index a394071..f3881d4 100644
--- a/src/H5Fefc.c
+++ b/src/H5Fefc.c
@@ -29,8 +29,10 @@
/* Packages needed by this file... */
#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
+#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
@@ -144,6 +146,8 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi
H5F_efc_t *efc = NULL; /* External file cache for parent file */
H5F_efc_ent_t *ent = NULL; /* Entry for target file in efc */
hbool_t open_file = FALSE; /* Whether ent->file needs to be closed in case of error */
+ H5P_genplist_t *plist; /* Property list pointer for FAPL */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
H5F_t *ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -153,6 +157,18 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi
HDassert(parent->shared);
HDassert(name);
+ /* Get the VOL info from the fapl */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, NULL, "not a file access property list")
+ 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")
+
+ /* Stash a copy of the "top-level" connector property, before any pass-through
+ * connectors modify or unwrap it.
+ */
+ if(H5CX_set_vol_connector_prop(&connector_prop) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set VOL connector info in API context")
+
/* Get external file cache */
efc = parent->shared->efc;
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 056a98b..8a7019d 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -39,6 +39,8 @@
#include "H5Tprivate.h" /* Datatypes */
#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
/****************/
/* Local Macros */
@@ -74,6 +76,7 @@ typedef struct H5F_olist_t {
/* Local Prototypes */
/********************/
+static herr_t H5F__set_vol_conn(H5F_t *file);
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*/);
@@ -115,39 +118,46 @@ H5FL_DEFINE(H5F_file_t);
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info)
+static herr_t
+H5F__set_vol_conn(H5F_t *file)
{
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
void *new_connector_info = NULL; /* Copy of connector info */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(file);
- /* Only cache VOL connector ID & info the first time the file is opened */
- if(file->shared->nrefs == 1) {
- /* Copy connector info, if it exists */
- if(vol_info) {
- H5VL_class_t *connector; /* Pointer to connector */
+ /* Retrieve a copy of the "top-level" connector property, before any pass-through
+ * connectors modified or unwrapped it.
+ */
+ if(H5CX_get_vol_connector_prop(&connector_prop) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL connector info from API context")
- /* 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")
+ /* Sanity check */
+ HDassert(0 != connector_prop.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 */
+ /* Copy connector info, if it exists */
+ if(connector_prop.connector_info) {
+ H5VL_class_t *connector; /* Pointer to connector */
- /* 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")
+ /* Retrieve the connector for the ID */
+ if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop.connector_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, connector_prop.connector_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 = connector_prop.connector_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() */
@@ -492,7 +502,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:
@@ -793,14 +802,12 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type,
/* get last component of file_name */
H5_GET_LAST_DELIMITER(actual_file_name, ptr)
- if(!ptr)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file, file name = '%s', temp_file_name = '%s'", file_name, temp_file_name)
-
- /* Truncate filename portion from actual file name path */
- *ptr = '\0';
+ if(ptr)
+ /* Truncate filename portion from actual file name path */
+ *ptr = '\0';
/* Build new file name for the external file */
- if(H5F__build_name(actual_file_name, temp_file_name, &full_name/*out*/) < 0)
+ if(H5F__build_name((ptr ? actual_file_name : ""), temp_file_name, &full_name/*out*/) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename")
actual_file_name = (char *)H5MM_xfree(actual_file_name);
@@ -816,7 +823,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type,
H5E_clear_stack(NULL);
} /* end if */
- /* Success */
+ /* Set return value (possibly NULL or valid H5F_t *) */
ret_value = src_file;
done:
@@ -1090,6 +1097,10 @@ 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 */
+ if(H5F__set_vol_conn(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't cache VOL connector info")
+
/* 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.
@@ -3601,7 +3612,6 @@ H5F__get_file(void *obj, H5I_type_t type)
case H5I_UNINIT:
case H5I_BADID:
case H5I_DATASPACE:
- case H5I_REFERENCE:
case H5I_VFL:
case H5I_VOL:
case H5I_GENPROP_CLS:
@@ -3695,7 +3705,7 @@ H5F_get_file_id(hid_t obj_id, H5I_type_t type)
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_FILE_GET_FILE_ID, type, &file_id) < 0)
+ 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")
@@ -3707,3 +3717,27 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_get_file_id() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_set_min_dset_ohdr
+ *
+ * Purpose: Set the crt_dset_ohdr_flag field with a new value.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(f->shared);
+
+ f->shared->crt_dset_min_ohdr_flag = minimize;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5F_set_min_dset_ohdr() */
+
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index d7f8915..13d95aa 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -482,7 +482,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
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, 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:
@@ -534,7 +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, 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:
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c
index 6ddbfbb..5bbd717 100644
--- a/src/H5Fmpi.c
+++ b/src/H5Fmpi.c
@@ -94,7 +94,7 @@ H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle)
FUNC_ENTER_NOAPI(FAIL)
- assert(f && f->shared);
+ HDassert(f && f->shared);
/* Dispatch to driver */
if ((ret_value = H5FD_get_vfd_handle(f->shared->lf, fapl, (void **)f_handle)) < 0)
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index fc902b0..335d0a7 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -358,6 +358,7 @@ struct H5F_file_t {
/* Object flush info */
H5F_object_flush_t object_flush; /* Information for object flush callback */
+ hbool_t crt_dset_min_ohdr_flag; /* flag to minimize created dataset object header */
};
/*
@@ -382,36 +383,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_GET_FILE_ID, /* retrieve or resurrect file ID of object */
- 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_FORMAT_CONVERT,
- H5VL_FILE_RESET_PAGE_BUFFERING_STATS,
- H5VL_FILE_GET_PAGE_BUFFERING_STATS,
- H5VL_FILE_GET_MDC_IMAGE_INFO,
- H5VL_FILE_GET_EOA,
- H5VL_FILE_INCR_FILESIZE,
- H5VL_FILE_SET_LIBVER_BOUNDS
-} H5VL_file_optional_t;
-
-
/*****************************/
/* Package Private Variables */
/*****************************/
@@ -440,7 +411,6 @@ 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);
-H5_DLL herr_t H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info);
/* File mount related routines */
H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 83513a5..5f7a1b2 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -331,6 +331,8 @@ typedef struct H5F_t H5F_t;
#define H5F_POINT_OF_NO_RETURN(F) ((F)->shared->fs.point_of_no_return)
#define H5F_FIRST_ALLOC_DEALLOC(F) ((F)->shared->first_alloc_dealloc)
#define H5F_EOA_PRE_FSM_FSALLOC(F) ((F)->shared->eoa_pre_fsm_fsalloc)
+#define H5F_GET_MIN_DSET_OHDR(F) ((F)->shared->crt_dset_min_ohdr_flag)
+#define H5F_SET_MIN_DSET_OHDR(F, V) ((F)->shared->crt_dset_min_ohdr_flag = (V))
#else /* H5F_MODULE */
#define H5F_LOW_BOUND(F) (H5F_get_low_bound(F))
#define H5F_HIGH_BOUND(F) (H5F_get_high_bound(F))
@@ -388,6 +390,8 @@ typedef struct H5F_t H5F_t;
#define H5F_POINT_OF_NO_RETURN(F) (H5F_get_point_of_no_return(F))
#define H5F_FIRST_ALLOC_DEALLOC(F) (H5F_get_first_alloc_dealloc(F))
#define H5F_EOA_PRE_FSM_FSALLOC(F) (H5F_get_eoa_pre_fsm_fsalloc(F))
+#define H5F_GET_MIN_DSET_OHDR(F) (H5F_get_min_dset_ohdr(F))
+#define H5F_SET_MIN_DSET_OHDR(F, V) (H5F_set_min_dset_ohdr((F), (V)))
#endif /* H5F_MODULE */
@@ -500,9 +504,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 */
@@ -742,6 +744,8 @@ H5_DLL hsize_t H5F_get_pgend_meta_thres(const H5F_t *f);
H5_DLL hbool_t H5F_get_point_of_no_return(const H5F_t *f);
H5_DLL hbool_t H5F_get_first_alloc_dealloc(const H5F_t *f);
H5_DLL haddr_t H5F_get_eoa_pre_fsm_fsalloc(const H5F_t *f);
+H5_DLL hbool_t H5F_get_min_dset_ohdr(const H5F_t *f);
+H5_DLL herr_t H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize);
/* Functions than retrieve values set/cached from the superblock/FCPL */
H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f);
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 8e54e7f..9f1ed01 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -217,12 +217,13 @@ typedef struct H5F_retry_info_t {
/* Callback for H5Pset_object_flush_cb() in a file access property list */
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);
@@ -233,7 +234,7 @@ H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope);
H5_DLL herr_t H5Fclose(hid_t file_id);
H5_DLL hid_t H5Fget_create_plist(hid_t file_id);
H5_DLL hid_t H5Fget_access_plist(hid_t file_id);
-H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned * intent);
+H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned *intent);
H5_DLL ssize_t H5Fget_obj_count(hid_t file_id, unsigned types);
H5_DLL ssize_t H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *obj_id_list);
H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle);
@@ -273,6 +274,8 @@ 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],
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);
+H5_DLL herr_t H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize);
+H5_DLL herr_t H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize);
#ifdef H5_HAVE_PARALLEL
H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 3147e95..103ad3b 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -514,6 +514,25 @@ H5F_sym_leaf_k(const H5F_t *f)
/*-------------------------------------------------------------------------
+ * Function: H5F_get_min_dset_ohdr
+ *
+ * Purpose: Get the setting flag for minimized dataset object headers
+ *
+ * Return: TRUE/FALSE as set in file
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5F_get_min_dset_ohdr(const H5F_t *f)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(f);
+
+ FUNC_LEAVE_NOAPI(f->shared->crt_dset_min_ohdr_flag)
+} /* end H5F_get_min_dset_ohdr */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_Kvalue
*
* Purpose: Replaced a macro to retrieve a B-tree key value for a certain
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index a15703e..cb03b5e 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -45,6 +45,8 @@
#include "H5Pprivate.h" /* Property lists */
#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
/****************/
/* Local Macros */
@@ -734,7 +736,7 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set the comment */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, &loc_params, 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:
@@ -770,19 +772,20 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf)
{
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(!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;
@@ -792,11 +795,14 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf)
/* Get the location object */
if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "invalid location identifier")
/* Get the comment */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, &loc_params, buf, bufsize, &ret_value) < 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)
@@ -868,7 +874,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
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_GROUP_ITERATE_OLD, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0)
+ 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 */
@@ -985,7 +991,7 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link,
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_GROUP_GET_OBJINFO, &loc_params, (unsigned)follow_link, statbuf) < 0)
+ 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 */
@@ -1239,7 +1245,7 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
/* 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_OBJECT_GET_INFO, &loc_params, &oinfo, fields) < 0)
+ 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 */
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index 2dacd94..5724031 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -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")
diff --git a/src/H5Gname.c b/src/H5Gname.c
index f6ddeeb..2aece2b 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -821,7 +821,6 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
- case H5I_REFERENCE:
case H5I_VFL:
case H5I_VOL:
case H5I_GENPROP_CLS:
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 159b6f5..f475bde 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -299,22 +299,6 @@ typedef struct H5G_copy_file_ud_t {
H5G_cache_t cache; /* Cached data for symbol table entry */
} H5G_copy_file_ud_t;
-/* Types for optional group VOL operations */
-typedef enum H5VL_group_optional_t {
- H5VL_GROUP_ITERATE_OLD, /* HG5Giterate (deprecated routine) */
- H5VL_GROUP_GET_OBJINFO /* HG5Gget_objinfo (deprecated routine) */
- /* (These two enum values should have an
- * "#ifndefH5_NO_DEPRECATED_SYMBOLS"
- * around them, but the compiler
- * complains about an empty enum
- * when deprecated symbols are
- * disabled currently. When
- * another enum value is added,
- * please put the #ifdef around
- * these symbols. QAK - 2018/12/06
- */
-} H5VL_group_optional_t;
-
/*****************************/
/* Package Private Variables */
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index ab6f200..170b74d 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -37,10 +37,6 @@
/* Public Macros */
/*****************/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/*******************/
/* Public Typedefs */
/*******************/
@@ -62,6 +58,7 @@ typedef struct H5G_info_t {
hbool_t mounted; /* Whether group has a file mounted on it */
} H5G_info_t;
+
/********************/
/* Public Variables */
/********************/
@@ -70,6 +67,10 @@ typedef struct H5G_info_t {
/*********************/
/* Public Prototypes */
/*********************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
H5_DLL hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id,
hid_t gcpl_id, hid_t gapl_id);
H5_DLL hid_t H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id);
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index 1995015..af6acb3 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -609,7 +609,6 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
- case H5I_REFERENCE:
case H5I_VFL:
case H5I_VOL:
case H5I_GENPROP_CLS:
diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c
index fc437dc..22de0c4 100644
--- a/src/H5HFdbg.c
+++ b/src/H5HFdbg.c
@@ -483,7 +483,7 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata)
/* Flag overlaps */
if (overlap)
- fprintf(udata->stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n");
+ HDfprintf(udata->stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n");
else
udata->amount_free += len;
} /* end if */
diff --git a/src/H5I.c b/src/H5I.c
index 68cbe55..ca9ff61 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -2372,7 +2372,6 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
- case H5I_REFERENCE:
case H5I_VFL:
case H5I_VOL:
case H5I_GENPROP_CLS:
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index f4b5cc9..56873ec 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -29,9 +29,6 @@
*
* When adding types here, add a section to the 'misc19' test in test/tmisc.c
* to verify that the H5I{inc|dec|get}_ref() routines work correctly with it.
- *
- * NOTE: H5I_REFERENCE is not used by the library and has been deprecated
- * with a tentative removal version of 1.12.0. (DER, July 2017)
*/
typedef enum H5I_type_t {
H5I_UNINIT = (-2), /* uninitialized type */
@@ -42,7 +39,6 @@ typedef enum H5I_type_t {
H5I_DATASPACE, /* type ID for Dataspace objects */
H5I_DATASET, /* type ID for Dataset objects */
H5I_ATTR, /* type ID for Attribute objects */
- H5I_REFERENCE, /* *DEPRECATED* type ID for Reference objects */
H5I_VFL, /* type ID for virtual file layer */
H5I_VOL, /* type ID for virtual object layer */
H5I_GENPROP_CLS, /* type ID for generic property list classes */
diff --git a/src/H5L.c b/src/H5L.c
index 9506e7d..1f45740 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -648,6 +648,8 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified")
if(link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class")
+ if(!udata && udata_size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata cannot be NULL if udata_size is non-zero")
/* Check the group access property list */
if(H5P_DEFAULT == lcpl_id)
@@ -1332,7 +1334,7 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
loc_params.obj_type = H5I_get_type(group_id);
/* Iterate over the links */
- if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0)
+ if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (unsigned)FALSE, (int)idx_type, (int)order, idx_p, op, op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
diff --git a/src/H5O.c b/src/H5O.c
index 2ea8c10..4e2f603 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -38,6 +38,8 @@
#include "H5Lprivate.h" /* Links */
#include "H5Opkg.h" /* Object headers */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
/****************/
/* Local Macros */
@@ -575,7 +577,7 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0)
+ 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_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
@@ -633,7 +635,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0)
+ 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_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name)
done:
@@ -698,7 +700,7 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0)
+ 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_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
@@ -746,7 +748,7 @@ H5Oset_comment(hid_t obj_id, const char *comment)
loc_params.obj_type = H5I_get_type(obj_id);
/* (Re)set the object's comment */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, &loc_params, 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_OHDR, H5E_CANTSET, FAIL, "can't set comment for object")
done:
@@ -801,7 +803,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* (Re)set the object's comment */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, &loc_params, 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_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name)
done:
@@ -844,7 +846,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize)
loc_params.obj_type = H5I_get_type(obj_id);
/* Retrieve the object's comment */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object")
done:
@@ -898,7 +900,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Retrieve the object's comment */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name)
done:
@@ -971,7 +973,7 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
loc_params.obj_type = H5I_get_type(obj_id);
/* Visit the objects */
- if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0)
+ if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, op, op_data, fields)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
@@ -1055,7 +1057,7 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
loc_params.obj_type = H5I_get_type(loc_id);
/* Visit the objects */
- if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0)
+ if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, op, op_data, fields)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
@@ -1104,7 +1106,6 @@ H5Oclose(hid_t object_id)
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
- case H5I_REFERENCE:
case H5I_VFL:
case H5I_VOL:
case H5I_GENPROP_CLS:
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index c93bf32..c420046 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -176,7 +176,12 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
/* Decode and store the name */
if(NULL == (attr->shared->name = H5MM_strdup((const char *)p)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+
+ /* Make an attempt to detect corrupted name or name length - HDFFV-10588 */
+ if(name_len != (HDstrlen(attr->shared->name) + 1))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "attribute name has different length than stored length")
+
if(attr->shared->version < H5O_ATTR_VERSION_2)
p += H5O_ALIGN_OLD(name_len); /* advance the memory pointer */
else
diff --git a/src/H5Obogus.c b/src/H5Obogus.c
index fbf04f2..f3cca0f 100644
--- a/src/H5Obogus.c
+++ b/src/H5Obogus.c
@@ -49,7 +49,7 @@ const H5O_msg_class_t H5O_MSG_BOGUS_VALID[1] = {{
H5O_BOGUS_VALID_ID, /*message id number */
"bogus valid", /*message name for debugging */
0, /*native message size */
- 0, /* messages are sharable? */
+ H5O_SHARE_IS_SHARABLE, /* messages are sharable? */
H5O__bogus_decode, /*decode message */
H5O_bogus_encode, /*encode message */
NULL, /*copy the native value */
@@ -73,7 +73,7 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{
H5O_BOGUS_INVALID_ID, /*message id number */
"bogus invalid", /*message name for debugging */
0, /*native message size */
- 0, /* messages are sharable? */
+ H5O_SHARE_IS_SHARABLE, /* messages are sharable? */
H5O__bogus_decode, /*decode message */
H5O_bogus_encode, /*encode message */
NULL, /*copy the native value */
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index fba4f6e..578cff0 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -1390,7 +1390,8 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Message size */
UINT16DECODE(chunk_image, mesg_size);
- HDassert(mesg_size == H5O_ALIGN_OH(oh, mesg_size));
+ if(mesg_size != H5O_ALIGN_OH(oh, mesg_size))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "message not aligned")
/* Message flags */
flags = *chunk_image++;
@@ -1402,10 +1403,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message")
if((flags & H5O_MSG_FLAG_WAS_UNKNOWN) && !(flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message")
- if((flags & H5O_MSG_FLAG_SHAREABLE)
- && H5O_msg_class_g[id]
- && !(H5O_msg_class_g[id]->share_flags & H5O_SHARE_IS_SHARABLE))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "message of unsharable class flagged as sharable")
+ /* Delay checking the "shareable" flag until we've made sure id
+ * references a valid message class that this version of the library
+ * knows about */
/* Reserved bytes/creation index */
if(oh->version == H5O_VERSION_1)
@@ -1517,9 +1517,17 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
mesgs_modified = TRUE;
} /* end if */
} /* end if */
- else
+ else {
+ /* Check for message of unshareable class marked as "shareable"
+ */
+ if((flags & H5O_MSG_FLAG_SHAREABLE)
+ && H5O_msg_class_g[id]
+ && !(H5O_msg_class_g[id]->share_flags & H5O_SHARE_IS_SHARABLE))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "message of unshareable class flagged as shareable")
+
/* Set message class for "known" messages */
mesg->type = H5O_msg_class_g[id];
+ } /* end else */
/* Do some inspection/interpretation of new messages from this chunk */
/* (detect continuation messages, ref. count messages, etc.) */
diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c
index 93fc18a..7aefc67 100644
--- a/src/H5Odeprec.c
+++ b/src/H5Odeprec.c
@@ -37,6 +37,8 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Opkg.h" /* Object headers */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
/****************/
/* Local Macros */
@@ -109,7 +111,7 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
- if(H5VL_object_optional(vol_obj, 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_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
@@ -160,7 +162,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
- if(H5VL_object_optional(vol_obj, 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_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name)
done:
@@ -221,7 +223,7 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
- if(H5VL_object_optional(vol_obj, 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_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
@@ -289,7 +291,7 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
loc_params.obj_type = H5I_get_type(obj_id);
/* Visit the objects */
- if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
+ if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, op, op_data, H5O_INFO_ALL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
@@ -368,7 +370,7 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
loc_params.obj_type = H5I_get_type(loc_id);
/* Visit the objects */
- if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
+ if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, op, op_data, H5O_INFO_ALL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index 125da36..fd50cb9 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -890,40 +890,40 @@ H5O__fill_debug(H5F_t H5_ATTR_UNUSED *f, const void *_fill, FILE *stream,
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Space Allocation Time:");
switch(fill->alloc_time) {
case H5D_ALLOC_TIME_EARLY:
- fprintf(stream,"Early\n");
+ HDfprintf(stream,"Early\n");
break;
case H5D_ALLOC_TIME_LATE:
- fprintf(stream,"Late\n");
+ HDfprintf(stream,"Late\n");
break;
case H5D_ALLOC_TIME_INCR:
- fprintf(stream,"Incremental\n");
+ HDfprintf(stream,"Incremental\n");
break;
case H5D_ALLOC_TIME_DEFAULT:
case H5D_ALLOC_TIME_ERROR:
default:
- fprintf(stream,"Unknown!\n");
+ HDfprintf(stream,"Unknown!\n");
break;
} /* end switch */
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Fill Time:");
switch(fill->fill_time) {
case H5D_FILL_TIME_ALLOC:
- fprintf(stream,"On Allocation\n");
+ HDfprintf(stream,"On Allocation\n");
break;
case H5D_FILL_TIME_NEVER:
- fprintf(stream,"Never\n");
+ HDfprintf(stream,"Never\n");
break;
case H5D_FILL_TIME_IFSET:
- fprintf(stream,"If Set\n");
+ HDfprintf(stream,"If Set\n");
break;
case H5D_FILL_TIME_ERROR:
default:
- fprintf(stream,"Unknown!\n");
+ HDfprintf(stream,"Unknown!\n");
break;
} /* end switch */
@@ -931,20 +931,20 @@ H5O__fill_debug(H5F_t H5_ATTR_UNUSED *f, const void *_fill, FILE *stream,
H5P_is_fill_value_defined((const H5O_fill_t *)fill, &fill_status);
switch(fill_status) {
case H5D_FILL_VALUE_UNDEFINED:
- fprintf(stream,"Undefined\n");
+ HDfprintf(stream,"Undefined\n");
break;
case H5D_FILL_VALUE_DEFAULT:
- fprintf(stream,"Default\n");
+ HDfprintf(stream,"Default\n");
break;
case H5D_FILL_VALUE_USER_DEFINED:
- fprintf(stream,"User Defined\n");
+ HDfprintf(stream,"User Defined\n");
break;
case H5D_FILL_VALUE_ERROR:
default:
- fprintf(stream,"Unknown!\n");
+ HDfprintf(stream,"Unknown!\n");
break;
} /* end switch */
diff --git a/src/H5Oflush.c b/src/H5Oflush.c
index 3e1ae46..da9d1d0 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -484,7 +484,6 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_connector
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
- case H5I_REFERENCE:
case H5I_VFL:
case H5I_VOL:
case H5I_GENPROP_CLS:
diff --git a/src/H5Oint.c b/src/H5Oint.c
index 52290f2..d3a409c 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -83,7 +83,6 @@ static herr_t H5O__visit_cb(hid_t group, const char *name, const H5L_info_t *lin
void *_udata);
static const H5O_obj_class_t *H5O__obj_class_real(const H5O_t *oh);
-
/*********************/
/* Package Variables */
/*********************/
@@ -126,12 +125,7 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */
H5O_MSG_FSINFO, /*0x0017 Free-space manager info */
H5O_MSG_MDCI, /*0x0018 Metadata cache image */
- H5O_MSG_UNKNOWN, /*0x0019 Placeholder for unknown message */
-#ifdef H5O_ENABLE_BOGUS
- H5O_MSG_BOGUS_INVALID, /*0x001A "Bogus invalid" (for testing) */
-#else /* H5O_ENABLE_BOGUS */
- NULL, /*0x001A "Bogus invalid" (for testing) */
-#endif /* H5O_ENABLE_BOGUS */
+ H5O_MSG_UNKNOWN /*0x0019 Placeholder for unknown message */
};
/* Format version bounds for object header */
@@ -277,99 +271,183 @@ done:
* matzke@llnl.gov
* Aug 5 1997
*
+ * Changes: 2018 August 17
+ * Jacob Smith
+ * Refactor out the operations into two separate steps --
+ * preparation and application -- to facilitate overriding the
+ * library-default size allocated for the object header. This
+ * function is retained as a wrapper, to minimize changes to
+ * unaffected calling functions.
+ *
*-------------------------------------------------------------------------
*/
herr_t
-H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id,
- H5O_loc_t *loc/*out*/)
+H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id, H5O_loc_t *loc /*out*/)
{
- H5P_genplist_t *oc_plist; /* Object creation property list */
- H5O_t *oh = NULL; /* Object header created */
- haddr_t oh_addr; /* Address of initial object header */
- size_t oh_size; /* Size of initial object header */
- uint8_t oh_flags; /* Object header's initial status flags */
- unsigned insert_flags = H5AC__NO_FLAGS_SET; /* Flags for inserting object header into cache */
- hbool_t store_msg_crt_idx; /* Whether to always store message creation indices for this file */
- herr_t ret_value = SUCCEED; /* return value */
+ H5O_t *oh = NULL;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
- /* check args */
HDassert(f);
HDassert(loc);
HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE));
+ /* create object header in freelist
+ * header version is set internally
+ */
+ oh = H5O__create_ohdr(f, ocpl_id);
+ if(NULL == oh)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "Can't instantiate object header")
+
+ /* apply object header information to file
+ */
+ if(H5O__apply_ohdr(f, oh, ocpl_id, size_hint, initial_rc, loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "Can't apply object header to file")
+
+done:
+ if((FAIL == ret_value) && (NULL != oh) && (H5O__free(oh) < 0))
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "can't delete object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_create() */
+
+
+/*-----------------------------------------------------------------------------
+ * Function: H5O__create_ohdr
+ *
+ * Purpose: Create the object header, set version and flags.
+ *
+ * Return: Success: Pointer to the newly-crated header object.
+ * Failure: NULL
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 17
+ *
+ *-----------------------------------------------------------------------------
+ */
+H5O_t *
+H5O__create_ohdr(H5F_t *f, hid_t ocpl_id)
+{
+ H5P_genplist_t *oc_plist;
+ H5O_t *oh = NULL; /* Object header in Freelist */
+ uint8_t oh_flags; /* Initial status flags */
+ H5O_t *ret_value = NULL;
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ HDassert(f);
+ HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE));
+
/* Check for invalid access request */
if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "no write intent on file")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "no write intent on file")
- /* Make certain we allocate at least a reasonable size for the object header */
- size_hint = H5O_ALIGN_F(f, MAX(H5O_MIN_SIZE, size_hint));
+ oh = H5FL_CALLOC(H5O_t);
+ if(NULL == oh)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- /* Get the property list */
- if(NULL == (oc_plist = (H5P_genplist_t *)H5I_object(ocpl_id)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property list")
+ oc_plist = (H5P_genplist_t *)H5I_object(ocpl_id);
+ if(NULL == oc_plist)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a property list")
/* Get any object header status flags set by properties */
if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags")
- /* Allocate the object header and zero out header fields */
- if(NULL == (oh = H5FL_CALLOC(H5O_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ if(H5O_set_version(f, oh, oh_flags, H5F_STORE_MSG_CRT_IDX(f)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, NULL, "can't set version of object header")
+
+ oh->flags = oh_flags;
+
+ ret_value = oh;
+
+done:
+ if((NULL == ret_value) && (NULL != oh) && (H5O__free(oh) < 0))
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "can't delete object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5O__create_ohdr() */
+
+
+/*-----------------------------------------------------------------------------
+ * Function: H5O__apply_ohdr
+ *
+ * Purpose: Initialize and set the object header in the file.
+ * Record some information at `loc_out`.
+ *
+ * Return: Success: SUCCEED (0) (non-negative value)
+ * Failure: FAIL (-1) (negative value)
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 17
+ *
+ *-----------------------------------------------------------------------------
+ */
+herr_t
+H5O__apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t initial_rc, H5O_loc_t *loc_out)
+{
+ haddr_t oh_addr;
+ size_t oh_size;
+ H5P_genplist_t *oc_plist = NULL;
+ unsigned insert_flags = H5AC__NO_FLAGS_SET;
+ herr_t ret_value = SUCCEED;
- /* Initialize file-specific information for object header */
- store_msg_crt_idx = H5F_STORE_MSG_CRT_IDX(f);
+ FUNC_ENTER_NOAPI(FAIL)
- if(H5O_set_version(f, oh, oh_flags, store_msg_crt_idx) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set version of objecdt header")
+ HDassert(f);
+ HDassert(loc_out);
+ HDassert(oh);
+ HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE));
+
+ /* Allocate at least a reasonable size for the object header */
+ size_hint = H5O_ALIGN_F(f, MAX(H5O_MIN_SIZE, size_hint));
oh->sizeof_size = H5F_SIZEOF_SIZE(f);
oh->sizeof_addr = H5F_SIZEOF_ADDR(f);
- oh->swmr_write = !!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE);
+ oh->swmr_write = !!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE); /* funky cast */
+
#ifdef H5O_ENABLE_BAD_MESG_COUNT
/* Check whether the "bad message count" property is set */
- if(H5P_exist_plist(oc_plist, H5O_BAD_MESG_COUNT_NAME) > 0) {
- /* Retrieve bad message count flag */
+ if(0 < H5P_exist_plist(oc_plist, H5O_BAD_MESG_COUNT_NAME))
+ /* Get bad message count flag -- from property list */
if(H5P_get(oc_plist, H5O_BAD_MESG_COUNT_NAME, &oh->store_bad_mesg_count) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get bad message count flag")
- }
#endif /* H5O_ENABLE_BAD_MESG_COUNT */
/* Create object header proxy if doing SWMR writes */
if(oh->swmr_write) {
- /* Create virtual entry, for use as proxy */
- if(NULL == (oh->proxy = H5AC_proxy_entry_create()))
+ oh->proxy = H5AC_proxy_entry_create();
+ if(NULL == oh->proxy)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create object header proxy")
- }
- else
+ } else {
oh->proxy = NULL;
+ }
- /* Set initial status flags */
- oh->flags = oh_flags;
+ oc_plist = (H5P_genplist_t *)H5I_object(ocpl_id);
+ if(NULL == oc_plist)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property list")
/* Initialize version-specific fields */
if(oh->version > H5O_VERSION_1) {
- /* Initialize all time fields with current time, if we are storing them */
+ /* Initialize all time fields */
if(oh->flags & H5O_HDR_STORE_TIMES)
oh->atime = oh->mtime = oh->ctime = oh->btime = H5_now();
else
oh->atime = oh->mtime = oh->ctime = oh->btime = 0;
- /* Make certain attribute creation order tracking is enabled if
- * attributes can be shared in this file.
- */
- if(store_msg_crt_idx)
+ if(H5F_STORE_MSG_CRT_IDX(f))
+ /* flag to record message creation indices */
oh->flags |= H5O_HDR_ATTR_CRT_ORDER_TRACKED;
- /* Retrieve attribute storage phase change values from property list */
+ /* Get attribute storage phase change values -- from property list */
if(H5P_get(oc_plist, H5O_CRT_ATTR_MAX_COMPACT_NAME, &oh->max_compact) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get max. # of compact attributes")
if(H5P_get(oc_plist, H5O_CRT_ATTR_MIN_DENSE_NAME, &oh->min_dense) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get min. # of dense attributes")
/* Check for non-default attribute storage phase change values */
- if(oh->max_compact != H5O_CRT_ATTR_MAX_COMPACT_DEF || oh->min_dense != H5O_CRT_ATTR_MIN_DENSE_DEF)
+ if(H5O_CRT_ATTR_MAX_COMPACT_DEF != oh->max_compact || H5O_CRT_ATTR_MIN_DENSE_DEF != oh->min_dense )
oh->flags |= H5O_HDR_ATTR_STORE_PHASE_CHANGE;
/* Determine correct value for chunk #0 size bits */
@@ -383,23 +461,25 @@ H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id,
oh->flags |= H5O_HDR_CHUNK0_4;
else if(size_hint > 255)
oh->flags |= H5O_HDR_CHUNK0_2;
- } /* end if */
- else {
+ } else {
/* Reset unused time fields */
oh->atime = oh->mtime = oh->ctime = oh->btime = 0;
- } /* end else */
+ } /* end if/else header version >1 */
/* Compute total size of initial object header */
/* (i.e. object header prefix and first chunk) */
oh_size = (size_t)H5O_SIZEOF_HDR(oh) + size_hint;
/* Allocate disk space for header and first chunk */
- if(HADDR_UNDEF == (oh_addr = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)oh_size)))
+ oh_addr = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)oh_size);
+ if(HADDR_UNDEF == oh_addr)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for object header")
/* Create the chunk list */
- oh->nchunks = oh->alloc_nchunks = 1;
- if(NULL == (oh->chunk = H5FL_SEQ_MALLOC(H5O_chunk_t, (size_t)oh->alloc_nchunks)))
+ oh->nchunks = 1;
+ oh->alloc_nchunks = 1;
+ oh->chunk = H5FL_SEQ_MALLOC(H5O_chunk_t, (size_t)oh->alloc_nchunks);
+ if(NULL == oh->chunk)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Initialize the first chunk */
@@ -409,25 +489,27 @@ H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id,
/* Allocate enough space for the first chunk */
/* (including space for serializing the object header prefix */
- if(NULL == (oh->chunk[0].image = H5FL_BLK_CALLOC(chunk_image, oh_size)))
+ oh->chunk[0].image = H5FL_BLK_CALLOC(chunk_image, oh_size);
+ if(NULL == oh->chunk[0].image)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
oh->chunk[0].chunk_proxy = NULL;
/* Put magic # for object header in first chunk */
- if(oh->version > H5O_VERSION_1)
+ if(H5O_VERSION_1 < oh->version)
HDmemcpy(oh->chunk[0].image, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
/* Create the message list */
oh->nmesgs = 1;
oh->alloc_nmesgs = H5O_NMESGS;
- if(NULL == (oh->mesg = H5FL_SEQ_CALLOC(H5O_mesg_t, oh->alloc_nmesgs)))
+ oh->mesg = H5FL_SEQ_CALLOC(H5O_mesg_t, oh->alloc_nmesgs);
+ if(NULL == oh->mesg)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- /* Initialize the initial "null" message, covering the entire first chunk */
+ /* Initialize the initial "null" message; covers the entire first chunk */
oh->mesg[0].type = H5O_MSG_NULL;
oh->mesg[0].dirty = TRUE;
oh->mesg[0].native = NULL;
- oh->mesg[0].raw = oh->chunk[0].image + (H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)) + H5O_SIZEOF_MSGHDR_OH(oh);
+ oh->mesg[0].raw = oh->chunk[0].image + H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh) + H5O_SIZEOF_MSGHDR_OH(oh);
oh->mesg[0].raw_size = size_hint - (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
oh->mesg[0].chunkno = 0;
@@ -452,20 +534,15 @@ H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id,
H5_END_TAG
/* Set up object location */
- loc->file = f;
- loc->addr = oh_addr;
+ loc_out->file = f;
+ loc_out->addr = oh_addr;
- /* Open it */
- if(H5O_open(loc) < 0)
+ if(H5O_open(loc_out) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object header")
done:
- if(ret_value < 0 && oh)
- if(H5O__free(oh) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_create() */
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* H5O__apply_ohdr() */
/*-------------------------------------------------------------------------
@@ -1765,7 +1842,6 @@ H5O_get_loc(hid_t object_id)
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
- case H5I_REFERENCE:
case H5I_VFL:
case H5I_VOL:
case H5I_GENPROP_CLS:
@@ -2421,6 +2497,63 @@ H5O_get_oh_addr(const H5O_t *oh)
/*-------------------------------------------------------------------------
+ * Function: H5O_get_oh_flags
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 17
+ *
+ *-------------------------------------------------------------------------
+ */
+uint8_t
+H5O_get_oh_flags(const H5O_t *oh)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ HDassert(oh);
+ FUNC_LEAVE_NOAPI(oh->flags); /* flags can be 0 */
+} /* H5O_get_oh_flags() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_oh_mtime
+ *
+ * Purpose: Retrieve an object's modification time. Assumes that the
+ * caller has verified that accessing this variable is appropriate
+ * to the header in question.
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 17
+ *
+ *-------------------------------------------------------------------------
+ */
+time_t
+H5O_get_oh_mtime(const H5O_t *oh)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ HDassert(oh);
+ HDassert(oh->mtime);
+ FUNC_LEAVE_NOAPI(oh->mtime);
+} /* H5O_get_oh_mtime() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_oh_version
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 17
+ *
+ *-------------------------------------------------------------------------
+ */
+uint8_t
+H5O_get_oh_version(const H5O_t *oh)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ HDassert(oh);
+ HDassert(oh->version);
+ FUNC_LEAVE_NOAPI(oh->version);
+} /* H5O_get_oh_version() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_get_rc_and_type
*
* Purpose: Retrieve an object's reference count and type
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index d6e3dce..18f3706 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -1598,16 +1598,23 @@ H5O_msg_is_shared(unsigned type_id, const void *mesg)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- HDassert(type_id < NELMTS(H5O_msg_class_g));
- type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
- HDassert(type);
- HDassert(mesg);
-
- /* If messages in a class aren't sharable, then obviously this message isn't shared! :-) */
- if(type->share_flags & H5O_SHARE_IS_SHARABLE)
- ret_value = H5O_IS_STORED_SHARED(((const H5O_shared_t *)mesg)->type);
- else
+#ifdef H5O_ENABLE_BOGUS
+ if(type_id >= NELMTS(H5O_msg_class_g))
ret_value = FALSE;
+ else
+#endif /* H5O_ENABLE_BOGUS */
+ {
+ HDassert(type_id < NELMTS(H5O_msg_class_g));
+ type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
+ HDassert(type);
+ HDassert(mesg);
+
+ /* If messages in a class aren't sharable, then obviously this message isn't shared! :-) */
+ if(type->share_flags & H5O_SHARE_IS_SHARABLE)
+ ret_value = H5O_IS_STORED_SHARED(((const H5O_shared_t *)mesg)->type);
+ else
+ ret_value = FALSE;
+ } /* end block/else */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_is_shared() */
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index 172f9ab..fbf7613 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -289,7 +289,7 @@ H5O_mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared,
/* encode */
tm = HDgmtime(mesg);
- sprintf((char*)p, "%04d%02d%02d%02d%02d%02d",
+ HDsprintf((char*)p, "%04d%02d%02d%02d%02d%02d",
1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
diff --git a/src/H5Oname.c b/src/H5Oname.c
index a710944..1f20f10 100644
--- a/src/H5Oname.c
+++ b/src/H5Oname.c
@@ -297,7 +297,7 @@ H5O__name_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream,
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth,
"Name:",
mesg->s);
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index dbc8089..668f4f0 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -29,7 +29,7 @@
#define H5O_NMESGS 8 /*initial number of messages */
#define H5O_NCHUNKS 2 /*initial number of chunks */
#define H5O_MIN_SIZE 22 /* Min. obj header data size (must be big enough for a message prefix and a continuation message) */
-#define H5O_MSG_TYPES 27 /* # of types of messages */
+#define H5O_MSG_TYPES 26 /* # of types of messages */
#define H5O_MAX_CRT_ORDER_IDX 65535 /* Max. creation order index value */
/* Versions of object header structure */
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index e8565b9..5987ecf 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -121,8 +121,14 @@ typedef struct H5O_mesg_t H5O_mesg_t;
/* If the module using this macro is allowed access to the private variables, access them directly */
#ifdef H5O_MODULE
#define H5O_OH_GET_ADDR(O) ((O)->chunk[0].addr)
+#define H5O_OH_GET_VERSION(O) ((O)->version)
+#define H5O_OH_GET_FLAGS(O) ((O)->flags)
+#define H5O_OH_GET_MTIME(O) ((O)->mtime)
#else /* H5O_MODULE */
#define H5O_OH_GET_ADDR(O) (H5O_get_oh_addr(O))
+#define H5O_OH_GET_VERSION(O) (H5O_get_oh_version(O))
+#define H5O_OH_GET_FLAGS(O) (H5O_get_oh_flags(O))
+#define H5O_OH_GET_MTIME(O) (H5O_get_oh_mtime(O))
#endif /* H5O_MODULE */
/* Set the fields in a shared message structure */
@@ -221,11 +227,11 @@ typedef struct H5O_copy_t {
* Note: Must increment H5O_MSG_TYPES in H5Opkg.h and update H5O_msg_class_g
* in H5O.c when creating a new message type. Also bump the value of
* H5O_BOGUS_INVALID_ID, below, to be one greater than the value of
- * H5O_UNKNOWN_ID.
+ * H5O_UNKNOWN_ID, and re-run gen_bogus.c.
*
* (this should never exist in a file)
*/
-#define H5O_BOGUS_INVALID_ID 0x001A /* "Bogus invalid" Message. */
+#define H5O_BOGUS_INVALID_ID 0x001a /* "Bogus invalid" Message. */
/* Shared object message types.
* Shared objects can be committed, in which case the shared message contains
@@ -645,6 +651,7 @@ typedef struct H5O_layout_t {
*/
#define H5O_BOGUS_VALUE 0xdeadbeef
typedef struct H5O_bogus_t {
+ H5O_shared_t sh_loc; /* Shared message info (must be first) */
unsigned u; /* Hold the bogus info */
} H5O_bogus_t;
#endif /* H5O_ENABLE_BOGUS */
@@ -851,13 +858,6 @@ typedef struct {
} u;
} H5O_mesg_operator_t;
-/* Types for object optional VOL operations */
-typedef enum H5VL_object_optional_t {
- H5VL_OBJECT_GET_COMMENT, /* get object comment */
- H5VL_OBJECT_GET_INFO, /* get object info */
- H5VL_OBJECT_SET_COMMENT /* set object comment */
-} H5VL_object_optional_t;
-
/* Typedef for abstract object creation */
typedef struct {
H5O_type_t obj_type; /* Type of object to create */
@@ -872,6 +872,9 @@ struct H5P_genplist_t;
H5_DLL herr_t H5O_init(void);
H5_DLL herr_t H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc,
hid_t ocpl_id, H5O_loc_t *loc/*out*/);
+H5_DLL H5O_t *H5O__create_ohdr(H5F_t *f, hid_t ocpl_id);
+H5_DLL herr_t H5O__apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id,
+ size_t size_hint, size_t initial_rc, H5O_loc_t *loc_out);
H5_DLL herr_t H5O_open(H5O_loc_t *loc);
H5_DLL void *H5O_open_by_idx(const H5G_loc_t *loc, const char *name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5I_type_t *opened_type/*out*/);
@@ -898,6 +901,9 @@ H5_DLL void *H5O_open_name(const H5G_loc_t *loc, const char *name, H5I_type_t *o
H5_DLL herr_t H5O_get_nlinks(const H5O_loc_t *loc, hsize_t *nlinks);
H5_DLL void *H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_loc_t *obj_loc);
H5_DLL haddr_t H5O_get_oh_addr(const H5O_t *oh);
+H5_DLL uint8_t H5O_get_oh_flags(const H5O_t *oh);
+H5_DLL time_t H5O_get_oh_mtime(const H5O_t *oh);
+H5_DLL uint8_t H5O_get_oh_version(const H5O_t *oh);
H5_DLL herr_t H5O_get_rc_and_type(const H5O_loc_t *oloc, unsigned *rc, H5O_type_t *otype);
H5_DLL H5AC_proxy_entry_t *H5O_get_proxy(const H5O_t *oh);
diff --git a/src/H5Opublic.h b/src/H5Opublic.h
index da2910d..c868e72 100644
--- a/src/H5Opublic.h
+++ b/src/H5Opublic.h
@@ -150,18 +150,19 @@ typedef enum H5O_mcdt_search_ret_t {
/* Callback to invoke when completing the search for a matching committed datatype from the committed dtype list */
typedef H5O_mcdt_search_ret_t (*H5O_mcdt_search_cb_t)(void *op_data);
+
/********************/
/* Public Variables */
/********************/
+/*********************/
+/* Public Prototypes */
+/*********************/
#ifdef __cplusplus
extern "C" {
#endif
-/*********************/
-/* Public Prototypes */
-/*********************/
H5_DLL hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id);
H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr);
H5_DLL hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name,
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 74fa72e..b7f70d1 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -189,7 +189,7 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
done:
if(!ret_value && sdim) {
- H5S_extent_release(sdim);
+ H5S__extent_release(sdim);
sdim = H5FL_FREE(H5S_extent_t, sdim);
} /* end if */
@@ -310,7 +310,7 @@ H5O_sdspace_copy(const void *_mesg, void *_dest)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy extent information */
- if(H5S_extent_copy_real(dest, mesg, TRUE) < 0)
+ if(H5S__extent_copy_real(dest, mesg, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent")
/* Set return value */
@@ -391,7 +391,7 @@ H5O__sdspace_reset(void *_mesg)
FUNC_ENTER_STATIC_NOERR
- H5S_extent_release(mesg);
+ H5S__extent_release(mesg);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__sdspace_reset() */
@@ -470,7 +470,7 @@ H5O_sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "dataspace extent allocation failed")
/* Create a copy of the dataspace extent */
- if(H5S_extent_copy_real(udata->src_space_extent, src_space_extent, TRUE) < 0)
+ if(H5S__extent_copy_real(udata->src_space_extent, src_space_extent, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent")
} /* end if */
diff --git a/src/H5PB.c b/src/H5PB.c
index a325ad1..88a6151 100644
--- a/src/H5PB.c
+++ b/src/H5PB.c
@@ -252,7 +252,7 @@ H5PB_print_stats(const H5PB_t *page_buf)
HDassert(page_buf);
- printf("PAGE BUFFER STATISTICS:\n");
+ HDprintf("PAGE BUFFER STATISTICS:\n");
HDprintf("******* METADATA\n");
HDprintf("\t Total Accesses: %u\n", page_buf->accesses[0]);
diff --git a/src/H5PLint.c b/src/H5PLint.c
index bbe71fe..8dec14b 100644
--- a/src/H5PLint.c
+++ b/src/H5PLint.c
@@ -262,7 +262,7 @@ H5PL_load(H5PL_type_t type, const H5PL_key_t *key)
/* Set up the search parameters */
search_params.type = type;
- search_params.key.id = key->id;
+ search_params.key = key;
/* Search in the table of already loaded plugin libraries */
if(H5PL__find_plugin_in_cache(&search_params, &found, &plugin_info) < 0)
@@ -311,6 +311,7 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key,
hbool_t *success, const void **plugin_info)
{
H5PL_HANDLE handle = NULL;
+ H5PL_get_plugin_type_t get_plugin_type = NULL;
H5PL_get_plugin_info_t get_plugin_info = NULL;
herr_t ret_value = SUCCEED;
@@ -333,12 +334,22 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key,
HGOTO_DONE(SUCCEED)
}
+ /* Return a handle for the function H5PLget_plugin_type in the dynamic library.
+ * The plugin library is supposed to define this function.
+ */
+ if (NULL == (get_plugin_type = (H5PL_get_plugin_type_t)H5PL_GET_LIB_FUNC(handle, "H5PLget_plugin_type")))
+ HGOTO_DONE(SUCCEED)
+
/* Return a handle for the function H5PLget_plugin_info in the dynamic library.
- * The plugin library is suppose to define this function.
+ * The plugin library is supposed to define this function.
*/
if (NULL == (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC(handle, "H5PLget_plugin_info")))
HGOTO_DONE(SUCCEED)
+ /* Check the plugin type and return if it doesn't match the one passed in */
+ if(type != (H5PL_type_t)(*get_plugin_type)())
+ HGOTO_DONE(SUCCEED)
+
/* Get the plugin information */
switch (type) {
case H5PL_TYPE_FILTER:
@@ -364,7 +375,7 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key,
/* Get the plugin info */
if(NULL == (cls = (const H5VL_class_t *)(*get_plugin_info)()))
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get VOL driver info from plugin")
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get VOL connector info from plugin")
/* Which kind of key are we looking for? */
if(key->vol.kind == H5VL_GET_CONNECTOR_BY_NAME) {
diff --git a/src/H5PLpath.c b/src/H5PLpath.c
index d53007b..04248b5 100644
--- a/src/H5PLpath.c
+++ b/src/H5PLpath.c
@@ -242,6 +242,7 @@ H5PL__create_path_table(void)
* environment variable or the default.
*/
char *next_path = NULL; /* A path tokenized from the paths string */
+ char *lasts = NULL; /* Context pointer for strtok_r() call */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -265,8 +266,7 @@ H5PL__create_path_table(void)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path copy")
/* Separate the paths and store them */
- /* XXX: strtok() is not thread-safe */
- next_path = HDstrtok(paths, H5PL_PATH_SEPARATOR);
+ next_path = HDstrtok_r(paths, H5PL_PATH_SEPARATOR, &lasts);
while (next_path) {
/* Insert the path into the table */
@@ -274,7 +274,7 @@ H5PL__create_path_table(void)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't insert path: %s", next_path)
/* Get the next path from the environment string */
- next_path = HDstrtok(NULL, H5PL_PATH_SEPARATOR);
+ next_path = HDstrtok_r(NULL, H5PL_PATH_SEPARATOR, &lasts);
} /* end while */
done:
@@ -689,7 +689,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo
continue;
/* attempt to open the dynamic library as a filter library */
- if (H5PL__open(path, search_params->type, &(search_params->key), found, plugin_info) < 0)
+ if (H5PL__open(path, search_params->type, search_params->key, found, plugin_info) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed")
if (*found)
HGOTO_DONE(SUCCEED)
@@ -755,7 +755,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo
continue;
/* attempt to open the dynamic library as a filter library */
- if (H5PL__open(path, search_params->type, &(search_params->key), found, plugin_info) < 0)
+ if (H5PL__open(path, search_params->type, search_params->key, found, plugin_info) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed")
if (*found)
HGOTO_DONE(SUCCEED)
diff --git a/src/H5PLpkg.h b/src/H5PLpkg.h
index d60da82..8c2367f 100644
--- a/src/H5PLpkg.h
+++ b/src/H5PLpkg.h
@@ -79,6 +79,7 @@
/* maximum size for expanding env vars */
# define H5PL_EXPAND_BUFFER_SIZE 32767
+ typedef H5PL_type_t(__cdecl *H5PL_get_plugin_type_t)(void);
typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void);
#else /* H5_HAVE_WIN32_API */
@@ -105,6 +106,7 @@
/* Clear error */
# define H5PL_CLR_ERROR HERROR(H5E_PLUGIN, H5E_CANTGET, "can't dlopen:%s", dlerror())
+ typedef H5PL_type_t(*H5PL_get_plugin_type_t)(void);
typedef const void *(*H5PL_get_plugin_info_t)(void);
#endif /* H5_HAVE_WIN32_API */
@@ -116,7 +118,7 @@
/* Data used to search for plugins */
typedef struct H5PL_search_params_t {
H5PL_type_t type;
- H5PL_key_t key;
+ const H5PL_key_t *key;
} H5PL_search_params_t;
diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c
index 7fe676d..cd0b4d6 100644
--- a/src/H5PLplugin_cache.c
+++ b/src/H5PLplugin_cache.c
@@ -276,7 +276,7 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f
for (u = 0; u < H5PL_num_plugins_g; u++) {
/* If the plugin type (filter, etc.) and ID match, query the plugin for its info */
- if ((search_params->type == (H5PL_cache_g[u]).type) && (search_params->key.id == (H5PL_cache_g[u]).key.id)) {
+ if ((search_params->type == (H5PL_cache_g[u]).type) && (search_params->key->id == (H5PL_cache_g[u]).key.id)) {
H5PL_get_plugin_info_t get_plugin_info_function;
const H5Z_class2_t *filter_info;
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index a5a16bb..b85f105 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -117,6 +117,11 @@
#define H5D_CRT_EXT_FILE_LIST_COPY H5P__dcrt_ext_file_list_copy
#define H5D_CRT_EXT_FILE_LIST_CMP H5P__dcrt_ext_file_list_cmp
#define H5D_CRT_EXT_FILE_LIST_CLOSE H5P__dcrt_ext_file_list_close
+/* Definitions for dataset object header minimization */
+#define H5D_CRT_MIN_DSET_HDR_SIZE_SIZE sizeof(hbool_t)
+#define H5D_CRT_MIN_DSET_HDR_SIZE_DEF FALSE
+#define H5D_CRT_MIN_DSET_HDR_SIZE_ENC H5P__encode_hbool_t
+#define H5D_CRT_MIN_DSET_HDR_SIZE_DEC H5P__decode_hbool_t
/******************/
@@ -209,6 +214,7 @@ static const H5O_layout_t H5D_def_layout_g = H5D_CRT_LAYOUT_DEF; /* Defau
static const H5O_fill_t H5D_def_fill_g = H5D_CRT_FILL_VALUE_DEF; /* Default fill value */
static const unsigned H5D_def_alloc_time_state_g = H5D_CRT_ALLOC_TIME_STATE_DEF; /* Default allocation time state */
static const H5O_efl_t H5D_def_efl_g = H5D_CRT_EXT_FILE_LIST_DEF; /* Default external file list */
+static const unsigned H5O_ohdr_min_g = H5D_CRT_MIN_DSET_HDR_SIZE_DEF; /* Default object header minimization */
/* Defaults for each type of layout */
#ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER
@@ -271,6 +277,12 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass)
H5D_CRT_EXT_FILE_LIST_DEL, H5D_CRT_EXT_FILE_LIST_COPY, H5D_CRT_EXT_FILE_LIST_CMP, H5D_CRT_EXT_FILE_LIST_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ /* Register the object header minimization property */
+ if(H5P__register_real(pclass, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, H5D_CRT_MIN_DSET_HDR_SIZE_SIZE, &H5O_ohdr_min_g,
+ NULL, NULL, NULL, H5D_CRT_MIN_DSET_HDR_SIZE_ENC, H5D_CRT_MIN_DSET_HDR_SIZE_DEC,
+ NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
/* Register the type ID property*/
if(H5P__register_real(pclass, H5VL_PROP_DSET_TYPE_ID, sizeof(hid_t), &type_id,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, NULL) < 0)
@@ -3749,3 +3761,95 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_fill_time() */
+
+/*-----------------------------------------------------------------------------
+ * Function: H5Pget_dset_no_attrs_hint
+ *
+ * Purpose:
+ *
+ * Access the flag for whether or not datasets created by the given dcpl
+ * will be created with a "minimized" object header.
+ *
+ * Return:
+ *
+ * Failure: Negative value (FAIL)
+ * Success: Non-negative value (SUCCEED)
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 14
+ *
+ * Modifications: None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize)
+{
+ hbool_t setting = FALSE;
+ H5P_genplist_t *plist = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*b", dcpl_id, minimize);
+
+ if(NULL == minimize)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "receiving pointer cannot be NULL")
+
+ plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE);
+ if(NULL == plist)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ if(H5P_peek(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &setting) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get dset oh minimize flag value")
+
+ *minimize = setting;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Pget_dset_no_attrs_hint() */
+
+
+/*-----------------------------------------------------------------------------
+ * Function: H5Pset_dset_no_attrs_hint
+ *
+ * Purpose:
+ *
+ * Set the dcpl to minimize (or explicitly to not minimized) dataset object
+ * headers upon creation.
+ *
+ * Return:
+ *
+ * Failure: Negative value (FAIL)
+ * Success: Non-negative value (SUCCEED)
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 14
+ *
+ * Modifications: None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_dset_no_attrs_hint(hid_t dcpl_id, hbool_t minimize)
+{
+ H5P_genplist_t *plist = NULL;
+ hbool_t prev_set = FALSE;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "ib", dcpl_id, minimize);
+
+ plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE);
+ if(NULL == plist)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ if(H5P_peek(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &prev_set) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get extant dset oh minimize flag value")
+
+ if(H5P_poke(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &minimize) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get dset oh minimize flag value")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Pset_dset_no_attrs_hint() */
+
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index bfc1d93..8338d84 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -2017,6 +2017,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_mpio_actual_io_mode() */
+
/*-------------------------------------------------------------------------
* Function: H5Pget_mpio_no_collective_cause
*
@@ -2053,8 +2054,6 @@ H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_ca
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_mpio_no_collective_cause() */
-
-
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 923c792..bfb52ff 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -49,7 +49,7 @@
#endif
/* Includes needed to set default VOL connector */
-#include "H5VLnative.h" /* Native VOL connector */
+#include "H5VLnative_private.h" /* Native VOL connector */
/****************/
@@ -177,16 +177,6 @@
#define H5F_ACS_FILE_IMAGE_INFO_COPY H5P__facc_file_image_info_copy
#define H5F_ACS_FILE_IMAGE_INFO_CMP H5P__facc_file_image_info_cmp
#define H5F_ACS_FILE_IMAGE_INFO_CLOSE H5P__facc_file_image_info_close
-/* Definition of core VFD write tracking flag */
-#define H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE sizeof(hbool_t)
-#define H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF FALSE
-#define H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC H5P__encode_hbool_t
-#define H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC H5P__decode_hbool_t
-/* Definition of core VFD write tracking page size */
-#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE sizeof(size_t)
-#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF 524288
-#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC H5P__encode_size_t
-#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC H5P__decode_size_t
/* Definition for # of metadata read attempts */
#define H5F_ACS_METADATA_READ_ATTEMPTS_SIZE sizeof(unsigned)
#define H5F_ACS_METADATA_READ_ATTEMPTS_DEF 0
@@ -401,8 +391,6 @@ static const H5F_libver_t H5F_def_libver_high_bound_g = H5F_ACS_LIBVER_HIGH_BOUN
static const hbool_t H5F_def_want_posix_fd_g = H5F_ACS_WANT_POSIX_FD_DEF; /* Default setting for retrieving 'handle' from core VFD */
static const unsigned H5F_def_efc_size_g = H5F_ACS_EFC_SIZE_DEF; /* Default external file cache size */
static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */
-static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF; /* Default setting for core VFD write tracking */
-static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */
static const unsigned H5F_def_metadata_read_attempts_g = H5F_ACS_METADATA_READ_ATTEMPTS_DEF; /* Default setting for the # of metadata read attempts */
static const H5F_object_flush_t H5F_def_object_flush_cb_g = H5F_ACS_OBJECT_FLUSH_CB_DEF; /* Default setting for object flush callback */
static const hbool_t H5F_def_clear_status_flags_g = H5F_ACS_CLEAR_STATUS_FLAGS_DEF; /* Default to clear the superblock status_flags */
@@ -572,18 +560,6 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass)
H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, H5F_ACS_FILE_IMAGE_INFO_CMP, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the core VFD backing store write tracking flag */
- if(H5P__register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g,
- NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC, H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC,
- NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- /* Register the size of the core VFD backing store page size */
- if(H5P__register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g,
- NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC,
- NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
/* Register the # of read attempts */
if(H5P__register_real(pclass, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, H5F_ACS_METADATA_READ_ATTEMPTS_SIZE, &H5F_def_metadata_read_attempts_g,
NULL, NULL, NULL, H5F_ACS_METADATA_READ_ATTEMPTS_ENC, H5F_ACS_METADATA_READ_ATTEMPTS_DEC,
@@ -3957,89 +3933,6 @@ H5P__facc_libver_type_dec(const void **_pp, void *_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_libver_type_dec() */
-
-/*-------------------------------------------------------------------------
- * 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 */
- 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_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Set values */
- if(H5P_set(plist, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, &is_enabled) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set core VFD write tracking flag")
- if(H5P_set(plist, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, &page_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set core VFD write tracking page size")
-
-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 */
- 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_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Get values */
- if(is_enabled) {
- if(H5P_get(plist, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, is_enabled) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core VFD write tracking flag")
- } /* end if */
-
- if(page_size) {
- if(H5P_get(plist, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, page_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core VFD write tracking page size")
- } /* end if */
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Pget_core_write_tracking() */
-
/*-------------------------------------------------------------------------
* Function: H5Pset_metadata_read_attempts
@@ -5338,7 +5231,7 @@ H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED
/* Use one of the classes (cls1) info comparison routines to compare the
* info objects
*/
- HDassert(cls1->info_cmp == cls2->info_cmp);
+ HDassert(cls1->info_cls.cmp == cls2->info_cls.cmp);
status = H5VL_cmp_connector_info(cls1, &cmp_value, info1->connector_info, info2->connector_info);
HDassert(status >= 0);
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 86c6687..078fe74 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -167,7 +167,8 @@ typedef enum H5D_mpio_no_collective_cause_t {
H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES = 0x10,
H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET = 0x20,
H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED = 0x40,
- H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x80
+ H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE = 0x80,
+ H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x100
} H5D_mpio_no_collective_cause_t;
/********************/
@@ -412,6 +413,8 @@ H5_DLL herr_t H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t
H5_DLL herr_t H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time);
H5_DLL herr_t H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t
*fill_time/*out*/);
+H5_DLL herr_t H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize);
+H5_DLL herr_t H5Pset_dset_no_attrs_hint(hid_t dcpl_id, hbool_t minimize);
/* Dataset access property list (DAPL) routines */
H5_DLL herr_t H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots,
diff --git a/src/H5R.c b/src/H5R.c
index b7866b1..7d3686e 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -127,7 +127,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info")
/* Create reference */
- if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_REF_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, ref, name, ref_type, space_id)) < 0)
+ if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_REF_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, ref, name, (int)ref_type, space_id)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference")
done:
@@ -257,7 +257,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
/* Get the dataspace with the correct region selected */
- if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_REGION, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0)
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_REGION, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, (int)ref_type, ref) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve dataspace")
done:
@@ -314,7 +314,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Get the object type */
- if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, ref_type, ref) < 0)
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, (int)ref_type, ref) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type")
done:
@@ -381,7 +381,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
/* Get name */
- if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size, ref_type, _ref) < 0)
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size, (int)ref_type, _ref) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine object path")
done:
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
index 827506e..ab8d3b4 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -126,7 +126,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid file identifier")
/* Get the object information */
- if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type, ref_type, ref) < 0)
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type, (int)ref_type, ref) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "unable to determine object type")
/* Set return value */
diff --git a/src/H5Rint.c b/src/H5Rint.c
index 365facd..a4f76ce 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -62,18 +62,6 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Local Variables */
/*******************/
-/* Reference ID class
- *
- * NOTE: H5I_REFERENCE is not used by the library and has been deprecated
- * with a tentative removal version of 1.12.0. (DER, July 2017)
- */
-static const H5I_class_t H5I_REFERENCE_CLS[1] = {{
- H5I_REFERENCE, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
- NULL /* Callback routine for closing objects of this class */
-}};
-
/* Flag indicating "top" of interface has been initialized */
static hbool_t H5R_top_package_initialize_s = FALSE;
@@ -97,11 +85,7 @@ H5R__init_package(void)
FUNC_ENTER_NOAPI_NOINIT
- /* Initialize the atom group for the file IDs */
- if (H5I_register_type(H5I_REFERENCE_CLS) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to initialize interface")
-
- /* Mark "top" of interface as initialized, too */
+ /* Mark "top" of interface as initialized */
H5R_top_package_initialize_s = TRUE;
done:
@@ -134,16 +118,10 @@ H5R_top_term_package(void)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if (H5R_top_package_initialize_s) {
- if (H5I_nmembers(H5I_REFERENCE) > 0) {
- (void)H5I_clear_type(H5I_REFERENCE, FALSE, FALSE);
- n++;
- }
-
- /* Mark closed */
- if (0 == n)
+ /* Mark closed if initialized */
+ if(H5R_top_package_initialize_s)
+ if(0 == n)
H5R_top_package_initialize_s = FALSE;
- }
FUNC_LEAVE_NOAPI(n)
} /* end H5R_top_term_package() */
@@ -176,16 +154,12 @@ H5R_term_package(void)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if (H5_PKG_INIT_VAR) {
+ if(H5_PKG_INIT_VAR) {
/* Sanity checks */
- HDassert(0 == H5I_nmembers(H5I_REFERENCE));
HDassert(FALSE == H5R_top_package_initialize_s);
- /* Destroy the reference id group */
- n += (H5I_dec_type_ref(H5I_REFERENCE) > 0);
-
/* Mark closed */
- if (0 == n)
+ if(0 == n)
H5_PKG_INIT_VAR = FALSE;
}
diff --git a/src/H5S.c b/src/H5S.c
index 4c11268..3a917bc 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -46,7 +46,12 @@
/********************/
/* Local Prototypes */
/********************/
-static htri_t H5S_is_simple(const H5S_t *sdim);
+static htri_t H5S__is_simple(const H5S_t *sdim);
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
/*********************/
@@ -63,15 +68,6 @@ const unsigned H5O_sdspace_ver_bounds[] = {
H5O_SDSPACE_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
-/*****************************/
-/* Library Private Variables */
-/*****************************/
-
-
-/*******************/
-/* Local Variables */
-/*******************/
-
/* Declare a free list to manage the H5S_extent_t struct */
H5FL_DEFINE(H5S_extent_t);
@@ -81,6 +77,11 @@ H5FL_DEFINE(H5S_t);
/* Declare a free list to manage the array's of hsize_t's */
H5FL_ARR_DEFINE(hsize_t, H5S_MAX_RANK);
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Dataspace ID class */
static const H5I_class_t H5I_DATASPACE_CLS[1] = {{
H5I_DATASPACE, /* ID class value */
@@ -112,9 +113,9 @@ H5S__init_package(void)
FUNC_ENTER_PACKAGE
- /* Initialize the atom group for the file IDs */
+ /* Initialize the atom group for the dataspace IDs */
if(H5I_register_type(H5I_DATASPACE_CLS) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize interface")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace ID class")
/* Mark "top" of interface as initialized, too */
H5S_top_package_initialize_s = TRUE;
@@ -237,26 +238,25 @@ H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space)
HDassert(space);
- if (space_id < 0)
+ /* Check for invalid ID */
+ if(space_id < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid space_id (ID cannot be a negative number)")
- if (H5S_ALL == space_id) {
- /* No special dataspace struct for H5S_ALL */
+ /* No special dataspace struct for H5S_ALL */
+ if(H5S_ALL == space_id)
*space = NULL;
- }
else {
/* Get the dataspace pointer */
- if (NULL == (*space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if(NULL == (*space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "space_id is not a dataspace ID")
/* Check for valid selection */
- if (H5S_SELECT_VALID(*space) != TRUE)
+ if(H5S_SELECT_VALID(*space) != TRUE)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection + offset not within extent")
- }
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-
} /* end H5S_get_validated_dataspace() */
@@ -330,10 +330,9 @@ H5S_create(H5S_class_t type)
ret_value = new_ds;
done:
- if(ret_value == NULL) {
+ if(ret_value == NULL)
if(new_ds && H5S_close(new_ds) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, NULL, "unable to release dataspace")
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_create() */
@@ -360,7 +359,7 @@ done:
hid_t
H5Screate(H5S_class_t type)
{
- H5S_t *new_ds=NULL; /* New dataspace structure */
+ H5S_t *new_ds = NULL; /* New dataspace structure */
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -374,21 +373,20 @@ H5Screate(H5S_class_t type)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace")
/* Atomize */
- if((ret_value = H5I_register (H5I_DATASPACE, new_ds, TRUE)) < 0)
+ if((ret_value = H5I_register(H5I_DATASPACE, new_ds, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
done:
- if(ret_value < 0) {
+ if(ret_value < 0)
if(new_ds && H5S_close(new_ds) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
- } /* end if */
FUNC_LEAVE_API(ret_value)
} /* end H5Screate() */
/*-------------------------------------------------------------------------
- * Function: H5S_extent_release
+ * Function: H5S__extent_release
*
* Purpose: Releases all memory associated with a dataspace extent.
*
@@ -397,16 +395,12 @@ done:
* Programmer: Quincey Koziol
* Thursday, July 23, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5S_extent_release(H5S_extent_t *extent)
+H5S__extent_release(H5S_extent_t *extent)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE_NOERR
HDassert(extent);
@@ -418,9 +412,8 @@ H5S_extent_release(H5S_extent_t *extent)
extent->max = H5FL_ARR_FREE(hsize_t, extent->max);
} /* end if */
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_extent_release() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__extent_release() */
/*-------------------------------------------------------------------------
@@ -446,11 +439,11 @@ H5S_close(H5S_t *ds)
/* Release selection (this should come before the extent release) */
if(H5S_SELECT_RELEASE(ds) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace selection")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace selection")
/* Release extent */
- if(H5S_extent_release(&ds->extent) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent")
+ if(H5S__extent_release(&ds->extent) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent")
/* Release the main structure */
ds = H5FL_FREE(H5S_t, ds);
@@ -467,13 +460,9 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Errors:
- *
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -485,7 +474,7 @@ H5Sclose(hid_t space_id)
H5TRACE1("e", "i", space_id);
/* Check args */
- if (NULL == H5I_object_verify(space_id,H5I_DATASPACE))
+ if(NULL == H5I_object_verify(space_id, H5I_DATASPACE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
/* When the reference count reaches zero the resources are freed */
@@ -503,14 +492,11 @@ done:
* Purpose: Copies a dataspace.
*
* Return: Success: ID of the new dataspace
- *
* Failure: Negative
*
* Programmer: Robb Matzke
* Friday, January 30, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -536,10 +522,9 @@ H5Scopy(hid_t space_id)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
done:
- if(ret_value < 0) {
+ if(ret_value < 0)
if(dst && H5S_close(dst) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
- } /* end if */
FUNC_LEAVE_API(ret_value)
} /* end H5Scopy() */
@@ -555,8 +540,6 @@ done:
* Programmer: Quincey Koziol
* Thursday, July 23, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -594,8 +577,6 @@ done:
* Programmer: Neil Fortner
* Monday, February 23, 2015
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -609,7 +590,7 @@ H5S_extent_copy(H5S_t *dst, const H5S_t *src)
HDassert(src);
/* Copy extent */
- if(H5S_extent_copy_real(&(dst->extent), &(src->extent), TRUE) < 0)
+ if(H5S__extent_copy_real(&(dst->extent), &(src->extent), TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent")
/* If the selection is 'all', update the number of elements selected in the
@@ -624,7 +605,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_extent_copy_real
+ * Function: H5S__extent_copy_real
*
* Purpose: Copies a dataspace extent
*
@@ -633,20 +614,18 @@ done:
* Programmer: Quincey Koziol
* Wednesday, June 3, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max)
+H5S__extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max)
{
unsigned u;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Release destination extent before we copy over it */
- if(H5S_extent_release(dst) < 0)
+ if(H5S__extent_release(dst) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent")
/* Copy the regular fields */
@@ -691,7 +670,7 @@ H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_ma
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_extent_copy_real() */
+} /* end H5S__extent_copy_real() */
/*-------------------------------------------------------------------------
@@ -705,14 +684,11 @@ done:
* selection)
*
* Return: Success: A pointer to a new copy of SRC
- *
* Failure: NULL
*
* Programmer: Robb Matzke
* Thursday, December 4, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5S_t *
@@ -727,7 +703,7 @@ H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the source dataspace's extent */
- if(H5S_extent_copy_real(&(dst->extent), &(src->extent), copy_max) < 0)
+ if(H5S__extent_copy_real(&(dst->extent), &(src->extent), copy_max) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent")
/* Copy the source dataspace's selection */
@@ -752,7 +728,6 @@ done:
* Purpose: Determines how many data points a dataset extent has.
*
* Return: Success: Number of data points in the dataset extent.
- *
* Failure: negative
*
* Programmer: Robb Matzke
@@ -762,9 +737,6 @@ done:
* pattern, don't call it directly, use the appropriate macro
* defined in H5Sprivate.h.
*
- * Modifications:
- * Changed Name - QAK 7/7/98
- *
*-------------------------------------------------------------------------
*/
hssize_t
@@ -791,15 +763,11 @@ done:
* Purpose: Determines how many data points a dataset extent has.
*
* Return: Success: Number of data points in the dataset.
- *
* Failure: negative
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
*
- * Modifications:
- * Changed Name - QAK 7/7/98
- *
*-------------------------------------------------------------------------
*/
hssize_t
@@ -833,14 +801,11 @@ done:
*
* Return: Success: Maximum number of data points the dataspace
* may have.
- *
* Failure: 0
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hsize_t
@@ -854,7 +819,7 @@ H5S_get_npoints_max(const H5S_t *ds)
/* check args */
HDassert(ds);
- switch (H5S_GET_EXTENT_TYPE(ds)) {
+ switch(H5S_GET_EXTENT_TYPE(ds)) {
case H5S_NULL:
ret_value = 0;
break;
@@ -864,31 +829,30 @@ H5S_get_npoints_max(const H5S_t *ds)
break;
case H5S_SIMPLE:
- if (ds->extent.max) {
- for (ret_value=1, u=0; u<ds->extent.rank; u++) {
- if (H5S_UNLIMITED==ds->extent.max[u]) {
+ if(ds->extent.max) {
+ for(ret_value = 1, u = 0; u < ds->extent.rank; u++) {
+ if(H5S_UNLIMITED == ds->extent.max[u]) {
ret_value = HSIZET_MAX;
break;
- }
+ } /* end if */
else
ret_value *= ds->extent.max[u];
- }
- }
- else {
- for (ret_value=1, u=0; u<ds->extent.rank; u++)
+ } /* end for */
+ } /* end if */
+ else
+ for(ret_value = 1, u = 0; u < ds->extent.rank; u++)
ret_value *= ds->extent.size[u];
- }
break;
case H5S_NO_CLASS:
default:
HDassert("unknown dataspace class" && 0);
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, 0, "internal error (unknown dataspace class)")
- }
+ } /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5S_get_npoints_max() */
/*-------------------------------------------------------------------------
@@ -897,21 +861,18 @@ done:
* Purpose: Determines the dimensionality of a dataspace.
*
* Return: Success: The number of dimensions in a dataspace.
- *
* Failure: Negative
*
* Programmer: Robb Matzke
* Thursday, December 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
H5Sget_simple_extent_ndims(hid_t space_id)
{
- H5S_t *ds;
- int ret_value;
+ H5S_t *ds;
+ int ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("Is", "i", space_id);
@@ -934,7 +895,6 @@ done:
*
* Return: Success: Non-negative number of dimensions. Zero
* implies a scalar.
- *
* Failure: Negative
*
* Programmer: Robb Matzke
@@ -944,8 +904,6 @@ done:
* pattern, don't call it directly, use the appropriate macro
* defined in H5Sprivate.h.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -980,43 +938,36 @@ done:
* Function: H5Sget_simple_extent_dims
*
* Purpose: Returns the size and maximum sizes in each dimension of
- * a dataspace DS through the DIMS and MAXDIMS arguments.
+ * a dataspace DS through the DIMS and MAXDIMS arguments.
*
* Return: Success: Number of dimensions, the same value as
* returned by H5Sget_simple_extent_ndims().
- *
* Failure: Negative
*
* Programmer: Robb Matzke
* Thursday, December 11, 1997
*
- * Modifications:
- * June 18, 1998 Albert Cheng
- * Added maxdims argument. Removed dims argument check
- * since it can still return ndims even if both dims and
- * maxdims are NULLs.
- *
*-------------------------------------------------------------------------
*/
int
H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[]/*out*/,
- hsize_t maxdims[]/*out*/)
+ hsize_t maxdims[]/*out*/)
{
- H5S_t *ds;
- int ret_value;
+ H5S_t *ds;
+ int ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("Is", "ixx", space_id, dims, maxdims);
/* Check args */
- if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if(NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
ret_value = H5S_get_simple_extent_dims(ds, dims, maxdims);
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Sget_simple_extent_dims() */
/*-------------------------------------------------------------------------
@@ -1082,14 +1033,11 @@ done:
* function may not be meaningful for all types of dataspaces.
*
* Return: Success: Number of dimensions. Zero implies scalar.
- *
* Failure: Negative
*
* Programmer: Robb Matzke
* Thursday, December 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -1156,13 +1104,6 @@ done:
* Programmer: Quincey Koziol
* Tuesday, December 31, 2002
*
- * Modifications:
- *
- * John Mainzer, 6/6/05
- * Updated function to use the new dirtied parameter of
- * H5AC_unprotect() instead of manipulating the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1192,7 +1133,6 @@ done:
* Purpose: Reads the dataspace from an object header.
*
* Return: Success: Pointer to a new dataspace.
- *
* Failure: NULL
*
* Programmer: Robb Matzke
@@ -1225,10 +1165,9 @@ H5S_read(const H5O_loc_t *loc)
ret_value = ds;
done:
- if(ret_value == NULL) {
+ if(ret_value == NULL)
if(ds != NULL)
ds = H5FL_FREE(H5S_t, ds);
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_read() */
@@ -1236,11 +1175,11 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5S_is_simple
+ H5S__is_simple
PURPOSE
Check if a dataspace is simple (internal)
USAGE
- htri_t H5S_is_simple(sdim)
+ htri_t H5S__is_simple(sdim)
H5S_t *sdim; IN: Pointer to dataspace object to query
RETURNS
TRUE/FALSE/FAIL
@@ -1249,21 +1188,21 @@ done:
has orthogonal, evenly spaced dimensions.
--------------------------------------------------------------------------*/
static htri_t
-H5S_is_simple(const H5S_t *sdim)
+H5S__is_simple(const H5S_t *sdim)
{
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args and all the boring stuff. */
HDassert(sdim);
/* H5S_NULL shouldn't be simple dataspace */
ret_value = (H5S_GET_EXTENT_TYPE(sdim) == H5S_SIMPLE ||
- H5S_GET_EXTENT_TYPE(sdim) == H5S_SCALAR) ? TRUE : FALSE;
+ H5S_GET_EXTENT_TYPE(sdim) == H5S_SCALAR) ? TRUE : FALSE;
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_is_simple() */
+} /* end H5S__is_simple() */
/*--------------------------------------------------------------------------
@@ -1283,21 +1222,21 @@ H5S_is_simple(const H5S_t *sdim)
htri_t
H5Sis_simple(hid_t space_id)
{
- H5S_t *space; /* dataspace to modify */
- htri_t ret_value;
+ H5S_t *space; /* Dataspace to check */
+ htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("t", "i", space_id);
/* Check args and all the boring stuff. */
- if ((space = (H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE)) == NULL)
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
- ret_value = H5S_is_simple(space);
+ ret_value = H5S__is_simple(space);
- done:
+done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Sis_simple() */
/*--------------------------------------------------------------------------
@@ -1325,56 +1264,44 @@ H5Sis_simple(hid_t space_id)
Currently, only the first dimension in the array (the slowest) may be
unlimited in size.
- MODIFICATION
- A null dataspace cannot be created from simple space with this function.
-
- Christian Chilan 01/17/2007
- Verifies that each element of DIMS is not equal to H5S_UNLIMITED.
-
- Raymond Lu 03/30/2011
- We allow 0 dimension size for non-unlimited dimension starting from 1.8.7
- release.
--------------------------------------------------------------------------*/
herr_t
H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/],
- const hsize_t max[/*rank*/])
+ const hsize_t max[/*rank*/])
{
- H5S_t *space; /* dataspace to modify */
- int u; /* local counting variable */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5S_t *space; /* Dataspace to modify */
+ int u; /* Local counting variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iIs*[a1]h*[a1]h", space_id, rank, dims, max);
/* Check args */
- if ((space = (H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE)) == NULL)
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
- if (rank > 0 && dims == NULL)
+ if(rank > 0 && dims == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified")
- if (rank<0 || rank>H5S_MAX_RANK)
+ if(rank < 0 || rank > H5S_MAX_RANK)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank")
- if (dims) {
- for (u=0; u<rank; u++) {
- if (H5S_UNLIMITED==dims[u])
+ if(dims)
+ for(u = 0; u < rank; u++)
+ if(H5S_UNLIMITED == dims[u])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "current dimension must have a specific size, not H5S_UNLIMITED")
- }
- }
- if (max!=NULL) {
- if(dims==NULL)
+ if(max != NULL) {
+ if(dims == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maximum dimension specified, but no current dimensions specified")
- for (u=0; u<rank; u++) {
- if (max[u]!=H5S_UNLIMITED && max[u]<dims[u])
+ for(u = 0; u < rank; u++)
+ if(max[u] != H5S_UNLIMITED && max[u] < dims[u])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid maximum dimension size")
- }
- }
+ } /* end if */
/* Do it */
- if (H5S_set_extent_simple(space, (unsigned)rank, dims, max)<0)
+ if(H5S_set_extent_simple(space, (unsigned)rank, dims, max) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set simple extent")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Sset_extent_simple() */
/*-------------------------------------------------------------------------
@@ -1385,19 +1312,17 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke (copied from H5Sset_extent_simple)
+ * Programmer: Robb Matzke
* Wednesday, July 8, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
- const hsize_t *max)
+ const hsize_t *max)
{
unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1406,7 +1331,7 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
HDassert(0 == rank || dims);
/* shift out of the previous state to a "simple" dataspace. */
- if(H5S_extent_release(&space->extent) < 0)
+ if(H5S__extent_release(&space->extent) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "failed to release previous dataspace extent")
if(rank == 0) { /* scalar variable */
@@ -1433,12 +1358,11 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
/* Copy the maximum dimensions if specified. Otherwise, the maximal dimensions are the
* same as the dimension */
space->extent.max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)rank);
- if(max != NULL) {
+ if(max != NULL)
HDmemcpy(space->extent.max, max, sizeof(hsize_t) * rank);
- } else {
+ else
for(u = 0; u < space->extent.rank; u++)
space->extent.max[u] = dims[u];
- }
} /* end else */
/* Selection related cleanup */
@@ -1454,7 +1378,7 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_set_extent_simple() */
+} /* end H5S_set_extent_simple() */
/*-------------------------------------------------------------------------
@@ -1470,26 +1394,20 @@ done:
* than the corresponding element of DIMS.
*
* Return: Success: The ID for the new simple dataspace object.
- *
* Failure: Negative
*
* Programmer: Quincey Koziol
* Tuesday, January 27, 1998
*
- * Modification:
- * Raymond Lu 03/30/2011
- * We allow 0-dimension for non-unlimited dimension starting
- * from 1.8.7 release.
- *
*-------------------------------------------------------------------------
*/
hid_t
H5Screate_simple(int rank, const hsize_t dims[/*rank*/],
- const hsize_t maxdims[/*rank*/])
+ const hsize_t maxdims[/*rank*/])
{
H5S_t *space = NULL;
int i;
- hid_t ret_value;
+ hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("i", "Is*[a0]h*[a0]h", rank, dims, maxdims);
@@ -1515,7 +1433,7 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/],
} /* end for */
/* Create the space and set the extent */
- if(NULL == (space = H5S_create_simple((unsigned)rank,dims,maxdims)))
+ if(NULL == (space = H5S_create_simple((unsigned)rank, dims, maxdims)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
/* Atomize */
@@ -1523,10 +1441,9 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/],
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
done:
- if(ret_value < 0) {
+ if(ret_value < 0)
if(space && H5S_close(space) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
- } /* end if */
FUNC_LEAVE_API(ret_value)
} /* end H5Screate_simple() */
@@ -1540,32 +1457,26 @@ done:
* Return: Success: The ID for the new simple dataspace object.
* Failure: Negative
*
- * Errors:
- *
* Programmer: Quincey Koziol
* Thursday, April 3, 2003
*
- * Modifications:
- * Extracted from H5Screate_simple
- * Quincey Koziol, Thursday, April 3, 2003
- *
*-------------------------------------------------------------------------
*/
H5S_t *
H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/],
- const hsize_t maxdims[/*rank*/])
+ const hsize_t maxdims[/*rank*/])
{
H5S_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
/* Check arguments */
- HDassert(rank <=H5S_MAX_RANK);
+ HDassert(rank <= H5S_MAX_RANK);
/* Create the space and set the extent */
- if(NULL==(ret_value=H5S_create(H5S_SIMPLE)))
+ if(NULL == (ret_value = H5S_create(H5S_SIMPLE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "can't create simple dataspace")
- if(H5S_set_extent_simple(ret_value,rank,dims,maxdims)<0)
+ if(H5S_set_extent_simple(ret_value, rank, dims, maxdims) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "can't set dimensions")
done:
@@ -1580,15 +1491,12 @@ done:
* (including selection) into binary in a buffer.
*
* Return: Success: non-negative
- *
* Failure: negative
*
* Programmer: Raymond Lu
* slu@ncsa.uiuc.edu
* July 14, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1601,15 +1509,15 @@ H5Sencode(hid_t obj_id, void *buf, size_t *nalloc)
H5TRACE3("e", "i*x*z", obj_id, buf, nalloc);
/* Check argument and retrieve object */
- if (NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE)))
+ if(NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if(H5S_encode(dspace, (unsigned char **)&buf, nalloc)<0)
+ if(H5S_encode(dspace, (unsigned char **)&buf, nalloc) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Sencode() */
/*-------------------------------------------------------------------------
@@ -1698,7 +1606,6 @@ done:
* return a new object handle.
*
* Return: Success: dataspace ID(non-negative)
- *
* Failure: negative
*
* Programmer: Raymond Lu
@@ -1738,7 +1645,6 @@ done:
* description of dataspace and returns a new object handle.
*
* Return: Success: dataspace ID(non-negative)
- *
* Failure: negative
*
* Programmer: Raymond Lu
@@ -1785,11 +1691,11 @@ H5S_decode(const unsigned char **p)
pp += extent_size;
/* Copy the extent into dataspace structure */
- if((ds = H5FL_CALLOC(H5S_t))==NULL)
+ if(NULL == (ds = H5FL_CALLOC(H5S_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for dataspace conversion path table")
- if(H5O_msg_copy(H5O_SDSPACE_ID, extent, &(ds->extent)) == NULL)
+ if(NULL == H5O_msg_copy(H5O_SDSPACE_ID, extent, &(ds->extent)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object")
- if(H5S_extent_release(extent) < 0)
+ if(H5S__extent_release(extent) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace")
extent = H5FL_FREE(H5S_extent_t, extent);
@@ -1820,11 +1726,8 @@ done:
* Purpose: Internal function for retrieving the type of extent for a dataspace object
*
* Return: Success: The class of the dataspace object
- *
* Failure: N5S_NO_CLASS
*
- * Errors:
- *
* Programmer: Quincey Koziol
* Thursday, September 28, 2000
*
@@ -1832,8 +1735,6 @@ done:
* pattern, don't call it directly, use the appropriate macro
* defined in H5Sprivate.h.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5S_class_t
@@ -1845,11 +1746,11 @@ H5S_get_simple_extent_type(const H5S_t *space)
HDassert(space);
- ret_value=H5S_GET_EXTENT_TYPE(space);
+ ret_value = H5S_GET_EXTENT_TYPE(space);
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5S_get_simple_extent_type() */
/*-------------------------------------------------------------------------
@@ -1858,36 +1759,31 @@ done:
* Purpose: Retrieves the type of extent for a dataspace object
*
* Return: Success: The class of the dataspace object
- *
* Failure: N5S_NO_CLASS
*
- * Errors:
- *
* Programmer: Quincey Koziol
* Thursday, July 23, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5S_class_t
H5Sget_simple_extent_type(hid_t sid)
{
H5S_t *space;
- H5S_class_t ret_value;
+ H5S_class_t ret_value; /* Return value */
FUNC_ENTER_API(H5S_NO_CLASS)
H5TRACE1("Sc", "i", sid);
/* Check arguments */
- if (NULL == (space = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE)))
+ if(NULL == (space = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5S_NO_CLASS, "not a dataspace")
- ret_value=H5S_GET_EXTENT_TYPE(space);
+ ret_value = H5S_GET_EXTENT_TYPE(space);
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Sget_simple_extent_type() */
/*--------------------------------------------------------------------------
@@ -1907,68 +1803,25 @@ done:
herr_t
H5Sset_extent_none(hid_t space_id)
{
- H5S_t *space; /* dataspace to modify */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5S_t *space; /* Dataspace to modify */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", space_id);
/* Check args */
- if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
/* Clear the previous extent from the dataspace */
- if(H5S_extent_release(&space->extent)<0)
+ if(H5S__extent_release(&space->extent) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, FAIL, "can't release previous dataspace")
- space->extent.type=H5S_NO_CLASS;
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Sset_extent_none() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5Soffset_simple
- PURPOSE
- Changes the offset of a selection within a simple dataspace extent
- USAGE
- herr_t H5Soffset_simple(space_id, offset)
- hid_t space_id; IN: Dataspace object to reset
- const hssize_t *offset; IN: Offset to position the selection at
- RETURNS
- Non-negative on success/Negative on failure
- DESCRIPTION
- This function creates an offset for the selection within an extent, allowing
- the same shaped selection to be moved to different locations within a
- dataspace without requiring it to be re-defined.
---------------------------------------------------------------------------*/
-herr_t
-H5Soffset_simple(hid_t space_id, const hssize_t *offset)
-{
- H5S_t *space; /* dataspace to modify */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Hs", space_id, offset);
-
- /* Check args */
- if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
- if (space->extent.rank==0 || (H5S_GET_EXTENT_TYPE(space)==H5S_SCALAR
- || H5S_GET_EXTENT_TYPE(space)==H5S_NULL))
- HGOTO_ERROR(H5E_ATOM, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar or null dataspace")
- if (offset == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no offset specified")
-
- /* Set the selection offset */
- if(H5S_select_offset(space,offset)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set offset")
+ space->extent.type = H5S_NO_CLASS;
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Soffset_simple() */
+} /* end H5Sset_extent_none() */
/*-------------------------------------------------------------------------
@@ -1997,7 +1850,7 @@ H5S_set_extent(H5S_t *space, const hsize_t *size)
HDassert(size);
/* Verify that the dimensions being changed are allowed to change */
- for(u = 0; u < space->extent.rank; u++) {
+ for(u = 0; u < space->extent.rank; u++)
if(space->extent.size[u] != size[u]) {
/* Check for invalid dimension size modification */
if(space->extent.max && H5S_UNLIMITED != space->extent.max[u] &&
@@ -2007,7 +1860,6 @@ H5S_set_extent(H5S_t *space, const hsize_t *size)
/* Indicate that dimension size can be modified */
ret_value = TRUE;
} /* end if */
- } /* end for */
/* Update dimension size(s) */
if(ret_value)
@@ -2034,7 +1886,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-hbool_t
+H5_ATTR_PURE hbool_t
H5S_has_extent(const H5S_t *ds)
{
hbool_t ret_value = FALSE; /* Return value */
@@ -2105,7 +1957,6 @@ done:
* Purpose: Determines if two dataspace extents are equal.
*
* Return: Success: TRUE if equal, FALSE if unequal
- *
* Failure: Negative
*
* Programmer: Quincey Koziol
@@ -2117,7 +1968,7 @@ htri_t
H5Sextent_equal(hid_t space1_id, hid_t space2_id)
{
const H5S_t *ds1, *ds2; /* Dataspaces to compare */
- htri_t ret_value;
+ htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("t", "ii", space1_id, space2_id);
@@ -2149,7 +2000,7 @@ done:
DESCRIPTION
Compare two dataspaces if their extents are identical.
--------------------------------------------------------------------------*/
-htri_t
+H5_ATTR_PURE htri_t
H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2)
{
unsigned u; /* Local index variable */
@@ -2210,7 +2061,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-hsize_t
+H5_ATTR_PURE hsize_t
H5S_extent_nelem(const H5S_extent_t *ext)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -2258,6 +2109,5 @@ H5S_set_version(H5F_t *f, H5S_t *ds)
done:
FUNC_LEAVE_NOAPI(ret_value)
-
} /* end H5S_set_version() */
diff --git a/src/H5ST.c b/src/H5ST.c
index dd5b63c..3a1020b 100644
--- a/src/H5ST.c
+++ b/src/H5ST.c
@@ -743,19 +743,19 @@ H5ST__dump_internal(H5ST_ptr_t p)
FUNC_ENTER_STATIC_NOERR
if(p) {
- printf("p=%p\n", (void *)p);
- printf("\tp->up=%p\n", (void *)p->up);
- printf("\tp->parent=%p\n", (void *)p->parent);
- printf("\tp->lokid=%p\n", (void *)p->lokid);
- printf("\tp->hikid=%p\n", (void *)p->hikid);
- printf("\tp->eqkid=%p\n", (void *)p->eqkid);
- printf("\tp->splitchar=%c\n", p->splitchar);
+ HDprintf("p=%p\n", (void *)p);
+ HDprintf("\tp->up=%p\n", (void *)p->up);
+ HDprintf("\tp->parent=%p\n", (void *)p->parent);
+ HDprintf("\tp->lokid=%p\n", (void *)p->lokid);
+ HDprintf("\tp->hikid=%p\n", (void *)p->hikid);
+ HDprintf("\tp->eqkid=%p\n", (void *)p->eqkid);
+ HDprintf("\tp->splitchar=%c\n", p->splitchar);
H5ST__dump_internal(p->lokid);
if(p->splitchar)
H5ST__dump_internal(p->eqkid);
else
- printf("%s\n", (char *)p->eqkid);
+ HDprintf("%s\n", (char *)p->eqkid);
H5ST__dump_internal(p->hikid);
} /* end if */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 3b77b98..0aa2f05 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -18,16 +18,36 @@
* Purpose: "All" selection dataspace I/O functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* ID Functions */
#include "H5Spkg.h" /* Dataspace functions */
-#include "H5VMprivate.h" /* Vector functions */
+#include "H5VMprivate.h" /* Vector functions */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
-/* Static function prototypes */
+/********************/
+/* Local Prototypes */
+/********************/
/* Selection callbacks */
static herr_t H5S__all_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
@@ -60,6 +80,16 @@ static herr_t H5S__all_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
static herr_t H5S__all_iter_next_block(H5S_sel_iter_t *sel_iter);
static herr_t H5S__all_iter_release(H5S_sel_iter_t *sel_iter);
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
/* Selection properties for "all" selections */
const H5S_select_class_t H5S_sel_all[1] = {{
H5S_SEL_ALL,
@@ -85,6 +115,11 @@ const H5S_select_class_t H5S_sel_all[1] = {{
H5S__all_iter_init,
}};
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Iteration properties for "all" selections */
static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{
H5S_SEL_ALL,
@@ -99,13 +134,14 @@ static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{
H5S__all_iter_release,
}};
+
/*-------------------------------------------------------------------------
* Function: H5S__all_iter_init
*
* Purpose: Initializes iteration information for "all" selection.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
@@ -132,7 +168,7 @@ H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
iter->type = H5S_sel_iter_all;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_iter_init() */
+} /* end H5S__all_iter_init() */
/*-------------------------------------------------------------------------
@@ -141,7 +177,7 @@ H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
* Purpose: Retrieve the current coordinates of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Tuesday, April 22, 2003
@@ -165,7 +201,7 @@ H5S__all_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S__all_iter_coords() */
+} /* end H5S__all_iter_coords() */
/*-------------------------------------------------------------------------
@@ -174,7 +210,7 @@ done:
* Purpose: Retrieve the current block of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Monday, June 2, 2003
@@ -204,7 +240,7 @@ H5S__all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
} /* end for */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_iter_block() */
+} /* end H5S__all_iter_block() */
/*-------------------------------------------------------------------------
@@ -212,7 +248,7 @@ H5S__all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
*
* Purpose: Return number of elements left to process in iterator
*
- * Return: non-negative number of elements on success, zero on failure
+ * Return: Non-negative number of elements on success, zero on failure
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
@@ -228,7 +264,7 @@ H5S__all_iter_nelmts(const H5S_sel_iter_t *iter)
HDassert(iter);
FUNC_LEAVE_NOAPI(iter->elmt_left)
-} /* H5S__all_iter_nelmts() */
+} /* end H5S__all_iter_nelmts() */
/*--------------------------------------------------------------------------
@@ -257,7 +293,7 @@ H5S__all_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
HDassert(iter);
FUNC_LEAVE_NOAPI(FALSE)
-} /* H5S__all_iter_has_next_block() */
+} /* end H5S__all_iter_has_next_block() */
/*--------------------------------------------------------------------------
@@ -292,7 +328,7 @@ H5S__all_iter_next(H5S_sel_iter_t *iter, size_t nelem)
iter->u.all.byte_offset += (nelem * iter->elmt_size);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_iter_next() */
+} /* end H5S__all_iter_next() */
/*--------------------------------------------------------------------------
@@ -321,7 +357,81 @@ H5S__all_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
HDassert(iter);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S__all_iter_next_block() */
+} /* end H5S__all_iter_next_block() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__all_get_seq_list
+ PURPOSE
+ Create a list of offsets & lengths for a selection
+ USAGE
+ herr_t H5S__all_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
+ H5S_t *space; IN: Dataspace containing selection to use.
+ unsigned flags; IN: Flags for extra information about operation
+ H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
+ position of interest in selection.
+ size_t maxseq; IN: Maximum number of sequences to generate
+ size_t maxelem; IN: Maximum number of elements to include in the
+ generated sequences
+ size_t *nseq; OUT: Actual number of sequences generated
+ size_t *nelem; OUT: Actual number of elements in sequences generated
+ hsize_t *off; OUT: Array of offsets
+ size_t *len; OUT: Array of lengths
+ RETURNS
+ Non-negative on success/Negative on failure.
+ DESCRIPTION
+ Use the selection in the dataspace to generate a list of byte offsets and
+ lengths for the region(s) selected. Start/Restart from the position in the
+ ITER parameter. The number of sequences generated is limited by the MAXSEQ
+ parameter and the number of sequences actually generated is stored in the
+ NSEQ parameter.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__all_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t *iter,
+ size_t H5_ATTR_UNUSED maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
+ hsize_t *off, size_t *len)
+{
+ size_t elem_used; /* The number of elements used */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(space);
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
+
+ /* Determine the actual number of elements to use */
+ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
+ elem_used = MIN(maxelem, (size_t)iter->elmt_left);
+ HDassert(elem_used > 0);
+
+ /* Compute the offset in the dataset */
+ off[0] = iter->u.all.byte_offset;
+ len[0] = elem_used * iter->elmt_size;
+
+ /* Should only need one sequence for 'all' selections */
+ *nseq = 1;
+
+ /* Set the number of elements used */
+ *nelem = elem_used;
+
+ /* Update the iterator */
+ iter->elmt_left -= elem_used;
+ iter->u.all.elmt_offset += elem_used;
+ iter->u.all.byte_offset += len[0];
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__all_get_seq_list() */
/*--------------------------------------------------------------------------
@@ -350,7 +460,7 @@ H5S__all_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED * iter)
HDassert(iter);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_iter_release() */
+} /* end H5S__all_iter_release() */
/*--------------------------------------------------------------------------
@@ -382,7 +492,7 @@ H5S__all_release(H5S_t *space)
space->select.num_elem = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_release() */
+} /* end H5S__all_release() */
/*--------------------------------------------------------------------------
@@ -391,9 +501,10 @@ H5S__all_release(H5S_t *space)
PURPOSE
Copy a selection from one dataspace to another
USAGE
- herr_t H5S__all_copy(dst, src)
+ herr_t H5S__all_copy(dst, src, share_selection)
H5S_t *dst; OUT: Pointer to the destination dataspace
H5S_t *src; IN: Pointer to the source dataspace
+ hbool_t; IN: Whether to share the selection between the dataspaces
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -527,7 +638,7 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p)
*p = pp;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_serialize() */
+} /* end H5S__all_serialize() */
/*--------------------------------------------------------------------------
@@ -572,7 +683,7 @@ H5S__all_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_A
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S__all_deserialize() */
+} /* end H5S__all_deserialize() */
/*--------------------------------------------------------------------------
@@ -622,7 +733,7 @@ H5S__all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
} /* end for */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_bounds() */
+} /* end H5S__all_bounds() */
/*--------------------------------------------------------------------------
@@ -657,7 +768,7 @@ H5S__all_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset)
*offset = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_offset() */
+} /* end H5S__all_offset() */
/*--------------------------------------------------------------------------
@@ -716,7 +827,7 @@ H5S__all_is_contiguous(const H5S_t H5_ATTR_UNUSED *space)
HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
-} /* H5S__all_is_contiguous() */
+} /* end H5S__all_is_contiguous() */
/*--------------------------------------------------------------------------
@@ -745,7 +856,7 @@ H5S__all_is_single(const H5S_t H5_ATTR_UNUSED *space)
HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
-} /* H5S__all_is_single() */
+} /* end H5S__all_is_single() */
/*--------------------------------------------------------------------------
@@ -776,7 +887,7 @@ H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space)
HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
-} /* H5S__all_is_regular() */
+} /* end H5S__all_is_regular() */
/*--------------------------------------------------------------------------
@@ -807,7 +918,7 @@ H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off
HDassert(offset);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_adjust_u() */
+} /* end H5S__all_adjust_u() */
/*-------------------------------------------------------------------------
@@ -816,7 +927,7 @@ H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off
* Purpose: Projects a single element 'all' selection into a scalar
* dataspace
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -836,7 +947,7 @@ H5S__all_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset)
*offset = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_project_scalar() */
+} /* end H5S__all_project_scalar() */
/*-------------------------------------------------------------------------
@@ -845,7 +956,7 @@ H5S__all_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset)
* Purpose: Projects an 'all' selection onto/into a simple dataspace
* of a different rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -853,7 +964,8 @@ H5S__all_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__all_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
+H5S__all_project_simple(const H5S_t H5_ATTR_UNUSED *base_space,
+ H5S_t *new_space, hsize_t H5_ATTR_UNUSED *offset)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -870,7 +982,7 @@ H5S__all_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offs
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S__all_project_simple() */
+} /* end H5S__all_project_simple() */
/*--------------------------------------------------------------------------
@@ -914,7 +1026,7 @@ H5S_select_all(H5S_t *space, hbool_t rel_prev)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_all() */
+} /* end H5S_select_all() */
/*--------------------------------------------------------------------------
@@ -953,79 +1065,5 @@ H5Sselect_all(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sselect_all() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S__all_get_seq_list
- PURPOSE
- Create a list of offsets & lengths for a selection
- USAGE
- herr_t H5S__all_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
- H5S_t *space; IN: Dataspace containing selection to use.
- unsigned flags; IN: Flags for extra information about operation
- H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
- position of interest in selection.
- size_t maxseq; IN: Maximum number of sequences to generate
- size_t maxelem; IN: Maximum number of elements to include in the
- generated sequences
- size_t *nseq; OUT: Actual number of sequences generated
- size_t *nelem; OUT: Actual number of elements in sequences generated
- hsize_t *off; OUT: Array of offsets
- size_t *len; OUT: Array of lengths
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Use the selection in the dataspace to generate a list of byte offsets and
- lengths for the region(s) selected. Start/Restart from the position in the
- ITER parameter. The number of sequences generated is limited by the MAXSEQ
- parameter and the number of sequences actually generated is stored in the
- NSEQ parameter.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S__all_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t *iter,
- size_t H5_ATTR_UNUSED maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
- hsize_t *off, size_t *len)
-{
- size_t elem_used; /* The number of elements used */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Check args */
- HDassert(space);
- HDassert(iter);
- HDassert(maxseq > 0);
- HDassert(maxelem > 0);
- HDassert(nseq);
- HDassert(nelem);
- HDassert(off);
- HDassert(len);
-
- /* Determine the actual number of elements to use */
- H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
- elem_used = MIN(maxelem, (size_t)iter->elmt_left);
- HDassert(elem_used > 0);
-
- /* Compute the offset in the dataset */
- off[0] = iter->u.all.byte_offset;
- len[0] = elem_used * iter->elmt_size;
-
- /* Should only need one sequence for 'all' selections */
- *nseq = 1;
-
- /* Set the number of elements used */
- *nelem = elem_used;
-
- /* Update the iterator */
- iter->elmt_left -= elem_used;
- iter->u.all.elmt_offset += elem_used;
- iter->u.all.byte_offset += len[0];
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__all_get_seq_list() */
+} /* end H5Sselect_all() */
diff --git a/src/H5Sdbg.c b/src/H5Sdbg.c
index ebd05ce..8171191 100644
--- a/src/H5Sdbg.c
+++ b/src/H5Sdbg.c
@@ -57,16 +57,16 @@
/********************/
-/*********************/
-/* Package Variables */
-/*********************/
-
-
/*****************************/
/* Library Private Variables */
/*****************************/
+/*********************/
+/* Package Variables */
+/*********************/
+
+
/*******************/
/* Local Variables */
/*******************/
@@ -94,24 +94,24 @@ H5S_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth)
switch(H5S_GET_EXTENT_TYPE(mesg)) {
case H5S_NULL:
- fprintf(stream, "%*s%-*s H5S_NULL\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s H5S_NULL\n", indent, "", fwidth,
"Space class:");
break;
case H5S_SCALAR:
- fprintf(stream, "%*s%-*s H5S_SCALAR\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s H5S_SCALAR\n", indent, "", fwidth,
"Space class:");
break;
case H5S_SIMPLE:
- fprintf(stream, "%*s%-*s H5S_SIMPLE\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s H5S_SIMPLE\n", indent, "", fwidth,
"Space class:");
H5O_debug_id(H5O_SDSPACE_ID, f, &(mesg->extent), stream, indent + 3, MAX(0, fwidth - 3));
break;
case H5S_NO_CLASS:
default:
- fprintf(stream, "%*s%-*s **UNKNOWN-%ld**\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s **UNKNOWN-%ld**\n", indent, "", fwidth,
"Space class:", (long)(H5S_GET_EXTENT_TYPE(mesg)));
break;
} /* end switch */
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index ed3fa45..c9fab38 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -18,21 +18,37 @@
* Purpose: Hyperslab selection dataspace I/O functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* ID Functions */
#include "H5Spkg.h" /* Dataspace functions */
-#include "H5VMprivate.h" /* Vector functions */
+#include "H5VMprivate.h" /* Vector functions */
+
+/****************/
/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
-/* Local datatypes */
-/* Static function prototypes */
+/********************/
+/* Local Prototypes */
+/********************/
static H5S_hyper_span_t *H5S__hyper_new_span(hsize_t low, hsize_t high,
H5S_hyper_span_info_t *down, H5S_hyper_span_t *next);
static herr_t H5S__hyper_span_precompute(H5S_hyper_span_info_t *spans, size_t elmt_size);
@@ -64,10 +80,6 @@ static herr_t H5S__hyper_generate_spans(H5S_t *space);
static herr_t H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op,
const hsize_t start[], const hsize_t stride[], const hsize_t count[],
const hsize_t block[]);
-/* Needed for use in hyperslab code (H5Shyper.c) */
-#ifdef NEW_HYPERSLAB_API
-static herr_t H5S_select_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2);
-#endif /*NEW_HYPERSLAB_API*/
static void H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride,
hsize_t *count, hsize_t *block, hsize_t clip_size);
static hsize_t H5S__hyper_get_clip_extent_real(const H5S_t *clip_space,
@@ -111,6 +123,15 @@ static hbool_t H5S__hyper_rebuild_helper(const H5S_hyper_span_t *span,
H5S_hyper_dim_t span_slab_info[], unsigned rank);
static hbool_t H5S__hyper_rebuild(H5S_t *space);
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
/* Selection properties for hyperslab selections */
const H5S_select_class_t H5S_sel_hyper[1] = {{
H5S_SEL_HYPERSLABS,
@@ -136,6 +157,11 @@ const H5S_select_class_t H5S_sel_hyper[1] = {{
H5S__hyper_iter_init,
}};
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Iteration properties for hyperslab selections */
static const H5S_sel_iter_class_t H5S_sel_iter_hyper[1] = {{
H5S_SEL_HYPERSLABS,
@@ -153,16 +179,16 @@ static const H5S_sel_iter_class_t H5S_sel_iter_hyper[1] = {{
/* Static variables */
/* Arrays for default stride, block, etc. */
-static const hsize_t H5S_hyper_zeros_g[H5O_LAYOUT_NDIMS] = {
+static const hsize_t H5S_hyper_zeros_g[H5S_MAX_RANK] = {
0,0,0,0, 0,0,0,0,
0,0,0,0, 0,0,0,0,
0,0,0,0, 0,0,0,0,
- 0,0,0,0, 0,0,0,0,0};
-static const hsize_t H5S_hyper_ones_g[H5O_LAYOUT_NDIMS] = {
+ 0,0,0,0, 0,0,0,0};
+static const hsize_t H5S_hyper_ones_g[H5S_MAX_RANK] = {
1,1,1,1, 1,1,1,1,
1,1,1,1, 1,1,1,1,
1,1,1,1, 1,1,1,1,
- 1,1,1,1, 1,1,1,1,1};
+ 1,1,1,1, 1,1,1,1};
/* Declare a free list to manage the H5S_hyper_sel_t struct */
H5FL_DEFINE_STATIC(H5S_hyper_sel_t);
@@ -261,9 +287,9 @@ H5S__hyper_print_diminfo(FILE *f, const H5S_t *space)
/*-------------------------------------------------------------------------
* Function: H5S__hyper_iter_init
*
- * Purpose: Initializes iteration information for hyperslab span tree selection.
+ * Purpose: Initializes iteration information for hyperslab selection.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Saturday, February 24, 2001
@@ -278,11 +304,8 @@ H5S__hyper_print_diminfo(FILE *f, const H5S_t *space)
static herr_t
H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
{
- const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- H5S_hyper_span_info_t *spans; /* Pointer to hyperslab span info node */
unsigned rank; /* Dataspace's dimension rank */
unsigned u; /* Index variable */
- int i; /* Index variable */
FUNC_ENTER_STATIC_NOERR
@@ -298,16 +321,16 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
/* Get the rank of the dataspace */
rank = space->extent.rank;
- /* Set the temporary pointer to the dimension information */
- tdiminfo = space->select.sel_info.hslab->opt_diminfo;
-
/* Check for the special case of just one H5Sselect_hyperslab call made */
if(space->select.sel_info.hslab->diminfo_valid) {
/* Initialize the information needed for regular hyperslab I/O */
+ const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
const hsize_t *mem_size; /* Temporary pointer to dataspace extent's dimension sizes */
- hsize_t acc; /* Accumulator for "flattened" dimension's sizes */
unsigned cont_dim = 0; /* # of contiguous dimensions */
+ /* Set the temporary pointer to the dimension information */
+ tdiminfo = space->select.sel_info.hslab->opt_diminfo;
+
/* Set the temporary pointer to the dataspace extent's dimension sizes */
mem_size = space->extent.size;
@@ -336,9 +359,11 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
/* Check if the regular selection can be "flattened" */
if(cont_dim > 0) {
- unsigned last_dim_flattened = 1; /* Flag to indicate that the last dimension was flattened */
+ hsize_t acc; /* Accumulator for "flattened" dimension's sizes */
+ hbool_t last_dim_flattened = TRUE; /* Flag to indicate that the last dimension was flattened */
unsigned flat_rank = rank-cont_dim; /* Number of dimensions after flattening */
unsigned curr_dim; /* Current dimension */
+ int i; /* Index variable */
/* Set the iterator's rank to the contiguous dimensions */
iter->u.hyp.iter_rank = flat_rank;
@@ -352,7 +377,7 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
acc *= mem_size[i];
/* Indicate that the dimension was flattened */
- last_dim_flattened = 1;
+ last_dim_flattened = TRUE;
} /* end if */
else {
if(last_dim_flattened) {
@@ -370,7 +395,7 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
iter->u.hyp.sel_off[curr_dim] = space->select.offset[i] * (hssize_t)acc;
/* Reset the "last dim flattened" flag to avoid flattened any further dimensions */
- last_dim_flattened = 0;
+ last_dim_flattened = FALSE;
/* Reset the "accumulator" for possible further dimension flattening */
acc = 1;
@@ -415,8 +440,9 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
/* Initialize irregular region information also (for release) */
iter->u.hyp.spans = NULL;
} /* end if */
- else {
-/* Initialize the information needed for non-regular hyperslab I/O */
+ else { /* Initialize the information needed for non-regular hyperslab I/O */
+ H5S_hyper_span_info_t *spans; /* Pointer to hyperslab span info node */
+
HDassert(space->select.sel_info.hslab->span_lst);
/* Make a copy of the span tree to iterate over */
iter->u.hyp.spans = H5S__hyper_copy_span(space->select.sel_info.hslab->span_lst);
@@ -458,7 +484,7 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
* Purpose: Retrieve the current coordinates of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Tuesday, April 22, 2003
@@ -543,7 +569,7 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
* Purpose: Retrieve the current block of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Monday, June 2, 2003
@@ -569,7 +595,7 @@ H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
/* Check for a single "regular" hyperslab */
if(iter->u.hyp.diminfo_valid) {
- /* Compute the end of the block */
+ /* Copy the start and compute the end of the block */
for(u = 0; u < iter->rank; u++) {
start[u] = iter->u.hyp.off[u];
end[u] = (start[u] + iter->u.hyp.diminfo[u].block) - 1;
@@ -594,7 +620,7 @@ H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
*
* Purpose: Return number of elements left to process in iterator
*
- * Return: non-negative number of elements on success, zero on failure
+ * Return: Non-negative number of elements on success, zero on failure
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
@@ -630,7 +656,7 @@ H5S__hyper_iter_nelmts(const H5S_sel_iter_t *iter)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static htri_t
+static H5_ATTR_PURE htri_t
H5S__hyper_iter_has_next_block(const H5S_sel_iter_t *iter)
{
unsigned u; /* Local index variable */
@@ -688,7 +714,7 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
{
unsigned ndims; /* Number of dimensions of dataset */
int fast_dim; /* Rank of the fastest changing dimension for the dataspace */
- unsigned i; /* Counters */
+ unsigned u; /* Counters */
FUNC_ENTER_STATIC_NOERR
@@ -696,19 +722,17 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
/* (i.e. a regular hyperslab selection */
if(iter->u.hyp.diminfo_valid) {
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- hsize_t iter_offset[H5O_LAYOUT_NDIMS];
- hsize_t iter_count[H5O_LAYOUT_NDIMS];
+ hsize_t iter_offset[H5S_MAX_RANK];
+ hsize_t iter_count[H5S_MAX_RANK];
int temp_dim; /* Temporary rank holder */
/* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank) {
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank)
/* Set the aliases for the dimension rank */
ndims = iter->u.hyp.iter_rank;
- } /* end if */
- else {
+ else
/* Set the aliases for the dimension rank */
ndims = iter->rank;
- } /* end else */
/* Set the fastest dimension rank */
fast_dim = (int)ndims - 1;
@@ -717,14 +741,14 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
tdiminfo = iter->u.hyp.diminfo;
/* Calculate the offset and block count for each dimension */
- for(i = 0; i < ndims; i++) {
- if(tdiminfo[i].count == 1) {
- iter_offset[i] = iter->u.hyp.off[i] - tdiminfo[i].start;
- iter_count[i] = 0;
+ for(u = 0; u < ndims; u++) {
+ if(tdiminfo[u].count == 1) {
+ iter_offset[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
+ iter_count[u] = 0;
} /* end if */
else {
- iter_offset[i] = (iter->u.hyp.off[i] - tdiminfo[i].start) % tdiminfo[i].stride;
- iter_count[i] = (iter->u.hyp.off[i] - tdiminfo[i].start) / tdiminfo[i].stride;
+ iter_offset[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) % tdiminfo[u].stride;
+ iter_count[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) / tdiminfo[u].stride;
} /* end else */
} /* end for */
@@ -749,10 +773,9 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
/* Decrement the number of elements advanced */
nelem -= actual_elem;
} /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
iter_offset[temp_dim]++;
- } /* end else */
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
if(iter_offset[temp_dim] < tdiminfo[temp_dim].block)
@@ -775,8 +798,8 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
} /* end while */
/* Translate current iter_offset and iter_count into iterator position */
- for(i = 0; i < ndims; i++)
- iter->u.hyp.off[i] = tdiminfo[i].start + (tdiminfo[i].stride * iter_count[i]) + iter_offset[i];
+ for(u = 0; u < ndims; u++)
+ iter->u.hyp.off[u] = tdiminfo[u].start + (tdiminfo[u].stride * iter_count[u]) + iter_offset[u];
} /* end if */
/* Must be an irregular hyperslab selection */
else {
@@ -820,15 +843,13 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
/* Decrement the number of elements advanced */
nelem -= actual_elem;
} /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
abs_arr[curr_dim]++;
- } /* end else */
/* Check if we are still within the span */
- if(abs_arr[curr_dim] <= curr_span->high) {
+ if(abs_arr[curr_dim] <= curr_span->high)
break;
- } /* end if */
/* If we walked off that span, advance to the next span */
else {
/* Advance span in this dimension */
@@ -844,10 +865,9 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
break;
} /* end if */
- else {
+ else
/* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
curr_dim--;
- } /* end else */
} /* end else */
} /* end while */
@@ -906,22 +926,20 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
FUNC_ENTER_STATIC_NOERR
/* Check for the special case of just one H5Sselect_hyperslab call made */
- /* (i.e. a regular hyperslab selection */
+ /* (i.e. a regular hyperslab selection) */
if(iter->u.hyp.diminfo_valid) {
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- hsize_t iter_offset[H5O_LAYOUT_NDIMS];
- hsize_t iter_count[H5O_LAYOUT_NDIMS];
+ hsize_t iter_offset[H5S_MAX_RANK];
+ hsize_t iter_count[H5S_MAX_RANK];
int temp_dim; /* Temporary rank holder */
/* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank) {
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank)
/* Set the aliases for the dimension rank */
ndims = iter->u.hyp.iter_rank;
- } /* end if */
- else {
+ else
/* Set the aliases for the dimension rank */
ndims = iter->rank;
- } /* end else */
/* Set the fastest dimension rank */
fast_dim = (int)ndims - 1;
@@ -944,14 +962,12 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
/* Advance one block */
temp_dim = fast_dim; /* Start with the fastest changing dimension */
while(temp_dim >= 0) {
- if(temp_dim == fast_dim) {
+ if(temp_dim == fast_dim)
/* Move iterator over current block */
iter_offset[temp_dim] += tdiminfo[temp_dim].block;
- } /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
iter_offset[temp_dim]++;
- } /* end else */
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
if(iter_offset[temp_dim] < tdiminfo[temp_dim].block)
@@ -1000,19 +1016,16 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
curr_span = ispan[curr_dim];
/* Increment absolute position */
- if(curr_dim == fast_dim) {
+ if(curr_dim == fast_dim)
/* Move the iterator over rest of element in span */
abs_arr[curr_dim] = curr_span->high + 1;
- } /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
abs_arr[curr_dim]++;
- } /* end else */
/* Check if we are still within the span */
- if(abs_arr[curr_dim] <= curr_span->high) {
+ if(abs_arr[curr_dim] <= curr_span->high)
break;
- } /* end if */
/* If we walked off that span, advance to the next span */
else {
/* Advance span in this dimension */
@@ -1028,10 +1041,9 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
break;
} /* end if */
- else {
+ else
/* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
curr_dim--;
- } /* end else */
} /* end else */
} /* end while */
@@ -1062,7 +1074,1333 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__hyper_iter_next() */
+} /* end H5S__hyper_iter_next_block() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__hyper_get_seq_list_gen
+ PURPOSE
+ Create a list of offsets & lengths for a selection
+ USAGE
+ herr_t H5S_select_hyper_get_file_list_gen(space,iter,maxseq,maxelem,nseq,nelem,off,len)
+ H5S_t *space; IN: Dataspace containing selection to use.
+ H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
+ position of interest in selection.
+ size_t maxseq; IN: Maximum number of sequences to generate
+ size_t maxelem; IN: Maximum number of elements to include in the
+ generated sequences
+ size_t *nseq; OUT: Actual number of sequences generated
+ size_t *nelem; OUT: Actual number of elements in sequences generated
+ hsize_t *off; OUT: Array of offsets
+ size_t *len; OUT: Array of lengths
+ RETURNS
+ Non-negative on success/Negative on failure.
+ DESCRIPTION
+ Use the selection in the dataspace to generate a list of byte offsets and
+ lengths for the region(s) selected. Start/Restart from the position in the
+ ITER parameter. The number of sequences generated is limited by the MAXSEQ
+ parameter and the number of sequences actually generated is stored in the
+ NSEQ parameter.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__hyper_get_seq_list_gen(const H5S_t *space, H5S_sel_iter_t *iter,
+ size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
+ hsize_t *off, size_t *len)
+{
+ H5S_hyper_span_t *curr_span; /* Current hyperslab span node */
+ H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */
+ hsize_t slab[H5S_MAX_RANK]; /* Cumulative size of each dimension in bytes */
+ hsize_t acc; /* Accumulator for computing cumulative sizes */
+ hsize_t loc_off; /* Element offset in the dataspace */
+ hsize_t last_span_end = 0; /* The offset of the end of the last span */
+ hsize_t *abs_arr; /* Absolute hyperslab span position */
+ const hssize_t *off_arr; /* Offset within the dataspace extent */
+ size_t span_size = 0; /* Number of bytes in current span to actually process */
+ size_t io_left; /* Number of elements left to process */
+ size_t io_bytes_left; /* Number of bytes left to process */
+ size_t io_used; /* Number of elements processed */
+ size_t curr_seq = 0; /* Number of sequence/offsets stored in the arrays */
+ size_t elem_size; /* Size of each element iterating over */
+ unsigned ndims; /* Number of dimensions of dataset */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ int curr_dim; /* Current dimension being operated on */
+ unsigned u; /* Index variable */
+ int i; /* Index variable */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(space);
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
+
+ /* Set the rank of the fastest changing dimension */
+ ndims = space->extent.rank;
+ fast_dim = (ndims - 1);
+
+ /* Get the pointers to the current span info and span nodes */
+ curr_span = iter->u.hyp.span[fast_dim];
+ abs_arr = iter->u.hyp.off;
+ off_arr = space->select.offset;
+ ispan = iter->u.hyp.span;
+ elem_size = iter->elmt_size;
+
+ /* Set the amount of elements to perform I/O on, etc. */
+ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
+ io_left = MIN(maxelem, (size_t)iter->elmt_left);
+ io_bytes_left = io_left * elem_size;
+
+ /* Compute the cumulative size of dataspace dimensions */
+ for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
+ slab[i] = acc;
+ acc *= space->extent.size[i];
+ } /* end for */
+
+ /* Set the offset of the first element iterated on */
+ for(u = 0, loc_off = 0; u < ndims; u++)
+ /* Compute the sequential element offset */
+ loc_off += ((hsize_t)((hssize_t)abs_arr[u] + off_arr[u])) * slab[u];
+
+ /* Range check against number of elements left in selection */
+ HDassert(io_bytes_left <= (iter->elmt_left * elem_size));
+
+ /* Take care of any partial spans leftover from previous I/Os */
+ if(abs_arr[fast_dim] != curr_span->low) {
+ /* Finish the span in the fastest changing dimension */
+
+ /* Compute the number of bytes to attempt in this span */
+ H5_CHECKED_ASSIGN(span_size, size_t, ((curr_span->high - abs_arr[fast_dim])+1)*elem_size, hsize_t);
+
+ /* Check number of bytes against upper bounds allowed */
+ if(span_size > io_bytes_left)
+ span_size = io_bytes_left;
+
+ /* Add the partial span to the list of sequences */
+ off[curr_seq] = loc_off;
+ len[curr_seq] = span_size;
+
+ /* Increment sequence count */
+ curr_seq++;
+
+ /* Set the location of the last span's end */
+ last_span_end = loc_off + span_size;
+
+ /* Decrement I/O left to perform */
+ io_bytes_left -= span_size;
+
+ /* Check if we are done */
+ if(io_bytes_left > 0) {
+ /* Move to next span in fastest changing dimension */
+ curr_span = curr_span->next;
+
+ if(NULL != curr_span) {
+ /* Move location offset of destination */
+ loc_off += (curr_span->low - abs_arr[fast_dim]) * elem_size;
+
+ /* Move iterator for fastest changing dimension */
+ abs_arr[fast_dim] = curr_span->low;
+ } /* end if */
+ } /* end if */
+ else {
+ /* Advance the hyperslab iterator */
+ abs_arr[fast_dim] += span_size / elem_size;
+
+ /* Check if we are still within the span */
+ if(abs_arr[fast_dim] <= curr_span->high) {
+ iter->u.hyp.span[fast_dim] = curr_span;
+ } /* end if */
+ /* If we walked off that span, advance to the next span */
+ else {
+ /* Advance span in this dimension */
+ curr_span = curr_span->next;
+
+ /* Check if we have a valid span in this dimension still */
+ if(NULL != curr_span) {
+ /* Reset absolute position */
+ abs_arr[fast_dim] = curr_span->low;
+ iter->u.hyp.span[fast_dim] = curr_span;
+ } /* end if */
+ } /* end else */
+ } /* end else */
+
+ /* Adjust iterator pointers */
+
+ if(NULL == curr_span) {
+/* Same as code in main loop */
+ /* Start at the next fastest dim */
+ curr_dim = (int)(fast_dim - 1);
+
+ /* Work back up through the dimensions */
+ while(curr_dim >= 0) {
+ /* Reset the current span */
+ curr_span = iter->u.hyp.span[curr_dim];
+
+ /* Increment absolute position */
+ abs_arr[curr_dim]++;
+
+ /* Check if we are still within the span */
+ if(abs_arr[curr_dim] <= curr_span->high) {
+ break;
+ } /* end if */
+ /* If we walked off that span, advance to the next span */
+ else {
+ /* Advance span in this dimension */
+ curr_span = curr_span->next;
+
+ /* Check if we have a valid span in this dimension still */
+ if(NULL != curr_span) {
+ /* Reset the span in the current dimension */
+ ispan[curr_dim] = curr_span;
+
+ /* Reset absolute position */
+ abs_arr[curr_dim] = curr_span->low;
+
+ break;
+ } /* end if */
+ else
+ /* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
+ curr_dim--;
+ } /* end else */
+ } /* end while */
+
+ /* Check if we have more spans in the tree */
+ if(curr_dim >= 0) {
+ /* Walk back down the iterator positions, resetting them */
+ while((unsigned)curr_dim < fast_dim) {
+ HDassert(curr_span);
+ HDassert(curr_span->down);
+ HDassert(curr_span->down->head);
+
+ /* Increment current dimension */
+ curr_dim++;
+
+ /* Set the new span_info & span for this dimension */
+ iter->u.hyp.span[curr_dim] = curr_span->down->head;
+
+ /* Advance span down the tree */
+ curr_span = curr_span->down->head;
+
+ /* Reset the absolute offset for the dim */
+ abs_arr[curr_dim] = curr_span->low;
+ } /* end while */
+
+ /* Verify that the curr_span points to the fastest dim */
+ HDassert(curr_span == iter->u.hyp.span[fast_dim]);
+
+ /* Reset the buffer offset */
+ for(u = 0, loc_off = 0; u < ndims; u++)
+ loc_off += ((hsize_t)((hssize_t)abs_arr[u] + off_arr[u])) * slab[u];
+ } /* end else */
+ else
+ /* We had better be done with I/O or bad things are going to happen... */
+ HDassert(io_bytes_left == 0);
+ } /* end if */
+ } /* end if */
+
+ /* Perform the I/O on the elements, based on the position of the iterator */
+ while(io_bytes_left > 0 && curr_seq < maxseq) {
+ /* Sanity check */
+ HDassert(curr_span);
+
+ /* Adjust location offset of destination to compensate for initial increment below */
+ loc_off -= curr_span->pstride;
+
+ /* Loop over all the spans in the fastest changing dimension */
+ while(curr_span != NULL) {
+ /* Move location offset of destination */
+ loc_off += curr_span->pstride;
+
+ /* Compute the number of elements to attempt in this span */
+ H5_CHECKED_ASSIGN(span_size, size_t, curr_span->nelem, hsize_t);
+
+ /* Check number of elements against upper bounds allowed */
+ if(span_size >= io_bytes_left) {
+ /* Trim the number of bytes to output */
+ span_size = io_bytes_left;
+ io_bytes_left = 0;
+
+/* COMMON */
+ /* Store the I/O information for the span */
+
+ /* Check if this is appending onto previous sequence */
+ if(curr_seq > 0 && last_span_end == loc_off)
+ len[curr_seq - 1] += span_size;
+ else {
+ off[curr_seq] = loc_off;
+ len[curr_seq] = span_size;
+
+ /* Increment the number of sequences in arrays */
+ curr_seq++;
+ } /* end else */
+
+ /* Set the location of the last span's end */
+ last_span_end = loc_off + span_size;
+/* end COMMON */
+
+ /* Break out now, we are finished with I/O */
+ break;
+ } /* end if */
+ else {
+ /* Decrement I/O left to perform */
+ io_bytes_left -= span_size;
+
+/* COMMON */
+ /* Store the I/O information for the span */
+
+ /* Check if this is appending onto previous sequence */
+ if(curr_seq > 0 && last_span_end == loc_off)
+ len[curr_seq - 1] += span_size;
+ else {
+ off[curr_seq] = loc_off;
+ len[curr_seq] = span_size;
+
+ /* Increment the number of sequences in arrays */
+ curr_seq++;
+ } /* end else */
+
+ /* Set the location of the last span's end */
+ last_span_end = loc_off + span_size;
+/* end COMMON */
+
+ /* If the sequence & offset arrays are full, do what? */
+ if(curr_seq >= maxseq)
+ /* Break out now, we are finished with sequences */
+ break;
+ } /* end else */
+
+ /* Move to next span in fastest changing dimension */
+ curr_span = curr_span->next;
+ } /* end while */
+
+ /* Check if we are done */
+ if(io_bytes_left == 0 || curr_seq >= maxseq) {
+ HDassert(curr_span);
+ abs_arr[fast_dim] = curr_span->low + (span_size / elem_size);
+
+ /* Check if we are still within the span */
+ if(abs_arr[fast_dim] <= curr_span->high) {
+ iter->u.hyp.span[fast_dim]=curr_span;
+ break;
+ } /* end if */
+ /* If we walked off that span, advance to the next span */
+ else {
+ /* Advance span in this dimension */
+ curr_span = curr_span->next;
+
+ /* Check if we have a valid span in this dimension still */
+ if(curr_span != NULL) {
+ /* Reset absolute position */
+ abs_arr[fast_dim] = curr_span->low;
+ iter->u.hyp.span[fast_dim] = curr_span;
+ break;
+ } /* end if */
+ } /* end else */
+ } /* end if */
+
+ /* Adjust iterator pointers */
+
+ /* Start at the next fastest dim */
+ curr_dim = (int)(fast_dim - 1);
+
+ /* Work back up through the dimensions */
+ while(curr_dim >= 0) {
+ /* Reset the current span */
+ curr_span=iter->u.hyp.span[curr_dim];
+
+ /* Increment absolute position */
+ abs_arr[curr_dim]++;
+
+ /* Check if we are still within the span */
+ if(abs_arr[curr_dim]<=curr_span->high) {
+ break;
+ } /* end if */
+ /* If we walked off that span, advance to the next span */
+ else {
+ /* Advance span in this dimension */
+ curr_span = curr_span->next;
+
+ /* Check if we have a valid span in this dimension still */
+ if(curr_span != NULL) {
+ /* Reset the span in the current dimension */
+ ispan[curr_dim] = curr_span;
+
+ /* Reset absolute position */
+ abs_arr[curr_dim] = curr_span->low;
+
+ break;
+ } /* end if */
+ else
+ /* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
+ curr_dim--;
+ } /* end else */
+ } /* end while */
+
+ /* Check if we are finished with the spans in the tree */
+ if(curr_dim < 0) {
+ /* We had better be done with I/O or bad things are going to happen... */
+ HDassert(io_bytes_left == 0);
+ break;
+ } /* end if */
+ else {
+ /* Walk back down the iterator positions, resetting them */
+ while((unsigned)curr_dim < fast_dim) {
+ HDassert(curr_span);
+ HDassert(curr_span->down);
+ HDassert(curr_span->down->head);
+
+ /* Increment current dimension to the next dimension down */
+ curr_dim++;
+
+ /* Set the new span for the next dimension down */
+ iter->u.hyp.span[curr_dim] = curr_span->down->head;
+
+ /* Advance span down the tree */
+ curr_span = curr_span->down->head;
+
+ /* Reset the absolute offset for the dim */
+ abs_arr[curr_dim] = curr_span->low;
+ } /* end while */
+
+ /* Verify that the curr_span points to the fastest dim */
+ HDassert(curr_span == iter->u.hyp.span[fast_dim]);
+ } /* end else */
+
+ /* Reset the buffer offset */
+ for(u = 0, loc_off = 0; u < ndims; u++)
+ loc_off += ((hsize_t)((hssize_t)abs_arr[u] + off_arr[u])) * slab[u];
+ } /* end while */
+
+ /* Decrement number of elements left in iterator */
+ io_used = (io_left - (io_bytes_left / elem_size));
+ iter->elmt_left -= io_used;
+
+ /* Set the number of sequences generated */
+ *nseq = curr_seq;
+
+ /* Set the number of elements used */
+ *nelem = io_used;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__hyper_get_seq_list_gen() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__hyper_get_seq_list_opt
+ PURPOSE
+ Create a list of offsets & lengths for a selection
+ USAGE
+ herr_t H5S_select_hyper_get_file_list_opt(space,iter,maxseq,maxelem,nseq,nelem,off,len)
+ H5S_t *space; IN: Dataspace containing selection to use.
+ H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
+ position of interest in selection.
+ size_t maxseq; IN: Maximum number of sequences to generate
+ size_t maxelem; IN: Maximum number of elements to include in the
+ generated sequences
+ size_t *nseq; OUT: Actual number of sequences generated
+ size_t *nelem; OUT: Actual number of elements in sequences generated
+ hsize_t *off; OUT: Array of offsets
+ size_t *len; OUT: Array of lengths
+ RETURNS
+ Non-negative on success/Negative on failure.
+ DESCRIPTION
+ Use the selection in the dataspace to generate a list of byte offsets and
+ lengths for the region(s) selected. Start/Restart from the position in the
+ ITER parameter. The number of sequences generated is limited by the MAXSEQ
+ parameter and the number of sequences actually generated is stored in the
+ NSEQ parameter.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__hyper_get_seq_list_opt(const H5S_t *space, H5S_sel_iter_t *iter,
+ size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
+ hsize_t *off, size_t *len)
+{
+ hsize_t *mem_size; /* Size of the source buffer */
+ hsize_t slab[H5S_MAX_RANK]; /* Hyperslab size */
+ const hssize_t *sel_off; /* Selection offset in dataspace */
+ hsize_t offset[H5S_MAX_RANK]; /* Coordinate offset in dataspace */
+ hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary block count */
+ hsize_t tmp_block[H5S_MAX_RANK]; /* Temporary block offset */
+ hsize_t wrap[H5S_MAX_RANK]; /* Bytes to wrap around at the end of a row */
+ hsize_t skip[H5S_MAX_RANK]; /* Bytes to skip between blocks */
+ const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
+ hsize_t fast_dim_start, /* Local copies of fastest changing dimension info */
+ fast_dim_stride,
+ fast_dim_block,
+ fast_dim_offset;
+ size_t fast_dim_buf_off; /* Local copy of amount to move fastest dimension buffer offset */
+ size_t fast_dim_count; /* Number of blocks left in fastest changing dimension */
+ size_t tot_blk_count; /* Total number of blocks left to output */
+ size_t act_blk_count; /* Actual number of blocks to output */
+ size_t total_rows; /* Total number of entire rows to output */
+ size_t curr_rows; /* Current number of entire rows to output */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ unsigned ndims; /* Number of dimensions of dataset */
+ int temp_dim; /* Temporary rank holder */
+ hsize_t acc; /* Accumulator */
+ hsize_t loc; /* Coordinate offset */
+ size_t curr_seq = 0; /* Current sequence being operated on */
+ size_t actual_elem; /* The actual number of elements to count */
+ size_t actual_bytes;/* The actual number of bytes to copy */
+ size_t io_left; /* The number of elements left in I/O operation */
+ size_t start_io_left; /* The initial number of elements left in I/O operation */
+ size_t elem_size; /* Size of each element iterating over */
+ unsigned u; /* Local index variable */
+ int i; /* Local index variable */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(space);
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
+
+ /* Set the local copy of the diminfo pointer */
+ tdiminfo = iter->u.hyp.diminfo;
+
+ /* Check if this is a "flattened" regular hyperslab selection */
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < space->extent.rank) {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = iter->u.hyp.iter_rank;
+ fast_dim = ndims - 1;
+
+ /* Set the local copy of the selection offset */
+ sel_off = iter->u.hyp.sel_off;
+
+ /* Set up the pointer to the size of the memory space */
+ mem_size = iter->u.hyp.size;
+ } /* end if */
+ else {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = space->extent.rank;
+ fast_dim = ndims - 1;
+
+ /* Set the local copy of the selection offset */
+ sel_off = space->select.offset;
+
+ /* Set up the pointer to the size of the memory space */
+ mem_size = space->extent.size;
+ } /* end else */
+
+ /* initialize row sizes for each dimension */
+ elem_size = iter->elmt_size;
+ for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
+ slab[i] = acc;
+ acc *= mem_size[i];
+ } /* end for */
+
+ /* Calculate the number of elements to sequence through */
+ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
+ io_left = MIN((size_t)iter->elmt_left, maxelem);
+
+ /* Sanity check that there aren't any "remainder" sequences in process */
+ HDassert(!((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride != 0 ||
+ ((iter->u.hyp.off[fast_dim] != tdiminfo[fast_dim].start) && tdiminfo[fast_dim].count == 1)));
+
+ /* We've cleared the "remainder" of the previous fastest dimension
+ * sequence before calling this routine, so we must be at the beginning of
+ * a sequence. Use the fancy algorithm to compute the offsets and run
+ * through as many as possible, until the buffer fills up.
+ */
+
+ /* Keep the number of elements we started with */
+ start_io_left = io_left;
+
+ /* Compute the arrays to perform I/O on */
+
+ /* Copy the location of the point to get */
+ /* (Add in the selection offset) */
+ for(u = 0; u < ndims; u++)
+ offset[u] = (hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u]);
+
+ /* Compute the current "counts" for this location */
+ for(u = 0; u < ndims; u++) {
+ if(tdiminfo[u].count == 1) {
+ tmp_count[u] = 0;
+ tmp_block[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
+ } /* end if */
+ else {
+ tmp_count[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) / tdiminfo[u].stride;
+ tmp_block[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) % tdiminfo[u].stride;
+ } /* end else */
+ } /* end for */
+
+ /* Compute the initial buffer offset */
+ for(u = 0, loc = 0; u < ndims; u++)
+ loc += offset[u] * slab[u];
+
+ /* Set the number of elements to write each time */
+ H5_CHECKED_ASSIGN(actual_elem, size_t, tdiminfo[fast_dim].block, hsize_t);
+
+ /* Set the number of actual bytes */
+ actual_bytes = actual_elem * elem_size;
+
+ /* Set local copies of information for the fastest changing dimension */
+ fast_dim_start = tdiminfo[fast_dim].start;
+ fast_dim_stride = tdiminfo[fast_dim].stride;
+ fast_dim_block = tdiminfo[fast_dim].block;
+ H5_CHECKED_ASSIGN(fast_dim_buf_off, size_t, slab[fast_dim] * fast_dim_stride, hsize_t);
+ fast_dim_offset = (hsize_t)((hssize_t)fast_dim_start + sel_off[fast_dim]);
+
+ /* Compute the number of blocks which would fit into the buffer */
+ H5_CHECK_OVERFLOW(io_left / fast_dim_block, hsize_t, size_t);
+ tot_blk_count = (size_t)(io_left / fast_dim_block);
+
+ /* Don't go over the maximum number of sequences allowed */
+ tot_blk_count = MIN(tot_blk_count, (maxseq - curr_seq));
+
+ /* Compute the amount to wrap at the end of each row */
+ for(u = 0; u < ndims; u++)
+ wrap[u] = (mem_size[u] - (tdiminfo[u].stride * tdiminfo[u].count)) * slab[u];
+
+ /* Compute the amount to skip between blocks */
+ for(u = 0; u < ndims; u++)
+ skip[u] = (tdiminfo[u].stride - tdiminfo[u].block) * slab[u];
+
+ /* Check if there is a partial row left (with full blocks) */
+ if(tmp_count[fast_dim] > 0) {
+ /* Get number of blocks in fastest dimension */
+ H5_CHECKED_ASSIGN(fast_dim_count, size_t, tdiminfo[fast_dim].count - tmp_count[fast_dim], hsize_t);
+
+ /* Make certain this entire row will fit into buffer */
+ fast_dim_count = MIN(fast_dim_count, tot_blk_count);
+
+ /* Number of blocks to sequence over */
+ act_blk_count = fast_dim_count;
+
+ /* Loop over all the blocks in the fastest changing dimension */
+ while(fast_dim_count > 0) {
+ /* Store the sequence information */
+ off[curr_seq] = loc;
+ len[curr_seq] = actual_bytes;
+
+ /* Increment sequence count */
+ curr_seq++;
+
+ /* Increment information to reflect block just processed */
+ loc += fast_dim_buf_off;
+
+ /* Decrement number of blocks */
+ fast_dim_count--;
+ } /* end while */
+
+ /* Decrement number of elements left */
+ io_left -= actual_elem * act_blk_count;
+
+ /* Decrement number of blocks left */
+ tot_blk_count -= act_blk_count;
+
+ /* Increment information to reflect block just processed */
+ tmp_count[fast_dim] += act_blk_count;
+
+ /* Check if we finished the entire row of blocks */
+ if(tmp_count[fast_dim] >= tdiminfo[fast_dim].count) {
+ /* Increment offset in destination buffer */
+ loc += wrap[fast_dim];
+
+ /* Increment information to reflect block just processed */
+ offset[fast_dim] = fast_dim_offset; /* reset the offset in the fastest dimension */
+ tmp_count[fast_dim] = 0;
+
+ /* Increment the offset and count for the other dimensions */
+ temp_dim = (int)fast_dim - 1;
+ while(temp_dim >= 0) {
+ /* Move to the next row in the curent dimension */
+ offset[temp_dim]++;
+ tmp_block[temp_dim]++;
+
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
+ break;
+ else {
+ /* Move to the next block in the current dimension */
+ offset[temp_dim] += (tdiminfo[temp_dim].stride - tdiminfo[temp_dim].block);
+ loc += skip[temp_dim];
+ tmp_block[temp_dim] = 0;
+ tmp_count[temp_dim]++;
+
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_count[temp_dim] < tdiminfo[temp_dim].count)
+ break;
+ else {
+ offset[temp_dim] = (hsize_t)((hssize_t)tdiminfo[temp_dim].start + sel_off[temp_dim]);
+ loc += wrap[temp_dim];
+ tmp_count[temp_dim] = 0; /* reset back to the beginning of the line */
+ tmp_block[temp_dim] = 0;
+ } /* end else */
+ } /* end else */
+
+ /* Decrement dimension count */
+ temp_dim--;
+ } /* end while */
+ } /* end if */
+ else {
+ /* Update the offset in the fastest dimension */
+ offset[fast_dim] += (fast_dim_stride * act_blk_count);
+ } /* end else */
+ } /* end if */
+
+ /* Compute the number of entire rows to read in */
+ H5_CHECK_OVERFLOW(tot_blk_count / tdiminfo[fast_dim].count, hsize_t, size_t);
+ curr_rows = total_rows = (size_t)(tot_blk_count / tdiminfo[fast_dim].count);
+
+ /* Reset copy of number of blocks in fastest dimension */
+ H5_CHECKED_ASSIGN(fast_dim_count, size_t, tdiminfo[fast_dim].count, hsize_t);
+
+ /* Read in data until an entire sequence can't be written out any longer */
+ while(curr_rows > 0) {
+
+#define DUFF_GUTS \
+/* Store the sequence information */ \
+off[curr_seq] = loc; \
+len[curr_seq] = actual_bytes; \
+ \
+/* Increment sequence count */ \
+curr_seq++; \
+ \
+/* Increment information to reflect block just processed */ \
+loc += fast_dim_buf_off;
+
+#ifdef NO_DUFFS_DEVICE
+ /* Loop over all the blocks in the fastest changing dimension */
+ while(fast_dim_count > 0) {
+ DUFF_GUTS
+
+ /* Decrement number of blocks */
+ fast_dim_count--;
+ } /* end while */
+#else /* NO_DUFFS_DEVICE */
+ {
+ size_t duffs_index; /* Counting index for Duff's device */
+
+ duffs_index = (fast_dim_count + 7) / 8;
+ switch (fast_dim_count % 8) {
+ default:
+ HDassert(0 && "This Should never be executed!");
+ break;
+ case 0:
+ do
+ {
+ DUFF_GUTS
+ case 7:
+ DUFF_GUTS
+ case 6:
+ DUFF_GUTS
+ case 5:
+ DUFF_GUTS
+ case 4:
+ DUFF_GUTS
+ case 3:
+ DUFF_GUTS
+ case 2:
+ DUFF_GUTS
+ case 1:
+ DUFF_GUTS
+ } while (--duffs_index > 0);
+ } /* end switch */
+ }
+#endif /* NO_DUFFS_DEVICE */
+#undef DUFF_GUTS
+
+ /* Increment offset in destination buffer */
+ loc += wrap[fast_dim];
+
+ /* Increment the offset and count for the other dimensions */
+ temp_dim = (int)fast_dim - 1;
+ while(temp_dim >= 0) {
+ /* Move to the next row in the curent dimension */
+ offset[temp_dim]++;
+ tmp_block[temp_dim]++;
+
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
+ break;
+ else {
+ /* Move to the next block in the current dimension */
+ offset[temp_dim] += (tdiminfo[temp_dim].stride - tdiminfo[temp_dim].block);
+ loc += skip[temp_dim];
+ tmp_block[temp_dim] = 0;
+ tmp_count[temp_dim]++;
+
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_count[temp_dim] < tdiminfo[temp_dim].count)
+ break;
+ else {
+ offset[temp_dim] = (hsize_t)((hssize_t)tdiminfo[temp_dim].start + sel_off[temp_dim]);
+ loc += wrap[temp_dim];
+ tmp_count[temp_dim] = 0; /* reset back to the beginning of the line */
+ tmp_block[temp_dim] = 0;
+ } /* end else */
+ } /* end else */
+
+ /* Decrement dimension count */
+ temp_dim--;
+ } /* end while */
+
+ /* Decrement the number of rows left */
+ curr_rows--;
+ } /* end while */
+
+ /* Adjust the number of blocks & elements left to transfer */
+
+ /* Decrement number of elements left */
+ H5_CHECK_OVERFLOW(actual_elem * (total_rows * tdiminfo[fast_dim].count), hsize_t, size_t);
+ io_left -= (size_t)(actual_elem * (total_rows * tdiminfo[fast_dim].count));
+
+ /* Decrement number of blocks left */
+ H5_CHECK_OVERFLOW((total_rows * tdiminfo[fast_dim].count), hsize_t, size_t);
+ tot_blk_count -= (size_t)(total_rows * tdiminfo[fast_dim].count);
+
+ /* Read in partial row of blocks */
+ if(io_left > 0 && curr_seq < maxseq) {
+ /* Get remaining number of blocks left to output */
+ fast_dim_count = tot_blk_count;
+
+ /* Loop over all the blocks in the fastest changing dimension */
+ while(fast_dim_count > 0) {
+ /* Store the sequence information */
+ off[curr_seq] = loc;
+ len[curr_seq] = actual_bytes;
+
+ /* Increment sequence count */
+ curr_seq++;
+
+ /* Increment information to reflect block just processed */
+ loc += fast_dim_buf_off;
+
+ /* Decrement number of blocks */
+ fast_dim_count--;
+ } /* end while */
+
+ /* Decrement number of elements left */
+ io_left -= actual_elem * tot_blk_count;
+
+ /* Increment information to reflect block just processed */
+ offset[fast_dim] += (fast_dim_stride * tot_blk_count); /* move the offset in the fastest dimension */
+
+ /* Handle any leftover, partial blocks in this row */
+ if(io_left > 0 && curr_seq < maxseq) {
+ actual_elem = io_left;
+ actual_bytes = actual_elem * elem_size;
+
+ /* Store the sequence information */
+ off[curr_seq] = loc;
+ len[curr_seq] = actual_bytes;
+
+ /* Increment sequence count */
+ curr_seq++;
+
+ /* Decrement the number of elements left */
+ io_left -= actual_elem;
+
+ /* Increment buffer correctly */
+ offset[fast_dim] += actual_elem;
+ } /* end if */
+
+ /* don't bother checking slower dimensions */
+ HDassert(io_left == 0 || curr_seq == maxseq);
+ } /* end if */
+
+ /* Update the iterator */
+
+ /* Update the iterator with the location we stopped */
+ /* (Subtract out the selection offset) */
+ for(u = 0; u < ndims; u++)
+ iter->u.hyp.off[u] = (hsize_t)((hssize_t)offset[u] - sel_off[u]);
+
+ /* Decrement the number of elements left in selection */
+ iter->elmt_left -= (start_io_left - io_left);
+
+ /* Increment the number of sequences generated */
+ *nseq += curr_seq;
+
+ /* Increment the number of elements used */
+ *nelem += start_io_left - io_left;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__hyper_get_seq_list_opt() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__hyper_get_seq_list_single
+ PURPOSE
+ Create a list of offsets & lengths for a selection
+ USAGE
+ herr_t H5S__hyper_get_seq_list_single(space, flags, iter, maxseq, maxelem, nseq, nelem, off, len)
+ H5S_t *space; IN: Dataspace containing selection to use.
+ unsigned flags; IN: Flags for extra information about operation
+ H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
+ position of interest in selection.
+ size_t maxseq; IN: Maximum number of sequences to generate
+ size_t maxelem; IN: Maximum number of elements to include in the
+ generated sequences
+ size_t *nseq; OUT: Actual number of sequences generated
+ size_t *nelem; OUT: Actual number of elements in sequences generated
+ hsize_t *off; OUT: Array of offsets
+ size_t *len; OUT: Array of lengths
+ RETURNS
+ Non-negative on success/Negative on failure.
+ DESCRIPTION
+ Use the selection in the dataspace to generate a list of byte offsets and
+ lengths for the region(s) selected. Start/Restart from the position in the
+ ITER parameter. The number of sequences generated is limited by the MAXSEQ
+ parameter and the number of sequences actually generated is stored in the
+ NSEQ parameter.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter,
+ size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
+ hsize_t *off, size_t *len)
+{
+ const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
+ const hssize_t *sel_off; /* Selection offset in dataspace */
+ hsize_t *mem_size; /* Size of the source buffer */
+ hsize_t base_offset[H5S_MAX_RANK]; /* Base coordinate offset in dataspace */
+ hsize_t offset[H5S_MAX_RANK]; /* Coordinate offset in dataspace */
+ hsize_t slab[H5S_MAX_RANK]; /* Hyperslab size */
+ hsize_t fast_dim_block; /* Local copies of fastest changing dimension info */
+ hsize_t acc; /* Accumulator */
+ hsize_t loc; /* Coordinate offset */
+ size_t tot_blk_count; /* Total number of blocks left to output */
+ size_t elem_size; /* Size of each element iterating over */
+ size_t io_left; /* The number of elements left in I/O operation */
+ size_t actual_elem; /* The actual number of elements to count */
+ unsigned ndims; /* Number of dimensions of dataset */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ unsigned skip_dim; /* Rank of the dimension to skip along */
+ unsigned u; /* Local index variable */
+ int i; /* Local index variable */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(space);
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
+
+ /* Set a local copy of the diminfo pointer */
+ tdiminfo = iter->u.hyp.diminfo;
+
+ /* Check if this is a "flattened" regular hyperslab selection */
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < space->extent.rank) {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = iter->u.hyp.iter_rank;
+
+ /* Set the local copy of the selection offset */
+ sel_off = iter->u.hyp.sel_off;
+
+ /* Set up the pointer to the size of the memory space */
+ mem_size = iter->u.hyp.size;
+ } /* end if */
+ else {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = space->extent.rank;
+
+ /* Set the local copy of the selection offset */
+ sel_off = space->select.offset;
+
+ /* Set up the pointer to the size of the memory space */
+ mem_size = space->extent.size;
+ } /* end else */
+ fast_dim = ndims - 1;
+
+ /* initialize row sizes for each dimension */
+ elem_size = iter->elmt_size;
+ for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
+ slab[i] = acc;
+ acc *= mem_size[i];
+ } /* end for */
+
+ /* Copy the base location of the block */
+ /* (Add in the selection offset) */
+ for(u = 0; u < ndims; u++)
+ base_offset[u] = (hsize_t)((hssize_t)tdiminfo[u].start + sel_off[u]);
+
+ /* Copy the location of the point to get */
+ /* (Add in the selection offset) */
+ for(u = 0; u < ndims; u++)
+ offset[u] = (hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u]);
+
+ /* Compute the initial buffer offset */
+ for(u = 0, loc = 0; u < ndims; u++)
+ loc += offset[u] * slab[u];
+
+ /* Set local copies of information for the fastest changing dimension */
+ fast_dim_block = tdiminfo[fast_dim].block;
+
+ /* Calculate the number of elements to sequence through */
+ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
+ io_left = MIN((size_t)iter->elmt_left, maxelem);
+
+ /* Compute the number of blocks which would fit into the buffer */
+ H5_CHECK_OVERFLOW(io_left / fast_dim_block, hsize_t, size_t);
+ tot_blk_count = (size_t)(io_left / fast_dim_block);
+
+ /* Don't go over the maximum number of sequences allowed */
+ tot_blk_count = MIN(tot_blk_count, maxseq);
+
+ /* Set the number of elements to write each time */
+ H5_CHECKED_ASSIGN(actual_elem, size_t, fast_dim_block, hsize_t);
+
+ /* Check for blocks to operate on */
+ if(tot_blk_count > 0) {
+ size_t actual_bytes; /* The actual number of bytes to copy */
+
+ /* Set the number of actual bytes */
+ actual_bytes = actual_elem * elem_size;
+
+ /* Check for 1-dim selection */
+ if(0 == fast_dim) {
+ /* Sanity checks */
+ HDassert(1 == tot_blk_count);
+ HDassert(io_left == actual_elem);
+
+ /* Store the sequence information */
+ *off++ = loc;
+ *len++ = actual_bytes;
+ } /* end if */
+ else {
+ hsize_t skip_slab; /* Temporary copy of slab[fast_dim - 1] */
+ size_t blk_count; /* Total number of blocks left to output */
+
+ /* Find first dimension w/block >1 */
+ skip_dim = fast_dim;
+ for(i = (int)(fast_dim - 1); i >= 0; i--)
+ if(tdiminfo[i].block > 1) {
+ skip_dim = (unsigned)i;
+ break;
+ } /* end if */
+ skip_slab = slab[skip_dim];
+
+ /* Check for being able to use fast algorithm for 1-D */
+ if(0 == skip_dim) {
+ /* Create sequences until an entire row can't be used */
+ blk_count = tot_blk_count;
+ while(blk_count > 0) {
+ /* Store the sequence information */
+ *off++ = loc;
+ *len++ = actual_bytes;
+
+ /* Increment offset in destination buffer */
+ loc += skip_slab;
+
+ /* Decrement block count */
+ blk_count--;
+ } /* end while */
+
+ /* Move to the next location */
+ offset[skip_dim] += tot_blk_count;
+ } /* end if */
+ else {
+ hsize_t tmp_block[H5S_MAX_RANK]; /* Temporary block offset */
+ hsize_t skip[H5S_MAX_RANK]; /* Bytes to skip between blocks */
+ int temp_dim; /* Temporary rank holder */
+
+ /* Set the starting block location */
+ for(u = 0; u < ndims; u++)
+ tmp_block[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
+
+ /* Compute the amount to skip between sequences */
+ for(u = 0; u < ndims; u++)
+ skip[u] = (mem_size[u] - tdiminfo[u].block) * slab[u];
+
+ /* Create sequences until an entire row can't be used */
+ blk_count = tot_blk_count;
+ while(blk_count > 0) {
+ /* Store the sequence information */
+ *off++ = loc;
+ *len++ = actual_bytes;
+
+ /* Set temporary dimension for advancing offsets */
+ temp_dim = (int)skip_dim;
+
+ /* Increment offset in destination buffer */
+ loc += skip_slab;
+
+ /* Increment the offset and count for the other dimensions */
+ while(temp_dim >= 0) {
+ /* Move to the next row in the curent dimension */
+ offset[temp_dim]++;
+ tmp_block[temp_dim]++;
+
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
+ break;
+ else {
+ offset[temp_dim] = base_offset[temp_dim];
+ loc += skip[temp_dim];
+ tmp_block[temp_dim] = 0;
+ } /* end else */
+
+ /* Decrement dimension count */
+ temp_dim--;
+ } /* end while */
+
+ /* Decrement block count */
+ blk_count--;
+ } /* end while */
+ } /* end else */
+ } /* end else */
+
+ /* Update the iterator, if there were any blocks used */
+
+ /* Decrement the number of elements left in selection */
+ iter->elmt_left -= tot_blk_count * actual_elem;
+
+ /* Check if there are elements left in iterator */
+ if(iter->elmt_left > 0) {
+ /* Update the iterator with the location we stopped */
+ /* (Subtract out the selection offset) */
+ for(u = 0; u < ndims; u++)
+ iter->u.hyp.off[u] = (hsize_t)((hssize_t)offset[u] - sel_off[u]);
+ } /* end if */
+
+ /* Increment the number of sequences generated */
+ *nseq += tot_blk_count;
+
+ /* Increment the number of elements used */
+ *nelem += tot_blk_count * actual_elem;
+ } /* end if */
+
+ /* Check for partial block, with room for another sequence */
+ if(io_left > (tot_blk_count * actual_elem) && tot_blk_count < maxseq) {
+ size_t elmt_remainder; /* Elements remaining */
+
+ /* Compute elements left */
+ elmt_remainder = io_left - (tot_blk_count * actual_elem);
+ HDassert(elmt_remainder < fast_dim_block);
+ HDassert(elmt_remainder > 0);
+
+ /* Store the sequence information */
+ *off++ = loc;
+ *len++ = elmt_remainder * elem_size;
+
+ /* Update the iterator with the location we stopped */
+ iter->u.hyp.off[fast_dim] += (hsize_t)elmt_remainder;
+
+ /* Decrement the number of elements left in selection */
+ iter->elmt_left -= elmt_remainder;
+
+ /* Increment the number of sequences generated */
+ (*nseq)++;
+
+ /* Increment the number of elements used */
+ *nelem += elmt_remainder;
+ } /* end if */
+
+ /* Sanity check */
+ HDassert(*nseq > 0);
+ HDassert(*nelem > 0);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__hyper_get_seq_list_single() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__hyper_get_seq_list
+ PURPOSE
+ Create a list of offsets & lengths for a selection
+ USAGE
+ herr_t H5S__hyper_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
+ H5S_t *space; IN: Dataspace containing selection to use.
+ unsigned flags; IN: Flags for extra information about operation
+ H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
+ position of interest in selection.
+ size_t maxseq; IN: Maximum number of sequences to generate
+ size_t maxelem; IN: Maximum number of elements to include in the
+ generated sequences
+ size_t *nseq; OUT: Actual number of sequences generated
+ size_t *nelem; OUT: Actual number of elements in sequences generated
+ hsize_t *off; OUT: Array of offsets (in bytes)
+ size_t *len; OUT: Array of lengths (in bytes)
+ RETURNS
+ Non-negative on success/Negative on failure.
+ DESCRIPTION
+ Use the selection in the dataspace to generate a list of byte offsets and
+ lengths for the region(s) selected. Start/Restart from the position in the
+ ITER parameter. The number of sequences generated is limited by the MAXSEQ
+ parameter and the number of sequences actually generated is stored in the
+ NSEQ parameter.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__hyper_get_seq_list(const H5S_t *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t *iter,
+ size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
+ hsize_t *off, size_t *len)
+{
+ herr_t ret_value = FAIL; /* return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(space);
+ HDassert(iter);
+ HDassert(iter->elmt_left > 0);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
+ HDassert(space->select.sel_info.hslab->unlim_dim < 0);
+
+ /* Check for the special case of just one H5Sselect_hyperslab call made */
+ if(space->select.sel_info.hslab->diminfo_valid) {
+ const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
+ const hssize_t *sel_off; /* Selection offset in dataspace */
+ hsize_t *mem_size; /* Size of the source buffer */
+ unsigned ndims; /* Number of dimensions of dataset */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ hbool_t single_block; /* Whether the selection is a single block */
+ unsigned u; /* Local index variable */
+
+ /* Set a local copy of the diminfo pointer */
+ tdiminfo = iter->u.hyp.diminfo;
+
+ /* Check if this is a "flattened" regular hyperslab selection */
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < space->extent.rank) {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = iter->u.hyp.iter_rank;
+
+ /* Set the local copy of the selection offset */
+ sel_off = iter->u.hyp.sel_off;
+
+ /* Set up the pointer to the size of the memory space */
+ mem_size = iter->u.hyp.size;
+ } /* end if */
+ else {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = space->extent.rank;
+
+ /* Set the local copy of the selection offset */
+ sel_off = space->select.offset;
+
+ /* Set up the pointer to the size of the memory space */
+ mem_size = space->extent.size;
+ } /* end else */
+ fast_dim = ndims - 1;
+
+ /* Check if we stopped in the middle of a sequence of elements */
+ if((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride != 0 ||
+ ((iter->u.hyp.off[fast_dim] != tdiminfo[fast_dim].start) && tdiminfo[fast_dim].count == 1)) {
+ hsize_t slab[H5S_MAX_RANK]; /* Hyperslab size */
+ hsize_t loc; /* Coordinate offset */
+ hsize_t acc; /* Accumulator */
+ size_t leftover; /* The number of elements left over from the last sequence */
+ size_t actual_elem; /* The actual number of elements to count */
+ size_t elem_size; /* Size of each element iterating over */
+ int i; /* Local index variable */
+
+
+ /* Calculate the number of elements left in the sequence */
+ if(tdiminfo[fast_dim].count == 1) {
+ H5_CHECKED_ASSIGN(leftover, size_t, tdiminfo[fast_dim].block - (iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start), hsize_t);
+ } /* end if */
+ else {
+ H5_CHECKED_ASSIGN(leftover, size_t, tdiminfo[fast_dim].block - ((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride), hsize_t);
+ } /* end else */
+
+ /* Make certain that we don't write too many */
+ actual_elem = MIN3(leftover, (size_t)iter->elmt_left, maxelem);
+
+ /* Initialize row sizes for each dimension */
+ elem_size = iter->elmt_size;
+ for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
+ slab[i] = acc;
+ acc *= mem_size[i];
+ } /* end for */
+
+ /* Compute the initial buffer offset */
+ for(u = 0, loc = 0; u < ndims; u++)
+ loc += ((hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u])) * slab[u];
+
+ /* Add a new sequence */
+ off[0] = loc;
+ H5_CHECKED_ASSIGN(len[0], size_t, actual_elem * elem_size, hsize_t);
+
+ /* Increment sequence array locations */
+ off++;
+ len++;
+
+ /* Advance the hyperslab iterator */
+ H5S__hyper_iter_next(iter, actual_elem);
+
+ /* Decrement the number of elements left in selection */
+ iter->elmt_left -= actual_elem;
+
+ /* Decrement element/sequence limits */
+ maxelem -= actual_elem;
+ maxseq--;
+
+ /* Set the number of sequences generated and elements used */
+ *nseq = 1;
+ *nelem = actual_elem;
+
+ /* Check for using up all the sequences/elements */
+ if(0 == iter->elmt_left || 0 == maxelem || 0 == maxseq)
+ return(SUCCEED);
+ } /* end if */
+ else {
+ /* Reset the number of sequences generated and elements used */
+ *nseq = 0;
+ *nelem = 0;
+ } /* end else */
+
+ /* Check for a single block selected */
+ single_block = TRUE;
+ for(u = 0; u < ndims; u++)
+ if(1 != tdiminfo[u].count) {
+ single_block = FALSE;
+ break;
+ } /* end if */
+
+ /* Check for single block selection */
+ if(single_block)
+ /* Use single-block optimized call to generate sequence list */
+ ret_value = H5S__hyper_get_seq_list_single(space, iter, maxseq, maxelem, nseq, nelem, off, len);
+ else
+ /* Use optimized call to generate sequence list */
+ ret_value = H5S__hyper_get_seq_list_opt(space, iter, maxseq, maxelem, nseq, nelem, off, len);
+ } /* end if */
+ else
+ /* Call the general sequence generator routine */
+ ret_value = H5S__hyper_get_seq_list_gen(space, iter, maxseq, maxelem, nseq, nelem, off, len);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__hyper_get_seq_list() */
/*--------------------------------------------------------------------------
@@ -1090,8 +2428,7 @@ H5S__hyper_iter_release(H5S_sel_iter_t *iter)
/* Check args */
HDassert(iter);
-/* Release the information needed for non-regular hyperslab I/O */
- /* Free the copy of the selections span tree */
+ /* Free the copy of the hyperslab selection span tree */
if(iter->u.hyp.spans != NULL)
H5S__hyper_free_span_info(iter->u.hyp.spans);
@@ -1110,7 +2447,7 @@ H5S__hyper_iter_release(H5S_sel_iter_t *iter)
H5S_hyper_span_info_t *down; IN: Down span tree for new node
H5S_hyper_span_t *next; IN: Next span for new node
RETURNS
- Pointer to next span node on success, NULL on failure
+ Pointer to new span node on success, NULL on failure
DESCRIPTION
Allocate and initialize a new hyperslab span node, filling in the low &
high bounds, the down span and next span pointers also. Increment the
@@ -1121,7 +2458,8 @@ H5S__hyper_iter_release(H5S_sel_iter_t *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_hyper_span_t *
-H5S__hyper_new_span(hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next)
+H5S__hyper_new_span(hsize_t low, hsize_t high, H5S_hyper_span_info_t *down,
+ H5S_hyper_span_t *next)
{
H5S_hyper_span_t *ret_value = NULL; /* Return value */
@@ -1403,6 +2741,7 @@ H5S__hyper_copy_span(H5S_hyper_span_info_t *spans)
FUNC_ENTER_STATIC
+ /* Sanity check */
HDassert(spans);
/* Copy the hyperslab span tree */
@@ -1421,92 +2760,88 @@ done:
NAME
H5S__hyper_cmp_spans
PURPOSE
- Check if two hyperslab slabs are the same
+ Check if two hyperslab span trees are the same
USAGE
hbool_t H5S__hyper_cmp_spans(span1, span2)
- H5S_hyper_span_t *span1; IN: First span tree to compare
- H5S_hyper_span_t *span2; IN: Second span tree to compare
+ H5S_hyper_span_info_t *span_info1; IN: First span tree to compare
+ H5S_hyper_span_info_t *span_info2; IN: Second span tree to compare
RETURNS
TRUE (1) or FALSE (0) on success, can't fail
DESCRIPTION
- Compare two hyperslab slabs to determine if they refer to the same
- selection. If span1 & span2 are both NULL, that counts as equal
+ Compare two hyperslab span trees to determine if they refer to the same
+ selection. If span1 & span2 are both NULL, that counts as equal.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static hbool_t
-H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_span_info_t *span_info2)
+static H5_ATTR_PURE hbool_t
+H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1,
+ const H5S_hyper_span_info_t *span_info2)
{
hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_STATIC_NOERR
- /* Check for redundant comparison */
+ /* Check for redundant comparison (or both spans being NULL) */
if(span_info1 == span_info2)
ret_value = TRUE;
else {
- const H5S_hyper_span_t *span1;
- const H5S_hyper_span_t *span2;
-
- /* Check for both spans being NULL */
- if(span_info1 == NULL && span_info2 == NULL)
- ret_value = TRUE;
+ /* Check for one span being NULL */
+ if(span_info1 == NULL || span_info2 == NULL)
+ ret_value = FALSE;
else {
- /* Check for one span being NULL */
- if(span_info1 == NULL || span_info2 == NULL)
- ret_value = FALSE;
- else {
- /* Get the pointers to the actual lists of spans */
- span1 = span_info1->head;
- span2 = span_info2->head;
-
- /* Sanity checking */
- HDassert(span1);
- HDassert(span2);
-
- /* infinite loop which must be broken out of */
- while(1) {
- /* Check for both spans being NULL */
- if(span1 == NULL && span2 == NULL) {
- ret_value = TRUE;
+ const H5S_hyper_span_t *span1;
+ const H5S_hyper_span_t *span2;
+
+ /* Get the pointers to the actual lists of spans */
+ span1 = span_info1->head;
+ span2 = span_info2->head;
+
+ /* Sanity checking */
+ HDassert(span1);
+ HDassert(span2);
+
+ /* infinite loop which must be broken out of */
+ while(1) {
+ /* Check for both spans being NULL */
+ if(span1 == NULL && span2 == NULL) {
+ ret_value = TRUE;
+ break;
+ } /* end if */
+ else {
+ /* Check for one span being NULL */
+ if(span1 == NULL || span2 == NULL) {
+ ret_value = FALSE;
break;
} /* end if */
else {
- /* Check for one span being NULL */
- if(span1 == NULL || span2 == NULL) {
+ /* Check if the actual low & high span information is the same */
+ if(span1->low != span2->low || span1->high != span2->high) {
ret_value = FALSE;
break;
} /* end if */
else {
- /* Check if the actual low & high span information is the same */
- if(span1->low != span2->low || span1->high != span2->high) {
- ret_value = FALSE;
- break;
- } /* end if */
- else {
- if(span1->down != NULL || span2 != NULL) {
- if(!H5S__hyper_cmp_spans(span1->down, span2->down)) {
- ret_value = FALSE;
- break;
- } /* end if */
- else {
- /* Keep going... */
- } /* end else */
+ if(span1->down != NULL || span2 != NULL) {
+ if(!H5S__hyper_cmp_spans(span1->down, span2->down)) {
+ ret_value = FALSE;
+ break;
} /* end if */
else {
/* Keep going... */
} /* end else */
+ } /* end if */
+ else {
+ /* Keep going... */
} /* end else */
} /* end else */
} /* end else */
+ } /* end else */
- /* Advance to the next nodes in the span list */
- span1 = span1->next;
- span2 = span2->next;
- } /* end while */
- } /* end else */
+ /* Advance to the next nodes in the span list */
+ span1 = span1->next;
+ span2 = span2->next;
+ } /* end while */
} /* end else */
} /* end else */
@@ -1614,9 +2949,10 @@ done:
PURPOSE
Copy a selection from one dataspace to another
USAGE
- herr_t H5S__hyper_copy(dst, src)
+ herr_t H5S__hyper_copy(dst, src, share_selection)
H5S_t *dst; OUT: Pointer to the destination dataspace
H5S_t *src; IN: Pointer to the source dataspace
+ hbool_t; IN: Whether to share the selection between the dataspaces
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -2049,7 +3385,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans,
HDassert(spans);
HDassert(start);
HDassert(end);
- HDassert(rank < H5O_LAYOUT_NDIMS);
+ HDassert(rank < H5S_MAX_RANK);
HDassert(p && pp);
/* Walk through the list of spans, recursing or outputting them */
@@ -2092,7 +3428,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans,
*p = pp;
FUNC_LEAVE_NOAPI_VOID
-} /* H5S__hyper_serialize_helper() */
+} /* end H5S__hyper_serialize_helper() */
/*--------------------------------------------------------------------------
@@ -2174,8 +3510,8 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
/* Check for a "regular" hyperslab selection */
else if(space->select.sel_info.hslab->diminfo_valid) {
const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
- hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
- hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
+ hsize_t offset[H5S_MAX_RANK]; /* Offset of element in dataspace */
+ hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary hyperslab counts */
unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
unsigned ndims; /* Rank of the dataspace */
unsigned u; /* Local counting variable */
@@ -2265,8 +3601,8 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
} /* end while */
} /* end if */
else {
- hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
- hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */
+ hsize_t start[H5S_MAX_RANK]; /* Location of start of hyperslab */
+ hsize_t end[H5S_MAX_RANK]; /* Location of end of hyperslab */
/* Encode number of hyperslabs */
block_count = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst);
@@ -2322,8 +3658,8 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl
{
unsigned rank; /* Rank of points */
const uint8_t *pp; /* Local pointer for decoding */
- hsize_t start[H5O_LAYOUT_NDIMS]; /* Hyperslab start information */
- hsize_t block[H5O_LAYOUT_NDIMS]; /* Hyperslab block information */
+ hsize_t start[H5S_MAX_RANK]; /* Hyperslab start information */
+ hsize_t block[H5S_MAX_RANK]; /* Hyperslab block information */
unsigned u; /* Local counting variable */
herr_t ret_value = FAIL; /* Return value */
@@ -2341,8 +3677,8 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl
/* If there is an unlimited dimension, only encode opt_unlim_diminfo */
if(flags & H5S_SELECT_FLAG_UNLIM) {
- hsize_t stride[H5O_LAYOUT_NDIMS]; /* Hyperslab stride information */
- hsize_t count[H5O_LAYOUT_NDIMS]; /* Hyperslab count information */
+ hsize_t stride[H5S_MAX_RANK]; /* Hyperslab stride information */
+ hsize_t count[H5S_MAX_RANK]; /* Hyperslab count information */
/* Sanity checks */
HDassert(H5S_UNLIMITED == HSIZE_UNDEF);
@@ -2364,21 +3700,21 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl
else {
const hsize_t *stride; /* Hyperslab stride information */
const hsize_t *count; /* Hyperslab count information */
- hsize_t end[H5O_LAYOUT_NDIMS]; /* Hyperslab end information */
+ hsize_t end[H5S_MAX_RANK]; /* Hyperslab end information */
hsize_t *tstart; /* Temporary hyperslab pointers */
hsize_t *tend; /* Temporary hyperslab pointers */
hsize_t *tblock; /* Temporary hyperslab pointers */
- size_t num_elem; /* Number of elements in selection */
+ size_t block_count; /* Number of blocks in selection */
unsigned v; /* Local counting variable */
- /* Decode the number of points */
- UINT32DECODE(pp, num_elem);
+ /* Decode the number of blocks */
+ UINT32DECODE(pp, block_count);
/* Set the count & stride for all blocks */
stride = count = H5S_hyper_ones_g;
/* Retrieve the coordinates from the buffer */
- for(u = 0; u < num_elem; u++) {
+ for(u = 0; u < block_count; u++) {
/* Decode the starting points */
for(tstart = start, v = 0; v < rank; v++, tstart++)
UINT32DECODE(pp, *tstart);
@@ -2451,7 +3787,7 @@ H5S__hyper_span_blocklist(const H5S_hyper_span_info_t *spans, hsize_t start[],
/* Sanity checks */
HDassert(spans);
- HDassert(rank < H5O_LAYOUT_NDIMS);
+ HDassert(rank < H5S_MAX_RANK);
HDassert(start);
HDassert(end);
HDassert(startblock);
@@ -2555,8 +3891,8 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblo
/* Check for a "regular" hyperslab selection */
if(space->select.sel_info.hslab->diminfo_valid) {
const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
- hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
- hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
+ hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary hyperslab counts */
+ hsize_t offset[H5S_MAX_RANK]; /* Offset of element in dataspace */
unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
unsigned ndims; /* Rank of the dataspace */
hbool_t done; /* Whether we are done with the iteration */
@@ -2666,8 +4002,8 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblo
} /* end while */
} /* end if */
else {
- hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
- hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */
+ hsize_t start[H5S_MAX_RANK]; /* Location of start of hyperslab */
+ hsize_t end[H5S_MAX_RANK]; /* Location of end of hyperslab */
ret_value = H5S__hyper_span_blocklist(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, &startblock, &numblocks, &buf);
} /* end else */
@@ -2775,7 +4111,7 @@ H5S_hyper_bounds_helper(const H5S_hyper_span_info_t *spans, const hssize_t *offs
HDassert(spans);
HDassert(offset);
- HDassert(rank < H5O_LAYOUT_NDIMS);
+ HDassert(rank < H5S_MAX_RANK);
HDassert(start);
HDassert(end);
@@ -3079,7 +4415,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static htri_t
+static H5_ATTR_PURE htri_t
H5S__hyper_is_contiguous(const H5S_t *space)
{
hbool_t small_contiguous, /* Flag for small contiguous block */
@@ -3149,10 +4485,10 @@ H5S__hyper_is_contiguous(const H5S_t *space)
/*
* For a hyperslab to be contiguous, it must have only one block and
- * (either it's size must be the same as the dataspace extent's in all
- * but the slowest changing dimension
- * OR
- * block size must be 1 in all but the fastest changing dimension).
+ * either it's size must be the same as the dataspace extent's in all
+ * but the slowest changing dimension
+ * OR
+ * block size must be 1 in all but the fastest changing dimension.
*/
/* Initialize flags */
large_contiguous = TRUE; /* assume true and reset if the dimensions don't match */
@@ -3264,7 +4600,7 @@ H5S__hyper_is_contiguous(const H5S_t *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static htri_t
+static H5_ATTR_PURE htri_t
H5S__hyper_is_single(const H5S_t *space)
{
htri_t ret_value = TRUE; /* return value */
@@ -3283,10 +4619,9 @@ H5S__hyper_is_single(const H5S_t *space)
*/
/* Check for a single block */
- for(u = 0; u < space->extent.rank; u++) {
+ for(u = 0; u < space->extent.rank; u++)
if(space->select.sel_info.hslab->opt_diminfo[u].count > 1)
HGOTO_DONE(FALSE)
- } /* end for */
} /* end if */
else {
H5S_hyper_span_info_t *spans; /* Hyperslab span info node */
@@ -3893,125 +5228,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_hyper_convert() */
-#ifdef LATER
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_hyper_intersect_helper
- PURPOSE
- Helper routine to detect intersections in span trees
- USAGE
- htri_t H5S_hyper_intersect_helper(spans1, spans2)
- H5S_hyper_span_info_t *spans1; IN: First span tree to operate with
- H5S_hyper_span_info_t *spans2; IN: Second span tree to operate with
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- Quickly detect intersections between two span trees
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static htri_t
-H5S_hyper_intersect_helper (H5S_hyper_span_info_t *spans1, H5S_hyper_span_info_t *spans2)
-{
- H5S_hyper_span_t *curr1; /* Pointer to current span in 1st span tree */
- H5S_hyper_span_t *curr2; /* Pointer to current span in 2nd span tree */
- htri_t status; /* Status from recursive call */
- htri_t ret_value=FALSE; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Sanity check */
- HDassert((spans1 && spans2) || (spans1 == NULL && spans2 == NULL));
-
- /* "NULL" span trees compare as overlapping */
- if(spans1==NULL && spans2==NULL)
- HGOTO_DONE(TRUE);
-
- /* Get the span lists for each span in this tree */
- curr1=spans1->head;
- curr2=spans2->head;
-
- /* Iterate over the spans in each tree */
- while(curr1!=NULL && curr2!=NULL) {
- /* Check for 1st span entirely before 2nd span */
- if(curr1->high<curr2->low)
- curr1=curr1->next;
- /* Check for 2nd span entirely before 1st span */
- else if(curr2->high<curr1->low)
- curr2=curr2->next;
- /* Spans must overlap */
- else {
- /* Recursively check spans in next dimension down */
- if((status=H5S_hyper_intersect_helper(curr1->down,curr2->down))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab intersection check")
-
- /* If there is a span intersection in the down dimensions, the span trees overlap */
- if(status==TRUE)
- HGOTO_DONE(TRUE);
-
- /* No intersection in down dimensions, advance to next span */
- if(curr1->high<curr2->high)
- curr1=curr1->next;
- else
- curr2=curr2->next;
- } /* end else */
- } /* end while */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_hyper_intersect_helper() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_hyper_intersect
- PURPOSE
- Detect intersections in span trees
- USAGE
- htri_t H5S_hyper_intersect(space1, space2)
- H5S_t *space1; IN: First dataspace to operate on span tree
- H5S_t *space2; IN: Second dataspace to operate on span tree
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- Quickly detect intersections between two span trees
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-htri_t
-H5S_hyper_intersect (H5S_t *space1, H5S_t *space2)
-{
- htri_t ret_value=FAIL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Sanity check */
- HDassert(space1);
- HDassert(space2);
-
- /* Check that the space selections both have span trees */
- if(space1->select.sel_info.hslab->span_lst==NULL ||
- space2->select.sel_info.hslab->span_lst==NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
-
- /* Check that the dataspaces are both the same rank */
- if(space1->extent.rank!=space2->extent.rank)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "dataspace ranks don't match")
-
- /* Perform the span-by-span intersection check */
- if((ret_value=H5S_hyper_intersect_helper(space1->select.sel_info.hslab->span_lst,space2->select.sel_info.hslab->span_lst))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab intersection check")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_hyper_intersect() */
-#endif /* LATER */
-
/*--------------------------------------------------------------------------
NAME
@@ -4019,13 +5235,12 @@ done:
PURPOSE
Helper routine to detect intersections in span trees
USAGE
- htri_t H5S_hyper_intersect_block_helper(spans, start, end)
+ hbool_t H5S__hyper_intersect_block_helper(spans, start, end)
H5S_hyper_span_info_t *spans; IN: First span tree to operate with
- hssize_t *offset; IN: Selection offset coordinate
hsize_t *start; IN: Starting coordinate for block
hsize_t *end; IN: Ending coordinate for block
RETURN
- Non-negative on success, negative on failure
+ Non-negative (TRUE/FALSE) on success, can't fail
DESCRIPTION
Quickly detect intersections between span tree and block
GLOBAL VARIABLES
@@ -4248,7 +5463,7 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset)
* Purpose: Projects a single element hyperslab selection into a scalar
* dataspace
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -4311,7 +5526,7 @@ H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset)
* Purpose: Projects a hyperslab selection onto/into a simple dataspace
* of a lower rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -4358,7 +5573,7 @@ H5S__hyper_project_simple_lower(const H5S_t *base_space, H5S_t *new_space)
* Purpose: Projects a hyperslab selection onto/into a simple dataspace
* of a higher rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -4369,6 +5584,7 @@ static herr_t
H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space)
{
H5S_hyper_span_t *prev_span = NULL; /* Pointer to previous list of spans */
+ unsigned delta_rank; /* Difference in dataspace ranks */
unsigned curr_dim; /* Current dimension being operated on */
herr_t ret_value = SUCCEED; /* Return value */
@@ -4382,7 +5598,8 @@ H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space)
/* Create nodes until reaching the correct # of dimensions */
new_space->select.sel_info.hslab->span_lst = NULL;
curr_dim = 0;
- while(curr_dim < (new_space->extent.rank - base_space->extent.rank)) {
+ delta_rank = (new_space->extent.rank - base_space->extent.rank);
+ while(curr_dim < delta_rank) {
H5S_hyper_span_info_t *new_span_info; /* Pointer to list of spans */
H5S_hyper_span_t *new_span; /* Temporary hyperslab span */
@@ -4446,7 +5663,7 @@ done:
* Purpose: Projects a hyperslab selection onto/into a simple dataspace
* of a different rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -4454,7 +5671,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
+H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space,
+ hsize_t *offset)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4723,11 +5941,11 @@ done:
"Normalize" a hyperslab selection by adjusting it's coordinates by the
amount of the selection offset.
USAGE
- hbool_t H5S_hyper_normalize_offset(space, old_offset)
+ htri_t H5S_hyper_normalize_offset(space, old_offset)
H5S_t *space; IN/OUT: Pointer to dataspace to move
hssize_t *old_offset; OUT: Pointer to space to store old offset
RETURNS
- TRUE if space has been normalized, FALSE if not
+ TRUE/FALSE for hyperslab selection, FAIL on error
DESCRIPTION
Copies the current selection offset into the array provided, then
inverts the selection offset, subtracts the offset from the hyperslab
@@ -4740,7 +5958,7 @@ done:
htri_t
H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset)
{
- htri_t ret_value = FALSE; /* Return value */
+ htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -4943,9 +6161,10 @@ done:
DESCRIPTION
Clip one span tree ('a') against another span tree ('b'). Creates span
trees for the area defined by the 'a' span tree which does not overlap the
- 'b' span tree, the area defined by the overlap of the 'a' hyperslab span
- tree and the 'b' span tree, and the area defined by the 'b' hyperslab span
- tree which does not overlap the 'a' span tree.
+ 'b' span tree ("a not b"), the area defined by the overlap of the 'a'
+ hyperslab span tree and the 'b' span tree ("a and b"), and the area defined
+ by the 'b' hyperslab span tree which does not overlap the 'a' span
+ tree ("b not a").
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
@@ -5101,10 +6320,10 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Split off upper part of span 'b' at upper span of span 'a' */
/* Check if there is actually an upper part of span 'b' to split off */
- if(span_a->high<span_b->high) {
+ if(span_a->high < span_b->high) {
/* Allocate new span node for upper part of span 'b' */
if(NULL == (tmp_span = H5S__hyper_new_span(span_a->high + 1, span_b->high, span_b->down, span_b->next)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Advance span 'a' */
H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
@@ -5269,12 +6488,12 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
} /* end else */
/* Check if there is actually an upper part of span 'b' to split off */
- if(span_a->high<span_b->high) {
+ if(span_a->high < span_b->high) {
/* Split off upper part of span 'b' at upper span of span 'a' */
/* Allocate new span node for upper part of spans 'a' */
if(NULL == (tmp_span = H5S__hyper_new_span(span_a->high + 1, span_b->high, span_b->down, span_b->next)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span")
/* And advance span 'a' */
H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
@@ -5294,9 +6513,9 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* AAAAAAAAAA */
/* <-----------------------------------> */
/* BBBBBBBBBB */
- else if((span_a->low>=span_b->low && span_a->low<=span_b->high) && span_a->high>span_b->high) {
+ else if((span_a->low >= span_b->low && span_a->low <= span_b->high) && span_a->high > span_b->high) {
/* Check if there is actually a lower part of span 'b' to split off */
- if(span_a->low>span_b->low) {
+ if(span_a->low > span_b->low) {
/* Split off lower part of span 'b' at lower span of span 'a' */
/* Merge/add lower part of span 'b' with/to b_not_a list */
@@ -5364,7 +6583,7 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Allocate new span node for upper part of span 'a' */
if(NULL == (tmp_span = H5S__hyper_new_span(span_b->high + 1, span_a->high, span_a->down, span_a->next)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span")
/* Make upper part of span 'a' into new span 'a' */
H5S__hyper_recover_span(&recover_a,&span_a,tmp_span);
@@ -5448,12 +6667,6 @@ static H5S_hyper_span_info_t *
H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_spans)
{
H5S_hyper_span_info_t *merged_spans = NULL; /* Pointer to the merged span tree */
- H5S_hyper_span_info_t *tmp_spans; /* Pointer to temporary new span tree */
- H5S_hyper_span_t *tmp_span; /* Pointer to temporary new span */
- H5S_hyper_span_t *span_a; /* Pointer to current span 'a' working on */
- H5S_hyper_span_t *span_b; /* Pointer to current span 'b' working on */
- H5S_hyper_span_t *prev_span_merge; /* Pointer to previous merged span */
- hbool_t recover_a, recover_b; /* Flags to indicate when to recover temporary spans */
H5S_hyper_span_info_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -5472,6 +6685,11 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
} /* end else */
} /* end if */
else {
+ H5S_hyper_span_t *span_a; /* Pointer to current span 'a' working on */
+ H5S_hyper_span_t *span_b; /* Pointer to current span 'b' working on */
+ H5S_hyper_span_t *prev_span_merge; /* Pointer to previous merged span */
+ hbool_t recover_a, recover_b; /* Flags to indicate when to recover temporary spans */
+
/* Get the pointers to the 'a' and 'b' span lists */
span_a = a_spans->head;
span_b = b_spans->head;
@@ -5484,6 +6702,9 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* Work through the list of spans in the new list */
while(span_a != NULL && span_b != NULL) {
+ H5S_hyper_span_info_t *tmp_spans; /* Pointer to temporary new span tree */
+ H5S_hyper_span_t *tmp_span; /* Pointer to temporary new span */
+
/* Check if the 'a' span is completely before 'b' span */
/* AAAAAAA */
/* <-----------------------------------> */
@@ -5766,7 +6987,7 @@ done:
static herr_t
H5S__hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t can_own)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
@@ -5852,12 +7073,12 @@ H5S__hyper_spans_nelem(const H5S_hyper_span_info_t *spans)
Create a span tree
USAGE
H5S_hyper_span_t *H5S__hyper_make_spans(rank, start, stride, count, block)
- unsigned rank; IN: # of dimensions of the space
- const hsize_t *start; IN: Starting location of the hyperslabs
- const hsize_t *stride; IN: Stride from the beginning of one block to
+ unsigned rank; IN: # of dimensions of the space
+ const hsize_t *start; IN: Starting location of the hyperslabs
+ const hsize_t *stride; IN: Stride from the beginning of one block to
the next
- const hsize_t *count; IN: Number of blocks
- const hsize_t *block; IN: Size of hyperslab block
+ const hsize_t *count; IN: Number of blocks
+ const hsize_t *block; IN: Size of hyperslab block
RETURNS
Pointer to new span tree on success, NULL on failure
DESCRIPTION
@@ -6141,7 +7362,7 @@ done:
static hbool_t
H5S__hyper_rebuild(H5S_t *space)
{
- H5S_hyper_dim_t top_span_slab_info[H5O_LAYOUT_NDIMS];
+ H5S_hyper_dim_t top_span_slab_info[H5S_MAX_RANK];
unsigned rank, curr_dim;
hbool_t ret_value = TRUE; /* Return value */
@@ -6203,12 +7424,12 @@ done:
static herr_t
H5S__hyper_generate_spans(H5S_t *space)
{
- hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
- hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
- hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
- hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t tmp_start[H5S_MAX_RANK]; /* Temporary start information */
+ hsize_t tmp_stride[H5S_MAX_RANK]; /* Temporary stride information */
+ hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary count information */
+ hsize_t tmp_block[H5S_MAX_RANK]; /* Temporary block information */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -6240,7 +7461,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_generate_spans() */
-#ifndef NEW_HYPERSLAB_API
/*-------------------------------------------------------------------------
* Function: H5S__generate_hyperlab
@@ -6249,19 +7469,14 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol (split from HS_select_hyperslab()).
+ * Programmer: Quincey Koziol
* Tuesday, September 12, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__generate_hyperslab (H5S_t *space, H5S_seloper_t op,
- const hsize_t start[],
- const hsize_t stride[],
- const hsize_t count[],
- const hsize_t block[])
+H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
+ const hsize_t stride[], const hsize_t count[], const hsize_t block[])
{
H5S_hyper_span_info_t *new_spans=NULL; /* Span tree for new hyperslab */
H5S_hyper_span_info_t *a_not_b = NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */
@@ -6293,7 +7508,7 @@ H5S__generate_hyperslab (H5S_t *space, H5S_seloper_t op,
space->select.num_elem = H5S__hyper_spans_nelem(new_spans);
/* Indicate that the new_spans are owned */
- new_spans=NULL;
+ new_spans = NULL;
} /* end if */
else {
hbool_t updated_spans = FALSE; /* Whether the spans in the selection were modified */
@@ -6502,9 +7717,9 @@ herr_t
H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
const hsize_t *stride, const hsize_t count[], const hsize_t *block)
{
- hsize_t int_stride[H5O_LAYOUT_NDIMS]; /* Internal storage for stride information */
- hsize_t int_count[H5O_LAYOUT_NDIMS]; /* Internal storage for count information */
- hsize_t int_block[H5O_LAYOUT_NDIMS]; /* Internal storage for block information */
+ hsize_t int_stride[H5S_MAX_RANK]; /* Internal storage for stride information */
+ hsize_t int_count[H5S_MAX_RANK]; /* Internal storage for count information */
+ hsize_t int_block[H5S_MAX_RANK]; /* Internal storage for block information */
const hsize_t *opt_stride; /* Optimized stride information */
const hsize_t *opt_count; /* Optimized count information */
const hsize_t *opt_block; /* Optimized block information */
@@ -6528,9 +7743,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
if(block == NULL)
block = H5S_hyper_ones_g;
- /*
- * Check new selection.
- */
+ /* Check new selection */
for(u = 0; u < space->extent.rank; u++) {
/* Check for overlapping hyperslab blocks in new selection. */
if(count[u] > 1 && stride[u] < block[u])
@@ -6566,7 +7779,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
if(unlim_dim >= 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "cannot have more than one unlimited dimension in selection")
else {
- if(count[u] == block[u] /* == H5S_UNLIMITED */)
+ if(count[u] == block[u]) /* Both are H5S_UNLIMITED */
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "count and block cannot both be unlimited")
unlim_dim = (int)u;
} /* end else */
@@ -6795,7 +8008,8 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds")
/* Patch count and block to remove unlimited and include the
- * existing selection */
+ * existing selection.
+ */
H5S__hyper_get_clip_diminfo(start[unlim_dim], opt_stride[unlim_dim], &tmp_count, &tmp_block, bounds_end[unlim_dim] + (hsize_t)1);
HDassert((tmp_count == 1) || (opt_count != H5S_hyper_ones_g));
HDassert((tmp_block == 1) || (opt_block != H5S_hyper_ones_g));
@@ -6895,2342 +8109,6 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Sselect_hyperslab() */
-#else /* NEW_HYPERSLAB_API */ /* Works */
-
-/*-------------------------------------------------------------------------
- * Function: H5S_operate_hyperslab
- *
- * Purpose: Combines two hyperslabs with an operation, putting the
- * result into a third hyperslab selection
- *
- * Return: non-negative on success/NULL on failure
- *
- * Programmer: Quincey Koziol
- * Tuesday, October 30, 2001
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper_t op, H5S_hyper_span_info_t *spans2,
- hbool_t can_own_span2, hbool_t *span2_owned)
-{
- H5S_hyper_span_info_t *a_not_b=NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */
- H5S_hyper_span_info_t *a_and_b=NULL; /* Span tree for hyperslab spans in both old and new span trees */
- H5S_hyper_span_info_t *b_not_a=NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- HDassert(result);
- HDassert(spans2);
- HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
-
- /* Just copy the selection from spans2 if we are setting the selection */
- /* ('space1' to 'result' aliasing happens at the next layer up) */
- if(op==H5S_SELECT_SET) {
- if(H5S__hyper_merge_spans(result,spans2,can_own_span2)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem = H5S__hyper_spans_nelem(spans2);
-
- /* Indicate that we took ownership of span2, if allowed */
- if(can_own_span2)
- *span2_owned=TRUE;
- } /* end if */
- else {
- hbool_t updated_spans = FALSE; /* Whether the spans in the selection were modified */
-
- HDassert(spans1);
-
- /* Generate lists of spans which overlap and don't overlap */
- if(H5S__hyper_clip_spans(spans1,spans2,&a_not_b,&a_and_b,&b_not_a)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
-
- /* Switch on the operation */
- switch(op) {
- case H5S_SELECT_OR:
- /* Copy spans from spans1 to current selection */
- if(spans1!=NULL) {
- if(H5S__hyper_merge_spans(result,spans1,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem = H5S__hyper_spans_nelem(spans1);
- } /* end if */
-
- /* Add any new spans from spans2 to current selection */
- if(b_not_a!=NULL) {
- if(H5S__hyper_merge_spans(result,b_not_a,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem += H5S__hyper_spans_nelem(b_not_a);
-
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- break;
-
- case H5S_SELECT_AND:
- /* Check if there are any overlapped selections */
- if(a_and_b!=NULL) {
- if(H5S__hyper_merge_spans(result,a_and_b,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem = H5S__hyper_spans_nelem(a_and_b);
-
- /* Indicate that the result owns the a_and_b spans */
- a_and_b=NULL;
-
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- break;
-
- case H5S_SELECT_XOR:
- /* Check if there are any non-overlapped selections */
- if(a_not_b!=NULL) {
- if(H5S__hyper_merge_spans(result,a_not_b,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem = H5S__hyper_spans_nelem(a_not_b);
-
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- if(b_not_a!=NULL) {
- if(H5S__hyper_merge_spans(result,b_not_a,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem += H5S__hyper_spans_nelem(b_not_a);
-
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- break;
-
- case H5S_SELECT_NOTB:
- /* Check if there are any non-overlapped selections */
- if(a_not_b!=NULL) {
- if(H5S__hyper_merge_spans(result,a_not_b,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem = H5S__hyper_spans_nelem(a_not_b);
-
- /* Indicate that the result owns the a_not_b spans */
- a_not_b=NULL;
-
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- break;
-
- case H5S_SELECT_NOTA:
- /* Check if there are any non-overlapped selections */
- if(b_not_a!=NULL) {
- if(H5S__hyper_merge_spans(result,b_not_a,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the number of elements in current selection */
- result->select.num_elem = H5S__hyper_spans_nelem(b_not_a);
-
- /* Indicate that the result owns the b_not_a spans */
- b_not_a=NULL;
-
- /* Indicate that the spans were updated */
- updated_spans = TRUE;
- } /* end if */
- break;
-
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- } /* end switch */
-
- /* Free the hyperslab trees generated from the clipping algorithm */
- if(a_not_b)
- H5S__hyper_free_span_info(a_not_b);
- if(a_and_b)
- H5S__hyper_free_span_info(a_and_b);
- if(b_not_a)
- H5S__hyper_free_span_info(b_not_a);
-
- /* Check if the resulting hyperslab span tree is empty */
- if(result->select.sel_info.hslab->span_lst==NULL) {
- H5S_hyper_span_info_t *spans; /* Empty hyperslab span tree */
-
- /* Sanity check */
- HDassert(result->select.num_elem == 0);
-
- /* Allocate a span info node */
- if((spans = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
-
- /* Set the reference count */
- spans->count=1;
-
- /* Reset the scratch pad space */
- spans->scratch=0;
-
- /* Set to empty tree */
- spans->head=NULL;
-
- /* Set pointer to empty span tree */
- result->select.sel_info.hslab->span_lst=spans;
- } /* end if */
- else {
- /* Check if we updated the spans */
- if(updated_spans) {
- /* Attempt to rebuild "optimized" start/stride/count/block information.
- * from resulting hyperslab span tree
- */
- H5S__hyper_rebuild(result);
- } /* end if */
- } /* end else */
- } /* end else */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_operate_hyperslab() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5S_generate_hyperlab
- *
- * Purpose: Generate hyperslab information from H5S_select_hyperslab()
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol (split from HS_select_hyperslab()).
- * Tuesday, September 12, 2000
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
- const hsize_t stride[], const hsize_t count[], const hsize_t block[])
-{
- H5S_hyper_span_info_t *new_spans=NULL; /* Span tree for new hyperslab */
- H5S_hyper_span_info_t *tmp_spans=NULL; /* Temporary copy of selection */
- hbool_t span2_owned=FALSE; /* Flag to indicate that span2 was used in H5S_operate_hyperslab() */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- HDassert(space);
- HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
- HDassert(start);
- HDassert(stride);
- HDassert(count);
- HDassert(block);
-
- /* Generate span tree for new hyperslab information */
- if(NULL == (new_spans = H5S__hyper_make_spans(space->extent.rank, start, stride, count, block)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information")
-
- /* Copy the original dataspace */
- if(space->select.sel_info.hslab->span_lst!=NULL) {
- /* Take ownership of the dataspace's hyperslab spans */
- /* (These are freed later) */
- tmp_spans=space->select.sel_info.hslab->span_lst;
- space->select.sel_info.hslab->span_lst=NULL;
-
- /* Reset the other dataspace selection information */
- if(H5S_SELECT_RELEASE(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection")
-
- /* Allocate space for the hyperslab selection information */
- if((space->select.sel_info.hslab=H5FL_MALLOC(H5S_hyper_sel_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
-
- /* Set unlim_dim */
- space->select.sel_info.hslab->unlim_dim = -1;
- } /* end if */
-
- /* Combine tmp_space (really space) & new_space, with the result in space */
- if(H5S_operate_hyperslab(space,tmp_spans,op,new_spans,TRUE,&span2_owned)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
-
-done:
- /* Free temporary data structures */
- if(tmp_spans!=NULL)
- if(H5S__hyper_free_span_info(tmp_spans)<0)
- HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
- if(new_spans!=NULL && span2_owned==FALSE)
- if(H5S__hyper_free_span_info(new_spans)<0)
- HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S__generate_hyperslab() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5S_select_hyperslab
- *
- * Purpose: Internal version of H5Sselect_hyperslab().
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Wednesday, January 10, 2001
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
- const hsize_t start[],
- const hsize_t *stride,
- const hsize_t count[],
- const hsize_t *block)
-{
- hsize_t int_stride[H5O_LAYOUT_NDIMS]; /* Internal storage for stride information */
- hsize_t int_count[H5O_LAYOUT_NDIMS]; /* Internal storage for count information */
- hsize_t int_block[H5O_LAYOUT_NDIMS]; /* Internal storage for block information */
- const hsize_t *opt_stride; /* Optimized stride information */
- const hsize_t *opt_count; /* Optimized count information */
- const hsize_t *opt_block; /* Optimized block information */
- unsigned u; /* Counters */
- int unlim_dim = -1; /* Unlimited dimension in selection, of -1 if none */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check args */
- HDassert(space);
- HDassert(start);
- HDassert(count);
- HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
-
- /* Point to the correct stride values */
- if(stride==NULL)
- stride = H5S_hyper_ones_g;
-
- /* Point to the correct block values */
- if(block==NULL)
- block = H5S_hyper_ones_g;
-
- /* Check for unlimited dimension */
- for(u = 0; u<space->extent.rank; u++)
- if((count[u] == H5S_UNLIMITED) || (block[u] == H5S_UNLIMITED)) {
- if(unlim_dim >= 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "cannot have more than one unlimited dimension in selection")
- else {
- if(count[u] == block[u] /* == H5S_UNLIMITED */)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "count and block cannot both be unlimited")
- unlim_dim = (int)u;
- } /* end else */
- } /* end if */
-
- /*
- * Check new selection.
- */
- for(u=0; u<space->extent.rank; u++) {
- /* Check for overlapping hyperslab blocks in new selection. */
- if(count[u]>1 && stride[u]<block[u])
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap")
-
- /* Detect zero-sized hyperslabs in new selection */
- if(count[u] == 0 || block[u] == 0) {
- switch(op) {
- case H5S_SELECT_SET: /* Select "set" operation */
- case H5S_SELECT_AND: /* Binary "and" operation for hyperslabs */
- case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
- /* Convert to "none" selection */
- if(H5S_select_none(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
- HGOTO_DONE(SUCCEED);
-
- case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */
- case H5S_SELECT_XOR: /* Binary "xor" operation for hyperslabs */
- case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */
- HGOTO_DONE(SUCCEED); /* Selection stays same */
-
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- } /* end switch */
- } /* end if */
- } /* end for */
-
- /* Optimize hyperslab parameters to merge contiguous blocks, etc. */
- if(stride == H5S_hyper_ones_g && block == H5S_hyper_ones_g) {
- /* Point to existing arrays */
- opt_stride = H5S_hyper_ones_g;
- opt_count = H5S_hyper_ones_g;
- opt_block = count;
- } /* end if */
- else {
- /* Point to local arrays */
- opt_stride = int_stride;
- opt_count = int_count;
- opt_block = int_block;
- for(u=0; u<space->extent.rank; u++) {
- /* contiguous hyperslabs have the block size equal to the stride */
- if((stride[u] == block[u]) && (count[u] != H5S_UNLIMITED)) {
- int_count[u]=1;
- int_stride[u]=1;
- if(block[u]==1)
- int_block[u]=count[u];
- else
- int_block[u]=block[u]*count[u];
- } /* end if */
- else {
- if(count[u]==1)
- int_stride[u]=1;
- else {
- HDassert((stride[u] > block[u]) || ((stride[u] == block[u])
- && (count[u] == H5S_UNLIMITED)));
- int_stride[u]=stride[u];
- } /* end else */
- int_count[u]=count[u];
- int_block[u]=block[u];
- } /* end else */
- } /* end for */
- } /* end else */
-
- /* Check for operating on unlimited selection */
- if((H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS)
- && (space->select.sel_info.hslab->unlim_dim >= 0)
- && (op != H5S_SELECT_SET))
- {
- /* Check for invalid operation */
- if(unlim_dim >= 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "cannot modify unlimited selection with another unlimited selection")
- if(!((op == H5S_SELECT_AND) || (op == H5S_SELECT_NOTA)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unsupported operation on unlimited selection")
- HDassert(space->select.sel_info.hslab->diminfo_valid);
-
- /* Clip unlimited selection to include new selection */
- if(H5S_hyper_clip_unlim(space,
- start[space->select.sel_info.hslab->unlim_dim]
- + ((opt_count[space->select.sel_info.hslab->unlim_dim]
- - (hsize_t)1)
- * opt_stride[space->select.sel_info.hslab->unlim_dim])
- + opt_block[space->select.sel_info.hslab->unlim_dim]) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection")
-
- /* If an empty space was returned it must be "none" */
- HDassert((space->select.num_elem > (hsize_t)0)
- || (space->select.type->type == H5S_SEL_NONE));
- } /* end if */
-
- /* Fixup operation for non-hyperslab selections */
- switch(H5S_GET_SELECT_TYPE(space)) {
- case H5S_SEL_NONE: /* No elements selected in dataspace */
- switch(op) {
- case H5S_SELECT_SET: /* Select "set" operation */
- /* Change "none" selection to hyperslab selection */
- break;
-
- case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */
- case H5S_SELECT_XOR: /* Binary "xor" operation for hyperslabs */
- case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
- op=H5S_SELECT_SET; /* Maps to "set" operation when applied to "none" selection */
- break;
-
- case H5S_SELECT_AND: /* Binary "and" operation for hyperslabs */
- case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */
- HGOTO_DONE(SUCCEED); /* Selection stays "none" */
-
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- } /* end switch */
- break;
-
- case H5S_SEL_ALL: /* All elements selected in dataspace */
- switch(op) {
- case H5S_SELECT_SET: /* Select "set" operation */
- /* Change "all" selection to hyperslab selection */
- break;
-
- case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */
- HGOTO_DONE(SUCCEED); /* Selection stays "all" */
-
- case H5S_SELECT_AND: /* Binary "and" operation for hyperslabs */
- op=H5S_SELECT_SET; /* Maps to "set" operation when applied to "none" selection */
- break;
-
- case H5S_SELECT_XOR: /* Binary "xor" operation for hyperslabs */
- case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */
- /* Convert current "all" selection to "real" hyperslab selection */
- /* Then allow operation to proceed */
- {
- hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
- hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
- hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
- hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
-
- /* Fill in temporary information for the dimensions */
- for(u=0; u<space->extent.rank; u++) {
- tmp_start[u]=0;
- tmp_stride[u]=1;
- tmp_count[u]=1;
- tmp_block[u]=space->extent.size[u];
- } /* end for */
-
- /* Convert to hyperslab selection */
- if(H5S_select_hyperslab(space,H5S_SELECT_SET,tmp_start,tmp_stride,tmp_count,tmp_block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
- } /* end case */
- break;
-
- case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
- /* Convert to "none" selection */
- if(H5S_select_none(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
- HGOTO_DONE(SUCCEED);
-
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- } /* end switch */
- break;
-
- case H5S_SEL_HYPERSLABS:
- /* Hyperslab operation on hyperslab selection, OK */
- break;
-
- case H5S_SEL_POINTS: /* Can't combine hyperslab operations and point selections currently */
- if(op==H5S_SELECT_SET) /* Allow only "set" operation to proceed */
- break;
- /* Else fall through to error */
-
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- } /* end switch */
-
-
- if(op==H5S_SELECT_SET) {
- /* If we are setting a new selection, remove current selection first */
- if(H5S_SELECT_RELEASE(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release hyperslab")
-
- /* Allocate space for the hyperslab selection information */
- if(NULL == (space->select.sel_info.hslab = H5FL_MALLOC(H5S_hyper_sel_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
-
- /* Save the diminfo */
- space->select.num_elem=1;
- for(u=0; u<space->extent.rank; u++) {
- space->select.sel_info.hslab->app_diminfo[u].start = start[u];
- space->select.sel_info.hslab->app_diminfo[u].stride = stride[u];
- space->select.sel_info.hslab->app_diminfo[u].count = count[u];
- space->select.sel_info.hslab->app_diminfo[u].block = block[u];
-
- space->select.sel_info.hslab->opt_diminfo[u].start = start[u];
- space->select.sel_info.hslab->opt_diminfo[u].stride = opt_stride[u];
- space->select.sel_info.hslab->opt_diminfo[u].count = opt_count[u];
- space->select.sel_info.hslab->opt_diminfo[u].block = opt_block[u];
-
- space->select.num_elem*=(opt_count[u]*opt_block[u]);
- } /* end for */
-
- /* Save unlim_dim */
- space->select.sel_info.hslab->unlim_dim = unlim_dim;
-
- /* Indicate that the dimension information is valid */
- space->select.sel_info.hslab->diminfo_valid = TRUE;
-
- /* Indicate that there's no slab information */
- space->select.sel_info.hslab->span_lst = NULL;
-
- /* Handle unlimited selections */
- if(unlim_dim >= 0) {
- /* Calculate num_elem_non_unlim */
- space->select.sel_info.hslab->num_elem_non_unlim = (hsize_t)1;
- for(u = 0; u < space->extent.rank; u++)
- if((int)u != unlim_dim)
- space->select.sel_info.hslab->num_elem_non_unlim *= (opt_count[u] * opt_block[u]);
-
- /* Set num_elem */
- if(space->select.num_elem != (hsize_t)0)
- space->select.num_elem = H5S_UNLIMITED;
- } /* end if */
- } /* end if */
- else if(op>=H5S_SELECT_OR && op<=H5S_SELECT_NOTA) {
- /* Sanity check */
- HDassert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS);
-
- /* Handle unlimited selections */
- if(unlim_dim >= 0) {
- hsize_t bounds_start[H5S_MAX_RANK];
- hsize_t bounds_end[H5S_MAX_RANK];
- hsize_t tmp_count = opt_count[unlim_dim];
- hsize_t tmp_block = opt_block[unlim_dim];
-
- /* Check for invalid operation */
- if(space->select.sel_info.hslab->unlim_dim >= 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "cannot modify unlimited selection with another unlimited selection")
- if(!((op == H5S_SELECT_AND) || (op == H5S_SELECT_NOTB)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unsupported operation with unlimited selection")
-
- /* Get bounds of existing selection */
- if(H5S_hyper_bounds(space, bounds_start, bounds_end) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds")
-
- /* Patch count and block to remove unlimited and include the
- * existing selection */
- H5S__hyper_get_clip_diminfo(start[unlim_dim], opt_stride[unlim_dim], &tmp_count, &tmp_block, bounds_end[unlim_dim] + (hsize_t)1);
- HDassert((tmp_count == 1) || (opt_count != H5S_hyper_ones_g));
- HDassert((tmp_block == 1) || (opt_block != H5S_hyper_ones_g));
- if(opt_count != H5S_hyper_ones_g) {
- HDassert(opt_count == int_count);
- int_count[unlim_dim] = tmp_count;
- } /* end if */
- if(opt_block != H5S_hyper_ones_g) {
- HDassert(opt_block == int_block);
- int_block[unlim_dim] = tmp_block;
- } /* end if */
- } /* end if */
-
- /* Check if there's no hyperslab span information currently */
- if(NULL == space->select.sel_info.hslab->span_lst)
- if(H5S__hyper_generate_spans(space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
-
- /* Indicate that the regular dimensions are no longer valid */
- space->select.sel_info.hslab->diminfo_valid = FALSE;
-
- /* Add in the new hyperslab information */
- if(H5S__generate_hyperslab (space, op, start, opt_stride, opt_count, opt_block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs")
- } /* end if */
- else
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
-
- /* Set selection type */
- space->select.type = H5S_sel_hyper;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_hyperslab() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5Sselect_hyperslab
- PURPOSE
- Specify a hyperslab to combine with the current hyperslab selection
- USAGE
- herr_t H5Sselect_hyperslab(dsid, op, start, stride, count, block)
- hid_t dsid; IN: Dataspace ID of selection to modify
- H5S_seloper_t op; IN: Operation to perform on current selection
- const hsize_t *start; IN: Offset of start of hyperslab
- const hsize_t *stride; IN: Hyperslab stride
- const hsize_t *count; IN: Number of blocks included in hyperslab
- const hsize_t *block; IN: Size of block in hyperslab
- RETURNS
- Non-negative on success/Negative on failure
- DESCRIPTION
- Combines a hyperslab selection with the current selection for a dataspace.
- If the current selection is not a hyperslab, it is freed and the hyperslab
- parameters passed in are combined with the H5S_SEL_ALL hyperslab (ie. a
- selection composing the entire current extent). If STRIDE or BLOCK is
- NULL, they are assumed to be set to all '1'.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5Sselect_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[])
-{
- H5S_t *space = NULL; /* Dataspace to modify selection of */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "iSs*h*h*h*h", space_id, op, start, stride, count, block);
-
- /* Check args */
- if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if (H5S_SCALAR==H5S_GET_EXTENT_TYPE(space))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space")
- if (H5S_NULL==H5S_GET_EXTENT_TYPE(space))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_NULL space")
- if(start==NULL || count==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified")
- if(!(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID))
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- if(stride!=NULL) {
- unsigned u; /* Local index variable */
-
- /* Check for 0-sized strides */
- for(u=0; u<space->extent.rank; u++) {
- if(stride[u]==0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid stride==0 value")
- } /* end for */
- } /* end if */
-
- if (H5S_select_hyperslab(space, op, start, stride, count, block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Sselect_hyperslab() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5Scombine_hyperslab
- PURPOSE
- Specify a hyperslab to combine with the current hyperslab selection and
- return a new dataspace with the combined selection as the selection in the
- new dataspace.
- USAGE
- hid_t H5Srefine_hyperslab(dsid, op, start, stride, count, block)
- hid_t dsid; IN: Dataspace ID of selection to use
- H5S_seloper_t op; IN: Operation to perform on current selection
- const hsize_t *start; IN: Offset of start of hyperslab
- const hsize_t *stride; IN: Hyperslab stride
- const hsize_t *count; IN: Number of blocks included in hyperslab
- const hsize_t *block; IN: Size of block in hyperslab
- RETURNS
- Dataspace ID on success/Negative on failure
- DESCRIPTION
- Combines a hyperslab selection with the current selection for a dataspace,
- creating a new dataspace to return the generated selection.
- If the current selection is not a hyperslab, it is freed and the hyperslab
- parameters passed in are combined with the H5S_SEL_ALL hyperslab (ie. a
- selection composing the entire current extent). If STRIDE or BLOCK is
- NULL, they are assumed to be set to all '1'.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-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[])
-{
- H5S_t *space; /* Dataspace to modify selection of */
- H5S_t *new_space = NULL; /* New dataspace created */
- hid_t ret_value; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE6("i", "iSs*h*h*h*h", space_id, op, start, stride, count, block);
-
- /* Check args */
- if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if(start == NULL || count == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified")
- if(!(op >= H5S_SELECT_SET && op <= H5S_SELECT_NOTA))
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
-
- /* Copy the first dataspace */
- if (NULL == (new_space = H5S_copy (space, TRUE, TRUE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy dataspace")
-
- /* Go modify the selection in the new dataspace */
- if (H5S_select_hyperslab(new_space, op, start, stride, count, block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection")
-
- /* Atomize */
- if((ret_value = H5I_register(H5I_DATASPACE, new_space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
-
-done:
- if(ret_value < 0 && new_space)
- H5S_close(new_space);
-
- FUNC_LEAVE_API(ret_value)
-} /* end H5Scombine_hyperslab() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5S__combine_select
- *
- * Purpose: Internal version of H5Scombine_select().
- *
- * Return: New dataspace on success/NULL on failure
- *
- * Programmer: Quincey Koziol
- * Tuesday, October 30, 2001
- *
- * Chao Mei
- * Wednesday, June 29, 2011
- *
- *-------------------------------------------------------------------------
- */
-static H5S_t *
-H5S__combine_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
-{
- H5S_t *new_space = NULL; /* New dataspace generated */
- hbool_t span2_owned=FALSE; /* Flag to indicate that span2 was used in H5S_operate_hyperslab() */
- H5S_t *ret_value; /* return value */
-
- FUNC_ENTER_STATIC
-
- /* Check args */
- HDassert(space1);
- HDassert(space2);
- HDassert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA);
-
- /* Check that the space selections both have span trees */
- if(space1->select.sel_info.hslab->span_lst==NULL)
- if(H5S__hyper_generate_spans(space1)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, NULL, "dataspace does not have span tree")
- if(space2->select.sel_info.hslab->span_lst==NULL)
- if(H5S__hyper_generate_spans(space2)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, NULL, "dataspace does not have span tree")
-
- /* Copy the first dataspace */
- if (NULL == (new_space = H5S_copy (space1, TRUE, TRUE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy dataspace")
-
- /* Free the current selection for the new dataspace */
- if(H5S_SELECT_RELEASE(new_space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, NULL, "can't release selection")
-
- /* Allocate space for the hyperslab selection information */
- if((new_space->select.sel_info.hslab=H5FL_CALLOC(H5S_hyper_sel_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab info")
-
- /* Set unlim_dim */
- new_space->select.sel_info.hslab->unlim_dim = -1;
-
- /* Combine space1 & space2, with the result in new_space */
- if(H5S_operate_hyperslab(new_space,space1->select.sel_info.hslab->span_lst,op,space2->select.sel_info.hslab->span_lst,FALSE,&span2_owned)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, NULL, "can't clip hyperslab information")
-
- /* Set return value */
- ret_value = new_space;
-
-done:
- if(ret_value == NULL && new_space)
- H5S_close(new_space);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S__combine_select() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5Scombine_select
- PURPOSE
- Combine two hyperslab selections with an operation, returning a dataspace
- with the resulting selection.
- USAGE
- hid_t H5Scombine_select(space1, op, space2)
- hid_t space1; IN: First Dataspace ID
- H5S_seloper_t op; IN: Selection operation
- hid_t space2; IN: Second Dataspace ID
- RETURNS
- Dataspace ID on success/Negative on failure
- DESCRIPTION
- Combine two existing hyperslab selections with an operation, returning
- a new dataspace with the resulting selection. The dataspace extent from
- space1 is copied for the dataspace extent of the newly created dataspace.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-hid_t
-H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
-{
- H5S_t *space1; /* First Dataspace */
- H5S_t *space2; /* Second Dataspace */
- H5S_t *new_space = NULL; /* New Dataspace */
- hid_t ret_value; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE3("i", "iSsi", space1_id, op, space2_id);
-
- /* Check args */
- if(NULL == (space1 = (H5S_t *)H5I_object_verify(space1_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if(NULL == (space2 = (H5S_t *)H5I_object_verify(space2_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if(!(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA))
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
-
- /* Check that both dataspaces have the same rank */
- if(space1->extent.rank != space2->extent.rank)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same rank")
-
- /* Check that both dataspaces have hyperslab selections */
- if(H5S_GET_SELECT_TYPE(space1) != H5S_SEL_HYPERSLABS || H5S_GET_SELECT_TYPE(space2) != H5S_SEL_HYPERSLABS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections")
-
- /* Go combine the dataspaces */
- if(NULL == (new_space = H5S__combine_select(space1, op, space2)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to create hyperslab selection")
-
- /* Atomize */
- if((ret_value = H5I_register(H5I_DATASPACE, new_space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
-
-done:
- if(ret_value < 0 && new_space)
- H5S_close(new_space);
-
- FUNC_LEAVE_API(ret_value)
-} /* end H5Scombine_select() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5S_select_select
- *
- * Purpose: Internal version of H5Sselect_select().
- *
- * Return: New dataspace on success/NULL on failure
- *
- * Programmer: Quincey Koziol
- * Tuesday, October 30, 2001
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5S_select_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
-{
- H5S_hyper_span_info_t *tmp_spans=NULL; /* Temporary copy of selection */
- hbool_t span2_owned=FALSE; /* Flag to indicate that span2 was used in H5S_operate_hyperslab() */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- HDassert(space1);
- HDassert(space2);
- HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
-
- /* Check that the space selections both have span trees */
- if(space1->select.sel_info.hslab->span_lst==NULL)
- if(H5S__hyper_generate_spans(space1)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
- if(space2->select.sel_info.hslab->span_lst==NULL)
- if(H5S__hyper_generate_spans(space2)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
-
- /* Take ownership of the dataspace's hyperslab spans */
- /* (These are freed later) */
- tmp_spans=space1->select.sel_info.hslab->span_lst;
- space1->select.sel_info.hslab->span_lst=NULL;
-
- /* Reset the other dataspace selection information */
- if(H5S_SELECT_RELEASE(space1)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection")
-
- /* Allocate space for the hyperslab selection information */
- if((space1->select.sel_info.hslab=H5FL_CALLOC(H5S_hyper_sel_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
-
- /* Set unlim_dim */
- space1->select.sel_info.hslab->unlim_dim = -1;
-
- /* Combine tmp_spans (from space1) & spans from space2, with the result in space1 */
- if(H5S_operate_hyperslab(space1,tmp_spans,op,space2->select.sel_info.hslab->span_lst,FALSE,&span2_owned)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
-
-done:
- if(tmp_spans!=NULL)
- H5S__hyper_free_span_info(tmp_spans);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_select() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5Sselect_select
- PURPOSE
- Refine a hyperslab selection with an operation using a second hyperslab
- to modify it.
- USAGE
- herr_t H5Sselect_select(space1, op, space2)
- hid_t space1; IN/OUT: First Dataspace ID
- H5S_seloper_t op; IN: Selection operation
- hid_t space2; IN: Second Dataspace ID
- RETURNS
- Non-negative on success/Negative on failure
- DESCRIPTION
- Refine an existing hyperslab selection with an operation, using a second
- hyperslab. The first selection is modified to contain the result of
- space1 operated on by space2.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5Sselect_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
-{
- H5S_t *space1; /* First Dataspace */
- H5S_t *space2; /* Second Dataspace */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "iSsi", space1_id, op, space2_id);
-
- /* Check args */
- if(NULL == (space1 = (H5S_t *)H5I_object_verify(space1_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if(NULL == (space2 = (H5S_t *)H5I_object_verify(space2_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if(!(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA))
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
-
- /* Check that both dataspaces have the same rank */
- if(space1->extent.rank != space2->extent.rank)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same rank")
-
- /* Check that both dataspaces have hyperslab selections */
- if(H5S_GET_SELECT_TYPE(space1) != H5S_SEL_HYPERSLABS || H5S_GET_SELECT_TYPE(space2) != H5S_SEL_HYPERSLABS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections")
-
- /* Go refine the first selection */
- if (H5S_select_select(space1, op, space2)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to modify hyperslab selection")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Sselect_select() */
-#endif /* NEW_HYPERSLAB_API */ /* Works */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S__hyper_get_seq_list_gen
- PURPOSE
- Create a list of offsets & lengths for a selection
- USAGE
- herr_t H5S_select_hyper_get_file_list_gen(space,iter,maxseq,maxelem,nseq,nelem,off,len)
- H5S_t *space; IN: Dataspace containing selection to use.
- H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
- position of interest in selection.
- size_t maxseq; IN: Maximum number of sequences to generate
- size_t maxelem; IN: Maximum number of elements to include in the
- generated sequences
- size_t *nseq; OUT: Actual number of sequences generated
- size_t *nelem; OUT: Actual number of elements in sequences generated
- hsize_t *off; OUT: Array of offsets
- size_t *len; OUT: Array of lengths
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Use the selection in the dataspace to generate a list of byte offsets and
- lengths for the region(s) selected. Start/Restart from the position in the
- ITER parameter. The number of sequences generated is limited by the MAXSEQ
- parameter and the number of sequences actually generated is stored in the
- NSEQ parameter.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S__hyper_get_seq_list_gen(const H5S_t *space, H5S_sel_iter_t *iter,
- size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
- hsize_t *off, size_t *len)
-{
- H5S_hyper_span_t *curr_span; /* Current hyperslab span node */
- H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */
- hsize_t slab[H5O_LAYOUT_NDIMS]; /* Cumulative size of each dimension in bytes */
- hsize_t acc; /* Accumulator for computing cumulative sizes */
- hsize_t loc_off; /* Element offset in the dataspace */
- hsize_t last_span_end = 0; /* The offset of the end of the last span */
- hsize_t *abs_arr; /* Absolute hyperslab span position */
- const hssize_t *off_arr; /* Offset within the dataspace extent */
- size_t span_size = 0; /* Number of bytes in current span to actually process */
- size_t io_left; /* Number of elements left to process */
- size_t io_bytes_left; /* Number of bytes left to process */
- size_t io_used; /* Number of elements processed */
- size_t curr_seq = 0; /* Number of sequence/offsets stored in the arrays */
- size_t elem_size; /* Size of each element iterating over */
- unsigned ndims; /* Number of dimensions of dataset */
- unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
- int curr_dim; /* Current dimension being operated on */
- unsigned u; /* Index variable */
- int i; /* Index variable */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Check args */
- HDassert(space);
- HDassert(iter);
- HDassert(maxseq > 0);
- HDassert(maxelem > 0);
- HDassert(nseq);
- HDassert(nelem);
- HDassert(off);
- HDassert(len);
-
- /* Set the rank of the fastest changing dimension */
- ndims = space->extent.rank;
- fast_dim = (ndims - 1);
-
- /* Get the pointers to the current span info and span nodes */
- curr_span = iter->u.hyp.span[fast_dim];
- abs_arr = iter->u.hyp.off;
- off_arr = space->select.offset;
- ispan = iter->u.hyp.span;
- elem_size = iter->elmt_size;
-
- /* Set the amount of elements to perform I/O on, etc. */
- H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
- io_left = MIN(maxelem, (size_t)iter->elmt_left);
- io_bytes_left = io_left * elem_size;
-
- /* Compute the cumulative size of dataspace dimensions */
- for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
- slab[i] = acc;
- acc *= space->extent.size[i];
- } /* end for */
-
- /* Set the offset of the first element iterated on */
- for(u = 0, loc_off = 0; u < ndims; u++)
- /* Compute the sequential element offset */
- loc_off += ((hsize_t)((hssize_t)abs_arr[u] + off_arr[u])) * slab[u];
-
- /* Range check against number of elements left in selection */
- HDassert(io_bytes_left <= (iter->elmt_left * elem_size));
-
- /* Take care of any partial spans leftover from previous I/Os */
- if(abs_arr[fast_dim]!=curr_span->low) {
-
- /* Finish the span in the fastest changing dimension */
-
- /* Compute the number of bytes to attempt in this span */
- H5_CHECKED_ASSIGN(span_size, size_t, ((curr_span->high-abs_arr[fast_dim])+1)*elem_size, hsize_t);
-
- /* Check number of bytes against upper bounds allowed */
- if(span_size>io_bytes_left)
- span_size=io_bytes_left;
-
- /* Add the partial span to the list of sequences */
- off[curr_seq]=loc_off;
- len[curr_seq]=span_size;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Set the location of the last span's end */
- last_span_end=loc_off+span_size;
-
- /* Decrement I/O left to perform */
- io_bytes_left-=span_size;
-
- /* Advance the hyperslab iterator */
- /* Check if we are done */
- if(io_bytes_left > 0) {
- /* Move to next span in fastest changing dimension */
- curr_span = curr_span->next;
-
- if(NULL != curr_span) {
- /* Move location offset of destination */
- loc_off += (curr_span->low - abs_arr[fast_dim]) * elem_size;
-
- /* Move iterator for fastest changing dimension */
- abs_arr[fast_dim] = curr_span->low;
- } /* end if */
- } /* end if */
- else {
- abs_arr[fast_dim] += span_size / elem_size;
-
- /* Check if we are still within the span */
- if(abs_arr[fast_dim] <= curr_span->high) {
- iter->u.hyp.span[fast_dim] = curr_span;
- } /* end if */
- /* If we walked off that span, advance to the next span */
- else {
- /* Advance span in this dimension */
- curr_span = curr_span->next;
-
- /* Check if we have a valid span in this dimension still */
- if(NULL != curr_span) {
- /* Reset absolute position */
- abs_arr[fast_dim] = curr_span->low;
- iter->u.hyp.span[fast_dim] = curr_span;
- } /* end if */
- } /* end else */
- } /* end else */
-
- /* Adjust iterator pointers */
-
- if(NULL == curr_span) {
-/* Same as code in main loop */
- /* Start at the next fastest dim */
- curr_dim = (int)(fast_dim - 1);
-
- /* Work back up through the dimensions */
- while(curr_dim >= 0) {
- /* Reset the current span */
- curr_span = iter->u.hyp.span[curr_dim];
-
- /* Increment absolute position */
- abs_arr[curr_dim]++;
-
- /* Check if we are still within the span */
- if(abs_arr[curr_dim] <= curr_span->high) {
- break;
- } /* end if */
- /* If we walked off that span, advance to the next span */
- else {
- /* Advance span in this dimension */
- curr_span = curr_span->next;
-
- /* Check if we have a valid span in this dimension still */
- if(NULL != curr_span) {
- /* Reset the span in the current dimension */
- ispan[curr_dim] = curr_span;
-
- /* Reset absolute position */
- abs_arr[curr_dim] = curr_span->low;
-
- break;
- } /* end if */
- else {
- /* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
- curr_dim--;
- } /* end else */
- } /* end else */
- } /* end while */
-
- /* Check if we have more spans in the tree */
- if(curr_dim >= 0) {
- /* Walk back down the iterator positions, resetting them */
- while((unsigned)curr_dim < fast_dim) {
- HDassert(curr_span);
- HDassert(curr_span->down);
- HDassert(curr_span->down->head);
-
- /* Increment current dimension */
- curr_dim++;
-
- /* Set the new span_info & span for this dimension */
- iter->u.hyp.span[curr_dim] = curr_span->down->head;
-
- /* Advance span down the tree */
- curr_span = curr_span->down->head;
-
- /* Reset the absolute offset for the dim */
- abs_arr[curr_dim] = curr_span->low;
- } /* end while */
-
- /* Verify that the curr_span points to the fastest dim */
- HDassert(curr_span == iter->u.hyp.span[fast_dim]);
-
- /* Reset the buffer offset */
- for(u = 0, loc_off = 0; u < ndims; u++)
- loc_off += ((hsize_t)((hssize_t)abs_arr[u] + off_arr[u])) * slab[u];
- } /* end else */
- else
- /* We had better be done with I/O or bad things are going to happen... */
- HDassert(io_bytes_left == 0);
- } /* end if */
- } /* end if */
-
- /* Perform the I/O on the elements, based on the position of the iterator */
- while(io_bytes_left > 0 && curr_seq < maxseq) {
- /* Sanity check */
- HDassert(curr_span);
-
- /* Adjust location offset of destination to compensate for initial increment below */
- loc_off -= curr_span->pstride;
-
- /* Loop over all the spans in the fastest changing dimension */
- while(curr_span != NULL) {
- /* Move location offset of destination */
- loc_off += curr_span->pstride;
-
- /* Compute the number of elements to attempt in this span */
- H5_CHECKED_ASSIGN(span_size, size_t, curr_span->nelem, hsize_t);
-
- /* Check number of elements against upper bounds allowed */
- if(span_size >= io_bytes_left) {
- /* Trim the number of bytes to output */
- span_size = io_bytes_left;
- io_bytes_left = 0;
-
-/* COMMON */
- /* Store the I/O information for the span */
-
- /* Check if this is appending onto previous sequence */
- if(curr_seq > 0 && last_span_end == loc_off)
- len[curr_seq - 1] += span_size;
- else {
- off[curr_seq] = loc_off;
- len[curr_seq] = span_size;
-
- /* Increment the number of sequences in arrays */
- curr_seq++;
- } /* end else */
-
- /* Set the location of the last span's end */
- last_span_end = loc_off + span_size;
-/* end COMMON */
-
- /* Break out now, we are finished with I/O */
- break;
- } /* end if */
- else {
- /* Decrement I/O left to perform */
- io_bytes_left -= span_size;
-
-/* COMMON */
- /* Store the I/O information for the span */
-
- /* Check if this is appending onto previous sequence */
- if(curr_seq > 0 && last_span_end == loc_off)
- len[curr_seq-1]+=span_size;
- else {
- off[curr_seq] = loc_off;
- len[curr_seq] = span_size;
-
- /* Increment the number of sequences in arrays */
- curr_seq++;
- } /* end else */
-
- /* Set the location of the last span's end */
- last_span_end = loc_off + span_size;
-/* end COMMON */
-
- /* If the sequence & offset arrays are full, do what? */
- if(curr_seq >= maxseq) {
- /* Break out now, we are finished with sequences */
- break;
- } /* end else */
- } /* end else */
-
- /* Move to next span in fastest changing dimension */
- curr_span=curr_span->next;
- } /* end while */
-
- /* Check if we are done */
- if(io_bytes_left==0 || curr_seq>=maxseq) {
- HDassert(curr_span);
- abs_arr[fast_dim]=curr_span->low+(span_size/elem_size);
-
- /* Check if we are still within the span */
- if(abs_arr[fast_dim]<=curr_span->high) {
- iter->u.hyp.span[fast_dim]=curr_span;
- break;
- } /* end if */
- /* If we walked off that span, advance to the next span */
- else {
- /* Advance span in this dimension */
- curr_span=curr_span->next;
-
- /* Check if we have a valid span in this dimension still */
- if(curr_span!=NULL) {
- /* Reset absolute position */
- abs_arr[fast_dim]=curr_span->low;
- iter->u.hyp.span[fast_dim]=curr_span;
- break;
- } /* end if */
- } /* end else */
- } /* end if */
-
- /* Adjust iterator pointers */
-
- /* Start at the next fastest dim */
- curr_dim = (int)(fast_dim - 1);
-
- /* Work back up through the dimensions */
- while(curr_dim >= 0) {
- /* Reset the current span */
- curr_span=iter->u.hyp.span[curr_dim];
-
- /* Increment absolute position */
- abs_arr[curr_dim]++;
-
- /* Check if we are still within the span */
- if(abs_arr[curr_dim]<=curr_span->high) {
- break;
- } /* end if */
- /* If we walked off that span, advance to the next span */
- else {
- /* Advance span in this dimension */
- curr_span=curr_span->next;
-
- /* Check if we have a valid span in this dimension still */
- if(curr_span!=NULL) {
- /* Reset the span in the current dimension */
- ispan[curr_dim]=curr_span;
-
- /* Reset absolute position */
- abs_arr[curr_dim]=curr_span->low;
-
- break;
- } /* end if */
- else {
- /* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
- curr_dim--;
- } /* end else */
- } /* end else */
- } /* end while */
-
- /* Check if we are finished with the spans in the tree */
- if(curr_dim < 0) {
- /* We had better be done with I/O or bad things are going to happen... */
- HDassert(io_bytes_left == 0);
- break;
- } /* end if */
- else {
- /* Walk back down the iterator positions, resetting them */
- while((unsigned)curr_dim < fast_dim) {
- HDassert(curr_span);
- HDassert(curr_span->down);
- HDassert(curr_span->down->head);
-
- /* Increment current dimension to the next dimension down */
- curr_dim++;
-
- /* Set the new span for the next dimension down */
- iter->u.hyp.span[curr_dim] = curr_span->down->head;
-
- /* Advance span down the tree */
- curr_span = curr_span->down->head;
-
- /* Reset the absolute offset for the dim */
- abs_arr[curr_dim] = curr_span->low;
- } /* end while */
-
- /* Verify that the curr_span points to the fastest dim */
- HDassert(curr_span == iter->u.hyp.span[fast_dim]);
- } /* end else */
-
- /* Reset the buffer offset */
- for(u = 0, loc_off = 0; u < ndims; u++)
- loc_off += ((hsize_t)((hssize_t)abs_arr[u] + off_arr[u])) * slab[u];
- } /* end while */
-
- /* Decrement number of elements left in iterator */
- io_used = (io_left - (io_bytes_left / elem_size));
- iter->elmt_left -= io_used;
-
- /* Set the number of sequences generated */
- *nseq = curr_seq;
-
- /* Set the number of elements used */
- *nelem = io_used;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__hyper_get_seq_list_gen() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S__hyper_get_seq_list_opt
- PURPOSE
- Create a list of offsets & lengths for a selection
- USAGE
- herr_t H5S_select_hyper_get_file_list_opt(space,iter,maxseq,maxelem,nseq,nelem,off,len)
- H5S_t *space; IN: Dataspace containing selection to use.
- H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
- position of interest in selection.
- size_t maxseq; IN: Maximum number of sequences to generate
- size_t maxelem; IN: Maximum number of elements to include in the
- generated sequences
- size_t *nseq; OUT: Actual number of sequences generated
- size_t *nelem; OUT: Actual number of elements in sequences generated
- hsize_t *off; OUT: Array of offsets
- size_t *len; OUT: Array of lengths
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Use the selection in the dataspace to generate a list of byte offsets and
- lengths for the region(s) selected. Start/Restart from the position in the
- ITER parameter. The number of sequences generated is limited by the MAXSEQ
- parameter and the number of sequences actually generated is stored in the
- NSEQ parameter.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S__hyper_get_seq_list_opt(const H5S_t *space, H5S_sel_iter_t *iter,
- size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
- hsize_t *off, size_t *len)
-{
- hsize_t *mem_size; /* Size of the source buffer */
- hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */
- const hssize_t *sel_off; /* Selection offset in dataspace */
- hsize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */
- hsize_t tmp_count[H5O_LAYOUT_NDIMS];/* Temporary block count */
- hsize_t tmp_block[H5O_LAYOUT_NDIMS];/* Temporary block offset */
- hsize_t wrap[H5O_LAYOUT_NDIMS]; /* Bytes to wrap around at the end of a row */
- hsize_t skip[H5O_LAYOUT_NDIMS]; /* Bytes to skip between blocks */
- const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- hsize_t fast_dim_start, /* Local copies of fastest changing dimension info */
- fast_dim_stride,
- fast_dim_block,
- fast_dim_offset;
- size_t fast_dim_buf_off; /* Local copy of amount to move fastest dimension buffer offset */
- size_t fast_dim_count; /* Number of blocks left in fastest changing dimension */
- size_t tot_blk_count; /* Total number of blocks left to output */
- size_t act_blk_count; /* Actual number of blocks to output */
- size_t total_rows; /* Total number of entire rows to output */
- size_t curr_rows; /* Current number of entire rows to output */
- unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
- unsigned ndims; /* Number of dimensions of dataset */
- int temp_dim; /* Temporary rank holder */
- hsize_t acc; /* Accumulator */
- hsize_t loc; /* Coordinate offset */
- size_t curr_seq = 0; /* Current sequence being operated on */
- size_t actual_elem; /* The actual number of elements to count */
- size_t actual_bytes;/* The actual number of bytes to copy */
- size_t io_left; /* The number of elements left in I/O operation */
- size_t start_io_left; /* The initial number of elements left in I/O operation */
- size_t elem_size; /* Size of each element iterating over */
- unsigned u; /* Local index variable */
- int i; /* Local index variable */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Check args */
- HDassert(space);
- HDassert(iter);
- HDassert(maxseq > 0);
- HDassert(maxelem > 0);
- HDassert(nseq);
- HDassert(nelem);
- HDassert(off);
- HDassert(len);
-
- /* Set the local copy of the diminfo pointer */
- tdiminfo = iter->u.hyp.diminfo;
-
- /* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < space->extent.rank) {
- /* Set the aliases for a few important dimension ranks */
- ndims = iter->u.hyp.iter_rank;
- fast_dim = ndims - 1;
-
- /* Set the local copy of the selection offset */
- sel_off = iter->u.hyp.sel_off;
-
- /* Set up the pointer to the size of the memory space */
- mem_size = iter->u.hyp.size;
- } /* end if */
- else {
- /* Set the aliases for a few important dimension ranks */
- ndims = space->extent.rank;
- fast_dim = ndims - 1;
-
- /* Set the local copy of the selection offset */
- sel_off = space->select.offset;
-
- /* Set up the pointer to the size of the memory space */
- mem_size = space->extent.size;
- } /* end else */
-
- /* initialize row sizes for each dimension */
- elem_size = iter->elmt_size;
- for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
- slab[i] = acc;
- acc *= mem_size[i];
- } /* end for */
-
- /* Calculate the number of elements to sequence through */
- H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
- io_left = MIN((size_t)iter->elmt_left, maxelem);
-
- /* Sanity check that there aren't any "remainder" sequences in process */
- HDassert(!((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride != 0 ||
- ((iter->u.hyp.off[fast_dim] != tdiminfo[fast_dim].start) && tdiminfo[fast_dim].count == 1)));
-
- /* We've cleared the "remainder" of the previous fastest dimension
- * sequence before calling this routine, so we must be at the beginning of
- * a sequence. Use the fancy algorithm to compute the offsets and run
- * through as many as possible, until the buffer fills up.
- */
-
- /* Keep the number of elements we started with */
- start_io_left = io_left;
-
- /* Compute the arrays to perform I/O on */
-
- /* Copy the location of the point to get */
- /* (Add in the selection offset) */
- for(u = 0; u < ndims; u++)
- offset[u] = (hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u]);
-
- /* Compute the current "counts" for this location */
- for(u = 0; u < ndims; u++) {
- if(tdiminfo[u].count == 1) {
- tmp_count[u] = 0;
- tmp_block[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
- } /* end if */
- else {
- tmp_count[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) / tdiminfo[u].stride;
- tmp_block[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) % tdiminfo[u].stride;
- } /* end else */
- } /* end for */
-
- /* Compute the initial buffer offset */
- for(u = 0, loc = 0; u < ndims; u++)
- loc += offset[u] * slab[u];
-
- /* Set the number of elements to write each time */
- H5_CHECKED_ASSIGN(actual_elem, size_t, tdiminfo[fast_dim].block, hsize_t);
-
- /* Set the number of actual bytes */
- actual_bytes = actual_elem * elem_size;
-
- /* Set local copies of information for the fastest changing dimension */
- fast_dim_start = tdiminfo[fast_dim].start;
- fast_dim_stride = tdiminfo[fast_dim].stride;
- fast_dim_block = tdiminfo[fast_dim].block;
- H5_CHECKED_ASSIGN(fast_dim_buf_off, size_t, slab[fast_dim] * fast_dim_stride, hsize_t);
- fast_dim_offset = (hsize_t)((hssize_t)fast_dim_start + sel_off[fast_dim]);
-
- /* Compute the number of blocks which would fit into the buffer */
- H5_CHECK_OVERFLOW(io_left / fast_dim_block, hsize_t, size_t);
- tot_blk_count = (size_t)(io_left / fast_dim_block);
-
- /* Don't go over the maximum number of sequences allowed */
- tot_blk_count = MIN(tot_blk_count, (maxseq - curr_seq));
-
- /* Compute the amount to wrap at the end of each row */
- for(u = 0; u < ndims; u++)
- wrap[u] = (mem_size[u] - (tdiminfo[u].stride * tdiminfo[u].count)) * slab[u];
-
- /* Compute the amount to skip between blocks */
- for(u = 0; u < ndims; u++)
- skip[u] = (tdiminfo[u].stride - tdiminfo[u].block) * slab[u];
-
- /* Check if there is a partial row left (with full blocks) */
- if(tmp_count[fast_dim] > 0) {
- /* Get number of blocks in fastest dimension */
- H5_CHECKED_ASSIGN(fast_dim_count, size_t, tdiminfo[fast_dim].count - tmp_count[fast_dim], hsize_t);
-
- /* Make certain this entire row will fit into buffer */
- fast_dim_count = MIN(fast_dim_count, tot_blk_count);
-
- /* Number of blocks to sequence over */
- act_blk_count = fast_dim_count;
-
- /* Loop over all the blocks in the fastest changing dimension */
- while(fast_dim_count > 0) {
- /* Store the sequence information */
- off[curr_seq] = loc;
- len[curr_seq] = actual_bytes;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Increment information to reflect block just processed */
- loc += fast_dim_buf_off;
-
- /* Decrement number of blocks */
- fast_dim_count--;
- } /* end while */
-
- /* Decrement number of elements left */
- io_left -= actual_elem * act_blk_count;
-
- /* Decrement number of blocks left */
- tot_blk_count -= act_blk_count;
-
- /* Increment information to reflect block just processed */
- tmp_count[fast_dim] += act_blk_count;
-
- /* Check if we finished the entire row of blocks */
- if(tmp_count[fast_dim] >= tdiminfo[fast_dim].count) {
- /* Increment offset in destination buffer */
- loc += wrap[fast_dim];
-
- /* Increment information to reflect block just processed */
- offset[fast_dim] = fast_dim_offset; /* reset the offset in the fastest dimension */
- tmp_count[fast_dim] = 0;
-
- /* Increment the offset and count for the other dimensions */
- temp_dim = (int)fast_dim - 1;
- while(temp_dim >= 0) {
- /* Move to the next row in the curent dimension */
- offset[temp_dim]++;
- tmp_block[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
- break;
- else {
- /* Move to the next block in the current dimension */
- offset[temp_dim] += (tdiminfo[temp_dim].stride - tdiminfo[temp_dim].block);
- loc += skip[temp_dim];
- tmp_block[temp_dim] = 0;
- tmp_count[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_count[temp_dim] < tdiminfo[temp_dim].count)
- break;
- else {
- offset[temp_dim] = (hsize_t)((hssize_t)tdiminfo[temp_dim].start + sel_off[temp_dim]);
- loc += wrap[temp_dim];
- tmp_count[temp_dim] = 0; /* reset back to the beginning of the line */
- tmp_block[temp_dim] = 0;
- } /* end else */
- } /* end else */
-
- /* Decrement dimension count */
- temp_dim--;
- } /* end while */
- } /* end if */
- else {
- /* Update the offset in the fastest dimension */
- offset[fast_dim] += (fast_dim_stride * act_blk_count);
- } /* end else */
- } /* end if */
-
- /* Compute the number of entire rows to read in */
- H5_CHECK_OVERFLOW(tot_blk_count / tdiminfo[fast_dim].count, hsize_t, size_t);
- curr_rows = total_rows = (size_t)(tot_blk_count / tdiminfo[fast_dim].count);
-
- /* Reset copy of number of blocks in fastest dimension */
- H5_CHECKED_ASSIGN(fast_dim_count, size_t, tdiminfo[fast_dim].count, hsize_t);
-
- /* Read in data until an entire sequence can't be written out any longer */
- while(curr_rows > 0) {
-
-#define DUFF_GUTS \
-/* Store the sequence information */ \
-off[curr_seq] = loc; \
-len[curr_seq] = actual_bytes; \
- \
-/* Increment sequence count */ \
-curr_seq++; \
- \
-/* Increment information to reflect block just processed */ \
-loc += fast_dim_buf_off;
-
-#ifdef NO_DUFFS_DEVICE
- /* Loop over all the blocks in the fastest changing dimension */
- while(fast_dim_count > 0) {
- DUFF_GUTS
-
- /* Decrement number of blocks */
- fast_dim_count--;
- } /* end while */
-#else /* NO_DUFFS_DEVICE */
- {
- size_t duffs_index; /* Counting index for Duff's device */
-
- duffs_index = (fast_dim_count + 7) / 8;
- switch (fast_dim_count % 8) {
- default:
- HDassert(0 && "This Should never be executed!");
- break;
- case 0:
- do
- {
- DUFF_GUTS
- case 7:
- DUFF_GUTS
- case 6:
- DUFF_GUTS
- case 5:
- DUFF_GUTS
- case 4:
- DUFF_GUTS
- case 3:
- DUFF_GUTS
- case 2:
- DUFF_GUTS
- case 1:
- DUFF_GUTS
- } while (--duffs_index > 0);
- } /* end switch */
- }
-#endif /* NO_DUFFS_DEVICE */
-#undef DUFF_GUTS
-
- /* Increment offset in destination buffer */
- loc += wrap[fast_dim];
-
- /* Increment the offset and count for the other dimensions */
- temp_dim = (int)fast_dim - 1;
- while(temp_dim >= 0) {
- /* Move to the next row in the curent dimension */
- offset[temp_dim]++;
- tmp_block[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
- break;
- else {
- /* Move to the next block in the current dimension */
- offset[temp_dim] += (tdiminfo[temp_dim].stride - tdiminfo[temp_dim].block);
- loc += skip[temp_dim];
- tmp_block[temp_dim] = 0;
- tmp_count[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_count[temp_dim] < tdiminfo[temp_dim].count)
- break;
- else {
- offset[temp_dim] = (hsize_t)((hssize_t)tdiminfo[temp_dim].start + sel_off[temp_dim]);
- loc += wrap[temp_dim];
- tmp_count[temp_dim] = 0; /* reset back to the beginning of the line */
- tmp_block[temp_dim] = 0;
- } /* end else */
- } /* end else */
-
- /* Decrement dimension count */
- temp_dim--;
- } /* end while */
-
- /* Decrement the number of rows left */
- curr_rows--;
- } /* end while */
-
- /* Adjust the number of blocks & elements left to transfer */
-
- /* Decrement number of elements left */
- H5_CHECK_OVERFLOW(actual_elem * (total_rows * tdiminfo[fast_dim].count), hsize_t, size_t);
- io_left -= (size_t)(actual_elem * (total_rows * tdiminfo[fast_dim].count));
-
- /* Decrement number of blocks left */
- H5_CHECK_OVERFLOW((total_rows * tdiminfo[fast_dim].count), hsize_t, size_t);
- tot_blk_count -= (size_t)(total_rows * tdiminfo[fast_dim].count);
-
- /* Read in partial row of blocks */
- if(io_left > 0 && curr_seq < maxseq) {
- /* Get remaining number of blocks left to output */
- fast_dim_count = tot_blk_count;
-
- /* Loop over all the blocks in the fastest changing dimension */
- while(fast_dim_count > 0) {
- /* Store the sequence information */
- off[curr_seq] = loc;
- len[curr_seq] = actual_bytes;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Increment information to reflect block just processed */
- loc += fast_dim_buf_off;
-
- /* Decrement number of blocks */
- fast_dim_count--;
- } /* end while */
-
- /* Decrement number of elements left */
- io_left -= actual_elem * tot_blk_count;
-
- /* Increment information to reflect block just processed */
- offset[fast_dim] += (fast_dim_stride * tot_blk_count); /* move the offset in the fastest dimension */
-
- /* Handle any leftover, partial blocks in this row */
- if(io_left > 0 && curr_seq < maxseq) {
- actual_elem = io_left;
- actual_bytes = actual_elem * elem_size;
-
- /* Store the sequence information */
- off[curr_seq] = loc;
- len[curr_seq] = actual_bytes;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Decrement the number of elements left */
- io_left -= actual_elem;
-
- /* Increment buffer correctly */
- offset[fast_dim] += actual_elem;
- } /* end if */
-
- /* don't bother checking slower dimensions */
- HDassert(io_left == 0 || curr_seq == maxseq);
- } /* end if */
-
- /* Update the iterator */
-
- /* Update the iterator with the location we stopped */
- /* (Subtract out the selection offset) */
- for(u = 0; u < ndims; u++)
- iter->u.hyp.off[u] = (hsize_t)((hssize_t)offset[u] - sel_off[u]);
-
- /* Decrement the number of elements left in selection */
- iter->elmt_left -= (start_io_left - io_left);
-
- /* Increment the number of sequences generated */
- *nseq += curr_seq;
-
- /* Increment the number of elements used */
- *nelem += start_io_left - io_left;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__hyper_get_seq_list_opt() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S__hyper_get_seq_list_single
- PURPOSE
- Create a list of offsets & lengths for a selection
- USAGE
- herr_t H5S__hyper_get_seq_list_single(space, flags, iter, maxseq, maxelem, nseq, nelem, off, len)
- H5S_t *space; IN: Dataspace containing selection to use.
- unsigned flags; IN: Flags for extra information about operation
- H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
- position of interest in selection.
- size_t maxseq; IN: Maximum number of sequences to generate
- size_t maxelem; IN: Maximum number of elements to include in the
- generated sequences
- size_t *nseq; OUT: Actual number of sequences generated
- size_t *nelem; OUT: Actual number of elements in sequences generated
- hsize_t *off; OUT: Array of offsets
- size_t *len; OUT: Array of lengths
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Use the selection in the dataspace to generate a list of byte offsets and
- lengths for the region(s) selected. Start/Restart from the position in the
- ITER parameter. The number of sequences generated is limited by the MAXSEQ
- parameter and the number of sequences actually generated is stored in the
- NSEQ parameter.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S__hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter,
- size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
- hsize_t *off, size_t *len)
-{
- const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- const hssize_t *sel_off; /* Selection offset in dataspace */
- hsize_t *mem_size; /* Size of the source buffer */
- hsize_t base_offset[H5O_LAYOUT_NDIMS]; /* Base coordinate offset in dataspace */
- hsize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */
- hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */
- hsize_t fast_dim_block; /* Local copies of fastest changing dimension info */
- hsize_t acc; /* Accumulator */
- hsize_t loc; /* Coordinate offset */
- size_t tot_blk_count; /* Total number of blocks left to output */
- size_t elem_size; /* Size of each element iterating over */
- size_t io_left; /* The number of elements left in I/O operation */
- size_t actual_elem; /* The actual number of elements to count */
- unsigned ndims; /* Number of dimensions of dataset */
- unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
- unsigned skip_dim; /* Rank of the dimension to skip along */
- unsigned u; /* Local index variable */
- int i; /* Local index variable */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Check args */
- HDassert(space);
- HDassert(iter);
- HDassert(maxseq > 0);
- HDassert(maxelem > 0);
- HDassert(nseq);
- HDassert(nelem);
- HDassert(off);
- HDassert(len);
-
- /* Set a local copy of the diminfo pointer */
- tdiminfo = iter->u.hyp.diminfo;
-
- /* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < space->extent.rank) {
- /* Set the aliases for a few important dimension ranks */
- ndims = iter->u.hyp.iter_rank;
-
- /* Set the local copy of the selection offset */
- sel_off = iter->u.hyp.sel_off;
-
- /* Set up the pointer to the size of the memory space */
- mem_size = iter->u.hyp.size;
- } /* end if */
- else {
- /* Set the aliases for a few important dimension ranks */
- ndims = space->extent.rank;
-
- /* Set the local copy of the selection offset */
- sel_off = space->select.offset;
-
- /* Set up the pointer to the size of the memory space */
- mem_size = space->extent.size;
- } /* end else */
- fast_dim = ndims - 1;
-
- /* initialize row sizes for each dimension */
- elem_size = iter->elmt_size;
- for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
- slab[i] = acc;
- acc *= mem_size[i];
- } /* end for */
-
- /* Copy the base location of the block */
- /* (Add in the selection offset) */
- for(u = 0; u < ndims; u++)
- base_offset[u] = (hsize_t)((hssize_t)tdiminfo[u].start + sel_off[u]);
-
- /* Copy the location of the point to get */
- /* (Add in the selection offset) */
- for(u = 0; u < ndims; u++)
- offset[u] = (hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u]);
-
- /* Compute the initial buffer offset */
- for(u = 0, loc = 0; u < ndims; u++)
- loc += offset[u] * slab[u];
-
- /* Set local copies of information for the fastest changing dimension */
- fast_dim_block = tdiminfo[fast_dim].block;
-
- /* Calculate the number of elements to sequence through */
- H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
- io_left = MIN((size_t)iter->elmt_left, maxelem);
-
- /* Compute the number of blocks which would fit into the buffer */
- H5_CHECK_OVERFLOW(io_left / fast_dim_block, hsize_t, size_t);
- tot_blk_count = (size_t)(io_left / fast_dim_block);
-
- /* Don't go over the maximum number of sequences allowed */
- tot_blk_count = MIN(tot_blk_count, maxseq);
-
- /* Set the number of elements to write each time */
- H5_CHECKED_ASSIGN(actual_elem, size_t, fast_dim_block, hsize_t);
-
- /* Check for blocks to operate on */
- if(tot_blk_count > 0) {
- size_t actual_bytes; /* The actual number of bytes to copy */
-
- /* Set the number of actual bytes */
- actual_bytes = actual_elem * elem_size;
-
- /* Check for 1-dim selection */
- if(0 == fast_dim) {
- /* Sanity checks */
- HDassert(1 == tot_blk_count);
- HDassert(io_left == actual_elem);
-
- /* Store the sequence information */
- *off++ = loc;
- *len++ = actual_bytes;
- } /* end if */
- else {
- hsize_t skip_slab; /* Temporary copy of slab[fast_dim - 1] */
- size_t blk_count; /* Total number of blocks left to output */
-
- /* Find first dimension w/block >1 */
- skip_dim = fast_dim;
- for(i = (int)(fast_dim - 1); i >= 0; i--)
- if(tdiminfo[i].block > 1) {
- skip_dim = (unsigned)i;
- break;
- } /* end if */
- skip_slab = slab[skip_dim];
-
- /* Check for being able to use fast algorithm for 1-D */
- if(0 == skip_dim) {
- /* Create sequences until an entire row can't be used */
- blk_count = tot_blk_count;
- while(blk_count > 0) {
- /* Store the sequence information */
- *off++ = loc;
- *len++ = actual_bytes;
-
- /* Increment offset in destination buffer */
- loc += skip_slab;
-
- /* Decrement block count */
- blk_count--;
- } /* end while */
-
- /* Move to the next location */
- offset[skip_dim] += tot_blk_count;
- } /* end if */
- else {
- hsize_t tmp_block[H5O_LAYOUT_NDIMS];/* Temporary block offset */
- hsize_t skip[H5O_LAYOUT_NDIMS]; /* Bytes to skip between blocks */
- int temp_dim; /* Temporary rank holder */
-
- /* Set the starting block location */
- for(u = 0; u < ndims; u++)
- tmp_block[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
-
- /* Compute the amount to skip between sequences */
- for(u = 0; u < ndims; u++)
- skip[u] = (mem_size[u] - tdiminfo[u].block) * slab[u];
-
- /* Create sequences until an entire row can't be used */
- blk_count = tot_blk_count;
- while(blk_count > 0) {
- /* Store the sequence information */
- *off++ = loc;
- *len++ = actual_bytes;
-
- /* Set temporary dimension for advancing offsets */
- temp_dim = (int)skip_dim;
-
- /* Increment offset in destination buffer */
- loc += skip_slab;
-
- /* Increment the offset and count for the other dimensions */
- while(temp_dim >= 0) {
- /* Move to the next row in the curent dimension */
- offset[temp_dim]++;
- tmp_block[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
- break;
- else {
- offset[temp_dim] = base_offset[temp_dim];
- loc += skip[temp_dim];
- tmp_block[temp_dim] = 0;
- } /* end else */
-
- /* Decrement dimension count */
- temp_dim--;
- } /* end while */
-
- /* Decrement block count */
- blk_count--;
- } /* end while */
- } /* end else */
- } /* end else */
-
- /* Update the iterator, if there were any blocks used */
-
- /* Decrement the number of elements left in selection */
- iter->elmt_left -= tot_blk_count * actual_elem;
-
- /* Check if there are elements left in iterator */
- if(iter->elmt_left > 0) {
- /* Update the iterator with the location we stopped */
- /* (Subtract out the selection offset) */
- for(u = 0; u < ndims; u++)
- iter->u.hyp.off[u] = (hsize_t)((hssize_t)offset[u] - sel_off[u]);
- } /* end if */
-
- /* Increment the number of sequences generated */
- *nseq += tot_blk_count;
-
- /* Increment the number of elements used */
- *nelem += tot_blk_count * actual_elem;
- } /* end if */
-
- /* Check for partial block, with room for another sequence */
- if(io_left > (tot_blk_count * actual_elem) && tot_blk_count < maxseq) {
- size_t elmt_remainder; /* Elements remaining */
-
- /* Compute elements left */
- elmt_remainder = io_left - (tot_blk_count * actual_elem);
- HDassert(elmt_remainder < fast_dim_block);
- HDassert(elmt_remainder > 0);
-
- /* Store the sequence information */
- *off++ = loc;
- *len++ = elmt_remainder * elem_size;
-
- /* Update the iterator with the location we stopped */
- iter->u.hyp.off[fast_dim] += (hsize_t)elmt_remainder;
-
- /* Decrement the number of elements left in selection */
- iter->elmt_left -= elmt_remainder;
-
- /* Increment the number of sequences generated */
- (*nseq)++;
-
- /* Increment the number of elements used */
- *nelem += elmt_remainder;
- } /* end if */
-
- /* Sanity check */
- HDassert(*nseq > 0);
- HDassert(*nelem > 0);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__hyper_get_seq_list_single() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S__hyper_get_seq_list
- PURPOSE
- Create a list of offsets & lengths for a selection
- USAGE
- herr_t H5S__hyper_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
- H5S_t *space; IN: Dataspace containing selection to use.
- unsigned flags; IN: Flags for extra information about operation
- H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
- position of interest in selection.
- size_t maxseq; IN: Maximum number of sequences to generate
- size_t maxelem; IN: Maximum number of elements to include in the
- generated sequences
- size_t *nseq; OUT: Actual number of sequences generated
- size_t *nelem; OUT: Actual number of elements in sequences generated
- hsize_t *off; OUT: Array of offsets
- size_t *len; OUT: Array of lengths
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Use the selection in the dataspace to generate a list of byte offsets and
- lengths for the region(s) selected. Start/Restart from the position in the
- ITER parameter. The number of sequences generated is limited by the MAXSEQ
- parameter and the number of sequences actually generated is stored in the
- NSEQ parameter.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S__hyper_get_seq_list(const H5S_t *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t *iter,
- size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
- hsize_t *off, size_t *len)
-{
- herr_t ret_value = FAIL; /* return value */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Check args */
- HDassert(space);
- HDassert(iter);
- HDassert(iter->elmt_left > 0);
- HDassert(maxseq > 0);
- HDassert(maxelem > 0);
- HDassert(nseq);
- HDassert(nelem);
- HDassert(off);
- HDassert(len);
- HDassert(space->select.sel_info.hslab->unlim_dim < 0);
-
- /* Check for the special case of just one H5Sselect_hyperslab call made */
- if(space->select.sel_info.hslab->diminfo_valid) {
- const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- const hssize_t *sel_off; /* Selection offset in dataspace */
- hsize_t *mem_size; /* Size of the source buffer */
- unsigned ndims; /* Number of dimensions of dataset */
- unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
- hbool_t single_block; /* Whether the selection is a single block */
- unsigned u; /* Local index variable */
-
- /* Set a local copy of the diminfo pointer */
- tdiminfo = iter->u.hyp.diminfo;
-
- /* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < space->extent.rank) {
- /* Set the aliases for a few important dimension ranks */
- ndims = iter->u.hyp.iter_rank;
-
- /* Set the local copy of the selection offset */
- sel_off = iter->u.hyp.sel_off;
-
- /* Set up the pointer to the size of the memory space */
- mem_size = iter->u.hyp.size;
- } /* end if */
- else {
- /* Set the aliases for a few important dimension ranks */
- ndims = space->extent.rank;
-
- /* Set the local copy of the selection offset */
- sel_off = space->select.offset;
-
- /* Set up the pointer to the size of the memory space */
- mem_size = space->extent.size;
- } /* end else */
- fast_dim = ndims - 1;
-
- /* Check if we stopped in the middle of a sequence of elements */
- if((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride != 0 ||
- ((iter->u.hyp.off[fast_dim] != tdiminfo[fast_dim].start) && tdiminfo[fast_dim].count == 1)) {
- hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */
- hsize_t loc; /* Coordinate offset */
- hsize_t acc; /* Accumulator */
- size_t leftover; /* The number of elements left over from the last sequence */
- size_t actual_elem; /* The actual number of elements to count */
- size_t elem_size; /* Size of each element iterating over */
- int i; /* Local index variable */
-
-
- /* Calculate the number of elements left in the sequence */
- if(tdiminfo[fast_dim].count == 1) {
- H5_CHECKED_ASSIGN(leftover, size_t, tdiminfo[fast_dim].block - (iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start), hsize_t);
- } /* end if */
- else {
- H5_CHECKED_ASSIGN(leftover, size_t, tdiminfo[fast_dim].block - ((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride), hsize_t);
- } /* end else */
-
- /* Make certain that we don't write too many */
- actual_elem = MIN3(leftover, (size_t)iter->elmt_left, maxelem);
-
- /* Initialize row sizes for each dimension */
- elem_size = iter->elmt_size;
- for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
- slab[i] = acc;
- acc *= mem_size[i];
- } /* end for */
-
- /* Compute the initial buffer offset */
- for(u = 0, loc = 0; u < ndims; u++)
- loc += ((hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u])) * slab[u];
-
- /* Add a new sequence */
- off[0] = loc;
- H5_CHECKED_ASSIGN(len[0], size_t, actual_elem * elem_size, hsize_t);
-
- /* Increment sequence array locations */
- off++;
- len++;
-
- /* Advance the hyperslab iterator */
- H5S__hyper_iter_next(iter, actual_elem);
-
- /* Decrement the number of elements left in selection */
- iter->elmt_left -= actual_elem;
-
- /* Decrement element/sequence limits */
- maxelem -= actual_elem;
- maxseq--;
-
- /* Set the number of sequences generated and elements used */
- *nseq = 1;
- *nelem = actual_elem;
-
- /* Check for using up all the sequences/elements */
- if(0 == iter->elmt_left || 0 == maxelem || 0 == maxseq)
- return(SUCCEED);
- } /* end if */
- else {
- /* Reset the number of sequences generated and elements used */
- *nseq = 0;
- *nelem = 0;
- } /* end else */
-
- /* Check for a single block selected */
- single_block = TRUE;
- for(u = 0; u < ndims; u++)
- if(1 != tdiminfo[u].count) {
- single_block = FALSE;
- break;
- } /* end if */
-
- /* Check for single block selection */
- if(single_block)
- /* Use single-block optimized call to generate sequence list */
- ret_value = H5S__hyper_get_seq_list_single(space, iter, maxseq, maxelem, nseq, nelem, off, len);
- else
- /* Use optimized call to generate sequence list */
- ret_value = H5S__hyper_get_seq_list_opt(space, iter, maxseq, maxelem, nseq, nelem, off, len);
- } /* end if */
- else
- /* Call the general sequence generator routine */
- ret_value = H5S__hyper_get_seq_list_gen(space, iter, maxseq, maxelem, nseq, nelem, off, len);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S__hyper_get_seq_list() */
/*--------------------------------------------------------------------------
@@ -9251,11 +8129,10 @@ H5S__hyper_get_seq_list(const H5S_t *space, unsigned H5_ATTR_UNUSED flags, H5S_s
DESCRIPTION
Projects the intersection of of the selections of src_space and
src_intersect_space within the selection of src_space as a selection
- within the selection of dst_space. The result is placed in the
- selection of proj_space. Note src_space, dst_space, and
- src_intersect_space do not need to use hyperslab selections, but they
- cannot use point selections. The result is always a hyperslab
- selection.
+ within the selection of dst_space. The result is placed in the selection
+ of proj_space. Note src_space, dst_space, and src_intersect_space do not
+ need to use hyperslab selections, but they cannot use point selections.
+ The result is always a hyperslab selection.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
@@ -9314,24 +8191,20 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HDassert(dst_space);
HDassert(src_intersect_space);
HDassert(proj_space);
-
+
/* Assert that src_space and src_intersect_space have same extent and there
* are no point selections */
- HDassert(H5S_GET_EXTENT_NDIMS(src_space)
- == H5S_GET_EXTENT_NDIMS(src_intersect_space));
+ HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space));
HDassert(!HDmemcmp(src_space->extent.size, src_intersect_space->extent.size,
- (size_t)H5S_GET_EXTENT_NDIMS(src_space)
- * sizeof(src_space->extent.size[0])));
+ (size_t)H5S_GET_EXTENT_NDIMS(src_space) * sizeof(src_space->extent.size[0])));
HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_POINTS);
HDassert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_POINTS);
HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) != H5S_SEL_POINTS);
/* Initialize prev_space, curr_span_tree, and curr_span_up_dim */
- for(i = 0; i < H5S_MAX_RANK; i++) {
- curr_span_tree[i] = NULL;
- prev_span[i] = NULL;
- curr_span_up_dim[i] = (hsize_t)0;
- } /* end for */
+ HDmemset(curr_span_tree, 0, sizeof(curr_span_tree));
+ HDmemset(prev_span, 0, sizeof(prev_span));
+ HDmemset(curr_span_up_dim, 0, sizeof(curr_span_up_dim));
/* Save rank of projected space */
proj_rank = proj_space->extent.rank;
@@ -9343,8 +8216,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
sis_nelem = (size_t)H5S_GET_SELECT_NPOINTS(src_intersect_space);
HDassert(ss_nelem == ds_nelem);
- /* Calculate proj_down_dims (note loop relies on unsigned i wrapping around)
- */
+ /* Calculate proj_down_dims */
if(H5VM_array_down(proj_rank, proj_space->extent.size, proj_down_dims) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value")
@@ -9358,7 +8230,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Allocate space for the hyperslab selection information (note this sets
* diminfo_valid to FALSE, diminfo arrays to 0, and span list to NULL) */
- if((proj_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t)) == NULL)
+ if(NULL == (proj_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info")
/* Set selection type */
@@ -9367,9 +8239,9 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Set unlim_dim */
proj_space->select.sel_info.hslab->unlim_dim = -1;
- /* Allocate the source space iterator */
+ /* Allocate the source selection iterator */
if(NULL == (ss_iter = H5FL_MALLOC(H5S_sel_iter_t)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source space iterator")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source selection iterator")
/* Initialize source space iterator */
if(H5S_select_iter_init(ss_iter, src_space, (size_t)1) < 0)
@@ -9382,9 +8254,9 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
ss_nelem -= nelem;
HDassert(ss_nseq > 0);
- /* Allocate the destination space iterator */
+ /* Allocate the destination selection iterator */
if(NULL == (ds_iter = H5FL_MALLOC(H5S_sel_iter_t)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate destination space iterator")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate destination selection iterator")
/* Initialize destination space iterator */
if(H5S_select_iter_init(ds_iter, dst_space, (size_t)1) < 0)
@@ -9443,9 +8315,8 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Reset advance_ss */
advance_ss = FALSE;
- } /* end if */
- if(advance_sis
- || (sis_off[sis_i] + sis_len[sis_i] <= ss_off[ss_i])) {
+ } /* end while */
+ if(advance_sis || (sis_off[sis_i] + sis_len[sis_i] <= ss_off[ss_i])) {
do {
/* Either we finished the current source intersect sequence or
* the sequences do not intersect. Advance source intersect
@@ -9483,7 +8354,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
* selection and advance any sequences we complete */
if(ss_off[ss_i] >= sis_off[sis_i])
int_sel_off = ss_sel_off;
- else
+ else
int_sel_off = sis_off[sis_i] - ss_off[ss_i] + ss_sel_off;
if((ss_off[ss_i] + (hsize_t)ss_len[ss_i]) <= (sis_off[sis_i]
+ (hsize_t)sis_len[sis_i])) {
@@ -9524,8 +8395,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HDassert(ds_sel_off <= int_sel_off);
proj_off = ds_off[ds_i] + int_sel_off - ds_sel_off;
proj_len = proj_len_rem = (size_t)MIN(int_len,
- (size_t)(ds_sel_off + (hsize_t)ds_len[ds_i]
- - int_sel_off));
+ (size_t)(ds_sel_off + (hsize_t)ds_len[ds_i] - int_sel_off));
/* Add to span tree */
while(proj_len_rem > (size_t)0) {
@@ -9565,7 +8435,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
(size_t)(proj_space->extent.size[proj_rank - 1]
- low));
HDassert(proj_len_rem >= span_len);
- high = low + (hsize_t)span_len - (hsize_t)1;
+ high = (low + (hsize_t)span_len) - (hsize_t)1;
/* Append span in lowest dimension */
if(H5S__hyper_append_span(&prev_span[proj_rank - 1], &curr_span_tree[proj_rank - 1], low, high, NULL, NULL) < 0)
@@ -9608,8 +8478,9 @@ loop_end:
/* Set the number of elements in current selection */
proj_space->select.num_elem = H5S__hyper_spans_nelem(proj_space->select.sel_info.hslab->span_lst);
- /* Attempt to rebuild "optimized" start/stride/count/block information.
- * from resulting hyperslab span tree */
+ /* Attempt to build "optimized" start/stride/count/block information
+ * from resulting hyperslab span tree.
+ */
H5S__hyper_rebuild(proj_space);
} /* end if */
else
@@ -9791,11 +8662,11 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-void
+static void
H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count,
hsize_t *block, hsize_t clip_size)
{
- FUNC_ENTER_PACKAGE_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check for selection outside clip size */
if(start >= clip_size) {
@@ -9819,7 +8690,7 @@ H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count,
} /* end else */
FUNC_LEAVE_NOAPI_VOID
-} /* end H5S_hyper_get_clip_diminfo() */
+} /* end H5S__hyper_get_clip_diminfo() */
/*--------------------------------------------------------------------------
@@ -9836,8 +8707,7 @@ H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count,
Non-negative on success/Negative on failure.
DESCRIPTION
This function changes the unlimited selection into a limited selection
- with the extent of the formerly unlimited dimension specified by
- * clip_size.
+ with the extent of the formerly unlimited dimension specified by clip_size.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
Note this function does not take the offset into account.
@@ -9851,7 +8721,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
hsize_t orig_count; /* Original count in unlimited dimension */
int orig_unlim_dim; /* Original unliminted dimension */
H5S_hyper_dim_t *diminfo; /* Convenience pointer to opt_diminfo in unlimited dimension */
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -9892,8 +8762,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
} /* end if */
else {
/* Calculate number of elements */
- space->select.num_elem = diminfo->count * diminfo->block
- * hslab->num_elem_non_unlim;
+ space->select.num_elem = diminfo->count * diminfo->block * hslab->num_elem_non_unlim;
/* Check if last block is partial. If superset is set, just keep the
* last block complete to speed computation. */
@@ -9924,8 +8793,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
/* Indicate that the regular dimensions are no longer valid */
hslab->diminfo_valid = FALSE;
- /* "And" selection with calculated block to perform clip operation
- */
+ /* "And" selection with calculated block to perform clip operation */
if(H5S__generate_hyperslab(space, H5S_SELECT_AND, start, H5S_hyper_ones_g, H5S_hyper_ones_g, block) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs")
} /* end if */
@@ -10237,7 +9105,7 @@ H5S_hyper_get_unlim_block(const H5S_t *space, hsize_t block_index)
/* Create output space, copy extent */
if(NULL == (space_out = H5S_create(H5S_SIMPLE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "unable to create output dataspace")
- if(H5S_extent_copy_real(&space_out->extent, &space->extent, TRUE) < 0)
+ if(H5S__extent_copy_real(&space_out->extent, &space->extent, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "unable to copy destination space extent")
/* Select block as defined by start/stride/count/block computed above */
@@ -10364,12 +9232,12 @@ H5Sis_regular_hyperslab(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sis_regular_hyperslab() */
+} /* end H5Sis_regular_hyperslab() */
/*--------------------------------------------------------------------------
NAME
- H5Sgetregular_hyperslab
+ H5Sget_regular_hyperslab
PURPOSE
Retrieve a regular hyperslab selection
USAGE
@@ -10428,5 +9296,5 @@ H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[],
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_regular_hyperslab() */
+} /* end H5Sget_regular_hyperslab() */
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 935d279..01ec3e1 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -14,60 +14,86 @@
/*
* Programmer: rky 980813
*
- * Purpose: Functions to read/write directly between app buffer and file.
+ * Purpose: Create MPI data types for HDF5 selections.
*
- * Beware of the ifdef'ed print statements.
- * I didn't make them portable.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Pprivate.h" /* Property lists */
#include "H5Spkg.h" /* Dataspaces */
#include "H5VMprivate.h" /* Vector and array functions */
#ifdef H5_HAVE_PARALLEL
-static herr_t H5S_mpio_all_type(const H5S_t *space, size_t elmt_size,
+/****************/
+/* Local Macros */
+/****************/
+#define H5S_MPIO_INITIAL_ALLOC_COUNT 256
+#define TWO_GIG_LIMIT 2147483648
+#ifndef H5S_MAX_MPI_COUNT
+#define H5S_MAX_MPI_COUNT 536870911 /* (2^29)-1 */
+#endif
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+static herr_t H5S__mpio_all_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type);
-static herr_t H5S_mpio_none_type(MPI_Datatype *new_type, int *count,
+static herr_t H5S__mpio_none_type(MPI_Datatype *new_type, int *count,
hbool_t *is_derived_type);
-static herr_t H5S_mpio_create_point_datatype(size_t elmt_size, hsize_t num_points,
+static herr_t H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points,
MPI_Aint *disp, MPI_Datatype *new_type);
-static herr_t H5S_mpio_point_type(const H5S_t *space, size_t elmt_size,
+static herr_t H5S__mpio_point_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type,
hbool_t do_permute, hsize_t **permute_map, hbool_t *is_permuted);
-static herr_t H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size,
+static herr_t H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size,
hsize_t **permute_map, MPI_Datatype *new_type, int *count,
hbool_t *is_derived_type);
-static herr_t H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
+static herr_t H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type);
-static herr_t H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
+static herr_t H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type);
-static herr_t H5S_obtain_datatype(const hsize_t down[], H5S_hyper_span_t* span,
+static herr_t H5S__obtain_datatype(const hsize_t down[], H5S_hyper_span_t* span,
const MPI_Datatype *elmt_type, MPI_Datatype *span_type, size_t elmt_size);
-static herr_t H5S_mpio_create_large_type (hsize_t, MPI_Aint, MPI_Datatype , MPI_Datatype *);
+static herr_t H5S__mpio_create_large_type(hsize_t, MPI_Aint, MPI_Datatype , MPI_Datatype *);
-#define H5S_MPIO_INITIAL_ALLOC_COUNT 256
+/*****************************/
+/* Library Private Variables */
+/*****************************/
-#define TWO_GIG_LIMIT 2147483648
-#ifndef H5S_MAX_MPI_COUNT
-#define H5S_MAX_MPI_COUNT 536870911 /* (2^29)-1 */
-#endif
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*******************/
+/* Local Variables */
+/*******************/
static hsize_t bigio_count = H5S_MAX_MPI_COUNT;
+
+
+
/*-------------------------------------------------------------------------
* Function: H5S_mpio_set_bigio_count
*
@@ -75,7 +101,7 @@ static hsize_t bigio_count = H5S_MAX_MPI_COUNT;
* when we utilize derived datatypes. This is of
* particular interest for allowing nightly testing
*
- * Return: the current/previous value of bigio_count.
+ * Return: The current/previous value of bigio_count.
*
* Programmer: Richard Warren, March 10, 2017
*
@@ -85,19 +111,20 @@ hsize_t
H5S_mpio_set_bigio_count(hsize_t new_count)
{
hsize_t orig_count = bigio_count;
- if ((new_count > 0) && (new_count < TWO_GIG_LIMIT)) {
+
+ if((new_count > 0) && (new_count < TWO_GIG_LIMIT))
bigio_count = new_count;
- }
+
return orig_count;
-}
+} /* end H5S_mpio_set_bigio_count() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_all_type
+ * Function: H5S__mpio_all_type
*
* Purpose: Translate an HDF5 "all" selection into an MPI type.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -105,16 +132,11 @@ H5S_mpio_set_bigio_count(hsize_t new_count)
* *is_derived_type 0 if MPI primitive type, 1 if derived
*
* Programmer: rky 980813
- * Modifications:
- * Mohamad Chaarawi
- * Adding support for large datatypes (beyond the limit of a
- * 32 bit integer.
- *
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_all_type(const H5S_t *space, size_t elmt_size,
+H5S__mpio_all_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
hsize_t total_bytes;
@@ -122,7 +144,7 @@ H5S_mpio_all_type(const H5S_t *space, size_t elmt_size,
hsize_t nelmts; /* Total number of elmts */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -133,34 +155,33 @@ H5S_mpio_all_type(const H5S_t *space, size_t elmt_size,
H5_CHECKED_ASSIGN(nelmts, hsize_t, snelmts, hssize_t);
total_bytes = (hsize_t)elmt_size * nelmts;
+
/* Verify that the size can be expressed as a 32 bit integer */
if(bigio_count >= total_bytes) {
- /* fill in the return values */
- *new_type = MPI_BYTE;
- H5_CHECKED_ASSIGN(*count, int, total_bytes, hsize_t);
- *is_derived_type = FALSE;
- }
+ /* fill in the return values */
+ *new_type = MPI_BYTE;
+ H5_CHECKED_ASSIGN(*count, int, total_bytes, hsize_t);
+ *is_derived_type = FALSE;
+ } /* end if */
else {
- /* Create a LARGE derived datatype for this transfer */
- if (H5S_mpio_create_large_type (total_bytes, 0, MPI_BYTE, new_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't create a large datatype from the all selection")
- }
- *count = 1;
- *is_derived_type = TRUE;
- }
+ /* Create a LARGE derived datatype for this transfer */
+ if(H5S__mpio_create_large_type(total_bytes, 0, MPI_BYTE, new_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large datatype from the all selection")
+ *count = 1;
+ *is_derived_type = TRUE;
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_mpio_all_type() */
+} /* H5S__mpio_all_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_none_type
+ * Function: H5S__mpio_none_type
*
* Purpose: Translate an HDF5 "none" selection into an MPI type.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -172,9 +193,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
+H5S__mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* fill in the return values */
*new_type = MPI_BYTE;
@@ -182,15 +203,15 @@ H5S_mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
*is_derived_type = FALSE;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_mpio_none_type() */
+} /* H5S__mpio_none_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_create_point_datatype
+ * Function: H5S__mpio_create_point_datatype
*
* Purpose: Create a derived datatype for point selections.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
*
@@ -198,18 +219,23 @@ H5S_mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5S_mpio_create_point_datatype (size_t elmt_size, hsize_t num_points,
- MPI_Aint *disp, MPI_Datatype *new_type)
+static herr_t
+H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points,
+ MPI_Aint *disp, MPI_Datatype *new_type)
{
MPI_Datatype elmt_type; /* MPI datatype for individual element */
hbool_t elmt_type_created = FALSE; /* Whether the element MPI datatype was created */
- int mpi_code; /* MPI error code */
+ int *inner_blocks = NULL; /* Arrays for MPI datatypes when "large" datatype needed */
+ MPI_Aint *inner_disps = NULL;
+ MPI_Datatype *inner_types = NULL;
+#if MPI_VERSION < 3
int *blocks = NULL; /* Array of block sizes for MPI hindexed create call */
hsize_t u; /* Local index variable */
+#endif
+ int mpi_code; /* MPI error code */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Create an MPI datatype for an element */
if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &elmt_type)))
@@ -219,146 +245,127 @@ H5S_mpio_create_point_datatype (size_t elmt_size, hsize_t num_points,
/* Check whether standard or BIGIO processing will be employeed */
if(bigio_count >= num_points) {
#if MPI_VERSION >= 3
- /* Create an MPI datatype for the whole point selection */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block((int)num_points, 1, disp, elmt_type, new_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_indexed_block failed", mpi_code)
+ /* Create an MPI datatype for the whole point selection */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block((int)num_points, 1, disp, elmt_type, new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_indexed_block failed", mpi_code)
#else
- /* Allocate block sizes for MPI datatype call */
- if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * num_points)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
+ /* Allocate block sizes for MPI datatype call */
+ if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * num_points)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
- for(u = 0; u < num_points; u++)
- blocks[u] = 1;
+ for(u = 0; u < num_points; u++)
+ blocks[u] = 1;
- /* Create an MPI datatype for the whole point selection */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)num_points, blocks, disp, elmt_type, new_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
+ /* Create an MPI datatype for the whole point selection */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)num_points, blocks, disp, elmt_type, new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
#endif
- /* Commit MPI datatype for later use */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
- }
- else {
- /* use LARGE_DATATYPE::
- * We'll create an hindexed_block type for every 2G point count and then combine
- * those and any remaining points into a single large datatype.
- */
- int total_types, i;
- int remaining_points;
- int num_big_types;
- hsize_t leftover;
-
- int *inner_blocks;
- MPI_Aint *inner_disps;
- MPI_Datatype *inner_types = NULL;
+ /* Commit MPI datatype for later use */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
+ } /* end if */
+ else {
+ /* use LARGE_DATATYPE::
+ * We'll create an hindexed_block type for every 2G point count and then combine
+ * those and any remaining points into a single large datatype.
+ */
+ int total_types, i;
+ int remaining_points;
+ int num_big_types;
+ hsize_t leftover;
- /* Calculate how many Big MPI datatypes are needed to represent the buffer */
- num_big_types = (int)(num_points/bigio_count);
+ /* Calculate how many Big MPI datatypes are needed to represent the buffer */
+ num_big_types = (int)(num_points / bigio_count);
- leftover = (hsize_t)num_points - (hsize_t)num_big_types * (hsize_t)bigio_count;
- H5_CHECKED_ASSIGN(remaining_points, int, leftover, hsize_t);
+ leftover = (hsize_t)num_points - (hsize_t)num_big_types * (hsize_t)bigio_count;
+ H5_CHECKED_ASSIGN(remaining_points, int, leftover, hsize_t);
- total_types = (int)(remaining_points) ? (num_big_types + 1) : num_big_types;
+ total_types = (int)(remaining_points) ? (num_big_types + 1) : num_big_types;
- /* Allocate array if MPI derived types needed */
- if(NULL == (inner_types = (MPI_Datatype *)H5MM_malloc((sizeof(MPI_Datatype) * (size_t)total_types))))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
+ /* Allocate array if MPI derived types needed */
+ if(NULL == (inner_types = (MPI_Datatype *)H5MM_malloc((sizeof(MPI_Datatype) * (size_t)total_types))))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
- if(NULL == (inner_blocks = (int *)H5MM_malloc(sizeof(int) * (size_t)total_types)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
+ if(NULL == (inner_blocks = (int *)H5MM_malloc(sizeof(int) * (size_t)total_types)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
- if(NULL == (inner_disps = (MPI_Aint *)H5MM_malloc(sizeof(MPI_Aint) * (size_t)total_types)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
+ if(NULL == (inner_disps = (MPI_Aint *)H5MM_malloc(sizeof(MPI_Aint) * (size_t)total_types)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
#if MPI_VERSION < 3
- /* Allocate block sizes for MPI datatype call */
- if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * bigio_count)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
+ /* Allocate block sizes for MPI datatype call */
+ if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * bigio_count)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
- for(u = 0; u < bigio_count; u++)
- blocks[u] = 1;
+ for(u = 0; u < bigio_count; u++)
+ blocks[u] = 1;
#endif
- for(i=0 ; i<num_big_types ; i++) {
+ for(i = 0; i < num_big_types; i++) {
#if MPI_VERSION >= 3
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(bigio_count,
- 1,
- &disp[i*bigio_count],
- elmt_type,
- &inner_types[i]))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code);
- }
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(bigio_count,
+ 1, &disp[i*bigio_count], elmt_type, &inner_types[i])))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code)
#else
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)bigio_count,
- blocks,
- &disp[i*bigio_count],
- elmt_type,
- &inner_types[i]))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
- }
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)bigio_count,
+ blocks, &disp[i*bigio_count], elmt_type, &inner_types[i])))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
#endif
- inner_blocks[i] = 1;
- inner_disps[i] = 0;
- }
+ inner_blocks[i] = 1;
+ inner_disps[i] = 0;
+ } /* end for*/
- if(remaining_points) {
+ if(remaining_points) {
#if MPI_VERSION >= 3
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(remaining_points,
- 1,
- &disp[num_big_types*bigio_count],
- elmt_type,
- &inner_types[num_big_types]))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code);
- }
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(remaining_points,
+ 1, &disp[num_big_types*bigio_count], elmt_type, &inner_types[num_big_types])))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code)
#else
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)remaining_points,
- blocks,
- &disp[num_big_types*bigio_count],
- elmt_type,
- &inner_types[num_big_types]))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
- }
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)remaining_points,
+ blocks, &disp[num_big_types*bigio_count], elmt_type, &inner_types[num_big_types])))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
#endif
- inner_blocks[num_big_types] = 1;
- inner_disps[num_big_types] = 0;
- }
-
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(total_types,
- inner_blocks,
- inner_disps,
- inner_types,
- new_type))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct", mpi_code);
- }
- for(i=0 ; i<total_types ; i++)
- MPI_Type_free(&inner_types[i]);
-
- H5MM_free(inner_types);
- H5MM_free(inner_blocks);
- H5MM_free(inner_disps);
-
- /* Commit MPI datatype for later use */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
- }
+ inner_blocks[num_big_types] = 1;
+ inner_disps[num_big_types] = 0;
+ } /* end if */
+
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(total_types,
+ inner_blocks, inner_disps, inner_types, new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct", mpi_code)
+ for(i = 0; i < total_types; i++)
+ MPI_Type_free(&inner_types[i]);
+
+ /* Commit MPI datatype for later use */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
+ } /* end else */
+
done:
if(elmt_type_created)
MPI_Type_free(&elmt_type);
+#if MPI_VERSION < 3
if(blocks)
H5MM_free(blocks);
+#endif
+ if(inner_types)
+ H5MM_free(inner_types);
+ if(inner_blocks)
+ H5MM_free(inner_blocks);
+ if(inner_disps)
+ H5MM_free(inner_disps);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_mpio_create_point_datatype() */
+} /* H5S__mpio_create_point_datatype() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_point_type
+ * Function: H5S__mpio_point_type
*
* Purpose: Translate an HDF5 "point" selection into an MPI type.
* Create a permutation array to handle out-of-order point selections.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -373,7 +380,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type,
+H5S__mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type,
int *count, hbool_t *is_derived_type, hbool_t do_permute, hsize_t **permute,
hbool_t *is_permuted)
{
@@ -384,7 +391,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
hsize_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -406,23 +413,23 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
/* Iterate through list of elements */
curr = space->select.sel_info.pnt_lst->head;
for(u = 0 ; u < num_points ; u++) {
- /* calculate the displacement of the current point */
+ /* Calculate the displacement of the current point */
disp[u] = H5VM_array_offset(space->extent.rank, space->extent.size, curr->pnt);
disp[u] *= elmt_size;
- /* This is a File Space used to set the file view, so adjust the displacements
+ /* This is a File Space used to set the file view, so adjust the displacements
* to have them monotonically non-decreasing.
- * Generate the permutation array by indicating at each point being selected,
- * the position it will shifted in the new displacement. Example:
- * Suppose 4 points with corresponding are selected
- * Pt 1: disp=6 ; Pt 2: disp=3 ; Pt 3: disp=0 ; Pt 4: disp=4
+ * Generate the permutation array by indicating at each point being selected,
+ * the position it will shifted in the new displacement. Example:
+ * Suppose 4 points with corresponding are selected
+ * Pt 1: disp=6 ; Pt 2: disp=3 ; Pt 3: disp=0 ; Pt 4: disp=4
* The permute map to sort the displacements in order will be:
* point 1: map[0] = L, indicating that this point is not moved (1st point selected)
- * point 2: map[1] = 0, indicating that this point is moved to the first position,
+ * point 2: map[1] = 0, indicating that this point is moved to the first position,
* since disp_pt1(6) > disp_pt2(3)
- * point 3: map[2] = 0, move to position 0, bec it has the lowest disp between
+ * point 3: map[2] = 0, move to position 0, bec it has the lowest disp between
* the points selected so far.
- * point 4: map[3] = 2, move the 2nd position since point 1 has a higher disp,
+ * point 4: map[3] = 2, move the 2nd position since point 1 has a higher disp,
* but points 2 and 3 have lower displacements.
*/
if(do_permute) {
@@ -447,7 +454,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
HDmemmove(disp + m + 1, disp + m, (u - m) * sizeof(MPI_Aint));
disp[m] = temp;
} /* end if */
- (*permute)[u] = m;
+ (*permute)[u] = m;
} /* end if */
else
(*permute)[u] = num_points;
@@ -455,7 +462,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
/* this is a memory space, and no permutation is necessary to create
the derived datatype */
else {
- ;/* do nothing */
+ ; /* do nothing */
} /* end else */
/* get the next point */
@@ -463,7 +470,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
} /* end for */
/* Create the MPI datatype for the set of element displacements */
- if(H5S_mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0)
+ if(H5S__mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create an MPI Datatype from point selection")
/* Set values about MPI datatype created */
@@ -481,11 +488,11 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_mpio_point_type() */
+} /* H5S__mpio_point_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_permute_type
+ * Function: H5S__mpio_permute_type
*
* Purpose: Translate an HDF5 "all/hyper/point" selection into an MPI type,
* while applying the permutation map. This function is called if
@@ -496,7 +503,7 @@ done:
* Note: This routine is called from H5S_mpio_space_type(), which is
* called first for the file dataspace and creates
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -508,7 +515,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
+H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
MPI_Aint *disp = NULL; /* Datatype displacement for each point*/
@@ -520,7 +527,7 @@ H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
hsize_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -571,12 +578,12 @@ H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
/* Set the displacement of the current point */
disp[u] = curr_off;
- /* This is a memory displacement, so for each point selected,
+ /* This is a memory displacement, so for each point selected,
* apply the map that was generated by the file selection */
if((*permute)[u] != num_points) {
MPI_Aint temp = disp[u];
- HDmemmove(disp + (*permute)[u] + 1, disp + (*permute)[u],
+ HDmemmove(disp + (*permute)[u] + 1, disp + (*permute)[u],
(u - (*permute)[u]) * sizeof(MPI_Aint));
disp[(*permute)[u]] = temp;
} /* end if */
@@ -597,7 +604,7 @@ H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
} /* end while */
/* Create the MPI datatype for the set of element displacements */
- if(H5S_mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0)
+ if(H5S__mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create an MPI Datatype from point selection")
/* Set values about MPI datatype created */
@@ -619,15 +626,15 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_mpio_permute_type() */
+} /* H5S__mpio_permute_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_hyper_type
+ * Function: H5S__mpio_reg_hyper_type
*
- * Purpose: Translate an HDF5 hyperslab selection into an MPI type.
+ * Purpose: Translate a regular HDF5 hyperslab selection into an MPI type.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -635,14 +642,11 @@ done:
* *is_derived_type 0 if MPI primitive type, 1 if derived
*
* Programmer: rky 980813
- * Modifications:
- * Mohamad Chaarawi
- * Adding support for large datatypes (beyond the limit of a
- * 32 bit integer.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
+H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
H5S_sel_iter_t sel_iter; /* Selection iteration info */
@@ -668,7 +672,7 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
int mpi_code; /* MPI return code */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -683,16 +687,15 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
diminfo = sel_iter.u.hyp.diminfo;
HDassert(diminfo);
- /* make a local copy of the dimension info so we can operate with them */
+ /* Make a local copy of the dimension info so we can operate with them */
/* Check if this is a "flattened" regular hyperslab selection */
if(sel_iter.u.hyp.iter_rank != 0 && sel_iter.u.hyp.iter_rank < space->extent.rank) {
/* Flattened selection */
rank = sel_iter.u.hyp.iter_rank;
- HDassert(rank <= H5S_MAX_RANK); /* within array bounds */
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "%s: Flattened selection\n",FUNC);
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S), "%s: Flattened selection\n",FUNC);
#endif
for(u = 0; u < rank; ++u) {
H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t)
@@ -701,33 +704,30 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
d[u].block = diminfo[u].block;
d[u].count = diminfo[u].count;
d[u].xtent = sel_iter.u.hyp.size[u];
+
#ifdef H5S_DEBUG
- if(H5DEBUG(S)){
- HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu",
- FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent );
- if (u==0)
- HDfprintf(H5DEBUG(S), " rank=%u\n", rank );
- else
- HDfprintf(H5DEBUG(S), "\n" );
- }
+if(H5DEBUG(S)) {
+ HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu",
+ FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent);
+ if(u == 0)
+ HDfprintf(H5DEBUG(S), " rank=%u\n", rank);
+ else
+ HDfprintf(H5DEBUG(S), "\n");
+}
#endif
- if(0 == d[u].block)
- goto empty;
- if(0 == d[u].count)
- goto empty;
- if(0 == d[u].xtent)
- goto empty;
+
+ /* Sanity check */
+ HDassert(d[u].block > 0);
+ HDassert(d[u].count > 0);
+ HDassert(d[u].xtent > 0);
} /* end for */
} /* end if */
else {
/* Non-flattened selection */
rank = space->extent.rank;
- HDassert(rank <= H5S_MAX_RANK); /* within array bounds */
- if(0 == rank)
- goto empty;
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S),"%s: Non-flattened selection\n",FUNC);
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S),"%s: Non-flattened selection\n",FUNC);
#endif
for(u = 0; u < rank; ++u) {
H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t)
@@ -736,22 +736,22 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
d[u].block = diminfo[u].block;
d[u].count = diminfo[u].count;
d[u].xtent = space->extent.size[u];
+
#ifdef H5S_DEBUG
- if(H5DEBUG(S)){
+if(H5DEBUG(S)) {
HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu",
- FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent );
- if (u==0)
- HDfprintf(H5DEBUG(S), " rank=%u\n", rank );
+ FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent);
+ if(u == 0)
+ HDfprintf(H5DEBUG(S), " rank=%u\n", rank);
else
- HDfprintf(H5DEBUG(S), "\n" );
- }
+ HDfprintf(H5DEBUG(S), "\n");
+}
#endif
- if(0 == d[u].block)
- goto empty;
- if(0 == d[u].count)
- goto empty;
- if(0 == d[u].xtent)
- goto empty;
+
+ /* Sanity check */
+ HDassert(d[u].block > 0);
+ HDassert(d[u].count > 0);
+ HDassert(d[u].xtent > 0);
} /* end for */
} /* end else */
@@ -762,56 +762,52 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
offset[rank - 1] = 1;
max_xtent[rank - 1] = d[rank - 1].xtent;
#ifdef H5S_DEBUG
- if(H5DEBUG(S)) {
- i = ((int)rank) - 1;
- HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n",
- i, offset[i], i, max_xtent[i]);
- }
+if(H5DEBUG(S)) {
+ i = ((int)rank) - 1;
+ HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", i, offset[i], i, max_xtent[i]);
+}
#endif
for(i = ((int)rank) - 2; i >= 0; --i) {
offset[i] = offset[i + 1] * d[i + 1].xtent;
max_xtent[i] = max_xtent[i + 1] * d[i].xtent;
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n",
- i, offset[i], i, max_xtent[i]);
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", i, offset[i], i, max_xtent[i]);
#endif
} /* end for */
/* Create a type covering the selected hyperslab.
* Multidimensional dataspaces are stored in row-major order.
* The type is built from the inside out, going from the
- * fastest-changing (i.e., inner) dimension * to the slowest (outer). */
+ * fastest-changing (i.e., inner) dimension * to the slowest (outer).
+ */
/*******************************************************
* Construct contig type for inner contig dims:
*******************************************************/
#ifdef H5S_DEBUG
- if(H5DEBUG(S)) {
+if(H5DEBUG(S)) {
HDfprintf(H5DEBUG(S), "%s: Making contig type %Zu MPI_BYTEs\n", FUNC, elmt_size);
for(i = ((int)rank) - 1; i >= 0; --i)
HDfprintf(H5DEBUG(S), "d[%d].xtent=%Hu \n", i, d[i].xtent);
- }
+}
#endif
/* LARGE_DATATYPE::
- * Check if the number of elements to form the inner type fits into a 32 bit integer.
+ * Check if the number of elements to form the inner type fits into a 32 bit integer.
* If yes then just create the innertype with MPI_Type_contiguous.
* Otherwise create a compound datatype by iterating as many times as needed
* for the innertype to be created.
*/
if(bigio_count >= elmt_size) {
- /* Use a single MPI datatype that has a 32 bit size */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &inner_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
- else {
- /* Create the compound datatype for this operation (> 2GB) */
- if (H5S_mpio_create_large_type (elmt_size, 0, MPI_BYTE, &inner_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't ccreate a large inner datatype in hyper selection")
- }
- }
+ /* Use a single MPI datatype that has a 32 bit size */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &inner_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
+ } /* end if */
+ else
+ /* Create the compound datatype for this operation (> 2GB) */
+ if(H5S__mpio_create_large_type(elmt_size, 0, MPI_BYTE, &inner_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large inner datatype in hyper selection")
/*******************************************************
* Construct the type by walking the hyperslab dims
@@ -819,65 +815,57 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
*******************************************************/
for(i = ((int)rank) - 1; i >= 0; --i) {
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "%s: Dimension i=%d \n"
- "start=%Hd count=%Hu block=%Hu stride=%Hu, xtent=%Hu max_xtent=%d\n",
- FUNC, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]);
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S), "%s: Dimension i=%d \n"
+ "start=%Hd count=%Hu block=%Hu stride=%Hu, xtent=%Hu max_xtent=%d\n",
+ FUNC, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]);
#endif
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", FUNC,i);
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", FUNC,i);
#endif
/****************************************
- * Build vector type of the selection.
- ****************************************/
- if (bigio_count >= d[i].count &&
- bigio_count >= d[i].block &&
- bigio_count >= d[i].strid) {
-
- /* All the parameters fit into 32 bit integers so create the vector type normally */
- mpi_code = MPI_Type_vector((int)(d[i].count), /* count */
- (int)(d[i].block), /* blocklength */
- (int)(d[i].strid), /* stride */
- inner_type, /* old type */
- &outer_type); /* new type */
-
- MPI_Type_free(&inner_type);
- if(mpi_code != MPI_SUCCESS)
- HMPI_GOTO_ERROR(FAIL, "couldn't create MPI vector type", mpi_code)
- }
+ * Build vector type of the selection.
+ ****************************************/
+ if(bigio_count >= d[i].count &&
+ bigio_count >= d[i].block && bigio_count >= d[i].strid) {
+ /* All the parameters fit into 32 bit integers so create the vector type normally */
+ mpi_code = MPI_Type_vector((int)(d[i].count), /* count */
+ (int)(d[i].block), /* blocklength */
+ (int)(d[i].strid), /* stride */
+ inner_type, /* old type */
+ &outer_type); /* new type */
+
+ MPI_Type_free(&inner_type);
+ if(mpi_code != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "couldn't create MPI vector type", mpi_code)
+ } /* end if */
else {
- /* Things get a bit more complicated and require LARGE_DATATYPE processing
- * There are two MPI datatypes that need to be created:
- * 1) an internal contiguous block; and
- * 2) a collection of elements where an element is a contiguous block(1).
- * Remember that the input arguments to the MPI-IO functions use integer
- * values to represent element counts. We ARE allowed however, in the
- * more recent MPI implementations to use constructed datatypes whereby
- * the total number of bytes in a transfer could be :
- * (2GB-1)number_of_blocks * the_datatype_extent.
- */
+ /* Things get a bit more complicated and require LARGE_DATATYPE processing
+ * There are two MPI datatypes that need to be created:
+ * 1) an internal contiguous block; and
+ * 2) a collection of elements where an element is a contiguous block(1).
+ * Remember that the input arguments to the MPI-IO functions use integer
+ * values to represent element counts. We ARE allowed however, in the
+ * more recent MPI implementations to use constructed datatypes whereby
+ * the total number of bytes in a transfer could be :
+ * (2GB-1)number_of_blocks * the_datatype_extent.
+ */
MPI_Aint stride_in_bytes, inner_extent;
MPI_Datatype block_type;
- /* create a contiguous datatype inner_type x number of BLOCKS.
- * Again we need to check that the number of BLOCKS can fit into
+ /* Create a contiguous datatype inner_type x number of BLOCKS.
+ * Again we need to check that the number of BLOCKS can fit into
* a 32 bit integer */
- if (bigio_count < d[i].block) {
- if (H5S_mpio_create_large_type(d[i].block, 0, inner_type,
- &block_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't ccreate a large block datatype in hyper selection")
- }
- }
- else {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)d[i].block,
- inner_type,
- &block_type)))
+ if(bigio_count < d[i].block) {
+ if(H5S__mpio_create_large_type(d[i].block, 0, inner_type, &block_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large block datatype in hyper selection")
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)d[i].block, inner_type, &block_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
/* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default,
* so we're using the MPI-2 version even though we don't need the lb
@@ -892,40 +880,38 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
/* If the element count is larger than what a 32 bit integer can hold,
* we call the large type creation function to handle that
*/
- if (bigio_count < d[i].count) {
- if (H5S_mpio_create_large_type (d[i].count, stride_in_bytes, block_type,
- &outer_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't create a large outer datatype in hyper selection")
- }
- }
+ if(bigio_count < d[i].count) {
+ if(H5S__mpio_create_large_type(d[i].count, stride_in_bytes, block_type, &outer_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large outer datatype in hyper selection")
+ } /* end if */
/* otherwise a regular create_hvector will do */
- else {
- mpi_code = MPI_Type_create_hvector((int)d[i].count, /* count */
- 1, /* blocklength */
- stride_in_bytes, /* stride in bytes*/
- block_type, /* old type */
- &outer_type); /* new type */
- if(MPI_SUCCESS != mpi_code)
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)d[i].count, /* count */
+ 1, /* blocklength */
+ stride_in_bytes, /* stride in bytes*/
+ block_type, /* old type */
+ &outer_type))) /* new type */
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
- }
+
MPI_Type_free(&block_type);
MPI_Type_free(&inner_type);
- }
- /****************************************
- * Then build the dimension type as (start, vector type, xtent).
- ****************************************/
- /* calculate start and extent values of this dimension */
+ } /* end else */
+
+ /****************************************
+ * Then build the dimension type as (start, vector type, xtent).
+ ****************************************/
+
+ /* Calculate start and extent values of this dimension */
start_disp = d[i].start * offset[i] * elmt_size;
new_extent = (MPI_Aint)elmt_size * max_xtent[i];
if(MPI_SUCCESS != (mpi_code = MPI_Type_get_extent(outer_type, &lb, &extent_len)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_get_extent failed", mpi_code)
/*************************************************
- * Restructure this datatype ("outer_type")
- * so that it still starts at 0, but its extent
- * is the full extent in this dimension.
- *************************************************/
+ * Restructure this datatype ("outer_type")
+ * so that it still starts at 0, but its extent
+ * is the full extent in this dimension.
+ *************************************************/
if(start_disp > 0 || extent_len < new_extent) {
MPI_Datatype interm_type;
int block_len = 1;
@@ -957,13 +943,6 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
/* fill in the remaining return values */
*count = 1; /* only have to move one of these suckers! */
*is_derived_type = TRUE;
- HGOTO_DONE(SUCCEED);
-
-empty:
- /* special case: empty hyperslab */
- *new_type = MPI_BYTE;
- *count = 0;
- *is_derived_type = FALSE;
done:
/* Release selection iterator */
@@ -972,21 +951,20 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "Leave %s, count=%ld is_derived_type=%t\n",
- FUNC, *count, *is_derived_type );
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S), "Leave %s, count=%ld is_derived_type=%t\n", FUNC, *count, *is_derived_type);
#endif
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_mpio_hyper_type() */
+} /* end H5S__mpio_reg_hyper_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_span_hyper_type
+ * Function: H5S__mpio_span_hyper_type
*
* Purpose: Translate an HDF5 irregular hyperslab selection into an
MPI type.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -995,14 +973,10 @@ done:
*
* Programmer: kyang
*
- * Modifications:
- * Mohamad Chaarawi
- * Adding support for large datatypes (beyond the limit of a
- * 32 bit integer.
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
+H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
MPI_Datatype elmt_type; /* MPI datatype for an element */
@@ -1012,7 +986,7 @@ H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
int mpi_code; /* MPI return code */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -1021,17 +995,13 @@ H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
HDassert(space->select.sel_info.hslab->span_lst->head);
/* Create the base type for an element */
- if (bigio_count >= elmt_size) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &elmt_type))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
- }
- else {
- if (H5S_mpio_create_large_type (elmt_size, 0, MPI_BYTE, &elmt_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't create a large element datatype in span_hyper selection")
- }
- }
+ if(bigio_count >= elmt_size) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &elmt_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
+ } /* end if */
+ else
+ if(H5S__mpio_create_large_type(elmt_size, 0, MPI_BYTE, &elmt_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large element datatype in span_hyper selection")
elmt_type_is_derived = TRUE;
/* Compute 'down' sizes for each dimension */
@@ -1039,8 +1009,8 @@ H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGETSIZE, FAIL, "couldn't compute 'down' dimension sizes")
/* Obtain derived data type */
- if(H5S_obtain_datatype(down, space->select.sel_info.hslab->span_lst->head, &elmt_type, &span_type, elmt_size) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
+ if(H5S__obtain_datatype(down, space->select.sel_info.hslab->span_lst->head, &elmt_type, &span_type, elmt_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&span_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
*new_type = span_type;
@@ -1056,16 +1026,15 @@ done:
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_mpio_span_hyper_type() */
+} /* end H5S__mpio_span_hyper_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_obtain_datatype
+ * Function: H5S__obtain_datatype
*
- * Purpose: Obtain an MPI derived datatype based on span-tree
- * implementation
+ * Purpose: Obtain an MPI derived datatype for span-tree hyperslab selection
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *span_type the MPI type corresponding to the selection
*
@@ -1074,11 +1043,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span,
+H5S__obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span,
const MPI_Datatype *elmt_type, MPI_Datatype *span_type, size_t elmt_size)
{
size_t alloc_count = 0; /* Number of span tree nodes allocated at this level */
- size_t outercount = 0; /* Number of span tree nodes at this level */
+ size_t outercount; /* Number of span tree nodes at this level */
MPI_Datatype *inner_type = NULL;
hbool_t inner_types_freed = FALSE; /* Whether the inner_type MPI datatypes have been freed */
hbool_t span_type_valid = FALSE; /* Whether the span_type MPI datatypes is valid */
@@ -1089,7 +1058,7 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span,
int mpi_code; /* MPI return status code */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(span);
@@ -1129,16 +1098,14 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span,
blocklen[outercount] = (int)tspan->nelem;
tspan = tspan->next;
- if (bigio_count < blocklen[outercount]) {
+ if(bigio_count < blocklen[outercount])
large_block = TRUE; /* at least one block type is large, so set this flag to true */
- }
outercount++;
} /* end while */
/* Everything fits into integers, so cast them and use hindexed */
- if (bigio_count >= outercount && large_block == FALSE) {
-
+ if(bigio_count >= outercount && large_block == FALSE) {
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)outercount, blocklen, disp, *elmt_type, span_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
span_type_valid = TRUE;
@@ -1150,7 +1117,7 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span,
MPI_Datatype temp_type = MPI_DATATYPE_NULL, outer_type = MPI_DATATYPE_NULL;
/* create the block type from elmt_type while checking the 32 bit int limit */
if (blocklen[i] > bigio_count) {
- if (H5S_mpio_create_large_type (blocklen[i], 0, *elmt_type, &temp_type) < 0) {
+ if (H5S__mpio_create_large_type (blocklen[i], 0, *elmt_type, &temp_type) < 0) {
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
"couldn't create a large element datatype in span_hyper selection")
}
@@ -1233,7 +1200,7 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span,
blocklen[outercount] = 1;
/* Generate MPI datatype for next dimension down */
- if(H5S_obtain_datatype(down + 1, tspan->down->head, elmt_type, &down_type, elmt_size) < 0)
+ if(H5S__obtain_datatype(down + 1, tspan->down->head, elmt_type, &down_type, elmt_size) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
/* Build the MPI datatype for this node */
@@ -1291,7 +1258,7 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_obtain_datatype() */
+} /* end H5S__obtain_datatype() */
/*-------------------------------------------------------------------------
@@ -1300,7 +1267,7 @@ done:
* Purpose: Translate an HDF5 dataspace selection into an MPI type.
* Currently handle only hyperslab and "all" selections.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -1312,7 +1279,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type,
+H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type,
int *count, hbool_t *is_derived_type, hbool_t do_permute, hsize_t **permute_map,
hbool_t *is_permuted)
{
@@ -1333,10 +1300,10 @@ H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
* out-of-order point selection, then permute this selection which
* should be a memory selection to match the file space permutation.
*/
- if(TRUE == *is_permuted) {
+ if(TRUE == *is_permuted) {
switch(H5S_GET_SELECT_TYPE(space)) {
case H5S_SEL_NONE:
- if(H5S_mpio_none_type(new_type, count, is_derived_type) < 0)
+ if(H5S__mpio_none_type(new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't convert 'none' selection to MPI type")
break;
@@ -1346,7 +1313,7 @@ H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
/* Sanity check */
HDassert(!do_permute);
- if(H5S_mpio_permute_type(space, elmt_size, permute_map, new_type, count, is_derived_type) < 0)
+ if(H5S__mpio_permute_type(space, elmt_size, permute_map, new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't convert 'all' selection to MPI type")
break;
@@ -1361,29 +1328,28 @@ H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
else {
switch(H5S_GET_SELECT_TYPE(space)) {
case H5S_SEL_NONE:
- if(H5S_mpio_none_type(new_type, count, is_derived_type) < 0)
+ if(H5S__mpio_none_type(new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert 'none' selection to MPI type")
break;
case H5S_SEL_ALL:
- if(H5S_mpio_all_type(space, elmt_size, new_type, count, is_derived_type) < 0)
+ if(H5S__mpio_all_type(space, elmt_size, new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert 'all' selection to MPI type")
break;
case H5S_SEL_POINTS:
- if(H5S_mpio_point_type(space, elmt_size, new_type, count, is_derived_type, do_permute, permute_map, is_permuted) < 0)
+ if(H5S__mpio_point_type(space, elmt_size, new_type, count, is_derived_type, do_permute, permute_map, is_permuted) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't convert 'point' selection to MPI type")
break;
case H5S_SEL_HYPERSLABS:
if((H5S_SELECT_IS_REGULAR(space) == TRUE)) {
- if(H5S_mpio_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0)
+ if(H5S__mpio_reg_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert regular 'hyperslab' selection to MPI type")
} /* end if */
- else {
- if(H5S_mpio_span_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0)
+ else
+ if(H5S__mpio_span_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert irregular 'hyperslab' selection to MPI type")
- } /* end else */
break;
case H5S_SEL_ERROR:
@@ -1407,12 +1373,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_create_large_type
+ * Function: H5S__mpio_create_large_type
*
- * Purpose: Create a large datatype of size larger than what a 32 bit integer
+ * Purpose: Create a large datatype of size larger than what a 32 bit integer
* can hold.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* *new_type the new datatype created
*
@@ -1420,10 +1386,9 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t H5S_mpio_create_large_type (hsize_t num_elements,
- MPI_Aint stride_bytes,
- MPI_Datatype old_type,
- MPI_Datatype *new_type)
+static herr_t
+H5S__mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes,
+ MPI_Datatype old_type, MPI_Datatype *new_type)
{
int num_big_types; /* num times the 2G datatype will be repeated */
int remaining_bytes; /* the number of bytes left that can be held in an int value */
@@ -1434,7 +1399,7 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements,
MPI_Aint disp[2], old_extent;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Calculate how many Big MPI datatypes are needed to represent the buffer */
num_big_types = (int)(num_elements/bigio_count);
@@ -1447,41 +1412,23 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements,
* use type_hvector to create the type with the displacement provided
*/
if (0 == stride_bytes) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(bigio_count,
- old_type,
- &inner_type))) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(bigio_count, old_type, &inner_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
- }
- else {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector (bigio_count,
- 1,
- stride_bytes,
- old_type,
- &inner_type))) {
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector(bigio_count, 1, stride_bytes, old_type, &inner_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
- }
- }
/* Create a contiguous datatype of the buffer (minus the remaining < 2GB part)
* If a stride is present, use hvector type
*/
- if (0 == stride_bytes) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(num_big_types,
- inner_type,
- &outer_type))) {
+ if(0 == stride_bytes) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(num_big_types, inner_type, &outer_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
- }
- else {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector (num_big_types,
- 1,
- stride_bytes,
- inner_type,
- &outer_type))) {
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector(num_big_types, 1, stride_bytes, inner_type, &outer_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
- }
- }
MPI_Type_free(&inner_type);
@@ -1489,23 +1436,13 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements,
* use a struct datatype to encapsulate everything.
*/
if(remaining_bytes) {
- if (stride_bytes == 0) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous (remaining_bytes,
- old_type,
- &leftover_type))) {
+ if(stride_bytes == 0) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(remaining_bytes, old_type, &leftover_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
- }
- else {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector
- ((int)(num_elements - (hsize_t)num_big_types*bigio_count),
- 1,
- stride_bytes,
- old_type,
- &leftover_type))) {
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)(num_elements - (hsize_t)num_big_types * bigio_count), 1, stride_bytes, old_type, &leftover_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
- }
- }
/* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default,
* so we're using the MPI-2 version even though we don't need the lb
@@ -1522,28 +1459,25 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements,
block_len[0] = 1;
block_len[1] = 1;
disp[0] = 0;
- disp[1] = (old_extent+stride_bytes)*num_big_types*(MPI_Aint)bigio_count;
+ disp[1] = (old_extent + stride_bytes) * num_big_types * (MPI_Aint)bigio_count;
- if(MPI_SUCCESS != (mpi_code =
- MPI_Type_create_struct(2, block_len, disp, type, new_type))) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(2, block_len, disp, type, new_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
- }
MPI_Type_free(&outer_type);
MPI_Type_free(&leftover_type);
- }
- else {
+ } /* end if */
+ else
/* There are no remaining bytes so just set the new type to
* the outer type created */
*new_type = outer_type;
- }
if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_mpio_create_large_type */
+} /* end H5S__mpio_create_large_type() */
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Snone.c b/src/H5Snone.c
index a8aaf7e..86994dd 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -18,166 +18,197 @@
* Purpose: "None" selection dataspace I/O functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
-#include "H5private.h"
-#include "H5Eprivate.h"
-#include "H5Iprivate.h"
-#include "H5Spkg.h"
-#include "H5VMprivate.h"
-#include "H5Dprivate.h"
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* ID Functions */
+#include "H5Spkg.h" /* Dataspace functions */
+#include "H5VMprivate.h" /* Vector functions */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
-/* Static function prototypes */
+
+/********************/
+/* Local Prototypes */
+/********************/
/* Selection callbacks */
-static herr_t H5S_none_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
-static herr_t H5S_none_get_seq_list(const H5S_t *space, unsigned flags,
+static herr_t H5S__none_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
+static herr_t H5S__none_get_seq_list(const H5S_t *space, unsigned flags,
H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
-static herr_t H5S_none_release(H5S_t *space);
-static htri_t H5S_none_is_valid(const H5S_t *space);
-static hssize_t H5S_none_serial_size(const H5S_t *space);
-static herr_t H5S_none_serialize(const H5S_t *space, uint8_t **p);
-static herr_t H5S_none_deserialize(H5S_t *space, uint32_t version, uint8_t flags,
+static herr_t H5S__none_release(H5S_t *space);
+static htri_t H5S__none_is_valid(const H5S_t *space);
+static hssize_t H5S__none_serial_size(const H5S_t *space);
+static herr_t H5S__none_serialize(const H5S_t *space, uint8_t **p);
+static herr_t H5S__none_deserialize(H5S_t *space, uint32_t version, uint8_t flags,
const uint8_t **p);
-static herr_t H5S_none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
-static herr_t H5S_none_offset(const H5S_t *space, hsize_t *off);
+static herr_t H5S__none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
+static herr_t H5S__none_offset(const H5S_t *space, hsize_t *off);
static int H5S__none_unlim_dim(const H5S_t *space);
-static htri_t H5S_none_is_contiguous(const H5S_t *space);
-static htri_t H5S_none_is_single(const H5S_t *space);
-static htri_t H5S_none_is_regular(const H5S_t *space);
-static herr_t H5S_none_adjust_u(H5S_t *space, const hsize_t *offset);
-static herr_t H5S_none_project_scalar(const H5S_t *space, hsize_t *offset);
-static herr_t H5S_none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
-static herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
+static htri_t H5S__none_is_contiguous(const H5S_t *space);
+static htri_t H5S__none_is_single(const H5S_t *space);
+static htri_t H5S__none_is_regular(const H5S_t *space);
+static herr_t H5S__none_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S__none_project_scalar(const H5S_t *space, hsize_t *offset);
+static herr_t H5S__none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
+static herr_t H5S__none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
/* Selection iteration callbacks */
-static herr_t H5S_none_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
-static herr_t H5S_none_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
-static hsize_t H5S_none_iter_nelmts(const H5S_sel_iter_t *iter);
-static htri_t H5S_none_iter_has_next_block(const H5S_sel_iter_t *iter);
-static herr_t H5S_none_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
-static herr_t H5S_none_iter_next_block(H5S_sel_iter_t *sel_iter);
-static herr_t H5S_none_iter_release(H5S_sel_iter_t *sel_iter);
+static herr_t H5S__none_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
+static herr_t H5S__none_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
+static hsize_t H5S__none_iter_nelmts(const H5S_sel_iter_t *iter);
+static htri_t H5S__none_iter_has_next_block(const H5S_sel_iter_t *iter);
+static herr_t H5S__none_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
+static herr_t H5S__none_iter_next_block(H5S_sel_iter_t *sel_iter);
+static herr_t H5S__none_iter_release(H5S_sel_iter_t *sel_iter);
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
/* Selection properties for "none" selections */
const H5S_select_class_t H5S_sel_none[1] = {{
H5S_SEL_NONE,
/* Methods on selection */
- H5S_none_copy,
- H5S_none_get_seq_list,
- H5S_none_release,
- H5S_none_is_valid,
- H5S_none_serial_size,
- H5S_none_serialize,
- H5S_none_deserialize,
- H5S_none_bounds,
- H5S_none_offset,
+ H5S__none_copy,
+ H5S__none_get_seq_list,
+ H5S__none_release,
+ H5S__none_is_valid,
+ H5S__none_serial_size,
+ H5S__none_serialize,
+ H5S__none_deserialize,
+ H5S__none_bounds,
+ H5S__none_offset,
H5S__none_unlim_dim,
NULL,
- H5S_none_is_contiguous,
- H5S_none_is_single,
- H5S_none_is_regular,
- H5S_none_adjust_u,
- H5S_none_project_scalar,
- H5S_none_project_simple,
- H5S_none_iter_init,
+ H5S__none_is_contiguous,
+ H5S__none_is_single,
+ H5S__none_is_regular,
+ H5S__none_adjust_u,
+ H5S__none_project_scalar,
+ H5S__none_project_simple,
+ H5S__none_iter_init,
}};
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Iteration properties for "none" selections */
static const H5S_sel_iter_class_t H5S_sel_iter_none[1] = {{
H5S_SEL_NONE,
/* Methods on selection iterator */
- H5S_none_iter_coords,
- H5S_none_iter_block,
- H5S_none_iter_nelmts,
- H5S_none_iter_has_next_block,
- H5S_none_iter_next,
- H5S_none_iter_next_block,
- H5S_none_iter_release,
+ H5S__none_iter_coords,
+ H5S__none_iter_block,
+ H5S__none_iter_nelmts,
+ H5S__none_iter_has_next_block,
+ H5S__none_iter_next,
+ H5S__none_iter_next_block,
+ H5S__none_iter_release,
}};
+
/*-------------------------------------------------------------------------
- * Function: H5S_none_iter_init
+ * Function: H5S__none_iter_init
*
* Purpose: Initializes iteration information for "none" selection.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_iter_init(H5S_sel_iter_t *iter, const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
- HDassert(space && H5S_SEL_NONE==H5S_GET_SELECT_TYPE(space));
+ HDassert(space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(space));
HDassert(iter);
/* Initialize type of selection iterator */
iter->type = H5S_sel_iter_none;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_iter_init() */
+} /* end H5S__none_iter_init() */
/*-------------------------------------------------------------------------
- * Function: H5S_none_iter_coords
+ * Function: H5S__none_iter_coords
*
* Purpose: Retrieve the current coordinates of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Tuesday, April 22, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_iter_coords(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_UNUSED *coords)
+H5S__none_iter_coords(const H5S_sel_iter_t H5_ATTR_UNUSED *iter,
+ hsize_t H5_ATTR_UNUSED *coords)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
HDassert(coords);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_iter_coords() */
+} /* end H5S__none_iter_coords() */
/*-------------------------------------------------------------------------
- * Function: H5S_none_iter_block
+ * Function: H5S__none_iter_block
*
* Purpose: Retrieve the current block of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Monday, June 2, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end)
+H5S__none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter,
+ hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
@@ -185,42 +216,40 @@ H5S_none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_U
HDassert(end);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_iter_block() */
+} /* end H5S__none_iter_block() */
/*-------------------------------------------------------------------------
- * Function: H5S_none_iter_nelmts
+ * Function: H5S__none_iter_nelmts
*
* Purpose: Return number of elements left to process in iterator
*
- * Return: non-negative number of elements on success, zero on failure
+ * Return: Non-negative number of elements on success, zero on failure
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hsize_t
-H5S_none_iter_nelmts(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
+H5S__none_iter_nelmts(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(0)
-} /* H5S_none_iter_nelmts() */
+} /* end H5S__none_iter_nelmts() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_iter_has_next_block
+ H5S__none_iter_has_next_block
PURPOSE
Check if there is another block left in the current iterator
USAGE
- htri_t H5S_none_iter_has_next_block(iter)
+ htri_t H5S__none_iter_has_next_block(iter)
const H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative (TRUE/FALSE) on success/Negative on failure
@@ -232,24 +261,24 @@ H5S_none_iter_nelmts(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
+H5S__none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_iter_has_next_block() */
+} /* end H5S__none_iter_has_next_block() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_iter_next
+ H5S__none_iter_next
PURPOSE
Increment selection iterator
USAGE
- herr_t H5S_none_iter_next(iter, nelem)
+ herr_t H5S__none_iter_next(iter, nelem)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
size_t nelem; IN: Number of elements to advance by
RETURNS
@@ -262,25 +291,25 @@ H5S_none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED nelem)
+H5S__none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED nelem)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
- HDassert(nelem>0);
+ HDassert(nelem > 0);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_iter_next() */
+} /* end H5S__none_iter_next() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_iter_next_block
+ H5S__none_iter_next_block
PURPOSE
Increment selection iterator to next block
USAGE
- herr_t H5S_none_iter_next(iter)
+ herr_t H5S__none_iter_next(iter)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative on success/Negative on failure
@@ -292,24 +321,82 @@ H5S_none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED ne
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
+H5S__none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_iter_next_block() */
+} /* end H5S__none_iter_next_block() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_iter_release
+ H5S__none_get_seq_list
+ PURPOSE
+ Create a list of offsets & lengths for a selection
+ USAGE
+ herr_t H5S__none_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
+ H5S_t *space; IN: Dataspace containing selection to use.
+ unsigned flags; IN: Flags for extra information about operation
+ H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
+ position of interest in selection.
+ size_t maxseq; IN: Maximum number of sequences to generate
+ size_t maxelem; IN: Maximum number of elements to include in the
+ generated sequences
+ size_t *nseq; OUT: Actual number of sequences generated
+ size_t *nelem; OUT: Actual number of elements in sequences generated
+ hsize_t *off; OUT: Array of offsets
+ size_t *len; OUT: Array of lengths
+ RETURNS
+ Non-negative on success/Negative on failure.
+ DESCRIPTION
+ Use the selection in the dataspace to generate a list of byte offsets and
+ lengths for the region(s) selected. Start/Restart from the position in the
+ ITER parameter. The number of sequences generated is limited by the MAXSEQ
+ parameter and the number of sequences actually generated is stored in the
+ NSEQ parameter.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__none_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t H5_ATTR_UNUSED *iter,
+ size_t H5_ATTR_UNUSED maxseq, size_t H5_ATTR_UNUSED maxelem, size_t *nseq, size_t *nelem,
+ hsize_t H5_ATTR_UNUSED *off, size_t H5_ATTR_UNUSED *len)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(space);
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
+
+ /* "none" selections don't generate sequences of bytes */
+ *nseq = 0;
+
+ /* They don't use any elements, either */
+ *nelem = 0;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__none_get_seq_list() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__none_iter_release
PURPOSE
Release "none" selection iterator information for a dataspace
USAGE
- herr_t H5S_none_iter_release(iter)
+ herr_t H5S__none_iter_release(iter)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative on success/Negative on failure
@@ -321,24 +408,24 @@ H5S_none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED * iter)
+H5S__none_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_iter_release() */
+} /* end H5S__none_iter_release() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_release
+ H5S__none_release
PURPOSE
Release none selection information for a dataspace
USAGE
- herr_t H5S_none_release(space)
+ herr_t H5S__none_release(space)
H5S_t *space; IN: Pointer to dataspace
RETURNS
Non-negative on success/Negative on failure
@@ -350,26 +437,27 @@ H5S_none_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED * iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_release(H5S_t H5_ATTR_UNUSED * space)
+H5S__none_release(H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_release() */
+} /* end H5S__none_release() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_copy
+ H5S__none_copy
PURPOSE
Copy a selection from one dataspace to another
USAGE
- herr_t H5S_none_copy(dst, src)
+ herr_t H5S__none_copy(dst, src, share_selection)
H5S_t *dst; OUT: Pointer to the destination dataspace
H5S_t *src; IN: Pointer to the source dataspace
+ hbool_t; IN: Whether to share the selection between the dataspaces
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -381,9 +469,10 @@ H5S_none_release(H5S_t H5_ATTR_UNUSED * space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSED share_selection)
+H5S__none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src,
+ hbool_t H5_ATTR_UNUSED share_selection)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(src);
HDassert(dst);
@@ -392,17 +481,17 @@ H5S_none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSE
dst->select.num_elem = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_none_copy() */
+} /* end H5S__none_copy() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_is_valid
+ H5S__none_is_valid
PURPOSE
Check whether the selection fits within the extent, with the current
offset defined.
USAGE
- htri_t H5S_none_is_valid(space);
+ htri_t H5S__none_is_valid(space);
H5S_t *space; IN: Dataspace pointer to query
RETURNS
TRUE if the selection fits within the extent, FALSE if it does not and
@@ -416,24 +505,24 @@ H5S_none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSE
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_is_valid(const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
-} /* end H5S_none_is_valid() */
+} /* end H5S__none_is_valid() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_serial_size
+ H5S__none_serial_size
PURPOSE
Determine the number of bytes needed to store the serialized "none"
selection information.
USAGE
- hssize_t H5S_none_serial_size(space)
+ hssize_t H5S__none_serial_size(space)
H5S_t *space; IN: Dataspace pointer to query
RETURNS
The number of bytes required on success, negative on an error.
@@ -446,9 +535,9 @@ H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static hssize_t
-H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
@@ -457,16 +546,16 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
* <length (4 bytes)> = 16 bytes
*/
FUNC_LEAVE_NOAPI(16)
-} /* end H5S_none_serial_size() */
+} /* end H5S__none_serial_size() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_serialize
+ H5S__none_serialize
PURPOSE
Serialize the current selection into a user-provided buffer.
USAGE
- herr_t H5S_none_serialize(space, p)
+ herr_t H5S__none_serialize(space, p)
const H5S_t *space; IN: Dataspace with selection to serialize
uint8_t **p; OUT: Pointer to buffer to put serialized
selection. Will be advanced to end of
@@ -482,11 +571,11 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_serialize(const H5S_t *space, uint8_t **p)
+H5S__none_serialize(const H5S_t *space, uint8_t **p)
{
uint8_t *pp = (*p); /* Local pointer for decoding */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
@@ -503,16 +592,16 @@ H5S_none_serialize(const H5S_t *space, uint8_t **p)
*p = pp;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_serialize() */
+} /* end H5S__none_serialize() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_deserialize
+ H5S__none_deserialize
PURPOSE
Deserialize the current selection from a user-provided buffer.
USAGE
- herr_t H5S_none_deserialize(space, version, flags, p)
+ herr_t H5S__none_deserialize(space, version, flags, p)
H5S_t *space; IN/OUT: Dataspace pointer to place
selection into
uint32_t version IN: Selection version
@@ -531,12 +620,12 @@ H5S_none_serialize(const H5S_t *space, uint8_t **p)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags,
- const uint8_t H5_ATTR_UNUSED **p)
+H5S__none_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version,
+ uint8_t H5_ATTR_UNUSED flags, const uint8_t H5_ATTR_UNUSED **p)
{
herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(space);
HDassert(p);
@@ -548,16 +637,16 @@ H5S_none_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_A
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_none_deserialize() */
+} /* end H5S__none_deserialize() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_bounds
+ H5S__none_bounds
PURPOSE
Gets the bounding box containing the selection.
USAGE
- herr_t H5S_none_bounds(space, start, end)
+ herr_t H5S__none_bounds(space, start, end)
H5S_t *space; IN: Dataspace pointer of selection to query
hsize_t *start; OUT: Starting coordinate of bounding box
hsize_t *end; OUT: Opposite coordinate of bounding box
@@ -577,25 +666,26 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end)
+H5S__none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *start,
+ hsize_t H5_ATTR_UNUSED *end)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
HDassert(start);
HDassert(end);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5Sget_none_bounds() */
+} /* end H5Sget_none_bounds() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_offset
+ H5S__none_offset
PURPOSE
Gets the linear offset of the first element for the selection.
USAGE
- herr_t H5S_none_offset(space, offset)
+ herr_t H5S__none_offset(space, offset)
const H5S_t *space; IN: Dataspace pointer of selection to query
hsize_t *offset; OUT: Linear offset of first element in selection
RETURNS
@@ -610,15 +700,15 @@ H5S_none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *start
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset)
+H5S__none_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
HDassert(offset);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_offset() */
+} /* end H5S__none_offset() */
/*--------------------------------------------------------------------------
@@ -651,11 +741,11 @@ H5S__none_unlim_dim(const H5S_t H5_ATTR_UNUSED *space)
/*--------------------------------------------------------------------------
NAME
- H5S_none_is_contiguous
+ H5S__none_is_contiguous
PURPOSE
Check if a "none" selection is contiguous within the dataspace extent.
USAGE
- htri_t H5S_none_is_contiguous(space)
+ htri_t H5S__none_is_contiguous(space)
H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -668,23 +758,23 @@ H5S__none_unlim_dim(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_none_is_contiguous(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_is_contiguous(const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
FUNC_LEAVE_NOAPI(FALSE)
-} /* H5S_none_is_contiguous() */
+} /* end H5S__none_is_contiguous() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_is_single
+ H5S__none_is_single
PURPOSE
Check if a "none" selection is a single block within the dataspace extent.
USAGE
- htri_t H5S_none_is_single(space)
+ htri_t H5S__none_is_single(space)
H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -697,23 +787,23 @@ H5S_none_is_contiguous(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_none_is_single(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_is_single(const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
FUNC_LEAVE_NOAPI(FALSE)
-} /* H5S_none_is_single() */
+} /* end H5S__none_is_single() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_is_regular
+ H5S__none_is_regular
PURPOSE
Check if a "none" selection is "regular"
USAGE
- htri_t H5S_none_is_regular(space)
+ htri_t H5S__none_is_regular(space)
const H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -727,15 +817,15 @@ H5S_none_is_single(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
-} /* H5S_none_is_regular() */
+} /* end H5S__none_is_regular() */
/*--------------------------------------------------------------------------
@@ -744,7 +834,7 @@ H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
PURPOSE
Adjust an "none" selection by subtracting an offset
USAGE
- herr_t H5S_none_adjust_u(space, offset)
+ herr_t H5S__none_adjust_u(space, offset)
H5S_t *space; IN/OUT: Pointer to dataspace to adjust
const hsize_t *offset; IN: Offset to subtract
RETURNS
@@ -757,24 +847,24 @@ H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset)
+H5S__none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
HDassert(offset);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_adjust_u() */
+} /* end H5S__none_adjust_u() */
/*-------------------------------------------------------------------------
- * Function: H5S_none_project_scalar
+ * Function: H5S__none_project_scalar
*
* Purpose: Projects a 'none' selection into a scalar dataspace
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -782,25 +872,25 @@ H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset)
+H5S__none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(space));
HDassert(offset);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_project_scalar() */
+} /* end H5S__none_project_scalar() */
/*-------------------------------------------------------------------------
- * Function: H5S_none_project_simple
+ * Function: H5S__none_project_simple
*
* Purpose: Projects an 'none' selection onto/into a simple dataspace
* of a different rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -808,11 +898,12 @@ H5S_none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSE
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
+H5S__none_project_simple(const H5S_t H5_ATTR_UNUSED *base_space,
+ H5S_t *new_space, hsize_t H5_ATTR_UNUSED *offset)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(base_space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(base_space));
@@ -825,7 +916,7 @@ H5S_none_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offs
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_none_project_simple() */
+} /* end H5S__none_project_simple() */
/*--------------------------------------------------------------------------
@@ -867,7 +958,7 @@ H5S_select_none(H5S_t *space)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_none() */
+} /* end H5S_select_none() */
/*--------------------------------------------------------------------------
@@ -906,63 +997,5 @@ H5Sselect_none(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sselect_none() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_none_get_seq_list
- PURPOSE
- Create a list of offsets & lengths for a selection
- USAGE
- herr_t H5S_none_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
- H5S_t *space; IN: Dataspace containing selection to use.
- unsigned flags; IN: Flags for extra information about operation
- H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
- position of interest in selection.
- size_t maxseq; IN: Maximum number of sequences to generate
- size_t maxelem; IN: Maximum number of elements to include in the
- generated sequences
- size_t *nseq; OUT: Actual number of sequences generated
- size_t *nelem; OUT: Actual number of elements in sequences generated
- hsize_t *off; OUT: Array of offsets
- size_t *len; OUT: Array of lengths
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Use the selection in the dataspace to generate a list of byte offsets and
- lengths for the region(s) selected. Start/Restart from the position in the
- ITER parameter. The number of sequences generated is limited by the MAXSEQ
- parameter and the number of sequences actually generated is stored in the
- NSEQ parameter.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S_none_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t H5_ATTR_UNUSED *iter,
- size_t H5_ATTR_UNUSED maxseq, size_t H5_ATTR_UNUSED maxelem, size_t *nseq, size_t *nelem,
- hsize_t H5_ATTR_UNUSED *off, size_t H5_ATTR_UNUSED *len)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Check args */
- HDassert(space);
- HDassert(iter);
- HDassert(maxseq > 0);
- HDassert(maxelem > 0);
- HDassert(nseq);
- HDassert(nelem);
- HDassert(off);
- HDassert(len);
-
- /* "none" selections don't generate sequences of bytes */
- *nseq = 0;
-
- /* They don't use any elements, either */
- *nelem = 0;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_none_get_seq_list() */
+} /* end H5Sselect_none() */
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index d895f40..0575f03 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -26,8 +26,12 @@
#ifndef _H5Spkg_H
#define _H5Spkg_H
+/* Get package's private header */
#include "H5Sprivate.h"
+/* Other private headers needed by this file */
+#include "H5Oprivate.h" /* Object headers */
+
/* Flags to indicate special dataspace features are active */
#define H5S_VALID_MAX 0x01
#define H5S_VALID_PERM 0x02
@@ -77,6 +81,7 @@ struct H5S_extent_t {
/*
* Dataspace selection information
*/
+
/* Node in point selection list (typedef'd in H5Sprivate.h) */
struct H5S_pnt_node_t {
hsize_t *pnt; /* Pointer to a selected point */
@@ -88,9 +93,9 @@ typedef struct {
H5S_pnt_node_t *head; /* Pointer to head of point list */
} H5S_pnt_list_t;
-/* Information about new-style hyperslab spans */
+/* Information about hyperslab spans */
-/* Information a particular hyperslab span */
+/* Information a particular hyperslab span (typedef'd in H5Sprivate.h) */
struct H5S_hyper_span_t {
hsize_t low, high; /* Low & high bounds of span */
hsize_t nelem; /* Number of elements in span (only needed during I/O) */
@@ -111,7 +116,7 @@ struct H5S_hyper_span_info_t {
struct H5S_hyper_span_t *head; /* Pointer to list of spans in next dimension down */
};
-/* Information about new-style hyperslab selection */
+/* Information about 'diminfo' form of hyperslab selection */
typedef struct {
hbool_t diminfo_valid; /* Whether the dataset has valid diminfo */
H5S_hyper_dim_t opt_diminfo[H5S_MAX_RANK]; /* per-dim selection info */
@@ -124,7 +129,7 @@ typedef struct {
* information. */
int unlim_dim; /* Dimension where selection is unlimited, or -1 if none */
hsize_t num_elem_non_unlim; /* # of elements in a "slice" excluding the unlimited dimension */
- H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information */
+ H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information of all dimensions */
} H5S_hyper_sel_t;
/* Selection information methods */
@@ -217,9 +222,11 @@ struct H5S_t {
/* Selection iteration methods */
/* Method to retrieve the current coordinates of iterator for current selection */
-typedef herr_t (*H5S_sel_iter_coords_func_t)(const H5S_sel_iter_t *iter, hsize_t *coords);
+typedef herr_t (*H5S_sel_iter_coords_func_t)(const H5S_sel_iter_t *iter,
+ hsize_t *coords);
/* Method to retrieve the current block of iterator for current selection */
-typedef herr_t (*H5S_sel_iter_block_func_t)(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
+typedef herr_t (*H5S_sel_iter_block_func_t)(const H5S_sel_iter_t *iter,
+ hsize_t *start, hsize_t *end);
/* Method to determine number of elements left in iterator for current selection */
typedef hsize_t (*H5S_sel_iter_nelmts_func_t)(const H5S_sel_iter_t *iter);
/* Method to determine if there are more blocks left in the current selection */
@@ -269,20 +276,19 @@ H5_DLLVAR const H5S_select_class_t H5S_sel_point[1];
H5_DLLVAR const unsigned H5O_sdspace_ver_bounds[H5F_LIBVER_NBOUNDS];
/* Extent functions */
-H5_DLL herr_t H5S_extent_release(H5S_extent_t *extent);
-H5_DLL herr_t H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src,
+H5_DLL herr_t H5S__extent_release(H5S_extent_t *extent);
+H5_DLL herr_t H5S__extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src,
hbool_t copy_max);
-/* Operations on selections */
+/* Operations on hyperslab selections */
H5_DLL herr_t H5S__hyper_project_intersection(const H5S_t *src_space,
- const H5S_t *dst_space, const H5S_t *src_intersect_space,
- H5S_t *proj_space);
+ const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t *proj_space);
H5_DLL herr_t H5S__hyper_subtract(H5S_t *space, H5S_t *subtract_space);
/* Testing functions */
#ifdef H5S_TESTING
-H5_DLL htri_t H5S_select_shape_same_test(hid_t sid1, hid_t sid2);
-H5_DLL htri_t H5S_get_rebuild_status_test(hid_t space_id);
+H5_DLL htri_t H5S__select_shape_same_test(hid_t sid1, hid_t sid2);
+H5_DLL htri_t H5S__get_rebuild_status_test(hid_t space_id);
#endif /* H5S_TESTING */
#endif /*_H5Spkg_H*/
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 9924920..6411b94 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -18,87 +18,124 @@
* Purpose: Point selection dataspace I/O functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* ID Functions */
-#include "H5MMprivate.h" /* Memory Management functions */
-#include "H5Spkg.h" /* Dataspace functions */
-#include "H5VMprivate.h" /* Vector functions */
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* ID Functions */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Spkg.h" /* Dataspace functions */
+#include "H5VMprivate.h" /* Vector functions */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
-/* Static function prototypes */
+
+/********************/
+/* Local Prototypes */
+/********************/
/* Selection callbacks */
-static herr_t H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
-static herr_t H5S_point_get_seq_list(const H5S_t *space, unsigned flags,
+static herr_t H5S__point_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
+static herr_t H5S__point_get_seq_list(const H5S_t *space, unsigned flags,
H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
-static herr_t H5S_point_release(H5S_t *space);
-static htri_t H5S_point_is_valid(const H5S_t *space);
-static hssize_t H5S_point_serial_size(const H5S_t *space);
-static herr_t H5S_point_serialize(const H5S_t *space, uint8_t **p);
-static herr_t H5S_point_deserialize(H5S_t *space, uint32_t version, uint8_t flags,
+static herr_t H5S__point_release(H5S_t *space);
+static htri_t H5S__point_is_valid(const H5S_t *space);
+static hssize_t H5S__point_serial_size(const H5S_t *space);
+static herr_t H5S__point_serialize(const H5S_t *space, uint8_t **p);
+static herr_t H5S__point_deserialize(H5S_t *space, uint32_t version, uint8_t flags,
const uint8_t **p);
-static herr_t H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
-static herr_t H5S_point_offset(const H5S_t *space, hsize_t *off);
+static herr_t H5S__point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
+static herr_t H5S__point_offset(const H5S_t *space, hsize_t *off);
static int H5S__point_unlim_dim(const H5S_t *space);
-static htri_t H5S_point_is_contiguous(const H5S_t *space);
-static htri_t H5S_point_is_single(const H5S_t *space);
-static htri_t H5S_point_is_regular(const H5S_t *space);
-static herr_t H5S_point_adjust_u(H5S_t *space, const hsize_t *offset);
-static herr_t H5S_point_project_scalar(const H5S_t *space, hsize_t *offset);
-static herr_t H5S_point_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
-static herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
+static htri_t H5S__point_is_contiguous(const H5S_t *space);
+static htri_t H5S__point_is_single(const H5S_t *space);
+static htri_t H5S__point_is_regular(const H5S_t *space);
+static herr_t H5S__point_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S__point_project_scalar(const H5S_t *space, hsize_t *offset);
+static herr_t H5S__point_project_simple(const H5S_t *space, H5S_t *new_space,
+ hsize_t *offset);
+static herr_t H5S__point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
/* Selection iteration callbacks */
-static herr_t H5S_point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
-static herr_t H5S_point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
-static hsize_t H5S_point_iter_nelmts(const H5S_sel_iter_t *iter);
-static htri_t H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter);
-static herr_t H5S_point_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
-static herr_t H5S_point_iter_next_block(H5S_sel_iter_t *sel_iter);
-static herr_t H5S_point_iter_release(H5S_sel_iter_t *sel_iter);
+static herr_t H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
+static herr_t H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start,
+ hsize_t *end);
+static hsize_t H5S__point_iter_nelmts(const H5S_sel_iter_t *iter);
+static htri_t H5S__point_iter_has_next_block(const H5S_sel_iter_t *iter);
+static herr_t H5S__point_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
+static herr_t H5S__point_iter_next_block(H5S_sel_iter_t *sel_iter);
+static herr_t H5S__point_iter_release(H5S_sel_iter_t *sel_iter);
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
/* Selection properties for point selections */
const H5S_select_class_t H5S_sel_point[1] = {{
H5S_SEL_POINTS,
/* Methods on selection */
- H5S_point_copy,
- H5S_point_get_seq_list,
- H5S_point_release,
- H5S_point_is_valid,
- H5S_point_serial_size,
- H5S_point_serialize,
- H5S_point_deserialize,
- H5S_point_bounds,
- H5S_point_offset,
+ H5S__point_copy,
+ H5S__point_get_seq_list,
+ H5S__point_release,
+ H5S__point_is_valid,
+ H5S__point_serial_size,
+ H5S__point_serialize,
+ H5S__point_deserialize,
+ H5S__point_bounds,
+ H5S__point_offset,
H5S__point_unlim_dim,
NULL,
- H5S_point_is_contiguous,
- H5S_point_is_single,
- H5S_point_is_regular,
- H5S_point_adjust_u,
- H5S_point_project_scalar,
- H5S_point_project_simple,
- H5S_point_iter_init,
+ H5S__point_is_contiguous,
+ H5S__point_is_single,
+ H5S__point_is_regular,
+ H5S__point_adjust_u,
+ H5S__point_project_scalar,
+ H5S__point_project_simple,
+ H5S__point_iter_init,
}};
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Iteration properties for point selections */
static const H5S_sel_iter_class_t H5S_sel_iter_point[1] = {{
H5S_SEL_POINTS,
/* Methods on selection iterator */
- H5S_point_iter_coords,
- H5S_point_iter_block,
- H5S_point_iter_nelmts,
- H5S_point_iter_has_next_block,
- H5S_point_iter_next,
- H5S_point_iter_next_block,
- H5S_point_iter_release,
+ H5S__point_iter_coords,
+ H5S__point_iter_block,
+ H5S__point_iter_nelmts,
+ H5S__point_iter_has_next_block,
+ H5S__point_iter_next,
+ H5S__point_iter_next_block,
+ H5S__point_iter_release,
}};
/* Declare a free list to manage the H5S_pnt_node_t struct */
@@ -107,93 +144,88 @@ H5FL_DEFINE_STATIC(H5S_pnt_node_t);
/* Declare a free list to manage the H5S_pnt_list_t struct */
H5FL_DEFINE_STATIC(H5S_pnt_list_t);
+
/*-------------------------------------------------------------------------
- * Function: H5S_point_iter_init
+ * Function: H5S__point_iter_init
*
* Purpose: Initializes iteration information for point selection.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
+H5S__point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
- HDassert(space && H5S_SEL_POINTS==H5S_GET_SELECT_TYPE(space));
+ HDassert(space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space));
HDassert(iter);
/* Initialize the number of points to iterate over */
- iter->elmt_left=space->select.num_elem;
+ iter->elmt_left = space->select.num_elem;
/* Start at the head of the list of points */
iter->u.pnt.curr=space->select.sel_info.pnt_lst->head;
/* Initialize type of selection iterator */
- iter->type=H5S_sel_iter_point;
+ iter->type = H5S_sel_iter_point;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_init() */
+} /* end H5S__point_iter_init() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_iter_coords
+ * Function: H5S__point_iter_coords
*
* Purpose: Retrieve the current coordinates of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Tuesday, April 22, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords)
+H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
HDassert(coords);
/* Copy the offset of the current point */
- HDmemcpy(coords,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank);
+ HDmemcpy(coords, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_coords() */
+} /* end H5S__point_iter_coords() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_iter_block
+ * Function: H5S__point_iter_block
*
* Purpose: Retrieve the current block of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Monday, June 2, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
+H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
@@ -201,46 +233,44 @@ H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
HDassert(end);
/* Copy the current point as a block */
- HDmemcpy(start,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank);
- HDmemcpy(end,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank);
+ HDmemcpy(start, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank);
+ HDmemcpy(end, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_block() */
+} /* end H5S__point_iter_block() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_iter_nelmts
+ * Function: H5S__point_iter_nelmts
*
* Purpose: Return number of elements left to process in iterator
*
- * Return: non-negative number of elements on success, zero on failure
+ * Return: Non-negative number of elements on success, zero on failure
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hsize_t
-H5S_point_iter_nelmts (const H5S_sel_iter_t *iter)
+H5S__point_iter_nelmts(const H5S_sel_iter_t *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(iter->elmt_left)
-} /* H5S_point_iter_nelmts() */
+} /* end H5S__point_iter_nelmts() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_iter_has_next_block
+ H5S__point_iter_has_next_block
PURPOSE
Check if there is another block left in the current iterator
USAGE
- htri_t H5S_point_iter_has_next_block(iter)
+ htri_t H5S__point_iter_has_next_block(iter)
const H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative (TRUE/FALSE) on success/Negative on failure
@@ -252,31 +282,31 @@ H5S_point_iter_nelmts (const H5S_sel_iter_t *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter)
+H5S__point_iter_has_next_block(const H5S_sel_iter_t *iter)
{
- htri_t ret_value=TRUE; /* Return value */
+ htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
/* Check if there is another point in the list */
- if(iter->u.pnt.curr->next==NULL)
+ if(iter->u.pnt.curr->next == NULL)
HGOTO_DONE(FALSE);
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_iter_has_next_block() */
+} /* end H5S__point_iter_has_next_block() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_iter_next
+ H5S__point_iter_next
PURPOSE
Increment selection iterator
USAGE
- herr_t H5S_point_iter_next(iter, nelem)
+ herr_t H5S__point_iter_next(iter, nelem)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
size_t nelem; IN: Number of elements to advance by
RETURNS
@@ -289,31 +319,31 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem)
+H5S__point_iter_next(H5S_sel_iter_t *iter, size_t nelem)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
- HDassert(nelem>0);
+ HDassert(nelem > 0);
/* Increment the iterator */
- while(nelem>0) {
- iter->u.pnt.curr=iter->u.pnt.curr->next;
+ while(nelem > 0) {
+ iter->u.pnt.curr = iter->u.pnt.curr->next;
nelem--;
} /* end while */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_next() */
+} /* end H5S__point_iter_next() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_iter_next_block
+ H5S__point_iter_next_block
PURPOSE
Increment selection iterator to next block
USAGE
- herr_t H5S_point_iter_next_block(iter)
+ herr_t H5S__point_iter_next_block(iter)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative on success/Negative on failure
@@ -325,27 +355,165 @@ H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_iter_next_block(H5S_sel_iter_t *iter)
+H5S__point_iter_next_block(H5S_sel_iter_t *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
/* Increment the iterator */
- iter->u.pnt.curr=iter->u.pnt.curr->next;
+ iter->u.pnt.curr = iter->u.pnt.curr->next;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_next_block() */
+} /* end H5S__point_iter_next_block() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__point_get_seq_list
+ PURPOSE
+ Create a list of offsets & lengths for a selection
+ USAGE
+ herr_t H5S__point_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
+ H5S_t *space; IN: Dataspace containing selection to use.
+ unsigned flags; IN: Flags for extra information about operation
+ H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
+ position of interest in selection.
+ size_t maxseq; IN: Maximum number of sequences to generate
+ size_t maxelem; IN: Maximum number of elements to include in the
+ generated sequences
+ size_t *nseq; OUT: Actual number of sequences generated
+ size_t *nelem; OUT: Actual number of elements in sequences generated
+ hsize_t *off; OUT: Array of offsets (in bytes)
+ size_t *len; OUT: Array of lengths (in bytes)
+ RETURNS
+ Non-negative on success/Negative on failure.
+ DESCRIPTION
+ Use the selection in the dataspace to generate a list of byte offsets and
+ lengths for the region(s) selected. Start/Restart from the position in the
+ ITER parameter. The number of sequences generated is limited by the MAXSEQ
+ parameter and the number of sequences actually generated is stored in the
+ NSEQ parameter.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
+ size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
+ hsize_t *off, size_t *len)
+{
+ size_t io_left; /* The number of bytes left in the selection */
+ size_t start_io_left; /* The initial number of bytes left in the selection */
+ H5S_pnt_node_t *node; /* Point node */
+ hsize_t dims[H5S_MAX_RANK]; /* Total size of memory buf */
+ int ndims; /* Dimensionality of space*/
+ hsize_t acc; /* Coordinate accumulator */
+ hsize_t loc; /* Coordinate offset */
+ size_t curr_seq; /* Current sequence being operated on */
+ int i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(space);
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
+
+ /* Choose the minimum number of bytes to sequence through */
+ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
+ start_io_left = io_left = (size_t)MIN(iter->elmt_left, maxelem);
+
+ /* Get the dataspace dimensions */
+ if((ndims = H5S_get_simple_extent_dims (space, dims, NULL)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve dataspace dimensions")
+
+ /* Walk through the points in the selection, starting at the current */
+ /* location in the iterator */
+ node = iter->u.pnt.curr;
+ curr_seq = 0;
+ while(NULL != node) {
+ /* Compute the offset of each selected point in the buffer */
+ for(i = ndims - 1, acc = iter->elmt_size, loc = 0; i >= 0; i--) {
+ loc += (hsize_t)((hssize_t)node->pnt[i] + space->select.offset[i]) * acc;
+ acc *= dims[i];
+ } /* end for */
+
+ /* Check if this is a later point in the selection */
+ if(curr_seq > 0) {
+ /* If a sorted sequence is requested, make certain we don't go backwards in the offset */
+ if((flags&H5S_GET_SEQ_LIST_SORTED) && loc<off[curr_seq-1])
+ break;
+
+ /* Check if this point extends the previous sequence */
+ /* (Unlikely, but possible) */
+ if(loc == (off[curr_seq - 1] + len[curr_seq - 1])) {
+ /* Extend the previous sequence */
+ len[curr_seq - 1] += iter->elmt_size;
+ } /* end if */
+ else {
+ /* Add a new sequence */
+ off[curr_seq] = loc;
+ len[curr_seq] = iter->elmt_size;
+
+ /* Increment sequence count */
+ curr_seq++;
+ } /* end else */
+ } /* end if */
+ else {
+ /* Add a new sequence */
+ off[curr_seq] = loc;
+ len[curr_seq] = iter->elmt_size;
+
+ /* Increment sequence count */
+ curr_seq++;
+ } /* end else */
+
+ /* Decrement number of elements left to process */
+ io_left--;
+
+ /* Move the iterator */
+ iter->u.pnt.curr = node->next;
+ iter->elmt_left--;
+
+ /* Check if we're finished with all sequences */
+ if(curr_seq == maxseq)
+ break;
+
+ /* Check if we're finished with all the elements available */
+ if(io_left == 0)
+ break;
+
+ /* Advance to the next point */
+ node = node->next;
+ } /* end while */
+
+ /* Set the number of sequences generated */
+ *nseq = curr_seq;
+
+ /* Set the number of elements used */
+ *nelem = start_io_left - io_left;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__point_get_seq_list() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_iter_release
+ H5S__point_iter_release
PURPOSE
Release point selection iterator information for a dataspace
USAGE
- herr_t H5S_point_iter_release(iter)
+ herr_t H5S__point_iter_release(iter)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative on success/Negative on failure
@@ -357,24 +525,24 @@ H5S_point_iter_next_block(H5S_sel_iter_t *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_iter_release (H5S_sel_iter_t H5_ATTR_UNUSED * iter)
+H5S__point_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED * iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_release() */
+} /* end H5S__point_iter_release() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_add
+ H5S__point_add
PURPOSE
Add a series of elements to a point selection
USAGE
- herr_t H5S_point_add(space, num_elem, coord)
+ herr_t H5S__point_add(space, num_elem, coord)
H5S_t *space; IN: Dataspace of selection to modify
size_t num_elem; IN: Number of elements in COORD array.
const hsize_t *coord[]; IN: The location of each element selected
@@ -388,14 +556,15 @@ H5S_point_iter_release (H5S_sel_iter_t H5_ATTR_UNUSED * iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *coord)
+H5S__point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *coord)
{
H5S_pnt_node_t *top = NULL, *curr = NULL, *new_node = NULL; /* Point selection nodes */
unsigned u; /* Counter */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
+ /* Sanity checks */
HDassert(space);
HDassert(num_elem > 0);
HDassert(coord);
@@ -469,16 +638,16 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_add() */
+} /* end H5S__point_add() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_release
+ H5S__point_release
PURPOSE
Release point selection information for a dataspace
USAGE
- herr_t H5S_point_release(space)
+ herr_t H5S__point_release(space)
H5S_t *space; IN: Pointer to dataspace
RETURNS
Non-negative on success/Negative on failure
@@ -490,11 +659,11 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_release (H5S_t *space)
+H5S__point_release(H5S_t *space)
{
H5S_pnt_node_t *curr, *next; /* Point selection nodes */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
@@ -515,7 +684,7 @@ H5S_point_release (H5S_t *space)
space->select.num_elem = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_release() */
+} /* end H5S__point_release() */
/*--------------------------------------------------------------------------
@@ -539,10 +708,7 @@ H5S_point_release (H5S_t *space)
array elements are iterated through when I/O is performed. Duplicate
coordinates are not checked for. The selection operator, OP, determines
how the new selection is to be combined with the existing selection for
- the dataspace. Currently, only H5S_SELECT_SET is supported, which replaces
- the existing selection with the one defined in this call. When operators
- other than H5S_SELECT_SET are used to combine a new selection with an
- existing selection, the selection ordering is reset to 'C' array ordering.
+ the dataspace.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
@@ -552,9 +718,9 @@ herr_t
H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem,
const hsize_t *coord)
{
- herr_t ret_value = SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(space);
@@ -573,7 +739,7 @@ H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate element information")
/* Add points to selection */
- if(H5S_point_add(space, op, num_elem, coord) < 0)
+ if(H5S__point_add(space, op, num_elem, coord) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert elements")
/* Set selection type */
@@ -581,18 +747,19 @@ H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_elements() */
+} /* end H5S_select_elements() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_copy
+ H5S__point_copy
PURPOSE
Copy a selection from one dataspace to another
USAGE
- herr_t H5S_point_copy(dst, src)
+ herr_t H5S__point_copy(dst, src, share_selection)
H5S_t *dst; OUT: Pointer to the destination dataspace
H5S_t *src; IN: Pointer to the source dataspace
+ hbool_t share_selection; IN: Whether to share the selection between the dataspaces
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -604,13 +771,14 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t H5_ATTR_UNUSED share_selection)
+H5S__point_copy(H5S_t *dst, const H5S_t *src, hbool_t H5_ATTR_UNUSED share_selection)
{
H5S_pnt_node_t *curr, *new_node, *new_tail; /* Point information nodes */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
+ /* Sanity checks */
HDassert(src);
HDassert(dst);
@@ -660,18 +828,18 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_point_copy() */
+} /* end H5S__point_copy() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_is_valid
+ H5S__point_is_valid
PURPOSE
Check whether the selection fits within the extent, with the current
offset defined.
USAGE
- htri_t H5S_point_is_valid(space);
- H5S_t *space; IN: Dataspace pointer to query
+ htri_t H5S__point_is_valid(space);
+ const H5S_t *space; IN: Dataspace pointer to query
RETURNS
TRUE if the selection fits within the extent, FALSE if it does not and
Negative on an error.
@@ -684,13 +852,13 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_point_is_valid (const H5S_t *space)
+H5S__point_is_valid(const H5S_t *space)
{
H5S_pnt_node_t *curr; /* Point information nodes */
unsigned u; /* Counter */
htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
@@ -711,7 +879,7 @@ H5S_point_is_valid (const H5S_t *space)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_point_is_valid() */
+} /* end H5S__point_is_valid() */
/*--------------------------------------------------------------------------
@@ -750,18 +918,18 @@ H5Sget_select_elem_npoints(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_select_elem_npoints() */
+} /* end H5Sget_select_elem_npoints() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_serial_size
+ H5S__point_serial_size
PURPOSE
Determine the number of bytes needed to store the serialized point selection
information.
USAGE
- hssize_t H5S_point_serial_size(space)
- H5S_t *space; IN: Dataspace pointer to query
+ hssize_t H5S__point_serial_size(space)
+ const H5S_t *space; IN: Dataspace pointer to query
RETURNS
The number of bytes required on success, negative on an error.
DESCRIPTION
@@ -773,12 +941,11 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static hssize_t
-H5S_point_serial_size (const H5S_t *space)
+H5S__point_serial_size(const H5S_t *space)
{
- H5S_pnt_node_t *curr; /* Point information nodes */
hssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
@@ -789,24 +956,20 @@ H5S_point_serial_size (const H5S_t *space)
ret_value = 24;
/* Count points in selection */
- curr=space->select.sel_info.pnt_lst->head;
- while(curr!=NULL) {
- /* Add 4 bytes times the rank for each element selected */
- ret_value+=4*space->extent.rank;
- curr=curr->next;
- } /* end while */
+ /* (Add 4 bytes times the rank for each element selected) */
+ ret_value += (4 * space->extent.rank) * (hssize_t)H5S_GET_SELECT_NPOINTS(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_point_serial_size() */
+} /* end H5S__point_serial_size() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_serialize
+ H5S__point_serialize
PURPOSE
Serialize the current selection into a user-provided buffer.
USAGE
- herr_t H5S_point_serialize(space, p)
+ herr_t H5S__point_serialize(space, p)
const H5S_t *space; IN: Dataspace with selection to serialize
uint8_t **p; OUT: Pointer to buffer to put serialized
selection. Will be advanced to end of
@@ -822,15 +985,15 @@ H5S_point_serial_size (const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_serialize (const H5S_t *space, uint8_t **p)
+H5S__point_serialize(const H5S_t *space, uint8_t **p)
{
H5S_pnt_node_t *curr; /* Point information nodes */
uint8_t *pp = (*p); /* Local pointer for decoding */
- uint8_t *lenp; /* pointer to length location for later storage */
- uint32_t len=0; /* number of bytes used */
- unsigned u; /* local counting variable */
+ uint8_t *lenp; /* Pointer to length location for later storage */
+ uint32_t len = 0; /* Number of bytes used */
+ unsigned u; /* Local counting variable */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
@@ -846,23 +1009,23 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p)
/* Encode number of dimensions */
UINT32ENCODE(pp, (uint32_t)space->extent.rank);
- len+=4;
+ len += 4;
/* Encode number of elements */
UINT32ENCODE(pp, (uint32_t)space->select.num_elem);
- len+=4;
+ len += 4;
/* Encode each point in selection */
- curr=space->select.sel_info.pnt_lst->head;
- while(curr!=NULL) {
+ curr = space->select.sel_info.pnt_lst->head;
+ while(curr != NULL) {
/* Add 4 bytes times the rank for each element selected */
- len+=4*space->extent.rank;
+ len += 4 * space->extent.rank;
/* Encode each point */
- for(u=0; u<space->extent.rank; u++)
+ for(u = 0; u < space->extent.rank; u++)
UINT32ENCODE(pp, (uint32_t)curr->pnt[u]);
- curr=curr->next;
+ curr = curr->next;
} /* end while */
/* Encode length */
@@ -872,16 +1035,16 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p)
*p = pp;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_serialize() */
+} /* end H5S__point_serialize() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_deserialize
+ H5S__point_deserialize
PURPOSE
Deserialize the current selection from a user-provided buffer.
USAGE
- herr_t H5S_point_deserialize(space, p)
+ herr_t H5S__point_deserialize(space, p)
H5S_t *space; IN/OUT: Dataspace pointer to place
selection into
uint32_t version IN: Selection version
@@ -900,10 +1063,9 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags,
+H5S__point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags,
const uint8_t **p)
{
- H5S_seloper_t op = H5S_SELECT_SET; /* Selection operation */
hsize_t *coord = NULL, *tcoord; /* Pointer to array of elements */
const uint8_t *pp = (*p); /* Local pointer for decoding */
size_t num_elem = 0; /* Number of elements in selection */
@@ -911,7 +1073,7 @@ H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_
unsigned i, j; /* local counting variables */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -933,7 +1095,7 @@ H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_
UINT32DECODE(pp, *tcoord);
/* Select points */
- if(H5S_select_elements(space, op, num_elem, (const hsize_t *)coord) < 0)
+ if(H5S_select_elements(space, H5S_SELECT_SET, num_elem, (const hsize_t *)coord) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
/* Update decoding pointer */
@@ -945,17 +1107,17 @@ done:
H5MM_xfree(coord);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_deserialize() */
+} /* end H5S__point_deserialize() */
/*--------------------------------------------------------------------------
NAME
- H5S_get_select_elem_pointlist
+ H5S__get_select_elem_pointlist
PURPOSE
Get the list of element points currently selected
USAGE
- herr_t H5S_get_select_elem_pointlist(space, hsize_t *buf)
- H5S_t *space; IN: Dataspace pointer of selection to query
+ herr_t H5S__get_select_elem_pointlist(space, hsize_t *buf)
+ const H5S_t *space; IN: Dataspace pointer of selection to query
hsize_t startpoint; IN: Element point to start with
hsize_t numpoints; IN: Number of element points to get
hsize_t *buf; OUT: List of element points selected
@@ -978,12 +1140,13 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoints, hsize_t *buf)
+H5S__get_select_elem_pointlist(const H5S_t *space, hsize_t startpoint,
+ hsize_t numpoints, hsize_t *buf)
{
H5S_pnt_node_t *node; /* Point node */
unsigned rank; /* Dataspace rank */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
HDassert(buf);
@@ -1009,7 +1172,7 @@ H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoint
} /* end while */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_get_select_elem_pointlist() */
+} /* end H5S__get_select_elem_pointlist() */
/*--------------------------------------------------------------------------
@@ -1059,20 +1222,20 @@ H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint,
if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a point selection")
- ret_value = H5S_get_select_elem_pointlist(space, startpoint, numpoints, buf);
+ ret_value = H5S__get_select_elem_pointlist(space, startpoint, numpoints, buf);
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_select_elem_pointlist() */
+} /* end H5Sget_select_elem_pointlist() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_bounds
+ H5S__point_bounds
PURPOSE
Gets the bounding box containing the selection.
USAGE
- herr_t H5S_point_bounds(space, start, end)
+ herr_t H5S__point_bounds(space, start, end)
H5S_t *space; IN: Dataspace pointer of selection to query
hsize_t *start; OUT: Starting coordinate of bounding box
hsize_t *end; OUT: Opposite coordinate of bounding box
@@ -1093,14 +1256,14 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
+H5S__point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
H5S_pnt_node_t *node; /* Point node */
unsigned rank; /* Dataspace rank */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(space);
@@ -1134,16 +1297,16 @@ H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_bounds() */
+} /* end H5S__point_bounds() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_offset
+ H5S__point_offset
PURPOSE
Gets the linear offset of the first element for the selection.
USAGE
- herr_t H5S_point_offset(space, offset)
+ herr_t H5S__point_offset(space, offset)
const H5S_t *space; IN: Dataspace pointer of selection to query
hsize_t *offset; OUT: Linear offset of first element in selection
RETURNS
@@ -1158,7 +1321,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_offset(const H5S_t *space, hsize_t *offset)
+H5S__point_offset(const H5S_t *space, hsize_t *offset)
{
const hsize_t *pnt; /* Pointer to a selected point's coordinates */
const hssize_t *sel_offset; /* Pointer to the selection's offset */
@@ -1167,7 +1330,7 @@ H5S_point_offset(const H5S_t *space, hsize_t *offset)
int i; /* index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_STATIC
HDassert(space);
HDassert(offset);
@@ -1198,7 +1361,7 @@ H5S_point_offset(const H5S_t *space, hsize_t *offset)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_offset() */
+} /* end H5S__point_offset() */
/*--------------------------------------------------------------------------
@@ -1232,11 +1395,11 @@ H5S__point_unlim_dim(const H5S_t H5_ATTR_UNUSED *space)
/*--------------------------------------------------------------------------
NAME
- H5S_point_is_contiguous
+ H5S__point_is_contiguous
PURPOSE
Check if a point selection is contiguous within the dataspace extent.
USAGE
- htri_t H5S_point_is_contiguous(space)
+ htri_t H5S__point_is_contiguous(space)
H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -1252,31 +1415,31 @@ H5S__point_unlim_dim(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_point_is_contiguous(const H5S_t *space)
+H5S__point_is_contiguous(const H5S_t *space)
{
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
/* One point is definitely contiguous */
- if(space->select.num_elem==1)
- ret_value=TRUE;
+ if(space->select.num_elem == 1)
+ ret_value = TRUE;
else /* More than one point might be contiguous, but it's complex to check and we don't need it right now */
- ret_value=FALSE;
+ ret_value = FALSE;
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_is_contiguous() */
+} /* end H5S__point_is_contiguous() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_is_single
+ H5S__point_is_single
PURPOSE
Check if a point selection is single within the dataspace extent.
USAGE
- htri_t H5S_point_is_single(space)
+ htri_t H5S__point_is_single(space)
H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -1289,31 +1452,31 @@ H5S_point_is_contiguous(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_point_is_single(const H5S_t *space)
+H5S__point_is_single(const H5S_t *space)
{
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
/* One point is definitely 'single' :-) */
- if(space->select.num_elem==1)
- ret_value=TRUE;
+ if(space->select.num_elem == 1)
+ ret_value = TRUE;
else
- ret_value=FALSE;
+ ret_value = FALSE;
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_is_single() */
+} /* end H5S__point_is_single() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_is_regular
+ H5S__point_is_regular
PURPOSE
Check if a point selection is "regular"
USAGE
- htri_t H5S_point_is_regular(space)
+ htri_t H5S__point_is_regular(space)
const H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -1329,32 +1492,32 @@ H5S_point_is_single(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_point_is_regular(const H5S_t *space)
+H5S__point_is_regular(const H5S_t *space)
{
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
/* Only simple check for regular points for now... */
- if(space->select.num_elem==1)
- ret_value=TRUE;
+ if(space->select.num_elem == 1)
+ ret_value = TRUE;
else
- ret_value=FALSE;
+ ret_value = FALSE;
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_is_regular() */
+} /* end H5S__point_is_regular() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_adjust_u
+ H5S__point_adjust_u
PURPOSE
Adjust a "point" selection by subtracting an offset
USAGE
- herr_t H5S_point_adjust_u(space, offset)
+ herr_t H5S__point_adjust_u(space, offset)
H5S_t *space; IN/OUT: Pointer to dataspace to adjust
const hsize_t *offset; IN: Offset to subtract
RETURNS
@@ -1367,12 +1530,12 @@ H5S_point_is_regular(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_adjust_u(H5S_t *space, const hsize_t *offset)
+H5S__point_adjust_u(H5S_t *space, const hsize_t *offset)
{
H5S_pnt_node_t *node; /* Point node */
unsigned rank; /* Dataspace rank */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
HDassert(offset);
@@ -1397,16 +1560,16 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset)
} /* end while */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_adjust_u() */
+} /* end H5S__point_adjust_u() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_project_scalar
+ * Function: H5S__point_project_scalar
*
* Purpose: Projects a single element point selection into a scalar
* dataspace
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -1414,12 +1577,12 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_project_scalar(const H5S_t *space, hsize_t *offset)
+H5S__point_project_scalar(const H5S_t *space, hsize_t *offset)
{
const H5S_pnt_node_t *node; /* Point node */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space));
@@ -1433,20 +1596,20 @@ H5S_point_project_scalar(const H5S_t *space, hsize_t *offset)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "point selection of one element has more than one node!")
/* Calculate offset of selection in projected buffer */
- *offset = H5VM_array_offset(space->extent.rank, space->extent.size, node->pnt);
+ *offset = H5VM_array_offset(space->extent.rank, space->extent.size, node->pnt);
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_project_scalar() */
+} /* end H5S__point_project_scalar() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_project_simple
+ * Function: H5S__point_project_simple
*
* Purpose: Projects a point selection onto/into a simple dataspace
* of a different rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -1454,7 +1617,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
+H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
{
const H5S_pnt_node_t *base_node; /* Point node in base space */
H5S_pnt_node_t *new_node; /* Point node in new space */
@@ -1462,7 +1625,7 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
unsigned rank_diff; /* Difference in ranks between spaces */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(base_space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(base_space));
@@ -1487,7 +1650,7 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
/* Calculate offset of selection in projected buffer */
HDmemset(block, 0, sizeof(block));
HDmemcpy(block, base_space->select.sel_info.pnt_lst->head->pnt, sizeof(hsize_t) * rank_diff);
- *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block);
+ *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block);
/* Iterate through base space's point nodes, copying the point information */
base_node = base_space->select.sel_info.pnt_lst->head;
@@ -1564,7 +1727,7 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_project_simple() */
+} /* end H5S__point_project_simple() */
/*--------------------------------------------------------------------------
@@ -1625,143 +1788,5 @@ H5Sselect_elements(hid_t spaceid, H5S_seloper_t op, size_t num_elem,
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sselect_elements() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_point_get_seq_list
- PURPOSE
- Create a list of offsets & lengths for a selection
- USAGE
- herr_t H5S_point_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
- H5S_t *space; IN: Dataspace containing selection to use.
- unsigned flags; IN: Flags for extra information about operation
- H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
- position of interest in selection.
- size_t maxseq; IN: Maximum number of sequences to generate
- size_t maxelem; IN: Maximum number of elements to include in the
- generated sequences
- size_t *nseq; OUT: Actual number of sequences generated
- size_t *nelem; OUT: Actual number of elements in sequences generated
- hsize_t *off; OUT: Array of offsets
- size_t *len; OUT: Array of lengths
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Use the selection in the dataspace to generate a list of byte offsets and
- lengths for the region(s) selected. Start/Restart from the position in the
- ITER parameter. The number of sequences generated is limited by the MAXSEQ
- parameter and the number of sequences actually generated is stored in the
- NSEQ parameter.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
- size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
- hsize_t *off, size_t *len)
-{
- size_t io_left; /* The number of bytes left in the selection */
- size_t start_io_left; /* The initial number of bytes left in the selection */
- H5S_pnt_node_t *node; /* Point node */
- hsize_t dims[H5O_LAYOUT_NDIMS]; /* Total size of memory buf */
- int ndims; /* Dimensionality of space*/
- hsize_t acc; /* Coordinate accumulator */
- hsize_t loc; /* Coordinate offset */
- size_t curr_seq; /* Current sequence being operated on */
- int i; /* Local index variable */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- HDassert(space);
- HDassert(iter);
- HDassert(maxseq > 0);
- HDassert(maxelem > 0);
- HDassert(nseq);
- HDassert(nelem);
- HDassert(off);
- HDassert(len);
-
- /* Choose the minimum number of bytes to sequence through */
- H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
- start_io_left = io_left = (size_t)MIN(iter->elmt_left, maxelem);
-
- /* Get the dataspace dimensions */
- if((ndims = H5S_get_simple_extent_dims (space, dims, NULL)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve dataspace dimensions")
-
- /* Walk through the points in the selection, starting at the current */
- /* location in the iterator */
- node = iter->u.pnt.curr;
- curr_seq = 0;
- while(NULL != node) {
- /* Compute the offset of each selected point in the buffer */
- for(i = ndims - 1, acc = iter->elmt_size, loc = 0; i >= 0; i--) {
- loc += (hsize_t)((hssize_t)node->pnt[i] + space->select.offset[i]) * acc;
- acc *= dims[i];
- } /* end for */
-
- /* Check if this is a later point in the selection */
- if(curr_seq>0) {
- /* If a sorted sequence is requested, make certain we don't go backwards in the offset */
- if((flags&H5S_GET_SEQ_LIST_SORTED) && loc<off[curr_seq-1])
- break;
-
- /* Check if this point extends the previous sequence */
- /* (Unlikely, but possible) */
- if(loc==(off[curr_seq-1]+len[curr_seq-1])) {
- /* Extend the previous sequence */
- len[curr_seq-1]+=iter->elmt_size;
- } /* end if */
- else {
- /* Add a new sequence */
- off[curr_seq]=loc;
- len[curr_seq]=iter->elmt_size;
-
- /* Increment sequence count */
- curr_seq++;
- } /* end else */
- } /* end if */
- else {
- /* Add a new sequence */
- off[curr_seq]=loc;
- len[curr_seq]=iter->elmt_size;
-
- /* Increment sequence count */
- curr_seq++;
- } /* end else */
-
- /* Decrement number of elements left to process */
- io_left--;
-
- /* Move the iterator */
- iter->u.pnt.curr=node->next;
- iter->elmt_left--;
-
- /* Check if we're finished with all sequences */
- if(curr_seq==maxseq)
- break;
-
- /* Check if we're finished with all the elements available */
- if(io_left==0)
- break;
-
- /* Advance to the next point */
- node=node->next;
- } /* end while */
-
- /* Set the number of sequences generated */
- *nseq=curr_seq;
-
- /* Set the number of elements used */
- *nelem=start_io_left-io_left;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_point_get_seq_list() */
+} /* end H5Sselect_elements() */
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 32ac51a..f4e0006 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -17,9 +17,6 @@
#ifndef _H5Sprivate_H
#define _H5Sprivate_H
-/* Early typedefs to avoid circular dependencies */
-typedef struct H5S_t H5S_t;
-
/* Include package's public header */
#include "H5Spublic.h"
@@ -30,7 +27,6 @@ typedef struct H5S_t H5S_t;
#include "H5private.h" /* Generic Functions */
#include "H5Fprivate.h" /* Files */
#include "H5Gprivate.h" /* Groups */
-#include "H5Oprivate.h" /* Object headers */
#include "H5Pprivate.h" /* Property lists */
#include "H5Tprivate.h" /* Datatypes */
@@ -62,20 +58,20 @@ typedef struct H5S_hyper_dim_t {
/* Point selection iteration container */
typedef struct {
- H5S_pnt_node_t *curr; /* Pointer to next node to output */
+ H5S_pnt_node_t *curr; /* Pointer to next node to output */
} H5S_point_iter_t;
/* Hyperslab selection iteration container */
typedef struct {
/* Common fields for all hyperslab selections */
- hsize_t off[H5S_MAX_RANK]; /* Offset in span node (used as position for regular hyperslabs) */
+ hsize_t off[H5S_MAX_RANK]; /* Offset in span node (used as position for regular hyperslabs) */
unsigned iter_rank; /* Rank of iterator information */
/* (This should always be the same as the dataspace
- * rank, except for regular hyperslab selections in
- * which there are contiguous regions in the lower
- * dimensions which have been "flattened" out
+ * rank, except for regular hyperslab selections in
+ * which there are contiguous regions in the lower
+ * dimensions that have been "flattened")
*/
- hbool_t diminfo_valid; /* Whether the dimension information is valid */
+ hbool_t diminfo_valid; /* Whether the dimension information is valid */
/* "Flattened" regular hyperslab selection fields */
H5S_hyper_dim_t diminfo[H5S_MAX_RANK]; /* "Flattened" regular selection information */
@@ -196,6 +192,12 @@ typedef struct H5S_sel_iter_op_t {
#define H5S_SELECT_RELEASE(S) (H5S_select_release(S))
#define H5S_SELECT_DESERIALIZE(S,BUF) (H5S_select_deserialize(S,BUF))
+/* Forward declaration of structs used below */
+struct H5O_t;
+struct H5O_loc_t;
+
+/* Early typedef to avoid circular dependencies */
+typedef struct H5S_t H5S_t;
/* Operations on dataspaces */
H5_DLL H5S_t *H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max);
@@ -207,7 +209,7 @@ H5_DLL hbool_t H5S_has_extent(const H5S_t *ds);
H5_DLL int H5S_get_simple_extent_ndims(const H5S_t *ds);
H5_DLL int H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[]/*out*/,
hsize_t max_dims[]/*out*/);
-H5_DLL herr_t H5S_write(H5F_t *f, H5O_t *oh, unsigned update_flags, H5S_t *ds);
+H5_DLL herr_t H5S_write(H5F_t *f, struct H5O_t *oh, unsigned update_flags, H5S_t *ds);
H5_DLL herr_t H5S_append(H5F_t *f, struct H5O_t *oh, H5S_t *ds);
H5_DLL H5S_t *H5S_read(const struct H5O_loc_t *loc);
H5_DLL htri_t H5S_set_extent(H5S_t *space, const hsize_t *size);
@@ -284,9 +286,6 @@ H5_DLL herr_t H5S_hyper_add_span_element(H5S_t *space, unsigned rank,
const hsize_t *coords);
H5_DLL herr_t H5S_hyper_reset_scratch(H5S_t *space);
H5_DLL herr_t H5S_hyper_convert(H5S_t *space);
-#ifdef LATER
-H5_DLL htri_t H5S_hyper_intersect (H5S_t *space1, H5S_t *space2);
-#endif /* LATER */
H5_DLL htri_t H5S_hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end);
H5_DLL herr_t H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset);
H5_DLL htri_t H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset);
@@ -302,7 +301,8 @@ H5_DLL hsize_t H5S_hyper_get_first_inc_block(const H5S_t *space,
hsize_t clip_size, hbool_t *partial);
/* Operations on selection iterators */
-H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size);
+H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, const H5S_t *space,
+ size_t elmt_size);
H5_DLL herr_t H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords);
H5_DLL hsize_t H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter);
H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
@@ -314,7 +314,7 @@ H5_DLL herr_t H5S_mpio_space_type(const H5S_t *space, size_t elmt_size,
/* out: */ MPI_Datatype *new_type,
int *count,
hbool_t *is_derived_type,
- hbool_t do_permute,
+ hbool_t do_permute,
hsize_t **permute_map,
hbool_t * is_permuted);
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index d7a5d29..561875a 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -79,23 +79,22 @@ typedef enum H5S_seloper_t {
typedef enum {
H5S_SEL_ERROR = -1, /* Error */
H5S_SEL_NONE = 0, /* Nothing selected */
- H5S_SEL_POINTS = 1, /* Sequence of points selected */
- H5S_SEL_HYPERSLABS = 2, /* "New-style" hyperslab selection defined */
+ H5S_SEL_POINTS = 1, /* Points / elements selected */
+ H5S_SEL_HYPERSLABS = 2, /* Hyperslab selected */
H5S_SEL_ALL = 3, /* Entire extent selected */
H5S_SEL_N /*THIS MUST BE LAST */
-}H5S_sel_type;
+} H5S_sel_type;
#ifdef __cplusplus
extern "C" {
#endif
-/* Functions in H5S.c */
+/* Operations on dataspaces */
H5_DLL hid_t H5Screate(H5S_class_t type);
H5_DLL hid_t H5Screate_simple(int rank, const hsize_t dims[],
- const hsize_t maxdims[]);
+ const hsize_t maxdims[]);
H5_DLL herr_t H5Sset_extent_simple(hid_t space_id, int rank,
- const hsize_t dims[],
- const hsize_t max[]);
+ const hsize_t dims[], const hsize_t max[]);
H5_DLL hid_t H5Scopy(hid_t space_id);
H5_DLL herr_t H5Sclose(hid_t space_id);
H5_DLL herr_t H5Sencode(hid_t obj_id, void *buf, size_t *nalloc);
@@ -103,51 +102,37 @@ H5_DLL hid_t H5Sdecode(const void *buf);
H5_DLL hssize_t H5Sget_simple_extent_npoints(hid_t space_id);
H5_DLL int H5Sget_simple_extent_ndims(hid_t space_id);
H5_DLL int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[],
- hsize_t maxdims[]);
+ hsize_t maxdims[]);
H5_DLL htri_t H5Sis_simple(hid_t space_id);
-H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid);
-H5_DLL herr_t H5Sselect_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[]);
-/* #define NEW_HYPERSLAB_API */
-/* Note that these haven't been working for a while and were never
- * publicly released - QAK */
-#ifdef NEW_HYPERSLAB_API
-H5_DLL 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,
- hid_t space2_id);
-H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op,
- hid_t space2_id);
-#endif /* NEW_HYPERSLAB_API */
-H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op,
- size_t num_elem, const hsize_t *coord);
H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id);
H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
H5_DLL herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id);
H5_DLL htri_t H5Sextent_equal(hid_t sid1, hid_t sid2);
+
+/* Operations on dataspace selections */
+H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
+H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid);
H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id);
+H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
+H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[],
+ hsize_t end[]);
+H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
H5_DLL herr_t H5Sselect_all(hid_t spaceid);
H5_DLL herr_t H5Sselect_none(hid_t spaceid);
-H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
-H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
+H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op,
+ size_t num_elem, const hsize_t *coord);
+H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
+H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint,
+ hsize_t numpoints, hsize_t buf[/*numpoints*/]);
+H5_DLL herr_t H5Sselect_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 htri_t H5Sis_regular_hyperslab(hid_t spaceid);
H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[],
hsize_t stride[], hsize_t count[], hsize_t block[]);
H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
-H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
hsize_t numblocks, hsize_t buf[/*numblocks*/]);
-H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint,
- hsize_t numpoints, hsize_t buf[/*numpoints*/]);
-H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[],
- hsize_t end[]);
-H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
#ifdef __cplusplus
}
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index ea10517..24586de 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -17,9 +17,16 @@
* Purpose: Dataspace selection functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
@@ -27,16 +34,40 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Spkg.h" /* Dataspaces */
-#include "H5VMprivate.h" /* Vector and array functions */
-#include "H5WBprivate.h" /* Wrapped Buffers */
+#include "H5VMprivate.h" /* Vector and array functions */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
-/* Local functions */
#ifdef LATER
static herr_t H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
static htri_t H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter);
static herr_t H5S_select_iter_next_block(H5S_sel_iter_t *iter);
#endif /* LATER */
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
/* Declare a free list to manage the H5S_sel_iter_t struct */
H5FL_DEFINE(H5S_sel_iter_t);
@@ -47,6 +78,11 @@ H5FL_SEQ_EXTERN(size_t);
H5FL_SEQ_EXTERN(hsize_t);
+/*******************/
+/* Local Variables */
+/*******************/
+
+
/*--------------------------------------------------------------------------
NAME
@@ -78,13 +114,56 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset)
HDassert(offset);
/* Copy the offset over */
- HDmemcpy(space->select.offset, offset, sizeof(hssize_t)*space->extent.rank);
+ HDmemcpy(space->select.offset, offset, sizeof(hssize_t) * space->extent.rank);
/* Indicate that the offset was changed */
space->select.offset_changed = TRUE;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_select_offset() */
+} /* end H5S_select_offset() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Soffset_simple
+ PURPOSE
+ Changes the offset of a selection within a simple dataspace extent
+ USAGE
+ herr_t H5Soffset_simple(space_id, offset)
+ hid_t space_id; IN: Dataspace object to reset
+ const hssize_t *offset; IN: Offset to position the selection at
+ RETURNS
+ Non-negative on success/Negative on failure
+ DESCRIPTION
+ This function creates an offset for the selection within an extent, allowing
+ the same shaped selection to be moved to different locations within a
+ dataspace without requiring it to be re-defined.
+--------------------------------------------------------------------------*/
+herr_t
+H5Soffset_simple(hid_t space_id, const hssize_t *offset)
+{
+ H5S_t *space; /* Dataspace to query */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*Hs", space_id, offset);
+
+ /* Check args */
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
+ if(space->extent.rank == 0 || (H5S_GET_EXTENT_TYPE(space) == H5S_SCALAR
+ || H5S_GET_EXTENT_TYPE(space) == H5S_NULL))
+ HGOTO_ERROR(H5E_ATOM, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar or null dataspace")
+ if(offset == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no offset specified")
+
+ /* Set the selection offset */
+ if(H5S_select_offset(space, offset) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set offset")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Soffset_simple() */
/*--------------------------------------------------------------------------
@@ -139,9 +218,10 @@ done:
PURPOSE
Copy a selection from one dataspace to another
USAGE
- herr_t H5S_select_copy(dst, src)
+ herr_t H5S_select_copy(dst, src, share_selection)
H5S_t *dst; OUT: Pointer to the destination dataspace
H5S_t *src; IN: Pointer to the source dataspace
+ hbool_t; IN: Whether to share the selection between the dataspaces
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -177,7 +257,7 @@ H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_copy() */
+} /* end H5S_select_copy() */
/*-------------------------------------------------------------------------
@@ -211,44 +291,7 @@ H5S_select_release(H5S_t *ds)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_release() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5S_select_get_seq_list
- *
- * Purpose: Retrieves the next sequence of offset/length pairs for an
- * iterator on a dataspace
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Tuesday, May 18, 2004
- *
- * Note: This routine participates in the "Inlining C function pointers"
- * pattern, don't call it directly, use the appropriate macro
- * defined in H5Sprivate.h.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5S_select_get_seq_list(const H5S_t *space, unsigned flags,
- H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
- size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len)
-{
- herr_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(space);
-
- /* Call the selection type's get_seq_list function */
- if((ret_value = (*space->select.type->get_seq_list)(space, flags, iter, maxseq, maxbytes, nseq, nbytes, off, len)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get selection sequence list")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_get_seq_list() */
+} /* end H5S_select_release() */
/*-------------------------------------------------------------------------
@@ -278,10 +321,10 @@ H5S_select_serial_size(const H5S_t *space)
HDassert(space);
/* Call the selection type's serial_size function */
- ret_value=(*space->select.type->serial_size)(space);
+ ret_value = (*space->select.type->serial_size)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_serial_size() */
+} /* end H5S_select_serial_size() */
/*--------------------------------------------------------------------------
@@ -311,7 +354,7 @@ H5S_select_serial_size(const H5S_t *space)
herr_t
H5S_select_serialize(const H5S_t *space, uint8_t **p)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -319,10 +362,10 @@ H5S_select_serialize(const H5S_t *space, uint8_t **p)
HDassert(p);
/* Call the selection type's serialize function */
- ret_value=(*space->select.type->serialize)(space,p);
+ ret_value = (*space->select.type->serialize)(space, p);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_serialize() */
+} /* end H5S_select_serialize() */
/*--------------------------------------------------------------------------
@@ -359,7 +402,7 @@ H5Sget_select_npoints(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_select_npoints() */
+} /* H5Sget_select_npoints() */
/*--------------------------------------------------------------------------
@@ -382,7 +425,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-hssize_t
+H5_ATTR_PURE hssize_t
H5S_get_select_npoints(const H5S_t *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -391,7 +434,7 @@ H5S_get_select_npoints(const H5S_t *space)
HDassert(space);
FUNC_LEAVE_NOAPI((hssize_t)space->select.num_elem)
-} /* H5S_get_select_npoints() */
+} /* end H5S_get_select_npoints() */
/*--------------------------------------------------------------------------
@@ -413,8 +456,6 @@ H5S_get_select_npoints(const H5S_t *space)
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
- Christian Chilan 01/17/2007
- Changed the error return value from 0 to FAIL.
--------------------------------------------------------------------------*/
htri_t
H5Sselect_valid(hid_t spaceid)
@@ -433,7 +474,7 @@ H5Sselect_valid(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sselect_valid() */
+} /* end H5Sselect_valid() */
/*--------------------------------------------------------------------------
@@ -471,7 +512,7 @@ H5S_select_valid(const H5S_t *space)
ret_value = (*space->select.type->is_valid)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_valid() */
+} /* end H5S_select_valid() */
/*--------------------------------------------------------------------------
@@ -584,7 +625,7 @@ H5S_select_deserialize(H5S_t **space, const uint8_t **p)
default:
break;
- }
+ } /* end switch */
if(ret_value < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "can't deserialize selection")
@@ -599,7 +640,7 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_deserialize() */
+} /* end H5S_select_deserialize() */
/*--------------------------------------------------------------------------
@@ -651,7 +692,7 @@ H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[])
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_select_bounds() */
+} /* end H5Sget_select_bounds() */
/*--------------------------------------------------------------------------
@@ -693,10 +734,10 @@ H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
HDassert(start);
HDassert(end);
- ret_value = (*space->select.type->bounds)(space,start,end);
+ ret_value = (*space->select.type->bounds)(space, start, end);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_select_bounds() */
+} /* end H5S_get_select_bounds() */
/*--------------------------------------------------------------------------
@@ -736,7 +777,7 @@ H5S_get_select_offset(const H5S_t *space, hsize_t *offset)
ret_value = (*space->select.type->offset)(space, offset);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_select_offset() */
+} /* end H5S_get_select_offset() */
/*--------------------------------------------------------------------------
@@ -774,7 +815,7 @@ H5S_get_select_unlim_dim(const H5S_t *space)
ret_value = (*space->select.type->unlim_dim)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_select_unlim_dim() */
+} /* end H5S_get_select_unlim_dim() */
/*--------------------------------------------------------------------------
@@ -819,7 +860,7 @@ H5S_get_select_num_elem_non_unlim(const H5S_t *space,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_select_unlim_dim() */
+} /* end H5S_get_select_unlim_dim() */
/*--------------------------------------------------------------------------
@@ -856,7 +897,7 @@ H5S_select_is_contiguous(const H5S_t *space)
ret_value = (*space->select.type->is_contiguous)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_is_contiguous() */
+} /* end H5S_select_is_contiguous() */
/*--------------------------------------------------------------------------
@@ -893,7 +934,7 @@ H5S_select_is_single(const H5S_t *space)
ret_value = (*space->select.type->is_single)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_is_single() */
+} /* end H5S_select_is_single() */
/*--------------------------------------------------------------------------
@@ -930,7 +971,7 @@ H5S_select_is_regular(const H5S_t *space)
ret_value = (*space->select.type->is_regular)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_is_regular() */
+} /* end H5S_select_is_regular() */
/*--------------------------------------------------------------------------
@@ -968,7 +1009,7 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
ret_value = (*space->select.type->adjust_u)(space, offset);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_adjust_u() */
+} /* end H5S_select_adjust_u() */
/*--------------------------------------------------------------------------
@@ -1007,7 +1048,7 @@ H5S_select_project_scalar(const H5S_t *space, hsize_t *offset)
ret_value = (*space->select.type->project_scalar)(space, offset);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_project_scalar() */
+} /* end H5S_select_project_scalar() */
/*--------------------------------------------------------------------------
@@ -1048,7 +1089,7 @@ H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset)
ret_value = (*space->select.type->project_simple)(space, new_space, offset);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_project_simple() */
+} /* end H5S_select_project_simple() */
/*--------------------------------------------------------------------------
@@ -1098,7 +1139,7 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s
HDassert(sel_iter->type);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_init() */
+} /* end H5S_select_iter_init() */
/*--------------------------------------------------------------------------
@@ -1135,10 +1176,10 @@ H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords)
HDassert(coords);
/* Call iter_coords routine for selection type */
- ret_value = (*sel_iter->type->iter_coords)(sel_iter,coords);
+ ret_value = (*sel_iter->type->iter_coords)(sel_iter, coords);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_coords() */
+} /* end H5S_select_iter_coords() */
#ifdef LATER
@@ -1170,7 +1211,7 @@ H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
{
herr_t ret_value; /* return value */
- FUNC_ENTER_NOAPI_NOINIT_NOINIT_NOERR
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(iter);
@@ -1178,10 +1219,10 @@ H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
HDassert(end);
/* Call iter_block routine for selection type */
- ret_value = (*iter->type->iter_block)(iter,start,end);
+ ret_value = (*iter->type->iter_block)(iter, start, end);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_block() */
+} /* end H5S_select_iter_block() */
#endif /* LATER */
@@ -1219,7 +1260,7 @@ H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter)
ret_value = (*sel_iter->type->iter_nelmts)(sel_iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_nelmts() */
+} /* end H5S_select_iter_nelmts() */
#ifdef LATER
@@ -1249,7 +1290,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter)
{
herr_t ret_value; /* return value */
- FUNC_ENTER_NOAPI_NOINIT_NOINIT_NOERR
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(iter);
@@ -1258,7 +1299,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter)
ret_value = (*iter->type->iter_has_next_block)(iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_has_next_block() */
+} /* end H5S_select_iter_has_next_block() */
#endif /* LATER */
@@ -1296,13 +1337,13 @@ H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem)
HDassert(nelem>0);
/* Call iter_next routine for selection type */
- ret_value = (*iter->type->iter_next)(iter,nelem);
+ ret_value = (*iter->type->iter_next)(iter, nelem);
/* Decrement the number of elements left in selection */
iter->elmt_left-=nelem;
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_next() */
+} /* end H5S_select_iter_next() */
#ifdef LATER
@@ -1343,10 +1384,48 @@ H5S_select_iter_next_block(H5S_sel_iter_t *iter)
ret_value = (*iter->type->iter_next_block)(iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_next_block() */
+} /* end H5S_select_iter_next_block() */
#endif /* LATER */
+/*-------------------------------------------------------------------------
+ * Function: H5S_select_get_seq_list
+ *
+ * Purpose: Retrieves the next sequence of offset/length pairs for an
+ * iterator on a dataspace
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, May 18, 2004
+ *
+ * Note: This routine participates in the "Inlining C function pointers"
+ * pattern, don't call it directly, use the appropriate macro
+ * defined in H5Sprivate.h.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5S_select_get_seq_list(const H5S_t *space, unsigned flags,
+ H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
+ size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len)
+{
+ herr_t ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Sanity check */
+ HDassert(space);
+
+ /* Call the selection type's get_seq_list function */
+ if((ret_value = (*space->select.type->get_seq_list)(space, flags, iter, maxseq, maxbytes, nseq, nbytes, off, len)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get selection sequence list")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_select_get_seq_list() */
+
+
/*--------------------------------------------------------------------------
NAME
H5S_select_iter_release
@@ -1381,7 +1460,7 @@ H5S_select_iter_release(H5S_sel_iter_t *sel_iter)
ret_value = (*sel_iter->type->iter_release)(sel_iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_release() */
+} /* end H5S_select_iter_release() */
/*--------------------------------------------------------------------------
@@ -1421,7 +1500,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
hsize_t *off = NULL; /* Array to store sequence offsets */
size_t *len = NULL; /* Array to store sequence lengths */
hssize_t nelmts; /* Number of elements in selection */
- hsize_t space_size[H5O_LAYOUT_NDIMS]; /* Dataspace size */
+ hsize_t space_size[H5S_MAX_RANK]; /* Dataspace size */
size_t max_elem; /* Maximum number of elements allowed in sequences */
size_t elmt_size; /* Datatype size */
unsigned ndims; /* Number of dimensions in dataspace */
@@ -1495,7 +1574,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
/* Loop, while bytes left in sequence */
while(curr_len > 0 && user_ret == 0) {
- hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of element in dataspace */
+ hsize_t coords[H5S_MAX_RANK]; /* Coordinates of element in dataspace */
hsize_t tmp_off; /* Temporary offset within sequence */
uint8_t *loc; /* Current element location in buffer */
int i; /* Local Index variable */
@@ -1515,14 +1594,20 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
/* Make the application callback */
user_ret = (op->u.app_op.op)(loc, op->u.app_op.type_id, ndims, coords, op_data);
break;
+
case H5S_SEL_ITER_OP_LIB:
/* Call the library's callback */
user_ret = (op->u.lib_op)(loc, type, ndims, coords, op_data);
break;
+
default:
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unsupported op type")
} /* end switch */
+ /* Check for error return from iterator */
+ if(user_ret < 0)
+ HERROR(H5E_DATASPACE, H5E_CANTNEXT, "iteration operator failed");
+
/* Increment offset in dataspace */
curr_off += elmt_size;
@@ -1552,7 +1637,7 @@ done:
iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_iterate() */
+} /* end H5S_select_iterate() */
/*--------------------------------------------------------------------------
@@ -1588,7 +1673,7 @@ H5Sget_select_type(hid_t space_id)
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Sget_select_type() */
+} /* end H5Sget_select_type() */
/*--------------------------------------------------------------------------
@@ -1610,7 +1695,7 @@ done:
pattern, don't call it directly, use the appropriate macro
defined in H5Sprivate.h.
--------------------------------------------------------------------------*/
-H5S_sel_type
+H5_ATTR_PURE H5S_sel_type
H5S_get_select_type(const H5S_t *space)
{
H5S_sel_type ret_value = H5S_SEL_ERROR; /* Return value */
@@ -1621,10 +1706,10 @@ H5S_get_select_type(const H5S_t *space)
HDassert(space);
/* Set return value */
- ret_value=H5S_GET_SELECT_TYPE(space);
+ ret_value = H5S_GET_SELECT_TYPE(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_get_select_type() */
+} /* end H5S_get_select_type() */
/*--------------------------------------------------------------------------
@@ -1647,17 +1732,15 @@ H5S_get_select_type(const H5S_t *space)
Assumes that there is only a single "block" for hyperslab selections.
EXAMPLES
REVISION LOG
- Modified function to view identical shapes with different dimensions
- as being the same under some circumstances.
--------------------------------------------------------------------------*/
htri_t
H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
{
H5S_sel_iter_t *iter_a = NULL; /* Selection a iteration info */
H5S_sel_iter_t *iter_b = NULL; /* Selection b iteration info */
- hbool_t iter_a_init = FALSE; /* Selection a iteration info has been initialized */
- hbool_t iter_b_init = FALSE; /* Selection b iteration info has been initialized */
- htri_t ret_value = TRUE; /* Return value */
+ hbool_t iter_a_init = FALSE; /* Selection a iteration info has been initialized */
+ hbool_t iter_b_init = FALSE; /* Selection b iteration info has been initialized */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1677,20 +1760,19 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
unsigned space_a_rank; /* Number of dimensions of dataspace A */
unsigned space_b_rank; /* Number of dimensions of dataspace B */
- /* need to be able to handle spaces of different rank:
+ /* Need to be able to handle spaces of different rank:
*
* To simplify logic, let space_a point to the element of the set
- * {space1, space2} with the largest rank or space1 if the ranks
+ * {space1, space2} with the largest rank or space1 if the ranks
* are identical.
*
* Similarly, let space_b point to the element of {space1, space2}
* with the smallest rank, or space2 if they are identical.
*
- * Let: space_a_rank be the rank of space_a,
+ * Let: space_a_rank be the rank of space_a,
* space_b_rank be the rank of space_b,
- * delta_rank = space_a_rank - space_b_rank.
*
- * Set all this up below.
+ * Set all this up here.
*/
if(space1->extent.rank >= space2->extent.rank) {
space_a = space1;
@@ -1709,10 +1791,6 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
HDassert(space_a_rank >= space_b_rank);
HDassert(space_b_rank > 0);
- /* Check for different number of elements selected */
- if(H5S_GET_SELECT_NPOINTS(space_a) != H5S_GET_SELECT_NPOINTS(space_b))
- HGOTO_DONE(FALSE)
-
/* Check for "easy" cases before getting into generalized block iteration code */
if((H5S_GET_SELECT_TYPE(space_a) == H5S_SEL_ALL) && (H5S_GET_SELECT_TYPE(space_b) == H5S_SEL_ALL)) {
hsize_t dims1[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #1 */
@@ -1833,11 +1911,11 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
space_a_dim = (int)space_a_rank - 1;
space_b_dim = (int)space_b_rank - 1;
- /* The first block only compares the sizes and sets the
- * relative offsets for later blocks
+ /* The first block only compares the sizes and sets the
+ * relative offsets for later blocks
*/
if(first_block) {
- /* If the block sizes in the common dimensions from
+ /* If the block sizes in the common dimensions from
* each selection don't match, get out
*/
while(space_b_dim >= 0) {
@@ -1853,7 +1931,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
space_b_dim--;
} /* end while */
- /* similarly, if the block size in any dimension that appears only
+ /* Similarly, if the block size in any dimension that appears only
* in space_a is not equal to 1, get out.
*/
while(space_a_dim >= 0) {
@@ -1871,7 +1949,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
} /* end if */
/* Check over the blocks for each selection */
else {
- /* for dimensions that space_a and space_b have in common: */
+ /* For dimensions that space_a and space_b have in common: */
while(space_b_dim >= 0) {
/* Check if the blocks are in the same relative location */
if((start_a[space_a_dim] - off_a[space_a_dim]) !=
@@ -1932,7 +2010,7 @@ done:
iter_b = H5FL_FREE(H5S_sel_iter_t, iter_b);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_shape_same() */
+} /* end H5S_select_shape_same() */
/*--------------------------------------------------------------------------
@@ -1941,24 +2019,24 @@ done:
PURPOSE
Given a dataspace a of rank n with some selection, construct a new
- dataspace b of rank m (m != n), with the selection in a being
- topologically identical to that in b (as verified by
+ dataspace b of rank m (m != n), with the selection in a being
+ topologically identical to that in b (as verified by
H5S_select_shape_same().
- This function exists, as some I/O code chokes on topologically
- identical selections with different ranks. At least to begin
+ This function exists, as some I/O code chokes on topologically
+ identical selections with different ranks. At least to begin
with, we will deal with the issue by constructing projections
- of the memory dataspace with ranks equaling those of the file
+ of the memory dataspace with ranks equaling those of the file
dataspace.
- Note that if m > n, it is possible that the starting point in the
- buffer associated with the memory dataspace will have to be
+ Note that if m > n, it is possible that the starting point in the
+ buffer associated with the memory dataspace will have to be
adjusted to match the projected dataspace. If the buf parameter
is not NULL, the function must return an adjusted buffer base
address in *adj_buf_ptr.
USAGE
- htri_t H5S_select_construct_projection(base_space,
+ htri_t H5S_select_construct_projection(base_space,
new_space_ptr,
new_space_rank,
buf,
@@ -1967,30 +2045,30 @@ done:
H5S_t ** new_space_ptr; OUT: Ptr to location in which to return
the address of the projected space
int new_space_rank; IN: Rank of the projected space.
- const void * buf; IN: Base address of the buffer
+ const void * buf; IN: Base address of the buffer
associated with the base space.
May be NULL.
void ** adj_buf_ptr; OUT: If buf != NULL, store the base
- address of the section of buf
+ address of the section of buf
that is described by *new_space_ptr
in *adj_buf_ptr.
-
+
RETURNS
Non-negative on success/Negative on failure.
DESCRIPTION
- Construct a new dataspace and associated selection which is a
- projection of the supplied dataspace and associated selection into
+ Construct a new dataspace and associated selection which is a
+ projection of the supplied dataspace and associated selection into
the specified rank. Return it in *new_space_ptr.
- If buf is supplied, computes the base address of the projected
+ If buf is supplied, computes the base address of the projected
selection in buf, and stores the base address in *adj_buf_ptr.
-
+
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
- The selection in the supplied base_space has thickness 1 in all
+ The selection in the supplied base_space has thickness 1 in all
dimensions greater than new_space_rank. Note that here we count
- dimensions from the fastest changing coordinate to the slowest
+ dimensions from the fastest changing coordinate to the slowest
changing changing coordinate.
EXAMPLES
REVISION LOG
@@ -2036,28 +2114,28 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
/* Create new scalar dataspace */
if(NULL == (new_space = H5S_create(H5S_SCALAR)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create scalar dataspace")
-
+
/* No need to register the dataspace(i.e. get an ID) as
* we will just be discarding it shortly.
*/
- /* Selection for the new space will be either all or
+ /* Selection for the new space will be either all or
* none, depending on whether the base space has 0 or
* 1 elements selected.
*
- * Observe that the base space can't have more than
+ * Observe that the base space can't have more than
* one selected element, since its selection has the
- * same shape as the file dataspace, and that data
+ * same shape as the file dataspace, and that data
* space is scalar.
*/
if(1 == npoints) {
/* Assuming that the selection in the base dataspace is not
- * empty, we must compute the offset of the selected item in
+ * empty, we must compute the offset of the selected item in
* the buffer associated with the base dataspace.
*
- * Since the new space rank is zero, we know that the
- * the base space must have rank at least 1 -- and
- * hence it is a simple dataspace. However, the
+ * Since the new space rank is zero, we know that the
+ * the base space must have rank at least 1 -- and
+ * hence it is a simple dataspace. However, the
* selection, may be either point, hyperspace, or all.
*
*/
@@ -2075,25 +2153,25 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
hsize_t new_space_dims[H5S_MAX_RANK]; /* Current dimensions for new dataspace */
hsize_t new_space_maxdims[H5S_MAX_RANK];/* Maximum dimensions for new dataspace */
unsigned rank_diff; /* Difference in ranks */
-
+
/* Set up the dimensions of the new, projected dataspace.
*
- * How we do this depends on whether we are projecting up into
- * increased dimensions, or down into a reduced number of
+ * How we do this depends on whether we are projecting up into
+ * increased dimensions, or down into a reduced number of
* dimensions.
*
- * If we are projecting up (the first half of the following
- * if statement), we copy the dimensions of the base data
- * space into the fastest changing dimensions of the new
+ * If we are projecting up (the first half of the following
+ * if statement), we copy the dimensions of the base data
+ * space into the fastest changing dimensions of the new
* projected dataspace, and set the remaining dimensions to
* one.
*
* If we are projecting down (the second half of the following
- * if statement), we just copy the dimensions with the most
+ * if statement), we just copy the dimensions with the most
* quickly changing dimensions into the dims for the projected
* data set.
*
- * This works, because H5S_select_shape_same() will return
+ * This works, because H5S_select_shape_same() will return
* true on selections of different rank iff:
*
* 1) the selection in the lower rank dataspace matches that
@@ -2101,13 +2179,13 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
* the larger rank dataspace, and
*
* 2) the selection has thickness 1 in all ranks that appear
- * only in the higher rank dataspace (i.e. those with
+ * only in the higher rank dataspace (i.e. those with
* more slowly changing indicies).
- */
+ */
if(new_space_rank > base_space_rank) {
hsize_t tmp_dim_size = 1; /* Temporary dimension value, for filling arrays */
- /* we must copy the dimensions of the base space into
+ /* we must copy the dimensions of the base space into
* the fastest changing dimensions of the new space,
* and set the remaining dimensions to 1
*/
@@ -2118,7 +2196,7 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
HDmemcpy(&new_space_maxdims[rank_diff], base_space_maxdims, sizeof(new_space_maxdims[0]) * base_space_rank);
} /* end if */
else { /* new_space_rank < base_space_rank */
- /* we must copy the fastest changing dimension of the
+ /* we must copy the fastest changing dimension of the
* base space into the dimensions of the new space.
*/
rank_diff = base_space_rank - new_space_rank;
@@ -2126,12 +2204,12 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
HDmemcpy(new_space_maxdims, &base_space_maxdims[rank_diff], sizeof(new_space_maxdims[0]) * new_space_rank);
} /* end else */
- /* now have the new space rank and dimensions set up --
+ /* now have the new space rank and dimensions set up --
* so we can create the new simple dataspace.
*/
if(NULL == (new_space = H5S_create_simple(new_space_rank, new_space_dims, new_space_maxdims)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
-
+
/* No need to register the dataspace(i.e. get an ID) as
* we will just be discarding it shortly.
*/
@@ -2142,13 +2220,13 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
*/
if(H5S_SELECT_PROJECT_SIMPLE(base_space, new_space, &projected_space_element_offset) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to project simple selection")
-
+
/* If we get this far, we have created the new dataspace, and projected
* the selection in the base dataspace into the new dataspace.
*
- * If the base dataspace is simple, check to see if the
- * offset_changed flag on the base selection has been set -- if so,
- * project the offset into the new dataspace and set the
+ * If the base dataspace is simple, check to see if the
+ * offset_changed flag on the base selection has been set -- if so,
+ * project the offset into the new dataspace and set the
* offset_changed flag.
*/
if(H5S_GET_EXTENT_TYPE(base_space) == H5S_SIMPLE && base_space->select.offset_changed) {
@@ -2180,12 +2258,12 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
* Since we can't do pointer arithmetic on void pointers, we first
* cast buf to a pointer to byte -- i.e. uint8_t.
*
- * We then multiply the projected space element offset we
- * calculated earlier by the supplied element size, add this
- * value to the type cast buf pointer, cast the result back
+ * We then multiply the projected space element offset we
+ * calculated earlier by the supplied element size, add this
+ * value to the type cast buf pointer, cast the result back
* to a pointer to void, and assign the result to *adj_buf_ptr.
*/
- *adj_buf_ptr = (const void *)(((const uint8_t *)buf) +
+ *adj_buf_ptr = (const void *)(((const uint8_t *)buf) +
((size_t)(projected_space_element_offset * element_size)));
} /* end if */
else
@@ -2200,7 +2278,7 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_construct_projection() */
+} /* end H5S_select_construct_projection() */
/*--------------------------------------------------------------------------
@@ -2231,7 +2309,7 @@ herr_t
H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_buf)
{
H5S_sel_iter_t *iter = NULL; /* Selection iteration info */
- hbool_t iter_init = 0; /* Selection iteration info has been initialized */
+ hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
hsize_t *off = NULL; /* Array to store sequence offsets */
size_t *len = NULL; /* Array to store sequence lengths */
hssize_t nelmts; /* Number of elements in selection */
@@ -2253,7 +2331,7 @@ H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_b
/* Initialize iterator */
if(H5S_select_iter_init(iter, space, fill_size) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
- iter_init = 1; /* Selection iteration info has been initialized */
+ iter_init = TRUE; /* Selection iteration info has been initialized */
/* Get the number of elements in selection */
if((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(space)) < 0)
@@ -2308,7 +2386,7 @@ done:
iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_fill() */
+} /* end H5S_select_fill() */
/*--------------------------------------------------------------------------
@@ -2335,7 +2413,7 @@ done:
src_intersect_space within the selection of src_space as a selection
within the selection of dst_space. The result is placed in the
selection of new_space_ptr.
-
+
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
@@ -2359,7 +2437,7 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Create new space, using dst extent. Start with "all" selection. */
if(NULL == (new_space = H5S_create(H5S_SIMPLE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create output dataspace")
- if(H5S_extent_copy_real(&new_space->extent, &dst_space->extent, TRUE) < 0)
+ if(H5S__extent_copy_real(&new_space->extent, &dst_space->extent, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy destination space extent")
/* If the intersecting space is "all", the intersection must be equal to the
@@ -2377,14 +2455,14 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
if(H5S_select_none(new_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
} /* end if */
- /* If any of the spaces use point selection, fall back to general algorithm
- */
+ /* If any of the spaces use point selection, fall back to general algorithm */
else if((src_intersect_space->select.type->type == H5S_SEL_POINTS)
|| (src_space->select.type->type == H5S_SEL_POINTS)
|| (dst_space->select.type->type == H5S_SEL_POINTS))
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported")
else {
HDassert(src_intersect_space->select.type->type == H5S_SEL_HYPERSLABS);
+
/* Intersecting space is hyperslab selection. Call the hyperslab
* routine to project to another hyperslab selection. */
if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space) < 0)
@@ -2401,7 +2479,7 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_project_intersection() */
+} /* end H5S_select_project_intersection() */
/*--------------------------------------------------------------------------
@@ -2423,7 +2501,7 @@ done:
Removes any and all portions of space that are also present in
subtract_space. In essence, performs an A_NOT_B operation with the
two selections.
-
+
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
@@ -2491,5 +2569,5 @@ H5S_select_subtract(H5S_t *space, H5S_t *subtract_space)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_subtract() */
+} /* end H5S_select_subtract() */
diff --git a/src/H5Stest.c b/src/H5Stest.c
index a7bee2b..50f5fa9 100644
--- a/src/H5Stest.c
+++ b/src/H5Stest.c
@@ -17,23 +17,60 @@
* Purpose: Dataspace selection testing functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
#define H5S_TESTING /*suppress warning about H5S testing funcs*/
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5Spkg.h" /* Dataspaces */
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
/*--------------------------------------------------------------------------
NAME
- H5S_select_shape_same_test
+ H5S__select_shape_same_test
PURPOSE
Determine if two dataspace selections are the same shape
USAGE
- htri_t H5S_select_shape_same_test(sid1, sid2)
+ htri_t H5S__select_shape_same_test(sid1, sid2)
hid_t sid1; IN: 1st dataspace to compare
hid_t sid2; IN: 2nd dataspace to compare
RETURNS
@@ -48,13 +85,13 @@
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5S_select_shape_same_test(hid_t sid1, hid_t sid2)
+H5S__select_shape_same_test(hid_t sid1, hid_t sid2)
{
H5S_t *space1; /* Pointer to 1st dataspace */
H5S_t *space2; /* Pointer to 2nd dataspace */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Get dataspace structures */
if(NULL == (space1 = (H5S_t *)H5I_object_verify(sid1, H5I_DATASPACE)))
@@ -68,16 +105,16 @@ H5S_select_shape_same_test(hid_t sid1, hid_t sid2)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_shape_same_test() */
+} /* H5S__select_shape_same_test() */
/*--------------------------------------------------------------------------
NAME
- H5S_get_rebuild_status_test
+ H5S__get_rebuild_status_test
PURPOSE
Determine the status of hyperslab rebuild
USAGE
- htri_t H5S_inquiry_rebuild_status(hid_t space_id)
+ htri_t H5S__get_rebuild_status_test(hid_t space_id)
hid_t space_id; IN: dataspace id
RETURNS
Non-negative TRUE/FALSE on success, negative on failure
@@ -90,12 +127,12 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5S_get_rebuild_status_test(hid_t space_id)
+H5S__get_rebuild_status_test(hid_t space_id)
{
H5S_t *space; /* Pointer to 1st dataspace */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Get dataspace structures */
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
@@ -105,5 +142,5 @@ H5S_get_rebuild_status_test(hid_t space_id)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_rebuild_status_test() */
+} /* H5S__get_rebuild_status_test() */
diff --git a/src/H5T.c b/src/H5T.c
index cd54183..ad36492 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -295,6 +295,7 @@ static htri_t H5T__compiler_conv(H5T_t *src, H5T_t *dst);
static herr_t H5T__set_size(H5T_t *dt, size_t size);
static herr_t H5T__close_cb(H5T_t *dt);
static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_conv_func_t *conv);
+static hbool_t H5T__detect_reg_ref(const H5T_t *dt);
/*****************************/
@@ -1396,7 +1397,7 @@ H5T_top_term_package(void)
if((path->conv.u.lib_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) {
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
- fprintf(H5DEBUG(T), "H5T: conversion function "
+ HDfprintf(H5DEBUG(T), "H5T: conversion function "
"0x%08lx failed to free private data for "
"%s (ignored)\n",
(unsigned long)(path->conv.u.lib_func), path->name);
@@ -1729,7 +1730,6 @@ H5Tcopy(hid_t type_id)
case H5I_GROUP:
case H5I_DATASPACE:
case H5I_ATTR:
- case H5I_REFERENCE:
case H5I_VFL:
case H5I_VOL:
case H5I_GENPROP_CLS:
@@ -5507,6 +5507,111 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5T_detect_reg_ref
+ *
+ * Purpose: Check whether a datatype contains (or is) a region reference
+ * datatype.
+ *
+ * Return: TRUE (1) or FALSE (0) on success
+ * (Can't fail)
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 5, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+H5T__detect_reg_ref(const H5T_t *dt)
+{
+ unsigned u; /* Local index variable */
+ hbool_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(dt);
+
+ /* Check if this datatype is a region reference */
+ if(H5T_REFERENCE == dt->shared->type && H5R_DATASET_REGION == dt->shared->u.atomic.u.r.rtype)
+ HGOTO_DONE(TRUE);
+
+ /* Check for types that might have the correct type as a component */
+ switch(dt->shared->type) {
+ case H5T_COMPOUND:
+ /* Iterate over all the compound datatype's fields */
+ for(u = 0; u < dt->shared->u.compnd.nmembs; u++)
+ /* Recurse on field's datatype */
+ if(H5T__detect_reg_ref(dt->shared->u.compnd.memb[u].type))
+ HGOTO_DONE(TRUE);
+ break;
+
+ case H5T_ARRAY:
+ case H5T_VLEN:
+ case H5T_ENUM:
+ HGOTO_DONE(H5T__detect_reg_ref(dt->shared->parent));
+ break;
+
+ case H5T_NO_CLASS:
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_TIME:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_REFERENCE:
+ case H5T_NCLASSES:
+ default:
+ break;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__detect_reg_ref() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_is_vl_storage
+ *
+ * Purpose: Check if a datatype will be stored in a variable-length form.
+ *
+ * Notes: Currently, only variable-length string & sequences and region
+ * references are stored in a variable-length form.
+ *
+ * Return:
+ * One of two values on success:
+ * TRUE - If the datatype will be stored in a variable-length form
+ * FALSE - If the datatype will NOT be stored in a variable-length form
+ * <0 is returned on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 5, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5T_is_vl_storage(const H5T_t *dt)
+{
+ htri_t ret_value = FALSE;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(dt);
+
+ /* VL and region reference datatypes are stored in variable-length form */
+ if(H5T_detect_class(dt, H5T_VLEN, FALSE))
+ ret_value = TRUE;
+ else if(H5T_detect_class(dt, H5T_REFERENCE, FALSE))
+ ret_value = H5T__detect_reg_ref(dt);
+ else
+ ret_value = FALSE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_is_vl_storage() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5T_upgrade_version_cb
*
* Purpose: H5T__visit callback to Upgrade the version of a datatype
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 610c628..712b264 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -155,7 +155,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id,
/* Set up VOL object */
if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t)))
- HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate top object structure")
new_obj->connector = vol_obj->connector;
new_obj->connector->nrefs ++;
new_obj->data = data;
@@ -308,7 +308,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
/* Setup VOL object */
if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t)))
- HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate top object structure")
new_obj->connector = vol_obj->connector;
new_obj->connector->nrefs ++;
new_obj->data = dt;
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index e6d83bb..9a1105b 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -2771,7 +2771,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
case H5T_CONV_FREE:
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
- fprintf(H5DEBUG(T), " Using %s mapping function%s\n",
+ HDfprintf(H5DEBUG(T), " Using %s mapping function%s\n",
priv->length?"O(1)":"O(log N)",
priv->length?"":", where N is the number of enum members");
}
diff --git a/src/H5Torder.c b/src/H5Torder.c
index d687d03..62662d6 100644
--- a/src/H5Torder.c
+++ b/src/H5Torder.c
@@ -100,11 +100,11 @@ H5Tget_order(hid_t type_id)
/* Check args */
if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_ORDER_ERROR, "not a datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_ORDER_ERROR, "not a datatype")
/* Get order */
if(H5T_ORDER_ERROR == (ret_value = H5T_get_order(dt)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "cant't get order for specified datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "can't get order for specified datatype")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 6b6446f..3dcbb2c 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -145,6 +145,7 @@ H5_DLL H5T_t *H5T_get_actual_type(H5T_t *dt);
H5_DLL herr_t H5T_save_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared);
H5_DLL herr_t H5T_restore_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared);
H5_DLL hbool_t H5T_already_vol_managed(const H5T_t *dt);
+H5_DLL htri_t H5T_is_vl_storage(const H5T_t *dt);
/* Reference specific functions */
H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt);
diff --git a/src/H5VL.c b/src/H5VL.c
index eedf68d..aa276ec 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -11,7 +11,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Purpose: The Virtual Object Layer as described in documentation.
+ * Purpose: The Virtual Object Layer as described in documentation.
* The pupose is to provide an abstraction on how to access the
* underlying HDF5 container, whether in a local file with
* a specific file format, or remotely on other machines, etc...
@@ -156,9 +156,9 @@ H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the NULL pointer")
if (0 == HDstrlen(cls->name))
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the empty string")
- if (cls->info_copy && !cls->info_free)
+ if (cls->info_cls.copy && !cls->info_cls.free)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for VOL info objects when a copy callback is provided")
- if (cls->get_wrap_ctx && !cls->free_wrap_ctx)
+ if (cls->wrap_cls.get_wrap_ctx && !cls->wrap_cls.free_wrap_ctx)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for object wrapping contexts when a get callback is provided")
op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
@@ -295,7 +295,7 @@ H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id)
const H5VL_class_t *cls;
/* Try loading the connector */
- key.vol.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ key.vol.kind = H5VL_GET_CONNECTOR_BY_VALUE;
key.vol.u.value = value;
if(NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, &key)))
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector")
@@ -486,14 +486,11 @@ done:
/*---------------------------------------------------------------------------
* Function: H5VLcmp_connector_cls
*
- * Purpose: Compares two connector classes
+ * Purpose: Compares two connector classes (based on their value field)
*
- * Return: Success: Non-negative, with *cmp set to positive if
- * connector_id1 is greater than connector_id2, negative if connector_id2
- * is greater than connector_id1 and zero if connector_id1 and connector_id2
- * are equal.
+ * Return: Success: Non-negative, *cmp set to a value like strcmp
*
- * Failure: Negative
+ * Failure: Negative, *cmp unset
*
*---------------------------------------------------------------------------
*/
@@ -520,3 +517,73 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5VLcmp_connector_cls() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLwrap_register
+ *
+ * Purpose: Wrap an internal object with a "wrap context" and register an
+ * hid_t for the resulting object.
+ *
+ * Note: This routine is mainly targeted toward wrapping objects for
+ * iteration routine callbacks (i.e. the callbacks from H5Aiterate*,
+ * H5Literate* / H5Lvisit*, and H5Ovisit* ).
+ *
+ * Return: Success: Non-negative hid_t for the object.
+ * Failure: Negative (H5I_INVALID_HID)
+ *
+ *---------------------------------------------------------------------------
+ */
+hid_t
+H5VLwrap_register(void *obj, H5I_type_t type)
+{
+ hid_t ret_value; /* Return value */
+
+ /* Use FUNC_ENTER_API_NOINIT here, so the API context doesn't get reset */
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("i", "*xIt", obj, type);
+
+ /* Check args */
+ if(type <= H5I_BADID || type >= H5I_NTYPES)
+ HGOTO_ERROR(H5E_VOL, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number")
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "obj is NULL")
+
+ /* Wrap the object and register an ID for it */
+ if((ret_value = H5VL_wrap_register(type, obj, TRUE)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to wrap object")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLwrap_register() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLobject
+ *
+ * Purpose: Retrieve the object pointer associated with an hid_t for a.
+ * VOL object.
+ *
+ * Note: This routine is mainly targeted toward unwrapping objects for
+ * testing.
+ *
+ * Return: Success: Object pointer
+ * Failure: NULL
+ *
+ *---------------------------------------------------------------------------
+ */
+void *
+H5VLobject(hid_t id)
+{
+ void *ret_value; /* Return value */
+
+ FUNC_ENTER_API(NULL)
+ H5TRACE1("*x", "i", id);
+
+ /* Retrieve the object pointer for the ID */
+ if(NULL == (ret_value = H5VL_object(id)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to retrieve object")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5VLobject() */
+
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index 2828262..5a5d9ee 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -95,8 +95,6 @@ static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls,
hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
void **req);
-static herr_t H5VL__file_cache_connector(void *obj, const H5VL_class_t *cls,
- hid_t dxpl_id, void **req, ...);
static void * H5VL__file_create(const H5VL_class_t *cls, const char *name,
unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
static void * H5VL__file_open(const H5VL_class_t *cls, const char *name,
@@ -350,14 +348,14 @@ H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info,
/* Check for actual source info */
if(src_info) {
/* Allow the connector to copy or do it ourselves */
- if(connector->info_copy) {
- if(NULL == (new_connector_info = (connector->info_copy)(src_info)))
+ if(connector->info_cls.copy) {
+ if(NULL == (new_connector_info = (connector->info_cls.copy)(src_info)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "connector info copy callback failed")
} /* end if */
- else if(connector->info_size > 0) {
- if(NULL == (new_connector_info = H5MM_malloc(connector->info_size)))
+ else if(connector->info_cls.size > 0) {
+ if(NULL == (new_connector_info = H5MM_malloc(connector->info_cls.size)))
HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "connector info allocation failed")
- HDmemcpy(new_connector_info, src_info, connector->info_size);
+ HDmemcpy(new_connector_info, src_info, connector->info_cls.size);
} /* end else-if */
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "no way to copy connector info")
@@ -446,13 +444,13 @@ H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value,
* if there is a a callback, otherwise just compare the info objects as
* memory buffers
*/
- if(connector->info_cmp) {
- if((connector->info_cmp)(cmp_value, info1, info2) < 0)
+ if(connector->info_cls.cmp) {
+ if((connector->info_cls.cmp)(cmp_value, info1, info2) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector info")
} /* end if */
else {
- HDassert(connector->info_size > 0);
- *cmp_value = HDmemcmp(info1, info2, connector->info_size);
+ HDassert(connector->info_cls.size > 0);
+ *cmp_value = HDmemcmp(info1, info2, connector->info_cls.size);
} /* end else */
done:
@@ -520,8 +518,8 @@ H5VL_free_connector_info(const H5VL_class_t *connector, void *info)
/* Only free info object, if it's non-NULL */
if(info) {
/* Allow the connector to free info or do it ourselves */
- if(connector->info_free) {
- if((connector->info_free)(info) < 0)
+ if(connector->info_cls.free) {
+ if((connector->info_cls.free)(info) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed")
} /* end if */
else
@@ -592,8 +590,8 @@ H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Allow the connector to serialize info */
- if(cls->info_to_str) {
- if((cls->info_to_str)(info, str) < 0)
+ if(cls->info_cls.to_str) {
+ if((cls->info_cls.to_str)(info, str) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "can't serialize connector info")
} /* end if */
else
@@ -634,8 +632,8 @@ H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Allow the connector to deserialize info */
- if(cls->str_to_info) {
- if((cls->str_to_info)(str, info) < 0)
+ if(cls->info_cls.from_str) {
+ if((cls->info_cls.from_str)(str, info) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize connector info")
} /* end if */
else
@@ -675,8 +673,8 @@ H5VLget_object(void *obj, hid_t connector_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Check for 'get_object' callback in connector */
- if(cls->get_object)
- ret_value = (cls->get_object)(obj);
+ if(cls->wrap_cls.get_object)
+ ret_value = (cls->wrap_cls.get_object)(obj);
else
ret_value = obj;
@@ -708,12 +706,12 @@ H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, void **wrap_ctx)
HDassert(wrap_ctx);
/* Allow the connector to copy or do it ourselves */
- if(connector->get_wrap_ctx) {
+ if(connector->wrap_cls.get_wrap_ctx) {
/* Sanity check */
- HDassert(connector->free_wrap_ctx);
+ HDassert(connector->wrap_cls.free_wrap_ctx);
/* Invoke connector's callback */
- if((connector->get_wrap_ctx)(obj, wrap_ctx) < 0)
+ if((connector->wrap_cls.get_wrap_ctx)(obj, wrap_ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "connector wrap context callback failed")
} /* end if */
else
@@ -779,7 +777,7 @@ H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx)
/* Only free wrap context, if it's non-NULL */
if(wrap_ctx) {
/* Free the connector's object wrapping context */
- if((connector->free_wrap_ctx)(wrap_ctx) < 0)
+ if((connector->wrap_cls.free_wrap_ctx)(wrap_ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector wrap context free request failed")
} /* end if */
@@ -831,7 +829,8 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj)
+H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj,
+ H5I_type_t obj_type)
{
void *ret_value = SUCCEED; /* Return value */
@@ -844,7 +843,7 @@ H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj)
/* Only wrap object if there's a wrap context */
if(wrap_ctx) {
/* Ask the connector to wrap the object */
- if(NULL == (ret_value = (connector->wrap_object)(obj, wrap_ctx)))
+ if(NULL == (ret_value = (connector->wrap_cls.wrap_object)(obj, obj_type, wrap_ctx)))
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object")
} /* end if */
else
@@ -866,13 +865,13 @@ done:
*---------------------------------------------------------------------------
*/
void *
-H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx)
+H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_ctx)
{
H5VL_class_t *cls; /* VOL connector's class struct */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE3("*x", "*xi*x", obj, connector_id, wrap_ctx);
+ H5TRACE4("*x", "*xIti*x", obj, obj_type, connector_id, wrap_ctx);
/* Check args and get class pointer */
if(NULL == obj)
@@ -881,7 +880,7 @@ H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Wrap the object */
- if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj)))
+ if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj, obj_type)))
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object")
done:
@@ -1360,7 +1359,7 @@ H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if(H5VL__attr_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed")
@@ -1368,7 +1367,7 @@ H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type,
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -1473,7 +1472,7 @@ H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if((ret_value = H5VL__attr_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback")
@@ -1481,7 +1480,7 @@ H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -1584,7 +1583,7 @@ H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...)
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
@@ -1592,7 +1591,7 @@ H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...)
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -2207,7 +2206,7 @@ H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if(H5VL__dataset_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed")
@@ -2215,7 +2214,7 @@ H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type,
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -2319,7 +2318,7 @@ H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t spec
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if(H5VL__dataset_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback")
@@ -2327,7 +2326,7 @@ H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t spec
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -2432,7 +2431,7 @@ H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if(H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
@@ -2440,7 +2439,7 @@ H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id,
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -2596,42 +2595,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL__file_cache_connector
- *
- * Purpose: Wrap varargs and reissue 'cache VOL connector' operation
- * to file specific call
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__file_cache_connector(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
- void **req, ...)
-{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Re-issue call to internal file specific callback routine */
- va_start(arguments, req);
- arg_started = TRUE;
- if(H5VL__file_specific(obj, cls, H5VL_FILE_CACHE_VOL_CONN, dxpl_id, req, arguments) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
-
-done:
- /* End access to the va_list, if we started it */
- if(arg_started)
- va_end(arguments);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__file_cache_connector() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5VL__file_create
*
* Purpose: Creates a file through the VOL
@@ -2695,10 +2658,6 @@ H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name,
if(NULL == (ret_value = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed")
- /* Cache the connector ID & info */
- if(H5VL__file_cache_connector(ret_value, cls, dxpl_id, req, connector_prop->connector_id, connector_prop->connector_info) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "caching VOL connector ID & info failed")
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_file_create() */
@@ -2806,10 +2765,6 @@ H5VL_file_open(const H5VL_connector_prop_t *connector_prop, const char *name,
if(NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed")
- /* Cache the connector ID & info */
- if(H5VL__file_cache_connector(ret_value, cls, dxpl_id, req, connector_prop->connector_id, connector_prop->connector_info) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "caching VOL connector ID & info failed")
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_file_open() */
@@ -2914,7 +2869,7 @@ H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if(H5VL__file_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed")
@@ -2922,7 +2877,7 @@ H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type,
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -3022,7 +2977,7 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t
FUNC_ENTER_NOAPI(FAIL)
/* Start access to the varargs, so they are available in all situations below */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
/* Special treatment of file access check */
@@ -3033,9 +2988,9 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t
hid_t fapl_id; /* File access property list for accessing the file */
/* Get the file access property list to access the file */
- va_copy(tmp_args, arguments);
- fapl_id = va_arg(tmp_args, hid_t);
- va_end(tmp_args);
+ HDva_copy(tmp_args, arguments);
+ fapl_id = HDva_arg(tmp_args, hid_t);
+ HDva_end(tmp_args);
/* Get the VOL info from the FAPL */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
@@ -3067,7 +3022,7 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -3170,7 +3125,7 @@ H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...)
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if(H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed")
@@ -3178,7 +3133,7 @@ H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...)
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -3593,7 +3548,7 @@ H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if(H5VL__group_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed")
@@ -3601,7 +3556,7 @@ H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type,
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -3705,7 +3660,7 @@ H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if(H5VL__group_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback")
@@ -3713,7 +3668,7 @@ H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -3816,7 +3771,7 @@ H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
@@ -3824,7 +3779,7 @@ H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -4372,7 +4327,7 @@ H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if(H5VL__link_get(vol_obj->data, loc_params, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed")
@@ -4380,7 +4335,7 @@ H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -4484,7 +4439,7 @@ H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if((ret_value = H5VL__link_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback")
@@ -4492,7 +4447,7 @@ H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -4595,7 +4550,7 @@ H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...)
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if(H5VL__link_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
@@ -4603,7 +4558,7 @@ H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...)
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -4924,7 +4879,7 @@ H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_param
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if(H5VL__object_get(vol_obj->data, loc_params, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
@@ -4932,7 +4887,7 @@ H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_param
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -5037,7 +4992,7 @@ H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if((ret_value = H5VL__object_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed")
@@ -5045,7 +5000,7 @@ H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -5152,7 +5107,7 @@ H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ..
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if(H5VL__object_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
@@ -5160,7 +5115,7 @@ H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ..
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -5473,7 +5428,7 @@ H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if(H5VL__datatype_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed")
@@ -5481,7 +5436,7 @@ H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type,
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -5589,7 +5544,7 @@ H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t sp
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if(H5VL__datatype_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback")
@@ -5597,7 +5552,7 @@ H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t sp
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -5701,7 +5656,7 @@ H5VL_datatype_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, req);
+ HDva_start(arguments, req);
arg_started = TRUE;
if(H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
@@ -5709,7 +5664,7 @@ H5VL_datatype_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id,
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -6265,7 +6220,7 @@ H5VL_request_specific(const H5VL_object_t *vol_obj,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, specific_type);
+ HDva_start(arguments, specific_type);
arg_started = TRUE;
if((ret_value = H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, specific_type, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback")
@@ -6273,7 +6228,7 @@ H5VL_request_specific(const H5VL_object_t *vol_obj,
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
@@ -6379,7 +6334,7 @@ H5VL_request_optional(const H5VL_object_t *vol_obj, ...)
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- va_start(arguments, vol_obj);
+ HDva_start(arguments, vol_obj);
arg_started = TRUE;
if((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback")
@@ -6387,7 +6342,7 @@ H5VL_request_optional(const H5VL_object_t *vol_obj, ...)
done:
/* End access to the va_list, if we started it */
if(arg_started)
- va_end(arguments);
+ HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
diff --git a/src/H5VLint.c b/src/H5VLint.c
index 82886cd..5aa25d2 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -65,7 +65,7 @@ typedef struct H5VL_wrap_ctx_t {
/* Local Prototypes */
/********************/
static herr_t H5VL__free_cls(H5VL_class_t *cls);
-static void *H5VL__wrap_obj(void *obj);
+static void *H5VL__wrap_obj(void *obj, H5I_type_t obj_type);
static H5VL_object_t *H5VL__new_vol_obj(H5I_type_t type, void *object,
H5VL_t *vol_connector, hbool_t wrap_obj);
static void *H5VL__object(hid_t id, H5I_type_t obj_type);
@@ -248,7 +248,7 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5VL__wrap_obj(void *obj)
+H5VL__wrap_obj(void *obj, H5I_type_t obj_type)
{
H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */
void *ret_value = NULL; /* Return value */
@@ -265,7 +265,7 @@ H5VL__wrap_obj(void *obj)
/* If there is a VOL object wrapping context, wrap the object */
if(vol_wrap_ctx) {
/* Wrap object, using the VOL callback */
- if(NULL == (ret_value = H5VL_wrap_object(vol_wrap_ctx->connector->cls, vol_wrap_ctx->obj_wrap_ctx, obj)))
+ if(NULL == (ret_value = H5VL_wrap_object(vol_wrap_ctx->connector->cls, vol_wrap_ctx->obj_wrap_ctx, obj, obj_type)))
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object")
} /* end if */
else
@@ -310,7 +310,7 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t
HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate memory for VOL object")
new_vol_obj->connector = vol_connector;
if(wrap_obj) {
- if(NULL == (new_vol_obj->data = H5VL__wrap_obj(object)))
+ if(NULL == (new_vol_obj->data = H5VL__wrap_obj(object, type)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't wrap library object")
} /* end if */
else
@@ -625,9 +625,12 @@ H5VL_register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
done:
- if (ret_value < 0)
- if (saved)
- H5FL_FREE(H5VL_class_t, saved);
+ if (ret_value < 0 && saved) {
+ if (saved->name)
+ H5MM_xfree((void *)(saved->name)); /* Casting away const OK -QAK */
+
+ H5FL_FREE(H5VL_class_t, saved);
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_register_connector() */
@@ -737,8 +740,8 @@ H5VL_object_data(const H5VL_object_t *vol_obj)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check for 'get_object' callback in connector */
- if(vol_obj->connector->cls->get_object)
- ret_value = (vol_obj->connector->cls->get_object)(vol_obj->data);
+ if(vol_obj->connector->cls->wrap_cls.get_object)
+ ret_value = (vol_obj->connector->cls->wrap_cls.get_object)(vol_obj->data);
else
ret_value = vol_obj->data;
@@ -793,7 +796,6 @@ H5VL__object(hid_t id, H5I_type_t obj_type)
case H5I_UNINIT:
case H5I_BADID:
case H5I_DATASPACE:
- case H5I_REFERENCE:
case H5I_VFL:
case H5I_VOL:
case H5I_GENPROP_CLS:
@@ -877,9 +879,11 @@ done:
*
* Purpose: Compare VOL class for a connector
*
- * Return: Positive if VALUE1 is greater than VALUE2, negative if
- * VALUE2 is greater than VALUE1 and zero if VALUE1 and
- * VALUE2 are equal.
+ * Note: Sets *cmp_value positive if VALUE1 is greater than VALUE2,
+ * negative if VALUE2 is greater than VALUE1, and zero if VALUE1
+ * and VALUE2 are equal (like strcmp).
+ *
+ * Return: SUCCEED / FAIL
*
*-------------------------------------------------------------------------
*/
@@ -929,15 +933,15 @@ H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_clas
HDassert(cls1->version == cls2->version);
/* Compare connector info */
- if(cls1->info_size < cls2->info_size) {
+ if(cls1->info_cls.size < cls2->info_cls.size) {
*cmp_value = -1;
HGOTO_DONE(SUCCEED)
} /* end if */
- if(cls1->info_size > cls2->info_size) {
+ if(cls1->info_cls.size > cls2->info_cls.size) {
*cmp_value = 1;
HGOTO_DONE(SUCCEED)
} /* end if */
- HDassert(cls1->info_size == cls2->info_size);
+ HDassert(cls1->info_cls.size == cls2->info_cls.size);
/* Set comparison value to 'equal' */
*cmp_value = 0;
@@ -976,12 +980,12 @@ H5VL_set_vol_wrapper(void *obj, const H5VL_t *connector)
/* Check for existing wrapping context */
if(NULL == vol_wrap_ctx) {
/* Check if the connector can create a wrap context */
- if(connector->cls->get_wrap_ctx) {
+ if(connector->cls->wrap_cls.get_wrap_ctx) {
/* Sanity check */
- HDassert(connector->cls->free_wrap_ctx);
+ HDassert(connector->cls->wrap_cls.free_wrap_ctx);
/* Get the wrap context from the connector */
- if((connector->cls->get_wrap_ctx)(obj, &obj_wrap_ctx) < 0)
+ if((connector->cls->wrap_cls.get_wrap_ctx)(obj, &obj_wrap_ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL connector's object wrap context")
} /* end if */
@@ -1044,7 +1048,7 @@ H5VL_reset_vol_wrapper(void)
/* If there is a VOL connector object wrapping context, release it */
if(vol_wrap_ctx->obj_wrap_ctx) {
/* Release the VOL connector's object wrapping context */
- if((*vol_wrap_ctx->connector->cls->free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0)
+ if((*vol_wrap_ctx->connector->cls->wrap_cls.free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release connector's object wrapping context")
} /* end if */
@@ -1095,7 +1099,7 @@ H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref)
HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype")
/* Wrap the object with VOL connector info */
- if(NULL == (new_obj = H5VL__wrap_obj(obj)))
+ if(NULL == (new_obj = H5VL__wrap_obj(obj, type)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't wrap library object")
/* Retrieve the VOL object wrapping context */
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index 3fc1a7c..f4f3b5f 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -11,113 +11,25 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Purpose: The native VOL connector where access is to a single HDF5 file
+ * Purpose: The native VOL connector where access is to a single HDF5 file
* using HDF5 VFDs.
*/
-#define H5A_FRIEND /* Suppress error about including H5Apkg */
-#define H5D_FRIEND /* Suppress error about including H5Dpkg */
-#define H5F_FRIEND /* Suppress error about including H5Fpkg */
-#define H5G_FRIEND /* Suppress error about including H5Gpkg */
-#define H5L_FRIEND /* Suppress error about including H5Lpkg */
-#define H5O_FRIEND /* Suppress error about including H5Opkg */
-#define H5R_FRIEND /* Suppress error about including H5Rpkg */
-#define H5T_FRIEND /* Suppress error about including H5Tpkg */
-
-
#include "H5private.h" /* Generic Functions */
-#include "H5Apkg.h" /* Attributes */
-#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
-#include "H5Gpkg.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
-#include "H5Lpkg.h" /* Links */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
#include "H5Pprivate.h" /* Property lists */
-#include "H5Rpkg.h" /* References */
-#include "H5SMprivate.h" /* Shared Object Header Messages */
-#include "H5Tpkg.h" /* Datatypes */
#include "H5VLprivate.h" /* Virtual Object Layer */
-#include "H5VLnative.h" /* Native VOL connector */
-/*
- * The VOL connector identification number.
- */
-static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID;
+#include "H5VLnative_private.h" /* Native VOL connector */
+/* The VOL connector identification number */
+static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID;
+
/* Prototypes */
static herr_t H5VL__native_term(void);
-/* Atrribute callbacks */
-static void *H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
-static void *H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
-static herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
-static herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_attr_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req);
-
-/* Dataset callbacks */
-static void *H5VL__native_dataset_create(void *obj, const 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__native_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL__native_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__native_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__native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_dataset_optional(void *dset, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_dataset_close(void *dset, hid_t dxpl_id, void **req);
-
-/* File callbacks */
-static void *H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
-static void *H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL__native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req);
-
-/* Group callbacks */
-static void *H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
-static void *H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_group_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req);
-
-/* Link callbacks */
-static herr_t H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj,
- const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
- void *dst_obj, const H5VL_loc_params_t *loc_params2,
- hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
- void *dst_obj, const H5VL_loc_params_t *loc_params2,
- hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-
-/* Object callbacks */
-static void *H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req);
-static herr_t H5VL__native_object_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name,
- void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name,
- hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
-
-/* Datatype callbacks */
-static void *H5VL__native_datatype_commit(void *obj, const 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__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req);
-
/* Native VOL connector class struct */
static H5VL_class_t H5VL_native_cls_g = {
H5VL_NATIVE_VERSION, /* version */
@@ -126,16 +38,20 @@ static H5VL_class_t H5VL_native_cls_g = {
0, /* capability flags */
NULL, /* initialize */
H5VL__native_term, /* terminate */
- (size_t)0, /* info size */
- NULL, /* info copy */
- NULL, /* info compare */
- NULL, /* info free */
- NULL, /* info to str */
- NULL, /* str to info */
- NULL, /* get_object */
- NULL, /* get_wrap_ctx */
- NULL, /* wrap_object */
- NULL, /* free_wrap_ctx */
+ { /* info_cls */
+ (size_t)0, /* info size */
+ NULL, /* info copy */
+ NULL, /* info compare */
+ NULL, /* info free */
+ NULL, /* info to str */
+ NULL /* str to info */
+ },
+ { /* wrap_cls */
+ NULL, /* get_object */
+ NULL, /* get_wrap_ctx */
+ NULL, /* wrap_object */
+ NULL /* free_wrap_ctx */
+ },
{ /* attribute_cls */
H5VL__native_attr_create, /* create */
H5VL__native_attr_open, /* open */
@@ -210,7 +126,7 @@ static H5VL_class_t H5VL_native_cls_g = {
/*-------------------------------------------------------------------------
* Function: H5VL_native_register
*
- * Purpose: Register the native VOL connector and retrieve an ID for it.
+ * Purpose: Register the native VOL connector and retrieve an ID for it.
*
* Return: Success: The ID for the native connector
* Failure: H5I_INVALID_HID
@@ -257,3380 +173,3 @@ H5VL__native_term(void)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5VL__native_term() */
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_attr_create
- *
- * Purpose: Creates an attribute on an object.
- *
- * Return: Success: Pointer to attribute object
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
- hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req)
-{
- H5G_loc_t loc; /* Object location */
- H5G_loc_t obj_loc; /* Location used to open group */
- hbool_t loc_found = FALSE;
- H5P_genplist_t *plist; /* Property list pointer */
- hid_t type_id, space_id;
- H5T_t *type, *dt; /* Datatype to use for attribute */
- H5S_t *space; /* Dataspace to use for attribute */
- H5A_t *attr = NULL;
- void *ret_value = NULL;
-
- FUNC_ENTER_STATIC
-
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
-
- /* get creation properties */
- if(H5P_get(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for datatype id")
- if(H5P_get(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id")
-
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
- if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, NULL, "no write intent on file")
-
- if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
- /* If this is a named datatype, get the connector's pointer to the datatype */
- type = H5T_get_actual_type(dt);
-
- if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data space")
-
- if(loc_params->type == H5VL_OBJECT_BY_SELF) {
- /* H5Acreate */
- /* Go do the real work for attaching the attribute to the dataset */
- if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute")
- } /* end if */
- else if(loc_params->type == H5VL_OBJECT_BY_NAME) {
- /* H5Acreate_by_name */
- if(NULL == (attr = H5A__create_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name, type, space, acpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute")
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute create parameters")
-
- ret_value = (void *)attr;
-
-done:
- /* Release resources */
- if(loc_found && H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_attr_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_attr_open
- *
- * Purpose: Opens an attr inside a native H5 file.
- *
- * Return: Success: Pointer to attribute object
- * Failure: NULL
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
- hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
-{
- H5G_loc_t loc; /* Object location */
- H5A_t *attr = NULL; /* Attribute opened */
- void *ret_value;
-
- FUNC_ENTER_STATIC
-
- /* check arguments */
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
-
- if(loc_params->type == H5VL_OBJECT_BY_SELF) {
- /* H5Aopen */
- /* Open the attribute */
- if(NULL == (attr = H5A__open(&loc, attr_name)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute: '%s'", attr_name)
- } /* end if */
- else if(loc_params->type == H5VL_OBJECT_BY_NAME) {
- /* H5Aopen_by_name */
- /* Open the attribute on the object header */
- if(NULL == (attr = H5A__open_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute")
- } /* end else-if */
- else if(loc_params->type == H5VL_OBJECT_BY_IDX) {
- /* H5Aopen_by_idx */
- /* Open the attribute in the object header */
- if(NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute")
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute open parameters")
-
- ret_value = (void *)attr;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_attr_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_attr_read
- *
- * Purpose: Reads data from attribute.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
-{
- H5T_t *mem_type; /* Memory datatype */
- herr_t ret_value; /* Return value */
-
- FUNC_ENTER_STATIC
-
- if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
-
- /* Go write the actual data to the attribute */
- if((ret_value = H5A__read((H5A_t*)attr, mem_type, buf)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_attr_read() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_attr_write
- *
- * Purpose: Writes data to attribute.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
-{
- H5T_t *mem_type; /* Memory datatype */
- herr_t ret_value; /* Return value */
-
- FUNC_ENTER_STATIC
-
- if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
-
- /* Go write the actual data to the attribute */
- if((ret_value = H5A__write((H5A_t*)attr, mem_type, buf)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_attr_write() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_attr_get
- *
- * Purpose: Gets information about an attribute
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- switch(get_type) {
- /* H5Aget_space */
- case H5VL_ATTR_GET_SPACE:
- {
- hid_t *ret_id = va_arg(arguments, hid_t *);
- H5A_t *attr = (H5A_t *)obj;
-
- if((*ret_id = H5A_get_space(attr)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute")
- break;
- }
-
- /* H5Aget_type */
- case H5VL_ATTR_GET_TYPE:
- {
- hid_t *ret_id = va_arg(arguments, hid_t *);
- H5A_t *attr = (H5A_t *)obj;
-
- if((*ret_id = H5A__get_type(attr)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute")
- break;
- }
-
- /* H5Aget_create_plist */
- case H5VL_ATTR_GET_ACPL:
- {
- hid_t *ret_id = va_arg(arguments, hid_t *);
- H5A_t *attr = (H5A_t *)obj;
-
- if((*ret_id = H5A__get_create_plist(attr)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for attr")
-
- break;
- }
-
- /* H5Aget_name */
- case H5VL_ATTR_GET_NAME:
- {
- const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *);
- size_t buf_size = va_arg(arguments, size_t);
- char *buf = va_arg(arguments, char *);
- ssize_t *ret_val = va_arg(arguments, ssize_t *);
- H5A_t *attr = NULL;
-
- if(H5VL_OBJECT_BY_SELF == loc_params->type) {
- attr = (H5A_t *)obj;
- /* Call private function in turn */
- if(0 > (*ret_val = H5A__get_name(attr, buf_size, buf)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name")
- }
- else if(H5VL_OBJECT_BY_IDX == loc_params->type) {
- H5G_loc_t loc;
-
- /* check arguments */
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Open the attribute on the object header */
- if(NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
-
- /* Get the length of the name */
- *ret_val = (ssize_t)HDstrlen(attr->shared->name);
-
- /* Copy the name into the user's buffer, if given */
- if(buf) {
- HDstrncpy(buf, attr->shared->name, MIN((size_t)(*ret_val + 1), buf_size));
- if((size_t)(*ret_val) >= buf_size)
- buf[buf_size - 1]='\0';
- } /* end if */
-
- /* Release resources */
- if(attr && H5A__close(attr) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
- }
- else
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr")
-
- break;
- }
-
- /* H5Aget_info */
- case H5VL_ATTR_GET_INFO:
- {
- const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *);
- H5A_info_t *ainfo = va_arg(arguments, H5A_info_t *);
- H5A_t *attr = NULL;
-
- if(H5VL_OBJECT_BY_SELF == loc_params->type) {
- attr = (H5A_t *)obj;
- if(H5A__get_info(attr, ainfo) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get attribute info")
- }
- else if(H5VL_OBJECT_BY_NAME == loc_params->type) {
- char *attr_name = va_arg(arguments, char *);
- H5G_loc_t loc;
-
- /* check arguments */
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Open the attribute on the object header */
- if(NULL == (attr = H5A__open_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
-
- /* Get the attribute information */
- if(H5A__get_info(attr, ainfo) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
-
- /* Release resources */
- if(attr && H5A__close(attr) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
- }
- else if(H5VL_OBJECT_BY_IDX == loc_params->type) {
- H5G_loc_t loc;
-
- /* check arguments */
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Open the attribute on the object header */
- if(NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
-
- /* Get the attribute information */
- if(H5A__get_info(attr, ainfo) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
-
- /* Release resources */
- if(attr && H5A__close(attr) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
- }
- else
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr")
-
- break;
- }
-
- case H5VL_ATTR_GET_STORAGE_SIZE:
- {
- hsize_t *ret = va_arg(arguments, hsize_t *);
- H5A_t *attr = (H5A_t *)obj;
-
- /* Set return value */
- *ret = attr->shared->data_size;
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from attr")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_attr_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_attr_specific
- *
- * Purpose: Specific operation on attribute
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Mohamad Chaarawi
- * August, 2014
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
-{
- H5G_loc_t loc;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Get location for passed-in object */
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- switch(specific_type) {
- case H5VL_ATTR_DELETE:
- {
- char *attr_name = va_arg(arguments, char *);
-
- if(H5VL_OBJECT_BY_SELF == loc_params->type) {
- /* H5Adelete */
- /* Delete the attribute from the location */
- if(H5O__attr_remove(loc.oloc, attr_name) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
- } /* end if */
- else if(H5VL_OBJECT_BY_NAME == loc_params->type) {
- /* H5Adelete_by_name */
- /* Delete the attribute */
- if(H5A__delete_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
- } /* end else-if */
- else if(H5VL_OBJECT_BY_IDX == loc_params->type) {
- /* H5Adelete_by_idx */
- /* Delete the attribute from the location */
- if(H5A__delete_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute remove parameters")
- break;
- }
-
- case H5VL_ATTR_EXISTS:
- {
- const char *attr_name = va_arg(arguments, const char *);
- htri_t *ret = va_arg(arguments, htri_t *);
-
- if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Aexists */
- /* Check if the attribute exists */
- if((*ret = H5O__attr_exists(loc.oloc, attr_name)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
- } /* end if */
- else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Aexists_by_name */
- /* Check if the attribute exists */
- if((*ret = H5A__exists_by_name(loc, loc_params->loc_data.loc_by_name.name, attr_name)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters")
- break;
- }
-
- case H5VL_ATTR_ITER:
- {
- H5_index_t idx_type = va_arg(arguments, H5_index_t);
- H5_iter_order_t order = va_arg(arguments, H5_iter_order_t);
- hsize_t *idx = va_arg(arguments, hsize_t *);
- H5A_operator2_t op = va_arg(arguments, H5A_operator2_t);
- void *op_data = va_arg(arguments, void *);
-
- if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Aiterate2 */
- /* Iterate over attributes */
- if((ret_value = H5A__iterate(&loc, ".", idx_type, order, idx, op, op_data)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes")
- } /* end if */
- else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Aiterate_by_name */
- /* Iterate over attributes by name */
- if((ret_value = H5A__iterate(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, idx, op, op_data)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "attribute iteration failed");
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters")
- break;
- }
-
- /* H5Arename/rename_by_name */
- case H5VL_ATTR_RENAME:
- {
- const char *old_name = va_arg(arguments, const char *);
- const char *new_name = va_arg(arguments, const char *);
-
- if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Arename */
- /* Call attribute rename routine */
- if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
- } /* end if */
- else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Arename_by_name */
- /* Call attribute rename routine */
- if(H5A__rename_by_name(loc, loc_params->loc_data.loc_by_name.name, old_name, new_name) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute rename parameters")
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_attr_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_attr_optional
- *
- * Purpose: Perform a connector-specific operation on a native attribute
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_attr_optional(void H5_ATTR_UNUSED *obj, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
-{
- H5VL_attr_optional_t optional_type;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- optional_type = va_arg(arguments, H5VL_attr_optional_t);
- switch(optional_type) {
-#ifndef H5_NO_DEPRECATED_SYMBOLS
- case H5VL_ATTR_ITERATE_OLD:
- {
- hid_t loc_id = va_arg(arguments, hid_t);
- unsigned *attr_num = va_arg(arguments, unsigned *);
- H5A_operator1_t op = va_arg(arguments, H5A_operator1_t);
- void *op_data = va_arg(arguments, void *);
-
- /* Call the actual iteration routine */
- if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0)
- HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes");
-
- break;
- }
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_attr_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_attr_close
- *
- * Purpose: Closes an attribute.
- *
- * Return: Success: 0
- * Failure: -1, attr not closed.
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_attr_close(void *attr, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- if(H5A__close((H5A_t*)attr) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close attribute")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_attr_close() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_dataset_create
- *
- * Purpose: Creates a dataset in a native HDF5 file
- *
- * Return: Success: Pointer to a dataset struct
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
- const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- H5G_loc_t loc; /* Object location to insert dataset into */
- hid_t type_id = H5I_INVALID_HID;
- hid_t space_id = H5I_INVALID_HID;
- hid_t lcpl_id = H5I_INVALID_HID;
- H5D_t *dset = NULL; /* New dataset's info */
- const H5S_t *space; /* Dataspace for dataset */
- void *ret_value;
-
- FUNC_ENTER_STATIC
-
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
-
- /* Get creation properties */
- if(H5P_get(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for datatype id")
- if(H5P_get(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id")
- if(H5P_get(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id")
-
- /* Check arguments */
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
- if(H5I_DATATYPE != H5I_get_type(type_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype ID")
- if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a dataspace ID")
-
- /* H5Dcreate_anon */
- if(NULL == name) {
- /* build and open the new dataset */
- if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset")
- } /* end if */
- /* H5Dcreate2 */
- else {
- /* Create the new dataset & get its ID */
- if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset")
- } /* end else */
-
- ret_value = (void *)dset;
-
-done:
- if(NULL == name) {
- /* Release the dataset's object header, if it was created */
- if(dset) {
- H5O_loc_t *oloc; /* Object location for dataset */
-
- /* Get the new dataset's object location */
- if(NULL == (oloc = H5D_oloc(dset)))
- HDONE_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get object location of dataset")
-
- /* Decrement refcount on dataset's object header in memory */
- if(H5O_dec_rc_by_loc(oloc) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object")
- } /* end if */
- } /* end if */
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_dataset_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_dataset_open
- *
- * Purpose: Opens a dataset in a native HDF5 file.
- *
- * Return: Success: Pointer to a dataset struct
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5VL__native_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
- hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
-{
- H5D_t *dset = NULL;
- H5G_loc_t loc; /* Object location of group */
- void *ret_value = NULL;
-
- FUNC_ENTER_STATIC
-
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
-
- /* Open the dataset */
- if(NULL == (dset = H5D__open_name(&loc, name, dapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open dataset")
-
- ret_value = (void *)dset;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_dataset_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_dataset_read
- *
- * Purpose: Reads raw data from a dataset into a buffer.
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, void *buf,
- void H5_ATTR_UNUSED **req)
-{
- H5D_t *dset = (H5D_t *)obj;
- const H5S_t *mem_space = NULL;
- const H5S_t *file_space = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Check arguments */
- if(NULL == dset->oloc.file)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
-
- /* Get validated dataspace pointers */
- if(H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id")
- if(H5S_get_validated_dataspace(file_space_id, &file_space) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id")
-
- /* Read raw data */
- if(H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_dataset_read() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_dataset_write
- *
- * Purpose: Writes raw data from a buffer into a dataset.
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, const void *buf,
- void H5_ATTR_UNUSED **req)
-{
- H5D_t *dset = (H5D_t *)obj;
- const H5S_t *mem_space = NULL;
- const H5S_t *file_space = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* check arguments */
- if(NULL == dset->oloc.file)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
-
- /* Get validated dataspace pointers */
- if(H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id")
- if(H5S_get_validated_dataspace(file_space_id, &file_space) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id")
-
- /* Write the data */
- if(H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_dataset_write() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_dataset_get
- *
- * Purpose: Gets certain information about a dataset
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_dataset_get(void *obj, H5VL_dataset_get_t get_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
-{
- H5D_t *dset = (H5D_t *)obj;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- switch(get_type) {
- /* H5Dget_space */
- case H5VL_DATASET_GET_SPACE:
- {
- hid_t *ret_id = va_arg(arguments, hid_t *);
-
- if((*ret_id = H5D__get_space(dset)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of dataset")
-
- break;
- }
-
- /* H5Dget_space_statuc */
- case H5VL_DATASET_GET_SPACE_STATUS:
- {
- H5D_space_status_t *allocation = va_arg(arguments, H5D_space_status_t *);
-
- /* Read data space address and return */
- if(H5D__get_space_status(dset, allocation) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status")
-
- break;
- }
-
- /* H5Dget_type */
- case H5VL_DATASET_GET_TYPE:
- {
- hid_t *ret_id = va_arg(arguments, hid_t *);
-
- if((*ret_id = H5D__get_type(dset)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of dataset")
-
- break;
- }
-
- /* H5Dget_create_plist */
- case H5VL_DATASET_GET_DCPL:
- {
- hid_t *ret_id = va_arg(arguments, hid_t *);
-
- if((*ret_id = H5D_get_create_plist(dset)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for dataset")
-
- break;
- }
-
- /* H5Dget_access_plist */
- case H5VL_DATASET_GET_DAPL:
- {
- hid_t *ret_id = va_arg(arguments, hid_t *);
-
- if((*ret_id = H5D_get_access_plist(dset)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get access property list for dataset")
-
- break;
- }
-
- /* H5Dget_storage_size */
- case H5VL_DATASET_GET_STORAGE_SIZE:
- {
- hsize_t *ret = va_arg(arguments, hsize_t *);
-
- /* Set return value */
- if(H5D__get_storage_size(dset, ret) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage")
- break;
- }
-
- /* H5Dget_offset */
- case H5VL_DATASET_GET_OFFSET:
- {
- haddr_t *ret = va_arg(arguments, haddr_t *);
-
- /* Set return value */
- *ret = H5D__get_offset(dset);
- if(!H5F_addr_defined(*ret))
- *ret = HADDR_UNDEF;
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_dataset_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_dataset_specific
- *
- * Purpose: Specific operation on dataset
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
-{
- H5D_t *dset = (H5D_t *)obj;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- switch(specific_type) {
- /* H5Dspecific_space */
- case H5VL_DATASET_SET_EXTENT:
- {
- const hsize_t *size = va_arg(arguments, const hsize_t *);
-
- if(H5D__set_extent(dset, size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extent of dataset")
- break;
- }
-
- case H5VL_DATASET_FLUSH:
- {
- hid_t dset_id = va_arg(arguments, hid_t);
-
- /* Flush the dataset */
- if(H5D__flush(dset, dset_id) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset")
-
- break;
- }
-
- case H5VL_DATASET_REFRESH:
- {
- hid_t dset_id = va_arg(arguments, hid_t);
-
- /* Refresh the dataset */
- if((H5D__refresh(dset_id, dset)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset")
-
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_dataset_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_dataset_optional
- *
- * Purpose: Perform a connector-specific operation on a native dataset
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
-{
- H5D_t *dset = NULL; /* Dataset */
- H5VL_dataset_optional_t optional_type = va_arg(arguments, H5VL_dataset_optional_t);
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- switch(optional_type) {
- case H5VL_DATASET_FORMAT_CONVERT:
- {
- dset = (H5D_t *)obj;
-
- switch(dset->shared->layout.type) {
- case H5D_CHUNKED:
- /* Convert the chunk indexing type to version 1 B-tree if not */
- if(dset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE)
- if((H5D__format_convert(dset)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade chunk indexing type for dataset")
- break;
-
- case H5D_CONTIGUOUS:
- case H5D_COMPACT:
- /* Downgrade the layout version to 3 if greater than 3 */
- if(dset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT)
- if((H5D__format_convert(dset)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade layout version for dataset")
- break;
-
- case H5D_VIRTUAL:
- /* Nothing to do even though layout is version 4 */
- break;
-
- case H5D_LAYOUT_ERROR:
- case H5D_NLAYOUTS:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type")
-
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type")
- } /* end switch */
-
- break;
- }
-
- case H5VL_DATASET_GET_CHUNK_INDEX_TYPE:
- {
- H5D_chunk_index_t *idx_type = va_arg(arguments, H5D_chunk_index_t *);
-
- dset = (H5D_t *)obj;
-
- /* Make sure the dataset is chunked */
- if(H5D_CHUNKED != dset->shared->layout.type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
-
- /* Get the chunk indexing type */
- *idx_type = dset->shared->layout.u.chunk.idx_type;
-
- break;
- }
-
- case H5VL_DATASET_GET_CHUNK_STORAGE_SIZE:
- {
- hsize_t *offset = va_arg(arguments, hsize_t *);
- hsize_t *chunk_nbytes = va_arg(arguments, hsize_t *);
-
- dset = (H5D_t *)obj;
-
- /* Make sure the dataset is chunked */
- if(H5D_CHUNKED != dset->shared->layout.type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
-
- /* Call private function */
- if(H5D__get_chunk_storage_size(dset, offset, chunk_nbytes) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk")
-
- break;
- }
-
- case H5VL_DATASET_CHUNK_READ:
- {
- const hsize_t *offset = va_arg(arguments, hsize_t *);
- uint32_t *filters = va_arg(arguments, uint32_t *);
- void *buf = va_arg(arguments, void *);
- hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
-
- dset = (H5D_t *)obj;
-
- /* Check arguments */
- if(NULL == dset->oloc.file)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
- if(H5D_CHUNKED != dset->shared->layout.type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
-
- /* Copy the user's offset array so we can be sure it's terminated properly.
- * (we don't want to mess with the user's buffer).
- */
- if(H5D__get_offset_copy(dset, offset, offset_copy) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array")
-
- /* Read the raw chunk */
- if(H5D__chunk_direct_read(dset, offset_copy, filters, buf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data")
-
- break;
- }
-
- case H5VL_DATASET_CHUNK_WRITE:
- {
- uint32_t filters = va_arg(arguments, uint32_t);
- const hsize_t *offset = va_arg(arguments, const hsize_t *);
- uint32_t data_size_32 = va_arg(arguments, uint32_t);
- const void *buf = va_arg(arguments, const void *);
- hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
-
- dset = (H5D_t *)obj;
-
- /* Check arguments */
- if(NULL == dset->oloc.file)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
- if(H5D_CHUNKED != dset->shared->layout.type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
-
- /* Copy the user's offset array so we can be sure it's terminated properly.
- * (we don't want to mess with the user's buffer).
- */
- if(H5D__get_offset_copy(dset, offset, offset_copy) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array")
-
- /* Write chunk */
- if(H5D__chunk_direct_write(dset, filters, offset_copy, data_size_32, buf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data")
-
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_dataset_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_dataset_close
- *
- * Purpose: Closes a dataset.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL (dataset will not be closed)
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_dataset_close(void *dset, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- if(H5D_close((H5D_t*)dset) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close dataset")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_dataset_close() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_file_create
- *
- * Purpose: Creates a file as a native HDF5 file.
- *
- * Return: Success: A pointer to an H5F_t file struct
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
-{
- H5F_t *new_file = NULL;
- void *ret_value = NULL;
-
- FUNC_ENTER_STATIC
-
- /* 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
- * reading and writing.
- */
- if(0 == (flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC)))
- flags |= H5F_ACC_EXCL; /*default*/
- flags |= H5F_ACC_RDWR | H5F_ACC_CREAT;
-
- /* Create the file */
- if(NULL == (new_file = H5F_open(name, flags, fcpl_id, fapl_id)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file")
- new_file->id_exists = TRUE;
-
- ret_value = (void *)new_file;
-
-done:
- if(NULL == ret_value && new_file)
- if(H5F__close(new_file) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_file_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_file_open
- *
- * Purpose: Opens a file as a native HDF5 file.
- *
- * Return: Success: A pointer to an H5F_t file struct
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
-{
- H5F_t *new_file = NULL;
- void *ret_value = NULL;
-
- FUNC_ENTER_STATIC
-
- /* Open the file */
- if(NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
- new_file->id_exists = TRUE;
-
- ret_value = (void *)new_file;
-
-done:
- if(NULL == ret_value && new_file && H5F_try_close(new_file, NULL) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_file_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_file_get
- *
- * Purpose: Get info about a file
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_file_get(void *obj, H5VL_file_get_t get_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
-{
- H5F_t *f = NULL; /* File struct */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- switch(get_type) {
- /* H5Fget_access_plist */
- case H5VL_FILE_GET_FAPL:
- {
- H5P_genplist_t *new_plist; /* New property list */
- hid_t *plist_id = va_arg(arguments, hid_t *);
-
- f = (H5F_t *)obj;
-
- /* Retrieve the file's access property list */
- if((*plist_id = H5F_get_access_plist(f, TRUE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file access property list")
-
- if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(*plist_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
- break;
- }
-
- /* H5Fget_create_plist */
- case H5VL_FILE_GET_FCPL:
- {
- H5P_genplist_t *plist; /* Property list */
- hid_t *plist_id = va_arg(arguments, hid_t *);
-
- f = (H5F_t *)obj;
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
-
- /* Create the property list object to return */
- if((*plist_id = H5P_copy_plist(plist, TRUE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy file creation properties")
-
- break;
- }
-
- /* H5Fget_obj_count */
- case H5VL_FILE_GET_OBJ_COUNT:
- {
- unsigned types = va_arg(arguments, unsigned);
- ssize_t *ret = va_arg(arguments, ssize_t *);
- size_t obj_count = 0; /* Number of opened objects */
-
- f = (H5F_t *)obj;
- /* Perform the query */
- if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
-
- /* Set the return value */
- *ret = (ssize_t)obj_count;
- break;
- }
-
- /* H5Fget_obj_ids */
- case H5VL_FILE_GET_OBJ_IDS:
- {
- unsigned types = va_arg(arguments, unsigned);
- size_t max_objs = va_arg(arguments, size_t);
- hid_t *oid_list = va_arg(arguments, hid_t *);
- ssize_t *ret = va_arg(arguments, ssize_t *);
- size_t obj_count = 0; /* Number of opened objects */
-
- f = (H5F_t *)obj;
- /* Perform the query */
- if(H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_count) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed")
-
- /* Set the return value */
- *ret = (ssize_t)obj_count;
- break;
- }
-
- /* H5Fget_intent */
- case H5VL_FILE_GET_INTENT:
- {
- unsigned *intent_flags = va_arg(arguments, unsigned *);
-
- f = (H5F_t *)obj;
-
- /* HDF5 uses some flags internally that users don't know about.
- * Simplify things for them so that they only get either H5F_ACC_RDWR
- * or H5F_ACC_RDONLY and any SWMR flags.
- */
- if(H5F_INTENT(f) & H5F_ACC_RDWR) {
- *intent_flags = H5F_ACC_RDWR;
-
- /* Check for SWMR write access on the file */
- if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)
- *intent_flags |= H5F_ACC_SWMR_WRITE;
- } /* end if */
- else {
- *intent_flags = H5F_ACC_RDONLY;
-
- /* Check for SWMR read access on the file */
- if(H5F_INTENT(f) & H5F_ACC_SWMR_READ)
- *intent_flags |= H5F_ACC_SWMR_READ;
- } /* end else */
-
- break;
- }
-
- /* H5Fget_name */
- case H5VL_FILE_GET_NAME:
- {
- H5I_type_t type = va_arg(arguments, H5I_type_t);
- size_t size = va_arg(arguments, size_t);
- char *name = va_arg(arguments, char *);
- ssize_t *ret = va_arg(arguments, ssize_t *);
- size_t len;
-
- if(NULL == (f = H5F__get_file(obj, type)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- len = HDstrlen(H5F_OPEN_NAME(f));
-
- if(name) {
- HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1,size));
- if(len >= size)
- name[size-1]='\0';
- } /* end if */
-
- /* Set the return value for the API call */
- *ret = (ssize_t)len;
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_file_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_file_specific
- *
- * Purpose: Specific operation on file
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- switch(specific_type) {
- /* H5Fflush */
- case H5VL_FILE_FLUSH:
- {
- H5I_type_t type = va_arg(arguments, H5I_type_t);
- H5F_scope_t scope = va_arg(arguments, H5F_scope_t);
- H5F_t *f = NULL; /* File to flush */
-
- /* Get the file for the object */
- if(NULL == (f = H5F__get_file(obj, type)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Nothing to do if the file is read only. This determination is
- * made at the shared open(2) flags level, implying that opening a
- * file twice, once for read-only and once for read-write, and then
- * calling H5Fflush() with the read-only handle, still causes data
- * to be flushed.
- */
- if(H5F_ACC_RDWR & H5F_INTENT(f)) {
- /* Flush other files, depending on scope */
- if(H5F_SCOPE_GLOBAL == scope) {
- /* Call the flush routine for mounted file hierarchies */
- if(H5F_flush_mounts(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy")
- } /* end if */
- else {
- /* Call the flush routine, for this file */
- if(H5F__flush(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
- } /* end else */
- } /* end if */
- break;
- }
-
- /* H5Freopen */
- case H5VL_FILE_REOPEN:
- {
- void **ret = va_arg(arguments, void **);
- H5F_t *new_file = NULL;
-
- /* Reopen the file through the VOL connector */
- if(NULL == (new_file = H5F__reopen((H5F_t *)obj)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file")
- new_file->id_exists = TRUE;
-
- *ret = (void *)new_file;
- break;
- }
-
- /* H5Fmount */
- case H5VL_FILE_MOUNT:
- {
- H5I_type_t type = va_arg(arguments, H5I_type_t);
- const char *name = va_arg(arguments, const char *);
- H5F_t *child = va_arg(arguments, H5F_t *);
- hid_t plist_id = va_arg(arguments, hid_t);
- H5G_loc_t loc;
-
- if(H5G_loc_real(obj, type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Do the mount */
- if(H5F__mount(&loc, name, child, plist_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
-
- break;
- }
-
- /* H5Funmount */
- case H5VL_FILE_UNMOUNT:
- {
- H5I_type_t type = va_arg(arguments, H5I_type_t);
- const char *name = va_arg(arguments, const char *);
- H5G_loc_t loc;
-
- if(H5G_loc_real(obj, type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Unmount */
- if(H5F__unmount(&loc, name) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file")
-
- break;
- }
-
- /* H5Fis_accessible */
- case H5VL_FILE_IS_ACCESSIBLE:
- {
- hid_t fapl_id = va_arg(arguments, hid_t);
- const char *name = va_arg(arguments, const char *);
- htri_t *ret = va_arg(arguments, htri_t *);
-
- /* Call private routine */
- if((*ret = H5F__is_hdf5(name, fapl_id)) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "error in HDF5 file check")
- break;
- }
-
- /* H5Fcreate / H5Fopen */
- case H5VL_FILE_CACHE_VOL_CONN:
- {
- hid_t vol_id = va_arg(arguments, hid_t);
- void *vol_info = va_arg(arguments, void *);
-
- /* Call private routine */
- if(H5F__set_vol_conn((H5F_t *)obj, vol_id, vol_info) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cache VOL connector ID & info failed")
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_file_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_file_optional
- *
- * Purpose: Perform a connector-specific operation on a native file
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
-{
- H5F_t *f = NULL; /* File */
- H5VL_file_optional_t optional_type = va_arg(arguments, H5VL_file_optional_t);
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- f = (H5F_t *)obj;
- switch(optional_type) {
- /* H5Fget_filesize */
- case H5VL_FILE_GET_SIZE:
- {
- haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */
- haddr_t base_addr; /* Base address for the file */
- hsize_t *size = va_arg(arguments, hsize_t *);
-
- /* Go get the actual file size */
- if(H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ")
-
- base_addr = H5FD_get_base_addr(f->shared->lf);
-
- if(size)
- *size = (hsize_t)(max_eof_eoa + base_addr); /* Convert relative base address for file to absolute address */
-
- break;
- }
-
- /* H5Fget_file_image */
- case H5VL_FILE_GET_FILE_IMAGE:
- {
- void *buf_ptr = va_arg(arguments, void *);
- ssize_t *ret = va_arg(arguments, ssize_t *);
- size_t buf_len = va_arg(arguments, size_t );
-
- /* Do the actual work */
- if((*ret = H5F__get_file_image(f, buf_ptr, buf_len)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get file image failed")
- break;
- }
-
- /* H5Fget_freespace */
- case H5VL_FILE_GET_FREE_SPACE:
- {
- hsize_t tot_space; /* Amount of free space in the file */
- hssize_t *ret = va_arg(arguments, hssize_t *);
-
- /* Go get the actual amount of free space in the file */
- if(H5MF_get_freespace(f, &tot_space, NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
- *ret = (hssize_t)tot_space;
- break;
- }
-
- case H5VL_FILE_GET_FREE_SECTIONS:
- {
- H5F_sect_info_t *sect_info = va_arg(arguments, H5F_sect_info_t *);
- ssize_t *ret = va_arg(arguments, ssize_t *);
- H5F_mem_t type = va_arg(arguments, H5F_mem_t);
- size_t nsects = va_arg(arguments, size_t);
-
- /* Go get the free-space section information in the file */
- if((*ret = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
- break;
- }
-
- /* H5Fget_info2 */
- case H5VL_FILE_GET_INFO:
- {
- H5I_type_t type = va_arg(arguments, H5I_type_t);
- H5F_info2_t *finfo = va_arg(arguments, H5F_info2_t *);
-
- /* Get the file struct. This call is careful to not return the file pointer
- * for the top file in a mount hierarchy.
- */
- if(NULL == (f = H5F__get_file(obj, type)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct")
-
- /* Get the file info */
- if(H5F__get_info(f, finfo) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
-
- break;
- }
-
- /* H5Fget_mdc_config */
- case H5VL_FILE_GET_MDC_CONF:
- {
- H5AC_cache_config_t *config_ptr = va_arg(arguments, H5AC_cache_config_t *);
-
- /* Go get the resize configuration */
- if(H5AC_get_cache_auto_resize_config(f->shared->cache, config_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.")
- break;
- }
-
- /* H5Fget_mdc_hit_rate */
- case H5VL_FILE_GET_MDC_HR:
- {
- double *hit_rate_ptr = va_arg(arguments, double *);
-
- /* Go get the current hit rate */
- if(H5AC_get_cache_hit_rate(f->shared->cache, hit_rate_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.")
- break;
- }
-
- /* H5Fget_mdc_size */
- case H5VL_FILE_GET_MDC_SIZE:
- {
- size_t *max_size_ptr = va_arg(arguments, size_t *);
- size_t *min_clean_size_ptr = va_arg(arguments, size_t *);
- size_t *cur_size_ptr = va_arg(arguments, size_t *);
- int *cur_num_entries_ptr = va_arg(arguments, int *);
- uint32_t cur_num_entries;
-
- /* Go get the size data */
- if(H5AC_get_cache_size(f->shared->cache, max_size_ptr, min_clean_size_ptr,
- cur_size_ptr, &cur_num_entries) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.")
-
- if(cur_num_entries_ptr != NULL)
- *cur_num_entries_ptr = (int)cur_num_entries;
- break;
- }
-
- /* H5Fget_vfd_handle */
- case H5VL_FILE_GET_VFD_HANDLE:
- {
- void **file_handle = va_arg(arguments, void **);
- hid_t fapl_id = va_arg(arguments, hid_t);
-
- /* Retrieve the VFD handle for the file */
- if(H5F_get_vfd_handle(f, fapl_id, file_handle) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle")
- break;
- }
-
- /* H5Iget_file_id */
- case H5VL_FILE_GET_FILE_ID:
- {
- H5I_type_t type = va_arg(arguments, H5I_type_t);
- hid_t *file_id = va_arg(arguments, hid_t *);
-
- if(NULL == (f = H5F__get_file(obj, type)))
- HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file or file object")
- if((*file_id = H5F__get_file_id(f)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file ID")
- break;
- }
-
- /* H5Fclear_elink_file_cache */
- case H5VL_FILE_CLEAR_ELINK_CACHE:
- {
- /* Release the EFC */
- if(f->shared->efc)
- if(H5F__efc_release(f->shared->efc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
- break;
- }
-
- /* H5Freset_mdc_hit_rate_stats */
- case H5VL_FILE_RESET_MDC_HIT_RATE:
- {
- /* Reset the hit rate statistic */
- if(H5AC_reset_cache_hit_rate_stats(f->shared->cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate")
- break;
- }
-
- case H5VL_FILE_SET_MDC_CONFIG:
- {
- H5AC_cache_config_t *config_ptr = va_arg(arguments, H5AC_cache_config_t *);
-
- /* set the resize configuration */
- if(H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed")
- break;
- }
-
- case H5VL_FILE_GET_METADATA_READ_RETRY_INFO:
- {
- H5F_retry_info_t *info = va_arg(arguments, H5F_retry_info_t *);
-
- if(H5F_get_metadata_read_retry_info(f, info) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't get metadata read retry info")
-
- break;
- }
-
- case H5VL_FILE_START_SWMR_WRITE:
- {
- if(H5F__start_swmr_write(f) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't start SWMR write")
-
- break;
- }
-
- case H5VL_FILE_START_MDC_LOGGING:
- {
- /* Call mdc logging function */
- if(H5C_start_logging(f->shared->cache) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging")
-
- break;
- }
-
- case H5VL_FILE_STOP_MDC_LOGGING:
- {
- /* Call mdc logging function */
- if(H5C_stop_logging(f->shared->cache) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging")
-
- break;
- }
-
- case H5VL_FILE_GET_MDC_LOGGING_STATUS:
- {
- hbool_t *is_enabled = va_arg(arguments, hbool_t *);
- hbool_t *is_currently_logging = va_arg(arguments, hbool_t *);
-
- /* Call mdc logging function */
- if(H5C_get_logging_status(f->shared->cache, is_enabled, is_currently_logging) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status")
-
- break;
- }
-
- case H5VL_FILE_FORMAT_CONVERT:
- {
- /* Convert the format */
- if(H5F__format_convert(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format")
-
- break;
- }
-
- case H5VL_FILE_RESET_PAGE_BUFFERING_STATS:
- {
- /* Sanity check */
- if(NULL == f->shared->page_buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file")
-
- /* Reset the statistics */
- if (H5PB_reset_stats(f->shared->page_buf) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't reset stats for page buffering")
-
- break;
- }
-
- case H5VL_FILE_GET_PAGE_BUFFERING_STATS:
- {
- unsigned *accesses = va_arg(arguments, unsigned *);
- unsigned *hits = va_arg(arguments, unsigned *);
- unsigned *misses = va_arg(arguments, unsigned *);
- unsigned *evictions = va_arg(arguments, unsigned *);
- unsigned *bypasses = va_arg(arguments, unsigned *);
-
- /* Sanity check */
- if(NULL == f->shared->page_buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file")
-
- /* Get the statistics */
- if(H5PB_get_stats(f->shared->page_buf, accesses, hits, misses, evictions, bypasses) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering")
-
- break;
- }
-
- case H5VL_FILE_GET_MDC_IMAGE_INFO:
- {
- haddr_t *image_addr = va_arg(arguments, haddr_t *);
- hsize_t *image_len = va_arg(arguments, hsize_t *);
-
- /* Go get the address and size of the cache image */
- if(H5AC_get_mdc_image_info(f->shared->cache, image_addr, image_len) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
-
- break;
- }
-
- case H5VL_FILE_GET_EOA:
- {
- haddr_t *eoa = va_arg(arguments, haddr_t *);
- haddr_t rel_eoa; /* Relative address of EOA */
-
- /* Sanity check */
- HDassert(eoa);
-
- /* This routine will work only for drivers with this feature enabled.*/
- /* We might introduce a new feature flag in the future */
- if(!H5F_HAS_FEATURE(f, H5FD_FEAT_SUPPORTS_SWMR_IO))
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine")
-
- /* The real work */
- if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed")
-
- /* Set return value */
- /* (Note compensating for base address subtraction in internal routine) */
- *eoa = rel_eoa + H5F_get_base_addr(f);
-
- break;
- }
-
- case H5VL_FILE_INCR_FILESIZE:
- {
- hsize_t increment = va_arg(arguments, hsize_t);
- haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */
-
- /* 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(f, 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(f, &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 */
- if(H5F__set_eoa(f, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed")
-
- break;
- }
-
- case H5VL_FILE_SET_LIBVER_BOUNDS:
- {
- H5F_libver_t low = va_arg(arguments, H5F_libver_t);
- H5F_libver_t high = va_arg(arguments, H5F_libver_t);
-
- /* 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")
-
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_file_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_file_close
- *
- * Purpose: Closes a file.
- *
- * Return: SUCCEED/FAIL (the file will not be closed on failure)
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req)
-{
- int nref;
- H5F_t *f = (H5F_t *)file;
- hid_t file_id = H5I_INVALID_HID;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* This routine should only be called when a file ID's ref count drops to zero */
- HDassert(H5F_ID_EXISTS(f));
-
- /* Flush file if this is the last reference to this id and we have write
- * intent, unless it will be flushed by the "shared" file being closed.
- * This is only necessary to replicate previous behaviour, and could be
- * disabled by an option/property to improve performance.
- */
- if((H5F_NREFS(f) > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) {
- /* Get the file ID corresponding to the H5F_t struct */
- if(H5I_find_id(f, H5I_FILE, &file_id) < 0 || H5I_INVALID_HID == file_id)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "invalid atom")
-
- /* Get the number of references outstanding for this file ID */
- if((nref = H5I_get_ref(file_id, FALSE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count")
- if(nref == 1)
- if(H5F__flush(f) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
- } /* end if */
-
- /* Close the file */
- if(H5F__close(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close file")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_file_close() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_group_create
- *
- * Purpose: Creates a group inside a native h5 file.
- *
- * Return: Success: Pointer to a group struct
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
- hid_t gcpl_id, hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- H5G_loc_t loc; /* Location to create group */
- H5G_t *grp = NULL; /* New group created */
- hid_t lcpl_id;
- void *ret_value;
-
- FUNC_ENTER_STATIC
-
- /* Get the property list structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
-
- /* Get creation properties */
- if(H5P_get(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id")
-
- /* Set up the location */
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
-
- /* if name is NULL then this is from H5Gcreate_anon */
- if(name == NULL) {
- H5G_obj_create_t gcrt_info; /* Information for group creation */
-
- /* Set up group creation info */
- gcrt_info.gcpl_id = gcpl_id;
- gcrt_info.cache_type = H5G_NOTHING_CACHED;
- HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache));
-
- /* Create the new group & get its ID */
- if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group")
- } /* end if */
- /* otherwise it's from H5Gcreate */
- else {
- /* Create the new group & get its ID */
- if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group")
- } /* end else */
-
- ret_value = (void *)grp;
-
-done:
- if(name == NULL) {
- /* Release the group's object header, if it was created */
- if(grp) {
- H5O_loc_t *oloc; /* Object location for group */
-
- /* Get the new group's object location */
- if(NULL == (oloc = H5G_oloc(grp)))
- HDONE_ERROR(H5E_SYM, H5E_CANTGET, NULL, "unable to get object location of group")
-
- /* Decrement refcount on group's object header in memory */
- if(H5O_dec_rc_by_loc(oloc) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object")
- } /* end if */
- } /* end if */
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_group_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_group_open
- *
- * Purpose: Opens a group inside a native h5 file.
- *
- * Return: Success: Pointer to a group struct
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
- hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
-{
- H5G_loc_t loc; /* Location to open group */
- H5G_t *grp = NULL; /* New group opend */
- void *ret_value;
-
- FUNC_ENTER_STATIC
-
- /* Set up the location */
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
-
- /* Open the group */
- if((grp = H5G__open_name(&loc, name)) == NULL)
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group")
-
- ret_value = (void *)grp;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_group_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_group_get
- *
- * Purpose: Get info about a group
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_group_get(void *obj, H5VL_group_get_t get_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- switch(get_type) {
- /* H5Gget_create_plist */
- case H5VL_GROUP_GET_GCPL:
- {
- hid_t *new_gcpl_id = va_arg(arguments, hid_t *);
- H5G_t *grp = (H5G_t *)obj;
-
- if((*new_gcpl_id = H5G_get_create_plist(grp)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for group")
- break;
- }
-
- /* H5Gget_info */
- case H5VL_GROUP_GET_INFO:
- {
- const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *);
- H5G_info_t *group_info = va_arg(arguments, H5G_info_t *);
- H5G_loc_t loc;
-
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- if(loc_params->type == H5VL_OBJECT_BY_SELF) {
- /* H5Gget_info */
-
- /* Retrieve the group's information */
- if(H5G__obj_info(loc.oloc, group_info) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
- } /* end if */
- else if(loc_params->type == H5VL_OBJECT_BY_NAME) {
- /* H5Gget_info_by_name */
-
- /* Retrieve the group's information */
- if(H5G__get_info_by_name(&loc, loc_params->loc_data.loc_by_name.name, group_info) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
- } /* end else-if */
- else if(loc_params->type == H5VL_OBJECT_BY_IDX) {
- /* H5Gget_info_by_idx */
-
- /* Retrieve the group's information */
- if(H5G__get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, group_info) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters")
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_group_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_group_specific
- *
- * Purpose: Specific operations for groups
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
-{
- H5G_t *grp = (H5G_t *)obj;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- switch(specific_type) {
- case H5VL_GROUP_FLUSH:
- {
- hid_t group_id = va_arg(arguments, hid_t);
-
- /* Flush object's metadata to file */
- if(H5O_flush_common(&grp->oloc, group_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group")
-
- break;
- }
-
- case H5VL_GROUP_REFRESH:
- {
- hid_t group_id = va_arg(arguments, hid_t);
-
- /* Call private function to refresh group object */
- if((H5O_refresh_metadata(group_id, grp->oloc)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")
-
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_group_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_group_optional
- *
- * Purpose: Perform a connector-specific operation on a native group
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_group_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
-{
- H5VL_group_optional_t optional_type;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- optional_type = va_arg(arguments, H5VL_group_optional_t);
- switch(optional_type) {
-#ifndef H5_NO_DEPRECATED_SYMBOLS
- /* H5Giterate (deprecated) */
- case H5VL_GROUP_ITERATE_OLD:
- {
- const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *);
- hsize_t idx = va_arg(arguments, hsize_t);
- hsize_t *last_obj = va_arg(arguments, hsize_t *);
- const H5G_link_iterate_t *lnk_op = va_arg(arguments, const H5G_link_iterate_t *);
- void *op_data = va_arg(arguments, void *);
- H5G_loc_t grp_loc;
-
- /* Get the location struct for the object */
- if(H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Call the actual iteration routine */
- if((ret_value = H5G_iterate(&grp_loc, loc_params->loc_data.loc_by_name.name, H5_INDEX_NAME, H5_ITER_INC, idx, last_obj, lnk_op, op_data)) < 0)
- HERROR(H5E_VOL, H5E_BADITER, "error iterating over group's links");
-
- break;
- }
-
- /* H5Gget_objinfo (deprecated) */
- case H5VL_GROUP_GET_OBJINFO:
- {
- const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *);
- hbool_t follow_link = va_arg(arguments, unsigned);
- H5G_stat_t *statbuf = va_arg(arguments, H5G_stat_t *);
- H5G_loc_t grp_loc;
-
- /* Get the location struct for the object */
- if(H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Call the actual group objinfo routine */
- if(H5G__get_objinfo(&grp_loc, loc_params->loc_data.loc_by_name.name, follow_link, statbuf) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object")
-
- break;
- }
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_group_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_group_close
- *
- * Purpose: Closes a group.
- *
- * Return: SUCCEED/FAIL (the group will not be closed on failure)
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_group_close(void *grp, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- if(H5G_close((H5G_t *)grp) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close group")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_group_close() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_link_create
- *
- * Purpose: Creates an hard/soft/UD/external links.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Mohamad Chaarawi
- * April, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj,
- const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- switch(create_type) {
- case H5VL_LINK_CREATE_HARD:
- {
- H5G_loc_t cur_loc;
- H5G_loc_t link_loc;
- void *cur_obj;
- H5VL_loc_params_t cur_params;
-
- if(H5P_get(plist, H5VL_PROP_LINK_TARGET, &cur_obj) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for current location id")
- if(H5P_get(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &cur_params) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for current name")
-
- if(NULL != cur_obj && H5G_loc_real(cur_obj, cur_params.obj_type, &cur_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- if(NULL != obj && H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* H5Lcreate_hard */
- if(H5VL_OBJECT_BY_NAME == cur_params.type) {
- H5G_loc_t *cur_loc_p, *link_loc_p;
-
- /* Set up current & new location pointers */
- cur_loc_p = &cur_loc;
- link_loc_p = &link_loc;
- if(NULL == cur_obj)
- cur_loc_p = link_loc_p;
- else if(NULL == obj)
- link_loc_p = cur_loc_p;
- else if(cur_loc_p->oloc->file != link_loc_p->oloc->file)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.")
-
- /* Create the link */
- if((ret_value = H5L_create_hard(cur_loc_p, cur_params.loc_data.loc_by_name.name,
- link_loc_p, loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
- } /* end if */
- else { /* H5Olink */
- /* Link to the object */
- if(H5L_link(&link_loc, loc_params->loc_data.loc_by_name.name, &cur_loc, lcpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link")
- } /* end else */
- break;
- }
-
- case H5VL_LINK_CREATE_SOFT:
- {
- char *target_name;
- H5G_loc_t link_loc; /* Group location for new link */
-
- if(H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- if(H5P_get(plist, H5VL_PROP_LINK_TARGET_NAME, &target_name) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for targe name")
-
- /* Create the link */
- if((ret_value = H5L_create_soft(target_name, &link_loc, loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
- break;
- }
-
- case H5VL_LINK_CREATE_UD:
- {
- H5G_loc_t link_loc; /* Group location for new link */
- H5L_type_t link_type;
- void *udata;
- size_t udata_size;
-
- if(H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- if(H5P_get(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for link type")
- if(H5P_get(plist, H5VL_PROP_LINK_UDATA, &udata) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for udata")
- if(H5P_get(plist, H5VL_PROP_LINK_UDATA_SIZE, &udata_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for udata size")
-
- /* Create link */
- if(H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, udata, udata_size,
- link_type, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "invalid link creation call")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_link_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_link_copy
- *
- * Purpose: Renames an object within an HDF5 file and copies it to a new
- * group. The original name SRC is unlinked from the group graph
- * and then inserted with the new name DST (which can specify a
- * new path for the object) as an atomic operation. The names
- * are interpreted relative to SRC_LOC_ID and
- * DST_LOC_ID, which are either file IDs or group ID.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Mohamad Chaarawi
- * April, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
- void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id,
- hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req)
-{
- H5G_loc_t src_loc, *src_loc_p;
- H5G_loc_t dst_loc, *dst_loc_p;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- if(NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Set up src & dst location pointers */
- src_loc_p = &src_loc;
- dst_loc_p = &dst_loc;
- if(NULL == src_obj)
- src_loc_p = dst_loc_p;
- else if(NULL == dst_obj)
- dst_loc_p = src_loc_p;
-
- /* Copy the link */
- if(H5L_move(src_loc_p, loc_params1->loc_data.loc_by_name.name,
- dst_loc_p, loc_params2->loc_data.loc_by_name.name,
- TRUE, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_link_copy() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_link_move
- *
- * Purpose: Renames an object within an HDF5 file and moves it to a new
- * group. The original name SRC is unlinked from the group graph
- * and then inserted with the new name DST (which can specify a
- * new path for the object) as an atomic operation. The names
- * are interpreted relative to SRC_LOC_ID and
- * DST_LOC_ID, which are either file IDs or group ID.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Mohamad Chaarawi
- * April, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
- void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id,
- hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req)
-{
- H5G_loc_t src_loc, *src_loc_p;
- H5G_loc_t dst_loc, *dst_loc_p;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- if(NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Set up src & dst location pointers */
- src_loc_p = &src_loc;
- dst_loc_p = &dst_loc;
- if(NULL == src_obj)
- src_loc_p = dst_loc_p;
- else if(NULL == dst_obj)
- dst_loc_p = src_loc_p;
-
- /* Move the link */
- if(H5L_move(src_loc_p, loc_params1->loc_data.loc_by_name.name,
- dst_loc_p, loc_params2->loc_data.loc_by_name.name,
- FALSE, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_link_move() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_link_get
- *
- * Purpose: Get info about a link
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Mohamad Chaarawi
- * April, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
-{
- H5G_loc_t loc;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- switch(get_type) {
- /* H5Lget_info/H5Lget_info_by_idx */
- case H5VL_LINK_GET_INFO:
- {
- H5L_info_t *linfo = va_arg(arguments, H5L_info_t *);
-
- /* Get the link information */
- if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_info */
- if(H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, linfo) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
- } /* end if */
- else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_info_by_idx */
- if(H5L_get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, linfo) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
- break;
- }
-
- /* H5Lget_name_by_idx */
- case H5VL_LINK_GET_NAME:
- {
- char *name = va_arg(arguments, char *);
- size_t size = va_arg(arguments, size_t);
- ssize_t *ret = va_arg(arguments, ssize_t *);
-
- /* Get the link name */
- if((*ret = H5L_get_name_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, name, size)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
-
- break;
- }
-
- /* H5Lget_val/H5Lget_val_by_idx */
- case H5VL_LINK_GET_VAL:
- {
- void *buf = va_arg(arguments, void *);
- size_t size = va_arg(arguments, size_t);
-
- /* Get the link information */
- if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_val */
- if(H5L_get_val(&loc, loc_params->loc_data.loc_by_name.name, buf, size) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link value")
- }
- else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_val_by_idx */
-
- if(H5L_get_val_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, buf, size) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val")
- }
- else
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val")
-
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from link")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_link_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_link_specific
- *
- * Purpose: Specific operation on a link
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Mohamad Chaarawi
- * April, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- switch(specific_type) {
- case H5VL_LINK_EXISTS:
- {
- htri_t *ret = va_arg(arguments, htri_t *);
- H5G_loc_t loc;
-
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Check for the existence of the link */
- if((*ret = H5L_exists(&loc, loc_params->loc_data.loc_by_name.name)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info")
- break;
- }
-
- case H5VL_LINK_ITER:
- {
- H5G_loc_t loc;
- hbool_t recursive = va_arg(arguments, int);
- H5_index_t idx_type = va_arg(arguments, H5_index_t);
- H5_iter_order_t order = va_arg(arguments, H5_iter_order_t);
- hsize_t *idx_p = va_arg(arguments, hsize_t *);
- H5L_iterate_t op = va_arg(arguments, H5L_iterate_t);
- void *op_data = va_arg(arguments, void *);
-
- /* Get the location */
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
-
- /* Visit or iterate over the links */
- if(loc_params->type == H5VL_OBJECT_BY_SELF) {
- if(recursive) {
- /* H5Lvisit */
- if((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
- } /* end if */
- else {
- /* H5Literate */
- if((ret_value = H5L_iterate(&loc, ".", idx_type, order, idx_p, op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links")
- } /* end else */
- } /* end if */
- else if(loc_params->type == H5VL_OBJECT_BY_NAME) {
- if(recursive) {
- /* H5Lvisit_by_name */
- if((ret_value = H5G_visit(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
- } /* end if */
- else {
- /* H5Literate_by_name */
- if((ret_value = H5L_iterate(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, idx_p, op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links")
- } /* end else */
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_LINK, H5E_UNSUPPORTED, FAIL, "unknown link iterate params")
-
- break;
- }
-
- case H5VL_LINK_DELETE:
- {
- H5G_loc_t loc;
-
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Unlink */
- if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Ldelete */
- if(H5L_delete(&loc, loc_params->loc_data.loc_by_name.name) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
- } /* end if */
- else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Ldelete_by_idx */
- if(H5L_delete_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_link_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_object_open
- *
- * Purpose: Opens an object inside a native h5 file.
- *
- * Return: Success: object id.
- * Failure: NULL
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
-{
- H5G_loc_t loc;
- void *ret_value = NULL;
-
- FUNC_ENTER_STATIC
-
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
-
- switch(loc_params->type) {
- case H5VL_OBJECT_BY_NAME:
- {
- /* Open the object */
- if(NULL == (ret_value = H5O_open_name(&loc, loc_params->loc_data.loc_by_name.name, opened_type)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by name")
- break;
- }
-
- case H5VL_OBJECT_BY_IDX:
- {
- /* Open the object */
- if(NULL == (ret_value = H5O_open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, opened_type)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by index")
- break;
- }
-
- case H5VL_OBJECT_BY_ADDR:
- {
- /* Open the object */
- if(NULL == (ret_value = H5O_open_by_addr(&loc, loc_params->loc_data.loc_by_addr.addr, opened_type)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by address")
- break;
- }
-
- case H5VL_OBJECT_BY_REF:
- {
- hid_t temp_id = H5I_INVALID_HID;
- H5F_t *file = NULL;
-
- /* Get the file pointer from the entry */
- file = loc.oloc->file;
-
- /* Create reference */
- if((temp_id = H5R__dereference(file, loc_params->loc_data.loc_by_ref.lapl_id,
- loc_params->loc_data.loc_by_ref.ref_type,
- loc_params->loc_data.loc_by_ref._ref)) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, NULL, "unable to dereference object")
-
- *opened_type = H5I_get_type(temp_id);
- if(NULL == (ret_value = H5I_remove(temp_id)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object")
- break;
- }
-
- case H5VL_OBJECT_BY_SELF:
- default:
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown open parameters")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_object_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_object_copy
- *
- * Purpose: Copies an object inside a native h5 file.
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_object_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name,
- void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name,
- hid_t ocpypl_id, hid_t lcpl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
-{
- H5G_loc_t src_loc; /* Source object group location */
- H5G_loc_t dst_loc; /* Destination group location */
- herr_t ret_value = FAIL;
-
- FUNC_ENTER_STATIC
-
- /* get location for objects */
- if(H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- if(H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Copy the object */
- if((ret_value = H5O_copy(&src_loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_object_copy() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_object_get
- *
- * Purpose: Gets certain data about an object
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
-{
- herr_t ret_value = SUCCEED; /* Return value */
- H5G_loc_t loc; /* Location of group */
-
- FUNC_ENTER_STATIC
-
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- switch(get_type) {
- /* H5Rget_region */
- case H5VL_REF_GET_REGION:
- {
- hid_t *ret = va_arg(arguments, hid_t *);
- H5R_type_t H5_ATTR_UNUSED ref_type = va_arg(arguments, H5R_type_t);
- void *ref = va_arg(arguments, void *);
- H5S_t *space = NULL; /* Dataspace object */
-
- /* Get the dataspace with the correct region selected */
- if((space = H5R__get_region(loc.oloc->file, ref)) == NULL)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve region")
-
- /* Atomize */
- if((*ret = H5I_register(H5I_DATASPACE, space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
-
- break;
- }
-
- /* H5Rget_obj_type2 */
- case H5VL_REF_GET_TYPE:
- {
- H5O_type_t *obj_type = va_arg(arguments, H5O_type_t *);
- H5R_type_t ref_type = va_arg(arguments, H5R_type_t);
- void *ref = va_arg(arguments, void *);
-
- /* Get the object information */
- if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, obj_type) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type")
- break;
- }
-
- /* H5Rget_name */
- case H5VL_REF_GET_NAME:
- {
- ssize_t *ret = va_arg(arguments, ssize_t *);
- char *name = va_arg(arguments, char *);
- size_t size = va_arg(arguments, size_t);
- H5R_type_t ref_type = va_arg(arguments, H5R_type_t);
- void *ref = va_arg(arguments, void *);
-
- /* Get name */
- if((*ret = H5R__get_name(loc.oloc->file, ref_type, ref, name, size)) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object path")
- break;
- }
-
- /* H5Iget_name */
- case H5VL_ID_GET_NAME:
- {
- ssize_t *ret = va_arg(arguments, ssize_t *);
- char *name = va_arg(arguments, char *);
- size_t size = va_arg(arguments, size_t);
-
- /* Retrieve object's name */
- if((*ret = H5G_get_name(&loc, name, size, NULL)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name")
-
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_object_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_object_specific
- *
- * Purpose: Specific operation on an object
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
-{
- H5G_loc_t loc;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- switch(specific_type) {
- /* H5Oincr_refcount / H5Odecr_refcount */
- case H5VL_OBJECT_CHANGE_REF_COUNT:
- {
- int update_ref = va_arg(arguments, int);
- H5O_loc_t *oloc = loc.oloc;
-
- if(H5O_link(oloc, update_ref) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
-
- break;
- }
-
- /* H5Oexists_by_name */
- case H5VL_OBJECT_EXISTS:
- {
- htri_t *ret = va_arg(arguments, htri_t *);
-
- if(loc_params->type == H5VL_OBJECT_BY_NAME) {
- /* Check if the object exists */
- if((*ret = H5G_loc_exists(&loc, loc_params->loc_data.loc_by_name.name)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", loc_params->loc_data.loc_by_name.name)
- } /* end if */
- else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters")
- break;
- }
-
- case H5VL_OBJECT_VISIT:
- {
- H5_index_t idx_type = va_arg(arguments, H5_index_t);
- H5_iter_order_t order = va_arg(arguments, H5_iter_order_t);
- H5O_iterate_t op = va_arg(arguments, H5O_iterate_t);
- void *op_data = va_arg(arguments, void *);
- unsigned fields = va_arg(arguments, unsigned);
-
- /* Call internal object visitation routine */
- if(loc_params->type == H5VL_OBJECT_BY_SELF) {
- /* H5Ovisit */
- if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, fields)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
- } /* end if */
- else if(loc_params->type == H5VL_OBJECT_BY_NAME) {
- /* H5Ovisit_by_name */
- if((ret_value = H5O__visit(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, op, op_data, fields)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object visit params");
- break;
- }
-
- case H5VL_OBJECT_FLUSH:
- {
- hid_t oid = va_arg(arguments, hid_t);
-
- /* Flush the object's metadata */
- if(H5O_flush(loc.oloc, oid) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
-
- break;
- }
-
- case H5VL_OBJECT_REFRESH:
- {
- hid_t oid = va_arg(arguments, hid_t);
- H5O_loc_t *oloc = loc.oloc;
-
- /* Refresh the metadata */
- if(H5O_refresh_metadata(oid, *oloc) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
-
- break;
- }
-
- case H5VL_REF_CREATE:
- {
- void *ref = va_arg(arguments, void *);
- const char *name = va_arg(arguments, char *);
- H5R_type_t ref_type = va_arg(arguments, H5R_type_t);
- hid_t space_id = va_arg(arguments, hid_t);
- H5S_t *space = NULL; /* Pointer to dataspace containing region */
-
- if(space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
-
- /* Create reference */
- if(H5R__create(ref, &loc, name, ref_type, space) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference")
-
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_object_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_object_optional
- *
- * Purpose: Perform a connector-specific operation for an objectibute
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Mohamad Chaarawi
- * April, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
-{
- H5VL_object_optional_t optional_type = va_arg(arguments, H5VL_object_optional_t);
- H5VL_loc_params_t *loc_params = va_arg(arguments, H5VL_loc_params_t *);
- H5G_loc_t loc; /* Location of group */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- switch(optional_type) {
- /* H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx */
- case H5VL_OBJECT_GET_INFO:
- {
- H5O_info_t *obj_info = va_arg(arguments, H5O_info_t *);
- unsigned fields = va_arg(arguments, unsigned);
-
- if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */
- /* Retrieve the object's information */
- if(H5G_loc_info(&loc, ".", obj_info, fields) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
- } /* end if */
- else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */
- /* Retrieve the object's information */
- if(H5G_loc_info(&loc, loc_params->loc_data.loc_by_name.name, obj_info, fields) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
- } /* end else-if */
- else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
-
- /* Set up opened group location to fill in */
- obj_loc.oloc = &obj_oloc;
- obj_loc.path = &obj_path;
- H5G_loc_reset(&obj_loc);
-
- /* Find the object's location, according to the order in the index */
- if(H5G_loc_find_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n, &obj_loc/*out*/) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found")
-
- /* Retrieve the object's information */
- if(H5O_get_info(obj_loc.oloc, obj_info, fields) < 0) {
- H5G_loc_free(&obj_loc);
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
- } /* end if */
-
- /* Release the object location */
- if(H5G_loc_free(&obj_loc) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters")
- break;
- }
-
- /* H5Oget_comment / H5Oget_comment_by_name */
- case H5VL_OBJECT_GET_COMMENT:
- {
- char *comment = va_arg(arguments, char *);
- size_t bufsize = va_arg(arguments, size_t);
- ssize_t *ret = va_arg(arguments, ssize_t *);
-
- /* Retrieve the object's comment */
- if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_comment */
- if((*ret = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
- } /* end if */
- else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_comment_by_name */
- if((*ret = H5G_loc_get_comment(&loc, loc_params->loc_data.loc_by_name.name, comment/*out*/, bufsize)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters")
- break;
- }
-
- /* H5Oset_comment */
- case H5VL_OBJECT_SET_COMMENT:
- {
- const char *comment = va_arg(arguments, char *);
-
- if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oset_comment */
- /* (Re)set the object's comment */
- if(H5G_loc_set_comment(&loc, ".", comment) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
- } /* end if */
- else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oset_comment_by_name */
- /* (Re)set the object's comment */
- if(H5G_loc_set_comment(&loc, loc_params->loc_data.loc_by_name.name, comment) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters")
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object");
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_object_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_datatype_commit
- *
- * Purpose: Commits a datatype inside a native h5 file.
- *
- * Return: Success: datatype id.
- * Failure: NULL
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5VL__native_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
- hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t H5_ATTR_UNUSED tapl_id,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
-{
- H5G_loc_t loc; /* Location to commit datatype */
- H5T_t *dt; /* Datatype for ID */
- H5T_t *type = NULL; /* copy of the original type which will be committed */
- void *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* check arguments */
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
-
- if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
-
- /* Check arguments. We cannot commit an immutable type because H5Tclose()
- * normally fails on such types (try H5Tclose(H5T_NATIVE_INT)) but closing
- * a named type should always succeed.
- */
- if(H5T_STATE_NAMED == dt->shared->state || H5T_STATE_OPEN == dt->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is already committed")
- if(H5T_STATE_IMMUTABLE == dt->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is immutable")
-
- /* Check for a "sensible" datatype to store on disk */
- if(H5T_is_sensible(dt) <= 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "datatype is not sensible")
-
- /* Copy the datatype - the copied one will be the type that is
- * committed, and attached to original datatype above the VOL
- * layer
- */
- if(NULL == (type = H5T_copy(dt, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy");
-
- /* Commit the datatype */
- if(NULL != name) {
- /* H5Tcommit */
- if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype")
- } /* end if */
- else {
- /* H5Tcommit_anon */
- if(H5T__commit_anon(loc.oloc->file, type, tcpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype")
- } /* end else */
-
- ret_value = (void *)type;
-
-done:
- if(NULL == ret_value && type)
- H5T_close(type);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_datatype_commit() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_datatype_open
- *
- * Purpose: Opens a named datatype inside a native h5 file.
- *
- * Return: Success: datatype pointer
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
- hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
-{
- H5T_t *type = NULL; /* Datatype opened in file */
- H5G_loc_t loc; /* Group location of object to open */
- void *ret_value = NULL;
-
- FUNC_ENTER_STATIC
-
- if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
-
- /* Open the datatype */
- if(NULL == (type = H5T__open_name(&loc, name)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype")
-
- type->vol_obj = NULL;
-
- ret_value = (void *)type;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_datatype_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_datatype_get
- *
- * Purpose: Get information about a datatype
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Mohamad Chaarawi
- * June, 2013
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_datatype_get(void *obj, H5VL_datatype_get_t get_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
-{
- H5T_t *dt = (H5T_t *)obj;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- switch (get_type) {
- case H5VL_DATATYPE_GET_BINARY:
- {
- ssize_t *nalloc = va_arg(arguments, ssize_t *);
- void *buf = va_arg(arguments, void *);
- size_t size = va_arg(arguments, size_t);
-
- if(H5T_encode(dt, (unsigned char *)buf, &size) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't determine serialized length of datatype")
-
- *nalloc = (ssize_t) size;
- break;
- }
-
- /* H5Tget_create_plist */
- case H5VL_DATATYPE_GET_TCPL:
- {
- hid_t *ret_id = va_arg(arguments, hid_t *);
-
- if(H5I_INVALID_HID == (*ret_id = H5T__get_create_plist(dt)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info");
-
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from datatype")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_datatype_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_datatype_specific
- *
- * Purpose: Specific operations for datatype
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
-{
- H5T_t *dt = (H5T_t *)obj;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- switch(specific_type) {
- case H5VL_DATATYPE_FLUSH:
- {
- hid_t type_id = va_arg(arguments, hid_t);
-
- /* To flush metadata and invoke flush callback if there is */
- if (H5O_flush_common(&dt->oloc, type_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype")
-
- break;
- }
-
- case H5VL_DATATYPE_REFRESH:
- {
- hid_t type_id = va_arg(arguments, hid_t);
-
- /* Call private function to refresh datatype object */
- if ((H5O_refresh_metadata(type_id, dt->oloc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype")
-
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_datatype_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL__native_datatype_close
- *
- * Purpose: Closes a datatype.
- *
- * Return: Success: 0
- * Failure: -1, datatype not closed.
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL__native_datatype_close(void *dt, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- if(H5T_close((H5T_t*)dt) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close datatype")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__native_datatype_close() */
-
diff --git a/src/H5VLnative.h b/src/H5VLnative.h
index 8ae3a66..1a3007a 100644
--- a/src/H5VLnative.h
+++ b/src/H5VLnative.h
@@ -25,14 +25,70 @@
#define H5VL_NATIVE_VALUE H5_VOL_NATIVE /* enum value */
#define H5VL_NATIVE_VERSION 0
+/* Typedef and values for native VOL connector attribute optional VOL operations */
+typedef int H5VL_native_attr_optional_t;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+#define H5VL_NATIVE_ATTR_ITERATE_OLD 0 /* H5Aiterate (deprecated routine) */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+/* Typedef and values for native VOL connector dataset optional VOL operations */
+typedef int H5VL_native_dataset_optional_t;
+#define H5VL_NATIVE_DATASET_FORMAT_CONVERT 0 /* H5Dformat_convert (internal) */
+#define H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE 1 /* H5Dget_chunk_index_type */
+#define H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE 2 /* H5Dget_chunk_storage_size */
+#define H5VL_NATIVE_DATASET_CHUNK_READ 3 /* H5Dchunk_read */
+#define H5VL_NATIVE_DATASET_CHUNK_WRITE 4 /* H5Dchunk_write */
+
+/* Typedef and values for native VOL connector file optional VOL operations */
+typedef int H5VL_native_file_optional_t;
+#define H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE 0 /* H5Fclear_elink_file_cache */
+#define H5VL_NATIVE_FILE_GET_FILE_IMAGE 1 /* H5Fget_file_image */
+#define H5VL_NATIVE_FILE_GET_FREE_SECTIONS 2 /* H5Fget_free_sections */
+#define H5VL_NATIVE_FILE_GET_FREE_SPACE 3 /* H5Fget_freespace */
+#define H5VL_NATIVE_FILE_GET_INFO 4 /* H5Fget_info1/2 */
+#define H5VL_NATIVE_FILE_GET_MDC_CONF 5 /* H5Fget_mdc_config */
+#define H5VL_NATIVE_FILE_GET_MDC_HR 6 /* H5Fget_mdc_hit_rate */
+#define H5VL_NATIVE_FILE_GET_MDC_SIZE 7 /* H5Fget_mdc_size */
+#define H5VL_NATIVE_FILE_GET_SIZE 8 /* H5Fget_filesize */
+#define H5VL_NATIVE_FILE_GET_VFD_HANDLE 9 /* H5Fget_vfd_handle */
+#define H5VL_NATIVE_FILE_GET_FILE_ID 10 /* H5Fget_file_id */
+#define H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE 11 /* H5Freset_mdc_hit_rate_stats */
+#define H5VL_NATIVE_FILE_SET_MDC_CONFIG 12 /* H5Fset_mdc_config */
+#define H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO 13 /* H5Fget_metadata_read_retry_info */
+#define H5VL_NATIVE_FILE_START_SWMR_WRITE 14 /* H5Fstart_swmr_write */
+#define H5VL_NATIVE_FILE_START_MDC_LOGGING 15 /* H5Fstart_mdc_logging */
+#define H5VL_NATIVE_FILE_STOP_MDC_LOGGING 16 /* H5Fstop_mdc_logging */
+#define H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS 17 /* H5Fget_mdc_logging_status */
+#define H5VL_NATIVE_FILE_FORMAT_CONVERT 18 /* H5Fformat_convert */
+#define H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS 19 /* H5Freset_page_buffering_stats */
+#define H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS 20 /* H5Fget_page_buffering_stats */
+#define H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO 21 /* H5Fget_mdc_image_info */
+#define H5VL_NATIVE_FILE_GET_EOA 22 /* H5Fget_eoa */
+#define H5VL_NATIVE_FILE_INCR_FILESIZE 23 /* H5Fincrement_filesize */
+#define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 24 /* H5Fset_latest_format/libver_bounds */
+#define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 25 /* H5Fget_dset_no_attrs_hint */
+#define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 26 /* H5Fset_dset_no_attrs_hint */
+
+/* Typedef and values for native VOL connector group optional VOL operations */
+typedef int H5VL_native_group_optional_t;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+#define H5VL_NATIVE_GROUP_ITERATE_OLD 0 /* HG5Giterate (deprecated routine) */
+#define H5VL_NATIVE_GROUP_GET_OBJINFO 1 /* HG5Gget_objinfo (deprecated routine) */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+/* Typedef and values for native VOL connector object optional VOL operations */
+typedef int H5VL_native_object_optional_t;
+#define H5VL_NATIVE_OBJECT_GET_COMMENT 0 /* H5G|H5Oget_comment, H5Oget_comment_by_name */
+#define H5VL_NATIVE_OBJECT_GET_INFO 1 /* H5Oget_info(_by_idx, _by_name)(2) */
+#define H5VL_NATIVE_OBJECT_SET_COMMENT 2 /* H5G|H5Oset_comment, H5Oset_comment_by_name */
#ifdef __cplusplus
extern "C" {
#endif
+/* Private functions */
H5_DLL hid_t H5VL_native_register(void);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/H5VLnative_attr.c b/src/H5VLnative_attr.c
new file mode 100644
index 0000000..7d9f0ac
--- /dev/null
+++ b/src/H5VLnative_attr.c
@@ -0,0 +1,597 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Attribute callbacks for the native VOL connector
+ *
+ */
+
+#define H5A_FRIEND /* Suppress error about including H5Apkg */
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Apkg.h" /* Attributes */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Sprivate.h" /* Dataspaces */
+#include "H5Tprivate.h" /* Datatypes */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+#include "H5VLnative_private.h" /* Native VOL connector */
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_create
+ *
+ * Purpose: Handles the attribute create callback
+ *
+ * Return: Success: attribute pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
+ hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t loc; /* Object location */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ hbool_t loc_found = FALSE;
+ H5P_genplist_t *plist; /* Property list pointer */
+ hid_t type_id, space_id;
+ H5T_t *type, *dt; /* Datatype to use for attribute */
+ H5S_t *space; /* Dataspace to use for attribute */
+ H5A_t *attr = NULL;
+ void *ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
+
+ /* get creation properties */
+ if(H5P_get(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for datatype id")
+ if(H5P_get(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id")
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+ if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR))
+ HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, NULL, "no write intent on file")
+
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
+ /* If this is a named datatype, get the connector's pointer to the datatype */
+ type = H5T_get_actual_type(dt);
+
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data space")
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) {
+ /* H5Acreate */
+ /* Go do the real work for attaching the attribute to the dataset */
+ if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) {
+ /* H5Acreate_by_name */
+ if(NULL == (attr = H5A__create_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name, type, space, acpl_id)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute create parameters")
+
+ ret_value = (void *)attr;
+
+done:
+ /* Release resources */
+ if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_open
+ *
+ * Purpose: Handles the attribute open callback
+ *
+ * Return: Success: attribute pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
+ hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t loc; /* Object location */
+ H5A_t *attr = NULL; /* Attribute opened */
+ void *ret_value;
+
+ FUNC_ENTER_PACKAGE
+
+ /* check arguments */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) {
+ /* H5Aopen */
+ /* Open the attribute */
+ if(NULL == (attr = H5A__open(&loc, attr_name)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute: '%s'", attr_name)
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) {
+ /* H5Aopen_by_name */
+ /* Open the attribute on the object header */
+ if(NULL == (attr = H5A__open_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute")
+ } /* end else-if */
+ else if(loc_params->type == H5VL_OBJECT_BY_IDX) {
+ /* H5Aopen_by_idx */
+ /* Open the attribute in the object header */
+ if(NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
+ loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order,
+ loc_params->loc_data.loc_by_idx.n)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute open parameters")
+
+ ret_value = (void *)attr;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_read
+ *
+ * Purpose: Handles the attribute read callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5T_t *mem_type; /* Memory datatype */
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
+ /* Go write the actual data to the attribute */
+ if((ret_value = H5A__read((H5A_t*)attr, mem_type, buf)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_write
+ *
+ * Purpose: Handles the attribute write callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5T_t *mem_type; /* Memory datatype */
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
+ /* Go write the actual data to the attribute */
+ if((ret_value = H5A__write((H5A_t*)attr, mem_type, buf)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_get
+ *
+ * Purpose: Handles the attribute get callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ switch(get_type) {
+ /* H5Aget_space */
+ case H5VL_ATTR_GET_SPACE:
+ {
+ hid_t *ret_id = HDva_arg(arguments, hid_t *);
+ H5A_t *attr = (H5A_t *)obj;
+
+ if((*ret_id = H5A_get_space(attr)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute")
+ break;
+ }
+
+ /* H5Aget_type */
+ case H5VL_ATTR_GET_TYPE:
+ {
+ hid_t *ret_id = HDva_arg(arguments, hid_t *);
+ H5A_t *attr = (H5A_t *)obj;
+
+ if((*ret_id = H5A__get_type(attr)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute")
+ break;
+ }
+
+ /* H5Aget_create_plist */
+ case H5VL_ATTR_GET_ACPL:
+ {
+ hid_t *ret_id = HDva_arg(arguments, hid_t *);
+ H5A_t *attr = (H5A_t *)obj;
+
+ if((*ret_id = H5A__get_create_plist(attr)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for attr")
+
+ break;
+ }
+
+ /* H5Aget_name */
+ case H5VL_ATTR_GET_NAME:
+ {
+ const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *);
+ size_t buf_size = HDva_arg(arguments, size_t);
+ char *buf = HDva_arg(arguments, char *);
+ ssize_t *ret_val = HDva_arg(arguments, ssize_t *);
+ H5A_t *attr = NULL;
+
+ if(H5VL_OBJECT_BY_SELF == loc_params->type) {
+ attr = (H5A_t *)obj;
+ /* Call private function in turn */
+ if(0 > (*ret_val = H5A__get_name(attr, buf_size, buf)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name")
+ }
+ else if(H5VL_OBJECT_BY_IDX == loc_params->type) {
+ H5G_loc_t loc;
+
+ /* check arguments */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Open the attribute on the object header */
+ if(NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
+ loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order,
+ loc_params->loc_data.loc_by_idx.n)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
+
+ /* Get the length of the name */
+ *ret_val = (ssize_t)HDstrlen(attr->shared->name);
+
+ /* Copy the name into the user's buffer, if given */
+ if(buf) {
+ HDstrncpy(buf, attr->shared->name, MIN((size_t)(*ret_val + 1), buf_size));
+ if((size_t)(*ret_val) >= buf_size)
+ buf[buf_size - 1]='\0';
+ } /* end if */
+
+ /* Release resources */
+ if(attr && H5A__close(attr) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ }
+ else
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr")
+
+ break;
+ }
+
+ /* H5Aget_info */
+ case H5VL_ATTR_GET_INFO:
+ {
+ const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *);
+ H5A_info_t *ainfo = HDva_arg(arguments, H5A_info_t *);
+ H5A_t *attr = NULL;
+
+ if(H5VL_OBJECT_BY_SELF == loc_params->type) {
+ attr = (H5A_t *)obj;
+ if(H5A__get_info(attr, ainfo) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get attribute info")
+ }
+ else if(H5VL_OBJECT_BY_NAME == loc_params->type) {
+ char *attr_name = HDva_arg(arguments, char *);
+ H5G_loc_t loc;
+
+ /* check arguments */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Open the attribute on the object header */
+ if(NULL == (attr = H5A__open_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
+
+ /* Get the attribute information */
+ if(H5A__get_info(attr, ainfo) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
+
+ /* Release resources */
+ if(attr && H5A__close(attr) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ }
+ else if(H5VL_OBJECT_BY_IDX == loc_params->type) {
+ H5G_loc_t loc;
+
+ /* check arguments */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Open the attribute on the object header */
+ if(NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
+ loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order,
+ loc_params->loc_data.loc_by_idx.n)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
+
+ /* Get the attribute information */
+ if(H5A__get_info(attr, ainfo) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
+
+ /* Release resources */
+ if(attr && H5A__close(attr) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ }
+ else
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr")
+
+ break;
+ }
+
+ case H5VL_ATTR_GET_STORAGE_SIZE:
+ {
+ hsize_t *ret = HDva_arg(arguments, hsize_t *);
+ H5A_t *attr = (H5A_t *)obj;
+
+ /* Set return value */
+ *ret = attr->shared->data_size;
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from attr")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_specific
+ *
+ * Purpose: Handles the attribute specific callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5G_loc_t loc;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Get location for passed-in object */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ switch(specific_type) {
+ case H5VL_ATTR_DELETE:
+ {
+ char *attr_name = HDva_arg(arguments, char *);
+
+ if(H5VL_OBJECT_BY_SELF == loc_params->type) {
+ /* H5Adelete */
+ /* Delete the attribute from the location */
+ if(H5O__attr_remove(loc.oloc, attr_name) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
+ } /* end if */
+ else if(H5VL_OBJECT_BY_NAME == loc_params->type) {
+ /* H5Adelete_by_name */
+ /* Delete the attribute */
+ if(H5A__delete_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
+ } /* end else-if */
+ else if(H5VL_OBJECT_BY_IDX == loc_params->type) {
+ /* H5Adelete_by_idx */
+ /* Delete the attribute from the location */
+ if(H5A__delete_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute remove parameters")
+ break;
+ }
+
+ case H5VL_ATTR_EXISTS:
+ {
+ const char *attr_name = HDva_arg(arguments, const char *);
+ htri_t *ret = HDva_arg(arguments, htri_t *);
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Aexists */
+ /* Check if the attribute exists */
+ if((*ret = H5O__attr_exists(loc.oloc, attr_name)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Aexists_by_name */
+ /* Check if the attribute exists */
+ if((*ret = H5A__exists_by_name(loc, loc_params->loc_data.loc_by_name.name, attr_name)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters")
+ break;
+ }
+
+ case H5VL_ATTR_ITER:
+ {
+ H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */
+ H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */
+ hsize_t *idx = HDva_arg(arguments, hsize_t *);
+ H5A_operator2_t op = HDva_arg(arguments, H5A_operator2_t);
+ void *op_data = HDva_arg(arguments, void *);
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Aiterate2 */
+ /* Iterate over attributes */
+ if((ret_value = H5A__iterate(&loc, ".", idx_type, order, idx, op, op_data)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Aiterate_by_name */
+ /* Iterate over attributes by name */
+ if((ret_value = H5A__iterate(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, idx, op, op_data)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "attribute iteration failed");
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters")
+ break;
+ }
+
+ /* H5Arename/rename_by_name */
+ case H5VL_ATTR_RENAME:
+ {
+ const char *old_name = HDva_arg(arguments, const char *);
+ const char *new_name = HDva_arg(arguments, const char *);
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Arename */
+ /* Call attribute rename routine */
+ if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Arename_by_name */
+ /* Call attribute rename routine */
+ if(H5A__rename_by_name(loc, loc_params->loc_data.loc_by_name.name, old_name, new_name) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute rename parameters")
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_optional
+ *
+ * Purpose: Handles the attribute optional callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_attr_optional(void H5_ATTR_UNUSED *obj, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5VL_native_attr_optional_t optional_type;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ optional_type = HDva_arg(arguments, H5VL_native_attr_optional_t);
+ switch(optional_type) {
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ case H5VL_NATIVE_ATTR_ITERATE_OLD:
+ {
+ hid_t loc_id = HDva_arg(arguments, hid_t);
+ unsigned *attr_num = HDva_arg(arguments, unsigned *);
+ H5A_operator1_t op = HDva_arg(arguments, H5A_operator1_t);
+ void *op_data = HDva_arg(arguments, void *);
+
+ /* Call the actual iteration routine */
+ if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0)
+ HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes");
+
+ break;
+ }
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_close
+ *
+ * Purpose: Handles the attribute close callback
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL (attribute will not be closed)
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_attr_close(void *attr, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ if(H5A__close((H5A_t*)attr) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close attribute")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_close() */
+
diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c
new file mode 100644
index 0000000..8f7351c
--- /dev/null
+++ b/src/H5VLnative_dataset.c
@@ -0,0 +1,575 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Dataset callbacks for the native VOL connector
+ *
+ */
+
+#define H5D_FRIEND /* Suppress error about including H5Dpkg */
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Sprivate.h" /* Dataspaces */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+#include "H5VLnative_private.h" /* Native VOL connector */
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_create
+ *
+ * Purpose: Handles the dataset create callback
+ *
+ * Return: Success: dataset pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5G_loc_t loc; /* Object location to insert dataset into */
+ hid_t type_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t lcpl_id = H5I_INVALID_HID;
+ H5D_t *dset = NULL; /* New dataset's info */
+ const H5S_t *space; /* Dataspace for dataset */
+ void *ret_value;
+
+ FUNC_ENTER_PACKAGE
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
+
+ /* Get creation properties */
+ if(H5P_get(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for datatype id")
+ if(H5P_get(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id")
+ if(H5P_get(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id")
+
+ /* Check arguments */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+ if(H5I_DATATYPE != H5I_get_type(type_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype ID")
+ if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a dataspace ID")
+
+ /* H5Dcreate_anon */
+ if(NULL == name) {
+ /* build and open the new dataset */
+ if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset")
+ } /* end if */
+ /* H5Dcreate2 */
+ else {
+ /* Create the new dataset & get its ID */
+ if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset")
+ } /* end else */
+
+ ret_value = (void *)dset;
+
+done:
+ if(NULL == name) {
+ /* Release the dataset's object header, if it was created */
+ if(dset) {
+ H5O_loc_t *oloc; /* Object location for dataset */
+
+ /* Get the new dataset's object location */
+ if(NULL == (oloc = H5D_oloc(dset)))
+ HDONE_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get object location of dataset")
+
+ /* Decrement refcount on dataset's object header in memory */
+ if(H5O_dec_rc_by_loc(oloc) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object")
+ } /* end if */
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_open
+ *
+ * Purpose: Handles the dataset open callback
+ *
+ * Return: Success: dataset pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL__native_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5D_t *dset = NULL;
+ H5G_loc_t loc; /* Object location of group */
+ void *ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+
+ /* Open the dataset */
+ if(NULL == (dset = H5D__open_name(&loc, name, dapl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open dataset")
+
+ ret_value = (void *)dset;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_read
+ *
+ * Purpose: Handles the dataset read callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id,
+ hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, void *buf,
+ void H5_ATTR_UNUSED **req)
+{
+ H5D_t *dset = (H5D_t *)obj;
+ const H5S_t *mem_space = NULL;
+ const H5S_t *file_space = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check arguments */
+ if(NULL == dset->oloc.file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
+
+ /* Get validated dataspace pointers */
+ if(H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id")
+ if(H5S_get_validated_dataspace(file_space_id, &file_space) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id")
+
+ /* Read raw data */
+ if(H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_write
+ *
+ * Purpose: Handles the dataset write callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id,
+ hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, const void *buf,
+ void H5_ATTR_UNUSED **req)
+{
+ H5D_t *dset = (H5D_t *)obj;
+ const H5S_t *mem_space = NULL;
+ const H5S_t *file_space = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* check arguments */
+ if(NULL == dset->oloc.file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
+
+ /* Get validated dataspace pointers */
+ if(H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id")
+ if(H5S_get_validated_dataspace(file_space_id, &file_space) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id")
+
+ /* Write the data */
+ if(H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_get
+ *
+ * Purpose: Handles the dataset get callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_dataset_get(void *obj, H5VL_dataset_get_t get_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5D_t *dset = (H5D_t *)obj;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ switch(get_type) {
+ /* H5Dget_space */
+ case H5VL_DATASET_GET_SPACE:
+ {
+ hid_t *ret_id = HDva_arg(arguments, hid_t *);
+
+ if((*ret_id = H5D__get_space(dset)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of dataset")
+
+ break;
+ }
+
+ /* H5Dget_space_statuc */
+ case H5VL_DATASET_GET_SPACE_STATUS:
+ {
+ H5D_space_status_t *allocation = HDva_arg(arguments, H5D_space_status_t *);
+
+ /* Read data space address and return */
+ if(H5D__get_space_status(dset, allocation) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status")
+
+ break;
+ }
+
+ /* H5Dget_type */
+ case H5VL_DATASET_GET_TYPE:
+ {
+ hid_t *ret_id = HDva_arg(arguments, hid_t *);
+
+ if((*ret_id = H5D__get_type(dset)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of dataset")
+
+ break;
+ }
+
+ /* H5Dget_create_plist */
+ case H5VL_DATASET_GET_DCPL:
+ {
+ hid_t *ret_id = HDva_arg(arguments, hid_t *);
+
+ if((*ret_id = H5D_get_create_plist(dset)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for dataset")
+
+ break;
+ }
+
+ /* H5Dget_access_plist */
+ case H5VL_DATASET_GET_DAPL:
+ {
+ hid_t *ret_id = HDva_arg(arguments, hid_t *);
+
+ if((*ret_id = H5D_get_access_plist(dset)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get access property list for dataset")
+
+ break;
+ }
+
+ /* H5Dget_storage_size */
+ case H5VL_DATASET_GET_STORAGE_SIZE:
+ {
+ hsize_t *ret = HDva_arg(arguments, hsize_t *);
+
+ /* Set return value */
+ if(H5D__get_storage_size(dset, ret) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage")
+ break;
+ }
+
+ /* H5Dget_offset */
+ case H5VL_DATASET_GET_OFFSET:
+ {
+ haddr_t *ret = HDva_arg(arguments, haddr_t *);
+
+ /* Set return value */
+ *ret = H5D__get_offset(dset);
+ if(!H5F_addr_defined(*ret))
+ *ret = HADDR_UNDEF;
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_specific
+ *
+ * Purpose: Handles the dataset specific callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5D_t *dset = (H5D_t *)obj;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ switch(specific_type) {
+ /* H5Dspecific_space */
+ case H5VL_DATASET_SET_EXTENT:
+ {
+ const hsize_t *size = HDva_arg(arguments, const hsize_t *);
+
+ if(H5D__set_extent(dset, size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extent of dataset")
+ break;
+ }
+
+ case H5VL_DATASET_FLUSH:
+ {
+ hid_t dset_id = HDva_arg(arguments, hid_t);
+
+ /* Flush the dataset */
+ if(H5D__flush(dset, dset_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset")
+
+ break;
+ }
+
+ case H5VL_DATASET_REFRESH:
+ {
+ hid_t dset_id = HDva_arg(arguments, hid_t);
+
+ /* Refresh the dataset */
+ if((H5D__refresh(dset_id, dset)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset")
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_optional
+ *
+ * Purpose: Handles the dataset optional callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5D_t *dset = NULL; /* Dataset */
+ H5VL_native_dataset_optional_t optional_type = HDva_arg(arguments, H5VL_native_dataset_optional_t);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ switch(optional_type) {
+ case H5VL_NATIVE_DATASET_FORMAT_CONVERT:
+ {
+ dset = (H5D_t *)obj;
+
+ switch(dset->shared->layout.type) {
+ case H5D_CHUNKED:
+ /* Convert the chunk indexing type to version 1 B-tree if not */
+ if(dset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE)
+ if((H5D__format_convert(dset)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade chunk indexing type for dataset")
+ break;
+
+ case H5D_CONTIGUOUS:
+ case H5D_COMPACT:
+ /* Downgrade the layout version to 3 if greater than 3 */
+ if(dset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT)
+ if((H5D__format_convert(dset)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade layout version for dataset")
+ break;
+
+ case H5D_VIRTUAL:
+ /* Nothing to do even though layout is version 4 */
+ break;
+
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type")
+
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type")
+ } /* end switch */
+
+ break;
+ }
+
+ case H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE:
+ {
+ H5D_chunk_index_t *idx_type = HDva_arg(arguments, H5D_chunk_index_t *);
+
+ dset = (H5D_t *)obj;
+
+ /* Make sure the dataset is chunked */
+ if(H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* Get the chunk indexing type */
+ *idx_type = dset->shared->layout.u.chunk.idx_type;
+
+ break;
+ }
+
+ case H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE:
+ {
+ hsize_t *offset = HDva_arg(arguments, hsize_t *);
+ hsize_t *chunk_nbytes = HDva_arg(arguments, hsize_t *);
+
+ dset = (H5D_t *)obj;
+
+ /* Make sure the dataset is chunked */
+ if(H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* Call private function */
+ if(H5D__get_chunk_storage_size(dset, offset, chunk_nbytes) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk")
+
+ break;
+ }
+
+ case H5VL_NATIVE_DATASET_CHUNK_READ:
+ {
+ const hsize_t *offset = HDva_arg(arguments, hsize_t *);
+ uint32_t *filters = HDva_arg(arguments, uint32_t *);
+ void *buf = HDva_arg(arguments, void *);
+ hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
+
+ dset = (H5D_t *)obj;
+
+ /* Check arguments */
+ if(NULL == dset->oloc.file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
+ if(H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* Copy the user's offset array so we can be sure it's terminated properly.
+ * (we don't want to mess with the user's buffer).
+ */
+ if(H5D__get_offset_copy(dset, offset, offset_copy) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array")
+
+ /* Read the raw chunk */
+ if(H5D__chunk_direct_read(dset, offset_copy, filters, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data")
+
+ break;
+ }
+
+ case H5VL_NATIVE_DATASET_CHUNK_WRITE:
+ {
+ uint32_t filters = HDva_arg(arguments, uint32_t);
+ const hsize_t *offset = HDva_arg(arguments, const hsize_t *);
+ uint32_t data_size_32 = HDva_arg(arguments, uint32_t);
+ const void *buf = HDva_arg(arguments, const void *);
+ hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
+
+ dset = (H5D_t *)obj;
+
+ /* Check arguments */
+ if(NULL == dset->oloc.file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
+ if(H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* Copy the user's offset array so we can be sure it's terminated properly.
+ * (we don't want to mess with the user's buffer).
+ */
+ if(H5D__get_offset_copy(dset, offset, offset_copy) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array")
+
+ /* Write chunk */
+ if(H5D__chunk_direct_write(dset, filters, offset_copy, data_size_32, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data")
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_close
+ *
+ * Purpose: Handles the dataset close callback
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL (dataset will not be closed)
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_dataset_close(void *dset, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ if(H5D_close((H5D_t*)dset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close dataset")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_close() */
+
diff --git a/src/H5VLnative_datatype.c b/src/H5VLnative_datatype.c
new file mode 100644
index 0000000..3c9463d
--- /dev/null
+++ b/src/H5VLnative_datatype.c
@@ -0,0 +1,265 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Datatype callbacks for the native VOL connector
+ *
+ */
+
+#define H5T_FRIEND /* Suppress error about including H5Tpkg */
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Tpkg.h" /* Datatypes */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+#include "H5VLnative_private.h" /* Native VOL connector */
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_datatype_commit
+ *
+ * Purpose: Handles the datatype commit callback
+ *
+ * Return: Success: datatype pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL__native_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t H5_ATTR_UNUSED tapl_id,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t loc; /* Location to commit datatype */
+ H5T_t *dt; /* Datatype for ID */
+ H5T_t *type = NULL; /* copy of the original type which will be committed */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* check arguments */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
+
+ /* Check arguments. We cannot commit an immutable type because H5Tclose()
+ * normally fails on such types (try H5Tclose(H5T_NATIVE_INT)) but closing
+ * a named type should always succeed.
+ */
+ if(H5T_STATE_NAMED == dt->shared->state || H5T_STATE_OPEN == dt->shared->state)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is already committed")
+ if(H5T_STATE_IMMUTABLE == dt->shared->state)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is immutable")
+
+ /* Check for a "sensible" datatype to store on disk */
+ if(H5T_is_sensible(dt) <= 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "datatype is not sensible")
+
+ /* Copy the datatype - the copied one will be the type that is
+ * committed, and attached to original datatype above the VOL
+ * layer
+ */
+ if(NULL == (type = H5T_copy(dt, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy");
+
+ /* Commit the datatype */
+ if(NULL != name) {
+ /* H5Tcommit */
+ if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype")
+ } /* end if */
+ else {
+ /* H5Tcommit_anon */
+ if(H5T__commit_anon(loc.oloc->file, type, tcpl_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype")
+ } /* end else */
+
+ ret_value = (void *)type;
+
+done:
+ if(NULL == ret_value && type)
+ H5T_close(type);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_datatype_commit() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_datatype_open
+ *
+ * Purpose: Handles the datatype open callback
+ *
+ * Return: Success: datatype pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5T_t *type = NULL; /* Datatype opened in file */
+ H5G_loc_t loc; /* Group location of object to open */
+ void *ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+
+ /* Open the datatype */
+ if(NULL == (type = H5T__open_name(&loc, name)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype")
+
+ type->vol_obj = NULL;
+
+ ret_value = (void *)type;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_datatype_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_datatype_get
+ *
+ * Purpose: Handles the datatype get callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_datatype_get(void *obj, H5VL_datatype_get_t get_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5T_t *dt = (H5T_t *)obj;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ switch (get_type) {
+ case H5VL_DATATYPE_GET_BINARY:
+ {
+ ssize_t *nalloc = HDva_arg(arguments, ssize_t *);
+ void *buf = HDva_arg(arguments, void *);
+ size_t size = HDva_arg(arguments, size_t);
+
+ if(H5T_encode(dt, (unsigned char *)buf, &size) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't determine serialized length of datatype")
+
+ *nalloc = (ssize_t) size;
+ break;
+ }
+
+ /* H5Tget_create_plist */
+ case H5VL_DATATYPE_GET_TCPL:
+ {
+ hid_t *ret_id = HDva_arg(arguments, hid_t *);
+
+ if(H5I_INVALID_HID == (*ret_id = H5T__get_create_plist(dt)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info");
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from datatype")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_datatype_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_datatype_specific
+ *
+ * Purpose: Handles the datatype specific callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5T_t *dt = (H5T_t *)obj;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ switch(specific_type) {
+ case H5VL_DATATYPE_FLUSH:
+ {
+ hid_t type_id = HDva_arg(arguments, hid_t);
+
+ /* To flush metadata and invoke flush callback if there is */
+ if(H5O_flush_common(&dt->oloc, type_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype")
+
+ break;
+ }
+
+ case H5VL_DATATYPE_REFRESH:
+ {
+ hid_t type_id = HDva_arg(arguments, hid_t);
+
+ /* Call private function to refresh datatype object */
+ if((H5O_refresh_metadata(type_id, dt->oloc)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype")
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_datatype_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_datatype_close
+ *
+ * Purpose: Handles the datatype close callback
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL (datatype will not be closed)
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_datatype_close(void *dt, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ if(H5T_close((H5T_t*)dt) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close datatype")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_datatype_close() */
+
diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c
new file mode 100644
index 0000000..624cd30
--- /dev/null
+++ b/src/H5VLnative_file.c
@@ -0,0 +1,830 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: File callbacks for the native VOL connector
+ *
+ */
+
+#define H5F_FRIEND /* Suppress error about including H5Fpkg */
+
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Cprivate.h" /* Cache */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5PBprivate.h" /* Page buffering */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+#include "H5VLnative_private.h" /* Native VOL connector */
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_file_create
+ *
+ * Purpose: Handles the file create callback
+ *
+ * Return: Success: file pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5F_t *new_file = NULL;
+ void *ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
+
+ /* 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
+ * reading and writing.
+ */
+ if(0 == (flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC)))
+ flags |= H5F_ACC_EXCL; /* default */
+ flags |= H5F_ACC_RDWR | H5F_ACC_CREAT;
+
+ /* Create the file */
+ if(NULL == (new_file = H5F_open(name, flags, fcpl_id, fapl_id)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file")
+ new_file->id_exists = TRUE;
+
+ ret_value = (void *)new_file;
+
+done:
+ if(NULL == ret_value && new_file)
+ if(H5F__close(new_file) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_file_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_file_open
+ *
+ * Purpose: Handles the file open callback
+ *
+ * Return: Success: file pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5F_t *new_file = NULL;
+ void *ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
+
+ /* Open the file */
+ if(NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
+ new_file->id_exists = TRUE;
+
+ ret_value = (void *)new_file;
+
+done:
+ if(NULL == ret_value && new_file && H5F_try_close(new_file, NULL) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_file_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_file_get
+ *
+ * Purpose: Handles the file get callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_file_get(void *obj, H5VL_file_get_t get_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5F_t *f = NULL; /* File struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ switch(get_type) {
+ /* H5Fget_access_plist */
+ case H5VL_FILE_GET_FAPL:
+ {
+ H5P_genplist_t *new_plist; /* New property list */
+ hid_t *plist_id = HDva_arg(arguments, hid_t *);
+
+ f = (H5F_t *)obj;
+
+ /* Retrieve the file's access property list */
+ if((*plist_id = H5F_get_access_plist(f, TRUE)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file access property list")
+
+ if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(*plist_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ break;
+ }
+
+ /* H5Fget_create_plist */
+ case H5VL_FILE_GET_FCPL:
+ {
+ H5P_genplist_t *plist; /* Property list */
+ hid_t *plist_id = HDva_arg(arguments, hid_t *);
+
+ f = (H5F_t *)obj;
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Create the property list object to return */
+ if((*plist_id = H5P_copy_plist(plist, TRUE)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy file creation properties")
+
+ break;
+ }
+
+ /* H5Fget_obj_count */
+ case H5VL_FILE_GET_OBJ_COUNT:
+ {
+ unsigned types = HDva_arg(arguments, unsigned);
+ ssize_t *ret = HDva_arg(arguments, ssize_t *);
+ size_t obj_count = 0; /* Number of opened objects */
+
+ f = (H5F_t *)obj;
+ /* Perform the query */
+ if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
+
+ /* Set the return value */
+ *ret = (ssize_t)obj_count;
+ break;
+ }
+
+ /* H5Fget_obj_ids */
+ case H5VL_FILE_GET_OBJ_IDS:
+ {
+ unsigned types = HDva_arg(arguments, unsigned);
+ size_t max_objs = HDva_arg(arguments, size_t);
+ hid_t *oid_list = HDva_arg(arguments, hid_t *);
+ ssize_t *ret = HDva_arg(arguments, ssize_t *);
+ size_t obj_count = 0; /* Number of opened objects */
+
+ f = (H5F_t *)obj;
+ /* Perform the query */
+ if(H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_count) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed")
+
+ /* Set the return value */
+ *ret = (ssize_t)obj_count;
+ break;
+ }
+
+ /* H5Fget_intent */
+ case H5VL_FILE_GET_INTENT:
+ {
+ unsigned *intent_flags = HDva_arg(arguments, unsigned *);
+
+ f = (H5F_t *)obj;
+
+ /* HDF5 uses some flags internally that users don't know about.
+ * Simplify things for them so that they only get either H5F_ACC_RDWR
+ * or H5F_ACC_RDONLY and any SWMR flags.
+ */
+ if(H5F_INTENT(f) & H5F_ACC_RDWR) {
+ *intent_flags = H5F_ACC_RDWR;
+
+ /* Check for SWMR write access on the file */
+ if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)
+ *intent_flags |= H5F_ACC_SWMR_WRITE;
+ } /* end if */
+ else {
+ *intent_flags = H5F_ACC_RDONLY;
+
+ /* Check for SWMR read access on the file */
+ if(H5F_INTENT(f) & H5F_ACC_SWMR_READ)
+ *intent_flags |= H5F_ACC_SWMR_READ;
+ } /* end else */
+
+ break;
+ }
+
+ /* H5Fget_name */
+ case H5VL_FILE_GET_NAME:
+ {
+ H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
+ size_t size = HDva_arg(arguments, size_t);
+ char *name = HDva_arg(arguments, char *);
+ ssize_t *ret = HDva_arg(arguments, ssize_t *);
+ size_t len;
+
+ if(NULL == (f = H5F__get_file(obj, type)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ len = HDstrlen(H5F_OPEN_NAME(f));
+
+ if(name) {
+ HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1,size));
+ if(len >= size)
+ name[size-1]='\0';
+ } /* end if */
+
+ /* Set the return value for the API call */
+ *ret = (ssize_t)len;
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_file_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_file_specific
+ *
+ * Purpose: Handles the file specific callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ switch(specific_type) {
+ /* H5Fflush */
+ case H5VL_FILE_FLUSH:
+ {
+ H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
+ H5F_scope_t scope = (H5F_scope_t)HDva_arg(arguments, int); /* enum work-around */
+ H5F_t *f = NULL; /* File to flush */
+
+ /* Get the file for the object */
+ if(NULL == (f = H5F__get_file(obj, type)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Nothing to do if the file is read only. This determination is
+ * made at the shared open(2) flags level, implying that opening a
+ * file twice, once for read-only and once for read-write, and then
+ * calling H5Fflush() with the read-only handle, still causes data
+ * to be flushed.
+ */
+ if(H5F_ACC_RDWR & H5F_INTENT(f)) {
+ /* Flush other files, depending on scope */
+ if(H5F_SCOPE_GLOBAL == scope) {
+ /* Call the flush routine for mounted file hierarchies */
+ if(H5F_flush_mounts(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy")
+ } /* end if */
+ else {
+ /* Call the flush routine, for this file */
+ if(H5F__flush(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
+ } /* end else */
+ } /* end if */
+ break;
+ }
+
+ /* H5Freopen */
+ case H5VL_FILE_REOPEN:
+ {
+ void **ret = HDva_arg(arguments, void **);
+ H5F_t *new_file = NULL;
+
+ /* Reopen the file through the VOL connector */
+ if(NULL == (new_file = H5F__reopen((H5F_t *)obj)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file")
+ new_file->id_exists = TRUE;
+
+ *ret = (void *)new_file;
+ break;
+ }
+
+ /* H5Fmount */
+ case H5VL_FILE_MOUNT:
+ {
+ H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
+ const char *name = HDva_arg(arguments, const char *);
+ H5F_t *child = HDva_arg(arguments, H5F_t *);
+ hid_t plist_id = HDva_arg(arguments, hid_t);
+ H5G_loc_t loc;
+
+ if(H5G_loc_real(obj, type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Do the mount */
+ if(H5F__mount(&loc, name, child, plist_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
+
+ break;
+ }
+
+ /* H5Funmount */
+ case H5VL_FILE_UNMOUNT:
+ {
+ H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
+ const char *name = HDva_arg(arguments, const char *);
+ H5G_loc_t loc;
+
+ if(H5G_loc_real(obj, type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Unmount */
+ if(H5F__unmount(&loc, name) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file")
+
+ break;
+ }
+
+ /* H5Fis_accessible */
+ case H5VL_FILE_IS_ACCESSIBLE:
+ {
+ hid_t fapl_id = HDva_arg(arguments, hid_t);
+ const char *name = HDva_arg(arguments, const char *);
+ htri_t *ret = HDva_arg(arguments, htri_t *);
+
+ /* Call private routine */
+ if((*ret = H5F__is_hdf5(name, fapl_id)) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "error in HDF5 file check")
+ break;
+ }
+
+
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_file_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_file_optional
+ *
+ * Purpose: Handles the file optional callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5F_t *f = NULL; /* File */
+ H5VL_native_file_optional_t optional_type = HDva_arg(arguments, H5VL_native_file_optional_t);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ f = (H5F_t *)obj;
+ switch(optional_type) {
+ /* H5Fget_filesize */
+ case H5VL_NATIVE_FILE_GET_SIZE:
+ {
+ haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */
+ haddr_t base_addr; /* Base address for the file */
+ hsize_t *size = HDva_arg(arguments, hsize_t *);
+
+ /* Go get the actual file size */
+ if(H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ")
+
+ base_addr = H5FD_get_base_addr(f->shared->lf);
+
+ if(size)
+ *size = (hsize_t)(max_eof_eoa + base_addr); /* Convert relative base address for file to absolute address */
+
+ break;
+ }
+
+ /* H5Fget_file_image */
+ case H5VL_NATIVE_FILE_GET_FILE_IMAGE:
+ {
+ void *buf_ptr = HDva_arg(arguments, void *);
+ ssize_t *ret = HDva_arg(arguments, ssize_t *);
+ size_t buf_len = HDva_arg(arguments, size_t );
+
+ /* Do the actual work */
+ if((*ret = H5F__get_file_image(f, buf_ptr, buf_len)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get file image failed")
+ break;
+ }
+
+ /* H5Fget_freespace */
+ case H5VL_NATIVE_FILE_GET_FREE_SPACE:
+ {
+ hsize_t tot_space; /* Amount of free space in the file */
+ hssize_t *ret = HDva_arg(arguments, hssize_t *);
+
+ /* Go get the actual amount of free space in the file */
+ if(H5MF_get_freespace(f, &tot_space, NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
+ *ret = (hssize_t)tot_space;
+ break;
+ }
+
+ /* H5Fget_free_sections */
+ case H5VL_NATIVE_FILE_GET_FREE_SECTIONS:
+ {
+ H5F_sect_info_t *sect_info = HDva_arg(arguments, H5F_sect_info_t *);
+ ssize_t *ret = HDva_arg(arguments, ssize_t *);
+ H5F_mem_t type = (H5F_mem_t)HDva_arg(arguments, int); /* enum work-around */
+ size_t nsects = HDva_arg(arguments, size_t);
+
+ /* Go get the free-space section information in the file */
+ if((*ret = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
+ break;
+ }
+
+ /* H5Fget_info1/2 */
+ case H5VL_NATIVE_FILE_GET_INFO:
+ {
+ H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
+ H5F_info2_t *finfo = HDva_arg(arguments, H5F_info2_t *);
+
+ /* Get the file struct. This call is careful to not return the file pointer
+ * for the top file in a mount hierarchy.
+ */
+ if(NULL == (f = H5F__get_file(obj, type)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct")
+
+ /* Get the file info */
+ if(H5F__get_info(f, finfo) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
+
+ break;
+ }
+
+ /* H5Fget_mdc_config */
+ case H5VL_NATIVE_FILE_GET_MDC_CONF:
+ {
+ H5AC_cache_config_t *config_ptr = HDva_arg(arguments, H5AC_cache_config_t *);
+
+ /* Go get the resize configuration */
+ if(H5AC_get_cache_auto_resize_config(f->shared->cache, config_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.")
+ break;
+ }
+
+ /* H5Fget_mdc_hit_rate */
+ case H5VL_NATIVE_FILE_GET_MDC_HR:
+ {
+ double *hit_rate_ptr = HDva_arg(arguments, double *);
+
+ /* Go get the current hit rate */
+ if(H5AC_get_cache_hit_rate(f->shared->cache, hit_rate_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.")
+ break;
+ }
+
+ /* H5Fget_mdc_size */
+ case H5VL_NATIVE_FILE_GET_MDC_SIZE:
+ {
+ size_t *max_size_ptr = HDva_arg(arguments, size_t *);
+ size_t *min_clean_size_ptr = HDva_arg(arguments, size_t *);
+ size_t *cur_size_ptr = HDva_arg(arguments, size_t *);
+ int *cur_num_entries_ptr = HDva_arg(arguments, int *);
+ uint32_t cur_num_entries;
+
+ /* Go get the size data */
+ if(H5AC_get_cache_size(f->shared->cache, max_size_ptr, min_clean_size_ptr,
+ cur_size_ptr, &cur_num_entries) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.")
+
+ if(cur_num_entries_ptr != NULL)
+ *cur_num_entries_ptr = (int)cur_num_entries;
+ break;
+ }
+
+ /* H5Fget_vfd_handle */
+ case H5VL_NATIVE_FILE_GET_VFD_HANDLE:
+ {
+ void **file_handle = HDva_arg(arguments, void **);
+ hid_t fapl_id = HDva_arg(arguments, hid_t);
+
+ /* Retrieve the VFD handle for the file */
+ if(H5F_get_vfd_handle(f, fapl_id, file_handle) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle")
+ break;
+ }
+
+ /* H5Iget_file_id */
+ case H5VL_NATIVE_FILE_GET_FILE_ID:
+ {
+ H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
+ hid_t *file_id = HDva_arg(arguments, hid_t *);
+
+ if(NULL == (f = H5F__get_file(obj, type)))
+ HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file or file object")
+ if((*file_id = H5F__get_file_id(f)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file ID")
+ break;
+ }
+
+ /* H5Fclear_elink_file_cache */
+ case H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE:
+ {
+ /* Release the EFC */
+ if(f->shared->efc)
+ if(H5F__efc_release(f->shared->efc) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
+ break;
+ }
+
+ /* H5Freset_mdc_hit_rate_stats */
+ case H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE:
+ {
+ /* Reset the hit rate statistic */
+ if(H5AC_reset_cache_hit_rate_stats(f->shared->cache) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate")
+ break;
+ }
+
+ /* H5Fset_mdc_config */
+ case H5VL_NATIVE_FILE_SET_MDC_CONFIG:
+ {
+ H5AC_cache_config_t *config_ptr = HDva_arg(arguments, H5AC_cache_config_t *);
+
+ /* set the resize configuration */
+ if(H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed")
+ break;
+ }
+
+ /* H5Fget_metadata_read_retry_info */
+ case H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO:
+ {
+ H5F_retry_info_t *info = HDva_arg(arguments, H5F_retry_info_t *);
+
+ if(H5F_get_metadata_read_retry_info(f, info) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't get metadata read retry info")
+
+ break;
+ }
+
+ /* H5Fstart_swmr_write */
+ case H5VL_NATIVE_FILE_START_SWMR_WRITE:
+ {
+ if(H5F__start_swmr_write(f) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't start SWMR write")
+
+ break;
+ }
+
+ /* H5Fstart_mdc_logging */
+ case H5VL_NATIVE_FILE_START_MDC_LOGGING:
+ {
+ /* Call mdc logging function */
+ if(H5C_start_logging(f->shared->cache) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to start mdc logging")
+
+ break;
+ }
+
+ /* H5Fstop_mdc_logging */
+ case H5VL_NATIVE_FILE_STOP_MDC_LOGGING:
+ {
+ /* Call mdc logging function */
+ if(H5C_stop_logging(f->shared->cache) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to stop mdc logging")
+
+ break;
+ }
+
+ /* H5Fget_mdc_logging_status */
+ case H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS:
+ {
+ hbool_t *is_enabled = HDva_arg(arguments, hbool_t *);
+ hbool_t *is_currently_logging = HDva_arg(arguments, hbool_t *);
+
+ /* Call mdc logging function */
+ if(H5C_get_logging_status(f->shared->cache, is_enabled, is_currently_logging) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to get logging status")
+
+ break;
+ }
+
+ /* H5Fformat_convert */
+ case H5VL_NATIVE_FILE_FORMAT_CONVERT:
+ {
+ /* Convert the format */
+ if(H5F__format_convert(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format")
+
+ break;
+ }
+
+ /* H5Freset_page_buffering_stats */
+ case H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS:
+ {
+ /* Sanity check */
+ if(NULL == f->shared->page_buf)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file")
+
+ /* Reset the statistics */
+ if(H5PB_reset_stats(f->shared->page_buf) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't reset stats for page buffering")
+
+ break;
+ }
+
+ /* H5Fget_page_buffering_stats */
+ case H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS:
+ {
+ unsigned *accesses = HDva_arg(arguments, unsigned *);
+ unsigned *hits = HDva_arg(arguments, unsigned *);
+ unsigned *misses = HDva_arg(arguments, unsigned *);
+ unsigned *evictions = HDva_arg(arguments, unsigned *);
+ unsigned *bypasses = HDva_arg(arguments, unsigned *);
+
+ /* Sanity check */
+ if(NULL == f->shared->page_buf)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file")
+
+ /* Get the statistics */
+ if(H5PB_get_stats(f->shared->page_buf, accesses, hits, misses, evictions, bypasses) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering")
+
+ break;
+ }
+
+ /* H5Fget_mdc_image_info */
+ case H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO:
+ {
+ haddr_t *image_addr = HDva_arg(arguments, haddr_t *);
+ hsize_t *image_len = HDva_arg(arguments, hsize_t *);
+
+ /* Go get the address and size of the cache image */
+ if(H5AC_get_mdc_image_info(f->shared->cache, image_addr, image_len) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
+
+ break;
+ }
+
+ /* H5Fget_eoa */
+ case H5VL_NATIVE_FILE_GET_EOA:
+ {
+ haddr_t *eoa = HDva_arg(arguments, haddr_t *);
+ haddr_t rel_eoa; /* Relative address of EOA */
+
+ /* Sanity check */
+ HDassert(eoa);
+
+ /* This routine will work only for drivers with this feature enabled.*/
+ /* We might introduce a new feature flag in the future */
+ if(!H5F_HAS_FEATURE(f, H5FD_FEAT_SUPPORTS_SWMR_IO))
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine")
+
+ /* The real work */
+ if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed")
+
+ /* Set return value */
+ /* (Note compensating for base address subtraction in internal routine) */
+ *eoa = rel_eoa + H5F_get_base_addr(f);
+
+ break;
+ }
+
+ /* H5Fincrement_filesize */
+ case H5VL_NATIVE_FILE_INCR_FILESIZE:
+ {
+ hsize_t increment = HDva_arg(arguments, hsize_t);
+ haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */
+
+ /* 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(f, 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(f, &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 */
+ if(H5F__set_eoa(f, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed")
+
+ break;
+ }
+
+ /* H5Fset_latest_format, H5Fset_libver_bounds */
+ case H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS:
+ {
+ H5F_libver_t low = (H5F_libver_t)HDva_arg(arguments, int); /* enum work-around */
+ H5F_libver_t high = (H5F_libver_t)HDva_arg(arguments, int); /* enum work-around */
+
+ /* 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")
+
+ break;
+ }
+
+ /* H5Fget_dset_no_attrs_hint */
+ case H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG:
+ {
+ hbool_t *minimize = HDva_arg(arguments, hbool_t *);
+ *minimize = H5F_GET_MIN_DSET_OHDR(f);
+ break;
+ }
+
+ /* H5Fset_dset_no_attrs_hint */
+ case H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG:
+ {
+ int minimize = HDva_arg(arguments, int);
+ if(H5F_set_min_dset_ohdr(f, (hbool_t)minimize) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set file's dataset object header minimization flag")
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_file_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_file_close
+ *
+ * Purpose: Handles the file close callback
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL (file will not be closed)
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
+{
+ int nref;
+ H5F_t *f = (H5F_t *)file;
+ hid_t file_id = H5I_INVALID_HID;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* This routine should only be called when a file ID's ref count drops to zero */
+ HDassert(H5F_ID_EXISTS(f));
+
+ /* Flush file if this is the last reference to this id and we have write
+ * intent, unless it will be flushed by the "shared" file being closed.
+ * This is only necessary to replicate previous behaviour, and could be
+ * disabled by an option/property to improve performance.
+ */
+ if((H5F_NREFS(f) > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) {
+ /* Get the file ID corresponding to the H5F_t struct */
+ if(H5I_find_id(f, H5I_FILE, &file_id) < 0 || H5I_INVALID_HID == file_id)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "invalid atom")
+
+ /* Get the number of references outstanding for this file ID */
+ if((nref = H5I_get_ref(file_id, FALSE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count")
+ if(nref == 1)
+ if(H5F__flush(f) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
+ } /* end if */
+
+ /* Close the file */
+ if(H5F__close(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_file_close() */
+
diff --git a/src/H5VLnative_group.c b/src/H5VLnative_group.c
new file mode 100644
index 0000000..9c07b3d
--- /dev/null
+++ b/src/H5VLnative_group.c
@@ -0,0 +1,363 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Group callbacks for the native VOL connector
+ *
+ */
+
+#define H5G_FRIEND /* Suppress error about including H5Gpkg */
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+#include "H5VLnative_private.h" /* Native VOL connector */
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_group_create
+ *
+ * Purpose: Handles the group create callback
+ *
+ * Return: Success: group pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t gcpl_id, hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5G_loc_t loc; /* Location to create group */
+ H5G_t *grp = NULL; /* New group created */
+ hid_t lcpl_id;
+ void *ret_value;
+
+ FUNC_ENTER_PACKAGE
+
+ /* Get the property list structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
+
+ /* Get creation properties */
+ if(H5P_get(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id")
+
+ /* Set up the location */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+
+ /* if name is NULL then this is from H5Gcreate_anon */
+ if(name == NULL) {
+ H5G_obj_create_t gcrt_info; /* Information for group creation */
+
+ /* Set up group creation info */
+ gcrt_info.gcpl_id = gcpl_id;
+ gcrt_info.cache_type = H5G_NOTHING_CACHED;
+ HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache));
+
+ /* Create the new group & get its ID */
+ if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group")
+ } /* end if */
+ /* otherwise it's from H5Gcreate */
+ else {
+ /* Create the new group & get its ID */
+ if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group")
+ } /* end else */
+
+ ret_value = (void *)grp;
+
+done:
+ if(name == NULL) {
+ /* Release the group's object header, if it was created */
+ if(grp) {
+ H5O_loc_t *oloc; /* Object location for group */
+
+ /* Get the new group's object location */
+ if(NULL == (oloc = H5G_oloc(grp)))
+ HDONE_ERROR(H5E_SYM, H5E_CANTGET, NULL, "unable to get object location of group")
+
+ /* Decrement refcount on group's object header in memory */
+ if(H5O_dec_rc_by_loc(oloc) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object")
+ } /* end if */
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_group_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_group_open
+ *
+ * Purpose: Handles the group open callback
+ *
+ * Return: Success: group pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t loc; /* Location to open group */
+ H5G_t *grp = NULL; /* New group opend */
+ void *ret_value;
+
+ FUNC_ENTER_PACKAGE
+
+ /* Set up the location */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+
+ /* Open the group */
+ if((grp = H5G__open_name(&loc, name)) == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group")
+
+ ret_value = (void *)grp;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_group_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_group_get
+ *
+ * Purpose: Handles the group get callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_group_get(void *obj, H5VL_group_get_t get_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ switch(get_type) {
+ /* H5Gget_create_plist */
+ case H5VL_GROUP_GET_GCPL:
+ {
+ hid_t *new_gcpl_id = HDva_arg(arguments, hid_t *);
+ H5G_t *grp = (H5G_t *)obj;
+
+ if((*new_gcpl_id = H5G_get_create_plist(grp)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for group")
+ break;
+ }
+
+ /* H5Gget_info */
+ case H5VL_GROUP_GET_INFO:
+ {
+ const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *);
+ H5G_info_t *group_info = HDva_arg(arguments, H5G_info_t *);
+ H5G_loc_t loc;
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) {
+ /* H5Gget_info */
+
+ /* Retrieve the group's information */
+ if(H5G__obj_info(loc.oloc, group_info) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) {
+ /* H5Gget_info_by_name */
+
+ /* Retrieve the group's information */
+ if(H5G__get_info_by_name(&loc, loc_params->loc_data.loc_by_name.name, group_info) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
+ } /* end else-if */
+ else if(loc_params->type == H5VL_OBJECT_BY_IDX) {
+ /* H5Gget_info_by_idx */
+
+ /* Retrieve the group's information */
+ if(H5G__get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, group_info) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters")
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_group_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_group_specific
+ *
+ * Purpose: Handles the group specific callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5G_t *grp = (H5G_t *)obj;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ switch(specific_type) {
+ case H5VL_GROUP_FLUSH:
+ {
+ hid_t group_id = HDva_arg(arguments, hid_t);
+
+ /* Flush object's metadata to file */
+ if(H5O_flush_common(&grp->oloc, group_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group")
+
+ break;
+ }
+
+ case H5VL_GROUP_REFRESH:
+ {
+ hid_t group_id = HDva_arg(arguments, hid_t);
+
+ /* Call private function to refresh group object */
+ if((H5O_refresh_metadata(group_id, grp->oloc)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_group_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_group_optional
+ *
+ * Purpose: Handles the group optional callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_group_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5VL_native_group_optional_t optional_type;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ optional_type = HDva_arg(arguments, H5VL_native_group_optional_t);
+ switch(optional_type) {
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ /* H5Giterate (deprecated) */
+ case H5VL_NATIVE_GROUP_ITERATE_OLD:
+ {
+ const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *);
+ hsize_t idx = HDva_arg(arguments, hsize_t);
+ hsize_t *last_obj = HDva_arg(arguments, hsize_t *);
+ const H5G_link_iterate_t *lnk_op = HDva_arg(arguments, const H5G_link_iterate_t *);
+ void *op_data = HDva_arg(arguments, void *);
+ H5G_loc_t grp_loc;
+
+ /* Get the location struct for the object */
+ if(H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Call the actual iteration routine */
+ if((ret_value = H5G_iterate(&grp_loc, loc_params->loc_data.loc_by_name.name, H5_INDEX_NAME, H5_ITER_INC, idx, last_obj, lnk_op, op_data)) < 0)
+ HERROR(H5E_VOL, H5E_BADITER, "error iterating over group's links");
+
+ break;
+ }
+
+ /* H5Gget_objinfo (deprecated) */
+ case H5VL_NATIVE_GROUP_GET_OBJINFO:
+ {
+ const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *);
+ hbool_t follow_link = (hbool_t)HDva_arg(arguments, unsigned);
+ H5G_stat_t *statbuf = HDva_arg(arguments, H5G_stat_t *);
+ H5G_loc_t grp_loc;
+
+ /* Get the location struct for the object */
+ if(H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Call the actual group objinfo routine */
+ if(H5G__get_objinfo(&grp_loc, loc_params->loc_data.loc_by_name.name, follow_link, statbuf) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object")
+
+ break;
+ }
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_group_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_group_close
+ *
+ * Purpose: Handles the group close callback
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL (group will not be closed)
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_group_close(void *grp, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ if(H5G_close((H5G_t *)grp) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close group")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_group_close() */
+
diff --git a/src/H5VLnative_link.c b/src/H5VLnative_link.c
new file mode 100644
index 0000000..98d2ccd
--- /dev/null
+++ b/src/H5VLnative_link.c
@@ -0,0 +1,435 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Link callbacks for the native VOL connector
+ *
+ */
+
+#define H5L_FRIEND /* Suppress error about including H5Lpkg */
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lpkg.h" /* Links */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+#include "H5VLnative_private.h" /* Native VOL connector */
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_link_create
+ *
+ * Purpose: Handles the link create callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj,
+ const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ switch(create_type) {
+ case H5VL_LINK_CREATE_HARD:
+ {
+ H5G_loc_t cur_loc;
+ H5G_loc_t link_loc;
+ void *cur_obj;
+ H5VL_loc_params_t cur_params;
+
+ if(H5P_get(plist, H5VL_PROP_LINK_TARGET, &cur_obj) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for current location id")
+ if(H5P_get(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &cur_params) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for current name")
+
+ if(NULL != cur_obj && H5G_loc_real(cur_obj, cur_params.obj_type, &cur_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ if(NULL != obj && H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* H5Lcreate_hard */
+ if(H5VL_OBJECT_BY_NAME == cur_params.type) {
+ H5G_loc_t *cur_loc_p, *link_loc_p;
+
+ /* Set up current & new location pointers */
+ cur_loc_p = &cur_loc;
+ link_loc_p = &link_loc;
+ if(NULL == cur_obj)
+ cur_loc_p = link_loc_p;
+ else if(NULL == obj)
+ link_loc_p = cur_loc_p;
+ else if(cur_loc_p->oloc->file != link_loc_p->oloc->file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.")
+
+ /* Create the link */
+ if((ret_value = H5L_create_hard(cur_loc_p, cur_params.loc_data.loc_by_name.name,
+ link_loc_p, loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
+ } /* end if */
+ else { /* H5Olink */
+ /* Link to the object */
+ if(H5L_link(&link_loc, loc_params->loc_data.loc_by_name.name, &cur_loc, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link")
+ } /* end else */
+ break;
+ }
+
+ case H5VL_LINK_CREATE_SOFT:
+ {
+ char *target_name;
+ H5G_loc_t link_loc; /* Group location for new link */
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ if(H5P_get(plist, H5VL_PROP_LINK_TARGET_NAME, &target_name) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for targe name")
+
+ /* Create the link */
+ if((ret_value = H5L_create_soft(target_name, &link_loc, loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
+ break;
+ }
+
+ case H5VL_LINK_CREATE_UD:
+ {
+ H5G_loc_t link_loc; /* Group location for new link */
+ H5L_type_t link_type;
+ void *udata;
+ size_t udata_size;
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ if(H5P_get(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for link type")
+ if(H5P_get(plist, H5VL_PROP_LINK_UDATA, &udata) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for udata")
+ if(H5P_get(plist, H5VL_PROP_LINK_UDATA_SIZE, &udata_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for udata size")
+
+ /* Create link */
+ if(H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, udata, udata_size,
+ link_type, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "invalid link creation call")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_link_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_link_copy
+ *
+ * Purpose: Handles the link copy callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id,
+ hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t src_loc, *src_loc_p;
+ H5G_loc_t dst_loc, *dst_loc_p;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ if(NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Set up src & dst location pointers */
+ src_loc_p = &src_loc;
+ dst_loc_p = &dst_loc;
+ if(NULL == src_obj)
+ src_loc_p = dst_loc_p;
+ else if(NULL == dst_obj)
+ dst_loc_p = src_loc_p;
+
+ /* Copy the link */
+ if(H5L_move(src_loc_p, loc_params1->loc_data.loc_by_name.name,
+ dst_loc_p, loc_params2->loc_data.loc_by_name.name,
+ TRUE, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_link_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_link_move
+ *
+ * Purpose: Handles the link move callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id,
+ hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t src_loc, *src_loc_p;
+ H5G_loc_t dst_loc, *dst_loc_p;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ if(NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Set up src & dst location pointers */
+ src_loc_p = &src_loc;
+ dst_loc_p = &dst_loc;
+ if(NULL == src_obj)
+ src_loc_p = dst_loc_p;
+ else if(NULL == dst_obj)
+ dst_loc_p = src_loc_p;
+
+ /* Move the link */
+ if(H5L_move(src_loc_p, loc_params1->loc_data.loc_by_name.name,
+ dst_loc_p, loc_params2->loc_data.loc_by_name.name,
+ FALSE, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_link_move() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_link_get
+ *
+ * Purpose: Handles the link get callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5G_loc_t loc;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ switch(get_type) {
+ /* H5Lget_info/H5Lget_info_by_idx */
+ case H5VL_LINK_GET_INFO:
+ {
+ H5L_info_t *linfo = HDva_arg(arguments, H5L_info_t *);
+
+ /* Get the link information */
+ if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_info */
+ if(H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, linfo) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_info_by_idx */
+ if(H5L_get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, linfo) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
+ break;
+ }
+
+ /* H5Lget_name_by_idx */
+ case H5VL_LINK_GET_NAME:
+ {
+ char *name = HDva_arg(arguments, char *);
+ size_t size = HDva_arg(arguments, size_t);
+ ssize_t *ret = HDva_arg(arguments, ssize_t *);
+
+ /* Get the link name */
+ if((*ret = H5L_get_name_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, name, size)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
+
+ break;
+ }
+
+ /* H5Lget_val/H5Lget_val_by_idx */
+ case H5VL_LINK_GET_VAL:
+ {
+ void *buf = HDva_arg(arguments, void *);
+ size_t size = HDva_arg(arguments, size_t);
+
+ /* Get the link information */
+ if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_val */
+ if(H5L_get_val(&loc, loc_params->loc_data.loc_by_name.name, buf, size) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link value")
+ }
+ else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_val_by_idx */
+
+ if(H5L_get_val_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, buf, size) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val")
+ }
+ else
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val")
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from link")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_link_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_link_specific
+ *
+ * Purpose: Handles the link specific callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ switch(specific_type) {
+ case H5VL_LINK_EXISTS:
+ {
+ htri_t *ret = HDva_arg(arguments, htri_t *);
+ H5G_loc_t loc;
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Check for the existence of the link */
+ if((*ret = H5L_exists(&loc, loc_params->loc_data.loc_by_name.name)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info")
+ break;
+ }
+
+ case H5VL_LINK_ITER:
+ {
+ H5G_loc_t loc;
+ hbool_t recursive = (hbool_t)HDva_arg(arguments, unsigned);
+ H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */
+ H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */
+ hsize_t *idx_p = HDva_arg(arguments, hsize_t *);
+ H5L_iterate_t op = HDva_arg(arguments, H5L_iterate_t);
+ void *op_data = HDva_arg(arguments, void *);
+
+ /* Get the location */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+
+ /* Visit or iterate over the links */
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) {
+ if(recursive) {
+ /* H5Lvisit */
+ if((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
+ } /* end if */
+ else {
+ /* H5Literate */
+ if((ret_value = H5L_iterate(&loc, ".", idx_type, order, idx_p, op, op_data)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links")
+ } /* end else */
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) {
+ if(recursive) {
+ /* H5Lvisit_by_name */
+ if((ret_value = H5G_visit(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, op, op_data)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
+ } /* end if */
+ else {
+ /* H5Literate_by_name */
+ if((ret_value = H5L_iterate(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, idx_p, op, op_data)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links")
+ } /* end else */
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_LINK, H5E_UNSUPPORTED, FAIL, "unknown link iterate params")
+
+ break;
+ }
+
+ case H5VL_LINK_DELETE:
+ {
+ H5G_loc_t loc;
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Unlink */
+ if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Ldelete */
+ if(H5L_delete(&loc, loc_params->loc_data.loc_by_name.name) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Ldelete_by_idx */
+ if(H5L_delete_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_link_specific() */
+
diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c
new file mode 100644
index 0000000..0b1d73a
--- /dev/null
+++ b/src/H5VLnative_object.c
@@ -0,0 +1,482 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Object callbacks for the native VOL connector
+ *
+ */
+
+#define H5O_FRIEND /* Suppress error about including H5Opkg */
+#define H5R_FRIEND /* Suppress error about including H5Rpkg */
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Opkg.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Rpkg.h" /* References */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+#include "H5VLnative_private.h" /* Native VOL connector */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_object_open
+ *
+ * Purpose: Handles the object open callback
+ *
+ * Return: Success: object pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t loc;
+ void *ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+
+ switch(loc_params->type) {
+ case H5VL_OBJECT_BY_NAME:
+ {
+ /* Open the object */
+ if(NULL == (ret_value = H5O_open_name(&loc, loc_params->loc_data.loc_by_name.name, opened_type)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by name")
+ break;
+ }
+
+ case H5VL_OBJECT_BY_IDX:
+ {
+ /* Open the object */
+ if(NULL == (ret_value = H5O_open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, opened_type)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by index")
+ break;
+ }
+
+ case H5VL_OBJECT_BY_ADDR:
+ {
+ /* Open the object */
+ if(NULL == (ret_value = H5O_open_by_addr(&loc, loc_params->loc_data.loc_by_addr.addr, opened_type)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by address")
+ break;
+ }
+
+ case H5VL_OBJECT_BY_REF:
+ {
+ hid_t temp_id = H5I_INVALID_HID;
+ H5F_t *file = NULL;
+
+ /* Get the file pointer from the entry */
+ file = loc.oloc->file;
+
+ /* Create reference */
+ if((temp_id = H5R__dereference(file, loc_params->loc_data.loc_by_ref.lapl_id,
+ loc_params->loc_data.loc_by_ref.ref_type,
+ loc_params->loc_data.loc_by_ref._ref)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, NULL, "unable to dereference object")
+
+ *opened_type = H5I_get_type(temp_id);
+ if(NULL == (ret_value = H5I_remove(temp_id)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object")
+ break;
+ }
+
+ case H5VL_OBJECT_BY_SELF:
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown open parameters")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_object_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_object_copy
+ *
+ * Purpose: Handles the object copy callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_object_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name,
+ hid_t ocpypl_id, hid_t lcpl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t src_loc; /* Source object group location */
+ H5G_loc_t dst_loc; /* Destination group location */
+ herr_t ret_value = FAIL;
+
+ FUNC_ENTER_PACKAGE
+
+ /* get location for objects */
+ if(H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ if(H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Copy the object */
+ if((ret_value = H5O_copy(&src_loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_object_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_object_get
+ *
+ * Purpose: Handles the object get callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+ H5G_loc_t loc; /* Location of group */
+
+ FUNC_ENTER_PACKAGE
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ switch(get_type) {
+ /* H5Rget_region */
+ case H5VL_REF_GET_REGION:
+ {
+ hid_t *ret = HDva_arg(arguments, hid_t *);
+ H5R_type_t H5_ATTR_UNUSED ref_type = (H5R_type_t)HDva_arg(arguments, int); /* enum work-around */
+ void *ref = HDva_arg(arguments, void *);
+ H5S_t *space = NULL; /* Dataspace object */
+
+ /* Get the dataspace with the correct region selected */
+ if((space = H5R__get_region(loc.oloc->file, ref)) == NULL)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve region")
+
+ /* Atomize */
+ if((*ret = H5I_register(H5I_DATASPACE, space, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
+
+ break;
+ }
+
+ /* H5Rget_obj_type1/2 */
+ case H5VL_REF_GET_TYPE:
+ {
+ H5O_type_t *obj_type = HDva_arg(arguments, H5O_type_t *);
+ H5R_type_t ref_type = (H5R_type_t)HDva_arg(arguments, int); /* enum work-around */
+ void *ref = HDva_arg(arguments, void *);
+
+ /* Get the object information */
+ if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, obj_type) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type")
+ break;
+ }
+
+ /* H5Rget_name */
+ case H5VL_REF_GET_NAME:
+ {
+ ssize_t *ret = HDva_arg(arguments, ssize_t *);
+ char *name = HDva_arg(arguments, char *);
+ size_t size = HDva_arg(arguments, size_t);
+ H5R_type_t ref_type = (H5R_type_t)HDva_arg(arguments, int); /* enum work-around */
+ void *ref = HDva_arg(arguments, void *);
+
+ /* Get name */
+ if((*ret = H5R__get_name(loc.oloc->file, ref_type, ref, name, size)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object path")
+ break;
+ }
+
+ /* H5Iget_name */
+ case H5VL_ID_GET_NAME:
+ {
+ ssize_t *ret = HDva_arg(arguments, ssize_t *);
+ char *name = HDva_arg(arguments, char *);
+ size_t size = HDva_arg(arguments, size_t);
+
+ /* Retrieve object's name */
+ if((*ret = H5G_get_name(&loc, name, size, NULL)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name")
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_object_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_object_specific
+ *
+ * Purpose: Handles the object specific callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5G_loc_t loc;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ switch(specific_type) {
+ /* H5Oincr_refcount / H5Odecr_refcount */
+ case H5VL_OBJECT_CHANGE_REF_COUNT:
+ {
+ int update_ref = HDva_arg(arguments, int);
+ H5O_loc_t *oloc = loc.oloc;
+
+ if(H5O_link(oloc, update_ref) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
+
+ break;
+ }
+
+ /* H5Oexists_by_name */
+ case H5VL_OBJECT_EXISTS:
+ {
+ htri_t *ret = HDva_arg(arguments, htri_t *);
+
+ if(loc_params->type == H5VL_OBJECT_BY_NAME) {
+ /* Check if the object exists */
+ if((*ret = H5G_loc_exists(&loc, loc_params->loc_data.loc_by_name.name)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", loc_params->loc_data.loc_by_name.name)
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters")
+ break;
+ }
+
+ case H5VL_OBJECT_VISIT:
+ {
+ H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */
+ H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */
+ H5O_iterate_t op = HDva_arg(arguments, H5O_iterate_t);
+ void *op_data = HDva_arg(arguments, void *);
+ unsigned fields = HDva_arg(arguments, unsigned);
+
+ /* Call internal object visitation routine */
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) {
+ /* H5Ovisit */
+ if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, fields)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) {
+ /* H5Ovisit_by_name */
+ if((ret_value = H5O__visit(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, op, op_data, fields)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object visit params");
+ break;
+ }
+
+ case H5VL_OBJECT_FLUSH:
+ {
+ hid_t oid = HDva_arg(arguments, hid_t);
+
+ /* Flush the object's metadata */
+ if(H5O_flush(loc.oloc, oid) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
+
+ break;
+ }
+
+ case H5VL_OBJECT_REFRESH:
+ {
+ hid_t oid = HDva_arg(arguments, hid_t);
+ H5O_loc_t *oloc = loc.oloc;
+
+ /* Refresh the metadata */
+ if(H5O_refresh_metadata(oid, *oloc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
+
+ break;
+ }
+
+ case H5VL_REF_CREATE:
+ {
+ void *ref = HDva_arg(arguments, void *);
+ const char *name = HDva_arg(arguments, char *);
+ H5R_type_t ref_type = (H5R_type_t)HDva_arg(arguments, int); /* enum work-around */
+ hid_t space_id = HDva_arg(arguments, hid_t);
+ H5S_t *space = NULL; /* Pointer to dataspace containing region */
+
+ if(space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ /* Create reference */
+ if(H5R__create(ref, &loc, name, ref_type, space) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference")
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_object_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_object_optional
+ *
+ * Purpose: Handles the object optional callback
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5VL_native_object_optional_t optional_type = HDva_arg(arguments, H5VL_native_object_optional_t);
+ H5VL_loc_params_t *loc_params = HDva_arg(arguments, H5VL_loc_params_t *);
+ H5G_loc_t loc; /* Location of group */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ switch(optional_type) {
+ /* H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx */
+ case H5VL_NATIVE_OBJECT_GET_INFO:
+ {
+ H5O_info_t *obj_info = HDva_arg(arguments, H5O_info_t *);
+ unsigned fields = HDva_arg(arguments, unsigned);
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */
+ /* Retrieve the object's information */
+ if(H5G_loc_info(&loc, ".", obj_info, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */
+ /* Retrieve the object's information */
+ if(H5G_loc_info(&loc, loc_params->loc_data.loc_by_name.name, obj_info, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ } /* end else-if */
+ else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+
+ /* Set up opened group location to fill in */
+ obj_loc.oloc = &obj_oloc;
+ obj_loc.path = &obj_path;
+ H5G_loc_reset(&obj_loc);
+
+ /* Find the object's location, according to the order in the index */
+ if(H5G_loc_find_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
+ loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order,
+ loc_params->loc_data.loc_by_idx.n, &obj_loc/*out*/) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found")
+
+ /* Retrieve the object's information */
+ if(H5O_get_info(obj_loc.oloc, obj_info, fields) < 0) {
+ H5G_loc_free(&obj_loc);
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
+ } /* end if */
+
+ /* Release the object location */
+ if(H5G_loc_free(&obj_loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters")
+ break;
+ }
+
+ /* H5Oget_comment / H5Oget_comment_by_name */
+ case H5VL_NATIVE_OBJECT_GET_COMMENT:
+ {
+ char *comment = HDva_arg(arguments, char *);
+ size_t bufsize = HDva_arg(arguments, size_t);
+ ssize_t *ret = HDva_arg(arguments, ssize_t *);
+
+ /* Retrieve the object's comment */
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_comment */
+ if((*ret = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_comment_by_name */
+ if((*ret = H5G_loc_get_comment(&loc, loc_params->loc_data.loc_by_name.name, comment/*out*/, bufsize)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters")
+ break;
+ }
+
+ /* H5Oset_comment */
+ case H5VL_NATIVE_OBJECT_SET_COMMENT:
+ {
+ const char *comment = HDva_arg(arguments, char *);
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oset_comment */
+ /* (Re)set the object's comment */
+ if(H5G_loc_set_comment(&loc, ".", comment) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oset_comment_by_name */
+ /* (Re)set the object's comment */
+ if(H5G_loc_set_comment(&loc, loc_params->loc_data.loc_by_name.name, comment) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters")
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object");
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_object_optional() */
+
diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h
new file mode 100644
index 0000000..1bf4da2
--- /dev/null
+++ b/src/H5VLnative_private.h
@@ -0,0 +1,88 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: The private header file for the native VOL connector.
+ */
+
+#ifndef _H5VLnative_private_H
+#define _H5VLnative_private_H
+
+#include "H5VLnative.h" /* Native VOL connector */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Atrribute callbacks */
+H5_DLL void *H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
+void *H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_attr_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req);
+
+/* Dataset callbacks */
+H5_DLL void *H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL__native_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_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);
+H5_DLL herr_t H5VL__native_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);
+H5_DLL herr_t H5VL__native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_dataset_optional(void *dset, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_dataset_close(void *dset, hid_t dxpl_id, void **req);
+
+/* File callbacks */
+H5_DLL void *H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req);
+
+/* Group callbacks */
+H5_DLL void *H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_group_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req);
+
+/* Link callbacks */
+H5_DLL herr_t H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Object callbacks */
+H5_DLL void *H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_object_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name, void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Datatype callbacks */
+H5_DLL void *H5VL__native_datatype_commit(void *obj, const 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);
+H5_DLL void *H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H5VLnative_private_H */
+
diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c
index a93ac9a..fe72000 100644
--- a/src/H5VLpassthru.c
+++ b/src/H5VLpassthru.c
@@ -11,14 +11,14 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Purpose: This is a "pass through" VOL connector, which forwards each
- * VOL callback to an underlying connector.
- *
- * It is designed as an example VOL connector for developers to
- * use when creating new connectors, especially connectors that
- * are outside of the HDF5 library. As such, it should _NOT_
- * include _any_ private HDF5 header files. This connector should
- * therefore only make public HDF5 API calls and use standard C /
+ * Purpose: This is a "pass through" VOL connector, which forwards each
+ * VOL callback to an underlying connector.
+ *
+ * It is designed as an example VOL connector for developers to
+ * use when creating new connectors, especially connectors that
+ * are outside of the HDF5 library. As such, it should _NOT_
+ * include _any_ private HDF5 header files. This connector should
+ * therefore only make public HDF5 API calls and use standard C /
* POSIX calls.
*/
@@ -26,6 +26,7 @@
/* Header files needed */
/* (Public HDF5 and standard C / POSIX only) */
#include <assert.h>
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -39,8 +40,14 @@
/* Whether to display log messge when callback is invoked */
/* (Uncomment to enable) */
-/* #define ENABLE_LOGGING */
+/* #define ENABLE_PASSTHRU_LOGGING */
+/* Hack for missing va_copy() in old Visual Studio editions
+ * (from H5win2_defs.h - used on VS2012 and earlier)
+ */
+#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1800)
+#define va_copy(D,S) ((D) = (S))
+#endif
/************/
/* Typedefs */
@@ -75,15 +82,20 @@ static herr_t H5VL_pass_through_free_obj(H5VL_pass_through_t *obj);
/* "Management" callbacks */
static herr_t H5VL_pass_through_init(hid_t vipl_id);
static herr_t H5VL_pass_through_term(void);
+
+/* VOL info callbacks */
static void *H5VL_pass_through_info_copy(const void *info);
static herr_t H5VL_pass_through_info_cmp(int *cmp_value, const void *info1, const void *info2);
static herr_t H5VL_pass_through_info_free(void *info);
static herr_t H5VL_pass_through_info_to_str(const void *info, char **str);
static herr_t H5VL_pass_through_str_to_info(const char *str, void **info);
+
+/* VOL object wrap / retrieval callbacks */
static void *H5VL_pass_through_get_object(const void *obj);
static herr_t H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx);
static herr_t H5VL_pass_through_free_wrap_ctx(void *obj);
-static void *H5VL_pass_through_wrap_object(void *obj, void *wrap_ctx);
+static void *H5VL_pass_through_wrap_object(void *obj, H5I_type_t obj_type,
+ void *wrap_ctx);
/* Attribute callbacks */
static void *H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
@@ -161,86 +173,90 @@ static herr_t H5VL_pass_through_request_free(void *req);
static const H5VL_class_t H5VL_pass_through_g = {
H5VL_PASSTHRU_VERSION, /* version */
(H5VL_class_value_t)H5VL_PASSTHRU_VALUE, /* value */
- H5VL_PASSTHRU_NAME, /* name */
+ H5VL_PASSTHRU_NAME, /* name */
0, /* capability flags */
H5VL_pass_through_init, /* initialize */
H5VL_pass_through_term, /* terminate */
- sizeof(H5VL_pass_through_t), /* info size */
- H5VL_pass_through_info_copy, /* info copy */
- H5VL_pass_through_info_cmp, /* info compare */
- H5VL_pass_through_info_free, /* info free */
- H5VL_pass_through_info_to_str, /* info to str */
- H5VL_pass_through_str_to_info, /* str to info */
- H5VL_pass_through_get_object, /* get_object */
- H5VL_pass_through_get_wrap_ctx, /* get_wrap_ctx */
- H5VL_pass_through_wrap_object, /* wrap_object */
- H5VL_pass_through_free_wrap_ctx, /* free_wrap_ctx */
+ { /* info_cls */
+ sizeof(H5VL_pass_through_info_t), /* size */
+ H5VL_pass_through_info_copy, /* copy */
+ H5VL_pass_through_info_cmp, /* compare */
+ H5VL_pass_through_info_free, /* free */
+ H5VL_pass_through_info_to_str, /* to_str */
+ H5VL_pass_through_str_to_info, /* from_str */
+ },
+ { /* wrap_cls */
+ H5VL_pass_through_get_object, /* get_object */
+ H5VL_pass_through_get_wrap_ctx, /* get_wrap_ctx */
+ H5VL_pass_through_wrap_object, /* wrap_object */
+ H5VL_pass_through_free_wrap_ctx, /* free_wrap_ctx */
+ },
{ /* attribute_cls */
- H5VL_pass_through_attr_create, /* create */
- H5VL_pass_through_attr_open, /* open */
- H5VL_pass_through_attr_read, /* read */
- H5VL_pass_through_attr_write, /* write */
- H5VL_pass_through_attr_get, /* get */
- H5VL_pass_through_attr_specific, /* specific */
- H5VL_pass_through_attr_optional, /* optional */
- H5VL_pass_through_attr_close /* close */
+ H5VL_pass_through_attr_create, /* create */
+ H5VL_pass_through_attr_open, /* open */
+ H5VL_pass_through_attr_read, /* read */
+ H5VL_pass_through_attr_write, /* write */
+ H5VL_pass_through_attr_get, /* get */
+ H5VL_pass_through_attr_specific, /* specific */
+ H5VL_pass_through_attr_optional, /* optional */
+ H5VL_pass_through_attr_close /* close */
},
{ /* dataset_cls */
- H5VL_pass_through_dataset_create, /* create */
- H5VL_pass_through_dataset_open, /* open */
- H5VL_pass_through_dataset_read, /* read */
- H5VL_pass_through_dataset_write, /* write */
- H5VL_pass_through_dataset_get, /* get */
- H5VL_pass_through_dataset_specific, /* specific */
- H5VL_pass_through_dataset_optional, /* optional */
- H5VL_pass_through_dataset_close /* close */
+ H5VL_pass_through_dataset_create, /* create */
+ H5VL_pass_through_dataset_open, /* open */
+ H5VL_pass_through_dataset_read, /* read */
+ H5VL_pass_through_dataset_write, /* write */
+ H5VL_pass_through_dataset_get, /* get */
+ H5VL_pass_through_dataset_specific, /* specific */
+ H5VL_pass_through_dataset_optional, /* optional */
+ H5VL_pass_through_dataset_close /* close */
},
- { /* datatype_cls */
- H5VL_pass_through_datatype_commit, /* commit */
- H5VL_pass_through_datatype_open, /* open */
- H5VL_pass_through_datatype_get, /* get_size */
- H5VL_pass_through_datatype_specific, /* specific */
- H5VL_pass_through_datatype_optional, /* optional */
- H5VL_pass_through_datatype_close /* close */
+ { /* datatype_cls */
+ H5VL_pass_through_datatype_commit, /* commit */
+ H5VL_pass_through_datatype_open, /* open */
+ H5VL_pass_through_datatype_get, /* get_size */
+ H5VL_pass_through_datatype_specific, /* specific */
+ H5VL_pass_through_datatype_optional, /* optional */
+ H5VL_pass_through_datatype_close /* close */
},
{ /* file_cls */
- H5VL_pass_through_file_create, /* create */
- H5VL_pass_through_file_open, /* open */
- H5VL_pass_through_file_get, /* get */
- H5VL_pass_through_file_specific, /* specific */
- H5VL_pass_through_file_optional, /* optional */
- H5VL_pass_through_file_close /* close */
+ H5VL_pass_through_file_create, /* create */
+ H5VL_pass_through_file_open, /* open */
+ H5VL_pass_through_file_get, /* get */
+ H5VL_pass_through_file_specific, /* specific */
+ H5VL_pass_through_file_optional, /* optional */
+ H5VL_pass_through_file_close /* close */
},
{ /* group_cls */
- H5VL_pass_through_group_create, /* create */
- H5VL_pass_through_group_open, /* open */
- H5VL_pass_through_group_get, /* get */
- H5VL_pass_through_group_specific, /* specific */
- H5VL_pass_through_group_optional, /* optional */
- H5VL_pass_through_group_close /* close */
+ H5VL_pass_through_group_create, /* create */
+ H5VL_pass_through_group_open, /* open */
+ H5VL_pass_through_group_get, /* get */
+ H5VL_pass_through_group_specific, /* specific */
+ H5VL_pass_through_group_optional, /* optional */
+ H5VL_pass_through_group_close /* close */
},
{ /* link_cls */
- H5VL_pass_through_link_create, /* create */
- H5VL_pass_through_link_copy, /* copy */
- H5VL_pass_through_link_move, /* move */
- H5VL_pass_through_link_get, /* get */
- H5VL_pass_through_link_specific, /* specific */
- H5VL_pass_through_link_optional, /* optional */
+ H5VL_pass_through_link_create, /* create */
+ H5VL_pass_through_link_copy, /* copy */
+ H5VL_pass_through_link_move, /* move */
+ H5VL_pass_through_link_get, /* get */
+ H5VL_pass_through_link_specific, /* specific */
+ H5VL_pass_through_link_optional, /* optional */
},
{ /* object_cls */
- H5VL_pass_through_object_open, /* open */
- H5VL_pass_through_object_copy, /* copy */
- H5VL_pass_through_object_get, /* get */
- H5VL_pass_through_object_specific, /* specific */
- H5VL_pass_through_object_optional, /* optional */
+ H5VL_pass_through_object_open, /* open */
+ H5VL_pass_through_object_copy, /* copy */
+ H5VL_pass_through_object_get, /* get */
+ H5VL_pass_through_object_specific, /* specific */
+ H5VL_pass_through_object_optional, /* optional */
},
{ /* request_cls */
- H5VL_pass_through_request_wait, /* wait */
- H5VL_pass_through_request_notify, /* notify */
- H5VL_pass_through_request_cancel, /* cancel */
- H5VL_pass_through_request_specific, /* specific */
- H5VL_pass_through_request_optional, /* optional */
- H5VL_pass_through_request_free /* free */
+ H5VL_pass_through_request_wait, /* wait */
+ H5VL_pass_through_request_notify, /* notify */
+ H5VL_pass_through_request_cancel, /* cancel */
+ H5VL_pass_through_request_specific, /* specific */
+ H5VL_pass_through_request_optional, /* optional */
+ H5VL_pass_through_request_free /* free */
},
NULL /* optional */
};
@@ -252,10 +268,10 @@ static hid_t H5VL_PASSTHRU_g = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* Function: H5VL__pass_through_new_obj
*
- * Purpose: Create a new pass through object for an underlying object
+ * Purpose: Create a new pass through object for an underlying object
*
- * Return: Success: Pointer to the new pass through object
- * Failure: NULL
+ * Return: Success: Pointer to the new pass through object
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* Monday, December 3, 2018
@@ -272,17 +288,17 @@ H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id)
new_obj->under_vol_id = under_vol_id;
H5Iinc_ref(new_obj->under_vol_id);
- return(new_obj);
+ return new_obj;
} /* end H5VL__pass_through_new_obj() */
/*-------------------------------------------------------------------------
* Function: H5VL__pass_through_free_obj
*
- * Purpose: Release a pass through object
+ * Purpose: Release a pass through object
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
* Programmer: Quincey Koziol
* Monday, December 3, 2018
@@ -295,18 +311,18 @@ H5VL_pass_through_free_obj(H5VL_pass_through_t *obj)
H5Idec_ref(obj->under_vol_id);
free(obj);
- return(0);
+ return 0;
} /* end H5VL__pass_through_free_obj() */
/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_register
*
- * Purpose: Register the pass-through VOL connector and retrieve an ID
- * for it.
+ * Purpose: Register the pass-through VOL connector and retrieve an ID
+ * for it.
*
- * Return: Success: The ID for the pass-through VOL connector
- * Failure: -1
+ * Return: Success: The ID for the pass-through VOL connector
+ * Failure: -1
*
* Programmer: Quincey Koziol
* Wednesday, November 28, 2018
@@ -323,7 +339,7 @@ H5VL_pass_through_register(void)
if(H5I_VOL != H5Iget_type(H5VL_PASSTHRU_g))
H5VL_PASSTHRU_g = H5VLregister_connector(&H5VL_pass_through_g, H5P_DEFAULT);
- return(H5VL_PASSTHRU_g);
+ return H5VL_PASSTHRU_g;
} /* end H5VL_pass_through_register() */
@@ -331,25 +347,25 @@ H5VL_pass_through_register(void)
* Function: H5VL_pass_through_init
*
* Purpose: Initialize this VOL connector, performing any necessary
- * operations for the connector that will apply to all containers
+ * operations for the connector that will apply to all containers
* accessed with the connector.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
static herr_t
H5VL_pass_through_init(hid_t vipl_id)
{
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL INIT\n");
#endif
/* Shut compiler up about unused parameter */
vipl_id = vipl_id;
- return(0);
+ return 0;
} /* end H5VL_pass_through_init() */
@@ -357,26 +373,26 @@ H5VL_pass_through_init(hid_t vipl_id)
* Function: H5VL_pass_through_term
*
* Purpose: Terminate this VOL connector, performing any necessary
- * operations for the connector that release connector-wide
- * resources (usually created / initialized with the 'init'
- * callback).
+ * operations for the connector that release connector-wide
+ * resources (usually created / initialized with the 'init'
+ * callback).
*
- * Return: Success: 0
- * Failure: (Can't fail)
+ * Return: Success: 0
+ * Failure: (Can't fail)
*
*---------------------------------------------------------------------------
*/
static herr_t
H5VL_pass_through_term(void)
{
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL TERM\n");
#endif
/* Reset VOL ID */
H5VL_PASSTHRU_g = H5I_INVALID_HID;
- return(0);
+ return 0;
} /* end H5VL_pass_through_term() */
@@ -385,8 +401,8 @@ H5VL_pass_through_term(void)
*
* Purpose: Duplicate the connector's info object.
*
- * Returns: Success: New connector info object
- * Failure: NULL
+ * Returns: Success: New connector info object
+ * Failure: NULL
*
*---------------------------------------------------------------------------
*/
@@ -396,7 +412,7 @@ H5VL_pass_through_info_copy(const void *_info)
const H5VL_pass_through_info_t *info = (const H5VL_pass_through_info_t *)_info;
H5VL_pass_through_info_t *new_info;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL INFO Copy\n");
#endif
@@ -409,7 +425,7 @@ H5VL_pass_through_info_copy(const void *_info)
if(info->under_vol_info)
H5VLcopy_connector_info(new_info->under_vol_id, &(new_info->under_vol_info), info->under_vol_info);
- return(new_info);
+ return new_info;
} /* end H5VL_pass_through_info_copy() */
@@ -417,10 +433,10 @@ H5VL_pass_through_info_copy(const void *_info)
* Function: H5VL_pass_through_info_cmp
*
* Purpose: Compare two of the connector's info objects, setting *cmp_value,
- * following the same rules as strcmp().
+ * following the same rules as strcmp().
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*---------------------------------------------------------------------------
*/
@@ -430,7 +446,7 @@ H5VL_pass_through_info_cmp(int *cmp_value, const void *_info1, const void *_info
const H5VL_pass_through_info_t *info1 = (const H5VL_pass_through_info_t *)_info1;
const H5VL_pass_through_info_t *info2 = (const H5VL_pass_through_info_t *)_info2;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL INFO Compare\n");
#endif
@@ -444,14 +460,14 @@ H5VL_pass_through_info_cmp(int *cmp_value, const void *_info1, const void *_info
/* Compare under VOL connector classes */
H5VLcmp_connector_cls(cmp_value, info1->under_vol_id, info2->under_vol_id);
if(*cmp_value != 0)
- return(0);
+ return 0;
/* Compare under VOL connector info objects */
H5VLcmp_connector_info(cmp_value, info1->under_vol_id, info1->under_vol_info, info2->under_vol_info);
if(*cmp_value != 0)
- return(0);
+ return 0;
- return(0);
+ return 0;
} /* end H5VL_pass_through_info_cmp() */
@@ -460,8 +476,8 @@ H5VL_pass_through_info_cmp(int *cmp_value, const void *_info1, const void *_info
*
* Purpose: Release an info object for the connector.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*---------------------------------------------------------------------------
*/
@@ -470,7 +486,7 @@ H5VL_pass_through_info_free(void *_info)
{
H5VL_pass_through_info_t *info = (H5VL_pass_through_info_t *)_info;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL INFO Free\n");
#endif
@@ -482,7 +498,7 @@ H5VL_pass_through_info_free(void *_info)
/* Free pass through info object itself */
free(info);
- return(0);
+ return 0;
} /* end H5VL_pass_through_info_free() */
@@ -491,8 +507,8 @@ H5VL_pass_through_info_free(void *_info)
*
* Purpose: Serialize an info object for this connector into a string
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*---------------------------------------------------------------------------
*/
@@ -504,7 +520,7 @@ H5VL_pass_through_info_to_str(const void *_info, char **str)
char *under_vol_string = NULL;
size_t under_vol_str_len = 0;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL INFO To String\n");
#endif
@@ -520,10 +536,14 @@ H5VL_pass_through_info_to_str(const void *_info, char **str)
*str = (char *)H5allocate_memory(32 + under_vol_str_len, (hbool_t)0);
assert(*str);
- /* Encode our info */
- snprintf(*str, 32 + under_vol_str_len, "under_vol=%u;under_info={%s}", (unsigned)under_value, (under_vol_string ? under_vol_string : ""));
+ /* Encode our info
+ * Normally we'd use snprintf() here for a little extra safety, but that
+ * call had problems on Windows until recently. So, to be as platform-independent
+ * as we can, we're using sprintf() instead.
+ */
+ sprintf(*str, "under_vol=%u;under_info={%s}", (unsigned)under_value, (under_vol_string ? under_vol_string : ""));
- return(0);
+ return 0;
} /* end H5VL_pass_through_info_to_str() */
@@ -532,8 +552,8 @@ H5VL_pass_through_info_to_str(const void *_info, char **str)
*
* Purpose: Deserialize a string into an info object for this connector.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*---------------------------------------------------------------------------
*/
@@ -546,7 +566,7 @@ H5VL_pass_through_str_to_info(const char *str, void **_info)
hid_t under_vol_id;
void *under_vol_info = NULL;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL INFO String To Info\n");
#endif
@@ -576,7 +596,7 @@ H5VL_pass_through_str_to_info(const char *str, void **_info)
/* Set return value */
*_info = info;
- return(0);
+ return 0;
} /* end H5VL_pass_through_str_to_info() */
@@ -585,8 +605,8 @@ H5VL_pass_through_str_to_info(const char *str, void **_info)
*
* Purpose: Retrieve the 'data' for a VOL object.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*---------------------------------------------------------------------------
*/
@@ -595,11 +615,11 @@ H5VL_pass_through_get_object(const void *obj)
{
const H5VL_pass_through_t *o = (const H5VL_pass_through_t *)obj;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL Get object\n");
#endif
- return(H5VLget_object(o->under_object, o->under_vol_id));
+ return H5VLget_object(o->under_object, o->under_vol_id);
} /* end H5VL_pass_through_get_object() */
@@ -608,8 +628,8 @@ H5VL_pass_through_get_object(const void *obj)
*
* Purpose: Retrieve a "wrapper context" for an object
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*---------------------------------------------------------------------------
*/
@@ -619,7 +639,7 @@ H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx)
const H5VL_pass_through_t *o = (const H5VL_pass_through_t *)obj;
H5VL_pass_through_wrap_ctx_t *new_wrap_ctx;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL WRAP CTX Get\n");
#endif
@@ -634,7 +654,7 @@ H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx)
/* Set wrap context to return */
*wrap_ctx = new_wrap_ctx;
- return(0);
+ return 0;
} /* end H5VL_pass_through_get_wrap_ctx() */
@@ -643,30 +663,30 @@ H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx)
*
* Purpose: Use a "wrapper context" to wrap a data object
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*---------------------------------------------------------------------------
*/
static void *
-H5VL_pass_through_wrap_object(void *obj, void *_wrap_ctx)
+H5VL_pass_through_wrap_object(void *obj, H5I_type_t obj_type, void *_wrap_ctx)
{
H5VL_pass_through_wrap_ctx_t *wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)_wrap_ctx;
H5VL_pass_through_t *new_obj;
void *under;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL WRAP Object\n");
#endif
/* Wrap the object with the underlying VOL */
- under = H5VLwrap_object(obj, wrap_ctx->under_vol_id, wrap_ctx->under_wrap_ctx);
+ under = H5VLwrap_object(obj, obj_type, wrap_ctx->under_vol_id, wrap_ctx->under_wrap_ctx);
if(under)
new_obj = H5VL_pass_through_new_obj(under, wrap_ctx->under_vol_id);
else
new_obj = NULL;
- return(new_obj);
+ return new_obj;
} /* end H5VL_pass_through_wrap_object() */
@@ -675,8 +695,8 @@ H5VL_pass_through_wrap_object(void *obj, void *_wrap_ctx)
*
* Purpose: Release a "wrapper context" for an object
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*---------------------------------------------------------------------------
*/
@@ -685,7 +705,7 @@ H5VL_pass_through_free_wrap_ctx(void *_wrap_ctx)
{
H5VL_pass_through_wrap_ctx_t *wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)_wrap_ctx;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL WRAP CTX Free\n");
#endif
@@ -697,17 +717,17 @@ H5VL_pass_through_free_wrap_ctx(void *_wrap_ctx)
/* Free pass through wrap context object itself */
free(wrap_ctx);
- return(0);
+ return 0;
} /* end H5VL_pass_through_free_wrap_ctx() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_attr_create
+ * Function: H5VL_pass_through_attr_create
*
- * Purpose: Creates an attribute on an object.
+ * Purpose: Creates an attribute on an object.
*
- * Return: Success: Pointer to attribute object
- * Failure: NULL
+ * Return: Success: Pointer to attribute object
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
@@ -719,7 +739,7 @@ H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Create\n");
#endif
@@ -734,17 +754,17 @@ H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params,
else
attr = NULL;
- return((void*)attr);
+ return (void*)attr;
} /* end H5VL_pass_through_attr_create() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_attr_open
+ * Function: H5VL_pass_through_attr_open
*
- * Purpose: Opens an attribute on an object.
+ * Purpose: Opens an attribute on an object.
*
- * Return: Success: Pointer to attribute object
- * Failure: NULL
+ * Return: Success: Pointer to attribute object
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
@@ -756,7 +776,7 @@ H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Open\n");
#endif
@@ -771,17 +791,17 @@ H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params,
else
attr = NULL;
- return((void *)attr);
+ return (void *)attr;
} /* end H5VL_pass_through_attr_open() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_attr_read
+ * Function: H5VL_pass_through_attr_read
*
- * Purpose: Reads data from attribute.
+ * Purpose: Reads data from attribute.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -792,7 +812,7 @@ H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Read\n");
#endif
@@ -802,17 +822,17 @@ H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_attr_read() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_attr_write
+ * Function: H5VL_pass_through_attr_write
*
- * Purpose: Writes data to attribute.
+ * Purpose: Writes data to attribute.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -823,7 +843,7 @@ H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Write\n");
#endif
@@ -833,17 +853,17 @@ H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_attr_write() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_attr_get
+ * Function: H5VL_pass_through_attr_get
*
- * Purpose: Gets information about an attribute
+ * Purpose: Gets information about an attribute
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -854,7 +874,7 @@ H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Get\n");
#endif
@@ -864,17 +884,17 @@ H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_attr_get() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_attr_specific
+ * Function: H5VL_pass_through_attr_specific
*
- * Purpose: Specific operation on attribute
+ * Purpose: Specific operation on attribute
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -885,7 +905,7 @@ H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Specific\n");
#endif
@@ -895,7 +915,7 @@ H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_attr_specific() */
@@ -904,8 +924,8 @@ H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
*
* Purpose: Perform a connector-specific operation on an attribute
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -916,7 +936,7 @@ H5VL_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **req,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Optional\n");
#endif
@@ -926,17 +946,17 @@ H5VL_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **req,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_attr_optional() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_attr_close
+ * Function: H5VL_pass_through_attr_close
*
- * Purpose: Closes an attribute.
+ * Purpose: Closes an attribute.
*
- * Return: Success: 0
- * Failure: -1, attr not closed.
+ * Return: Success: 0
+ * Failure: -1, attr not closed.
*
*-------------------------------------------------------------------------
*/
@@ -946,7 +966,7 @@ H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req)
H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Close\n");
#endif
@@ -960,7 +980,7 @@ H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req)
if(ret_value >= 0)
H5VL_pass_through_free_obj(o);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_attr_close() */
@@ -982,7 +1002,7 @@ H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATASET Create\n");
#endif
@@ -997,7 +1017,7 @@ H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
else
dset = NULL;
- return((void *)dset);
+ return (void *)dset;
} /* end H5VL_pass_through_dataset_create() */
@@ -1019,7 +1039,7 @@ H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATASET Open\n");
#endif
@@ -1034,7 +1054,7 @@ H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params,
else
dset = NULL;
- return((void *)dset);
+ return (void *)dset;
} /* end H5VL_pass_through_dataset_open() */
@@ -1043,8 +1063,8 @@ H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params,
*
* Purpose: Reads data elements from a dataset into a buffer.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1055,7 +1075,7 @@ H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id
H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATASET Read\n");
#endif
@@ -1065,7 +1085,7 @@ H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_dataset_read() */
@@ -1074,8 +1094,8 @@ H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id
*
* Purpose: Writes data elements from a buffer into a dataset.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1086,7 +1106,7 @@ H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_i
H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATASET Write\n");
#endif
@@ -1096,7 +1116,7 @@ H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_i
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_dataset_write() */
@@ -1105,8 +1125,8 @@ H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_i
*
* Purpose: Gets information about a dataset
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1117,7 +1137,7 @@ H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATASET Get\n");
#endif
@@ -1127,17 +1147,17 @@ H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_dataset_get() */
/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_dataset_specific
*
- * Purpose: Specific operation on a dataset
+ * Purpose: Specific operation on a dataset
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1148,7 +1168,7 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL H5Dspecific\n");
#endif
@@ -1158,7 +1178,7 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_dataset_specific() */
@@ -1167,8 +1187,8 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t
*
* Purpose: Perform a connector-specific operation on a dataset
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1179,7 +1199,7 @@ H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATASET Optional\n");
#endif
@@ -1189,7 +1209,7 @@ H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_dataset_optional() */
@@ -1198,8 +1218,8 @@ H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req,
*
* Purpose: Closes a dataset.
*
- * Return: Success: 0
- * Failure: -1, dataset not closed.
+ * Return: Success: 0
+ * Failure: -1, dataset not closed.
*
*-------------------------------------------------------------------------
*/
@@ -1209,7 +1229,7 @@ H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req)
H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATASET Close\n");
#endif
@@ -1223,17 +1243,17 @@ H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req)
if(ret_value >= 0)
H5VL_pass_through_free_obj(o);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_dataset_close() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_datatype_commit
+ * Function: H5VL_pass_through_datatype_commit
*
- * Purpose: Commits a datatype inside a container.
+ * Purpose: Commits a datatype inside a container.
*
- * Return: Success: Pointer to datatype object
- * Failure: NULL
+ * Return: Success: Pointer to datatype object
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
@@ -1246,7 +1266,7 @@ H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATATYPE Commit\n");
#endif
@@ -1261,7 +1281,7 @@ H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params
else
dt = NULL;
- return((void *)dt);
+ return (void *)dt;
} /* end H5VL_pass_through_datatype_commit() */
@@ -1283,7 +1303,7 @@ H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATATYPE Open\n");
#endif
@@ -1298,17 +1318,17 @@ H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params,
else
dt = NULL;
- return((void *)dt);
+ return (void *)dt;
} /* end H5VL_pass_through_datatype_open() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_datatype_get
+ * Function: H5VL_pass_through_datatype_get
*
- * Purpose: Get information about a datatype
+ * Purpose: Get information about a datatype
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1319,7 +1339,7 @@ H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)dt;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATATYPE Get\n");
#endif
@@ -1329,7 +1349,7 @@ H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_datatype_get() */
@@ -1338,8 +1358,8 @@ H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type,
*
* Purpose: Specific operations for datatypes
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1350,7 +1370,7 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATATYPE Specific\n");
#endif
@@ -1360,7 +1380,7 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_datatype_specific() */
@@ -1369,8 +1389,8 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific
*
* Purpose: Perform a connector-specific operation on a datatype
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1381,7 +1401,7 @@ H5VL_pass_through_datatype_optional(void *obj, hid_t dxpl_id, void **req,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATATYPE Optional\n");
#endif
@@ -1391,17 +1411,17 @@ H5VL_pass_through_datatype_optional(void *obj, hid_t dxpl_id, void **req,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_datatype_optional() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_datatype_close
+ * Function: H5VL_pass_through_datatype_close
*
- * Purpose: Closes a datatype.
+ * Purpose: Closes a datatype.
*
- * Return: Success: 0
- * Failure: -1, datatype not closed.
+ * Return: Success: 0
+ * Failure: -1, datatype not closed.
*
*-------------------------------------------------------------------------
*/
@@ -1411,7 +1431,7 @@ H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req)
H5VL_pass_through_t *o = (H5VL_pass_through_t *)dt;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATATYPE Close\n");
#endif
@@ -1427,7 +1447,7 @@ H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req)
if(ret_value >= 0)
H5VL_pass_through_free_obj(o);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_datatype_close() */
@@ -1450,7 +1470,7 @@ H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id,
hid_t under_fapl_id;
void *under;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL FILE Create\n");
#endif
@@ -1481,7 +1501,7 @@ H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id,
/* Release copy of our VOL info */
H5VL_pass_through_info_free(info);
- return((void *)file);
+ return (void *)file;
} /* end H5VL_pass_through_file_create() */
@@ -1504,7 +1524,7 @@ H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id,
hid_t under_fapl_id;
void *under;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL FILE Open\n");
#endif
@@ -1535,7 +1555,7 @@ H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id,
/* Release copy of our VOL info */
H5VL_pass_through_info_free(info);
- return((void *)file);
+ return (void *)file;
} /* end H5VL_pass_through_file_open() */
@@ -1544,8 +1564,8 @@ H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id,
*
* Purpose: Get info about a file
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1556,7 +1576,7 @@ H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL FILE Get\n");
#endif
@@ -1566,18 +1586,18 @@ H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_file_get() */
/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_file_specific_reissue
*
- * Purpose: Re-wrap vararg arguments into a va_list and reissue the
- * file specific callback to the underlying VOL connector.
+ * Purpose: Re-wrap vararg arguments into a va_list and reissue the
+ * file specific callback to the underlying VOL connector.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1592,17 +1612,17 @@ H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id,
ret_value = H5VLfile_specific(obj, connector_id, specific_type, dxpl_id, req, arguments);
va_end(arguments);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_file_specific_reissue() */
/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_file_specific
*
- * Purpose: Specific operation on file
+ * Purpose: Specific operation on file
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1614,7 +1634,7 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type,
hid_t under_vol_id = -1;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL FILE Specific\n");
#endif
@@ -1626,7 +1646,7 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type,
hid_t plist_id;
/* Retrieve parameters for 'mount' operation, so we can unwrap the child file */
- loc_type = va_arg(arguments, H5I_type_t);
+ loc_type = (H5I_type_t)va_arg(arguments, int); /* enum work-around */
name = va_arg(arguments, const char *);
child_file = (H5VL_pass_through_t *)va_arg(arguments, void *);
plist_id = va_arg(arguments, hid_t);
@@ -1635,7 +1655,7 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type,
under_vol_id = o->under_vol_id;
/* Re-issue 'file specific' call, using the unwrapped pieces */
- ret_value = H5VL_pass_through_file_specific_reissue(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, loc_type, name, child_file->under_object, plist_id);
+ ret_value = H5VL_pass_through_file_specific_reissue(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, (int)loc_type, name, child_file->under_object, plist_id);
} /* end if */
else if(specific_type == H5VL_FILE_IS_ACCESSIBLE) {
H5VL_pass_through_info_t *info;
@@ -1699,7 +1719,7 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_file_specific() */
@@ -1708,8 +1728,8 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type,
*
* Purpose: Perform a connector-specific operation on a file
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1720,7 +1740,7 @@ H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **req,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL File Optional\n");
#endif
@@ -1730,7 +1750,7 @@ H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **req,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_file_optional() */
@@ -1739,8 +1759,8 @@ H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **req,
*
* Purpose: Closes a file.
*
- * Return: Success: 0
- * Failure: -1, file not closed.
+ * Return: Success: 0
+ * Failure: -1, file not closed.
*
*-------------------------------------------------------------------------
*/
@@ -1750,7 +1770,7 @@ H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req)
H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL FILE Close\n");
#endif
@@ -1764,7 +1784,7 @@ H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req)
if(ret_value >= 0)
H5VL_pass_through_free_obj(o);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_file_close() */
@@ -1786,7 +1806,7 @@ H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL GROUP Create\n");
#endif
@@ -1801,7 +1821,7 @@ H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params,
else
group = NULL;
- return((void *)group);
+ return (void *)group;
} /* end H5VL_pass_through_group_create() */
@@ -1823,7 +1843,7 @@ H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL GROUP Open\n");
#endif
@@ -1838,7 +1858,7 @@ H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params,
else
group = NULL;
- return((void *)group);
+ return (void *)group;
} /* end H5VL_pass_through_group_open() */
@@ -1847,8 +1867,8 @@ H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params,
*
* Purpose: Get info about a group
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1859,7 +1879,7 @@ H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL GROUP Get\n");
#endif
@@ -1869,17 +1889,17 @@ H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_group_get() */
/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_group_specific
*
- * Purpose: Specific operation on a group
+ * Purpose: Specific operation on a group
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1890,7 +1910,7 @@ H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL GROUP Specific\n");
#endif
@@ -1900,7 +1920,7 @@ H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_group_specific() */
@@ -1909,8 +1929,8 @@ H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type,
*
* Purpose: Perform a connector-specific operation on a group
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1921,7 +1941,7 @@ H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **req,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL GROUP Optional\n");
#endif
@@ -1931,7 +1951,7 @@ H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **req,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_group_optional() */
@@ -1940,8 +1960,8 @@ H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **req,
*
* Purpose: Closes a group.
*
- * Return: Success: 0
- * Failure: -1, group not closed.
+ * Return: Success: 0
+ * Failure: -1, group not closed.
*
*-------------------------------------------------------------------------
*/
@@ -1951,7 +1971,7 @@ H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req)
H5VL_pass_through_t *o = (H5VL_pass_through_t *)grp;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL H5Gclose\n");
#endif
@@ -1965,17 +1985,17 @@ H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req)
if(ret_value >= 0)
H5VL_pass_through_free_obj(o);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_group_close() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_link_create
+ * Function: H5VL_pass_through_link_create
*
- * Purpose: Creates a hard / soft / UD / external link.
+ * Purpose: Creates a hard / soft / UD / external link.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -1986,7 +2006,7 @@ H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, co
hid_t under_vol_id = -1;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL LINK Create\n");
#endif
@@ -2018,22 +2038,22 @@ H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, co
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_link_create() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_link_copy
+ * Function: H5VL_pass_through_link_copy
*
- * Purpose: Renames an object within an HDF5 container and copies it to a new
+ * Purpose: Renames an object within an HDF5 container and copies it to a new
* group. The original name SRC is unlinked from the group graph
* and then inserted with the new name DST (which can specify a
* new path for the object) as an atomic operation. The names
* are interpreted relative to SRC_LOC_ID and
* DST_LOC_ID, which are either file IDs or group ID.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2047,7 +2067,7 @@ H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
hid_t under_vol_id = -1;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL LINK Copy\n");
#endif
@@ -2064,23 +2084,22 @@ H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_link_copy() */
/*-------------------------------------------------------------------------
- * Function:
-H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ * Function: H5VL_pass_through_link_move
*
- * Purpose: Moves a link within an HDF5 file to a new group. The original
- * name SRC is unlinked from the group graph
+ * Purpose: Moves a link within an HDF5 file to a new group. The original
+ * name SRC is unlinked from the group graph
* and then inserted with the new name DST (which can specify a
* new path for the object) as an atomic operation. The names
* are interpreted relative to SRC_LOC_ID and
* DST_LOC_ID, which are either file IDs or group ID.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2094,7 +2113,7 @@ H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
hid_t under_vol_id = -1;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL LINK Move\n");
#endif
@@ -2111,17 +2130,17 @@ H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_link_move() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_link_get
+ * Function: H5VL_pass_through_link_get
*
- * Purpose: Get info about a link
+ * Purpose: Get info about a link
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2132,7 +2151,7 @@ H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL LINK Get\n");
#endif
@@ -2142,17 +2161,17 @@ H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_link_get() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_link_specific
+ * Function: H5VL_pass_through_link_specific
*
- * Purpose: Specific operation on a link
+ * Purpose: Specific operation on a link
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2163,7 +2182,7 @@ H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL LINK Specific\n");
#endif
@@ -2173,7 +2192,7 @@ H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_link_specific() */
@@ -2182,8 +2201,8 @@ H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
*
* Purpose: Perform a connector-specific operation on a link
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2194,7 +2213,7 @@ H5VL_pass_through_link_optional(void *obj, hid_t dxpl_id, void **req,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL LINK Optional\n");
#endif
@@ -2204,17 +2223,17 @@ H5VL_pass_through_link_optional(void *obj, hid_t dxpl_id, void **req,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_link_optional() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_object_open
+ * Function: H5VL_pass_through_object_open
*
- * Purpose: Opens an object inside a container.
+ * Purpose: Opens an object inside a container.
*
- * Return: Success: Pointer to object
- * Failure: NULL
+ * Return: Success: Pointer to object
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
@@ -2226,7 +2245,7 @@ H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL OBJECT Open\n");
#endif
@@ -2241,17 +2260,17 @@ H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params,
else
new_obj = NULL;
- return((void *)new_obj);
+ return (void *)new_obj;
} /* end H5VL_pass_through_object_open() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_object_copy
+ * Function: H5VL_pass_through_object_copy
*
- * Purpose: Copies an object inside a container.
+ * Purpose: Copies an object inside a container.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2265,7 +2284,7 @@ H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_pa
H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL OBJECT Copy\n");
#endif
@@ -2275,17 +2294,17 @@ H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_pa
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o_src->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_object_copy() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_object_get
+ * Function: H5VL_pass_through_object_get
*
- * Purpose: Get info about an object
+ * Purpose: Get info about an object
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2295,7 +2314,7 @@ H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5V
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL OBJECT Get\n");
#endif
@@ -2305,17 +2324,17 @@ H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5V
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_object_get() */
/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_object_specific
*
- * Purpose: Specific operation on an object
+ * Purpose: Specific operation on an object
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2327,7 +2346,7 @@ H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL OBJECT Specific\n");
#endif
@@ -2337,17 +2356,17 @@ H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_object_specific() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_object_optional
+ * Function: H5VL_pass_through_object_optional
*
- * Purpose: Perform a connector-specific operation for an object
+ * Purpose: Perform a connector-specific operation for an object
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2358,7 +2377,7 @@ H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL OBJECT Optional\n");
#endif
@@ -2368,20 +2387,20 @@ H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req,
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_object_optional() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_request_wait
+ * Function: H5VL_pass_through_request_wait
*
- * Purpose: Wait (with a timeout) for an async operation to complete
+ * Purpose: Wait (with a timeout) for an async operation to complete
*
- * Note: Releases the request if the operation has completed and the
- * connector callback succeeds
+ * Note: Releases the request if the operation has completed and the
+ * connector callback succeeds
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2392,7 +2411,7 @@ H5VL_pass_through_request_wait(void *obj, uint64_t timeout,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL REQUEST Wait\n");
#endif
@@ -2401,20 +2420,20 @@ H5VL_pass_through_request_wait(void *obj, uint64_t timeout,
if(ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS)
H5VL_pass_through_free_obj(o);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_request_wait() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_request_notify
+ * Function: H5VL_pass_through_request_notify
*
* Purpose: Registers a user callback to be invoked when an asynchronous
- * operation completes
+ * operation completes
*
- * Note: Releases the request, if connector callback succeeds
+ * Note: Releases the request, if connector callback succeeds
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2424,7 +2443,7 @@ H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx)
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL REQUEST Wait\n");
#endif
@@ -2433,19 +2452,19 @@ H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx)
if(ret_value >= 0)
H5VL_pass_through_free_obj(o);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_request_notify() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_request_cancel
+ * Function: H5VL_pass_through_request_cancel
*
* Purpose: Cancels an asynchronous operation
*
- * Note: Releases the request, if connector callback succeeds
+ * Note: Releases the request, if connector callback succeeds
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2455,7 +2474,7 @@ H5VL_pass_through_request_cancel(void *obj)
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL REQUEST Cancel\n");
#endif
@@ -2464,18 +2483,18 @@ H5VL_pass_through_request_cancel(void *obj)
if(ret_value >= 0)
H5VL_pass_through_free_obj(o);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_request_cancel() */
/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_request_specific_reissue
*
- * Purpose: Re-wrap vararg arguments into a va_list and reissue the
- * request specific callback to the underlying VOL connector.
+ * Purpose: Re-wrap vararg arguments into a va_list and reissue the
+ * request specific callback to the underlying VOL connector.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2490,17 +2509,17 @@ H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id,
ret_value = H5VLrequest_specific(obj, connector_id, specific_type, arguments);
va_end(arguments);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_request_specific_reissue() */
/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_request_specific
*
- * Purpose: Specific operation on a request
+ * Purpose: Specific operation on a request
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2510,7 +2529,7 @@ H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_t
{
herr_t ret_value = -1;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL REQUEST Specific\n");
#endif
@@ -2632,17 +2651,17 @@ H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_t
else
assert(0 && "Unknown 'specific' operation");
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_request_specific() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_request_optional
+ * Function: H5VL_pass_through_request_optional
*
- * Purpose: Perform a connector-specific operation for a request
+ * Purpose: Perform a connector-specific operation for a request
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2652,24 +2671,24 @@ H5VL_pass_through_request_optional(void *obj, va_list arguments)
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL REQUEST Optional\n");
#endif
ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, arguments);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_request_optional() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_request_free
+ * Function: H5VL_pass_through_request_free
*
* Purpose: Releases a request, allowing the operation to complete without
- * application tracking
+ * application tracking
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -2679,7 +2698,7 @@ H5VL_pass_through_request_free(void *obj)
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL REQUEST Free\n");
#endif
@@ -2688,6 +2707,6 @@ H5VL_pass_through_request_free(void *obj)
if(ret_value >= 0)
H5VL_pass_through_free_obj(o);
- return(ret_value);
+ return ret_value;
} /* end H5VL_pass_through_request_free() */
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index ef5a81e..283c77a 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -95,7 +95,7 @@ H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx);
H5_DLL herr_t H5VL_set_vol_wrapper(void *obj, const H5VL_t *vol_connector);
H5_DLL herr_t H5VL_reset_vol_wrapper(void);
H5_DLL void * H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx,
- void *obj);
+ void *obj, H5I_type_t obj_type);
/* ID registration functions */
H5_DLL hid_t H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref);
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index 2b055e7..f8f5423 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -22,6 +22,7 @@
#include "H5Apublic.h" /* Attributes */
#include "H5ESpublic.h" /* Event Stack */
#include "H5Fpublic.h" /* Files */
+#include "H5Ipublic.h" /* IDs */
#include "H5Lpublic.h" /* Links */
#include "H5Opublic.h" /* Objects */
#include "H5Rpublic.h" /* References */
@@ -115,7 +116,7 @@ typedef enum H5VL_file_get_t {
H5VL_FILE_GET_INTENT, /* file intent */
H5VL_FILE_GET_NAME, /* file name */
H5VL_FILE_GET_OBJ_COUNT, /* object count in file */
- H5VL_FILE_GET_OBJ_IDS /* object ids in file */
+ H5VL_FILE_GET_OBJ_IDS /* object ids in file */
} H5VL_file_get_t;
/* types for file SPECIFIC callback */
@@ -124,8 +125,7 @@ typedef enum H5VL_file_specific_t {
H5VL_FILE_REOPEN, /* Reopen the file */
H5VL_FILE_MOUNT, /* Mount a file */
H5VL_FILE_UNMOUNT, /* Unmount a file */
- H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */
- H5VL_FILE_CACHE_VOL_CONN /* Cache VOL connector ID & info */
+ H5VL_FILE_IS_ACCESSIBLE /* Check if a file is accessible */
} H5VL_file_specific_t;
/* types for group GET callback */
@@ -236,6 +236,25 @@ typedef struct H5VL_loc_params_t {
} loc_data;
} H5VL_loc_params_t;
+/* VOL connector info fields & callbacks */
+typedef struct H5VL_info_class_t {
+ size_t size; /* Size of the VOL info */
+ void * (*copy)(const void *info); /* Callback to create a copy of the VOL info */
+ herr_t (*cmp)(int *cmp_value, const void *info1, const void *info2); /* Callback to compare VOL info */
+ herr_t (*free)(void *info); /* Callback to release a VOL info */
+ herr_t (*to_str)(const void *info, char **str); /* Callback to serialize connector's info into a string */
+ herr_t (*from_str)(const char *str, void **info); /* Callback to deserialize a string into connector's info */
+} H5VL_info_class_t;
+
+/* VOL object wrap / retrieval callbacks */
+/* (These only need to be implemented by "pass through" VOL connectors) */
+typedef struct H5VL_wrap_class_t {
+ void * (*get_object)(const void *obj); /* Callback to retrieve underlying object */
+ herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* Callback to retrieve the object wrapping context for the connector */
+ void * (*wrap_object)(void *obj, H5I_type_t obj_type, void *wrap_ctx); /* Callback to wrap a library object */
+ herr_t (*free_wrap_ctx)(void *wrap_ctx); /* Callback to release the object wrapping context for the connector */
+} H5VL_wrap_class_t;
+
/* H5A routines */
typedef struct H5VL_attr_class_t {
void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
@@ -370,34 +389,29 @@ typedef int H5VL_class_value_t;
/* Class information for each VOL connector */
typedef struct H5VL_class_t {
- unsigned int version; /* VOL connector class struct version # */
- H5VL_class_value_t value; /* Value to identify connector */
- const char *name; /* Connector name (MUST be unique!) */
- unsigned cap_flags; /* Capability flags for connector */
- herr_t (*initialize)(hid_t vipl_id); /* Connector initialization callback */
- herr_t (*terminate)(void); /* Connector termination callback */
- size_t info_size; /* Size of the VOL info */
- void * (*info_copy)(const void *info); /* Callback to create a copy of the VOL info */
- herr_t (*info_cmp)(int *cmp_value, const void *info1, const void *info2); /* Callback to compare VOL info */
- herr_t (*info_free)(void *info); /* Callback to release the VOL info copy */
- herr_t (*info_to_str)(const void *info, char **str); /* Callback to serialize connector's info into a string */
- herr_t (*str_to_info)(const char *str, void **info); /* Callback to deserialize a string into connector's info */
- void * (*get_object)(const void *obj); /* Callback to retrieve underlying object */
- herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* Callback to retrieve the object wrapping context for the connector */
- void* (*wrap_object)(void *obj, void *wrap_ctx); /* Callback to wrap a library object */
- herr_t (*free_wrap_ctx)(void *wrap_ctx); /* Callback to release the object wrapping context for the connector */
+ /* Overall connector fields & callbacks */
+ unsigned int version; /* VOL connector class struct version # */
+ H5VL_class_value_t value; /* Value to identify connector */
+ const char *name; /* Connector name (MUST be unique!) */
+ unsigned cap_flags; /* Capability flags for connector */
+ herr_t (*initialize)(hid_t vipl_id); /* Connector initialization callback */
+ herr_t (*terminate)(void); /* Connector termination callback */
+
+ /* VOL framework */
+ H5VL_info_class_t info_cls; /* VOL info fields & callbacks */
+ H5VL_wrap_class_t wrap_cls; /* VOL object wrap / retrieval callbacks */
/* Data Model */
- H5VL_attr_class_t attr_cls; /* attribute class callbacks */
- H5VL_dataset_class_t dataset_cls; /* dataset class callbacks */
- H5VL_datatype_class_t datatype_cls; /* datatype class callbacks */
- H5VL_file_class_t file_cls; /* file class callbacks */
- H5VL_group_class_t group_cls; /* group class callbacks */
- H5VL_link_class_t link_cls; /* link class callbacks */
- H5VL_object_class_t object_cls; /* object class callbacks */
+ H5VL_attr_class_t attr_cls; /* Attribute (H5A*) class callbacks */
+ H5VL_dataset_class_t dataset_cls; /* Dataset (H5D*) class callbacks */
+ H5VL_datatype_class_t datatype_cls; /* Datatype (H5T*) class callbacks */
+ H5VL_file_class_t file_cls; /* File (H5F*) class callbacks */
+ H5VL_group_class_t group_cls; /* Group (H5G*) class callbacks */
+ H5VL_link_class_t link_cls; /* Link (H5L*) class callbacks */
+ H5VL_object_class_t object_cls; /* Object (H5O*) class callbacks */
/* Services */
- H5VL_request_class_t request_cls; /* asynchronous request class callbacks */
+ H5VL_request_class_t request_cls; /* Asynchronous request class callbacks */
/* Catch-all */
herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */
@@ -434,6 +448,8 @@ H5_DLL herr_t H5VLunregister_connector(hid_t connector_id);
/* Helper routines for VOL connector authors */
H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2);
+H5_DLL hid_t H5VLwrap_register(void *obj, H5I_type_t type);
+H5_DLL void *H5VLobject(hid_t obj_id);
/* Public wrappers for generic callbacks */
@@ -449,7 +465,8 @@ H5_DLL herr_t H5VLconnector_info_to_str(const void *info, hid_t connector_id, ch
H5_DLL herr_t H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info);
H5_DLL void *H5VLget_object(void *obj, hid_t connector_id);
H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx);
-H5_DLL void *H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx);
+H5_DLL void *H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id,
+ void *wrap_ctx);
H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id);
/* Public wrappers for attribute callbacks */
diff --git a/src/H5VM.c b/src/H5VM.c
index 4c0b837..452d378 100644
--- a/src/H5VM.c
+++ b/src/H5VM.c
@@ -1548,7 +1548,7 @@ done:
*
* Purpose: Given source and destination buffers in memory (SRC & DST)
* copy sequences of from the source buffer into the destination
- * buffer. Each set of sequnces has an array of lengths, an
+ * buffer. Each set of sequences has an array of lengths, an
* array of offsets, the maximum number of sequences and the
* current sequence to start at in the sequence.
*
diff --git a/src/H5Z.c b/src/H5Z.c
index f41588f..0e2a7ba 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -611,7 +611,7 @@ H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key)
/* Sanity check for collectively calling H5Zunregister, if requested */
/* (Sanity check assumes that a barrier on one file's comm
* is sufficient (i.e. that there aren't different comms for
- * different files). -QAK, 2018/02/14
+ * different files). -QAK, 2018/02/14)
*/
if(H5_coll_api_sanity_check_g && !object->sanity_checked) {
MPI_Comm mpi_comm; /* File's communicator */
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index cdf31a4..0026749 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -1174,6 +1174,8 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value
/* special case: minbits equal to full precision */
if(minbits == p.size * 8) {
HDmemcpy(outbuf, (unsigned char*)(*buf)+buf_offset, size_out);
+ /* free the original buffer */
+ H5MM_xfree(*buf);
/* convert to dataset datatype endianness order if needed */
if(need_convert)
@@ -1272,6 +1274,9 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value
/* special case: minbits equal to full precision */
if(minbits == p.size * 8) {
HDmemcpy(outbuf + buf_offset, *buf, nbytes);
+ /* free the original buffer */
+ H5MM_xfree(*buf);
+
*buf = outbuf;
outbuf = NULL;
*buf_size = size_out;
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index 67646a0..f8fc325 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -850,7 +850,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
if (!factor)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
- sscanf(current->tok_begin, "%ld", &factor->value.int_val);
+ HDsscanf(current->tok_begin, "%ld", &factor->value.int_val);
break;
case H5Z_XFORM_FLOAT:
@@ -858,7 +858,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
if (!factor)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
- sscanf(current->tok_begin, "%lf", &factor->value.float_val);
+ HDsscanf(current->tok_begin, "%lf", &factor->value.float_val);
break;
case H5Z_XFORM_SYMBOL:
diff --git a/src/H5dbg.c b/src/H5dbg.c
index dd50034..4939bca 100644
--- a/src/H5dbg.c
+++ b/src/H5dbg.c
@@ -113,7 +113,7 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf,
} /* end else */
} /* end if */
else
- fprintf(stream, " ");
+ HDfprintf(stream, " ");
if(7 == v)
HDfputc(' ', stream);
} /* end for */
diff --git a/src/H5err.txt b/src/H5err.txt
index 3965242..93a3abd 100644
--- a/src/H5err.txt
+++ b/src/H5err.txt
@@ -181,7 +181,7 @@ MINOR, CACHE, H5E_CANTRESIZE, Unable to resize a metadata cache entry
MINOR, CACHE, H5E_CANTDEPEND, Unable to create a flush dependency
MINOR, CACHE, H5E_CANTUNDEPEND, Unable to destroy a flush dependency
MINOR, CACHE, H5E_CANTNOTIFY, Unable to notify object about action
-MINOR, CACHE, H5E_LOGFAIL, Failure in the cache logging framework
+MINOR, CACHE, H5E_LOGGING, Failure in the cache logging framework
MINOR, CACHE, H5E_CANTCORK, Unable to cork an object
MINOR, CACHE, H5E_CANTUNCORK, Unable to uncork an object
diff --git a/src/H5private.h b/src/H5private.h
index b654bae..ef52ac6 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -1156,6 +1156,9 @@ typedef off_t h5_stat_size_t;
#ifndef HDpowf
#define HDpowf(X,Y) powf(X,Y)
#endif /* HDpowf */
+#ifndef HDpread
+ #define HDpread(F,B,C,O) pread(F,B,C,O)
+#endif /* HDpread */
#ifndef HDprintf
#define HDprintf(...) HDfprintf(stdout, __VA_ARGS__)
#endif /* HDprintf */
@@ -1168,6 +1171,9 @@ typedef off_t h5_stat_size_t;
#ifndef HDputs
#define HDputs(S) puts(S)
#endif /* HDputs */
+#ifndef HDpwrite
+ #define HDpwrite(F,B,C,O) pwrite(F,B,C,O)
+#endif /* HDpwrite */
#ifndef HDqsort
#define HDqsort(M,N,Z,F) qsort(M,N,Z,F)
#endif /* HDqsort*/
@@ -1334,8 +1340,9 @@ typedef off_t h5_stat_size_t;
#define HDsrandom(S) srand(S)
#endif /* HDsrandom */
#endif /* H5_HAVE_RAND_R */
-/* sscanf() variable arguments */
-
+#ifndef HDsscanf
+ #define HDsscanf(S,FMT,...) sscanf(S,FMT,__VA_ARGS__)
+#endif /* HDsscanf */
#ifndef HDstrcat
#define HDstrcat(X,Y) strcat(X,Y)
#endif /* HDstrcat */
@@ -1393,6 +1400,9 @@ typedef off_t h5_stat_size_t;
#ifndef HDstrtok
#define HDstrtok(X,Y) strtok(X,Y)
#endif /* HDstrtok */
+#ifndef HDstrtok_r
+ #define HDstrtok_r(X,Y,Z) strtok_r(X,Y,Z)
+#endif /* HDstrtok */
#ifndef HDstrtol
#define HDstrtol(S,R,N) strtol(S,R,N)
#endif /* HDstrtol */
@@ -1495,6 +1505,9 @@ typedef off_t h5_stat_size_t;
#ifndef HDva_arg
#define HDva_arg(A,T) va_arg(A,T)
#endif /* HDva_arg */
+#ifndef HDva_copy
+#define HDva_copy(D,S) va_copy(D,S)
+#endif /* HDva_copy */
#ifndef HDva_end
#define HDva_end(A) va_end(A)
#endif /* HDva_end */
diff --git a/src/H5system.c b/src/H5system.c
index 2d29650..f47d057 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -121,7 +121,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
HDassert(stream);
HDassert(fmt);
- va_start (ap, fmt);
+ HDva_start (ap, fmt);
while (*fmt) {
fwidth = prec = 0;
zerofill = 0;
@@ -170,7 +170,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
s = rest;
} /* end if */
else if ('*'==*s) {
- fwidth = va_arg(ap, int);
+ fwidth = HDva_arg(ap, int);
if(fwidth < 0) {
leftjust = 1;
fwidth = -fwidth;
@@ -185,7 +185,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
prec = (int)HDstrtol(s, &rest, 10);
s = rest;
} else if('*'==*s) {
- prec = va_arg(ap, int);
+ prec = HDva_arg(ap, int);
s++;
}
if(prec < 1)
@@ -272,16 +272,16 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case 'd':
case 'i':
if(!HDstrcmp(modifier, "h")) {
- short x = (short)va_arg(ap, int);
+ short x = (short)HDva_arg(ap, int);
n = fprintf(stream, format_templ, x);
} else if(!*modifier) {
- int x = va_arg(ap, int);
+ int x = HDva_arg(ap, int);
n = fprintf(stream, format_templ, x);
} else if(!HDstrcmp(modifier, "l")) {
- long x = va_arg(ap, long);
+ long x = HDva_arg(ap, long);
n = fprintf(stream, format_templ, x);
} else {
- int64_t x = va_arg(ap, int64_t);
+ int64_t x = HDva_arg(ap, int64_t);
n = fprintf(stream, format_templ, x);
}
break;
@@ -291,16 +291,16 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case 'x':
case 'X':
if(!HDstrcmp(modifier, "h")) {
- unsigned short x = (unsigned short)va_arg(ap, unsigned int);
+ unsigned short x = (unsigned short)HDva_arg(ap, unsigned int);
n = fprintf(stream, format_templ, x);
} else if(!*modifier) {
- unsigned int x = va_arg(ap, unsigned int);
+ unsigned int x = HDva_arg(ap, unsigned int);
n = fprintf(stream, format_templ, x);
} else if(!HDstrcmp(modifier, "l")) {
- unsigned long x = va_arg(ap, unsigned long);
+ unsigned long x = HDva_arg(ap, unsigned long);
n = fprintf(stream, format_templ, x);
} else {
- uint64_t x = va_arg(ap, uint64_t);
+ uint64_t x = HDva_arg(ap, uint64_t);
n = fprintf(stream, format_templ, x);
}
break;
@@ -311,10 +311,10 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case 'g':
case 'G':
if(!HDstrcmp(modifier, "h")) {
- float x = (float)va_arg(ap, double);
+ float x = (float)HDva_arg(ap, double);
n = fprintf(stream, format_templ, (double)x);
} else if(!*modifier || !HDstrcmp(modifier, "l")) {
- double x = va_arg(ap, double);
+ double x = HDva_arg(ap, double);
n = fprintf(stream, format_templ, x);
} else {
/*
@@ -322,10 +322,10 @@ HDfprintf(FILE *stream, const char *fmt, ...)
* `double' are the same thing.
*/
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
- long double x = va_arg(ap, long double);
+ long double x = HDva_arg(ap, long double);
n = fprintf(stream, format_templ, x);
#else
- double x = va_arg(ap, double);
+ double x = HDva_arg(ap, double);
n = fprintf(stream, format_templ, x);
#endif
}
@@ -333,7 +333,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case 'a':
{
- haddr_t x = va_arg(ap, haddr_t);
+ haddr_t x = HDva_arg(ap, haddr_t);
if(H5F_addr_defined(x)) {
len = 0;
@@ -379,7 +379,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case 'c':
{
- char x = (char)va_arg(ap, int);
+ char x = (char)HDva_arg(ap, int);
n = fprintf(stream, format_templ, x);
}
break;
@@ -387,7 +387,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case 's':
case 'p':
{
- char *x = va_arg(ap, char*);
+ char *x = HDva_arg(ap, char*);
n = fprintf(stream, format_templ, x);
}
break;
@@ -399,7 +399,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case 't':
{
- htri_t tri_var = va_arg(ap, htri_t);
+ htri_t tri_var = HDva_arg(ap, htri_t);
if(tri_var > 0)
fprintf(stream, "TRUE");
@@ -423,7 +423,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
nout++;
}
}
- va_end(ap);
+ HDva_end(ap);
return nout;
} /* end HDfprintf() */
@@ -492,7 +492,8 @@ HDstrtoll(const char *s, const char **rest, int base)
/* Optional minus or plus sign */
if ('+'==*s) {
s++;
- } else if ('-'==*s) {
+ }
+ else if ('-'==*s) {
sign = -1;
s++;
}
@@ -501,10 +502,12 @@ HDstrtoll(const char *s, const char **rest, int base)
if (0==base && '0'==*s && ('x'==s[1] || 'X'==s[1])) {
base = 16;
s += 2;
- } else if (0==base && '0'==*s) {
+ }
+ else if (0==base && '0'==*s) {
base = 8;
s++;
- } else if (0==base) {
+ }
+ else if (0==base) {
base = 10;
}
@@ -525,7 +528,8 @@ HDstrtoll(const char *s, const char **rest, int base)
if (acc*base+digit < acc) {
overflow = TRUE;
- } else {
+ }
+ else {
acc = acc*base + digit;
}
}
@@ -536,7 +540,8 @@ HDstrtoll(const char *s, const char **rest, int base)
if (overflow) {
if (sign>0) {
acc = ((uint64_t)1<<(8*sizeof(int64_t)-1))-1;
- } else {
+ }
+ else {
acc = (int64_t)((uint64_t)1<<(8*sizeof(int64_t)-1));
}
errno = ERANGE;
@@ -843,9 +848,9 @@ int c99_snprintf(char* str, size_t size, const char* format, ...)
int count;
va_list ap;
- va_start(ap, format);
+ HDva_start(ap, format);
count = c99_vsnprintf(str, size, format, ap);
- va_end(ap);
+ HDva_end(ap);
return count;
}
diff --git a/src/H5timer.c b/src/H5timer.c
index 0ba8bd1..4b1ec06 100644
--- a/src/H5timer.c
+++ b/src/H5timer.c
@@ -213,26 +213,26 @@ H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds)
if(H5_DBL_ABS_EQUAL(bw, (double)0.0F))
HDstrcpy(buf, "0.000 B/s");
else if(bw < (double)1.0F)
- sprintf(buf, "%10.4e", bw);
+ HDsprintf(buf, "%10.4e", bw);
else if(bw < (double)H5_KB) {
- sprintf(buf, "%05.4f", bw);
+ HDsprintf(buf, "%05.4f", bw);
HDstrcpy(buf+5, " B/s");
} else if(bw < (double)H5_MB) {
- sprintf(buf, "%05.4f", bw / (double)H5_KB);
+ HDsprintf(buf, "%05.4f", bw / (double)H5_KB);
HDstrcpy(buf+5, " kB/s");
} else if(bw < (double)H5_GB) {
- sprintf(buf, "%05.4f", bw / (double)H5_MB);
+ HDsprintf(buf, "%05.4f", bw / (double)H5_MB);
HDstrcpy(buf+5, " MB/s");
} else if(bw < (double)H5_TB) {
- sprintf(buf, "%05.4f", bw / (double)H5_GB);
+ HDsprintf(buf, "%05.4f", bw / (double)H5_GB);
HDstrcpy(buf+5, " GB/s");
} else if(bw < (double)H5_PB) {
- sprintf(buf, "%05.4f", bw / (double)H5_TB);
+ HDsprintf(buf, "%05.4f", bw / (double)H5_TB);
HDstrcpy(buf+5, " TB/s");
} else {
- sprintf(buf, "%10.4e", bw);
+ HDsprintf(buf, "%10.4e", bw);
if(HDstrlen(buf) > 10)
- sprintf(buf, "%10.3e", bw);
+ HDsprintf(buf, "%10.3e", bw);
}
}
} /* end H5_bandwidth() */
diff --git a/src/H5trace.c b/src/H5trace.c
index d5aad06..9a13193 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -135,7 +135,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
if(!out)
return 0.0F; /*tracing is off*/
- va_start(ap, type);
+ HDva_start(ap, type);
if(H5_debug_g.ttop) {
if(returning) {
@@ -227,7 +227,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
* name is the null pointer then don't print the argument or the
* following `='. This is used for return values.
*/
- argname = va_arg(ap, char *);
+ argname = HDva_arg(ap, char *);
if(argname) {
unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname) - 3);
@@ -243,7 +243,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
/* The value */
if(ptr)
- vp = va_arg(ap, void *);
+ vp = HDva_arg(ap, void *);
switch(type[0]) {
case 'a':
if(ptr) {
@@ -253,7 +253,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- haddr_t addr = va_arg(ap, haddr_t);
+ haddr_t addr = HDva_arg(ap, haddr_t);
HDfprintf(out, "%a", addr);
} /* end else */
@@ -267,8 +267,8 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- /* Can't pass hbool_t to va_arg() */
- hbool_t bool_var = (hbool_t)va_arg(ap, int);
+ /* Can't pass hbool_t to HDva_arg() */
+ hbool_t bool_var = (hbool_t)HDva_arg(ap, int);
if(TRUE == bool_var)
HDfprintf(out, "TRUE");
else if(!bool_var)
@@ -286,7 +286,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- double dbl = va_arg(ap, double);
+ double dbl = HDva_arg(ap, double);
HDfprintf(out, "%g", dbl);
} /* end else */
@@ -302,7 +302,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5D_alloc_time_t alloc_time = (H5D_alloc_time_t)va_arg(ap, int);
+ H5D_alloc_time_t alloc_time = (H5D_alloc_time_t)HDva_arg(ap, int);
switch(alloc_time) {
case H5D_ALLOC_TIME_ERROR:
@@ -340,7 +340,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5FD_mpio_collective_opt_t opt = (H5FD_mpio_collective_opt_t)va_arg(ap, int);
+ H5FD_mpio_collective_opt_t opt = (H5FD_mpio_collective_opt_t)HDva_arg(ap, int);
switch(opt) {
case H5FD_MPIO_COLLECTIVE_IO:
@@ -366,7 +366,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5D_fill_time_t fill_time = (H5D_fill_time_t)va_arg(ap, int);
+ H5D_fill_time_t fill_time = (H5D_fill_time_t)HDva_arg(ap, int);
switch(fill_time) {
case H5D_FILL_TIME_ERROR:
@@ -400,7 +400,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5D_fill_value_t fill_value = (H5D_fill_value_t)va_arg(ap, int);
+ H5D_fill_value_t fill_value = (H5D_fill_value_t)HDva_arg(ap, int);
switch(fill_value) {
case H5D_FILL_VALUE_ERROR:
@@ -434,7 +434,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5FD_mpio_chunk_opt_t opt = (H5FD_mpio_chunk_opt_t)va_arg(ap, int);
+ H5FD_mpio_chunk_opt_t opt = (H5FD_mpio_chunk_opt_t)HDva_arg(ap, int);
switch(opt) {
case H5FD_MPIO_CHUNK_DEFAULT:
@@ -464,7 +464,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5D_mpio_actual_io_mode_t actual_io_mode = (H5D_mpio_actual_io_mode_t)va_arg(ap, int);
+ H5D_mpio_actual_io_mode_t actual_io_mode = (H5D_mpio_actual_io_mode_t)HDva_arg(ap, int);
switch(actual_io_mode) {
case H5D_MPIO_NO_COLLECTIVE:
@@ -502,7 +502,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5D_chunk_index_t idx = (H5D_chunk_index_t)va_arg(ap, int);
+ H5D_chunk_index_t idx = (H5D_chunk_index_t)HDva_arg(ap, int);
switch(idx) {
case H5D_CHUNK_IDX_BTREE:
@@ -548,7 +548,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5D_layout_t layout = (H5D_layout_t)va_arg(ap, int);
+ H5D_layout_t layout = (H5D_layout_t)HDva_arg(ap, int);
switch(layout) {
case H5D_LAYOUT_ERROR:
@@ -590,7 +590,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5D_mpio_no_collective_cause_t nocol_cause_mode = (H5D_mpio_no_collective_cause_t)va_arg(ap, int);
+ H5D_mpio_no_collective_cause_t nocol_cause_mode = (H5D_mpio_no_collective_cause_t)HDva_arg(ap, int);
hbool_t flag_already_displayed = FALSE;
/* Check for all bit-flags which might be set */
@@ -637,7 +637,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5D_mpio_actual_chunk_opt_mode_t chunk_opt_mode = (H5D_mpio_actual_chunk_opt_mode_t)va_arg(ap, int);
+ H5D_mpio_actual_chunk_opt_mode_t chunk_opt_mode = (H5D_mpio_actual_chunk_opt_mode_t)HDva_arg(ap, int);
switch(chunk_opt_mode) {
case H5D_MPIO_NO_CHUNK_OPTIMIZATION:
@@ -667,7 +667,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5D_space_status_t space_status = (H5D_space_status_t)va_arg(ap, int);
+ H5D_space_status_t space_status = (H5D_space_status_t)HDva_arg(ap, int);
switch(space_status) {
case H5D_SPACE_STATUS_NOT_ALLOCATED:
@@ -701,7 +701,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5FD_mpio_xfer_t transfer = (H5FD_mpio_xfer_t)va_arg(ap, int);
+ H5FD_mpio_xfer_t transfer = (H5FD_mpio_xfer_t)HDva_arg(ap, int);
switch(transfer) {
case H5FD_MPIO_INDEPENDENT:
@@ -727,7 +727,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5D_vds_view_t view = (H5D_vds_view_t)va_arg(ap, int);
+ H5D_vds_view_t view = (H5D_vds_view_t)HDva_arg(ap, int);
switch(view) {
case H5D_VDS_ERROR:
@@ -763,7 +763,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- herr_t status = va_arg(ap, herr_t);
+ herr_t status = HDva_arg(ap, herr_t);
if(status >= 0)
HDfprintf(out, "SUCCEED");
@@ -782,7 +782,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5E_direction_t direction = (H5E_direction_t)va_arg(ap, int);
+ H5E_direction_t direction = (H5E_direction_t)HDva_arg(ap, int);
switch(direction) {
case H5E_WALK_UPWARD:
@@ -808,7 +808,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5E_error2_t *error = va_arg(ap, H5E_error2_t *);
+ H5E_error2_t *error = HDva_arg(ap, H5E_error2_t *);
HDfprintf(out, "0x%lx", (unsigned long)error);
} /* end else */
@@ -822,7 +822,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5ES_status_t status = (H5ES_status_t)va_arg(ap, int);
+ H5ES_status_t status = (H5ES_status_t)HDva_arg(ap, int);
switch(status) {
case H5ES_STATUS_IN_PROGRESS:
@@ -853,7 +853,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5E_type_t etype = (H5E_type_t)va_arg(ap, int);
+ H5E_type_t etype = (H5E_type_t)HDva_arg(ap, int);
switch(etype) {
case H5E_MAJOR:
@@ -887,7 +887,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5F_close_degree_t degree = (H5F_close_degree_t)va_arg(ap, int);
+ H5F_close_degree_t degree = (H5F_close_degree_t)HDva_arg(ap, int);
switch(degree) {
case H5F_CLOSE_DEFAULT:
@@ -921,7 +921,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5F_fspace_strategy_t fs_strategy = (H5F_fspace_strategy_t)va_arg(ap, int);
+ H5F_fspace_strategy_t fs_strategy = (H5F_fspace_strategy_t)HDva_arg(ap, int);
switch(fs_strategy) {
case H5F_FSPACE_STRATEGY_FSM_AGGR:
@@ -956,7 +956,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5F_mem_t mem_type = (H5F_mem_t)va_arg(ap, int);
+ H5F_mem_t mem_type = (H5F_mem_t)HDva_arg(ap, int);
switch(mem_type) {
case H5FD_MEM_NOLIST:
@@ -1007,7 +1007,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5F_scope_t scope = (H5F_scope_t)va_arg(ap, int);
+ H5F_scope_t scope = (H5F_scope_t)HDva_arg(ap, int);
switch(scope) {
case H5F_SCOPE_LOCAL:
@@ -1042,7 +1042,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5F_libver_t libver_vers = (H5F_libver_t)va_arg(ap, int);
+ H5F_libver_t libver_vers = (H5F_libver_t)HDva_arg(ap, int);
switch(libver_vers) {
case H5F_LIBVER_EARLIEST:
@@ -1084,7 +1084,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5G_obj_t obj_type = (H5G_obj_t)va_arg(ap, int);
+ H5G_obj_t obj_type = (H5G_obj_t)HDva_arg(ap, int);
switch(obj_type) {
case H5G_UNKNOWN:
@@ -1132,7 +1132,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5G_stat_t *statbuf = va_arg(ap, H5G_stat_t*);
+ H5G_stat_t *statbuf = HDva_arg(ap, H5G_stat_t*);
HDfprintf(out, "0x%lx", (unsigned long)statbuf);
}
@@ -1166,7 +1166,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- hsize_t hsize = va_arg(ap, hsize_t);
+ hsize_t hsize = HDva_arg(ap, hsize_t);
if(H5S_UNLIMITED == hsize)
HDfprintf(out, "H5S_UNLIMITED");
@@ -1196,7 +1196,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- hssize_t hssize = va_arg(ap, hssize_t);
+ hssize_t hssize = HDva_arg(ap, hssize_t);
HDfprintf(out, "%Hd", hssize);
asize[argno] = (hssize_t)hssize;
@@ -1217,7 +1217,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- hid_t obj = va_arg(ap, hid_t);
+ hid_t obj = HDva_arg(ap, hid_t);
if(H5P_DEFAULT == obj)
HDfprintf(out, "H5P_DEFAULT");
@@ -1355,10 +1355,6 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "%ld (attr)", (long)obj);
break;
- case H5I_REFERENCE:
- HDfprintf(out, "%ld (reference)", (long)obj);
- break;
-
case H5I_VFL:
HDfprintf(out, "%ld (file driver)", (long)obj);
break;
@@ -1409,7 +1405,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5_index_t idx_type = (H5_index_t)va_arg(ap, int);
+ H5_index_t idx_type = (H5_index_t)HDva_arg(ap, int);
switch(idx_type) {
case H5_INDEX_UNKNOWN:
@@ -1443,7 +1439,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5_iter_order_t order = (H5_iter_order_t)va_arg(ap, int);
+ H5_iter_order_t order = (H5_iter_order_t)HDva_arg(ap, int);
switch(order) {
case H5_ITER_UNKNOWN:
@@ -1490,7 +1486,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- int is = va_arg(ap, int);
+ int is = HDva_arg(ap, int);
HDfprintf (out, "%d", is);
asize[argno] = is;
@@ -1505,7 +1501,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5I_type_t id_type = (H5I_type_t)va_arg(ap, int);
+ H5I_type_t id_type = (H5I_type_t)HDva_arg(ap, int);
switch (id_type) {
case H5I_UNINIT:
@@ -1540,10 +1536,6 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "H5I_ATTR");
break;
- case H5I_REFERENCE:
- HDfprintf(out, "H5I_REFERENCE");
- break;
-
case H5I_VFL:
HDfprintf(out, "H5I_VFL");
break;
@@ -1600,7 +1592,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- unsigned iu = va_arg(ap, unsigned);
+ unsigned iu = HDva_arg(ap, unsigned);
HDfprintf(out, "%u", iu);
asize[argno] = iu;
@@ -1623,7 +1615,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5L_type_t link_type = (H5L_type_t)va_arg(ap, int);
+ H5L_type_t link_type = (H5L_type_t)HDva_arg(ap, int);
switch(link_type) {
case H5L_TYPE_ERROR:
@@ -1670,7 +1662,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end if */
#ifdef H5_HAVE_PARALLEL
else {
- MPI_Comm comm = va_arg(ap, MPI_Comm);
+ MPI_Comm comm = HDva_arg(ap, MPI_Comm);
HDfprintf(out, "%ld", (long)comm);
} /* end else */
@@ -1686,7 +1678,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end if */
#ifdef H5_HAVE_PARALLEL
else {
- MPI_Info info = va_arg(ap, MPI_Info);
+ MPI_Info info = HDva_arg(ap, MPI_Info);
HDfprintf(out, "%ld", (long)info);
} /* end else */
@@ -1701,7 +1693,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5FD_mem_t mt = (H5FD_mem_t)va_arg(ap, int);
+ H5FD_mem_t mt = (H5FD_mem_t)HDva_arg(ap, int);
switch(mt) {
case H5FD_MEM_NOLIST:
@@ -1760,7 +1752,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- off_t offset = va_arg(ap, off_t);
+ off_t offset = HDva_arg(ap, off_t);
HDfprintf (out, "%ld", (long)offset);
} /* end else */
@@ -1776,7 +1768,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5O_type_t objtype = (H5O_type_t)va_arg(ap, int);
+ H5O_type_t objtype = (H5O_type_t)HDva_arg(ap, int);
switch(objtype) {
case H5O_TYPE_UNKNOWN:
@@ -1820,7 +1812,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- hid_t pclass_id = va_arg(ap, hid_t);
+ hid_t pclass_id = HDva_arg(ap, hid_t);
char *class_name = NULL;
H5P_genclass_t *pclass;
@@ -1844,7 +1836,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- hobj_ref_t ref = va_arg(ap, hobj_ref_t);
+ hobj_ref_t ref = HDva_arg(ap, hobj_ref_t);
HDfprintf(out, "Reference Object=%a", ref);
} /* end else */
@@ -1860,7 +1852,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5R_type_t reftype = (H5R_type_t)va_arg(ap, int);
+ H5R_type_t reftype = (H5R_type_t)HDva_arg(ap, int);
switch(reftype) {
case H5R_BADTYPE:
@@ -1902,7 +1894,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5S_class_t cls = (H5S_class_t)va_arg(ap, int);
+ H5S_class_t cls = (H5S_class_t)HDva_arg(ap, int);
switch(cls) {
case H5S_NO_CLASS:
@@ -1936,7 +1928,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5S_seloper_t so = (H5S_seloper_t)va_arg(ap, int);
+ H5S_seloper_t so = (H5S_seloper_t)HDva_arg(ap, int);
switch(so) {
case H5S_SELECT_NOOP:
@@ -1994,7 +1986,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5S_sel_type st = (H5S_sel_type)va_arg(ap, int);
+ H5S_sel_type st = (H5S_sel_type)HDva_arg(ap, int);
switch(st) {
case H5S_SEL_ERROR:
@@ -2042,7 +2034,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- const char *str = va_arg(ap, const char *);
+ const char *str = HDva_arg(ap, const char *);
HDfprintf(out, "\"%s\"", str);
} /* end else */
@@ -2058,7 +2050,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5T_cset_t cset = (H5T_cset_t)va_arg(ap, int);
+ H5T_cset_t cset = (H5T_cset_t)HDva_arg(ap, int);
switch(cset) {
case H5T_CSET_ERROR:
@@ -2105,7 +2097,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5T_direction_t direct = (H5T_direction_t)va_arg(ap, int);
+ H5T_direction_t direct = (H5T_direction_t)HDva_arg(ap, int);
switch(direct) {
case H5T_DIR_DEFAULT:
@@ -2135,7 +2127,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5T_pers_t pers = (H5T_pers_t)va_arg(ap, int);
+ H5T_pers_t pers = (H5T_pers_t)HDva_arg(ap, int);
switch(pers) {
case H5T_PERS_DONTCARE:
@@ -2165,7 +2157,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5T_norm_t norm = (H5T_norm_t)va_arg(ap, int);
+ H5T_norm_t norm = (H5T_norm_t)HDva_arg(ap, int);
switch(norm) {
case H5T_NORM_ERROR:
@@ -2199,7 +2191,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5T_order_t order = (H5T_order_t)va_arg(ap, int);
+ H5T_order_t order = (H5T_order_t)HDva_arg(ap, int);
switch(order) {
case H5T_ORDER_ERROR:
@@ -2241,7 +2233,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5T_pad_t pad = (H5T_pad_t)va_arg(ap, int);
+ H5T_pad_t pad = (H5T_pad_t)HDva_arg(ap, int);
switch(pad) {
case H5T_PAD_ERROR:
@@ -2279,7 +2271,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5T_sign_t sign = (H5T_sign_t)va_arg(ap, int);
+ H5T_sign_t sign = (H5T_sign_t)HDva_arg(ap, int);
switch(sign) {
case H5T_SGN_ERROR:
@@ -2313,7 +2305,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5T_class_t type_class = (H5T_class_t)va_arg(ap, int);
+ H5T_class_t type_class = (H5T_class_t)HDva_arg(ap, int);
switch(type_class) {
case H5T_NO_CLASS:
@@ -2383,7 +2375,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5T_str_t str = (H5T_str_t)va_arg(ap, int);
+ H5T_str_t str = (H5T_str_t)HDva_arg(ap, int);
switch(str) {
case H5T_STR_ERROR:
@@ -2439,7 +2431,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- htri_t tri_var = va_arg (ap, htri_t);
+ htri_t tri_var = HDva_arg (ap, htri_t);
if(tri_var>0)
HDfprintf (out, "TRUE");
@@ -2469,7 +2461,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- unsigned long iul = va_arg(ap, unsigned long);
+ unsigned long iul = HDva_arg(ap, unsigned long);
HDfprintf(out, "%lu", iul);
asize[argno] = (hssize_t)iul;
@@ -2493,7 +2485,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- unsigned long long iull = va_arg(ap, unsigned long long);
+ unsigned long long iull = HDva_arg(ap, unsigned long long);
HDfprintf(out, "%llu", iull);
asize[argno] = (hssize_t)iull;
@@ -2516,7 +2508,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_attr_get_t get = (H5VL_attr_get_t)va_arg(ap, int);
+ H5VL_attr_get_t get = (H5VL_attr_get_t)HDva_arg(ap, int);
switch(get) {
case H5VL_ATTR_GET_SPACE:
@@ -2551,7 +2543,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_attr_specific_t specific = (H5VL_attr_specific_t)va_arg(ap, int);
+ H5VL_attr_specific_t specific = (H5VL_attr_specific_t)HDva_arg(ap, int);
switch(specific) {
case H5VL_ATTR_DELETE:
@@ -2580,7 +2572,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_class_value_t class_val = (H5VL_class_value_t)va_arg(ap, H5VL_class_value_t);
+ H5VL_class_value_t class_val = (H5VL_class_value_t)HDva_arg(ap, H5VL_class_value_t);
if(H5_VOL_NATIVE == class_val)
HDfprintf(out, "H5_VOL_NATIVE");
@@ -2596,7 +2588,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_dataset_get_t get = (H5VL_dataset_get_t)va_arg(ap, int);
+ H5VL_dataset_get_t get = (H5VL_dataset_get_t)HDva_arg(ap, int);
switch(get) {
case H5VL_DATASET_GET_SPACE:
@@ -2634,7 +2626,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_dataset_specific_t specific = (H5VL_dataset_specific_t)va_arg(ap, int);
+ H5VL_dataset_specific_t specific = (H5VL_dataset_specific_t)HDva_arg(ap, int);
switch(specific) {
case H5VL_DATASET_SET_EXTENT:
@@ -2660,7 +2652,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_datatype_get_t get = (H5VL_datatype_get_t)va_arg(ap, int);
+ H5VL_datatype_get_t get = (H5VL_datatype_get_t)HDva_arg(ap, int);
switch(get) {
case H5VL_DATATYPE_GET_BINARY:
@@ -2683,7 +2675,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_datatype_specific_t specific = (H5VL_datatype_specific_t)va_arg(ap, int);
+ H5VL_datatype_specific_t specific = (H5VL_datatype_specific_t)HDva_arg(ap, int);
switch(specific) {
case H5VL_DATATYPE_FLUSH:
@@ -2706,7 +2698,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_file_get_t get = (H5VL_file_get_t)va_arg(ap, int);
+ H5VL_file_get_t get = (H5VL_file_get_t)HDva_arg(ap, int);
switch(get) {
case H5VL_FILE_GET_FAPL:
@@ -2741,7 +2733,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_file_specific_t specific = (H5VL_file_specific_t)va_arg(ap, int);
+ H5VL_file_specific_t specific = (H5VL_file_specific_t)HDva_arg(ap, int);
switch(specific) {
case H5VL_FILE_FLUSH:
@@ -2759,9 +2751,6 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5VL_FILE_IS_ACCESSIBLE:
HDfprintf(out, "H5VL_FILE_IS_ACCESSIBLE");
break;
- case H5VL_FILE_CACHE_VOL_CONN:
- HDfprintf(out, "H5VL_FILE_CACHE_VOL_CONN");
- break;
default:
HDfprintf(out, "%ld", (long)specific);
break;
@@ -2776,7 +2765,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_group_get_t get = (H5VL_group_get_t)va_arg(ap, int);
+ H5VL_group_get_t get = (H5VL_group_get_t)HDva_arg(ap, int);
switch(get) {
case H5VL_GROUP_GET_GCPL:
@@ -2799,7 +2788,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_group_specific_t specific = (H5VL_group_specific_t)va_arg(ap, int);
+ H5VL_group_specific_t specific = (H5VL_group_specific_t)HDva_arg(ap, int);
switch(specific) {
case H5VL_GROUP_FLUSH:
@@ -2822,7 +2811,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_link_create_type_t create = (H5VL_link_create_type_t)va_arg(ap, int);
+ H5VL_link_create_type_t create = (H5VL_link_create_type_t)HDva_arg(ap, int);
switch(create) {
case H5VL_LINK_CREATE_HARD:
@@ -2848,7 +2837,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_link_get_t get = (H5VL_link_get_t)va_arg(ap, int);
+ H5VL_link_get_t get = (H5VL_link_get_t)HDva_arg(ap, int);
switch(get) {
case H5VL_LINK_GET_INFO:
@@ -2874,7 +2863,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_link_specific_t specific = (H5VL_link_specific_t)va_arg(ap, int);
+ H5VL_link_specific_t specific = (H5VL_link_specific_t)HDva_arg(ap, int);
switch(specific) {
case H5VL_LINK_DELETE:
@@ -2900,7 +2889,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_object_get_t get = (H5VL_object_get_t)va_arg(ap, int);
+ H5VL_object_get_t get = (H5VL_object_get_t)HDva_arg(ap, int);
switch(get) {
case H5VL_REF_GET_REGION:
@@ -2929,7 +2918,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_object_specific_t specific = (H5VL_object_specific_t)va_arg(ap, int);
+ H5VL_object_specific_t specific = (H5VL_object_specific_t)HDva_arg(ap, int);
switch(specific) {
case H5VL_OBJECT_CHANGE_REF_COUNT:
@@ -2964,7 +2953,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5VL_request_specific_t specific = (H5VL_request_specific_t)va_arg(ap, int);
+ H5VL_request_specific_t specific = (H5VL_request_specific_t)HDva_arg(ap, int);
switch(specific) {
case H5VL_REQUEST_WAITANY:
@@ -3009,7 +2998,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- vp = va_arg (ap, void *);
+ vp = HDva_arg (ap, void *);
if(vp)
HDfprintf(out, "0x%lx", (unsigned long)vp);
@@ -3035,7 +3024,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- size_t size = va_arg(ap, size_t);
+ size_t size = HDva_arg(ap, size_t);
HDfprintf(out, "%Zu", size);
asize[argno] = (hssize_t)size;
@@ -3052,7 +3041,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5Z_SO_scale_type_t scale_type = (H5Z_SO_scale_type_t)va_arg(ap, int);
+ H5Z_SO_scale_type_t scale_type = (H5Z_SO_scale_type_t)HDva_arg(ap, int);
switch(scale_type) {
case H5Z_SO_FLOAT_DSCALE:
@@ -3082,7 +3071,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5Z_class2_t *filter = va_arg(ap, H5Z_class2_t*);
+ H5Z_class2_t *filter = HDva_arg(ap, H5Z_class2_t*);
HDfprintf(out, "0x%lx", (unsigned long)filter);
} /* end else */
@@ -3096,7 +3085,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5Z_EDC_t edc = (H5Z_EDC_t)va_arg(ap, int);
+ H5Z_EDC_t edc = (H5Z_EDC_t)HDva_arg(ap, int);
if(H5Z_DISABLE_EDC == edc)
HDfprintf(out, "H5Z_DISABLE_EDC");
@@ -3115,7 +3104,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- H5Z_filter_t id = va_arg(ap, H5Z_filter_t);
+ H5Z_filter_t id = HDva_arg(ap, H5Z_filter_t);
if(H5Z_FILTER_DEFLATE == id)
HDfprintf(out, "H5Z_FILTER_DEFLATE");
@@ -3141,7 +3130,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "NULL");
} /* end if */
else {
- ssize_t ssize = va_arg(ap, ssize_t);
+ ssize_t ssize = HDva_arg(ap, ssize_t);
HDfprintf(out, "%Zd", ssize);
asize[argno] = (hssize_t)ssize;
@@ -3169,7 +3158,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
(event_time.etime - *returning));
error:
- va_end(ap);
+ HDva_end(ap);
if(returning)
HDfprintf(out, ";\n");
else {
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index 4522228..140afc3 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -62,9 +62,17 @@ typedef __int64 h5_stat_size_t;
#define HDstat(S,B) _stati64(S,B)
#define HDstrcasecmp(A,B) _stricmp(A,B)
#define HDstrdup(S) _strdup(S)
+#define HDstrtok_r(X,Y,Z) strtok_s(X,Y,Z)
#define HDtzset() _tzset()
#define HDunlink(S) _unlink(S)
#define HDwrite(F,M,Z) _write(F,M,Z)
+#if (_MSC_VER < 1800)
+/* va_copy() does not exist on pre-2013 Visual Studio. Since va_lists are
+ * just pointers into the stack in those CRTs, the usual work-around
+ * is to just define the operation as a pointer copy.
+ */
+#define HDva_copy(D,S) ((D) = (S))
+#endif /* MSC_VER < 1800 */
#ifdef H5_HAVE_VISUAL_STUDIO
diff --git a/src/Makefile.am b/src/Makefile.am
index 69b51b2..5532655 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -40,12 +40,12 @@ DISTCLEANFILES=H5pubconf.h
# library sources
libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c H5Atest.c \
- H5AC.c H5ACdbg.c H5AClog.c H5ACproxy_entry.c \
+ H5AC.c H5ACdbg.c H5ACproxy_entry.c \
H5B.c H5Bcache.c H5Bdbg.c \
H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c H5B2int.c H5B2internal.c \
H5B2leaf.c H5B2stat.c H5B2test.c \
- H5C.c H5Cdbg.c H5Cepoch.c H5Cimage.c H5Clog.c H5Cprefetched.c \
- H5Cquery.c H5Ctag.c H5Ctest.c \
+ H5C.c H5Cdbg.c H5Cepoch.c H5Cimage.c H5Clog.c H5Clog_json.c H5Clog_trace.c \
+ H5Cprefetched.c H5Cquery.c H5Ctag.c H5Ctest.c \
H5CS.c \
H5CX.c \
H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \
@@ -114,7 +114,10 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Topaque.c \
H5Torder.c \
H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \
- H5VL.c H5VLcallback.c H5VLint.c H5VLnative.c H5VLpassthru.c \
+ H5VL.c H5VLcallback.c H5VLint.c H5VLnative.c \
+ H5VLnative_attr.c H5VLnative_dataset.c H5VLnative_datatype.c \
+ H5VLnative_file.c H5VLnative_group.c H5VLnative_link.c H5VLnative_object.c \
+ H5VLpassthru.c \
H5VM.c H5WB.c H5Z.c \
H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \
H5Zscaleoffset.c H5Zszip.c H5Ztrans.c
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index 531cd00..9d0e29f 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -82,7 +82,6 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@
API tracing: @TRACE_API@
Using memory checker: @USINGMEMCHECKER@
Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@
- Metadata trace file: @METADATATRACEFILE@
Function stack tracing: @CODESTACK@
Strict file format checks: @STRICT_FORMAT_CHECKS@
Optimization instrumentation: @INSTRUMENT_LIBRARY@