summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2018-12-23 06:18:42 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2018-12-23 06:18:42 (GMT)
commitc3f51c52d098d6cd2e6c2955a50140bdb45571c6 (patch)
tree3fbc8a16ba3140b0f7ed1febfbff9afb511073bd /src
parent251ba120b5e3277a0e53e9ea2417f6b370cf7d05 (diff)
parent7d28a4295ebac24dd0a84da9f4b880488d8bd32f (diff)
downloadhdf5-c3f51c52d098d6cd2e6c2955a50140bdb45571c6.zip
hdf5-c3f51c52d098d6cd2e6c2955a50140bdb45571c6.tar.gz
hdf5-c3f51c52d098d6cd2e6c2955a50140bdb45571c6.tar.bz2
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/~bmribler/hdf5_bmr_fixbug into develop
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt57
-rw-r--r--src/H5A.c122
-rw-r--r--src/H5Adeprec.c65
-rw-r--r--src/H5Aint.c16
-rw-r--r--src/H5Apublic.h18
-rw-r--r--src/H5CX.c78
-rw-r--r--src/H5CXprivate.h2
-rw-r--r--src/H5Cquery.c8
-rw-r--r--src/H5D.c77
-rw-r--r--src/H5Ddeprec.c30
-rw-r--r--src/H5Dint.c41
-rw-r--r--src/H5Dio.c14
-rw-r--r--src/H5Dpkg.h9
-rw-r--r--src/H5Dprivate.h2
-rw-r--r--src/H5Dpublic.h23
-rw-r--r--src/H5Dvirtual.c13
-rw-r--r--src/H5ESpublic.h2
-rw-r--r--src/H5F.c340
-rw-r--r--src/H5FDcore.c148
-rw-r--r--src/H5FDdirect.c3
-rw-r--r--src/H5FDlog.c2
-rw-r--r--src/H5FDmpio.c1
-rw-r--r--src/H5FDmulti.c3
-rw-r--r--src/H5FDtest.c5
-rw-r--r--src/H5Fdeprec.c66
-rw-r--r--src/H5Fint.c397
-rw-r--r--src/H5Fmount.c12
-rw-r--r--src/H5Fpkg.h51
-rw-r--r--src/H5Fprivate.h7
-rw-r--r--src/H5Fpublic.h4
-rw-r--r--src/H5Fquery.c2
-rw-r--r--src/H5Ftest.c34
-rw-r--r--src/H5G.c66
-rw-r--r--src/H5Gcompact.c68
-rw-r--r--src/H5Gdense.c77
-rw-r--r--src/H5Gdeprec.c443
-rw-r--r--src/H5Gint.c7
-rw-r--r--src/H5Gloc.c3
-rw-r--r--src/H5Gname.c22
-rw-r--r--src/H5Gpkg.h15
-rw-r--r--src/H5Gprivate.h4
-rw-r--r--src/H5Gpublic.h9
-rw-r--r--src/H5Gstab.c115
-rw-r--r--src/H5Gtest.c1
-rw-r--r--src/H5Gtraverse.c3
-rw-r--r--src/H5HG.c9
-rw-r--r--src/H5I.c185
-rw-r--r--src/H5Ipublic.h4
-rw-r--r--src/H5Itest.c23
-rw-r--r--src/H5L.c130
-rw-r--r--src/H5Lexternal.c6
-rw-r--r--src/H5O.c120
-rw-r--r--src/H5Oattribute.c2
-rw-r--r--src/H5Ocopy.c4
-rw-r--r--src/H5Odeprec.c19
-rw-r--r--src/H5Ofill.c4
-rw-r--r--src/H5Oflush.c41
-rw-r--r--src/H5Oint.c6
-rw-r--r--src/H5Olink.c17
-rw-r--r--src/H5Opkg.h7
-rw-r--r--src/H5Oprivate.h1
-rw-r--r--src/H5Opublic.h7
-rw-r--r--src/H5PLint.c39
-rw-r--r--src/H5PLpath.c6
-rw-r--r--src/H5PLpkg.h8
-rw-r--r--src/H5PLplugin_cache.c6
-rw-r--r--src/H5PLprivate.h15
-rw-r--r--src/H5Pfapl.c498
-rw-r--r--src/H5Plcpl.c2
-rw-r--r--src/H5Pprivate.h1
-rw-r--r--src/H5Ppublic.h3
-rw-r--r--src/H5R.c22
-rw-r--r--src/H5Rdeprec.c20
-rw-r--r--src/H5Rint.c54
-rw-r--r--src/H5T.c106
-rw-r--r--src/H5Tcommit.c85
-rw-r--r--src/H5Tdeprec.c25
-rw-r--r--src/H5Tprivate.h3
-rw-r--r--src/H5Tvlen.c6
-rw-r--r--src/H5VL.c2223
-rw-r--r--src/H5VLcallback.c6489
-rw-r--r--src/H5VLint.c2252
-rw-r--r--src/H5VLnative.c3518
-rw-r--r--src/H5VLnative.h65
-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.c811
-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.h70
-rw-r--r--src/H5VLpassthru.c2702
-rw-r--r--src/H5VLpassthru.h46
-rw-r--r--src/H5VLprivate.h166
-rw-r--r--src/H5VLpublic.h362
-rw-r--r--src/H5Z.c10
-rw-r--r--src/H5Zpublic.h2
-rw-r--r--src/H5private.h17
-rw-r--r--src/H5system.c59
-rw-r--r--src/H5trace.c239
-rw-r--r--src/H5win32defs.h8
-rw-r--r--src/Makefile.am7
-rw-r--r--src/hdf5.h5
104 files changed, 16111 insertions, 9626 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bca5a92..c9a2fda 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -625,11 +625,21 @@ IDE_GENERATED_PROPERTIES ("H5UC" "${H5UC_HDRS}" "${H5UC_SOURCES}" )
set (H5VL_SOURCES
${HDF5_SRC_DIR}/H5VL.c
+ ${HDF5_SRC_DIR}/H5VLcallback.c
${HDF5_SRC_DIR}/H5VLint.c
${HDF5_SRC_DIR}/H5VLnative.c
+ ${HDF5_SRC_DIR}/H5VLnative_attr.c
+ ${HDF5_SRC_DIR}/H5VLnative_dataset.c
+ ${HDF5_SRC_DIR}/H5VLnative_datatype.c
+ ${HDF5_SRC_DIR}/H5VLnative_file.c
+ ${HDF5_SRC_DIR}/H5VLnative_group.c
+ ${HDF5_SRC_DIR}/H5VLnative_link.c
+ ${HDF5_SRC_DIR}/H5VLnative_object.c
+ ${HDF5_SRC_DIR}/H5VLpassthru.c
)
set (H5VL_HDRS
${HDF5_SRC_DIR}/H5VLnative.h
+ ${HDF5_SRC_DIR}/H5VLpassthru.h
${HDF5_SRC_DIR}/H5VLpublic.h
)
IDE_GENERATED_PROPERTIES ("H5VL" "${H5VL_HDRS}" "${H5VL_SOURCES}" )
@@ -866,8 +876,8 @@ set (H5_PRIVATE_HEADERS
${HDF5_SRC_DIR}/H5UCprivate.h
- ${HDF5_SRC_DIR}/H5VLpkg.h
${HDF5_SRC_DIR}/H5VLnative_private.h
+ ${HDF5_SRC_DIR}/H5VLpkg.h
${HDF5_SRC_DIR}/H5VLprivate.h
${HDF5_SRC_DIR}/H5VMprivate.h
@@ -948,10 +958,13 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c)
)
add_custom_command (
OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
COMMAND ${HDF5_BATCH_CMD}
ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT}
COMMAND ${CMAKE_COMMAND}
ARGS -E echo "Executed batch command to create H5Tinit.c"
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
DEPENDS H5detect
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
)
@@ -961,31 +974,62 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c)
if (BUILD_SHARED_LIBS)
add_custom_command (
OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c
+ ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit_created
+ WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
)
set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
endif ()
else ()
add_custom_command (
OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5detect>
ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
DEPENDS H5detect
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
)
if (BUILD_SHARED_LIBS)
add_custom_command (
OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c
+ ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
)
set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
endif ()
endif ()
set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE)
+else ()
+ add_custom_command (
+ OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
+ DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
+ )
+ if (BUILD_SHARED_LIBS)
+ add_custom_command (
+ OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
+ DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
+ )
+ set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
+ endif ()
endif ()
add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c)
@@ -999,8 +1043,11 @@ target_link_libraries (H5make_libsettings
add_custom_command (
OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c
+ ${HDF5_BINARY_DIR}/gen_SRCS.stamp2
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5make_libsettings>
ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2
DEPENDS H5make_libsettings
WORKING_DIRECTORY ${HDF5_BINARY_DIR}
)
@@ -1008,9 +1055,13 @@ set_source_files_properties (${HDF5_BINARY_DIR}/H5lib_settings.c PROPERTIES GENE
if (BUILD_SHARED_LIBS)
add_custom_command (
OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c
+ ${HDF5_BINARY_DIR}/shared/shared_gen_SRCS.stamp2
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different "${HDF5_BINARY_DIR}/H5lib_settings.c" "${HDF5_BINARY_DIR}/shared/H5lib_settings.c"
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2
DEPENDS ${HDF5_BINARY_DIR}/H5lib_settings.c
+ WORKING_DIRECTORY ${HDF5_BINARY_DIR}
)
set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE)
endif ()
@@ -1023,8 +1074,8 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF)
# Add H5Tinit source to build - generated by H5detect/CMake at configure time
#-----------------------------------------------------------------------------
set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c)
+add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2)
-add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${gen_SRCS})
add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS})
target_include_directories(${HDF5_LIB_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
@@ -1053,8 +1104,8 @@ set (install_targets ${HDF5_LIB_TARGET})
if (BUILD_SHARED_LIBS)
set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c)
+ add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2)
- add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${shared_gen_SRCS})
add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS})
target_include_directories(${HDF5_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
diff --git a/src/H5A.c b/src/H5A.c
index b023c78..8ebd2b3 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -296,18 +296,17 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the attribute */
- if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, attr_name,
- acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
- if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@@ -349,7 +348,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id,
hid_t lapl_id)
{
- void *attr = NULL; /* attr token from VOL plugin */
+ void *attr = NULL; /* attr token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5P_genplist_t *plist; /* Property list pointer */
H5VL_loc_params_t loc_params;
@@ -402,18 +401,17 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the attribute */
- if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, attr_name,
- acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
- if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close (attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@@ -442,7 +440,7 @@ done:
hid_t
H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id)
{
- void *attr = NULL; /* attr token from VOL driver */
+ void *attr = NULL; /* attr token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID;
@@ -471,18 +469,17 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
- if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls,
- attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name)
/* Register the attribute and get an ID for it */
- if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@@ -514,7 +511,7 @@ hid_t
H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
hid_t aapl_id, hid_t lapl_id)
{
- void *attr = NULL; /* attr token from VOL driver */
+ void *attr = NULL; /* attr token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID;
@@ -554,18 +551,17 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
- if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls,
- attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute")
/* Register the attribute and get an ID for it */
- if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close (attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@@ -646,18 +642,17 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
- if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls,
- NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
- if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@@ -702,8 +697,7 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
/* Write the attribute data */
- if((ret_value = H5VL_attr_write(vol_obj->data, vol_obj->driver->cls,
- dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if((ret_value = H5VL_attr_write(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute")
done:
@@ -745,8 +739,7 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL")
/* Read the attribute data */
- if((ret_value = H5VL_attr_read(vol_obj->data, vol_obj->driver->cls,
- dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if((ret_value = H5VL_attr_read(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute")
done:
@@ -784,8 +777,7 @@ H5Aget_space(hid_t attr_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
/* Get the dataspace */
- if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_SPACE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute")
done:
@@ -812,7 +804,7 @@ done:
hid_t
H5Aget_type(hid_t attr_id)
{
- H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
+ H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@@ -823,8 +815,7 @@ H5Aget_type(hid_t attr_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
/* Get the datatype */
- if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_TYPE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute")
done:
@@ -867,8 +858,7 @@ H5Aget_create_plist(hid_t attr_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
/* Get the acpl */
- if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_ACPL,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_ACPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get creation property list for attribute")
done:
@@ -918,9 +908,7 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf)
loc_params.obj_type = H5I_get_type(attr_id);
/* Get the attribute name */
- if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_NAME,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- loc_params, buf_size, buf, &ret_value) < 0)
+ if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, buf_size, buf, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name")
done:
@@ -985,8 +973,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the name */
- if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_NAME,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, size, name, &ret_value) < 0)
+ if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, size, name, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get name")
done:
@@ -1025,8 +1012,7 @@ H5Aget_storage_size(hid_t attr_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute")
/* Get the storage size */
- if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_STORAGE_SIZE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, 0, "unable to get acpl")
done:
@@ -1060,13 +1046,14 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo)
/* Check arguments */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
+ if(!ainfo)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "attribute_info parameter cannot be NULL")
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(attr_id);
/* Get the attribute information */
- if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0)
+ if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@@ -1122,8 +1109,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the attribute information */
- if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo, attr_name) < 0)
+ if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo, attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@@ -1186,8 +1172,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the attribute information */
- if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0)
+ if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@@ -1238,10 +1223,9 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
/* Rename the attribute */
- if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_RENAME,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name)) < 0)
+ if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
- }
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
@@ -1299,10 +1283,9 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Rename the attribute */
- if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_RENAME,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name)) < 0)
+ if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
- }
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
@@ -1377,9 +1360,7 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Iterate over attributes */
- if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_ITER,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- idx_type, order, idx, op, op_data)) < 0)
+ if((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, idx, op, op_data)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
done:
@@ -1467,9 +1448,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Iterate over attributes */
- if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_ITER,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- idx_type, order, idx, op, op_data)) < 0)
+ if((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, idx, op, op_data)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed");
done:
@@ -1522,8 +1501,7 @@ H5Adelete(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Delete the attribute */
- if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name)) < 0)
+ if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -1581,8 +1559,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Delete the attribute */
- if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name)) < 0)
+ if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -1652,8 +1629,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Delete the attribute through the VOL */
- if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL)) < 0)
+ if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -1731,8 +1707,7 @@ H5Aexists(hid_t obj_id, const char *attr_name)
loc_params.obj_type = H5I_get_type(obj_id);
/* Check if the attribute exists */
- if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_EXISTS,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
+ if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:
@@ -1786,8 +1761,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
loc_params.obj_type = H5I_get_type(loc_id);
/* Check existence of attribute */
- if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_EXISTS,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
+ if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index cce9316..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 */
@@ -114,8 +116,8 @@ hid_t
H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t acpl_id)
{
- void *attr = NULL; /* attr token from VOL plugin */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *attr = NULL; /* attr token from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -156,18 +158,17 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the attribute */
- if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, name,
- acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
- if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
done:
/* Clean up on failure */
if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@@ -199,8 +200,8 @@ done:
hid_t
H5Aopen_name(hid_t loc_id, const char *name)
{
- void *attr = NULL; /* attr token from VOL plugin */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *attr = NULL; /* attr token from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -218,22 +219,21 @@ H5Aopen_name(hid_t loc_id, const char *name)
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
- if (NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls,
- name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
- if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Clean up on failure */
if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@@ -265,8 +265,8 @@ done:
hid_t
H5Aopen_idx(hid_t loc_id, unsigned idx)
{
- void *attr = NULL; /* attr token from VOL plugin */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *attr = NULL; /* attr token from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -291,18 +291,17 @@ H5Aopen_idx(hid_t loc_id, unsigned idx)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
- if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls,
- NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
- if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Clean up on failure */
if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
@@ -330,7 +329,7 @@ done:
int
H5Aget_num_attrs(hid_t loc_id)
{
- H5VL_object_t *vol_obj;
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
H5O_info_t oinfo;
int ret_value = -1;
@@ -341,13 +340,12 @@ H5Aget_num_attrs(hid_t loc_id)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
- /* get the location object */
+ /* Get the location object */
if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Get the number of attributes for the object */
- if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, &oinfo, H5O_INFO_ALL) < 0)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, &oinfo, H5O_INFO_ALL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object")
H5_CHECKED_ASSIGN(ret_value, int, oinfo.num_attrs, hsize_t);
@@ -397,18 +395,23 @@ done:
herr_t
H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data)
{
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ herr_t ret_value; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5_ITER_ERROR)
H5TRACE4("e", "i*Iux*x", loc_id, attr_num, op, op_data);
/* check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "location is not valid for an attribute")
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier")
/* Call attribute iteration routine */
- if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0)
- HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
+ if((ret_value = H5VL_attr_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_ATTR_ITERATE_OLD, loc_id, attr_num, op, op_data)) < 0)
+ HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes");
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Aint.c b/src/H5Aint.c
index ca5cb80..6502fa4 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -43,7 +43,6 @@
#include "H5Opkg.h" /* Object headers */
#include "H5SMprivate.h" /* Shared Object Header Messages */
#include "H5VLprivate.h" /* Virtual Object Layer */
-#include "H5VLnative_private.h" /* Native VOL driver */
/****************/
@@ -924,7 +923,7 @@ H5A__get_type(H5A_t *attr)
* two level IDs, where the VOL object is a copy of the
* returned datatype
*/
- if ((ret_value = H5VL_native_register(H5I_DATATYPE, dt, TRUE)) < 0)
+ if ((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
}
else {
@@ -1156,7 +1155,7 @@ H5A__close_cb(H5VL_object_t *attr_vol_obj)
HDassert(attr_vol_obj);
/* Close the attribute */
- if((ret_value = H5VL_attr_close(attr_vol_obj->data, attr_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if((ret_value = H5VL_attr_close(attr_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute")
/* Free the VOL object */
@@ -2621,7 +2620,7 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5
H5G_name_t obj_path; /* Opened object group hier. path */
H5O_loc_t obj_oloc; /* Opened object object location */
hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
- hid_t obj_loc_id = (-1); /* ID for object located */
+ hid_t obj_loc_id = H5I_INVALID_HID; /* ID for object located */
H5A_attr_iter_op_t attr_op; /* Attribute operator */
void *temp_obj = NULL;
H5I_type_t obj_type;
@@ -2648,7 +2647,7 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object");
/* Get an ID for the object */
- if((obj_loc_id = H5VL_native_register(obj_type, temp_obj, TRUE)) < 0)
+ if((obj_loc_id = H5VL_wrap_register(obj_type, temp_obj, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype");
/* Call internal attribute iteration routine */
@@ -2660,7 +2659,7 @@ done:
if(obj_loc_id != H5I_INVALID_HID) {
if(H5I_dec_app_ref(obj_loc_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object");
- }
+ } /* end if */
else if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location");
@@ -2689,7 +2688,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op,
hsize_t idx; /* Index of attribute to start iterating at */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE_NOERR
/* Build attribute operator info */
attr_op.op_type = H5A_ATTR_OP_APP;
@@ -2700,13 +2699,12 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op,
/* Call internal attribute iteration routine */
if((ret_value = H5A__iterate_common(loc_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, &idx, &attr_op, op_data)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes")
+ HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
/* Translate hsize_t index value to legacy unsigned index value*/
if(attr_num)
*attr_num = (unsigned)idx;
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__iterate_old() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
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/H5CX.c b/src/H5CX.c
index e08ca2f..1d9cf3d 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -125,7 +125,6 @@
(*head)->ctx.H5_GLUE(PROP_FIELD,_set) = TRUE; \
} /* end if */ \
}
-#endif /* H5_HAVE_PARALLEL */
/* Macro for the duplicated code to test and set properties for a property list */
#define H5CX_SET_PROP(PROP_NAME, PROP_FIELD) \
@@ -140,6 +139,7 @@
if(H5P_set((*head)->ctx.dxpl, PROP_NAME, &(*head)->ctx.PROP_FIELD) < 0) \
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, NULL, "error setting filter mask xfer property") \
} /* end if */
+#endif /* H5_HAVE_PARALLEL */
/******************/
@@ -267,6 +267,10 @@ typedef struct H5CX_t {
/* Cached LAPL properties */
size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */
+
+ /* Cached VOL properties */
+ void *vol_wrap_ctx; /* VOL plugin's "wrap context" for creating IDs */
+ hbool_t vol_wrap_ctx_valid; /* Whether VOL plugin's "wrap context" for creating IDs is valid */
} H5CX_t;
/* Typedef for nodes on the API context stack */
@@ -918,6 +922,40 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_set_vol_wrap_ctx
+ *
+ * Purpose: Sets the VOL object wrapping context for an operation.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * October 14, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_set_vol_wrap_ctx(void *vol_wrap_ctx)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(head && *head);
+
+ /* Set the API context value */
+ (*head)->ctx.vol_wrap_ctx = vol_wrap_ctx;
+
+ /* Mark the value as valid */
+ (*head)->ctx.vol_wrap_ctx_valid = TRUE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_set_vol_wrap_ctx() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_get_dxpl
*
* Purpose: Retrieves the DXPL ID for the current API call context.
@@ -970,6 +1008,42 @@ H5CX_get_lapl(void)
/*-------------------------------------------------------------------------
+ * Function: H5CX_get_vol_wrap_ctx
+ *
+ * Purpose: Retrieves the VOL object wrapping context for an operation.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * October 14, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_vol_wrap_ctx(void **vol_wrap_ctx)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_wrap_ctx);
+ HDassert(head && *head);
+
+ /* Check for value that was set */
+ if((*head)->ctx.vol_wrap_ctx_valid)
+ /* Get the value */
+ *vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx;
+ else
+ *vol_wrap_ctx = NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_vol_wrap_ctx() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_get_tag
*
* Purpose: Retrieves the object tag for the current API call context.
@@ -2501,7 +2575,9 @@ H5CX__pop_common(void)
ret_value = (*head);
(*head) = (*head)->next;
+#ifdef H5_HAVE_PARALLEL
done:
+#endif /* H5_HAVE_PARALLEL */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX__pop_common() */
diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h
index 44a4067..57ca5cd 100644
--- a/src/H5CXprivate.h
+++ b/src/H5CXprivate.h
@@ -63,10 +63,12 @@ H5_DLL void H5CX_set_lapl(hid_t lapl_id);
H5_DLL herr_t H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
hid_t loc_id, hbool_t is_collective);
H5_DLL herr_t H5CX_set_loc(hid_t loc_id);
+H5_DLL herr_t H5CX_set_vol_wrap_ctx(void *wrap_ctx);
/* "Getter" routines for API context info */
H5_DLL hid_t H5CX_get_dxpl(void);
H5_DLL hid_t H5CX_get_lapl(void);
+H5_DLL herr_t H5CX_get_vol_wrap_ctx(void **wrap_ctx);
H5_DLL haddr_t H5CX_get_tag(void);
H5_DLL H5AC_ring_t H5CX_get_ring(void);
#ifdef H5_HAVE_PARALLEL
diff --git a/src/H5Cquery.c b/src/H5Cquery.c
index 6c927b0..e4f3133 100644
--- a/src/H5Cquery.c
+++ b/src/H5Cquery.c
@@ -472,11 +472,11 @@ H5C_get_mdc_image_info(H5C_t * cache_ptr, haddr_t *image_addr, hsize_t *image_le
if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry")
- if(image_addr == NULL || image_len == NULL)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad image_addr or image_len on entry")
- *image_addr = cache_ptr->image_addr;
- *image_len = cache_ptr->image_len;
+ if(image_addr)
+ *image_addr = cache_ptr->image_addr;
+ if(image_len)
+ *image_len = cache_ptr->image_len;
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5D.c b/src/H5D.c
index eb40cc8..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 */
@@ -158,17 +160,16 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the dataset */
- if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls,
- name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */
- if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle")
+ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle")
done:
if(H5I_INVALID_HID == ret_value)
- if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
@@ -211,7 +212,7 @@ hid_t
H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
hid_t dapl_id)
{
- void *dset = NULL; /* dset token from VOL plugin */
+ void *dset = NULL; /* dset token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
@@ -250,19 +251,17 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the dataset */
- if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls,
- NULL, dcpl_id, dapl_id,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, NULL, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */
- if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
+ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
- if(dset && H5VL_dataset_close (dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
@@ -287,7 +286,7 @@ done:
hid_t
H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id)
{
- void *dset = NULL; /* dset token from VOL plugin */
+ void *dset = NULL; /* dset token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -314,18 +313,18 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id)
loc_params.obj_type = H5I_get_type(loc_id);
/* Open the dataset */
- if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->driver->cls, name,
- dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (dset = H5VL_dataset_open(vol_obj, &loc_params, name, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset")
/* Register an atom for the dataset */
- if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
+ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
done:
if(H5I_INVALID_HID == ret_value)
- if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
+
FUNC_LEAVE_API(ret_value)
} /* end H5Dopen2() */
@@ -391,8 +390,7 @@ H5Dget_space(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
/* Get the dataspace */
- if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace")
done:
@@ -423,8 +421,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
/* Get dataspace status */
- if((ret_value = H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE_STATUS,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, allocation)) < 0)
+ if((ret_value = H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE_STATUS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, allocation)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status")
done:
@@ -459,8 +456,7 @@ H5Dget_type(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
/* get the datatype */
- if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_TYPE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
done:
@@ -498,8 +494,7 @@ H5Dget_create_plist(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
/* Get the dataset creation property list */
- if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_DCPL,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties")
done:
@@ -554,8 +549,7 @@ H5Dget_access_plist(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
/* Get the dataset access property list */
- if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_DAPL,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties")
done:
@@ -592,8 +586,7 @@ H5Dget_storage_size(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier")
/* Get the storage size */
- if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_STORAGE_SIZE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size")
done:
@@ -626,8 +619,7 @@ H5Dget_offset(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier")
/* Get the offset */
- if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_OFFSET,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset")
done:
@@ -840,8 +832,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
vlen_bufsize.mspace_id = H5I_INVALID_HID;
/* Get a copy of the dataset's dataspace */
- if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0)
+ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace")
/* Create a scalar for the memory dataspace */
@@ -922,8 +913,7 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[])
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Set the extent */
- if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_SET_EXTENT,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0)
+ if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent")
done:
@@ -961,8 +951,7 @@ H5Dflush(hid_t dset_id)
* XXX: Note that we need to pass the ID to the VOL since the H5F_flush_cb_t
* callback needs it and that's in the public API.
*/
- if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_FLUSH,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0)
+ if((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset")
done:
@@ -997,8 +986,7 @@ H5Drefresh(hid_t dset_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Refresh the dataset object */
- if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_REFRESH,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0)
+ if((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset")
done:
@@ -1041,8 +1029,7 @@ H5Dformat_convert(hid_t dset_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Convert the dataset */
- if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_DATASET_FORMAT_CONVERT) < 0)
+ if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_FORMAT_CONVERT) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format")
done:
@@ -1078,8 +1065,7 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL")
/* Get the chunk indexing type */
- if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0)
+ if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type")
done:
@@ -1120,8 +1106,7 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL")
/* Get the dataset creation property list */
- if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0)
+ if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk")
done:
diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c
index 58238bc..76827b4 100644
--- a/src/H5Ddeprec.c
+++ b/src/H5Ddeprec.c
@@ -40,7 +40,7 @@
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
-#include "H5VLprivate.h" /* VOL plugins */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -113,7 +113,7 @@ hid_t
H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t dcpl_id)
{
- void *dset = NULL; /* dset token from VOL plugin */
+ void *dset = NULL; /* dset token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
@@ -161,17 +161,16 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the dataset through the VOL */
- if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, dcpl_id,
- H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */
- if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
+ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
if (H5I_INVALID_HID == ret_value)
- if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
@@ -198,7 +197,7 @@ done:
hid_t
H5Dopen1(hid_t loc_id, const char *name)
{
- void *dset = NULL; /* dset token from VOL plugin */
+ void *dset = NULL; /* dset token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -221,17 +220,16 @@ H5Dopen1(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the dataset */
- if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->driver->cls, name,
- H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (dset = H5VL_dataset_open(vol_obj, &loc_params, name, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset")
/* Get an atom for the dataset */
- if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
+ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
done:
if(H5I_INVALID_HID == ret_value)
- if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
@@ -275,8 +273,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
/* Get the dataspace pointer for the dataset */
- if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) < 0)
+ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataspace")
if(H5I_INVALID_HID == sid)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "received an invalid dataspace from the dataset")
@@ -306,8 +303,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[])
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Increase size */
- if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_SET_EXTENT,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0)
+ if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to extend dataset")
done:
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 253d005..6bb3343 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -21,17 +21,16 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5FOprivate.h" /* File objects */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5VLprivate.h" /* Virtual Object Layer */
-#include "H5VLnative_private.h" /* Native VOL driver */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5FOprivate.h" /* File objects */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -301,7 +300,7 @@ H5D__close_cb(H5VL_object_t *dset_vol_obj)
HDassert(dset_vol_obj);
/* Close the dataset */
- if(H5VL_dataset_close(dset_vol_obj->data, dset_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_dataset_close(dset_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset");
done:
@@ -975,7 +974,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
/* Get the dataset's datatype */
if(NULL == (dt = (const H5T_t *)H5I_object(type_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
- /* If this is a named datatype, get the pointer via the VOL driver */
+ /* If this is a named datatype, get the pointer via the VOL plugin */
type = (const H5T_t *)H5T_get_actual_type(dt);
/* Check if the datatype is "sensible" for use in a dataset */
@@ -1962,12 +1961,12 @@ H5D_oloc(H5D_t *dataset)
*-------------------------------------------------------------------------
*/
H5G_name_t *
-H5D_nameof(H5D_t *dataset)
+H5D_nameof(const H5D_t *dataset)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
- FUNC_LEAVE_NOAPI(dataset ? &(dataset->path) : (H5G_name_t *)NULL)
+ FUNC_LEAVE_NOAPI(dataset ? (H5G_name_t *)&(dataset->path) : (H5G_name_t *)NULL)
} /* end H5D_nameof() */
@@ -2460,10 +2459,7 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id,
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point")
/* Read in the point (with the custom VL memory allocator) */
- if(H5VL_dataset_read(vol_obj->data, vol_obj->driver->cls,
- type_id, vlen_bufsize->mspace_id,
- vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT,
- vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0)
+ if(H5VL_dataset_read(vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point")
done:
@@ -3402,13 +3398,12 @@ H5D__get_type(const H5D_t *dset)
* two-level IDs, where the VOL object is a copy of the
* returned datatype.
*/
- if((ret_value = H5VL_native_register(H5I_DATATYPE, dt, TRUE)) < 0)
+ if((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
- }
- else {
+ } /* end if */
+ else
if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
- }
done:
if(ret_value < 0)
diff --git a/src/H5Dio.c b/src/H5Dio.c
index b6d4f1b..fe85d23 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"
@@ -191,8 +193,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
H5CX_set_dxpl(dxpl_id);
/* Read the data */
- if ((ret_value = H5VL_dataset_read(vol_obj->data, vol_obj->driver->cls, mem_type_id, mem_space_id,
- file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0)
+ if ((ret_value = H5VL_dataset_read(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
done:
@@ -243,8 +244,7 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil
H5CX_set_dxpl(dxpl_id);
/* Read the raw chunk */
- if (H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, dxpl_id,
- H5_REQUEST_NULL, H5VL_DATASET_CHUNK_READ, offset, filters, buf) < 0)
+ if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_CHUNK_READ, offset, filters, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data")
done:
@@ -315,8 +315,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
H5CX_set_dxpl(dxpl_id);
/* Write the data */
- if ((ret_value = H5VL_dataset_write(vol_obj->data, vol_obj->driver->cls, mem_type_id, mem_space_id,
- file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0)
+ if ((ret_value = H5VL_dataset_write(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
done:
@@ -373,8 +372,7 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of
H5CX_set_dxpl(dxpl_id);
/* Write chunk */
- if (H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, dxpl_id,
- H5_REQUEST_NULL, H5VL_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0)
+ if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data")
done:
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index c84c245..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 cbee0de..4e9cda8 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -158,7 +158,7 @@ H5_DLL herr_t H5D_close(H5D_t *dataset);
H5_DLL herr_t H5D_mult_refresh_close(hid_t dset_id);
H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset);
H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset);
-H5_DLL H5G_name_t *H5D_nameof(H5D_t *dataset);
+H5_DLL H5G_name_t *H5D_nameof(const H5D_t *dataset);
H5_DLL H5T_t *H5D_typeof(const H5D_t *dset);
H5_DLL herr_t H5D_flush_all(const H5F_t *f);
H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset);
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/H5Dvirtual.c b/src/H5Dvirtual.c
index c7c1eec..c0d49d8 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -58,7 +58,6 @@
#include "H5Oprivate.h" /* Object headers */
#include "H5Pprivate.h" /* Property Lists */
#include "H5Sprivate.h" /* Dataspaces */
-#include "H5VLnative_private.h" /* Native VOL driver */
#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -2963,7 +2962,6 @@ static herr_t
H5D__virtual_refresh_source_dset(H5D_t **dset)
{
hid_t temp_id = H5I_INVALID_HID; /* Temporary dataset identifier */
- hid_t native_vol_id = H5I_INVALID_HID; /* ID for the native VOL driver */
H5VL_object_t *vol_obj = NULL; /* VOL object stored with the ID */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2972,12 +2970,8 @@ H5D__virtual_refresh_source_dset(H5D_t **dset)
/* Sanity check */
HDassert(dset && *dset);
- /* Get the native VOL driver's ID */
- if((native_vol_id = H5VL_native_get_driver_id()) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get native VOL driver ID")
-
/* Get a temporary identifier for this source dataset */
- if((temp_id = H5VL_register_using_vol_id(H5I_DATASET, *dset, native_vol_id, FALSE)) < 0)
+ if((temp_id = H5VL_wrap_register(H5I_DATASET, *dset, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID")
/* Refresh source dataset */
@@ -2987,7 +2981,8 @@ H5D__virtual_refresh_source_dset(H5D_t **dset)
/* Discard the identifier & replace the dataset */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_remove(temp_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID")
- *dset = (H5D_t *)(vol_obj->data);
+ if(NULL == (*dset = (H5D_t *)H5VL_object_data(vol_obj)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve library object from VOL object")
vol_obj->data = NULL;
done:
@@ -2995,7 +2990,7 @@ done:
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__virtual_refresh_source_dsets() */
+} /* end H5D__virtual_refresh_source_dset() */
/*-------------------------------------------------------------------------
diff --git a/src/H5ESpublic.h b/src/H5ESpublic.h
index cb8eebf..e3b1b56 100644
--- a/src/H5ESpublic.h
+++ b/src/H5ESpublic.h
@@ -29,7 +29,7 @@ typedef enum H5ES_status_t {
H5ES_STATUS_IN_PROGRESS, /* Operation has not yet completed */
H5ES_STATUS_SUCCEED, /* Operation has completed, successfully */
H5ES_STATUS_FAIL, /* Operation has completed, but failed */
- H5ES_STATUS_CANCEL /* Operation has not completed and has been cancelled */
+ H5ES_STATUS_CANCELED /* Operation has not completed and was canceled */
} H5ES_status_t;
diff --git a/src/H5F.c b/src/H5F.c
index a31dff3..3cb7807 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -38,15 +38,31 @@
#include "H5Tprivate.h" /* Datatypes */
#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
/****************/
/* Local Macros */
/****************/
+
/******************/
/* Local Typedefs */
/******************/
+/* User data for traversal routine to get ID counts */
+typedef struct {
+ size_t obj_count; /* Number of objects counted so far */
+ unsigned types; /* Types of objects to be counted */
+} H5F_trav_obj_cnt_t;
+
+/* User data for traversal routine to get ID lists */
+typedef struct {
+ size_t max_objs; /* Maximum # of IDs to record */
+ hid_t *oid_list; /* Array of recorded IDs*/
+ size_t obj_count; /* Number of objects counted so far */
+} H5F_trav_obj_ids_t;
+
/********************/
/* Package Typedefs */
@@ -199,12 +215,12 @@ H5F__close_cb(H5VL_object_t *file_vol_obj)
HDassert(file_vol_obj);
/* Close the file */
- if(H5VL_file_close(file_vol_obj->data, file_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file");
+ if(H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
/* Free the VOL object */
if(H5VL_free_object(file_vol_obj) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -239,8 +255,7 @@ H5Fget_create_plist(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
/* Retrieve the file creation property list */
- if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_FCPL,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_FCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties")
done:
@@ -280,8 +295,7 @@ H5Fget_access_plist(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
/* Retrieve the file's access property list */
- if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_FAPL,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_FAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list")
done:
@@ -308,7 +322,7 @@ H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id,
FUNC_ENTER_STATIC_NOERR
- *(udata->obj_count) = *(udata->obj_count) + 1;
+ udata->obj_count++;
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F_get_all_count_cb */
@@ -350,42 +364,38 @@ H5Fget_obj_count(hid_t file_id, unsigned types)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id")
/* Get the count */
- if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_OBJ_COUNT,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, &ret_value) < 0)
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, &ret_value) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)")
}
/* If we passed in the 'special' ID, get the count for everything open in the
* library, iterating over all open files and getting the object count for each.
- *
- * XXX: Consider making this a helper function in H5I.
*/
else {
H5F_trav_obj_cnt_t udata;
- udata.obj_count = &ret_value;
+ /* Set up callback context */
udata.types = types | H5F_OBJ_LOCAL;
+ udata.obj_count = 0;
- if(types & H5F_OBJ_FILE) {
+ if(types & H5F_OBJ_FILE)
if(H5I_iterate(H5I_FILE, H5F__get_all_count_cb, &udata, TRUE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed");
- }
- if(types & H5F_OBJ_DATASET) {
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed")
+ if(types & H5F_OBJ_DATASET)
if(H5I_iterate(H5I_DATASET, H5F__get_all_count_cb, &udata, TRUE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed");
- }
- if(types & H5F_OBJ_GROUP) {
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed")
+ if(types & H5F_OBJ_GROUP)
if(H5I_iterate(H5I_GROUP, H5F__get_all_count_cb, &udata, TRUE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed");
- }
- if(types & H5F_OBJ_DATATYPE) {
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed")
+ if(types & H5F_OBJ_DATATYPE)
if(H5I_iterate(H5I_DATATYPE, H5F__get_all_count_cb, &udata, TRUE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed");
- }
- if(types & H5F_OBJ_ATTR) {
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed")
+ if(types & H5F_OBJ_ATTR)
if(H5I_iterate(H5I_ATTR, H5F__get_all_count_cb, &udata, TRUE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed");
- }
- }
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed")
+
+ /* Set return value */
+ ret_value = (ssize_t)udata.obj_count;
+ } /* end else */
done:
FUNC_LEAVE_API(ret_value)
@@ -411,11 +421,12 @@ H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void *key)
FUNC_ENTER_STATIC_NOERR
- if(*udata->obj_count >= udata->max_objs)
+ if(udata->obj_count >= udata->max_objs)
HGOTO_DONE(H5_ITER_STOP);
- udata->oid_list[*udata->obj_count] = obj_id;
- *(udata->obj_count) = *(udata->obj_count) + 1;
+ /* Add the ID to the array */
+ udata->oid_list[udata->obj_count] = obj_id;
+ udata->obj_count++;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -430,6 +441,9 @@ done:
* NOTE: Type mismatch - You can ask for more objects than can be
* returned.
*
+ * NOTE: Currently, the IDs' ref counts are not incremented. Is this
+ * intentional and documented?
+ *
* Return: Success: The number of IDs in oid_list
*
* Failure: -1
@@ -462,14 +476,12 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
/* Get the IDs */
- if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_OBJ_IDS,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0)
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_IDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)")
- }
+ } /* end if */
/* If we passed in the 'special' ID, get the count for everything open in the
* library, iterating over all open files and getting the object count for each.
*
- * XXX: Consider making this a helper function in H5I.
* XXX: Note that the RM states that passing in a negative value for max_objs
* gets you all the objects. This technically works, but is clearly wrong
* behavior since max_objs is an unsigned type.
@@ -477,31 +489,30 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list)
else {
H5F_trav_obj_ids_t udata;
+ /* Set up callback context */
udata.max_objs = max_objs;
udata.oid_list = oid_list;
- udata.obj_count = &ret_value;
+ udata.obj_count = 0;
- if(types & H5F_OBJ_FILE) {
+ if(types & H5F_OBJ_FILE)
if(H5I_iterate(H5I_FILE, H5F__get_all_ids_cb, &udata, TRUE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed");
- }
- if(types & H5F_OBJ_DATASET) {
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed")
+ if(types & H5F_OBJ_DATASET)
if(H5I_iterate(H5I_DATASET, H5F__get_all_ids_cb, &udata, TRUE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed");
- }
- if(types & H5F_OBJ_GROUP) {
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed")
+ if(types & H5F_OBJ_GROUP)
if(H5I_iterate(H5I_GROUP, H5F__get_all_ids_cb, &udata, TRUE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed");
- }
- if(types & H5F_OBJ_DATATYPE) {
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed")
+ if(types & H5F_OBJ_DATATYPE)
if(H5I_iterate(H5I_DATATYPE, H5F__get_all_ids_cb, &udata, TRUE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed");
- }
- if(types & H5F_OBJ_ATTR) {
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed")
+ if(types & H5F_OBJ_ATTR)
if(H5I_iterate(H5I_ATTR, H5F__get_all_ids_cb, &udata, TRUE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed");
- }
- }
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed")
+
+ /* Set return value */
+ ret_value = (ssize_t)udata.obj_count;
+ } /* end else */
done:
FUNC_LEAVE_API(ret_value)
@@ -536,8 +547,7 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Retrieve the VFD handle for the file */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle")
done:
@@ -574,8 +584,7 @@ H5Fis_accessible(const char *name, hid_t fapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list")
/* Check if file is accessible */
- if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0)
+ if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5")
done:
@@ -611,12 +620,9 @@ done:
hid_t
H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
{
- void *new_file = NULL; /* file struct for new file */
-
+ H5F_t *new_file = NULL; /* File struct for new file */
H5P_genplist_t *plist; /* Property list pointer */
- H5VL_class_t *cls = NULL; /* VOL Class structure for callback info */
- H5VL_t *driver = NULL; /* VOL driver struct */
- H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
hid_t ret_value; /* return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@@ -650,10 +656,8 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* get the VOL info from the fapl */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list")
- if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get vol driver info")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL driver ID")
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
/* Adjust bit flags by turning on the creation bit and making sure that
* the EXCL or TRUNC bit is set. All newly-created files are opened for
@@ -664,21 +668,12 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
flags |= H5F_ACC_RDWR | H5F_ACC_CREAT;
/* Create a new file or truncate an existing file through the VOL */
- if(NULL == (new_file = H5VL_file_create(cls, filename, flags, fcpl_id, fapl_id,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (new_file = (H5F_t *)H5VL_file_create(&connector_prop, filename, flags, fcpl_id, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file")
- /* Setup VOL driver struct */
- if(NULL == (driver = H5FL_CALLOC(H5VL_t)))
- HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VL info struct")
- driver->cls = cls;
- driver->id = driver_prop.driver_id;
- if(H5I_inc_ref(driver->id, FALSE) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver")
-
/* Get an atom for the file */
- if((ret_value = H5VL_register(H5I_FILE, new_file, driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
+ if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
done:
FUNC_LEAVE_API(ret_value)
@@ -707,12 +702,10 @@ done:
hid_t
H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
{
- void *new_file = NULL; /* file struct for new file */
- H5P_genplist_t *plist; /* Property list pointer */
- H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */
- H5VL_class_t *cls = NULL; /* VOL class structure for callback info */
- H5VL_t *driver = NULL; /* VOL driver struct */
- hid_t ret_value; /* return value */
+ H5F_t *new_file = NULL; /* File struct for new file */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ hid_t ret_value; /* return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "*sIui", filename, flags, fapl_id);
@@ -739,26 +732,16 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
/* Get the VOL info from the fapl */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list")
- if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL driver info")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL driver ID")
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
/* Open the file through the VOL layer */
- if(NULL == (new_file = H5VL_file_open(cls, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (new_file = (H5F_t *)H5VL_file_open(&connector_prop, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file")
- /* Setup VOL driver struct */
- if(NULL == (driver = H5FL_CALLOC(H5VL_t)))
- HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VL info struct")
- driver->cls = cls;
- driver->id = driver_prop.driver_id;
- if(H5I_inc_ref(driver->id, FALSE) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver")
-
/* Get an ID for the file */
- if((ret_value = H5VL_register(H5I_FILE, new_file, driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
+ if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
done:
FUNC_LEAVE_API(ret_value)
@@ -789,17 +772,15 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
/* Get the type of object we're flushing + sanity check */
obj_type = H5I_get_type(object_id);
if(H5I_FILE != obj_type && H5I_GROUP != obj_type && H5I_DATATYPE != obj_type &&
- H5I_DATASET != obj_type && H5I_ATTR != obj_type) {
+ H5I_DATASET != obj_type && H5I_ATTR != obj_type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- }
/* get the file object */
if(NULL == (vol_obj = H5VL_vol_object(object_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Flush the object */
- if(H5VL_file_specific(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_FLUSH,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, scope) < 0)
+ if(H5VL_file_specific(vol_obj, H5VL_FILE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)obj_type, (int)scope) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file")
done:
@@ -863,7 +844,7 @@ hid_t
H5Freopen(hid_t file_id)
{
H5VL_object_t *vol_obj = NULL;
- void *file; /* File token from VOL driver */
+ H5F_t *file = NULL; /* File struct for new file */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@@ -874,17 +855,16 @@ H5Freopen(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
/* Reopen the file */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_REOPEN, &file) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL driver")
+ if(H5VL_file_specific(vol_obj, H5VL_FILE_REOPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &file) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL connector")
/* Make sure that worked */
if(NULL == file)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file")
/* Get an atom for the file */
- if((ret_value = H5VL_register(H5I_FILE, file, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
+ if((ret_value = H5VL_register(H5I_FILE, file, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
done:
/* XXX (VOL MERGE): If registration fails, file will not be closed */
@@ -919,10 +899,9 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Get the flags */
- if((ret_value = H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_INTENT,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0)
+ if((ret_value = H5VL_file_get(vol_obj, H5VL_FILE_GET_INTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags")
- }
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
@@ -954,8 +933,7 @@ H5Fget_freespace(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
/* Get the amount of free space in the file */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FREE_SPACE, &ret_value) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space")
done:
@@ -990,8 +968,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the file size */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_SIZE, size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
done:
@@ -1041,8 +1018,8 @@ done:
ssize_t
H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len)
{
- H5VL_object_t *vol_obj; /* File object for file ID */
- ssize_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* File object for file ID */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "i*xz", file_id, buf_ptr, buf_len);
@@ -1052,8 +1029,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID")
/* Get the file image */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image")
done:
@@ -1093,8 +1069,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Get the metadata cache configuration */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_CONF, config_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration")
done:
@@ -1127,8 +1102,7 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Set the metadata cache configuration */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_MDC_CONFIG, config_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration")
done:
@@ -1164,8 +1138,7 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the current hit rate */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_HR, hit_rate_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate")
done:
@@ -1202,9 +1175,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the size data */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE,
- max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_SIZE, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size")
done:
@@ -1242,8 +1213,7 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Reset the hit rate statistic */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate")
done:
@@ -1277,7 +1247,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size)
{
H5VL_object_t *vol_obj = NULL;
H5I_type_t type;
- ssize_t ret_value = -1;
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", obj_id, name, size);
@@ -1292,8 +1262,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
/* Get the filename via the VOL */
- if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_NAME,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, size, name, &ret_value) < 0)
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)type, size, name, &ret_value) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file name")
done:
@@ -1338,8 +1307,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the file information */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- H5VL_FILE_GET_INFO, type, finfo) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_INFO, (int)type, finfo) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
done:
@@ -1375,8 +1343,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the retry info */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info")
done:
@@ -1415,8 +1382,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0")
/* Get the free-space section information in the file */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, (int)type, nsects) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections")
done:
@@ -1449,8 +1415,7 @@ H5Fclear_elink_file_cache(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Release the EFC */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
done:
@@ -1509,9 +1474,8 @@ H5Fstart_swmr_write(hid_t file_id)
if(H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* start SWMR writing */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0)
+ /* Start SWMR writing */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_START_SWMR_WRITE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing")
done:
@@ -1543,8 +1507,7 @@ H5Fstart_mdc_logging(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* Call mdc logging function */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_START_MDC_LOGGING) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_START_MDC_LOGGING) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging")
done:
@@ -1577,8 +1540,7 @@ H5Fstop_mdc_logging(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* Call mdc logging function */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_STOP_MDC_LOGGING) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging")
done:
@@ -1612,8 +1574,7 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* Call mdc logging function */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status")
done:
@@ -1633,13 +1594,10 @@ done:
*
*-------------------------------------------------------------------------
*/
-/* XXX (VOL MERGE): This could go in the native VOL driver under 'optional'
- */
herr_t
H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high)
{
H5VL_object_t *vol_obj; /* File as VOL object */
- H5F_t *f; /* File */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1648,15 +1606,14 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high)
/* Check args */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID")
- f = (H5F_t *)(vol_obj->data);
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call internal set_libver_bounds function */
- if(H5F__set_libver_bounds(f, low, high) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds")
+ /* Set the library's version bounds */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, low, high) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds")
done:
FUNC_LEAVE_API(ret_value)
@@ -1692,8 +1649,7 @@ H5Fformat_convert(hid_t file_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Convert the format */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_FORMAT_CONVERT) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_FORMAT_CONVERT) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format")
done:
@@ -1724,8 +1680,7 @@ H5Freset_page_buffering_stats(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Reset the statistics */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_RESET_PAGE_BUFFERING_STATS) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering")
done:
@@ -1760,9 +1715,7 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats")
/* Get the statistics */
- if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_FILE_GET_PAGE_BUFFERING_STATS,
- accesses, hits, misses, evictions, bypasses) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS, accesses, hits, misses, evictions, bypasses) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering")
done:
@@ -1786,21 +1739,19 @@ done:
herr_t
H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len)
{
- H5F_t *file; /* File object for file ID */
+ H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*a*h", file_id, image_addr, image_len);
/* Check args */
- if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
- if(NULL == image_addr || NULL == image_len)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL image addr or image len")
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* Go get the address and size of the cache image */
- if(H5AC_get_mdc_image_info(file->shared->cache, image_addr, image_len) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO, image_addr, image_len) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
done:
FUNC_LEAVE_API(ret_value)
@@ -1820,29 +1771,23 @@ done:
herr_t
H5Fget_eoa(hid_t file_id, haddr_t *eoa)
{
- H5F_t *file; /* File object for file ID */
- haddr_t rel_eoa; /* Relative address of EOA */
+ H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*a", file_id, eoa);
/* Check args */
- if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
- /* This public routine will work only for drivers with this feature enabled.*/
- /* We might introduce a new feature flag in the future */
- if(!H5F_HAS_FEATURE(file, H5FD_FEAT_SUPPORTS_SWMR_IO))
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine")
-
- /* The real work */
- if(HADDR_UNDEF == (rel_eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed")
+ /* Only do work if valid pointer to fill in */
+ if(eoa) {
+ /* Retrieve the EOA for the file */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_EOA, eoa) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA")
+ } /* end if */
- /* (Note compensating for base address subtraction in internal routine) */
- if(eoa)
- *eoa = rel_eoa + H5FD_get_base_addr(file->shared->lf);
done:
FUNC_LEAVE_API(ret_value)
} /* H5Fget_eoa() */
@@ -1859,30 +1804,19 @@ done:
herr_t
H5Fincrement_filesize(hid_t file_id, hsize_t increment)
{
- H5F_t *file; /* File object for file ID */
- haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* File info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ih", file_id, increment);
/* Check args */
- if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
- /* This public routine will work only for drivers with this feature enabled.*/
- /* We might introduce a new feature flag in the future */
- if(!H5F_HAS_FEATURE(file, H5FD_FEAT_SUPPORTS_SWMR_IO))
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine")
-
- /* Get the maximum of EOA and EOF */
- if(H5F__get_max_eof_eoa(file, &max_eof_eoa) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ")
-
- /* Set EOA to the maximum value + increment */
- /* H5FD_set_eoa() will add base_addr to max_eof_eoa */
- if(H5FD_set_eoa(file->shared->lf, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed")
+ /* Increment the file size */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_INCR_FILESIZE, increment) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 2ab04dc..ec6b2a7 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.
@@ -466,6 +471,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 +581,9 @@ H5FD__core_term(void)
herr_t
H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store)
{
- H5FD_core_fapl_t fa;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value;
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5FD_core_fapl_t fa; /* Core VFD info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "izb", fapl_id, increment, backing_store);
@@ -493,10 +592,16 @@ H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store)
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+ /* Set VFD info values */
+ HDmemset(&fa, 0, sizeof(H5FD_core_fapl_t));
fa.increment = increment;
fa.backing_store = backing_store;
+ fa.write_tracking = H5FD_CORE_WRITE_TRACKING_FLAG;
+ fa.page_size = H5FD_CORE_WRITE_TRACKING_PAGE_SIZE;
- ret_value = H5P_set_driver(plist, H5FD_CORE, &fa);
+ /* Set the property values & the driver for the FAPL */
+ if(H5P_set_driver(plist, H5FD_CORE, &fa) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set core VFD as driver")
done:
FUNC_LEAVE_API(ret_value)
@@ -518,9 +623,9 @@ done:
herr_t
H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_store /*out*/)
{
- H5P_genplist_t *plist; /* Property list pointer */
- const H5FD_core_fapl_t *fa;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ const H5FD_core_fapl_t *fa; /* Core VFD info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ixx", fapl_id, increment, backing_store);
@@ -559,7 +664,7 @@ static void *
H5FD__core_fapl_get(H5FD_t *_file)
{
H5FD_core_t *file = (H5FD_core_t*)_file;
- H5FD_core_fapl_t *fa;
+ H5FD_core_fapl_t *fa; /* Core VFD info */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -569,6 +674,8 @@ H5FD__core_fapl_get(H5FD_t *_file)
fa->increment = file->increment;
fa->backing_store = (hbool_t)(file->fd >= 0);
+ fa->write_tracking = file->write_tracking;
+ fa->page_size = file->bstore_page_size;
/* Set return value */
ret_value = fa;
@@ -776,35 +883,28 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
} /* end if */
} /* end if */
+ /* Get the write tracking & page size */
+ file->write_tracking = fa->write_tracking;
+ file->bstore_page_size = fa->page_size;
+
/* Set up write tracking if the backing store is on */
file->dirty_list = NULL;
if(fa->backing_store) {
- hbool_t write_tracking_flag = FALSE; /* what the user asked for */
hbool_t use_write_tracking = FALSE; /* what we're actually doing */
- /* Get the write tracking flag */
- if(H5P_get(plist, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, &write_tracking_flag) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get core VFD write tracking flag");
-
- /* Get the page size */
- if(H5P_get(plist, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, &(file->bstore_page_size)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get core VFD write tracking page size");
-
/* default is to have write tracking OFF for create (hence the check to see
* if the user explicitly set a page size) and ON with the default page size
* on open (when not read-only).
*/
/* Only use write tracking if the file is open for writing */
- use_write_tracking =
- TRUE == write_tracking_flag /* user asked for write tracking */
- && !(o_flags & O_RDONLY) /* file is open for writing (i.e. not read-only) */
- && file->bstore_page_size != 0; /* page size is not zero */
+ use_write_tracking = (TRUE == fa->write_tracking) /* user asked for write tracking */
+ && !(o_flags & O_RDONLY) /* file is open for writing (i.e. not read-only) */
+ && (file->bstore_page_size != 0); /* page size is not zero */
/* initialize the dirty list */
- if(use_write_tracking) {
+ if(use_write_tracking)
if(NULL == (file->dirty_list = H5SL_create(H5SL_TYPE_HADDR, NULL)))
HGOTO_ERROR(H5E_SLIST, H5E_CANTCREATE, NULL, "can't create core vfd dirty region list");
- } /* end if */
} /* end if */
/* Set return value */
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 906ec28..d1a8fc8 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -291,6 +291,7 @@ H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbu
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+ HDmemset(&fa, 0, sizeof(H5FD_direct_fapl_t));
if(boundary != 0)
fa.mboundary = boundary;
else
@@ -417,7 +418,7 @@ static void *
H5FD_direct_fapl_copy(const void *_old_fa)
{
const H5FD_direct_fapl_t *old_fa = (const H5FD_direct_fapl_t*)_old_fa;
- H5FD_direct_fapl_t *new_fa = H5MM_malloc(sizeof(H5FD_direct_fapl_t));
+ H5FD_direct_fapl_t *new_fa = H5MM_calloc(sizeof(H5FD_direct_fapl_t));
FUNC_ENTER_NOAPI_NOINIT_NOERR
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 3dcd7f5..cd9ab0e 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -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.
*/
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 87f8b6a..c04906e 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -319,6 +319,7 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info)
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator")
/* Initialize driver specific properties */
+ HDmemset(&fa, 0, sizeof(H5FD_mpio_fapl_t));
fa.comm = comm;
fa.info = info;
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index aa1b118..e8dde50 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -497,6 +497,7 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map,
* Initialize driver specific information. No need to copy it into the FA
* struct since all members will be copied by H5Pset_driver().
*/
+ memset(&fa, 0, sizeof(H5FD_multi_fapl_t));
memcpy(fa.memb_map, memb_map, H5FD_MEM_NTYPES*sizeof(H5FD_mem_t));
memcpy(fa.memb_fapl, memb_fapl, H5FD_MEM_NTYPES*sizeof(hid_t));
memcpy(fa.memb_name, memb_name, H5FD_MEM_NTYPES*sizeof(char*));
@@ -892,7 +893,7 @@ static void *
H5FD_multi_fapl_copy(const void *_old_fa)
{
const H5FD_multi_fapl_t *old_fa = (const H5FD_multi_fapl_t*)_old_fa;
- H5FD_multi_fapl_t *new_fa = (H5FD_multi_fapl_t *)malloc(sizeof(H5FD_multi_fapl_t));
+ H5FD_multi_fapl_t *new_fa = (H5FD_multi_fapl_t *)calloc(1, sizeof(H5FD_multi_fapl_t));
int nerrors = 0;
static const char *func="H5FD_multi_fapl_copy"; /* Function Name for error reporting */
diff --git a/src/H5FDtest.c b/src/H5FDtest.c
index 080223c..dec0818 100644
--- a/src/H5FDtest.c
+++ b/src/H5FDtest.c
@@ -104,11 +104,10 @@ H5FD__supports_swmr_test(const char *vfd_name)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(!vfd_name || !HDstrcmp(vfd_name, ""))
+ if(!vfd_name || !HDstrcmp(vfd_name, "") || !HDstrcmp(vfd_name, "nomatch"))
ret_value = TRUE;
else
- ret_value = !HDstrcmp(vfd_name, "log")
- || !HDstrcmp(vfd_name, "sec2");
+ ret_value = !HDstrcmp(vfd_name, "log") || !HDstrcmp(vfd_name, "sec2");
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c
index 6fee596..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 */
@@ -96,7 +98,8 @@
herr_t
H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
{
- H5F_t *f; /* Top file in mount hierarchy */
+ H5VL_object_t *vol_obj = NULL;
+ H5I_type_t type;
H5F_info2_t finfo2; /* Current file info struct */
herr_t ret_value = SUCCEED; /* Return value */
@@ -107,27 +110,17 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
if(!finfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
- /* For file IDs, get the file object directly
- *
- * (This prevents the H5G_loc() call from returning the file pointer for
- * the top file in a mount hierarchy)
- */
- if(H5I_get_type(obj_id) == H5I_FILE ) {
- if(NULL == (f = (H5F_t *)H5VL_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
- }
- else {
- H5G_loc_t loc; /* Object location */
-
- /* Get symbol table entry */
- if(H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID")
- f = loc.oloc->file;
- }
- HDassert(f->shared);
-
- /* Get the current file info */
- if(H5F__get_info(f, &finfo2) < 0)
+ /* Check the type */
+ type = H5I_get_type(obj_id);
+ if(H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Get the file object */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ 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_NATIVE_FILE_GET_INFO, type, &finfo2) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
/* Copy the compatible fields into the older struct */
@@ -165,12 +158,11 @@ H5Fis_hdf5(const char *name)
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "no file name specified")
- /* call the private is_HDF5 function */
- if((ret_value = H5F__is_hdf5(name, H5P_FILE_ACCESS_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable open file")
+ /* Check if file is accessible */
+ if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5P_FILE_ACCESS_DEFAULT, name, &ret_value) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable to determine if file is accessible as HDF5")
done:
-
FUNC_LEAVE_API(ret_value)
} /* end H5Fis_hdf5() */
@@ -209,16 +201,13 @@ done:
*
*-------------------------------------------------------------------------
*/
-/* XXX (VOL MERGE): This could go in the native VOL driver under 'optional'.
- */
herr_t
H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
{
H5VL_object_t *vol_obj; /* File as VOL object */
- H5F_t *f; /* File */
- H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */
- H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */
+ H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ib", file_id, latest_format);
@@ -226,17 +215,20 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
/* Check args */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID")
- f = (H5F_t *)(vol_obj->data);
+
+ /* Set up collective metadata if appropriate */
+ if(H5CX_set_loc(file_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* 'low' and 'high' are both initialized to LATEST.
* If latest format is not expected, set 'low' to EARLIEST
- */
+ */
if(!latest_format)
low = H5F_LIBVER_EARLIEST;
- /* Call private set_libver_bounds function to set the bounds */
- if(H5F__set_libver_bounds(f, low, high) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds")
+ /* Set the library's version bounds */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, (int)low, (int)high) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 1a0c8b9..8de1769 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -37,8 +37,9 @@
#include "H5Pprivate.h" /* Property lists */
#include "H5SMprivate.h" /* Shared Object Header Messages */
#include "H5Tprivate.h" /* Datatypes */
-#include "H5VLprivate.h" /* VOL drivers */
-#include "H5VLnative_private.h" /* Native VOL driver */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+#include "H5VLnative_private.h" /* Native VOL connector */
/****************/
@@ -75,10 +76,12 @@ typedef struct H5F_olist_t {
/* Local Prototypes */
/********************/
+static herr_t H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info);
static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr);
static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key);
static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/);
static char *H5F__getenv_prefix_name(char **env_prefix/*in,out*/);
+static H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf);
static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name);
static herr_t H5F__flush_phase1(H5F_t *f);
static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing);
@@ -107,6 +110,50 @@ H5FL_DEFINE(H5F_file_t);
/*-------------------------------------------------------------------------
+ * Function: H5F__set_vol_conn
+ *
+ * Purpose: Set the VOL connector ID and info for a file.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info)
+{
+ void *new_connector_info = NULL; /* Copy of connector info */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(file);
+
+ /* Copy connector info, if it exists */
+ if(vol_info) {
+ H5VL_class_t *connector; /* Pointer to connector */
+
+ /* Retrieve the connector for the ID */
+ if(NULL == (connector = (H5VL_class_t *)H5I_object(vol_id)))
+ HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Allocate and copy connector info */
+ if(H5VL_copy_connector_info(connector, &new_connector_info, vol_info) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "connector info copy failed")
+ } /* end if */
+
+ /* Cache the connector ID & info for the container */
+ file->shared->vol_id = vol_id;
+ file->shared->vol_info = new_connector_info;
+ if(H5I_inc_ref(file->shared->vol_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__set_vol_conn() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_get_access_plist
*
* Purpose: Returns a copy of the file access property list of the
@@ -129,6 +176,7 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
H5P_genplist_t *old_plist; /* Old property list */
H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */
hbool_t driver_prop_copied = FALSE; /* Whether the driver property has been set up */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
unsigned efc_size = 0;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -141,60 +189,60 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
if((ret_value = H5P_copy_plist(old_plist, app_ref)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "can't copy file access property list")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "can't copy file access property list")
if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(ret_value)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
/* Copy properties of the file access property list */
if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, &(f->shared->mdc_initCacheCfg)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.")
if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(f->shared->rdcc_nslots)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache number of slots")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache number of slots")
if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(f->shared->rdcc_nbytes)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache byte size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache byte size")
if(H5P_set(new_plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &(f->shared->rdcc_w0)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set preempt read chunks")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set preempt read chunks")
if(H5P_set(new_plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment threshold")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment threshold")
if(H5P_set(new_plist, H5F_ACS_ALIGN_NAME, &(f->shared->alignment)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment")
if(H5P_set(new_plist, H5F_ACS_GARBG_COLCT_REF_NAME, &(f->shared->gc_ref)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set garbage collect reference")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set garbage collect reference")
if(H5P_set(new_plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(f->shared->meta_aggr.alloc_size)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set metadata cache size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set metadata cache size")
if(H5P_set(new_plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't sieve buffer size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't sieve buffer size")
if(H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->sdata_aggr.alloc_size)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'small data' cache size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'small data' cache size")
if(H5P_set(new_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &f->shared->low_bound) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'low' bound for library format versions")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'low' bound for library format versions")
if(H5P_set(new_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &f->shared->high_bound) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'high' bound for library format versions")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'high' bound for library format versions")
if(H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->read_attempts)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag")
if(H5P_set(new_plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback")
if(f->shared->efc)
efc_size = H5F__efc_max_nfiles(f->shared->efc);
if(H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set elink file cache size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set elink file cache size")
if(f->shared->page_buf != NULL) {
if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &(f->shared->page_buf->max_size)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set page buffer size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set page buffer size")
if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &(f->shared->page_buf->min_meta_perc)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum metadata fraction of page buffer")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum metadata fraction of page buffer")
if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &(f->shared->page_buf->min_raw_perc)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum raw data fraction of page buffer")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum raw data fraction of page buffer")
} /* end if */
#ifdef H5_HAVE_PARALLEL
if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag")
if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag")
#endif /* H5_HAVE_PARALLEL */
if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.")
/* Prepare the driver property */
driver_prop.driver_id = f->shared->lf->driver_id;
@@ -203,13 +251,19 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
/* Set the driver property */
if(H5P_set(new_plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver ID & info")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver ID & info")
+
+ /* Set the VOL connector property */
+ connector_prop.connector_id = f->shared->vol_id;
+ connector_prop.connector_info = f->shared->vol_info;
+ if(H5P_set(new_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector ID & info")
/* Set the file close degree appropriately */
if(f->shared->fc_degree == H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->lf->cls->fc_degree)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree")
else if(f->shared->fc_degree != H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->fc_degree)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree")
done:
/* Release the copy of the driver info, if it was set up */
@@ -307,11 +361,11 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
if(types & H5F_OBJ_LOCAL) {
olist.file_info.local = TRUE;
olist.file_info.ptr.file = f;
- }
+ } /* end if */
else {
olist.file_info.local = FALSE;
olist.file_info.ptr.shared = f ? f->shared : NULL;
- }
+ } /* end else */
/* Iterate through file IDs to count the number, and put their
* IDs on the object list. */
@@ -319,7 +373,7 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_FILE;
if(H5I_iterate(H5I_FILE, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(1)")
- }
+ } /* end if */
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@@ -330,8 +384,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_DATASET;
if(H5I_iterate(H5I_DATASET, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(2)")
- }
- }
+ } /* end if */
+ } /* end if */
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@@ -342,8 +396,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_GROUP;
if(H5I_iterate(H5I_GROUP, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(3)")
- }
- }
+ } /* end if */
+ } /* end if */
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@@ -354,8 +408,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_DATATYPE;
if(H5I_iterate(H5I_DATATYPE, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(4)")
- }
- }
+ } /* end if */
+ } /* end if */
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@@ -366,8 +420,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_ATTR;
if(H5I_iterate(H5I_ATTR, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(5)")
- }
- }
+ } /* end if */
+ } /* end if */
/* Set the number of objects currently open */
*obj_id_count_ptr = obj_id_count;
@@ -409,8 +463,8 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
(!olist->file_info.ptr.shared ||
(olist->file_info.ptr.shared && ((H5F_t*)obj_ptr)->shared == olist->file_info.ptr.shared)))) {
add_obj = TRUE;
- }
- }
+ } /* end if */
+ } /* end if */
else { /* Either count opened object IDs or put the IDs on the list */
H5O_loc_t *oloc; /* Group entry info for object */
@@ -438,7 +492,6 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
case H5I_BADID:
case H5I_FILE:
case H5I_DATASPACE:
- case H5I_REFERENCE:
case H5I_VFL:
case H5I_VOL:
case H5I_GENPROP_CLS:
@@ -460,7 +513,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
(!olist->file_info.ptr.shared && olist->obj_type != H5I_DATATYPE) ||
(oloc && oloc->file && oloc->file->shared == olist->file_info.ptr.shared)))) {
add_obj = TRUE;
- }
+ } /* end if */
} /* end else */
if(add_obj) {
@@ -468,7 +521,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
if(olist->obj_id_list) {
olist->obj_id_list[olist->list_index] = obj_id;
olist->list_index++;
- }
+ } /* end if */
/* Increment the number of open objects */
if(olist->obj_id_count)
@@ -481,7 +534,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
*/
if(olist->max_nobjs > 0 && olist->list_index >= olist->max_nobjs)
HGOTO_DONE(H5_ITER_STOP) /* Indicate that the iterator should stop */
- }
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -835,13 +888,13 @@ done:
*
*-------------------------------------------------------------------------
*/
-H5F_t *
+static H5F_t *
H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
{
H5F_t *f = NULL;
H5F_t *ret_value = NULL;
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_STATIC
if(NULL == (f = H5FL_CALLOC(H5F_t)))
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure")
@@ -1005,12 +1058,12 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_
f->shared->feature_flags &= ~(unsigned)H5FD_FEAT_ACCUMULATE_METADATA;
if(H5FD_set_feature_flags(f->shared->lf, f->shared->feature_flags) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set feature_flags in VFD")
- }
+ } /* end if */
else {
/* If no value for read attempts has been set, use the default */
if(!f->shared->read_attempts)
f->shared->read_attempts = H5F_METADATA_READ_ATTEMPTS;
- }
+ } /* end else */
/* Determine the # of bins for metdata read retries */
if(H5F_set_retries(f) < 0)
@@ -1036,6 +1089,16 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_
if(H5P_get(plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get object flush cb info")
+ /* Get the VOL connector info */
+ {
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get VOL connector info")
+ if(H5F__set_vol_conn(f, connector_prop.connector_id, connector_prop.connector_info) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't cache VOL connector info")
+ } /* end block */
+
/* Create a metadata cache with the specified number of elements.
* The cache might be created with a different number of elements and
* the access property list should be updated to reflect that.
@@ -1296,6 +1359,25 @@ H5F__dest(H5F_t *f, hbool_t flush)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close property list")
+ /* Clean up the cached VOL connector ID & info */
+ if(f->shared->vol_info) {
+ H5VL_class_t *connector; /* Pointer to connector */
+
+ /* Retrieve the connector for the ID */
+ if(NULL == (connector = (H5VL_class_t *)H5I_object(f->shared->vol_id)))
+ /* Push error, but keep going*/
+ HDONE_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Free the connector info */
+ if(H5VL_free_connector_info(connector, f->shared->vol_info) < 0)
+ /* Push error, but keep going*/
+ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
+ } /* end if */
+ if(f->shared->vol_id > 0)
+ if(H5I_dec_ref(f->shared->vol_id) < 0)
+ /* Push error, but keep going*/
+ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close VOL connector ID")
+
/* Close the file */
if(H5FD_close(f->shared->lf) < 0)
/* Push error, but keep going*/
@@ -1535,7 +1617,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* Create the 'top' file structure */
if(NULL == (file = H5F__new(NULL, flags, fcpl_id, fapl_id, lf))) {
/* If this is the only time the file has been opened and the struct
- * returned is NULL, H5FD_close() will never be called via H5F_dest()
+ * returned is NULL, H5FD_close() will never be called via H5F__dest()
* so we have to close lf here before heading to the error handling.
*/
if(H5FD_close(lf) < 0)
@@ -1634,16 +1716,6 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
*/
if(H5P_get(a_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file close degree")
-
- /* This is a private property to clear the status_flags in the super block */
- /* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */
- if(H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) {
- if(H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags")
- else if(clear)
- file->shared->sblock->status_flags = 0;
- } /* end if */
-
if(shared->nrefs == 1) {
if(fc_degree == H5F_CLOSE_DEFAULT)
shared->fc_degree = lf->cls->fc_degree;
@@ -1657,6 +1729,15 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match")
} /* end if */
+ /* This is a private property to clear the status_flags in the super block */
+ /* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */
+ if(H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) {
+ if(H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags")
+ else if(clear)
+ file->shared->sblock->status_flags = 0;
+ } /* end if */
+
/* Record the evict-on-close MDC behavior. If it's the first time opening
* the file, set it to access property list value; if it's the second time
* or later, verify that the access property list value matches the value
@@ -2099,7 +2180,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
/* Delay flush until the shared file struct is closed, in H5F__dest. If the
* application called H5Fclose, it would have been flushed in that function
- * (unless it will have been flushed in H5F_dest anyways).
+ * (unless it will have been flushed in H5F__dest anyways).
*/
/* Destroy the H5F_t struct and decrement the reference count for the
@@ -2135,7 +2216,7 @@ done:
H5F_t *
H5F__reopen(H5F_t *f)
{
- H5F_t *ret_value = NULL;
+ H5F_t *ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2166,7 +2247,7 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5F_get_id(H5F_t *file, hbool_t app_ref)
+H5F_get_id(H5F_t *file)
{
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -2175,16 +2256,16 @@ H5F_get_id(H5F_t *file, hbool_t app_ref)
HDassert(file);
if(H5I_find_id(file, H5I_FILE, &ret_value) < 0 || H5I_INVALID_HID == ret_value) {
- /* resurrect the ID - Register an ID with the native driver */
- if((ret_value = H5VL_native_register(H5I_FILE, file, app_ref)) < 0)
+ /* resurrect the ID - Register an ID with the native connector */
+ if((ret_value = H5VL_wrap_register(H5I_FILE, file, FALSE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
file->id_exists = TRUE;
- }
+ } /* end if */
else {
/* Increment reference count on existing ID */
- if(H5I_inc_ref(ret_value, app_ref) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed")
- }
+ if(H5I_inc_ref(ret_value, FALSE) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "incrementing file ID failed")
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2999,6 +3080,7 @@ H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr)
HDassert(f->shared);
/* Dispatch to driver */
+ /* (H5FD_set_eoa() will add base_addr to addr) */
if(H5FD_set_eoa(f->shared->lf, type, addr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed")
@@ -3234,7 +3316,7 @@ H5F__start_swmr_write(H5F_t *f)
H5G_name_t *obj_paths = NULL; /* Group hierarchy path */
size_t u; /* Local index variable */
hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */
- H5VL_t *vol_driver = NULL; /* VOL driver for the file */
+ H5VL_t *vol_connector = NULL; /* VOL connector for the file */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -3274,16 +3356,16 @@ H5F__start_swmr_write(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
/* Get the # of opened named datatypes and attributes */
- if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE|H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0)
+ if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE | H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
- if(nt_attr_count)
+ if(nt_attr_count > 0)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "named datatypes and/or attributes opened in the file")
/* Get the # of opened datasets and groups */
- if(H5F_get_obj_count(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0)
+ if(H5F_get_obj_count(f, H5F_OBJ_GROUP | H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
- if(grp_dset_count) {
+ if(grp_dset_count > 0) {
/* Allocate space for group and object locations */
if((obj_ids = (hid_t *) H5MM_malloc(grp_dset_count * sizeof(hid_t))) == NULL)
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for hid_t")
@@ -3298,17 +3380,20 @@ H5F__start_swmr_write(H5F_t *f)
if(H5F_get_obj_ids(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed")
- /* Save the VOL driver for the refresh step */
+ /* Save the VOL connector and the object wrapping context for the refresh step */
if(grp_dset_count > 0) {
- H5VL_object_t *vol_obj = NULL;
+ H5VL_object_t *vol_obj;
+ /* Get the VOL object for one of the IDs */
if(NULL == (vol_obj = H5VL_vol_object(obj_ids[0])))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "invalid object identifier")
- vol_driver = vol_obj->driver;
- }
+ /* Get the (top) connector for the ID */
+ vol_connector = vol_obj->connector;
+ } /* end if */
- /* Refresh opened objects (groups, datasets) in the file */
+ /* Gather information about opened objects (groups, datasets) in the file */
+ /* (For refresh later on) */
for(u = 0; u < grp_dset_count; u++) {
H5O_loc_t *oloc; /* object location */
H5G_loc_t tmp_loc;
@@ -3369,10 +3454,9 @@ H5F__start_swmr_write(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to evict file's cached information")
/* Refresh (reopen) the objects (groups & datasets) in the file */
- for(u = 0; u < grp_dset_count; u++) {
- if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_driver, TRUE) < 0)
+ for(u = 0; u < grp_dset_count; u++)
+ if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_connector, TRUE) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object")
- }
/* Unlock the file */
if(H5FD_unlock(f->shared->lf) < 0)
@@ -3482,3 +3566,152 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__format_convert() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5F__get_file
+ *
+ * Purpose: Utility routine to get file struct for an object
+ *
+ * Returns: SUCCESS: A pointer to the H5F_t struct for the file
+ * associated with the object.
+ * FAILURE: NULL
+ *
+ *---------------------------------------------------------------------------
+ */
+H5F_t *
+H5F__get_file(void *obj, H5I_type_t type)
+{
+ H5F_t *ret_value = NULL; /* File pointer */
+ H5O_loc_t *oloc = NULL; /* Object location for ID */
+
+ FUNC_ENTER_PACKAGE
+
+ switch(type) {
+ case H5I_FILE:
+ ret_value = (H5F_t *)obj;
+ break;
+
+ case H5I_GROUP:
+ oloc = H5G_oloc((H5G_t *)obj);
+ break;
+
+ case H5I_DATATYPE:
+ oloc = H5T_oloc((H5T_t *)obj);
+ break;
+
+ case H5I_DATASET:
+ oloc = H5D_oloc((H5D_t *)obj);
+ break;
+
+ case H5I_ATTR:
+ oloc = H5A_oloc((H5A_t *)obj);
+ break;
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_DATASPACE:
+ case H5I_VFL:
+ case H5I_VOL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+ } /* end switch */
+
+ /* Set return value for objects (not files) */
+ if(oloc)
+ ret_value = oloc->file;
+
+ /* Couldn't find a file struct */
+ if(!ret_value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "object is not associated with a file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5F__get_file */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F__get_file_id
+ *
+ * Purpose: The package version of H5Iget_file_id(), obtains the file
+ * ID given an object ID.
+ *
+ * Return: Success: The file ID associated with the object
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5F__get_file_id(H5F_t *file)
+{
+ hid_t file_id = H5I_INVALID_HID; /* File ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check if the file's ID already exists */
+ if(H5I_find_id(file, H5I_FILE, &file_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed")
+
+ /* If the ID does not exist, register it with the VOL connector */
+ if(H5I_INVALID_HID == file_id) {
+ if((file_id = H5VL_wrap_register(H5I_FILE, file, TRUE)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
+ file->id_exists = TRUE;
+ } /* end if */
+ else {
+ /* Increment ref count on existing ID */
+ if(H5I_inc_ref(file_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed")
+ } /* end else */
+
+ /* Set return value */
+ ret_value = file_id;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__get_file_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_file_id
+ *
+ * Purpose: The private version of H5Iget_file_id(), obtains the file
+ * ID given an object ID.
+ *
+ * Return: Success: The file ID associated with the object
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5F_get_file_id(hid_t obj_id, H5I_type_t type)
+{
+ H5VL_object_t *vol_obj; /* File info */
+ hid_t file_id = H5I_INVALID_HID; /* File ID for object */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ /* Get the object pointer */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier")
+
+ /* Get the file through the VOL */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FILE_ID, (int)type, &file_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file ID")
+ if(H5I_INVALID_HID == file_id)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file ID through the VOL")
+
+ /* Set return value */
+ ret_value = file_id;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_get_file_id() */
+
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index 310edd4..13d95aa 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -477,13 +477,12 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
if(NULL == (child_vol_obj = (H5VL_object_t *)H5I_object(child_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object")
- /* Check if both objects are associated with the same VOL plugin */
- if(loc_vol_obj->driver->cls->value != child_vol_obj->driver->cls->value)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL driver")
+ /* Check if both objects are associated with the same VOL connector */
+ if(loc_vol_obj->connector->cls->value != child_vol_obj->connector->cls->value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL connector")
/* Perform the mount operation */
- if(H5VL_file_specific(loc_vol_obj->data, loc_vol_obj->driver->cls, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, loc_type, name, child_vol_obj->data, plist_id) < 0)
+ if(H5VL_file_specific(loc_vol_obj, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)loc_type, name, child_vol_obj->data, plist_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
done:
@@ -535,8 +534,7 @@ H5Funmount(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
/* Perform the unmount operation */
- if(H5VL_file_specific(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_UNMOUNT,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name) < 0)
+ if(H5VL_file_specific(vol_obj, H5VL_FILE_UNMOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)loc_type, name) < 0)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file")
done:
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 2098a77..4ad2c55 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -292,7 +292,7 @@ struct H5F_file_t {
/* begin on file access/create */
char *mdc_log_location; /* location of mdc log */
hid_t fcpl_id; /* File creation property list ID */
- H5F_close_degree_t fc_degree; /* File close behavior degree */
+ H5F_close_degree_t fc_degree; /* File close behavior degree */
hbool_t evict_on_close; /* If the file's objects should be evicted from the metadata cache on close */
size_t rdcc_nslots; /* Size of raw data chunk cache (slots) */
size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */
@@ -310,6 +310,10 @@ struct H5F_file_t {
H5FO_t *open_objs; /* Open objects in file */
H5UC_t *grp_btree_shared; /* Ref-counted group B-tree node info */
+ /* Cached VOL connector ID & info */
+ hid_t vol_id; /* ID of VOL connector for the container */
+ void *vol_info; /* Copy of VOL connector info for container */
+
/* File space allocation information */
H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
hsize_t fs_threshold; /* Free space section threshold */
@@ -378,47 +382,6 @@ struct H5F_t {
#endif /* H5_HAVE_PARALLEL */
};
-/* types for file optional VOL operations */
-typedef enum H5VL_file_optional_t {
- H5VL_FILE_CLEAR_ELINK_CACHE, /* Clear external link cache */
- H5VL_FILE_GET_FILE_IMAGE, /* file image */
- H5VL_FILE_GET_FREE_SECTIONS, /* file free selections */
- H5VL_FILE_GET_FREE_SPACE, /* file freespace */
- H5VL_FILE_GET_INFO, /* file info */
- H5VL_FILE_GET_MDC_CONF, /* file metadata cache configuration */
- H5VL_FILE_GET_MDC_HR, /* file metadata cache hit rate */
- H5VL_FILE_GET_MDC_SIZE, /* file metadata cache size */
- H5VL_FILE_GET_SIZE, /* file size */
- H5VL_FILE_GET_VFD_HANDLE, /* file VFD handle */
- H5VL_FILE_REOPEN, /* reopen the file */
- H5VL_FILE_RESET_MDC_HIT_RATE, /* get metadata cache hit rate */
- H5VL_FILE_SET_MDC_CONFIG, /* set metadata cache configuration */
- H5VL_FILE_GET_METADATA_READ_RETRY_INFO,
- H5VL_FILE_START_SWMR_WRITE,
- H5VL_FILE_START_MDC_LOGGING,
- H5VL_FILE_STOP_MDC_LOGGING,
- H5VL_FILE_GET_MDC_LOGGING_STATUS,
- H5VL_FILE_SET_LATEST_FORMAT,
- H5VL_FILE_FORMAT_CONVERT,
- H5VL_FILE_RESET_PAGE_BUFFERING_STATS,
- H5VL_FILE_GET_PAGE_BUFFERING_STATS,
- H5VL_FILE_GET_MDC_IMAGE_INFO
-
-} H5VL_file_optional_t;
-
-/* User data for traversal routine to get ID counts */
-typedef struct {
- ssize_t *obj_count; /* number of objects counted so far */
- unsigned types; /* types of objects to be counted */
-} H5F_trav_obj_cnt_t;
-
-/* User data for traversal routine to get ID lists */
-/* XXX (VOL MERGE): Should the type of obj_count and max_objs be identical? */
-typedef struct {
- size_t max_objs;
- hid_t *oid_list;
- ssize_t *obj_count; /* number of objects counted so far */
-} H5F_trav_obj_ids_t;
/*****************************/
/* Package Private Variables */
@@ -437,7 +400,6 @@ H5FL_EXTERN(H5F_file_t);
/* General routines */
H5_DLL H5F_t *H5F__reopen(H5F_t *f);
-H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf);
H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush);
H5_DLL herr_t H5F__flush(H5F_t *f);
H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t fapl_id);
@@ -447,6 +409,8 @@ H5_DLL herr_t H5F__format_convert(H5F_t *f);
H5_DLL herr_t H5F__start_swmr_write(H5F_t *f);
H5_DLL herr_t H5F__close(H5F_t *f);
H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high);
+H5_DLL H5F_t *H5F__get_file(void *obj, H5I_type_t type);
+H5_DLL hid_t H5F__get_file_id(H5F_t *file);
/* File mount related routines */
H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id);
@@ -506,6 +470,7 @@ H5_DLL herr_t H5F__get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t
H5_DLL herr_t H5F__check_cached_stab_test(hid_t file_id);
H5_DLL herr_t H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr);
H5_DLL herr_t H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr);
+H5_DLL htri_t H5F__same_file_test(hid_t file_id1, hid_t file_id2);
#endif /* H5F_TESTING */
#endif /* _H5Fpkg_H */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index a4b7880..85f0d15 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -479,7 +479,7 @@ typedef struct H5F_t H5F_t;
#define H5F_ACS_SDATA_BLOCK_SIZE_NAME "sdata_block_size" /* Minimum "small data" allocation block size (when aggregating "small" raw data allocations) */
#define H5F_ACS_GARBG_COLCT_REF_NAME "gc_ref" /* Garbage-collect references */
#define H5F_ACS_FILE_DRV_NAME "vfd_info" /* File driver ID & info */
-#define H5F_ACS_VOL_DRV_NAME "vol_driver_info" /* VOL driver ID & info */
+#define H5F_ACS_VOL_CONN_NAME "vol_connector_info" /* VOL connector ID & info */
#define H5F_ACS_CLOSE_DEGREE_NAME "close_degree" /* File close degree */
#define H5F_ACS_FAMILY_OFFSET_NAME "family_offset" /* Offset position in file for family file driver */
#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */
@@ -500,9 +500,7 @@ typedef struct H5F_t H5F_t;
#define H5F_ACS_USE_MDC_LOGGING_NAME "use_mdc_logging" /* Whether to use metadata cache logging */
#define H5F_ACS_MDC_LOG_LOCATION_NAME "mdc_log_location" /* Name of metadata cache log location */
#define H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME "start_mdc_log_on_access" /* Whether logging starts on file create/open */
-#define H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME "core_write_tracking_flag" /* Whether or not core VFD backing store write tracking is enabled */
#define H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME "evict_on_close_flag" /* Whether or not the metadata cache will evict objects on close */
-#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME "core_write_tracking_page_size" /* The page size in kiB when core VFD write tracking is enabled */
#define H5F_ACS_COLL_MD_WRITE_FLAG_NAME "collective_metadata_write" /* property indicating whether metadata writes are done collectively or not */
#define H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME "mdc_initCacheImageCfg" /* Initial metadata cache image creation configuration */
#define H5F_ACS_PAGE_BUFFER_SIZE_NAME "page_buffer_size" /* the maximum size for the page buffer cache */
@@ -716,6 +714,7 @@ typedef enum H5F_prefix_open_t {
/* Private functions */
H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/);
+H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type);
/* Functions that retrieve values from the file struct */
H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f);
@@ -734,7 +733,7 @@ H5_DLL H5F_t *H5F_get_parent(const H5F_t *f);
H5_DLL unsigned H5F_get_nmounts(const H5F_t *f);
H5_DLL unsigned H5F_get_read_attempts(const H5F_t *f);
H5_DLL hid_t H5F_get_access_plist(H5F_t *f, hbool_t app_ref);
-H5_DLL hid_t H5F_get_id(H5F_t *file, hbool_t app_ref);
+H5_DLL hid_t H5F_get_id(H5F_t *file);
H5_DLL herr_t H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_id_count_ptr);
H5_DLL herr_t H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list, hbool_t app_ref, size_t *obj_id_count_ptr);
H5_DLL hsize_t H5F_get_pgend_meta_thres(const H5F_t *f);
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 8e54e7f..e1b6dc3 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -218,11 +218,13 @@ typedef struct H5F_retry_info_t {
typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *udata);
+/*********************/
+/* Public Prototypes */
+/*********************/
#ifdef __cplusplus
extern "C" {
#endif
-/* Functions in H5F.c */
H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id);
H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags,
hid_t create_plist, hid_t access_plist);
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index b036974..3147e95 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -904,7 +904,7 @@ H5F_get_eoa(const H5F_t *f, H5FD_mem_t type)
/* Dispatch to driver */
if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f->shared->lf, type)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Ftest.c b/src/H5Ftest.c
index 1183284..49a2a22 100644
--- a/src/H5Ftest.c
+++ b/src/H5Ftest.c
@@ -233,3 +233,37 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__get_sbe_addr_test() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5F__same_file_test
+ *
+ * Purpose: Check if two file IDs refer to the same underlying file.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Oct 13, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5F__same_file_test(hid_t file_id1, hid_t file_id2)
+{
+ H5F_t *file1, *file2; /* File info */
+ htri_t ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check arguments */
+ if(NULL == (file1 = (H5F_t *)H5VL_object_verify(file_id1, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ if(NULL == (file2 = (H5F_t *)H5VL_object_verify(file_id2, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+
+ /* If they are using the same underlying "shared" file struct, they are the same file */
+ ret_value = (file1->shared == file2->shared);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__same_file_test() */
+
diff --git a/src/H5G.c b/src/H5G.c
index 1d4667f..20df130 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -278,7 +278,7 @@ H5G__close_cb(H5VL_object_t *grp_vol_obj)
HDassert(grp_vol_obj);
/* Close the group */
- if(H5VL_group_close(grp_vol_obj->data, grp_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_group_close(grp_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group")
/* Free the VOL object */
@@ -351,13 +351,13 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* Get the gcpl structure and set the link properties on it */
- if (NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
- if (H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
+ if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set property value for lcpl id")
- /* get the location object */
- if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ /* Get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Set the location parameters */
@@ -365,17 +365,16 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the group */
- if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, name,
- gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
- if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
+ if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
done:
if(H5I_INVALID_HID == ret_value)
- if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
@@ -440,23 +439,22 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
- /* get the location object */
+ /* Get the location object */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the group */
- if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, NULL,
- gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, NULL, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
- if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
+ if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
- if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
@@ -482,9 +480,9 @@ hid_t
H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
{
void *grp = NULL; /* Group opened */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, name, gapl_id);
@@ -506,17 +504,17 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
/* Open the group */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
- if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->driver->cls,
- name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+
+ if(NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group")
/* Register an ID for the group */
- if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
+ if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
if(H5I_INVALID_HID == ret_value)
- if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
@@ -550,8 +548,7 @@ H5Gget_create_plist(hid_t group_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID")
/* Get the group creation property list for the group */
- if(H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_GCPL,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_GCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list")
done:
@@ -593,8 +590,7 @@ H5Gget_info(hid_t loc_id, H5G_info_t *group_info)
/* Retrieve the group's information */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = id_type;
- if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0)
+ if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, group_info) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
done:
@@ -636,7 +632,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info,
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the location object */
- if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set up location parameters */
@@ -646,8 +642,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info,
loc_params.obj_type = H5I_get_type(loc_id);
/* Retrieve the group's information */
- if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0)
+ if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, group_info) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
done:
@@ -693,7 +688,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info")
- /* get the location object */
+ /* Get the location object */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
@@ -707,8 +702,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
loc_params.obj_type = H5I_get_type(loc_id);
/* Retrieve the group's information */
- if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0)
+ if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, group_info) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
done:
@@ -779,8 +773,7 @@ H5Gflush(hid_t group_id)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Flush group's metadata to file */
- if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_FLUSH,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0)
+ if(H5VL_group_specific(vol_obj, H5VL_GROUP_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group")
done:
@@ -818,8 +811,7 @@ H5Grefresh(hid_t group_id)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Refresh group's metadata */
- if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_REFRESH,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0)
+ if(H5VL_group_specific(vol_obj, H5VL_GROUP_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")
done:
diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c
index b32ce39..7e2b324 100644
--- a/src/H5Gcompact.c
+++ b/src/H5Gcompact.c
@@ -572,71 +572,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__compact_lookup_by_idx() */
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-
-/*-------------------------------------------------------------------------
- * Function: H5G__compact_get_type_by_idx
- *
- * Purpose: Returns the type of objects in the group by giving index.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * Sep 12, 2005
- *
- *-------------------------------------------------------------------------
- */
-H5G_obj_t
-H5G__compact_get_type_by_idx(H5O_loc_t *oloc, const H5O_linfo_t *linfo,
- hsize_t idx)
-{
- H5G_link_table_t ltable = {0, NULL}; /* Link table */
- H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Sanity check */
- HDassert(oloc);
-
- /* Build table of all link messages */
- if(H5G__compact_build_table(oloc, linfo, H5_INDEX_NAME, H5_ITER_INC, &ltable) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5G_UNKNOWN, "can't create link message table")
-
- /* Check for going out of bounds */
- if(idx >= ltable.nlinks)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound")
-
- /* Determine type of object */
- if(ltable.lnks[idx].type == H5L_TYPE_SOFT)
- ret_value = H5G_LINK;
- else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN)
- ret_value = H5G_UDLINK;
- else if(ltable.lnks[idx].type == H5L_TYPE_HARD){
- H5O_loc_t tmp_oloc; /* Temporary object location */
- H5O_type_t obj_type; /* Type of object at location */
-
- /* Build temporary object location */
- tmp_oloc.file = oloc->file;
- tmp_oloc.addr = ltable.lnks[idx].u.hard.addr;
-
- /* Get the type of the object */
- if(H5O_obj_type(&tmp_oloc, &obj_type) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type")
-
- /* Map to group object type */
- if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type)))
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type")
- } else {
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "unknown link type")
- } /* end else */
-
-done:
- /* Release link table */
- if(ltable.lnks && H5G__link_release_table(&ltable) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G__compact_get_type_by_idx() */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
index d2bcad1..a2ef55c 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -1777,80 +1777,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__dense_delete() */
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-
-/*-------------------------------------------------------------------------
- * Function: H5G__dense_get_type_by_idx
- *
- * Purpose: Returns the type of objects in the group by giving index.
- *
- * Note: This routine assumes a lookup on the link name index in
- * increasing order and isn't currently set up to be as
- * flexible as other routines in this code module, because
- * the H5Gget_objtype_by_idx that it's supporting is
- * deprecated.
- *
- * Return: Success: Non-negative, object type
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Sep 19 2006
- *
- *-------------------------------------------------------------------------
- */
-H5G_obj_t
-H5G__dense_get_type_by_idx(H5F_t *f, H5O_linfo_t *linfo, hsize_t idx)
-{
- H5G_link_table_t ltable = {0, NULL}; /* Table of links */
- H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(linfo);
-
- /* Build the table of links for this group */
- if(H5G__dense_build_table(f, linfo, H5_INDEX_NAME, H5_ITER_INC, &ltable) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "error building table of links")
-
- /* Check for going out of bounds */
- if(idx >= ltable.nlinks)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "index out of bound")
-
- /* Determine type of object */
- if(ltable.lnks[idx].type == H5L_TYPE_SOFT)
- ret_value = H5G_LINK;
- else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN)
- ret_value = H5G_UDLINK;
- else if(ltable.lnks[idx].type == H5L_TYPE_HARD) {
- H5O_loc_t tmp_oloc; /* Temporary object location */
- H5O_type_t obj_type; /* Type of object at location */
-
- /* Build temporary object location */
- tmp_oloc.file = f;
- tmp_oloc.addr = ltable.lnks[idx].u.hard.addr;
-
- /* Get the type of the object */
- if(H5O_obj_type(&tmp_oloc, &obj_type) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type")
-
- /* Map to group object type */
- if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type)))
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type")
- } else {
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "unknown link type")
- } /* end else */
-
-done:
- /* Release link table */
- if(ltable.lnks && H5G__link_release_table(&ltable) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G__dense_get_type_by_idx() */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index d2e991b..cb03b5e 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -43,7 +43,9 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5Pprivate.h" /* Property lists */
-#include "H5VLprivate.h" /* VOL plugins */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+#include "H5VLnative_private.h" /* Native VOL connector */
/****************/
@@ -72,13 +74,9 @@ typedef struct {
/********************/
/* Local Prototypes */
/********************/
-
static herr_t H5G__get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name,
- hbool_t follow_link, H5G_stat_t *statbuf/*out*/);
-static H5G_obj_t H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -172,7 +170,7 @@ hid_t
H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
{
void *grp = NULL; /* New group created */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */
@@ -227,6 +225,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get property value for lcpl id")
+ /* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -235,13 +234,12 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the group */
- if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, tmp_gcpl,
- H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
- if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
+ if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
if(H5I_INVALID_HID != tmp_gcpl && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT)
@@ -249,7 +247,7 @@ done:
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list")
if(H5I_INVALID_HID == ret_value)
- if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
@@ -276,10 +274,10 @@ done:
hid_t
H5Gopen1(hid_t loc_id, const char *name)
{
- void *grp = NULL; /* Group opened */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *grp = NULL; /* Group opened */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "i*s", loc_id, name);
@@ -297,17 +295,16 @@ H5Gopen1(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the group */
- if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->driver->cls, name, H5P_DEFAULT,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group")
/* Get an atom for the group */
- if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
+ if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
if(H5I_INVALID_HID == ret_value)
- if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
@@ -348,9 +345,10 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
/* Create link */
if(type == H5L_TYPE_HARD) {
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
+ H5VL_object_t tmp_vol_obj; /* Temporary object token of */
loc_params1.type = H5VL_OBJECT_BY_NAME;
loc_params1.obj_type = H5I_get_type(cur_loc_id);
@@ -371,13 +369,16 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target loc params")
+ /* Construct a temporary VOL object */
+ tmp_vol_obj.data = NULL;
+ tmp_vol_obj.connector = vol_obj->connector;
+
/* Create the link through the VOL */
- if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, vol_obj->driver->cls,
- lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
- }
+ } /* end if */
else if(type == H5L_TYPE_SOFT) {
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
loc_params.type = H5VL_OBJECT_BY_NAME;
@@ -394,10 +395,9 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
/* Create the link through the VOL */
- if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls,
- lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
- }
+ } /* end else-if */
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid link type")
@@ -441,8 +441,8 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
/* Create the appropriate kind of link */
if(type == H5L_TYPE_HARD) {
- H5VL_object_t *vol_obj1 = NULL; /* object token of loc_id */
- H5VL_object_t *vol_obj2 = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj1; /* Object token of loc_id */
+ H5VL_object_t *vol_obj2; /* Object token of loc_id */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
@@ -469,12 +469,11 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target name")
/* Create the link through the VOL */
- if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2, vol_obj2->driver->cls,
- lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
- }
+ } /* end if */
else if(type == H5L_TYPE_SOFT) {
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
/* Soft links only need one location, the new_loc_id, but it's possible that
@@ -496,10 +495,9 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
/* Create the link through the VOL */
- if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls,
- lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
- }
+ } /* end else-if */
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type")
@@ -518,10 +516,10 @@ done:
herr_t
H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*s*s", src_loc_id, src_name, dst_name);
@@ -544,8 +542,7 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Move the link */
- if((ret_value = H5VL_link_move(vol_obj->data, loc_params1, NULL, loc_params2, vol_obj->driver->cls,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if(H5VL_link_move(vol_obj, &loc_params1, NULL, &loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link")
done:
@@ -564,9 +561,9 @@ herr_t
H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name)
{
- H5VL_object_t *vol_obj1 = NULL; /* object token of src_id */
+ H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */
H5VL_loc_params_t loc_params1;
- H5VL_object_t *vol_obj2 = NULL; /* object token of dst_id */
+ H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */
H5VL_loc_params_t loc_params2;
herr_t ret_value = SUCCEED; /* Return value */
@@ -582,27 +579,24 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
loc_params1.loc_data.loc_by_name.name = src_name;
loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
loc_params1.obj_type = H5I_get_type(src_loc_id);
+
/* Set location parameter for destination object */
loc_params2.type = H5VL_OBJECT_BY_NAME;
loc_params2.loc_data.loc_by_name.name = dst_name;
loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
loc_params2.obj_type = H5I_get_type(dst_loc_id);
- if(H5L_SAME_LOC != src_loc_id) {
+ if(H5L_SAME_LOC != src_loc_id)
/* get the location object */
if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- }
- if(H5L_SAME_LOC != dst_loc_id) {
+ if(H5L_SAME_LOC != dst_loc_id)
/* get the location object */
if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- }
/* Move the link */
- if((ret_value = H5VL_link_move(vol_obj1->data, loc_params1, vol_obj2->data, loc_params2,
- vol_obj1->driver->cls, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if(H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link")
done:
@@ -620,7 +614,7 @@ done:
herr_t
H5Gunlink(hid_t loc_id, const char *name)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -645,8 +639,7 @@ H5Gunlink(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Delete the link */
- if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
done:
@@ -665,7 +658,7 @@ done:
herr_t
H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -690,8 +683,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the link value */
- if((ret_value = H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size)) < 0)
+ if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value")
done:
@@ -719,14 +711,13 @@ done:
herr_t
H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
{
- H5G_loc_t loc; /* Group's location */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*s*s", loc_id, name, comment);
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
@@ -734,8 +725,18 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Fill in location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.loc_data.loc_by_name.name = name;
+ loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
/* Set the comment */
- if(H5G_loc_set_comment(&loc, name, comment) < 0)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_SET_COMMENT, &loc_params, comment) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value")
done:
@@ -769,26 +770,39 @@ done:
int
H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf)
{
- H5G_loc_t loc; /* Group's location */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ ssize_t op_ret; /* Return value from operation */
int ret_value; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(-1)
H5TRACE4("Is", "i*sz*s", loc_id, name, bufsize, buf);
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, -1, "no name specified")
if(bufsize > 0 && !buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, -1, "no buffer specified")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, -1, "can't set collective metadata read info")
+
+ /* Fill in location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.loc_data.loc_by_name.name = name;
+ loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "invalid location identifier")
/* Get the comment */
- if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value")
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_COMMENT, &loc_params, buf, bufsize, &op_ret) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, -1, "unable to get comment value")
+
+ /* Set return value */
+ ret_value = (int)op_ret;
done:
FUNC_LEAVE_API(ret_value)
@@ -823,18 +837,17 @@ herr_t
H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
void *op_data)
{
- H5G_loc_t loc; /* Location of object */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
H5G_link_iterate_t lnk_op; /* Link operator */
hsize_t last_obj; /* Index of last object looked at */
- hsize_t idx; /* Internal location to hold index */
+ hsize_t idx; /* Internal location to hold index */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*s*Isx*x", loc_id, name, idx_p, op, op_data);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_p && *idx_p < 0)
@@ -850,9 +863,19 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
lnk_op.op_type = H5G_LINK_OP_OLD;
lnk_op.op_func.op_old = op;
- /* Call private function */
- if((ret_value = H5G_iterate(&loc, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed")
+ /* Fill out location struct */
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.loc_data.loc_by_name.name = name;
+ loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the object pointer */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier")
+
+ /* Call private iteration function, through VOL callback */
+ if((ret_value = H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_GROUP_ITERATE_OLD, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0)
+ HERROR(H5E_SYM, H5E_BADITER, "error iterating over group's links");
/* Set the index we stopped at */
if(idx_p)
@@ -882,29 +905,35 @@ done:
herr_t
H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs)
{
- H5G_loc_t loc; /* Location of object */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5I_type_t id_type; /* Type of ID */
+ H5VL_loc_params_t loc_params;
H5G_info_t grp_info; /* Group information */
- H5O_type_t obj_type; /* Type of object at location */
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", loc_id, num_objs);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
- if(H5O_obj_type(loc.oloc, &obj_type) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type")
- if(obj_type != H5O_TYPE_GROUP)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
+ id_type = H5I_get_type(loc_id);
+ if(!(H5I_GROUP == id_type || H5I_FILE == id_type))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID")
if(!num_objs)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects")
- /* Retrieve information about the group */
- if(H5G__obj_info(loc.oloc, &grp_info) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine # of objects")
+ /* Fill in location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = id_type;
- /* Set the number of objects [sic: links] in the group */
+ /* Get group location */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Retrieve the group's information */
+ if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, &grp_info) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
+
+ /* Set the number of objects [i.e. links] in the group */
*num_objs = grp_info.nlinks;
done:
@@ -931,23 +960,40 @@ done:
*/
herr_t
H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link,
- H5G_stat_t *statbuf/*out*/)
+ H5G_stat_t *statbuf/*out*/)
{
- H5G_loc_t loc; /* Group's location */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
- /* Get info */
- if(H5G__get_objinfo(&loc, name, follow_link, statbuf) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object")
+ /* Set up collective metadata if appropriate */
+ if(H5CX_set_loc(loc_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+
+ /* Retrieve object info, if pointer to struct is given */
+ if(statbuf) {
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+
+ /* Fill out location struct */
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.loc_data.loc_by_name.name = name;
+ loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Retrieve the object's information */
+ if(H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_GROUP_GET_OBJINFO, &loc_params, (unsigned)follow_link, statbuf) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name)
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
@@ -972,6 +1018,7 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c
H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/)
{
H5G_trav_goi_t *udata = (H5G_trav_goi_t *)_udata; /* User data passed in */
+ H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -980,48 +1027,43 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c
if(lnk == NULL && obj_loc == NULL)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name)
- /* Only modify user's buffer if it's available */
- if(udata->statbuf) {
- H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */
-
- /* Common code to retrieve the file's fileno */
- if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno")
+ /* Common code to retrieve the file's fileno */
+ if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno")
- /* Info for soft and UD links is gotten by H5L_get_info. If we have
- * a hard link, follow it and get info on the object
- */
- if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) {
- H5O_info_t oinfo; /* Object information */
+ /* Info for soft and UD links is gotten by H5L_get_info. If we have
+ * a hard link, follow it and get info on the object
+ */
+ if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) {
+ H5O_info_t oinfo; /* Object information */
- /* Go retrieve the object information */
- /* (don't need index & heap info) */
- HDassert(obj_loc);
- if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_HDR) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info")
+ /* Go retrieve the object information */
+ /* (don't need index & heap info) */
+ HDassert(obj_loc);
+ if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_HDR) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info")
- /* Get mapped object type */
- statbuf->type = H5G_map_obj_type(oinfo.type);
+ /* Get mapped object type */
+ statbuf->type = H5G_map_obj_type(oinfo.type);
- /* Get object number (i.e. address) for object */
- statbuf->objno[0] = (unsigned long)(oinfo.addr);
+ /* Get object number (i.e. address) for object */
+ statbuf->objno[0] = (unsigned long)(oinfo.addr);
#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
- statbuf->objno[1] = (unsigned long)(oinfo.addr >> 8 * sizeof(long));
+ statbuf->objno[1] = (unsigned long)(oinfo.addr >> 8 * sizeof(long));
#else
- statbuf->objno[1] = 0;
+ statbuf->objno[1] = 0;
#endif
- /* Get # of hard links pointing to object */
- statbuf->nlink = oinfo.rc;
+ /* Get # of hard links pointing to object */
+ statbuf->nlink = oinfo.rc;
- /* Get modification time for object */
- statbuf->mtime = oinfo.ctime;
+ /* Get modification time for object */
+ statbuf->mtime = oinfo.ctime;
- /* Retrieve the object header information */
- statbuf->ohdr.size = oinfo.hdr.space.total;
- statbuf->ohdr.free = oinfo.hdr.space.free;
- statbuf->ohdr.nmesgs = oinfo.hdr.nmesgs;
- statbuf->ohdr.nchunks = oinfo.hdr.nchunks;
- } /* end if */
+ /* Retrieve the object header information */
+ statbuf->ohdr.size = oinfo.hdr.space.total;
+ statbuf->ohdr.free = oinfo.hdr.space.free;
+ statbuf->ohdr.nmesgs = oinfo.hdr.nmesgs;
+ statbuf->ohdr.nchunks = oinfo.hdr.nchunks;
} /* end if */
done:
@@ -1049,22 +1091,22 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link,
H5G_stat_t *statbuf/*out*/)
{
H5G_trav_goi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
/* Sanity checks */
HDassert(loc);
HDassert(name && *name);
+ HDassert(statbuf);
- /* Reset stat buffer, if one was given */
- if(statbuf)
- HDmemset(statbuf, 0, sizeof(H5G_stat_t));
+ /* Reset stat buffer */
+ HDmemset(statbuf, 0, sizeof(H5G_stat_t));
/* Set up user data for retrieving information */
udata.statbuf = statbuf;
@@ -1072,12 +1114,11 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link,
udata.loc_file = loc->oloc->file;
/* Traverse the group hierarchy to locate the object to get info about */
- if(H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : H5G_TARGET_SLINK|H5G_TARGET_UDLINK),
- H5G__get_objinfo_cb, &udata) < 0)
+ if(H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : (H5G_TARGET_SLINK | H5G_TARGET_UDLINK)), H5G__get_objinfo_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist")
/* If we're pointing at a soft or UD link, get the real link length and type */
- if(statbuf && follow_link == 0) {
+ if(follow_link == 0) {
H5L_info_t linfo; /* Link information buffer */
herr_t ret;
@@ -1129,24 +1170,33 @@ done:
ssize_t
H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size)
{
- H5G_loc_t loc; /* Object location */
- H5O_type_t obj_type; /* Type of object at location */
- ssize_t ret_value;
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("Zs", "ih*sz", loc_id, idx, name, size);
- /* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
- if(H5O_obj_type(loc.oloc, &obj_type) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type")
- if(obj_type != H5O_TYPE_GROUP)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
+ /* Set up collective metadata if appropriate */
+ if(H5CX_set_loc(loc_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set collective metadata read info")
+
+ /* Fill in location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_IDX;
+ loc_params.loc_data.loc_by_idx.name = ".";
+ loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_NAME;
+ loc_params.loc_data.loc_by_idx.order = H5_ITER_INC;
+ loc_params.loc_data.loc_by_idx.n = idx;
+ loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Call internal function */
- if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name")
+ if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get object name")
done:
FUNC_LEAVE_API(ret_value)
@@ -1171,82 +1221,39 @@ done:
H5G_obj_t
H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
{
- H5G_loc_t loc; /* Object location */
- H5G_obj_t ret_value;
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5O_info_t oinfo; /* Object info (contains object type) */
+ unsigned fields; /* Which fields in object info to populate */
+ H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_API(H5G_UNKNOWN)
H5TRACE2("Go", "ih", loc_id, idx);
- /* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID")
-
- /* Call internal function*/
- if(H5G_UNKNOWN == (ret_value = H5G__obj_get_type_by_idx(loc.oloc, idx)))
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Gget_objtype_by_idx() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G__obj_get_type_by_idx
- *
- * Purpose: Private function for H5Gget_objtype_by_idx.
- * Returns the type of objects in the group by giving index.
- *
- * Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3)
- *
- * Failure: Negative
- *
- * Programmer: Raymond Lu
- * Nov 20, 2002
- *
- *-------------------------------------------------------------------------
- */
-static H5G_obj_t
-H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx)
-{
- H5O_linfo_t linfo; /* Link info message */
- htri_t linfo_exists; /* Whether the link info message exists */
- H5O_type_t obj_type; /* Type of object at location */
- H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_IDX;
+ loc_params.loc_data.loc_by_idx.name = ".";
+ loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_NAME;
+ loc_params.loc_data.loc_by_idx.order = H5_ITER_INC;
+ loc_params.loc_data.loc_by_idx.n = idx;
+ loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ loc_params.obj_type = H5I_get_type(loc_id);
- FUNC_ENTER_STATIC_TAG(oloc->addr)
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier")
- /* Sanity check */
- HDassert(oloc);
+ /* Retrieve the object's basic information (which includes its type) */
+ fields = H5O_INFO_BASIC;
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, &oinfo, fields) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info")
- /* Check args */
- if(H5O_obj_type(oloc, &obj_type) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type")
- if(obj_type != H5O_TYPE_GROUP)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "not a group")
-
- /* Attempt to get the link info for this group */
- if((linfo_exists = H5G__obj_get_linfo(oloc, &linfo)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't check for link info message")
- if(linfo_exists) {
- if(H5F_addr_defined(linfo.fheap_addr)) {
- /* Get the object's name from the dense link storage */
- if((ret_value = H5G__dense_get_type_by_idx(oloc->file, &linfo, idx)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
- } /* end if */
- else {
- /* Get the object's type from the link messages */
- if((ret_value = H5G__compact_get_type_by_idx(oloc, &linfo, idx)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
- } /* end else */
- } /* end if */
- else {
- /* Get the object's type from the symbol table */
- if((ret_value = H5G__stab_get_type_by_idx(oloc, idx)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
- } /* end else */
+ /* Map to group object type */
+ if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(oinfo.type)))
+ HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type")
done:
- FUNC_LEAVE_NOAPI_TAG(ret_value)
-} /* end H5G__obj_get_type_by_idx() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Gget_objtype_by_idx() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Gint.c b/src/H5Gint.c
index 26c582e..049c696 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -39,7 +39,6 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
-#include "H5VLnative_private.h" /* Native VOL driver */
/****************/
@@ -579,7 +578,7 @@ H5G_oloc(H5G_t *grp)
*-------------------------------------------------------------------------
*/
H5G_name_t *
-H5G_nameof(H5G_t *grp)
+H5G_nameof(const H5G_t *grp)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -808,7 +807,7 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name,
*/
if(NULL == (grp = H5G__open_name(loc, group_name)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
- if((gid = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0)
+ if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
/* Set up user data for callback */
@@ -1070,7 +1069,7 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
/* Register an ID for the starting group */
- if((gid = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0)
+ if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
/* Get the location of the starting group */
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 b6b0c20..2aece2b 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -584,21 +584,9 @@ H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size,
*cached = TRUE;
} /* end if */
else if(!loc->path->obj_hidden) {
- hid_t file;
-
- /* Retrieve file ID for name search */
- if((file = H5F_get_id(loc->oloc->file, FALSE)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get file ID")
-
/* Search for name of object */
- if((len = H5G_get_name_by_addr(file, loc->oloc, name, size)) < 0) {
- H5I_dec_ref(file);
+ if((len = H5G_get_name_by_addr(loc->oloc->file, loc->oloc, name, size)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine name")
- } /* end if */
-
- /* Close file ID used for search */
- if(H5I_dec_ref(file) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCLOSEFILE, FAIL, "can't determine name")
/* Indicate that the name is _not_ cached, if requested */
/* (Currently only used for testing - QAK, 2010/07/26) */
@@ -833,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:
@@ -1282,8 +1269,7 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc,
- char *name, size_t size)
+H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size)
{
H5G_gnba_iter_t udata; /* User data for iteration */
H5G_loc_t root_loc; /* Root group's location */
@@ -1296,8 +1282,8 @@ H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc,
FUNC_ENTER_NOAPI((-1))
- /* Construct the link info for the file's root group */
- if(H5G_loc(file, &root_loc) < 0)
+ /* Construct a group location for root group of the file */
+ if(H5G_root_loc(f, &root_loc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get root group's location")
/* Check for root group being the object looked for */
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 836213d..f475bde 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -381,9 +381,6 @@ H5_DLL herr_t H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t
#ifndef H5_STRICT_FORMAT_CHECKS
H5_DLL herr_t H5G__stab_valid(H5O_loc_t *grp_oloc, H5O_stab_t *alt_stab);
#endif /* H5_STRICT_FORMAT_CHECKS */
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-H5_DLL H5G_obj_t H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx);
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
/*
@@ -448,10 +445,6 @@ H5_DLL htri_t H5G__compact_lookup(const H5O_loc_t *grp_oloc, const char *name,
H5_DLL herr_t H5G__compact_lookup_by_idx(const H5O_loc_t *oloc,
const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order,
hsize_t n, H5O_link_t *lnk);
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-H5_DLL H5G_obj_t H5G__compact_get_type_by_idx(H5O_loc_t *oloc,
- const H5O_linfo_t *linfo, hsize_t idx);
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Functions that understand "dense" link storage */
H5_DLL herr_t H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo,
@@ -476,10 +469,6 @@ H5_DLL herr_t H5G__dense_remove_by_idx(H5F_t *f, const H5O_linfo_t *linfo,
H5RS_str_t *grp_full_path_r, H5_index_t idx_type, H5_iter_order_t order,
hsize_t n);
H5_DLL herr_t H5G__dense_delete(H5F_t *f, H5O_linfo_t *linfo, hbool_t adj_link);
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-H5_DLL H5G_obj_t H5G__dense_get_type_by_idx(H5F_t *f, H5O_linfo_t *linfo,
- hsize_t idx);
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Functions that understand group objects */
H5_DLL herr_t H5G__obj_create(H5F_t *f, H5G_obj_create_t *gcrt_info,
@@ -494,6 +483,10 @@ H5_DLL herr_t H5G__obj_iterate(const H5O_loc_t *grp_oloc,
H5_DLL herr_t H5G__obj_info(const H5O_loc_t *oloc, H5G_info_t *grp_info);
H5_DLL htri_t H5G__obj_lookup(const H5O_loc_t *grp_oloc, const char *name,
H5O_link_t *lnk);
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+H5_DLL herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name,
+ hbool_t follow_link, H5G_stat_t *statbuf/*out*/);
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
/*
* These functions operate on group hierarchy names.
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index f4f04bc..f149f29 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -187,7 +187,7 @@ typedef struct H5G_entry_t H5G_entry_t;
* call.
*/
H5_DLL struct H5O_loc_t *H5G_oloc(H5G_t *grp);
-H5_DLL H5G_name_t * H5G_nameof(H5G_t *grp);
+H5_DLL H5G_name_t * H5G_nameof(const H5G_t *grp);
H5_DLL H5F_t *H5G_fileof(H5G_t *grp);
H5_DLL H5G_t *H5G_open(const H5G_loc_t *loc);
H5_DLL herr_t H5G_close(H5G_t *grp);
@@ -261,7 +261,7 @@ H5_DLL herr_t H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_dept
H5_DLL herr_t H5G_name_free(H5G_name_t *name);
H5_DLL ssize_t H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size,
hbool_t *cached);
-H5_DLL ssize_t H5G_get_name_by_addr(hid_t fid, const struct H5O_loc_t *loc,
+H5_DLL ssize_t H5G_get_name_by_addr(H5F_t *f, const struct H5O_loc_t *loc,
char* name, size_t size);
H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char *name);
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/H5Gstab.c b/src/H5Gstab.c
index 9072b97..e8d38b9 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -1103,118 +1103,3 @@ done:
} /* end H5G__stab_valid */
#endif /* H5_STRICT_FORMAT_CHECKS */
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-
-/*-------------------------------------------------------------------------
- * Function: H5G_stab_get_type_by_idx_cb
- *
- * Purpose: Callback for B-tree iteration 'by index' info query to
- * retrieve the type of an object
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * Nov 7, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G_stab_get_type_by_idx_cb(const H5G_entry_t *ent, void *_udata)
-{
- H5G_bt_it_gtbi_t *udata = (H5G_bt_it_gtbi_t *)_udata;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Sanity check */
- HDassert(ent);
- HDassert(udata);
-
- /* Check for a soft link */
- switch(ent->type) {
- case H5G_CACHED_SLINK:
- udata->type = H5G_LINK;
- break;
-
- case H5G_CACHED_ERROR:
- case H5G_NOTHING_CACHED:
- case H5G_CACHED_STAB:
- case H5G_NCACHED:
- default:
- {
- H5O_loc_t tmp_oloc; /* Temporary object location */
- H5O_type_t obj_type; /* Type of object at location */
-
- /* Build temporary object location */
- tmp_oloc.file = udata->f;
- HDassert(H5F_addr_defined(ent->header));
- tmp_oloc.addr = ent->header;
-
- /* Get the type of the object */
- if(H5O_obj_type(&tmp_oloc, &obj_type) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type")
- udata->type = H5G_map_obj_type(obj_type);
- }
- break;
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_stab_get_type_by_idx_cb */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G__stab_get_type_by_idx
- *
- * Purpose: Private function for H5Gget_objtype_by_idx.
- * Returns the type of objects in the group by giving index.
- *
- * Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3)
- *
- * Failure: UNKNOWN
- *
- * Programmer: Raymond Lu
- * Nov 20, 2002
- *
- *-------------------------------------------------------------------------
- */
-H5G_obj_t
-H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx)
-{
- H5O_stab_t stab; /* Info about local heap & B-tree */
- H5G_bt_it_gtbi_t udata; /* User data for B-tree callback */
- H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */
-
- FUNC_ENTER_PACKAGE_TAG(oloc->addr)
-
- /* Sanity check */
- HDassert(oloc);
-
- /* Get the B-tree & local heap info */
- if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address")
-
- /* Set iteration information */
- udata.common.idx = idx;
- udata.common.num_objs = 0;
- udata.common.op = H5G_stab_get_type_by_idx_cb;
- udata.f = oloc->file;
- udata.type = H5G_UNKNOWN;
-
- /* Iterate over the group members */
- if(H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "iteration operator failed")
-
- /* If we don't know the type now, we almost certainly went out of bounds */
- if(udata.type == H5G_UNKNOWN)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "index out of bound")
-
- /* Set the return value */
- ret_value = udata.type;
-
-done:
- FUNC_LEAVE_NOAPI_TAG(ret_value)
-} /* end H5G__stab_get_type_by_idx() */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
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/H5Gtraverse.c b/src/H5Gtraverse.c
index 8fefcd8..d029bea 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -43,7 +43,6 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Ppublic.h" /* Property Lists */
#include "H5WBprivate.h" /* Wrapped Buffers */
-#include "H5VLnative_private.h" /* Native VOL driver */
/****************/
@@ -198,7 +197,7 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk,
/* Create a group ID to pass to the user-defined callback */
if(NULL == (grp = H5G_open(&grp_loc_copy)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
- if((cur_grp = H5VL_native_register(H5I_GROUP, grp, FALSE)) < 0)
+ if((cur_grp = H5VL_wrap_register(H5I_GROUP, grp, FALSE)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group")
/* User-defined callback function */
diff --git a/src/H5HG.c b/src/H5HG.c
index b9d8dc3..df1c82d 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -785,7 +785,14 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap")
HDassert(hobj->idx < heap->nused);
- HDassert(heap->obj[hobj->idx].begin);
+
+ /* When the application selects the same location to rewrite the VL element by using H5Sselect_elements,
+ * it can happen that the entry has been removed by first rewrite. Here we simply skip the removal of
+ * the entry and let the second rewrite happen (see HDFFV-10635). In the future, it'd be nice to handle
+ * this situation in H5T_conv_vlen in H5Tconv.c instead of this level (HDFFV-10648). */
+ if(heap->obj[hobj->idx].nrefs == 0 && heap->obj[hobj->idx].size == 0 && !heap->obj[hobj->idx].begin)
+ HGOTO_DONE(ret_value)
+
obj_start = heap->obj[hobj->idx].begin;
/* Include object header size */
need = H5HG_ALIGN(heap->obj[hobj->idx].size) + H5HG_SIZEOF_OBJHDR(f);
diff --git a/src/H5I.c b/src/H5I.c
index e1d947c..ca9ff61 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -33,8 +33,9 @@
#include "H5ACprivate.h" /* Metadata cache */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5FLprivate.h" /* Free Lists */
#include "H5Gprivate.h" /* Groups */
#include "H5Ipkg.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
@@ -130,6 +131,7 @@ H5FL_DEFINE_STATIC(H5I_class_t);
H5FL_EXTERN(H5VL_object_t);
/*--------------------- Local function prototypes ---------------------------*/
+static void *H5I__unwrap(void *obj_ptr, H5I_type_t type);
static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata);
static int H5I__destroy_type(H5I_type_t type);
static void *H5I__remove_verify(hid_t id, H5I_type_t id_type);
@@ -139,7 +141,6 @@ static int H5I__get_type_ref(H5I_type_t type);
static int H5I__search_cb(void *obj, hid_t id, void *_udata);
static H5I_id_info_t *H5I__find_id(hid_t id);
static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata);
-static hid_t H5I__get_file_id(hid_t obj_id, H5I_type_t id_type);
static int H5I__find_id_cb(void *_item, void *_key, void *_udata);
static int H5I__id_dump_cb(void *_item, void *_key, void *_udata);
@@ -452,6 +453,50 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5I__unwrap
+ *
+ * Purpose: Unwraps the object pointer for the 'item' that corresponds
+ * to an ID.
+ *
+ * Return: Pointer to the unwrapped pointer (can't fail)
+ *
+ * Programmer: Quincey Koziol
+ * Friday, October 19, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5I__unwrap(void *obj_ptr, H5I_type_t type)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(obj_ptr);
+
+ /* The stored object pointer might be an H5VL_object_t, in which
+ * case we'll need to get the wrapped object struct (H5F_t *, etc.).
+ */
+ if(H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) {
+ const H5VL_object_t *vol_obj;
+
+ vol_obj = (const H5VL_object_t *)obj_ptr;
+ ret_value = H5VL_object_data(vol_obj);
+ } /* end if */
+ else if(H5I_DATATYPE == type) {
+ H5T_t *dt = (H5T_t *)obj_ptr;
+
+ ret_value = (void *)H5T_get_actual_type(dt);
+ } /* end if */
+ else
+ ret_value = obj_ptr;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I__unwrap() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Iclear_type
*
* Purpose: Removes all objects from the type, calling the free
@@ -547,6 +592,7 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata)
FUNC_ENTER_STATIC_NOERR
+ /* Sanity checks */
HDassert(id);
HDassert(udata);
HDassert(udata->type_ptr);
@@ -556,8 +602,7 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata)
*/
if(udata->force || (id->count - (!udata->app_ref * id->app_count)) <= 1) {
/* Check for a 'free' function and call it, if it exists */
- /* (Casting away const OK -QAK) */
- if(udata->type_ptr->cls->free_func && (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) {
+ if(udata->type_ptr->cls->free_func && (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { /* (Casting away const OK -QAK) */
if(udata->force) {
#ifdef H5I_DEBUG
if(H5DEBUG(I)) {
@@ -858,8 +903,7 @@ H5I_subst(hid_t id, const void *new_object)
HGOTO_ERROR(H5E_ATOM, H5E_NOTFOUND, NULL, "can't get ID ref count")
/* Get the old object pointer to return */
- /* (Casting away const OK -QAK) */
- ret_value = (void *)id_ptr->obj_ptr;
+ ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */
/* Set the new object pointer for the ID */
id_ptr->obj_ptr = new_object;
@@ -1980,16 +2024,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
/* The stored object pointer might be an H5VL_object_t, in which
* case we'll need to get the wrapped object struct (H5F_t *, etc.).
*/
- if(H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) {
- const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr;
- obj_ptr = vol_obj->data;
- }
- else if(H5I_DATATYPE == type) {
- const H5T_t *dt = (const H5T_t *)item->obj_ptr;
- obj_ptr = (void *)H5T_get_actual_type(dt);
- }
- else
- obj_ptr = item->obj_ptr;
+ obj_ptr = H5I__unwrap((void *)item->obj_ptr, type);
/* Invoke callback function */
cb_ret_val = (*udata->user_func)((void *)obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */
@@ -1999,7 +2034,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
ret_value = H5_ITER_STOP; /* terminate iteration early */
else if(cb_ret_val < 0)
ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */
- }
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5I__iterate_cb() */
@@ -2057,7 +2092,7 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re
/* Iterate over IDs */
if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed")
- }
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2111,7 +2146,7 @@ done:
*
* Failure: -1
*
- * NOTE: Not safe for arbitrary VOL drivers as it relies on
+ * NOTE: Not safe for arbitrary VOL connectors as it relies on
* private H5G calls.
*
* Comments: Public function
@@ -2129,18 +2164,24 @@ done:
ssize_t
H5Iget_name(hid_t id, char *name/*out*/, size_t size)
{
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
H5G_loc_t loc; /* Object location */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", id, name, size);
- /* Get object location */
- if(H5G_loc(id, &loc) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location")
+ /* Get the object pointer */
+ if(NULL == (vol_obj = H5VL_vol_object(id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(id);
/* Retrieve object's name */
- if((ret_value = H5G_get_name(&loc, name, size, NULL)) < 0)
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_ID_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name")
done:
@@ -2174,9 +2215,9 @@ H5Iget_file_id(hid_t obj_id)
/* Call internal function */
if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) {
- if ((ret_value = H5I__get_file_id(obj_id, type)) < 0)
+ if ((ret_value = H5F_get_file_id(obj_id, type)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID")
- }
+ } /* end if */
else
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "not an ID of a file object")
@@ -2186,56 +2227,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5I__get_file_id
- *
- * Purpose: The private version of H5Iget_file_id(), obtains the file
- * ID given an object ID.
- *
- * Return: Success: The file ID associated with the object
- * Failure: H5I_INVALID_HID
- *
- *-------------------------------------------------------------------------
- */
-static hid_t
-H5I__get_file_id(hid_t obj_id, H5I_type_t type)
-{
- H5VL_object_t *vol_obj = NULL;
- void *file = NULL;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Get the object pointer */
- if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier")
-
- /* Get the file through the VOL */
- if (H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_OBJECT_GET_FILE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, &file) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file")
- if (NULL == file)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file through the VOL")
-
- /* Check if the file's ID already exists */
- if (H5I_find_id(file, H5I_FILE, &ret_value) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed")
-
- /* If the ID does not exist, register it with the VOL driver */
- if (H5I_INVALID_HID == ret_value) {
- if ((ret_value = H5VL_register(H5I_FILE, file, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
- }
- else {
- /* Increment ref count on existing ID */
- if (H5I_inc_ref(ret_value, TRUE) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed")
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I__get_file_id() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5I__find_id_cb
*
* Purpose: Callback for searching for an ID with a specific pointer
@@ -2260,23 +2251,14 @@ H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
HDassert(item);
HDassert(udata);
- /* Get a pointer to the VOL driver's data */
- if (H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) {
- const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr;
- obj_ptr = vol_obj->data;
- }
- else if (H5I_DATATYPE == type) {
- const H5T_t *dt = (const H5T_t *)item->obj_ptr;
- obj_ptr = (void *)H5T_get_actual_type(dt);
- }
- else
- obj_ptr = item->obj_ptr;
+ /* Get a pointer to the VOL connector's data */
+ obj_ptr = H5I__unwrap(item->obj_ptr, type);
/* Check for a match */
if (obj_ptr == udata->object) {
udata->ret_id = item->id;
ret_value = H5_ITER_STOP;
- }
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5I__find_id_cb() */
@@ -2324,7 +2306,7 @@ H5I_find_id(const void *object, H5I_type_t type, hid_t *id)
HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed")
*id = udata.ret_id;
- }
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2346,7 +2328,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */
H5I_type_t type = *(H5I_type_t *)_udata; /* User data */
H5G_name_t *path = NULL; /* Path to file object */
- const void *obj_ptr = NULL; /* Pointer to VOL driver object */
+ const void *obj_ptr = NULL; /* Pointer to VOL connector object */
FUNC_ENTER_STATIC_NOERR
@@ -2360,37 +2342,36 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
{
const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr;
- obj_ptr = vol_obj->data;
-
- if(H5_VOL_NATIVE == vol_obj->driver->cls->value)
- path = H5G_nameof((H5G_t *)obj_ptr);
+ obj_ptr = H5VL_object_data(vol_obj);
+ if(H5_VOL_NATIVE == vol_obj->connector->cls->value)
+ path = H5G_nameof((const H5G_t *)obj_ptr);
break;
}
+
case H5I_DATASET:
{
const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr;
- obj_ptr = vol_obj->data;
-
- if(H5_VOL_NATIVE == vol_obj->driver->cls->value)
- path = H5D_nameof((H5D_t *)obj_ptr);
+ obj_ptr = H5VL_object_data(vol_obj);
+ if(H5_VOL_NATIVE == vol_obj->connector->cls->value)
+ path = H5D_nameof((const H5D_t *)obj_ptr);
break;
}
+
case H5I_DATATYPE:
{
const H5T_t *dt = (const H5T_t *)item->obj_ptr;
- obj_ptr = (void *)H5T_get_actual_type(dt);
-
- path = H5T_nameof((H5T_t *)obj_ptr);
+ obj_ptr = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */
+ path = H5T_nameof((const H5T_t *)obj_ptr);
break;
}
+
case H5I_UNINIT:
case H5I_BADID:
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/H5Itest.c b/src/H5Itest.c
index 4b54835..79bc482 100644
--- a/src/H5Itest.c
+++ b/src/H5Itest.c
@@ -78,26 +78,41 @@
ssize_t
H5I__get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached)
{
+ H5VL_object_t *vol_obj; /* Object token of id */
H5G_loc_t loc; /* Object location */
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ hbool_t vol_wrapper_set = FALSE;/* Whether the VOL object wrapping context was set up */
ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_PACKAGE
- /* Get object location */
- if(H5G_loc(id, &loc) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location")
-
/* Set API context */
if(H5CX_push() < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set API context")
api_ctx_pushed = TRUE;
+ /* Get the object pointer */
+ if(NULL == (vol_obj = H5VL_vol_object(id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier")
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Get object location */
+ if(H5G_loc(id, &loc) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location")
+
/* Call internal group routine to retrieve object's name */
if((ret_value = H5G_get_name(&loc, name, size, cached)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name")
done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_ATOM, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
if(api_ctx_pushed && H5CX_pop() < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRESET, (-1), "can't reset API context")
diff --git a/src/H5L.c b/src/H5L.c
index 5142c82..33e561a 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -34,7 +34,6 @@
#include "H5Oprivate.h" /* File objects */
#include "H5Pprivate.h" /* Property lists */
#include "H5VLprivate.h" /* Virtual Object Layer */
-#include "H5VLnative_private.h" /* Native VOL driver */
/****************/
@@ -316,28 +315,22 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
loc_params2.loc_data.loc_by_name.lapl_id = lapl_id;
loc_params2.obj_type = H5I_get_type(dst_loc_id);
- if (H5L_SAME_LOC != src_loc_id) {
+ if (H5L_SAME_LOC != src_loc_id)
/* Get the location object */
if (NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- }
- if (H5L_SAME_LOC != dst_loc_id) {
+ if (H5L_SAME_LOC != dst_loc_id)
/* Get the location object */
if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- }
- /* Make sure that the VOL drivers are the same */
- if (vol_obj1 && vol_obj2) {
- if (vol_obj1->driver->cls->value != vol_obj2->driver->cls->value)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked")
- }
+ /* Make sure that the VOL connectors are the same */
+ if (vol_obj1 && vol_obj2)
+ if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked")
/* Move the link */
- if (H5VL_link_move((vol_obj1 ? vol_obj1->data : NULL), loc_params1,
- (vol_obj2 ? vol_obj2->data : NULL), loc_params2,
- (vol_obj1 ? vol_obj1->driver->cls : vol_obj2->driver->cls),
- lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
done:
@@ -367,6 +360,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
H5VL_loc_params_t loc_params1;
H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */
H5VL_loc_params_t loc_params2;
+ H5VL_object_t tmp_vol_obj; /* Temporary object token of */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -392,7 +386,6 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
-
/* Set location paramter for source object */
loc_params1.type = H5VL_OBJECT_BY_NAME;
loc_params1.loc_data.loc_by_name.name = src_name;
@@ -405,28 +398,26 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
loc_params2.loc_data.loc_by_name.lapl_id = lapl_id;
loc_params2.obj_type = H5I_get_type(dst_loc_id);
- if(H5L_SAME_LOC != src_loc_id) {
+ if(H5L_SAME_LOC != src_loc_id)
/* Get the location object */
if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- }
- if(H5L_SAME_LOC != dst_loc_id) {
+ if(H5L_SAME_LOC != dst_loc_id)
/* Get the location object */
if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- }
- /* Make sure that the VOL plugins are the same */
- if(vol_obj1 && vol_obj2) {
- if(vol_obj1->driver->cls->value != vol_obj2->driver->cls->value)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked")
- }
+ /* Make sure that the VOL connectors are the same */
+ if(vol_obj1 && vol_obj2)
+ if(vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked")
+
+ /* Construct a temporary source VOL object */
+ tmp_vol_obj.data = (vol_obj1 ? vol_obj1->data : NULL);
+ tmp_vol_obj.connector = (vol_obj1 ? vol_obj1->connector : vol_obj2->connector);
/* Copy the link */
- if(H5VL_link_copy((vol_obj1 ? vol_obj1->data : NULL), loc_params1,
- (vol_obj2 ? vol_obj2->data : NULL), loc_params2,
- (vol_obj1 ? vol_obj1->driver->cls : vol_obj2->driver->cls),
- lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_copy(&tmp_vol_obj, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to copy link")
done:
@@ -505,8 +496,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
/* Create the link */
- if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls,
- lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link")
done:
@@ -534,8 +524,9 @@ herr_t
H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id)
{
- H5VL_object_t *vol_obj1 = NULL; /* object token of cur_loc_id */
- H5VL_object_t *vol_obj2 = NULL; /* object token of new_loc_id */
+ H5VL_object_t *vol_obj1 = NULL; /* Object token of cur_loc_id */
+ H5VL_object_t *vol_obj2 = NULL; /* Object token of new_loc_id */
+ H5VL_object_t tmp_vol_obj; /* Temporary object token of */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
H5P_genplist_t *plist; /* Property list pointer */
@@ -578,22 +569,19 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
loc_params2.loc_data.loc_by_name.name = new_name;
loc_params2.loc_data.loc_by_name.lapl_id = lapl_id;
- if(H5L_SAME_LOC != cur_loc_id) {
+ if(H5L_SAME_LOC != cur_loc_id)
/* Get the current location object */
if (NULL == (vol_obj1 = (H5VL_object_t *)H5VL_vol_object(cur_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- }
- if(H5L_SAME_LOC != new_loc_id) {
+ if(H5L_SAME_LOC != new_loc_id)
/* Get the new location object */
if(NULL == (vol_obj2 = (H5VL_object_t *)H5VL_vol_object(new_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- }
- /* Make sure that the VOL drivers are the same */
- if(vol_obj1 && vol_obj2) {
- if(vol_obj1->driver->cls->value != vol_obj2->driver->cls->value)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL drivers and can't be linked")
- }
+ /* Make sure that the VOL connectors are the same */
+ if(vol_obj1 && vol_obj2)
+ if(vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked")
/* Get the link creation plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
@@ -605,10 +593,12 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't set property value for target name")
+ /* Construct a temporary VOL object */
+ tmp_vol_obj.data = (vol_obj2 ? (vol_obj2->data) : NULL);
+ tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector);
+
/* Create the link */
- if(H5VL_link_create(H5VL_LINK_CREATE_HARD, (vol_obj2 ? (vol_obj2->data) : NULL), loc_params2,
- (vol_obj1 != NULL ? vol_obj1->driver->cls : vol_obj2->driver->cls),
- lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link")
done:
@@ -644,10 +634,10 @@ herr_t
H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sLl*xzii", link_loc_id, link_name, link_type, udata,
@@ -689,8 +679,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
/* Create external link */
- if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->driver->cls,
- lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:
@@ -744,8 +733,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Unlink */
- if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
@@ -808,8 +796,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Delete the link */
- if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
@@ -865,8 +852,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the link value */
- if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0)
+ if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name)
done:
@@ -930,8 +916,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the link value */
- if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0)
+ if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value")
done:
@@ -982,8 +967,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Check for the existence of the link */
- if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_EXISTS,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -1034,8 +1018,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the link information */
- if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_INFO,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0)
+ if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -1095,8 +1078,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the link information */
- if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_INFO,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0)
+ if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -1292,8 +1274,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Get the link information */
- if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_NAME,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0)
+ if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name")
done:
@@ -1351,9 +1332,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->data, loc_params, vol_obj->driver->cls, 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:
@@ -1423,8 +1402,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name,
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
/* Iterate over the links */
- if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, 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, FALSE, idx_type, order, idx_p, op, op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
@@ -1492,9 +1470,7 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Iterate over the links */
- if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- TRUE, idx_type, order, NULL, op, op_data)) < 0)
+ if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
@@ -1569,9 +1545,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type,
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
/* Visit the links */
- if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- TRUE, idx_type, order, NULL, op, op_data)) < 0)
+ if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
@@ -1949,7 +1923,7 @@ H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATT
/* Set up location for user-defined callback */
if(NULL == (grp = H5G_open(&temp_loc)))
HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group")
- if((grp_id = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0)
+ if((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register ID for group")
/* Make callback */
@@ -2734,7 +2708,7 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
/* Set up location for user-defined callback */
if(NULL == (grp = H5G_open(&temp_loc)))
HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group")
- if((grp_id = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0)
+ if((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register group ID")
if(udata->copy) {
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index 34c96a8..0f3296f 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -34,7 +34,6 @@
#include "H5Opublic.h" /* File objects */
#include "H5Pprivate.h" /* Property lists */
#include "H5VLprivate.h" /* Virtual Object Layer */
-#include "H5VLnative_private.h" /* Native VOL driver */
/****************/
@@ -243,7 +242,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
/* Get an ID for the external link's object */
- if((ext_obj_id = H5VL_native_register(opened_type, ext_obj, TRUE)) < 0)
+ if((ext_obj_id = H5VL_wrap_register(opened_type, ext_obj, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register external link object")
/* Set return value */
@@ -414,8 +413,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
/* Create an external link */
- if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->driver->cls,
- lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link")
done:
diff --git a/src/H5O.c b/src/H5O.c
index 23b6dda7..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 */
@@ -100,7 +102,7 @@
hid_t
H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5I_type_t opened_type;
void *opened_obj = NULL;
H5VL_loc_params_t loc_params;
@@ -130,13 +132,13 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
loc_params.obj_type = H5I_get_type(loc_id);
/* Open the object */
- if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls,
- &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
/* Get an atom for the object */
- if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
+ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oopen() */
@@ -169,7 +171,7 @@ hid_t
H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5I_type_t opened_type;
void *opened_obj = NULL;
H5VL_loc_params_t loc_params;
@@ -203,12 +205,11 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the object */
- if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls,
- &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
- if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
+ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
done:
FUNC_LEAVE_API(ret_value)
@@ -253,7 +254,7 @@ done:
hid_t
H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5I_type_t opened_type;
void *opened_obj = NULL;
H5VL_loc_params_t loc_params;
@@ -271,13 +272,12 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the object */
- if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, &opened_type,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
/* Register the dataset ID */
- if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
+ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
done:
FUNC_LEAVE_API(ret_value)
@@ -311,6 +311,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
{
H5VL_object_t *vol_obj1 = NULL; /* object token of obj_id */
H5VL_object_t *vol_obj2 = NULL; /* object token of new_loc_id */
+ H5VL_object_t tmp_vol_obj; /* Temporary object token of */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
H5P_genplist_t *plist; /* Property list pointer */
@@ -348,21 +349,19 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
loc_params2.loc_data.loc_by_name.name = new_name;
loc_params2.loc_data.loc_by_name.lapl_id = lapl_id;
- if(H5L_SAME_LOC != obj_id) {
+ if(H5L_SAME_LOC != obj_id)
/* get the location object */
if(NULL == (vol_obj1 = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- }
- if(H5L_SAME_LOC != new_loc_id) {
+ if(H5L_SAME_LOC != new_loc_id)
/* get the location object */
if(NULL == (vol_obj2 = H5VL_vol_object(new_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- }
- /* Make sure that the VOL plugins are the same */
- if(vol_obj1 && vol_obj2) {
- if (vol_obj1->driver->cls->value != vol_obj2->driver->cls->value)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked")
- }
+
+ /* Make sure that the VOL connectors are the same */
+ if(vol_obj1 && vol_obj2)
+ if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked")
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
@@ -374,10 +373,12 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id")
+ /* Construct a temporary VOL object */
+ tmp_vol_obj.data = vol_obj2->data;
+ tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector);
+
/* Create a link to the object */
- if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2,
- (vol_obj1 != NULL ? vol_obj1->driver->cls : vol_obj2->driver->cls),
- lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link")
done:
@@ -408,7 +409,7 @@ done:
herr_t
H5Oincr_refcount(hid_t object_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED;
@@ -427,8 +428,7 @@ H5Oincr_refcount(hid_t object_id)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Change the object's reference count */
- if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_OBJECT_CHANGE_REF_COUNT,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, 1) < 0)
+ if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, 1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
@@ -459,7 +459,7 @@ done:
herr_t
H5Odecr_refcount(hid_t object_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -478,8 +478,7 @@ H5Odecr_refcount(hid_t object_id)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Change the object's reference count */
- if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_OBJECT_CHANGE_REF_COUNT,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, -1) < 0)
+ if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, -1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
@@ -503,7 +502,7 @@ done:
htri_t
H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
htri_t ret_value = FAIL; /* Return value */
@@ -531,8 +530,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
loc_params.obj_type = H5I_get_type(loc_id);
/* Check if the object exists */
- if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_OBJECT_EXISTS,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name)
done:
@@ -557,7 +555,7 @@ done:
herr_t
H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -579,8 +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->data, vol_obj->driver->cls, 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:
@@ -606,7 +603,7 @@ herr_t
H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
unsigned fields, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -638,8 +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->data, vol_obj->driver->cls, 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:
@@ -667,7 +663,7 @@ herr_t
H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -704,8 +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->data, vol_obj->driver->cls, 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:
@@ -733,7 +728,7 @@ done:
herr_t
H5Oset_comment(hid_t obj_id, const char *comment)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -753,8 +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->data, vol_obj->driver->cls, 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:
@@ -783,7 +777,7 @@ herr_t
H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -809,8 +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->data, vol_obj->driver->cls, 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:
@@ -837,7 +830,7 @@ done:
ssize_t
H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
ssize_t ret_value = -1; /* Return value */
@@ -845,7 +838,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize)
H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize);
/* Get the object */
- if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Set fields in the location struct */
@@ -853,8 +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->data, vol_obj->driver->cls, 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:
@@ -882,7 +874,7 @@ ssize_t
H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize,
hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
ssize_t ret_value = -1; /* Return value */
@@ -908,8 +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->data, vol_obj->driver->cls, 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:
@@ -956,7 +947,7 @@ herr_t
H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
H5O_iterate_t op, void *op_data, unsigned fields)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value; /* Return value */
@@ -982,9 +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->data, loc_params, vol_obj->driver->cls,
- 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:
@@ -1031,7 +1020,7 @@ herr_t
H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value; /* Return value */
@@ -1068,9 +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->data, loc_params, vol_obj->driver->cls,
- 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:
@@ -1119,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/H5Oattribute.c b/src/H5Oattribute.c
index 1d509e5..6e135c5 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -1304,7 +1304,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, H5_index_t idx_type,
/* Iterate over attributes in table */
if((ret_value = H5A__attr_iterate_table(&atable, skip, last_attr, loc_id, attr_op, op_data)) < 0)
- HERROR(H5E_ATTR, H5E_CANTNEXT, "iteration operator failed");
+ HERROR(H5E_ATTR, H5E_BADITER, "iteration operator failed");
} /* end else */
done:
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index c03c352..a3d4884 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -247,9 +247,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
loc_params2.obj_type = H5I_get_type(dst_loc_id);
/* Copy the object */
- if((ret_value = H5VL_object_copy(vol_obj1->data, loc_params1, vol_obj1->driver->cls, src_name,
- vol_obj2->data, loc_params2, vol_obj2->driver->cls, dst_name,
- ocpypl_id, lcpl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if(H5VL_object_copy(vol_obj1, &loc_params1, src_name, vol_obj2, &loc_params2, dst_name, ocpypl_id, lcpl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
done:
diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c
index 68eb170..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,8 +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->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
@@ -161,8 +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->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name)
done:
@@ -223,8 +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->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
@@ -292,9 +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->data, loc_params, vol_obj->driver->cls,
- 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:
@@ -373,9 +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->data, loc_params, vol_obj->driver->cls,
- 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 adf36b9..125da36 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -347,9 +347,9 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh,
if(NULL == (dt = (H5T_t *)H5O_msg_read_oh(f, open_oh, H5O_DTYPE_ID, NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't read DTYPE message")
/* Verify size */
- if(fill->size != H5T_GET_SIZE(dt))
+ if(fill->size != (ssize_t)H5T_GET_SIZE(dt))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "inconsistent fill value size")
- }
+ } /* end if */
if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
diff --git a/src/H5Oflush.c b/src/H5Oflush.c
index 40b6c6e..da9d1d0 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -92,8 +92,7 @@ H5Oflush(hid_t obj_id)
loc_params.obj_type = H5I_get_type(obj_id);
/* Flush the object */
- if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls,
- H5VL_OBJECT_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_id)) < 0)
+ if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
done:
@@ -257,8 +256,7 @@ H5Orefresh(hid_t oid)
loc_params.obj_type = H5I_get_type(oid);
/* Refresh the object */
- if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls,
- H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oid)) < 0)
+ if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oid) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
done:
@@ -301,7 +299,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
H5O_loc_t obj_oloc;
H5G_name_t obj_path;
H5O_shared_t cached_H5O_shared;
- H5VL_t *driver = NULL;
+ H5VL_t *connector = NULL;
/* Create empty object location */
obj_loc.oloc = &obj_oloc;
@@ -319,29 +317,29 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
if(H5T_save_refresh_state(oid, &cached_H5O_shared) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to save datatype state")
- /* Get the VOL object from the ID and cache a pointer to the driver.
+ /* Get the VOL object from the ID and cache a pointer to the connector.
* The vol_obj will disappear when the underlying object is closed, so
* we can't use that directly.
*/
if(NULL == (vol_obj = H5VL_vol_object(oid)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
- driver = vol_obj->driver;
+ connector = vol_obj->connector;
- /* Bump the number of references on the VOL driver.
- * If you don't do this, VDS refreshes can accidentally close the driver.
+ /* Bump the number of references on the VOL connector.
+ * If you don't do this, VDS refreshes can accidentally close the connector.
*/
- driver->nrefs++;
+ connector->nrefs++;
/* Close object & evict its metadata */
if((H5O__refresh_metadata_close(oid, oloc, &obj_loc)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
/* Re-open the object, re-fetching its metadata */
- if((H5O_refresh_metadata_reopen(oid, &obj_loc, driver, FALSE)) < 0)
+ if((H5O_refresh_metadata_reopen(oid, &obj_loc, connector, FALSE)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
- /* Restore the number of references on the VOL driver */
- driver->nrefs--;
+ /* Restore the number of references on the VOL connector */
+ connector->nrefs--;
/* Restore important datatype state */
if(H5I_get_type(oid) == H5I_DATATYPE)
@@ -444,7 +442,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, hbool_t start_swmr)
+H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_connector, hbool_t start_swmr)
{
void *object = NULL; /* Object for this operation */
H5I_type_t type; /* Type of object for the ID */
@@ -454,7 +452,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, h
/* Sanity check */
HDassert(obj_loc);
- HDassert(vol_driver);
+ HDassert(vol_connector);
/* Get object's type */
type = H5I_get_type(oid);
@@ -463,13 +461,13 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, h
case H5I_GROUP:
/* Re-open the group */
if(NULL == (object = H5G_open(obj_loc)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open group")
break;
case H5I_DATATYPE:
/* Re-open the named datatype */
if(NULL == (object = H5T_open(obj_loc)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to open named datatype")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open named datatype")
break;
case H5I_DATASET:
@@ -478,7 +476,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, h
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset")
if(!start_swmr) /* No need to handle multiple opens when H5Fstart_swmr_write() */
if(H5D_mult_refresh_reopen((H5D_t *)object) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to finish refresh for dataset")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to finish refresh for dataset")
break;
case H5I_UNINIT:
@@ -486,7 +484,6 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, h
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
- case H5I_REFERENCE:
case H5I_VFL:
case H5I_VOL:
case H5I_GENPROP_CLS:
@@ -496,13 +493,13 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, h
case H5I_ERROR_STACK:
case H5I_NTYPES:
default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid file object ID (dataset, group, or datatype)")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not a valid file object ID (dataset, group, or datatype)")
break;
} /* end switch */
/* Re-register ID for the object */
- if((H5VL_register_using_existing_id(type, object, vol_driver, TRUE, oid)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh")
+ if((H5VL_register_using_existing_id(type, object, vol_connector, TRUE, oid)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh")
done:
FUNC_LEAVE_NOAPI(ret_value);
diff --git a/src/H5Oint.c b/src/H5Oint.c
index 30fe127..a97a2fd 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -43,7 +43,6 @@
#endif /* H5O_ENABLE_BOGUS */
#include "H5Opkg.h" /* Object headers */
#include "H5VLprivate.h" /* Virtual Object Layer */
-#include "H5VLnative_private.h" /* Native VOL driver */
/****************/
@@ -1766,7 +1765,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:
@@ -2114,7 +2112,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields)
/* Set the object's reference count */
oinfo->rc = oh->nlink;
- }
+ } /* end if */
/* Get time information, if requested */
if(fields & H5O_INFO_TIME) {
@@ -2658,7 +2656,7 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
/* Get an ID for the visited object */
- if((obj_id = H5VL_native_register(opened_type, obj, TRUE)) < 0)
+ if((obj_id = H5VL_wrap_register(opened_type, obj, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register visited object")
/* Make callback for starting object */
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 6447936..55e1aee 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -612,6 +612,7 @@ herr_t
H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg)
{
H5O_link_t *lnk = (H5O_link_t *)_mesg;
+ hid_t file_id = -1; /* ID for the file the link is located in (passed to user callback) */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -645,25 +646,21 @@ H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg)
/* Check for delete callback */
if(link_class->del_func) {
- hid_t file_id; /* ID for the file the link is located in (passed to user callback) */
-
/* Get a file ID for the file the link is in */
- if((file_id = H5F_get_id(f, FALSE)) < 0)
+ if((file_id = H5F_get_id(f)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID")
/* Call user-defined link's 'delete' callback */
- if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) {
- H5I_dec_ref(file_id);
+ if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "link deletion callback returned failure")
- } /* end if */
-
- /* Release the file ID */
- if(H5I_dec_ref(file_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file")
} /* end if */
} /* end if */
done:
+ /* Release the file ID */
+ if(file_id > 0 && H5I_dec_ref(file_id) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_link_delete() */
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 7254edb..dbc8089 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -414,13 +414,6 @@ typedef struct H5O_chk_cache_ud_t {
H5O_common_cache_ud_t common; /* Common object header cache callback info */
} H5O_chk_cache_ud_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;
-
/* Header message ID to class mapping */
H5_DLLVAR const H5O_msg_class_t *const H5O_msg_class_g[H5O_MSG_TYPES];
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 048e13e..7ed9e26 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -851,7 +851,6 @@ typedef struct {
} u;
} H5O_mesg_operator_t;
-
/* Typedef for abstract object creation */
typedef struct {
H5O_type_t obj_type; /* Type of object to create */
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/H5PLint.c b/src/H5PLint.c
index 166b300..ded315a 100644
--- a/src/H5PLint.c
+++ b/src/H5PLint.c
@@ -30,7 +30,6 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5MMprivate.h" /* Memory management */
#include "H5PLpkg.h" /* Plugin */
-#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5Zprivate.h" /* Filter pipeline */
@@ -236,7 +235,7 @@ done:
*-------------------------------------------------------------------------
*/
const void *
-H5PL_load(H5PL_type_t type, H5PL_key_t key)
+H5PL_load(H5PL_type_t type, const H5PL_key_t *key)
{
H5PL_search_params_t search_params; /* Plugin search parameters */
hbool_t found = FALSE; /* Whether the plugin was found */
@@ -263,7 +262,7 @@ H5PL_load(H5PL_type_t type, 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)
@@ -308,7 +307,8 @@ done:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
herr_t
-H5PL__open(const char *path, H5PL_type_t type, H5PL_key_t key, hbool_t *success, const void **plugin_info)
+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_info_t get_plugin_info = NULL;
@@ -350,29 +350,44 @@ H5PL__open(const char *path, H5PL_type_t type, H5PL_key_t key, hbool_t *success,
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get filter info from plugin")
/* If the filter IDs match, we're done. Set the output parameters. */
- if (filter_info->id == key.id) {
+ if (filter_info->id == key->id) {
*plugin_info = (const void *)filter_info;
*success = TRUE;
}
break;
}
+
case H5PL_TYPE_VOL:
{
- const H5VL_class_t *cls = NULL;
+ const H5VL_class_t *cls;
/* Get the plugin info */
- if (NULL == (cls = (const H5VL_class_t *)(*get_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")
- /* If the plugin names match, we're done. Set the output parameters. */
- if (cls->name && !HDstrcmp(cls->name, key.name)) {
- *plugin_info = (const void *)cls;
- *success = TRUE;
- }
+ /* Which kind of key are we looking for? */
+ if(key->vol.kind == H5VL_GET_CONNECTOR_BY_NAME) {
+ /* If the plugin names match, we're done. Set the output parameters. */
+ if(cls->name && !HDstrcmp(cls->name, key->vol.u.name)) {
+ *plugin_info = (const void *)cls;
+ *success = TRUE;
+ } /* end if */
+ } /* end if */
+ else {
+ /* Sanity check */
+ HDassert(key->vol.kind == H5VL_GET_CONNECTOR_BY_VALUE);
+
+ /* If the plugin values match, we're done. Set the output parameters. */
+ if(cls->value == key->vol.u.value) {
+ *plugin_info = (const void *)cls;
+ *success = TRUE;
+ } /* end if */
+ } /* end else */
break;
}
+
case H5PL_TYPE_ERROR:
case H5PL_TYPE_NONE:
default:
diff --git a/src/H5PLpath.c b/src/H5PLpath.c
index 972f1d0..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:
diff --git a/src/H5PLpkg.h b/src/H5PLpkg.h
index dfaa4af..c3ad8f5 100644
--- a/src/H5PLpkg.h
+++ b/src/H5PLpkg.h
@@ -116,7 +116,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;
@@ -134,13 +134,15 @@ H5_DLL herr_t H5PL__get_plugin_control_mask(unsigned int *mask /*out*/);
H5_DLL herr_t H5PL__set_plugin_control_mask(unsigned int mask);
/* Plugin search and manipulation */
-H5_DLL herr_t H5PL__open(const char *libname, H5PL_type_t type, H5PL_key_t key, hbool_t *success /*out*/, const void **plugin_info /*out*/);
+H5_DLL herr_t H5PL__open(const char *libname, H5PL_type_t type, const H5PL_key_t *key,
+ hbool_t *success /*out*/, const void **plugin_info /*out*/);
H5_DLL herr_t H5PL__close(H5PL_HANDLE handle);
/* Plugin cache calls */
H5_DLL herr_t H5PL__create_plugin_cache(void);
H5_DLL herr_t H5PL__close_plugin_cache(hbool_t *already_closed /*out*/);
-H5_DLL herr_t H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle);
+H5_DLL herr_t H5PL__add_plugin(H5PL_type_t type, const H5PL_key_t *key,
+ H5PL_HANDLE handle);
H5_DLL herr_t H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *found /*out*/, const void **plugin_info /*out*/);
/* Plugin search path calls */
diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c
index e905ac2..cd0b4d6 100644
--- a/src/H5PLplugin_cache.c
+++ b/src/H5PLplugin_cache.c
@@ -216,7 +216,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle)
+H5PL__add_plugin(H5PL_type_t type, const H5PL_key_t *key, H5PL_HANDLE handle)
{
herr_t ret_value = SUCCEED;
@@ -229,7 +229,7 @@ H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle)
/* Store the plugin info and bump the # of plugins */
H5PL_cache_g[H5PL_num_plugins_g].type = type;
- H5PL_cache_g[H5PL_num_plugins_g].key = key;
+ H5PL_cache_g[H5PL_num_plugins_g].key = *key;
H5PL_cache_g[H5PL_num_plugins_g].handle = handle;
H5PL_num_plugins_g++;
@@ -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/H5PLprivate.h b/src/H5PLprivate.h
index 2af1b70..5ce9b87 100644
--- a/src/H5PLprivate.h
+++ b/src/H5PLprivate.h
@@ -21,7 +21,8 @@
#include "H5PLpublic.h"
/* Private headers needed by this file */
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/**************************/
@@ -35,8 +36,14 @@
/* The key that will be used to find the plugin */
typedef union H5PL_key_t {
- int id; /* filters */
- const char *name; /* VOL drivers */
+ int id; /* I/O filters */
+ struct {
+ H5VL_get_connector_kind_t kind; /* Kind of VOL lookup to do */
+ union {
+ H5VL_class_value_t value; /* VOL connector value */
+ const char *name; /* VOL connector name */
+ } u;
+ } vol;
} H5PL_key_t;
@@ -50,7 +57,7 @@ typedef union H5PL_key_t {
/***************************************/
/* Internal API routines */
-H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, H5PL_key_t key);
+H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, const H5PL_key_t *key);
#endif /* _H5PLprivate_H */
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 23eb924..452ea3f 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -39,17 +39,17 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory Management */
#include "H5Ppkg.h" /* Property lists */
-#include "H5VLprivate.h" /* VOL drivers */
+#include "H5VLprivate.h" /* Virtual Object Layer */
-/* Includes needed to set as default file driver */
-#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */
+/* Includes needed to set default file driver */
+#include "H5FDsec2.h" /* POSIX unbuffered I/O */
#include "H5FDstdio.h" /* Standard C buffered I/O */
#ifdef H5_HAVE_WINDOWS
#include "H5FDwindows.h" /* Win32 I/O */
#endif
-/* Includes needed to set the default VOL driver */
-#include "H5VLnative_private.h" /* Native VOL driver */
+/* Includes needed to set default 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
@@ -263,16 +253,16 @@
#define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF 0
#define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC H5P__encode_unsigned
#define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC H5P__decode_unsigned
-/* Definition for file VOL driver properties (ID, etc.) */
-#define H5F_ACS_VOL_SIZE sizeof(H5VL_driver_prop_t)
-#define H5F_ACS_VOL_DEF {H5_DEFAULT_VOL, NULL}
-#define H5F_ACS_VOL_CRT H5P__facc_vol_create
-#define H5F_ACS_VOL_SET H5P__facc_vol_set
-#define H5F_ACS_VOL_GET H5P__facc_vol_get
-#define H5F_ACS_VOL_DEL H5P__facc_vol_del
-#define H5F_ACS_VOL_COPY H5P__facc_vol_copy
-#define H5F_ACS_VOL_CMP H5P__facc_vol_cmp
-#define H5F_ACS_VOL_CLOSE H5P__facc_vol_close
+/* Definition for file VOL connector properties (ID, etc.) */
+#define H5F_ACS_VOL_CONN_SIZE sizeof(H5VL_connector_prop_t)
+#define H5F_ACS_VOL_CONN_DEF {H5_DEFAULT_VOL, NULL}
+#define H5F_ACS_VOL_CONN_CRT H5P__facc_vol_create
+#define H5F_ACS_VOL_CONN_SET H5P__facc_vol_set
+#define H5F_ACS_VOL_CONN_GET H5P__facc_vol_get
+#define H5F_ACS_VOL_CONN_DEL H5P__facc_vol_del
+#define H5F_ACS_VOL_CONN_COPY H5P__facc_vol_copy
+#define H5F_ACS_VOL_CONN_CMP H5P__facc_vol_cmp
+#define H5F_ACS_VOL_CONN_CLOSE H5P__facc_vol_close
/******************/
@@ -335,7 +325,7 @@ static int H5P__facc_cache_image_config_cmp(const void *_config1, const void *_c
static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size);
static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value);
-/* VOL driver callbacks */
+/* VOL connector callbacks */
static herr_t H5P__facc_vol_create(const char *name, size_t size, void *value);
static herr_t H5P__facc_vol_set(hid_t prop_id, const char *name, size_t size, void *value);
static herr_t H5P__facc_vol_get(hid_t prop_id, const char *name, size_t size, void *value);
@@ -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 */
@@ -438,7 +426,7 @@ static herr_t
H5P__facc_reg_prop(H5P_genclass_t *pclass)
{
const H5FD_driver_prop_t def_driver_prop = H5F_ACS_FILE_DRV_DEF; /* Default VFL driver ID & info (initialized from a variable) */
- const H5VL_driver_prop_t def_vol_prop = H5F_ACS_VOL_DEF; /* Default VOL driver ID & info (initialized from a variable) */
+ const H5VL_connector_prop_t def_vol_prop = H5F_ACS_VOL_CONN_DEF; /* Default VOL connector ID & info (initialized from a variable) */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -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,
@@ -669,11 +645,11 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass)
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the file VOL driver ID & info */
+ /* Register the file VOL connector ID & info */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P__register_real(pclass, H5F_ACS_VOL_DRV_NAME, H5F_ACS_VOL_SIZE, &def_vol_prop,
- H5F_ACS_VOL_CRT, H5F_ACS_VOL_SET, H5F_ACS_VOL_GET, NULL, NULL,
- H5F_ACS_VOL_DEL, H5F_ACS_VOL_COPY, H5F_ACS_VOL_CMP, H5F_ACS_VOL_CLOSE) < 0)
+ if(H5P__register_real(pclass, H5F_ACS_VOL_CONN_NAME, H5F_ACS_VOL_CONN_SIZE, &def_vol_prop,
+ H5F_ACS_VOL_CONN_CRT, H5F_ACS_VOL_CONN_SET, H5F_ACS_VOL_CONN_GET, NULL, NULL,
+ H5F_ACS_VOL_CONN_DEL, H5F_ACS_VOL_CONN_COPY, H5F_ACS_VOL_CONN_CMP, H5F_ACS_VOL_CONN_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
@@ -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
@@ -4975,10 +4868,10 @@ done:
/*-------------------------------------------------------------------------
* Function: H5P_set_vol
*
- * Purpose: Set the VOL driver for a file access property list
- * (PLIST_ID). The vol properties will
+ * Purpose: Set the VOL connector for a file access property list
+ * (PLIST_ID). The VOL properties will
* be copied into the property list and the reference count on
- * the vol will be incremented.
+ * the VOL will be incremented.
*
* Return: SUCCEED/FAIL
*
@@ -4992,19 +4885,19 @@ H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info)
FUNC_ENTER_NOAPI(FAIL)
if(NULL == H5I_object_verify(vol_id, H5I_VOL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
- H5VL_driver_prop_t vol_prop; /* Property for VOL ID & info */
+ H5VL_connector_prop_t vol_prop; /* Property for VOL ID & info */
- /* Prepare the VOL driver property */
- vol_prop.driver_id = vol_id;
- vol_prop.driver_info = vol_info;
+ /* Prepare the VOL connector property */
+ vol_prop.connector_id = vol_id;
+ vol_prop.connector_info = vol_info;
- /* Set the driver ID & info property */
- if(H5P_set(plist, H5F_ACS_VOL_DRV_NAME, &vol_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL driver ID & info")
- }
+ /* Set the connector ID & info property */
+ if(H5P_set(plist, H5F_ACS_VOL_CONN_NAME, &vol_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL connector ID & info")
+ } /* end if */
else
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
@@ -5016,7 +4909,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Pset_vol
*
- * Purpose: Set the file VOL driver (VOL_ID) for a file access
+ * Purpose: Set the file VOL connector (VOL_ID) for a file access
* property list (PLIST_ID)
*
* Return: Success: Non-negative
@@ -5037,11 +4930,11 @@ H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info)
if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
if(NULL == H5I_object_verify(new_vol_id, H5I_VOL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file vol ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file VOL ID")
- /* Set the vol */
+ /* Set the VOL */
if(H5P_set_vol(plist, new_vol_id, new_vol_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vol")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL")
done:
FUNC_LEAVE_API(ret_value)
@@ -5049,197 +4942,113 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5P_get_vol_info
- *
- * Purpose: Returns a pointer directly to the file vol-specific
- * information of a file access property list.
- *
- * Return: Success: Ptr to *uncopied* vol specific data
- * structure if any.
- *
- * Failure: NULL. Null is also returned if the vol has
- * not registered any vol-specific properties
- * although no error is pushed on the stack in
- * this case.
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5P_get_vol_info(H5P_genplist_t *plist)
-{
- void *ret_value = NULL;
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* Get the current vol info */
- if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
- H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */
-
- if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info")
- ret_value = (void *)driver_prop.driver_info;
- } else
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_get_vol_info() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_vol_info
- *
- * Purpose: Returns a pointer directly to the file vol-specific
- * information of a file access property list.
- *
- * XXX (VOL MERGE): This API call seems like a REALLY bad idea - DER
- *
- * Return: Success: Ptr to *uncopied* vol specific data
- * structure if any.
+ * Function: H5Pget_vol_id
*
- * Failure: NULL. Null is also returned if the vol has
- * not registered any vol-specific properties
- * although no error is pushed on the stack in
- * this case.
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5Pget_vol_info(hid_t plist_id)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- void *ret_value; /* Return value */
-
- FUNC_ENTER_API(NULL)
- H5TRACE1("*x", "i", plist_id);
-
- if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
-
- if(NULL == (ret_value = H5P_get_vol_info(plist)))
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol info")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Pget_vol_info() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5P__vol_copy
- *
- * Purpose: Copy VOL driver ID & info.
- *
- * Note: This is an "in-place" copy, since this routine gets called
- * after the top-level copy has been performed and this routine
- * finishes the "deep" part of the copy.
+ * Purpose: Returns the ID of the current VOL connector.
+ * This ID should be closed with H5VLclose().
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5P__vol_copy(void *value)
+herr_t
+H5Pget_vol_id(hid_t plist_id, hid_t *vol_id)
{
+ H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
-
- if(value) {
- H5VL_driver_prop_t *info = (H5VL_driver_prop_t *)value; /* Driver ID & info struct */
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*i", plist_id, vol_id);
- /* Copy the driver ID & info, if there is one */
- if(info->driver_id > 0) {
- /* Increment the reference count on driver ID and copy driver info */
- if(H5I_inc_ref(info->driver_id, FALSE) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL driver ID")
+ /* Get property list for ID */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
- /* Copy driver info, if it exists */
- if(info->driver_info) {
- H5VL_class_t *driver; /* Pointer to driver */
- void *new_driver; /* Copy of driver info */
+ /* Get the current VOL ID */
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
- /* Retrieve the driver for the ID */
- if(NULL == (driver = (H5VL_class_t *)H5I_object(info->driver_id)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL driver ID")
+ /* Get the connector property */
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector info")
- /* Allow the driver to copy or do it ourselves */
- if(driver->fapl_copy) {
- if(NULL == (new_driver = (driver->fapl_copy)(info->driver_info)))
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "driver info copy failed")
- }
- else if(driver->fapl_size > 0) {
- if(NULL == (new_driver = H5MM_malloc(driver->fapl_size)))
- HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "driver info allocation failed")
- HDmemcpy(new_driver, info->driver_info, driver->fapl_size);
- }
- else
- HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "no way to copy driver info")
+ /* Increment the VOL ID's ref count */
+ if(H5I_inc_ref(connector_prop.connector_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID")
- /* Set the driver info for the copy */
- info->driver_info = new_driver;
- }
- }
- }
+ /* Set the connector ID to return */
+ *vol_id = connector_prop.connector_id;
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P__vol_copy() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_vol_id() */
/*-------------------------------------------------------------------------
- * Function: H5P__vol_free
+ * Function: H5Pget_vol_info
*
- * Purpose: Free VOL driver ID & info.
+ * Purpose: Returns a copy of the VOL info for a connector.
+ * This information should be freed with H5VLfree_connector_info.
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5P__vol_free(void *value)
+herr_t
+H5Pget_vol_info(hid_t plist_id, void **vol_info)
{
+ H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i**x", plist_id, vol_info);
- if(value) {
- H5VL_driver_prop_t *info = (H5VL_driver_prop_t *)value; /* Driver ID & info struct */
+ /* Get property list for ID */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
- /* Free the driver info (if it exists) and decrement the ID */
- if(info->driver_id > 0) {
- if(info->driver_info) {
- H5VL_class_t *driver; /* Pointer to driver */
+ /* Get the current VOL info */
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
+ void *new_connector_info = NULL; /* Copy of connector info */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
- /* Retrieve the driver for the ID */
- if(NULL == (driver = (H5VL_class_t *)H5I_object(info->driver_id)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL driver ID")
+ /* Get the connector property */
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector property")
- /* Allow the driver to free info or do it ourselves */
- if(driver->fapl_free) {
- if((driver->fapl_free)((void *)info->driver_info) < 0) /* Casting away const OK -QAK */
- HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed")
- }
- else
- H5MM_xfree((void *)info->driver_info); /* Casting away const OK -QAK */
- }
+ /* Copy connector info, if it exists */
+ if(connector_prop.connector_info) {
+ H5VL_class_t *connector; /* Pointer to connector */
- /* Decrement reference count for driver ID */
- if(H5I_dec_ref(info->driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for driver ID")
- }
- }
+ /* Retrieve the connector for the ID */
+ if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop.connector_id)))
+ HGOTO_ERROR(H5E_PLIST, 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_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed")
+ } /* end if */
+
+ /* Set the connector info */
+ *vol_info = new_connector_info;
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P__vol_free() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_vol_info() */
/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_create
*
- * Purpose: Create callback for the VOL driver ID & info property.
+ connectorose: Create callback for the VOL connector ID & info property.
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5253,9 +5062,9 @@ H5P__facc_vol_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size
FUNC_ENTER_STATIC
- /* Make copy of the VOL driver */
- if(H5P__vol_copy(value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver")
+ /* Make copy of the VOL connector */
+ if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5265,7 +5074,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_set
*
- * Purpose: Copies a VOL driver property when it's set for a property list
+ * Purpose: Copies a VOL connector property when it's set for a property list
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5283,9 +5092,9 @@ H5P__facc_vol_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name,
/* Sanity check */
HDassert(value);
- /* Make copy of VOL driver ID & info */
- if(H5P__vol_copy(value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver")
+ /* Make copy of VOL connector ID & info */
+ if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5295,7 +5104,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_get
*
- * Purpose: Copies a VOL driver property when it's retrieved from a property list
+ * Purpose: Copies a VOL connector property when it's retrieved from a property list
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5313,9 +5122,9 @@ H5P__facc_vol_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name,
/* Sanity check */
HDassert(value);
- /* Make copy of VOL driver */
- if(H5P__vol_copy(value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver")
+ /* Make copy of VOL connector */
+ if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5325,7 +5134,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_del
*
- * Purpose: Frees memory used to store the VOL driver ID & info property
+ * Purpose: Frees memory used to store the VOL connector ID & info property
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5339,9 +5148,9 @@ H5P__facc_vol_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name,
FUNC_ENTER_STATIC
- /* Free the VOL driver ID & info */
- if(H5P__vol_free(value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL driver")
+ /* Free the VOL connector ID & info */
+ if(H5VL_conn_free((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5351,7 +5160,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_copy
*
- * Purpose: Copy callback for the VOL driver ID & info property.
+ * Purpose: Copy callback for the VOL connector ID & info property.
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5365,9 +5174,9 @@ H5P__facc_vol_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size,
FUNC_ENTER_STATIC
- /* Make copy of VOL driver */
- if(H5P__vol_copy(value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver")
+ /* Make copy of VOL connector */
+ if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5377,7 +5186,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_cmp
*
- * Purpose: Callback routine which is called whenever the VOL driver
+ * Purpose: Callback routine which is called whenever the VOL connector
* ID & info property in the file access property list
* is compared.
*
@@ -5390,48 +5199,45 @@ done:
static int
H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED size)
{
- const H5VL_driver_prop_t *info1 = (const H5VL_driver_prop_t *)_info1; /* Create local aliases for values */
- const H5VL_driver_prop_t *info2 = (const H5VL_driver_prop_t *)_info2;
- H5VL_class_t *cls1, *cls2; /* Driver class for each property */
- int cmp_value; /* Value from comparison */
- herr_t ret_value = 0; /* Return value */
+ const H5VL_connector_prop_t *info1 = (const H5VL_connector_prop_t *)_info1; /* Create local aliases for values */
+ const H5VL_connector_prop_t *info2 = (const H5VL_connector_prop_t *)_info2;
+ H5VL_class_t *cls1, *cls2; /* connector class for each property */
+ int cmp_value = 0; /* Value from comparison */
+ herr_t status; /* Status from info comparison */
+ int ret_value = 0; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(info1);
HDassert(info2);
- HDassert(size == sizeof(H5VL_driver_prop_t));
+ HDassert(size == sizeof(H5VL_connector_prop_t));
- /* Compare drivers */
- if(NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->driver_id)))
+ /* Compare connectors */
+ if(NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->connector_id)))
HGOTO_DONE(-1)
- if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->driver_id)))
+ if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->connector_id)))
HGOTO_DONE(1)
- if(cls1->name == NULL && cls2->name != NULL)
- HGOTO_DONE(-1);
- if(cls1->name != NULL && cls2->name == NULL)
- HGOTO_DONE(1);
- if(0 != (cmp_value = HDstrcmp(cls1->name, cls2->name)))
+ status = H5VL_cmp_connector_cls(&cmp_value, cls1, cls2);
+ HDassert(status >= 0);
+ if(cmp_value != 0)
HGOTO_DONE(cmp_value);
- /* Compare driver info */
- if(cls1->fapl_size < cls2->fapl_size)
- HGOTO_DONE(-1)
- if(cls1->fapl_size > cls2->fapl_size)
- HGOTO_DONE(1)
- HDassert(cls1->fapl_size == cls2->fapl_size);
+ /* At this point, we should be able to assume that we are dealing with
+ * the same connector class struct (or a copies of the same class struct)
+ */
- if(info1->driver_info == NULL && info2->driver_info != NULL)
- HGOTO_DONE(-1);
- if(info1->driver_info != NULL && info2->driver_info == NULL)
- HGOTO_DONE(1);
- if(info1->driver_info) {
- HDassert(cls1->fapl_size > 0);
- if(0 != (cmp_value = HDmemcmp(info1->driver_info, info2->driver_info, cls1->fapl_size)))
- HGOTO_DONE(cmp_value);
- }
+ /* Use one of the classes (cls1) info comparison routines to compare the
+ * info objects
+ */
+ HDassert(cls1->info_cmp == cls2->info_cmp);
+ status = H5VL_cmp_connector_info(cls1, &cmp_value, info1->connector_info, info2->connector_info);
+ HDassert(status >= 0);
+
+ /* Set return value */
+ ret_value = cmp_value;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_vol_cmp() */
@@ -5440,7 +5246,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_close
*
- * Purpose: Close callback for the VOL driver ID & info property.
+ * Purpose: Close callback for the VOL connector ID & info property.
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5454,9 +5260,9 @@ H5P__facc_vol_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size,
FUNC_ENTER_STATIC
- /* Free the VOL driver */
- if(H5P__vol_free(value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL driver")
+ /* Free the VOL connector */
+ if(H5VL_conn_free((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c
index 6568ecd..16be52a 100644
--- a/src/H5Plcpl.c
+++ b/src/H5Plcpl.c
@@ -55,7 +55,7 @@
/* Definitions for Location params */
#define H5L_CRT_LOCATION_SIZE sizeof(H5VL_loc_params_t)
-#define H5L_CRT_LOCATION_DEF {H5I_BADID, H5VL_OBJECT_BY_SELF, {HADDR_UNDEF}}
+#define H5L_CRT_LOCATION_DEF {H5I_BADID, H5VL_OBJECT_BY_SELF, {{HADDR_UNDEF}}}
/* Definitions for target object NAME */
#define H5L_CRT_TARGET_NAME_SIZE sizeof(char *)
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index cd749cb..866f088 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -178,7 +178,6 @@ H5_DLL const void *H5P_peek_driver_info(H5P_genplist_t *plist);
H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id,
const void *new_driver_info);
H5_DLL herr_t H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info);
-H5_DLL void * H5P_get_vol_info(H5P_genplist_t *plist);
H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist,
H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func,
void *free_info);
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 77d8ebb..86c6687 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -314,7 +314,8 @@ H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id,
H5_DLL hid_t H5Pget_driver(hid_t plist_id);
H5_DLL const void *H5Pget_driver_info(hid_t plist_id);
H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info);
-H5_DLL void *H5Pget_vol_info(hid_t plist_id);
+H5_DLL herr_t H5Pget_vol_id(hid_t plist_id, hid_t *vol_id);
+H5_DLL herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info);
H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset);
H5_DLL herr_t H5Pget_family_offset(hid_t fapl_id, hsize_t *offset);
H5_DLL herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type);
diff --git a/src/H5R.c b/src/H5R.c
index a2a7a14..7d3686e 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -127,9 +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->data, loc_params, vol_obj->driver->cls, 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:
@@ -200,12 +198,11 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r
loc_params.obj_type = H5I_get_type(obj_id);
/* Dereference */
- if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls,
- &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object")
- if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
+ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
done:
FUNC_LEAVE_API(ret_value)
@@ -260,8 +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->data, loc_params, vol_obj->driver->cls, 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:
@@ -318,9 +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->data, loc_params, vol_obj->driver->cls,
- 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:
@@ -387,9 +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->data, loc_params, vol_obj->driver->cls, 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 f224cda..ab8d3b4 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -37,13 +37,13 @@
#include "H5Ppublic.h" /* Property lists */
/* Private headers needed by this file */
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Gprivate.h" /* Groups */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gprivate.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
-#include "H5Oprivate.h" /* Object headers */
+#include "H5Oprivate.h" /* Object headers */
#include "H5Rpkg.h" /* References */
@@ -126,8 +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->data, loc_params, vol_obj->driver->cls, 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 */
@@ -183,13 +182,12 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref)
loc_params.obj_type = H5I_get_type(obj_id);
/* Dereference */
- if (NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, &opened_type,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object")
/* Get an atom for the object */
- if ((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
+ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Rint.c b/src/H5Rint.c
index 52a4ee1..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;
}
@@ -692,9 +666,9 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
ssize_t
-H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, char *name, size_t size)
+H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref,
+ char *name, size_t size)
{
- hid_t file_id = H5I_INVALID_HID; /* ID for file that the reference is in */
H5O_loc_t oloc; /* Object location describing object for reference */
ssize_t ret_value = -1; /* Return value */
@@ -728,7 +702,7 @@ H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, char *name, size_
UINT32DECODE(p, hobjid.idx);
/* Get the dataset region from the heap (allocate inside routine) */
- if ((buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)) == NULL)
+ if((buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)) == NULL)
HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, (-1), "Unable to read dataset region information")
/* Get the object oid for the dataset */
@@ -747,19 +721,11 @@ H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, char *name, size_
HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, (-1), "internal error (unknown reference type)")
} /* end switch */
- /* Retrieve file ID for name search */
- if ((file_id = H5F_get_id(f, FALSE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get file ID")
-
/* Get name, length, etc. */
- if ((ret_value = H5G_get_name_by_addr(file_id, &oloc, name, size)) < 0)
+ if((ret_value = H5G_get_name_by_addr(f, &oloc, name, size)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't determine name")
done:
- /* Close file ID used for search */
- if (file_id > 0 && H5I_dec_ref(file_id) < 0)
- HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, (-1), "can't decrement ref count of temp ID")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__get_name() */
diff --git a/src/H5T.c b/src/H5T.c
index d0b1c0a..01ace87 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -1609,23 +1609,22 @@ H5T__close_cb(H5T_t *dt)
HDassert(dt->shared);
/* If this datatype is VOL-managed (i.e.: has a VOL object),
- * close it through the VOL driver.
+ * close it through the VOL connector.
*/
if(NULL != dt->vol_obj) {
-
- /* Close the driver-managed datatype data */
- if(H5VL_datatype_close(dt->vol_obj->data, dt->vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype");
+ /* Close the connector-managed datatype data */
+ if(H5VL_datatype_close(dt->vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype")
/* Free the VOL object */
if(H5VL_free_object(dt->vol_obj) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object");
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object")
dt->vol_obj = NULL;
- }
+ } /* end if */
/* Close the datatype */
if(H5T_close(dt) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1730,7 +1729,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:
@@ -1745,7 +1743,7 @@ H5Tcopy(hid_t type_id)
/* Copy datatype */
if(NULL == (new_dt = H5T_copy(dt, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy")
/* Atomize result */
if((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0)
@@ -2264,30 +2262,30 @@ done:
* the return value is an integer type.
*
* Return: Success: Data type for base data type.
- *
* Failure: NULL
*
* Programmer: Raymond Lu
- * October 9, 2002
+ * October 9, 2002
+ *
*-------------------------------------------------------------------------
*/
H5T_t *
H5T_get_super(const H5T_t *dt)
{
- H5T_t *ret_value=NULL;
+ H5T_t *ret_value = NULL;
FUNC_ENTER_NOAPI(NULL)
HDassert(dt);
- if (!dt->shared->parent)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type");
- if (NULL==(ret_value=H5T_copy(dt->shared->parent, H5T_COPY_ALL)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy parent data type");
+ if(!dt->shared->parent)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type")
+ if(NULL == (ret_value = H5T_copy(dt->shared->parent, H5T_COPY_ALL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy parent data type")
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5T_get_super() */
/*-------------------------------------------------------------------------
@@ -3108,7 +3106,7 @@ H5T__create(H5T_class_t type, size_t size)
/* Copy the default string datatype */
if(NULL == (dt = H5T_copy(origin_dt, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy")
/* Modify the datatype */
if(H5T__set_size(dt, size) < 0)
@@ -3230,9 +3228,9 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
/* Allocate space */
if(NULL == (new_dt = H5FL_MALLOC(H5T_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
if(NULL == (new_dt->shared = H5FL_MALLOC(H5T_shared_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy shared information (entry information is copied last) */
*(new_dt->shared) = *(old_dt->shared);
@@ -3273,7 +3271,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
/* Open named datatype again */
if(H5O_open(&old_dt->oloc) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type")
/* Insert opened named datatype into opened object list for the file */
if(H5FO_insert(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr, new_dt->shared, FALSE)<0)
@@ -3337,7 +3335,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
new_dt->shared->u.compnd.memb =
(H5T_cmemb_t *)H5MM_malloc(new_dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t));
if (NULL == new_dt->shared->u.compnd.memb)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb,
new_dt->shared->u.compnd.nmembs * sizeof(H5T_cmemb_t));
@@ -3355,7 +3353,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
/* Range check against compound member's offset */
if ((accum_change < 0) && ((ssize_t) new_dt->shared->u.compnd.memb[i].offset < accum_change))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype")
/* Apply the accumulated size change to the offset of the field */
new_dt->shared->u.compnd.memb[i].offset += (size_t) accum_change;
@@ -3370,7 +3368,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
/* check if we couldn't find a match */
if(old_match < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "fields in datatype corrupted");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "fields in datatype corrupted")
} /* end if */
else
old_match = (int) i;
@@ -3386,7 +3384,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
/* Range check against datatype size */
if ((accum_change < 0) && ((ssize_t) new_dt->shared->size < accum_change))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype")
/* Apply the accumulated size change to the size of the compound struct */
new_dt->shared->size += (size_t) accum_change;
@@ -3404,7 +3402,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
new_dt->shared->u.enumer.value =
(uint8_t *)H5MM_malloc(new_dt->shared->u.enumer.nalloc * new_dt->shared->size);
if(NULL == new_dt->shared->u.enumer.value)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value,
new_dt->shared->u.enumer.nmembs * new_dt->shared->size);
for(i = 0; i < new_dt->shared->u.enumer.nmembs; i++) {
@@ -3418,7 +3416,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
if(method == H5T_COPY_TRANSIENT || method == H5T_COPY_REOPEN) {
/* H5T_copy converts any type into a memory type */
if(H5T_set_loc(new_dt, NULL, H5T_LOC_MEMORY) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
} /* end if */
break;
@@ -3672,7 +3670,7 @@ done:
* Purpose: Frees a datatype and all associated memory.
*
* Note: Does _not_ deal with open named datatypes, etc. so this
- * should never see a type managed by a VOL driver.
+ * should never see a type managed by a VOL connector.
*
* Return: Non-negative on success/Negative on failure
*
@@ -3694,7 +3692,7 @@ H5T_close_real(H5T_t *dt)
/* Clean up resources, depending on shared state */
if(dt->shared->state != H5T_STATE_OPEN) {
if(H5T__free(dt) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype")
dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
} /* end if */
@@ -3788,7 +3786,7 @@ H5T_close(H5T_t *dt)
/* Clean up resources */
if(H5T_close_real(dt) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to free datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to free datatype")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3837,7 +3835,7 @@ H5T__set_size(H5T_t *dt, size_t size)
if(dt->shared->parent) {
if(H5T__set_size(dt->shared->parent, size) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for parent data type");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for parent data type")
/* Adjust size of datatype appropriately */
if(dt->shared->type==H5T_ARRAY)
@@ -3879,7 +3877,7 @@ H5T__set_size(H5T_t *dt, size_t size)
size_t max_size;
if((num_membs = H5T_get_nmembers(dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get number of members");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get number of members")
if(num_membs) {
for(i = 0; i < (unsigned)num_membs; i++) {
@@ -3893,7 +3891,7 @@ H5T__set_size(H5T_t *dt, size_t size)
max_size = H5T__get_member_size(dt, max_index);
if(size < (max_offset + max_size))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size shrinking will cut off last member ");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size shrinking will cut off last member ")
} /* end if */
/* Compound must not have been packed previously */
@@ -3913,7 +3911,7 @@ H5T__set_size(H5T_t *dt, size_t size)
/* Get a copy of unsigned char type as the base/parent type */
if(NULL == (base = (H5T_t *)H5I_object(H5T_NATIVE_UCHAR)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid base datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid base datatype")
dt->shared->parent=H5T_copy(base,H5T_COPY_ALL);
/* change this datatype into a VL string */
@@ -3939,7 +3937,7 @@ H5T__set_size(H5T_t *dt, size_t size)
/* Set up VL information */
if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
} /* end if */
else {
prec = 8 * size;
@@ -3955,7 +3953,7 @@ H5T__set_size(H5T_t *dt, size_t size)
if(dt->shared->u.atomic.u.f.sign >= prec+offset ||
dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec+offset ||
dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec+offset) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first")
}
break;
@@ -4095,7 +4093,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
/* Build an index for each type so the names are sorted */
if(NULL == (idx1 = (unsigned *)H5MM_malloc(dt1->shared->u.compnd.nmembs * sizeof(unsigned))) ||
NULL == (idx2 = (unsigned *)H5MM_malloc(dt2->shared->u.compnd.nmembs * sizeof(unsigned))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed")
for(u = 0; u < dt1->shared->u.compnd.nmembs; u++)
idx1[u] = idx2[u] = u;
if(dt1->shared->u.enumer.nmembs > 1) {
@@ -4181,7 +4179,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
/* Build an index for each type so the names are sorted */
if(NULL == (idx1 = (unsigned *)H5MM_malloc(dt1->shared->u.enumer.nmembs * sizeof(unsigned))) ||
NULL == (idx2 = (unsigned *)H5MM_malloc(dt2->shared->u.enumer.nmembs * sizeof(unsigned))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed")
for(u=0; u<dt1->shared->u.enumer.nmembs; u++)
idx1[u] = u;
if(dt1->shared->u.enumer.nmembs > 1) {
@@ -5070,7 +5068,7 @@ done:
*-------------------------------------------------------------------------
*/
H5G_name_t *
-H5T_nameof(H5T_t *dt)
+H5T_nameof(const H5T_t *dt)
{
H5G_name_t *ret_value = NULL;
@@ -5190,21 +5188,21 @@ H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path")
/* If the datatype is committed through the VOL, close it */
- if (NULL != dt->vol_obj) {
+ if(NULL != dt->vol_obj) {
H5VL_object_t *vol_obj = dt->vol_obj;
/* Close the datatype through the VOL*/
- if ((ret_value = H5VL_datatype_close(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype");
+ if(H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype")
/* Free the datatype and set the VOL object pointer to NULL */
- if (H5VL_free_object(vol_obj) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object");
+ if(H5VL_free_object(vol_obj) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object")
dt->vol_obj = NULL;
- }
+ } /* end if */
dt->shared->state = H5T_STATE_TRANSIENT;
- }
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5349,7 +5347,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* Mark the VL, compound or array type */
if((changed=H5T_set_loc(dt->shared->parent,f,loc))<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed>0)
ret_value=changed;
@@ -5373,7 +5371,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* Range check against compound member's offset */
if ((accum_change < 0) && ((ssize_t) dt->shared->u.compnd.memb[i].offset < accum_change))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype")
/* Apply the accumulated size change to the offset of the field */
dt->shared->u.compnd.memb[i].offset += (size_t) accum_change;
@@ -5389,7 +5387,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* Mark the VL, compound, enum or array type */
if((changed = H5T_set_loc(memb_type,f,loc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed > 0)
ret_value = changed;
@@ -5398,7 +5396,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* Fail if the old_size is zero */
if (0 == old_size)
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "old_size of zero would cause division by zero");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "old_size of zero would cause division by zero")
/* Adjust the size of the member */
dt->shared->u.compnd.memb[i].size = (dt->shared->u.compnd.memb[i].size*memb_type->shared->size)/old_size;
@@ -5411,7 +5409,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* Range check against datatype size */
if ((accum_change < 0) && ((ssize_t) dt->shared->size < accum_change))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype")
/* Apply the accumulated size change to the datatype */
dt->shared->size += (size_t) accum_change;
@@ -5423,14 +5421,14 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* (If the force_conv flag is _not_ set, the type cannot change in size, so don't recurse) */
if(dt->shared->parent->shared->force_conv && H5T_IS_COMPLEX(dt->shared->parent->shared->type)) {
if((changed = H5T_set_loc(dt->shared->parent,f,loc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed > 0)
ret_value = changed;
} /* end if */
/* Mark this VL sequence */
if((changed = H5T__vlen_set_loc(dt, f, loc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed > 0)
ret_value = changed;
break;
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 09a0f3f..712b264 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -150,19 +150,17 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Commit the type */
- if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->driver->cls,
- name, type_id, lcpl_id, tcpl_id, tapl_id,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (data = H5VL_datatype_commit(vol_obj, &loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
/* 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")
- new_obj->driver = vol_obj->driver;
- new_obj->driver->nrefs ++;
+ 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;
- /* Set the committed type object to the VOL driver pointer in the H5T_t struct */
+ /* Set the committed type object to the VOL connector pointer in the H5T_t struct */
dt->vol_obj = new_obj;
done:
@@ -269,7 +267,7 @@ done:
herr_t
H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
{
- void *dt = NULL; /* datatype object created by VOL plugin */
+ void *dt = NULL; /* datatype object created by VOL connector */
H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */
H5T_t *type = NULL; /* Datatype created */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
@@ -305,19 +303,17 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Commit the datatype */
- if(NULL == (dt = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->driver->cls,
- NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (dt = H5VL_datatype_commit(vol_obj, &loc_params, NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
/* 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")
- new_obj->driver = vol_obj->driver;
- new_obj->driver->nrefs ++;
+ 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;
- /* Set the committed type object to the VOL pluging pointer in the H5T_t struct */
+ /* Set the committed type object to the VOL connector pointer in the H5T_t struct */
type->vol_obj = new_obj;
done:
@@ -568,7 +564,7 @@ done:
hid_t
H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id)
{
- void *dt = NULL; /* datatype token created by VOL driver */
+ void *dt = NULL; /* datatype token created by VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -595,18 +591,17 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
/* Open the datatype */
- if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->driver->cls,
- name, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (dt = H5VL_datatype_open(vol_obj, &loc_params, name, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype")
/* Register the type and return the ID */
- if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype")
+ if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype")
done:
/* Cleanup on error */
if(H5I_INVALID_HID == ret_value)
- if(dt && H5VL_datatype_close(dt, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(dt && H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype")
FUNC_LEAVE_API(ret_value)
@@ -658,16 +653,15 @@ H5Tget_create_plist(hid_t dtype_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get default creation property list")
if((ret_value = H5P_copy_plist(tcpl_plist, TRUE)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list")
- }
+ } /* end if */
/* If the datatype is committed, retrieve further information */
else {
H5VL_object_t *vol_obj = type->vol_obj;
/* Get the property list through the VOL */
- if(H5VL_datatype_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATATYPE_GET_TCPL,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_TCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info")
- }
+ } /* end else */
done:
FUNC_LEAVE_API(ret_value)
@@ -707,8 +701,7 @@ H5Tflush(hid_t type_id)
/* Flush metadata for named datatype */
if(dt->vol_obj)
- if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->driver->cls, H5VL_DATATYPE_FLUSH,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id)) < 0)
+ if(H5VL_datatype_specific(dt->vol_obj, H5VL_DATATYPE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype")
done:
@@ -749,8 +742,7 @@ H5Trefresh(hid_t type_id)
/* Refresh the datatype's metadata */
if(dt->vol_obj)
- if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->driver->cls, H5VL_DATATYPE_REFRESH,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id)) < 0)
+ if(H5VL_datatype_specific(dt->vol_obj, H5VL_DATATYPE_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype")
done:
@@ -1088,7 +1080,7 @@ H5T_update_shared(H5T_t *dt)
/*-------------------------------------------------------------------------
* Function: H5T_construct_datatype
*
- * Purpose: Create a Library datatype with a plugin specific datatype object
+ * Purpose: Create a Library datatype with a connector specific datatype object
*
* Return: Success: A type structure
* Failure: NULL
@@ -1100,14 +1092,13 @@ H5T_construct_datatype(H5VL_object_t *vol_obj)
{
ssize_t nalloc;
void *buf = NULL;
- H5T_t *dt = NULL; /* datatype token from VOL plugin */
+ H5T_t *dt = NULL; /* datatype token from VOL connector */
H5T_t *ret_value = NULL;
FUNC_ENTER_NOAPI(NULL)
/* get required buf size for encoding the datatype */
- if(H5VL_datatype_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATATYPE_GET_BINARY,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, NULL, 0) < 0)
+ if(H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, NULL, 0) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get datatype serialized size")
/* allocate buffer to store binary description of the datatype */
@@ -1115,8 +1106,7 @@ H5T_construct_datatype(H5VL_object_t *vol_obj)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype")
/* get binary description of the datatype */
- if(H5VL_datatype_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATATYPE_GET_BINARY,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, buf, (size_t)nalloc) < 0)
+ if(H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, buf, (size_t)nalloc) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get serialized datatype")
if(NULL == (dt = H5T_decode((size_t)nalloc, (const unsigned char *)buf)))
@@ -1161,7 +1151,7 @@ H5T_get_named_type(const H5T_t *dt)
/*-------------------------------------------------------------------------
* Function: H5T_get_actual_type
*
- * Purpose: Returns underlying native datatype created by native driver
+ * Purpose: Returns underlying native datatype created by native connector
* if datatype is committed, otherwise return the datatype
* object associate with the ID.
*
@@ -1181,7 +1171,7 @@ H5T_get_actual_type(H5T_t *dt)
if(NULL == dt->vol_obj)
ret_value = dt;
else
- ret_value = (H5T_t *)dt->vol_obj->data;
+ ret_value = (H5T_t *)H5VL_object_data(dt->vol_obj);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_get_actual_type() */
@@ -1268,3 +1258,24 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_restore_refresh_state() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_already_vol_managed
+ *
+ * Purpose: Check if the committed datatype is already VOL managed
+ *
+ * Return: TRUE / FALSE
+ *
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5T_already_vol_managed(const H5T_t *dt)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity check */
+ HDassert(dt);
+
+ FUNC_LEAVE_NOAPI( dt->vol_obj != NULL )
+} /* end H5T_already_vol_managed() */
+
diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c
index 0e45587..6ee0cd7 100644
--- a/src/H5Tdeprec.c
+++ b/src/H5Tdeprec.c
@@ -43,7 +43,7 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Ppublic.h" /* Property Lists */
#include "H5Tpkg.h" /* Datatypes */
-#include "H5VLprivate.h" /* VOL plugins */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -137,20 +137,17 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Commit the datatype */
- if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->driver->cls,
- name, type_id, H5P_LINK_CREATE_DEFAULT,
- H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (data = H5VL_datatype_commit(vol_obj, &loc_params, name, type_id, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
/* 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")
- new_obj->driver = vol_obj->driver;
- new_obj->driver->nrefs ++;
+ new_obj->connector = vol_obj->connector;
+ new_obj->connector->nrefs ++;
new_obj->data = data;
- /* Set the committed type object to the VOL pluging pointer in the H5T_t struct */
+ /* Set the committed type object to the VOL connector pointer in the H5T_t struct */
dt->vol_obj = new_obj;
done:
@@ -177,7 +174,7 @@ done:
hid_t
H5Topen1(hid_t loc_id, const char *name)
{
- void *dt = NULL; /* Datatype token created by VOL plugin */
+ void *dt = NULL; /* Datatype token created by VOL connector */
H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -197,19 +194,17 @@ H5Topen1(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the datatype */
- if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->driver->cls,
- name, H5P_DATATYPE_ACCESS_DEFAULT,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (dt = H5VL_datatype_open(vol_obj, &loc_params, name, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype")
/* Register the type and return the ID */
- if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype")
+ if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype")
done:
/* Cleanup on error */
if(H5I_INVALID_HID == ret_value)
- if(dt && H5VL_datatype_close(dt, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(dt && H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to close datatype")
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index c0a6d8d..6b6446f 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -119,7 +119,7 @@ H5_DLL herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc);
H5_DLL H5T_t *H5T_decode(size_t buf_size, const unsigned char *buf);
H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE * stream);
H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt);
-H5_DLL H5G_name_t *H5T_nameof(H5T_t *dt);
+H5_DLL H5G_name_t *H5T_nameof(const H5T_t *dt);
H5_DLL htri_t H5T_is_immutable(const H5T_t *dt);
H5_DLL htri_t H5T_is_named(const H5T_t *dt);
H5_DLL herr_t H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f);
@@ -144,6 +144,7 @@ H5_DLL H5VL_object_t *H5T_get_named_type(const H5T_t *dt);
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);
/* Reference specific functions */
H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt);
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 467847f..841637d 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -531,7 +531,7 @@ H5T_vlen_str_mem_getlen(const void *_vl)
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
const char *s=*(const char * const *)_vl; /* Pointer to the user's string information */
#else
- const char *s; /* Pointer to the user's string information */
+ const char *s = NULL; /* Pointer to the user's string information */
#endif
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -566,7 +566,7 @@ H5T_vlen_str_mem_getptr(void *_vl)
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
char *s=*(char **)_vl; /* Pointer to the user's string information */
#else
- char *s; /* Pointer to the user's string information */
+ char *s = NULL; /* Pointer to the user's string information */
#endif
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -601,7 +601,7 @@ H5T_vlen_str_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl)
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
char *s=*(char **)_vl; /* Pointer to the user's string information */
#else
- char *s; /* Pointer to the user's string information */
+ char *s = NULL; /* Pointer to the user's string information */
#endif
FUNC_ENTER_NOAPI_NOINIT_NOERR
diff --git a/src/H5VL.c b/src/H5VL.c
index 85b991f..eedf68d 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -41,41 +41,54 @@
/* Local Macros */
/****************/
+
/******************/
/* Local Typedefs */
/******************/
-/* Information needed for iterating over the registered VOL driver hid_t IDs.
- * The name of the new VOL driver that is being registered is stored in the
- * name field and the found_id field is initialized to H5I_INVALID_HID (-1).
- * If we find a VOL driver with the same name, we set the found_id field to
- * the existing ID for return to the function.
+/* Information needed for iterating over the registered VOL connector hid_t IDs.
+ * The name or value of the new VOL connector that is being registered is
+ * stored in the name (or value) field and the found_id field is initialized to
+ * H5I_INVALID_HID (-1). If we find a VOL connector with the same name / value,
+ * we set the found_id field to the existing ID for return to the function.
*/
typedef struct {
- const char *name; /* The name of the VOL driver to check */
- hid_t found_id; /* The library ID if we found a match */
-} H5VL_get_driver_ud_t;
+ /* IN */
+ H5VL_get_connector_kind_t kind; /* Which kind of connector search to make */
+ union {
+ const char *name; /* The name of the VOL connector to check */
+ H5VL_class_value_t value; /* The value of the VOL connector to check */
+ } u;
+
+ /* OUT */
+ hid_t found_id; /* The connector ID, if we found a match */
+} H5VL_get_connector_ud_t;
+
/********************/
/* Local Prototypes */
/********************/
-static int H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data);
+static int H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data);
+
/*********************/
/* Package Variables */
/*********************/
+
/*****************************/
/* Library Private Variables */
/*****************************/
+
/*******************/
/* Local Variables */
/*******************/
+
/*-------------------------------------------------------------------------
- * Function: H5VL__get_driver_cb
+ * Function: H5VL__get_connector_cb
*
* Purpose: Callback routine to search through registered VOLs
*
@@ -87,127 +100,40 @@ static int H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data);
*-------------------------------------------------------------------------
*/
static int
-H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data)
+H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data)
{
- H5VL_get_driver_ud_t *op_data = (H5VL_get_driver_ud_t *)_op_data; /* User data for callback */
+ H5VL_get_connector_ud_t *op_data = (H5VL_get_connector_ud_t *)_op_data; /* User data for callback */
H5VL_class_t *cls = (H5VL_class_t *)obj;
int ret_value = H5_ITER_CONT; /* Callback return value */
FUNC_ENTER_STATIC_NOERR
- if (0 == HDstrcmp(cls->name, op_data->name)) {
- op_data->found_id = id;
- ret_value = H5_ITER_STOP;
- }
+ if(H5VL_GET_CONNECTOR_BY_NAME == op_data->kind) {
+ if(0 == HDstrcmp(cls->name, op_data->u.name)) {
+ op_data->found_id = id;
+ ret_value = H5_ITER_STOP;
+ } /* end if */
+ } /* end if */
+ else {
+ HDassert(H5VL_GET_CONNECTOR_BY_VALUE == op_data->kind);
+ if(cls->value == op_data->u.value) {
+ op_data->found_id = id;
+ ret_value = H5_ITER_STOP;
+ } /* end if */
+ } /* end else */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__get_driver_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLinitialize
- *
- * Purpose: Calls the driver-specific callback to initialize the driver.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLinitialize(hid_t driver_id, hid_t vipl_id)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "ii", driver_id, vipl_id);
-
- /* Check args */
- if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if (cls->initialize && cls->initialize(vipl_id) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL driver did not initialize")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLinitialize() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLterminate
- *
- * Purpose: Calls the driver-specific callback to terminate the driver.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLterminate(hid_t driver_id, hid_t vtpl_id)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "ii", driver_id, vtpl_id);
-
- /* Check args */
- if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if (cls->terminate && cls->terminate(vtpl_id) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL driver did not terminate cleanly")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLterminate() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLclose
- *
- * Purpose: Closes the specified VOL driver. The VOL ID will no longer
- * be valid for accessing the VOL.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLclose(hid_t vol_id)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE1("e", "i", vol_id);
-
- /* Check args */
- if(NULL == H5I_object_verify(vol_id, H5I_VOL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if(H5I_dec_app_ref(vol_id) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close VOL driver ID")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLclose() */
+} /* end H5VL__get_connector_cb() */
/*-------------------------------------------------------------------------
- * Function: H5VLregister_driver
+ * Function: H5VLregister_connector
*
- * Purpose: Registers a new VOL driver as a member of the virtual object
+ * Purpose: Registers a new VOL connector as a member of the virtual object
* layer class.
*
- * Return: Success: A VOL driver ID which is good until the
- * library is closed or the driver is
+ * Return: Success: A VOL connector ID which is good until the
+ * library is closed or the connector is
* unregistered.
*
* Failure: H5I_INVALID_HID
@@ -215,53 +141,59 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5VLregister_driver(const H5VL_class_t *cls)
+H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id)
{
- H5VL_get_driver_ud_t op_data;
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_API(H5I_INVALID_HID)
- H5TRACE1("i", "*x", cls);
+ H5TRACE2("i", "*xi", cls, vipl_id);
/* Check arguments */
if (!cls)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "VOL driver class pointer cannot be NULL")
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "VOL connector class pointer cannot be NULL")
if (!cls->name)
- HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL driver class name cannot be the NULL pointer");
- /* XXX: Should probably come up with a max length so we can use strnlen()? */
+ 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 driver class name cannot be the empty string");
-
+ 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)
+ 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)
+ 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;
+ op_data.u.name = cls->name;
op_data.found_id = H5I_INVALID_HID;
- op_data.name = cls->name;
- /* check if driver is already registered */
- if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0)
+ /* check if connector is already registered */
+ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL IDs")
- /* XXX: Does this need to be an error? Users probably don't care as long
- * as their VOL driver is available.
- */
- if (op_data.found_id != H5I_INVALID_HID)
- HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL driver with the same name is already registered.")
-
- /* Create the new class ID */
- if ((ret_value = H5VL_register_driver(cls, sizeof(H5VL_class_t), TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver")
+ /* Increment the ref count on the existing VOL connector ID, if it's already registered */
+ if(op_data.found_id != H5I_INVALID_HID) {
+ if (H5I_inc_ref(op_data.found_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+ ret_value = op_data.found_id;
+ } /* end if */
+ else {
+ /* Create a new class ID */
+ if ((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector")
+ } /* end else */
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5VLregister_driver() */
+} /* end H5VLregister_connector() */
/*-------------------------------------------------------------------------
- * Function: H5VLregister_driver_by_name
+ * Function: H5VLregister_connector_by_name
*
- * Purpose: Registers a new VOL driver as a member of the virtual object
+ * Purpose: Registers a new VOL connector as a member of the virtual object
* layer class.
*
- * Return: Success: A VOL driver ID which is good until the
- * library is closed or the driver is
+ * Return: Success: A VOL connector ID which is good until the
+ * library is closed or the connector is
* unregistered.
*
* Failure: H5I_INVALID_HID
@@ -269,90 +201,117 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5VLregister_driver_by_name(const char *name)
+H5VLregister_connector_by_name(const char *name, hid_t vipl_id)
{
- H5VL_get_driver_ud_t op_data;
- hid_t ret_value = H5I_INVALID_HID;
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_API(H5I_INVALID_HID)
- H5TRACE1("i", "*s", name);
+ H5TRACE2("i", "*si", name, vipl_id);
/* Check arguments */
if (!name)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL driver name is disallowed")
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL connector name is disallowed")
if (0 == HDstrlen(name))
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL driver name is disallowed")
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL connector name is disallowed")
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = name;
op_data.found_id = H5I_INVALID_HID;
- op_data.name = name;
- /* Check if driver is already registered */
- if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0)
+ /* Check if connector is already registered */
+ if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids")
- if (op_data.found_id != H5I_INVALID_HID) {
- /* If driver alread registered, increment ref count on ID and return ID */
- if (H5I_inc_ref(op_data.found_id, TRUE) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver")
+ /* If connector alread registered, increment ref count on ID and return ID */
+ if(op_data.found_id != H5I_INVALID_HID) {
+ if(H5I_inc_ref(op_data.found_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
ret_value = op_data.found_id;
- }
+ } /* end if */
else {
H5PL_key_t key;
const H5VL_class_t *cls;
- /* Try loading the driver */
- key.name = name;
- 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 driver")
+ /* Try loading the connector */
+ key.vol.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ key.vol.u.name = name;
+ 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")
- /* Register the driver we loaded */
- if ((ret_value = H5VL_register_driver(cls, sizeof(H5VL_class_t), TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver ID")
- }
+ /* Register the connector we loaded */
+ if((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
+ } /* end else */
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5VLregister_driver_by_name() */
+} /* end H5VLregister_connector_by_name() */
/*-------------------------------------------------------------------------
- * Function: H5VLunregister_driver
+ * Function: H5VLregister_connector_by_value
*
- * Purpose: Removes a VOL driver ID from the library. This in no way affects
- * file access property lists which have been defined to use
- * this VOL driver or files which are already opened under with
- * this driver.
+ * Purpose: Registers a new VOL connector as a member of the virtual object
+ * layer class.
*
- * Return: Success: Non-negative
+ * Return: Success: A VOL connector ID which is good until the
+ * library is closed or the connector is
+ * unregistered.
*
- * Failure: Negative
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5VLunregister_driver(hid_t vol_id)
+hid_t
+H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id)
{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_API(FAIL)
- H5TRACE1("e", "i", vol_id);
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE2("i", "VCi", value, vipl_id);
/* Check arguments */
- if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(vol_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a vol driver")
+ if(value < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "negative VOL connector value is disallowed")
- /* The H5VL_class_t struct will be freed by this function */
- if (H5I_dec_app_ref(vol_id) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister vol driver")
+ op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE;
+ op_data.u.value = value;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Check if connector is already registered */
+ if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids")
+
+ /* If connector alread registered, increment ref count on ID and return ID */
+ if(op_data.found_id != H5I_INVALID_HID) {
+ if(H5I_inc_ref(op_data.found_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+ ret_value = op_data.found_id;
+ } /* end if */
+ else {
+ H5PL_key_t key;
+ const H5VL_class_t *cls;
+
+ /* Try loading the connector */
+ key.vol.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ 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")
+
+ /* Register the connector we loaded */
+ if((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
+ } /* end else */
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5VLunregister_driver() */
+} /* end H5VLregister_connector_by_value() */
/*-------------------------------------------------------------------------
- * Function: H5VLis_driver_registered
+ * Function: H5VLis_connector_registered
*
* Purpose: Tests whether a VOL class has been registered or not
*
@@ -365,19 +324,20 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5VLis_driver_registered(const char *name)
+H5VLis_connector_registered(const char *name)
{
- H5VL_get_driver_ud_t op_data;
- htri_t ret_value = FALSE; /* Return value */
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("t", "*s", name);
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = name;
op_data.found_id = H5I_INVALID_HID;
- op_data.name = name;
/* Check arguments */
- if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0)
+ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL ids")
if (op_data.found_id != H5I_INVALID_HID)
@@ -385,13 +345,13 @@ H5VLis_driver_registered(const char *name)
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5VLis_driver_registered() */
+} /* end H5VLis_connector_registered() */
/*-------------------------------------------------------------------------
- * Function: H5VLget_driver_id
+ * Function: H5VLget_connector_id
*
- * Purpose: Retrieves the ID for a registered VOL driver.
+ * Purpose: Retrieves the ID for a registered VOL connector.
*
* Return: Positive if the VOL class has been registered
* Negative on error (if the class is not a valid class or not registered)
@@ -399,1847 +359,102 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5VLget_driver_id(const char *name)
+H5VLget_connector_id(const char *name)
{
- H5VL_get_driver_ud_t op_data;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "*s", name);
- op_data.found_id = H5I_INVALID_HID;
- op_data.name = name;
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = name;
+ op_data.found_id = H5I_INVALID_HID;
/* Check arguments */
- if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL driver IDs")
+ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL connector IDs")
if (op_data.found_id != H5I_INVALID_HID) {
if (H5I_inc_ref(op_data.found_id, TRUE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver")
-
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
ret_value = op_data.found_id;
- }
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5VLget_driver_id() */
+} /* end H5VLget_connector_id() */
/*-------------------------------------------------------------------------
- * Function: H5VLget_driver_name
+ * Function: H5VLget_connector_name
*
- * Purpose: Returns the driver name for the VOL associated with the
+ * Purpose: Returns the connector name for the VOL associated with the
* object or file ID
*
- * Return: Success: The length of the driver name
+ * Return: Success: The length of the connector name
*
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
ssize_t
-H5VLget_driver_name(hid_t obj_id, char *name/*out*/, size_t size)
+H5VLget_connector_name(hid_t obj_id, char *name/*out*/, size_t size)
{
ssize_t ret_value = -1;
FUNC_ENTER_API(FAIL)
H5TRACE3("Zs", "ixz", obj_id, name, size);
- if ((ret_value = H5VL_get_driver_name(obj_id, name, size)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get driver name")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLget_driver_name() */
-
-
-/*---------------------------------------------------------------------------
- * Function: H5VLregister
- *
- * Purpose: Public routine to register an object and get an ID given a
- * VOL driver ID.
- *
- * Unlike H5Iregister(), this API call can register library
- * types (e.g.; H5I_DATASET).
- *
- * NOTE: This API call is mainly intended for VOL driver authors.
- *
- * Return: Success: A valid HDF5 ID
- *
- * Failure: H5I_INVALID_HID
- *
- *---------------------------------------------------------------------------
- */
-hid_t
-H5VLregister(H5I_type_t type, const void *obj, hid_t driver_id)
-{
- hid_t ret_value = H5I_INVALID_HID;
-
- FUNC_ENTER_API(H5I_INVALID_HID)
- H5TRACE3("i", "It*xi", type, obj, driver_id);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "obj pointer can't be NULL")
-
- if ((ret_value = H5VL_register_using_vol_id(type, obj, driver_id, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* H5VLregister */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLobject
- *
- * Purpose: Public utility function to return the VOL object pointer
- * associated with an hid_t.
- *
- * Return: Success: object pointer
- * Failure: NULL
- *
- * Programmer: Jordan Henderson
- * January, 2018
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VLobject(hid_t id)
-{
- void *ret_value = NULL;
-
- FUNC_ENTER_API(NULL)
- H5TRACE1("*x", "i", id);
-
- if (NULL == (ret_value = H5VL_object(id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLobject() */
-
-
-/*---------------------------------------------------------------------------
- * Function: H5VLget_object
- *
- * Purpose: Retrieves the object pointer associated with the ID. This
- * also optionally returns the H5VL_t struct that this ID
- * belongs to, if the user passes a valid pointer value.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *---------------------------------------------------------------------------
- */
-herr_t
-H5VLget_object(hid_t obj_id, void **obj)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i**x", obj_id, obj);
-
- /* Check args */
- if (!obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object pointer")
-
- if (NULL == (*obj = H5VL_vol_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain a valid object")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* H5VLget_object */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLattr_create
- *
- * Purpose: Creates an attribute
- *
- * Return: Success: Pointer to the new attribute
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name,
- hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- void *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_API(NULL)
- H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, driver_id, name, acpl_id,
- aapl_id, dxpl_id, req);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID")
-
- if(NULL == (ret_value = H5VL_attr_create(obj, loc_params, cls, name,
- acpl_id, aapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create attribute")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLattr_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLattr_open
- *
- * Purpose: Opens an attribute
- *
- * Return: Success: Pointer to the new attribute
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name,
- hid_t aapl_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- void *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_API(NULL)
- H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, aapl_id,
- dxpl_id, req);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID")
-
- if(NULL == (ret_value = H5VL_attr_open(obj, loc_params, cls, name, aapl_id,
- dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open attribute")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLattr_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLattr_read
- *
- * Purpose: Reads data from an attribute
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t H5VLattr_read(void *attr, hid_t driver_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
-
- if (NULL == attr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if((ret_value = H5VL_attr_read(attr, cls, mem_type_id, buf, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read attribute")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLattr_read() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLattr_write
- *
- * Purpose: Writes data to an attribute
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t H5VLattr_write(void *attr, hid_t driver_id, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
-
- if (NULL == attr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if((ret_value = H5VL_attr_write(attr, cls, mem_type_id, buf, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write attribute")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLattr_write() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLattr_get
- *
- * Purpose: Gets information about the attribute
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLattr_get(void *obj, hid_t driver_id, H5VL_attr_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "*xiVai**xx", obj, driver_id, get_type, dxpl_id, req, arguments);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- /* Bypass the H5VLint layer */
- if(NULL == cls->attr_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `attr get' method")
- if((ret_value = (cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to get attribute information")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLattr_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLattr_specific
- *
- * Purpose: Performs a driver-specific operation on an attribute
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "*xxiVbi**xx", obj, loc_params, driver_id, specific_type,
- dxpl_id, req, arguments);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- /* Bypass the H5VLint layer */
- if(NULL == cls->attr_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `attr specific' method")
- if((ret_value = (cls->attr_cls.specific)
- (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLattr_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLattr_optional
- *
- * Purpose: Performs an optional driver-specific operation on an attribute
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLattr_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- /* Have to bypass the H5VLint layer due to unknown val_list arguments */
- if(NULL == cls->attr_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `attr optional' method")
- if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLattr_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLattr_close
- *
- * Purpose: Closes an attribute
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLattr_close(void *attr, hid_t driver_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "*xii**x", attr, driver_id, dxpl_id, req);
-
- if (NULL == attr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if((ret_value = H5VL_attr_close(attr, cls, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close attribute")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLattr_close() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLdataset_create
- *
- * Purpose: Creates a dataset
- *
- * Return: Success: Pointer to the new dataset
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name,
- hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- void *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_API(NULL)
- H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, driver_id, name, dcpl_id,
- dapl_id, dxpl_id, req);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID")
-
- if(NULL == (ret_value = H5VL_dataset_create(obj, loc_params, cls, name,
- dcpl_id, dapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create dataset")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLdataset_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLdataset_open
- *
- * Purpose: Opens a dataset
- *
- * Return: Success: Pointer to the new dataset
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name,
- hid_t dapl_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- void *ret_value = NULL;
-
- FUNC_ENTER_API(NULL)
- H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, dapl_id,
- dxpl_id, req);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID")
-
- if(NULL == (ret_value = H5VL_dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open dataset")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLdataset_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLdataset_read
- *
- * Purpose: Reads data from a dataset
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLdataset_read(void *dset, hid_t driver_id, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t plist_id, void *buf, void **req)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE8("e", "*xiiiii*x**x", dset, driver_id, mem_type_id, mem_space_id,
- file_space_id, plist_id, buf, req);
-
- if (NULL == dset)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if((ret_value = H5VL_dataset_read(dset, cls, mem_type_id, mem_space_id, file_space_id,
- plist_id, buf, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLdataset_read() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLdataset_write
- *
- * Purpose: Writes data to a dataset
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLdataset_write(void *dset, hid_t driver_id, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t plist_id, const void *buf, void **req)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE8("e", "*xiiiii*x**x", dset, driver_id, mem_type_id, mem_space_id,
- file_space_id, plist_id, buf, req);
-
- if (NULL == dset)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if((ret_value = H5VL_dataset_write(dset, cls, mem_type_id, mem_space_id, file_space_id,
- plist_id, buf, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLdataset_write() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLdataset_get
- *
- * Purpose: Gets information about a dataset
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLdataset_get(void *dset, hid_t driver_id, H5VL_dataset_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "*xiVci**xx", dset, driver_id, get_type, dxpl_id, req, arguments);
-
- if (NULL == dset)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- /* Bypass the H5VLint layer */
- if(NULL == cls->dataset_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `dataset get' method")
- if((ret_value = (cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute dataset get callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLdataset_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLdataset_specific
- *
- * Purpose: Performs a driver-specific operation on a dataset
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLdataset_specific(void *obj, hid_t driver_id, H5VL_dataset_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "*xiVdi**xx", obj, driver_id, specific_type, dxpl_id, req,
- arguments);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if(NULL == cls->dataset_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `dataset specific' method")
- if((ret_value = (cls->dataset_cls.specific)
- (obj, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLdataset_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLdataset_optional
- *
- * Purpose: Performs an optional driver-specific operation on a dataset
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLdataset_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if(NULL == cls->dataset_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `dataset optional' method")
- if((ret_value = (cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLdataset_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLdataset_close
- *
- * Purpose: Closes a dataset
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLdataset_close(void *dset, hid_t driver_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "*xii**x", dset, driver_id, dxpl_id, req);
-
- if (NULL == dset)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if((ret_value = H5VL_dataset_close(dset, cls, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close dataset")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLdataset_close() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLfile_create
- *
- * Purpose: Creates a file
- *
- * Return: Success: Pointer to the new file
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
- hid_t dxpl_id, void **req)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */
- H5VL_class_t *cls = NULL;
- void *ret_value = NULL;
-
- FUNC_ENTER_API(NULL)
- H5TRACE6("*x", "*sIuiii**x", name, flags, fcpl_id, fapl_id, dxpl_id, req);
-
- /* get the VOL info from the fapl */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info")
-
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID")
-
- if(NULL == (ret_value = H5VL_file_create(cls, name, flags, fcpl_id, fapl_id,
- dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLfile_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLfile_open
- *
- * Purpose: Opens a file
- *
- * Return: Success: Pointer to the new file
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */
- H5VL_class_t *cls = NULL;
- void *ret_value = NULL;
-
- FUNC_ENTER_API(NULL)
- H5TRACE5("*x", "*sIuii**x", name, flags, fapl_id, dxpl_id, req);
-
- /* get the VOL info from the fapl */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info")
-
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID")
-
- if(NULL == (ret_value = H5VL_file_open(cls, name, flags, fapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLfile_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLfile_get
- *
- * Purpose: Gets information about the file
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLfile_get(void *file, hid_t driver_id, H5VL_file_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "*xiVgi**xx", file, driver_id, get_type, dxpl_id, req, arguments);
-
- if(NULL == file)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- /* Bypass the H5VLint layer */
- if(NULL == cls->file_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `file get' method")
- if((ret_value = (cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute file get callback")
+ if ((ret_value = H5VL_get_connector_name(obj_id, name, size)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get connector name")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5VLfile_get() */
+} /* end H5VLget_connector_name() */
/*-------------------------------------------------------------------------
- * Function: H5VLfile_specific
- *
- * Purpose: Performs a driver-specific operation on a file
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLfile_specific(void *file, hid_t driver_id, H5VL_file_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "*xiVhi**xx", file, driver_id, specific_type, dxpl_id, req,
- arguments);
-
- if(specific_type == H5VL_FILE_IS_ACCESSIBLE) {
- H5P_genplist_t *plist; /* Property list pointer */
- H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */
- hid_t fapl_id;
-
- fapl_id = va_arg (arguments, hid_t);
-
- /* get the VOL info from the fapl */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
-
- if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol driver info")
-
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if((ret_value = (cls->file_cls.specific)
- (file, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed")
- }
- else {
- if(NULL == file)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if(NULL == cls->file_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `file specific' method")
- if((ret_value = (cls->file_cls.specific)
- (file, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file specific callback")
- }
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLfile_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLfile_optional
- *
- * Purpose: Performs an optional driver-specific operation on a file
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLfile_optional(void *file, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "*xii**xx", file, driver_id, dxpl_id, req, arguments);
-
- if(NULL == file)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if(NULL == cls->file_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `file optional' method")
- if((ret_value = (cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file optional callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLfile_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLfile_close
- *
- * Purpose: Closes a file
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLfile_close(void *file, hid_t driver_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "*xii**x", file, driver_id, dxpl_id, req);
-
- if(NULL == file)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if((ret_value = H5VL_file_close(file, cls, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close file")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLfile_close() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLgroup_create
- *
- * Purpose: Creates a group
- *
- * Return: Success: Pointer to the new group
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name,
- hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- void *ret_value = NULL;
-
- FUNC_ENTER_API(NULL)
- H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, driver_id, name, gcpl_id,
- gapl_id, dxpl_id, req);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID")
-
- if(NULL == (ret_value = H5VL_group_create(obj, loc_params, cls, name,
- gcpl_id, gapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLgroup_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLgroup_open
- *
- * Purpose: Opens a group
- *
- * Return: Success: Pointer to the new group
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name,
- hid_t gapl_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- void *ret_value = NULL;
-
- FUNC_ENTER_API(NULL)
- H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, gapl_id,
- dxpl_id, req);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID")
-
- if(NULL == (ret_value = H5VL_group_open(obj, loc_params, cls, name,
- gapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLgroup_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLgroup_get
- *
- * Purpose: Gets information about the group
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLgroup_get(void *obj, hid_t driver_id, H5VL_group_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "*xiVii**xx", obj, driver_id, get_type, dxpl_id, req, arguments);
-
- if(NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- /* Bypass the H5VLint layer */
- if(NULL == cls->group_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `group get' method")
- if((ret_value = (cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute group get callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLgroup_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLgroup_specific
- *
- * Purpose: Performs a driver-specific operation on a group
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLgroup_specific(void *obj, hid_t driver_id, H5VL_group_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "*xiVji**xx", obj, driver_id, specific_type, dxpl_id, req,
- arguments);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if(NULL == cls->group_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `group specific' method")
- if((ret_value = (cls->group_cls.specific)
- (obj, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLgroup_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLgroup_optional
- *
- * Purpose: Performs an optional driver-specific operation on a group
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLgroup_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if(NULL == cls->group_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `group optional' method")
- if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLgroup_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLgroup_close
- *
- * Purpose: Closes a group
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLgroup_close(void *grp, hid_t driver_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "*xii**x", grp, driver_id, dxpl_id, req);
-
- if(NULL == grp)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if((ret_value = H5VL_group_close(grp, cls, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close group")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLgroup_close() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLlink_create
- *
- * Purpose: Creates a hard link
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params,
- hid_t driver_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, driver_id, lcpl_id,
- lapl_id, dxpl_id, req);
-
- if(NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if((ret_value = H5VL_link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to create link")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLlink_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLlink_copy
- *
- * Purpose: Copies a link to a new location
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj,
- H5VL_loc_params_t loc_params2, hid_t driver_id,
- hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2,
- driver_id, lcpl_id, lapl_id, dxpl_id, req);
-
- if(NULL == src_obj || NULL == dst_obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if((ret_value = H5VL_link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls,
- lcpl_id, lapl_id, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to copy object")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLlink_copy() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLlink_move
- *
- * Purpose: Moves a link to another location
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj,
- H5VL_loc_params_t loc_params2, hid_t driver_id,
- hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2,
- driver_id, lcpl_id, lapl_id, dxpl_id, req);
-
- if(NULL == src_obj || NULL == dst_obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if((ret_value = H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, cls,
- lcpl_id, lapl_id, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLlink_move() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLlink_get
- *
- * Purpose: Gets information about a link
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_link_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "*xxiVli**xx", obj, loc_params, driver_id, get_type, dxpl_id, req,
- arguments);
-
- if(NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if(NULL == cls->link_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `link get' method")
- if((ret_value = (cls->link_cls.get)
- (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link get callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLlink_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLlink_specific
- *
- * Purpose: Performs a driver-specific operation on a link
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "*xxiVmi**xx", obj, loc_params, driver_id, specific_type,
- dxpl_id, req, arguments);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- /* Bypass the H5VLint layer */
- if(NULL == cls->link_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `link specific' method")
- if((ret_value = (cls->link_cls.specific)
- (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLlink_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLlink_optional
- *
- * Purpose: Performs an optional driver-specific operation on a link
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLlink_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- /* Have to bypass the H5VLint layer due to unknown val_list arguments */
- if(NULL == cls->link_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `link optional' method")
- if((ret_value = (cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLlink_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLobject_open
- *
- * Purpose: Opens an object
- *
- * Return: Success: Pointer to the new object
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t driver_id, H5I_type_t *opened_type,
- hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- void *ret_value = NULL;
-
- FUNC_ENTER_API(NULL)
- H5TRACE6("*x", "*xxi*Iti**x", obj, params, driver_id, opened_type, dxpl_id, req);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID")
-
- if(NULL == (ret_value = H5VL_object_open(obj, params, cls, opened_type, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLobject_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLobject_copy
- *
- * Purpose: Copies an object to another location
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t driver_id1, const char *src_name,
- void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id2, const char *dst_name,
- hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls1 = NULL;
- H5VL_class_t *cls2 = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE12("e", "*xxi*s*xxi*siii**x", src_obj, loc_params1, driver_id1,
- src_name, dst_obj, loc_params2, driver_id2, dst_name, ocpypl_id,
- lcpl_id, dxpl_id, req);
-
- if(NULL == src_obj || NULL == dst_obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(driver_id1, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
- if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(driver_id2, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if((ret_value = H5VL_object_copy(src_obj, loc_params1, cls1, src_name,
- dst_obj, loc_params2, cls2, dst_name,
- ocpypl_id, lcpl_id, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLobject_copy() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLobject_get
- *
- * Purpose: Gets information about an object
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_object_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "*xxiVni**xx", obj, loc_params, driver_id, get_type, dxpl_id, req,
- arguments);
-
- if(NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if(NULL == cls->object_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `object get' method")
- if((ret_value = (cls->object_cls.get)
- (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object get callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLobject_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLobject_specific
- *
- * Purpose: Performs a driver-specific operation on an object
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "*xxiVoi**xx", obj, loc_params, driver_id, specific_type,
- dxpl_id, req, arguments);
-
- if(NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- /* Bypass the H5VLint layer */
- if(NULL == cls->object_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `object specific' method")
- if((ret_value = (cls->object_cls.specific)
- (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object specific callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLobject_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLobject_optional
- *
- * Purpose: Performs an optional driver-specific operation on an object
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLobject_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- /* Have to bypass the H5VLint layer due to unknown val_list arguments */
- if(NULL == cls->object_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `object optional' method")
- if((ret_value = (cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLobject_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLdatatype_commit
- *
- * Purpose: Commits a datatype to the file
- *
- * Return: Success: Pointer to the new datatype
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name,
- hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- void *ret_value = NULL;
-
- FUNC_ENTER_API(NULL)
- H5TRACE10("*x", "*xxi*siiiii**x", obj, loc_params, driver_id, name, type_id,
- lcpl_id, tcpl_id, tapl_id, dxpl_id, req);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID")
-
- if(NULL == (ret_value = H5VL_datatype_commit(obj, loc_params, cls, name, type_id,
- lcpl_id, tcpl_id, tapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to commit datatype")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLdatatype_commit() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLdatatype_open
- *
- * Purpose: Opens a named datatype
- *
- * Return: Success: Pointer to the new datatype
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name,
- hid_t tapl_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- void *ret_value = NULL;
-
- FUNC_ENTER_API(NULL)
- H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, tapl_id,
- dxpl_id, req);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID")
-
- if(NULL == (ret_value = H5VL_datatype_open(obj, loc_params, cls, name,
- tapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open datatype")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLdatatype_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLdatatype_specific
- *
- * Purpose: Performs a driver-specific operation on a datatype
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLdatatype_specific(void *obj, hid_t driver_id, H5VL_datatype_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "*xiVfi**xx", obj, driver_id, specific_type, dxpl_id, req,
- arguments);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if(NULL == cls->datatype_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `datatype specific' method")
- if((ret_value = (cls->datatype_cls.specific)
- (obj, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLdatatype_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLdatatype_optional
- *
- * Purpose: Performs an optional driver-specific operation on a datatype
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLdatatype_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments);
-
- if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if(NULL == cls->datatype_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `datatype optional' method")
- if((ret_value = (cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLdatatype_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLdatatype_get
- *
- * Purpose: Gets information about the datatype
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLdatatype_get(void *obj, hid_t driver_id, H5VL_datatype_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "*xiVei**xx", obj, driver_id, get_type, dxpl_id, req, arguments);
-
- if(NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- /* Bypass the H5VLint layer */
- if(NULL == cls->datatype_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `datatype get' method")
- if((ret_value = (cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute datatype get callback")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLdatatype_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLdatatype_close
- *
- * Purpose: Closes a datatype
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VLdatatype_close(void *dt, hid_t driver_id, hid_t dxpl_id, void **req)
-{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "*xii**x", dt, driver_id, dxpl_id, req);
-
- if (NULL == dt)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if((ret_value = H5VL_datatype_close(dt, cls, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close datatype")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5VLdatatype_close() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VLrequest_cancel
+ * Function: H5VLclose
*
- * Purpose: Cancels a request
+ * Purpose: Closes a VOL connector ID. This in no way affects
+ * file access property lists which have been defined to use
+ * this VOL connector or files which are already opened under with
+ * this connector.
*
* Return: Success: Non-negative
- *
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
herr_t
-H5VLrequest_cancel(void **req, hid_t driver_id, H5ES_status_t *status)
+H5VLclose(hid_t vol_id)
{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "**xi*Es", req, driver_id, status);
+ H5TRACE1("e", "i", vol_id);
- if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
+ /* Check args */
+ if(NULL == H5I_object_verify(vol_id, H5I_VOL))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector")
- if ((ret_value = H5VL_request_cancel(req, cls, status)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request")
+ /* Decrement the ref count on the ID, possibly releasing the VOL connector */
+ if(H5I_dec_app_ref(vol_id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close VOL connector ID")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5VLrequest_cancel() */
+} /* end H5VLclose() */
/*-------------------------------------------------------------------------
- * Function: H5VLrequest_test
+ * Function: H5VLunregister_connector
*
- * Purpose: Tests a request
+ * Purpose: Removes a VOL connector ID from the library. This in no way affects
+ * file access property lists which have been defined to use
+ * this VOL connector or files which are already opened under with
+ * this connector.
*
* Return: Success: Non-negative
*
@@ -2248,54 +463,60 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLrequest_test(void **req, hid_t driver_id, H5ES_status_t *status)
+H5VLunregister_connector(hid_t vol_id)
{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "**xi*Es", req, driver_id, status);
+ H5TRACE1("e", "i", vol_id);
- if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
+ /* Check arguments */
+ if(NULL == H5I_object_verify(vol_id, H5I_VOL))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector")
- if ((ret_value = H5VL_request_test(req, cls, status)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to test request")
+ /* The H5VL_class_t struct will be freed by this function */
+ if (H5I_dec_app_ref(vol_id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL connector")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5VLrequest_test() */
+} /* end H5VLunregister_connector() */
-/*-------------------------------------------------------------------------
- * Function: H5VLrequest_wait
+/*---------------------------------------------------------------------------
+ * Function: H5VLcmp_connector_cls
*
- * Purpose: Waits on a request
+ * Purpose: Compares two connector classes
*
- * Return: Success: Non-negative
+ * 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.
*
* Failure: Negative
*
- *-------------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*/
herr_t
-H5VLrequest_wait(void **req, hid_t driver_id, H5ES_status_t *status)
+H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2)
{
- H5VL_class_t *cls = NULL;
- herr_t ret_value = SUCCEED;
+ H5VL_class_t *cls1, *cls2; /* connectors for IDs */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "**xi*Es", req, driver_id, status);
+ H5TRACE3("e", "*Isii", cmp, connector_id1, connector_id2);
- if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- if ((ret_value = H5VL_request_wait(req, cls, status)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request")
+ /* Check args and get class pointers */
+ if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(connector_id1, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+ if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(connector_id2, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+ /* Compare the two VOL connector classes */
+ if(H5VL_cmp_connector_cls(cmp, cls1, cls2) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5VLrequest_wait() */
-
+} /* H5VLcmp_connector_cls() */
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
new file mode 100644
index 0000000..811162d
--- /dev/null
+++ b/src/H5VLcallback.c
@@ -0,0 +1,6489 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 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...
+ */
+
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5VLmodule.h" /* This source code file is part of the H5VL module */
+
+
+/***********/
+/* Headers */
+/***********/
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5VLpkg.h" /* Virtual Object Layer */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+static void *H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, const char *name, hid_t acpl_id, hid_t aapl_id,
+ hid_t dxpl_id, void **req);
+static void *H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
+ void *buf, hid_t dxpl_id, void **req);
+static herr_t H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
+ const void *buf, hid_t dxpl_id, void **req);
+static herr_t H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, H5VL_attr_specific_t specific_type, hid_t dxpl_id,
+ void **req, va_list arguments);
+static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments);
+static herr_t H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req);
+static void *H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, const char *name, hid_t dcpl_id, hid_t dapl_id,
+ hid_t dxpl_id, void **req);
+static void *H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL__dataset_read(void *dset, const H5VL_class_t *cls,
+ 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__dataset_write(void *obj, const H5VL_class_t *cls,
+ 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__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__dataset_specific(void *obj, const H5VL_class_t *cls,
+ H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+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 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,
+ unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments);
+static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req);
+static void *H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, const char *name, hid_t gcpl_id, hid_t gapl_id,
+ hid_t dxpl_id, void **req);
+static void *H5VL__group_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments);
+static herr_t H5VL__group_close(void *obj, const H5VL_class_t *cls,
+ hid_t dxpl_id, void **req);
+static herr_t H5VL__link_create(H5VL_link_create_type_t create_type, void *obj,
+ const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, hid_t lcpl_id,
+ hid_t lapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls,
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL__link_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls,
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, H5VL_link_get_t get_type, hid_t dxpl_id,
+ void **req, va_list arguments);
+static herr_t H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, H5VL_link_specific_t specific_type, hid_t dxpl_id,
+ void **req, va_list arguments);
+static herr_t H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments);
+static void *H5VL__object_open(void *obj, const H5VL_loc_params_t *params, const H5VL_class_t *cls,
+ H5I_type_t *opened_type, hid_t dxpl_id, void **req);
+static herr_t H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params,
+ const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params,
+ const char *dst_name, const H5VL_class_t *cls, hid_t ocpypl_id,
+ hid_t lcpl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, H5VL_object_get_t get_type, hid_t dxpl_id,
+ void **req, va_list arguments);
+static herr_t H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, H5VL_object_specific_t specific_type, hid_t dxpl_id,
+ void **req, va_list arguments);
+static herr_t H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments);
+static void * H5VL__datatype_commit(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, 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__datatype_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, const char *name, hid_t tapl_id, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls,
+ H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__datatype_specific(void *obj, const H5VL_class_t *cls,
+ H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req,
+ va_list arguments);
+static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls,
+ hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL__request_wait(void *req, const H5VL_class_t *cls,
+ uint64_t timeout, H5ES_status_t *status);
+static herr_t H5VL__request_notify(void *req, const H5VL_class_t *cls,
+ H5VL_request_notify_t cb, void *ctx);
+static herr_t H5VL__request_cancel(void *req, const H5VL_class_t *cls);
+static herr_t H5VL__request_specific(void *req, const H5VL_class_t *cls,
+ H5VL_request_specific_t specific_type, va_list arguments);
+static herr_t H5VL__request_optional(void *req, const H5VL_class_t *cls,
+ va_list arguments);
+static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLinitialize
+ *
+ * Purpose: Calls the connector-specific callback to initialize the connector.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLinitialize(hid_t connector_id, hid_t vipl_id)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "ii", connector_id, vipl_id);
+
+ /* Check args */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Invoke class' callback, if there is one */
+ if(cls->initialize && cls->initialize(vipl_id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not initialize")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLinitialize() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLterminate
+ *
+ * Purpose: Calls the connector-specific callback to terminate the connector.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLterminate(hid_t connector_id)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE1("e", "i", connector_id);
+
+ /* Check args */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Invoke class' callback, if there is one */
+ if(cls->terminate && cls->terminate() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLterminate() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLget_cap_flags
+ *
+ * Purpose: Retrieves the capability flag for a connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "i*Iu", connector_id, cap_flags);
+
+ /* Check args */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Retrieve capability flags */
+ if(cap_flags)
+ *cap_flags = cls->cap_flags;
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLget_cap_flags */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLget_value
+ *
+ * Purpose: Retrieves the 'value' for a connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLget_value(hid_t connector_id, H5VL_class_value_t *value)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "i*VC", connector_id, value);
+
+ /* Check args */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Retrieve connector value */
+ if(value)
+ *value = cls->value;
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLget_value */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_copy_connector_info
+ *
+ * Purpose: Copy the VOL info for a connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info,
+ const void *src_info)
+{
+ void *new_connector_info = NULL; /* Copy of connector info */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(connector);
+
+ /* 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)))
+ 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)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "connector info allocation failed")
+ HDmemcpy(new_connector_info, src_info, connector->info_size);
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "no way to copy connector info")
+ } /* end if */
+
+ /* Set the connector info for the copy */
+ *dst_info = new_connector_info;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_copy_connector_info() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLcopy_connector_info
+ *
+ * Purpose: Copies a VOL connector's info object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_info)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE3("e", "i**x*x", connector_id, dst_vol_info, src_vol_info);
+
+ /* Check args and get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Copy the VOL connector's info object */
+ if(H5VL_copy_connector_info(cls, dst_vol_info, src_vol_info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy VOL connector info object")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLcopy_connector_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_cmp_connector_info
+ *
+ * Purpose: Compare VOL info for a connector. Sets *cmp_value to
+ * positive if INFO1 is greater than INFO2, negative if
+ * INFO2 is greater than INFO1 and zero if INFO1 and
+ * INFO2 are equal.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value,
+ const void *info1, const void *info2)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(connector);
+ HDassert(cmp_value);
+
+ /* Take care of cases where one or both pointers is NULL */
+ if(info1 == NULL && info2 != NULL) {
+ *cmp_value = -1;
+ HGOTO_DONE(SUCCEED);
+ } /* end if */
+ if(info1 != NULL && info2 == NULL) {
+ *cmp_value = 1;
+ HGOTO_DONE(SUCCEED);
+ } /* end if */
+ if(info1 == NULL && info2 == NULL) {
+ *cmp_value = 0;
+ HGOTO_DONE(SUCCEED);
+ } /* end if */
+
+ /* Use the class's info comparison routine to compare the info objects,
+ * 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)
+ 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);
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_cmp_connector_info() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLcmp_connector_info
+ *
+ * Purpose: Compares two connector info objects
+ *
+ * Note: Both info objects must be from the same VOL connector class
+ *
+ * Return: Success: Non-negative, with *cmp set to positive if
+ * info1 is greater than info2, negative if info2
+ * is greater than info1 and zero if info1 and info2
+ * are equal.
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1, const void *info2)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "*Isi*x*x", cmp, connector_id, info1, info2);
+
+ /* Check args and get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Compare the two VOL connector info objects */
+ if(cmp)
+ H5VL_cmp_connector_info(cls, cmp, info1, info2);
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5VLcmp_connector_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_free_connector_info
+ *
+ * Purpose: Free VOL info for a connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_free_connector_info(const H5VL_class_t *connector, void *info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(connector);
+
+ /* 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed")
+ } /* end if */
+ else
+ H5MM_xfree(info);
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_free_connector_info() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLfree_connector_info
+ *
+ * Purpose: Free VOL connector info object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLfree_connector_info(hid_t connector_id, void *info)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "i*x", connector_id, info);
+
+ /* Check args and get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Free the VOL connector info object */
+ if(H5VL_free_connector_info(cls, info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLfree_connector_info() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLconnector_info_to_str
+ *
+ * Purpose: Serialize a connector's info into a string
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE3("e", "*xi**s", info, connector_id, str);
+
+ /* Only serialize info object, if it's non-NULL */
+ if(info) {
+ H5VL_class_t *cls; /* VOL connector's class struct */
+
+ /* Check args and get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "can't serialize connector info")
+ } /* end if */
+ else
+ *str = NULL;
+ } /* end if */
+ else
+ *str = NULL;
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLconnector_info_to_str() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLconnector_str_to_info
+ *
+ * Purpose: Deserialize a string into a connector's info
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE3("e", "*si**x", str, connector_id, info);
+
+ /* Only deserialize string, if it's non-NULL */
+ if(str) {
+ H5VL_class_t *cls; /* VOL connector's class struct */
+
+ /* Check args and get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize connector info")
+ } /* end if */
+ else
+ *info = NULL;
+ } /* end if */
+ else
+ *info = NULL;
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLconnector_str_to_info() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLget_object
+ *
+ * Purpose: Retrieves an underlying object.
+ *
+ * Return: Success: Non-NULL
+ * Failure: NULL
+ *
+ *---------------------------------------------------------------------------
+ */
+void *
+H5VLget_object(void *obj, hid_t connector_id)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("*x", "*xi", obj, connector_id);
+
+ /* Check args */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ 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);
+ else
+ ret_value = obj;
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLget_object */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_get_wrap_ctx
+ *
+ * Purpose: Retrieve the VOL object wrapping context for a connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, void **wrap_ctx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(connector);
+ HDassert(obj);
+ HDassert(wrap_ctx);
+
+ /* Allow the connector to copy or do it ourselves */
+ if(connector->get_wrap_ctx) {
+ /* Sanity check */
+ HDassert(connector->free_wrap_ctx);
+
+ /* Invoke connector's callback */
+ if((connector->get_wrap_ctx)(obj, wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "connector wrap context callback failed")
+ } /* end if */
+ else
+ *wrap_ctx = NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_get_wrap_ctx() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLget_wrap_ctx
+ *
+ * Purpose: Get a VOL connector's object wrapping context
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE3("e", "*xi**x", obj, connector_id, wrap_ctx);
+
+ /* Check args and get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Get the VOL connector's object wrapper */
+ if(H5VL_get_wrap_ctx(cls, obj, wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to retrieve VOL connector object wrap context")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLget_wrap_ctx() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_free_wrap_ctx
+ *
+ * Purpose: Free object wrapping context for a connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(connector);
+
+ /* 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector wrap context free request failed")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_free_wrap_ctx() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLfree_wrap_ctx
+ *
+ * Purpose: Release a VOL connector's object wrapping context
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "*xi", wrap_ctx, connector_id);
+
+ /* Check args and get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Release the VOL connector's object wrapper */
+ if(H5VL_free_wrap_ctx(cls, wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector object wrap context")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLfree_wrap_ctx() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_wrap_object
+ *
+ * Purpose: Wrap an object with connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj)
+{
+ void *ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Sanity checks */
+ HDassert(connector);
+ HDassert(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)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object")
+ } /* end if */
+ else
+ ret_value = obj;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_wrap_object() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLwrap_object
+ *
+ * Purpose: Asks a connector to wrap an underlying object.
+ *
+ * Return: Success: Non-NULL
+ * Failure: NULL
+ *
+ *---------------------------------------------------------------------------
+ */
+void *
+H5VLwrap_object(void *obj, 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);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ 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)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLwrap_object */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_create
+ *
+ * Purpose: Creates an attribute through the VOL
+ *
+ * Return: Success: Pointer to the new attribute
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.create)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr create' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->attr_cls.create)(obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_attr_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_create
+ *
+ * Purpose: Creates an attribute through the VOL
+ *
+ * Return: Success: Pointer to the new attribute
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_attr_create(const H5VL_object_t *vol_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)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__attr_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, acpl_id, aapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_attr_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_create
+ *
+ * Purpose: Creates an attribute
+ *
+ * Return: Success: Pointer to the new attribute
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, acpl_id,
+ aapl_id, dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__attr_create(obj, loc_params, cls, name, acpl_id, aapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create attribute")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_open
+ *
+ * Purpose: Opens an attribute through the VOL
+ *
+ * Return: Success: Pointer to the attribute
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name,
+ hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.open)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr open' method")
+
+ /* Call the corresponding VOL open callback */
+ if(NULL == (ret_value = (cls->attr_cls.open)(obj, loc_params, name, aapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__attr_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_open
+ *
+ * Purpose: Opens an attribute through the VOL
+ *
+ * Return: Success: Pointer to the attribute
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_attr_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__attr_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, aapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_attr_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_open
+ *
+ * Purpose: Opens an attribute
+ *
+ * Return: Success: Pointer to the attribute
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ const char *name, hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("*x", "*x*xi*sii**x", obj, loc_params, connector_id, name, aapl_id,
+ dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__attr_open(obj, loc_params, cls, name, aapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open attribute")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_read
+ *
+ * Purpose: Reads data from attr through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, void *buf,
+ hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.read)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr read' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->attr_cls.read)(obj, mem_type_id, buf, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__attr_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_read
+ *
+ * Purpose: Reads data from attr through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, void *buf,
+ hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__attr_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, buf, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_attr_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_read
+ *
+ * Purpose: Reads data from an attribute
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLattr_read(void *obj, hid_t connector_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xii*xi**x", obj, connector_id, mem_type_id, buf, dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__attr_read(obj, cls, mem_type_id, buf, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read attribute")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_write
+ *
+ * Purpose: Writes data to attr through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf,
+ hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.write)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr write' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->attr_cls.write)(obj, mem_type_id, buf, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__attr_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_write
+ *
+ * Purpose: Writes data to attr through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, const void *buf,
+ hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__attr_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, buf, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_attr_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_write
+ *
+ * Purpose: Writes data to an attribute
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLattr_write(void *obj, hid_t connector_id, hid_t mem_type_id, const void *buf,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xii*xi**x", obj, connector_id, mem_type_id, buf, dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__attr_write(obj, cls, mem_type_id, buf, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write attribute")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_get
+ *
+ * Purpose: Get specific information about the attribute through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.get)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr get' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__attr_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_get
+ *
+ * Purpose: Get specific information about the attribute through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type,
+ 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_attr_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_get
+ *
+ * Purpose: Gets information about the attribute
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVai**xx", obj, connector_id, get_type, dxpl_id, req,
+ arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__attr_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get attribute information")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_specific
+ *
+ * Purpose: Specific operation on attributes through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.specific)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr specific' method")
+
+ /* Call the corresponding VOL callback */
+ if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__attr_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_specific
+ *
+ * Purpose: Specific operation on attributes through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ H5VL_attr_specific_t specific_type, 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_attr_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_specific
+ *
+ * Purpose: Performs a connector-specific operation on an attribute
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("e", "*x*xiVbi**xx", obj, loc_params, connector_id, specific_type,
+ dxpl_id, req, arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if((ret_value = H5VL__attr_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.optional)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr optional' method")
+
+ /* Call the corresponding VOL callback */
+ if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__attr_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_attr_optional(const H5VL_object_t *vol_obj, 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_attr_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on an attribute
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if((ret_value = H5VL__attr_optional(obj, cls, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_close
+ *
+ * Purpose: Closes an attribute through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.close)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr close' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->attr_cls.close)(obj, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__attr_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_close
+ *
+ * Purpose: Closes an attribute through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__attr_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_attr_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_close
+ *
+ * Purpose: Closes an attribute
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLattr_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__attr_close(obj, cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close attribute")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_create
+ *
+ * Purpose: Creates a dataset through the VOL
+ *
+ * Return: Success: Pointer to new dataset
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.create)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset create' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->dataset_cls.create)(obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_create
+ *
+ * Purpose: Creates a dataset through the VOL
+ *
+ * Return: Success: Pointer to new dataset
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_dataset_create(const H5VL_object_t *vol_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)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__dataset_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, dcpl_id, dapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_dataset_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_create
+ *
+ * Purpose: Creates a dataset
+ *
+ * Return: Success: Pointer to the new dataset
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, dcpl_id,
+ dapl_id, dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__dataset_create(obj, loc_params, cls, name, dcpl_id, dapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create dataset")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_open
+ *
+ * Purpose: Opens a dataset through the VOL
+ *
+ * Return: Success: Pointer to dataset
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name,
+ hid_t dapl_id, hid_t dxpl_id, void **req)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.open)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset open' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->dataset_cls.open)(obj, loc_params, name, dapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_open
+ *
+ * Purpose: Opens a dataset through the VOL
+ *
+ * Return: Success: Pointer to dataset
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_dataset_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t dapl_id, hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__dataset_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, dapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_dataset_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_open
+ *
+ * Purpose: Opens a dataset
+ *
+ * Return: Success: Pointer to the new dataset
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ const char *name, hid_t dapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("*x", "*x*xi*sii**x", obj, loc_params, connector_id, name, dapl_id,
+ dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open dataset")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_read
+ *
+ * Purpose: Reads data from dataset through the VOL
+*
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__dataset_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
+ hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf,
+ void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.read)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset read' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->dataset_cls.read)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_read
+ *
+ * Purpose: Reads data from dataset through the VOL
+*
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id,
+ hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf,
+ void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__dataset_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_dataset_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_read
+ *
+ * Purpose: Reads data from a dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id,
+ hid_t file_space_id, hid_t plist_id, void *buf, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE8("e", "*xiiiii*x**x", obj, connector_id, mem_type_id, mem_space_id,
+ file_space_id, plist_id, buf, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__dataset_read(obj, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_write
+ *
+ * Purpose: Writes data from dataset through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
+ hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf,
+ void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.write)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset write' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->dataset_cls.write)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_write
+ *
+ * Purpose: Writes data from dataset through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id,
+ hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf,
+ void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__dataset_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_dataset_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_write
+ *
+ * Purpose: Writes data to a dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdataset_write(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id,
+ hid_t file_space_id, hid_t plist_id, const void *buf, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE8("e", "*xiiiii*x**x", obj, connector_id, mem_type_id, mem_space_id,
+ file_space_id, plist_id, buf, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__dataset_write(obj, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_get
+ *
+ * Purpose: Get specific information about the dataset through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.get)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset get' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->dataset_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_get
+ *
+ * Purpose: Get specific information about the dataset through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type,
+ 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_dataset_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_get
+ *
+ * Purpose: Gets information about a dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVci**xx", obj, connector_id, get_type, dxpl_id, req,
+ arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__dataset_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset get callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_specific
+ *
+ * Purpose: Specific operation on datasets through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.specific)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset specific' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->dataset_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_specific
+ *
+ * Purpose: Specific operation on datasets through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t specific_type,
+ 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_dataset_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_specific
+ *
+ * Purpose: Performs a connector-specific operation on a dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVdi**xx", obj, connector_id, specific_type, dxpl_id, req,
+ arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__dataset_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.optional)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset optional' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->dataset_cls.optional)(obj, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_dataset_optional(const H5VL_object_t *vol_obj, 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Call the corresponding VOL callback */
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_dataset_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on a dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdataset_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__dataset_optional(obj, cls, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_close
+ *
+ * Purpose: Closes a dataset through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(obj);
+ HDassert(cls);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.close)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset close' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->dataset_cls.close)(obj, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "dataset close failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_close
+ *
+ * Purpose: Closes a dataset through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+ HDassert(vol_obj->data);
+ HDassert(vol_obj->connector);
+ HDassert(vol_obj->connector->cls);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__dataset_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "dataset close failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_dataset_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_close
+ *
+ * Purpose: Closes a dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdataset_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__dataset_close(obj, cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close dataset")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__file_create
+ *
+ * Purpose: Creates a file through the VOL
+ *
+ * Note: Does not have a 'static' version of the routine, since there's
+ * no objects in the container before this operation completes.
+ *
+ * Return: Success: Pointer to new file
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->file_cls.create)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'file create' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_file_create
+ *
+ * Purpose: Creates a file through the VOL
+ *
+ * Note: Does not have a 'static' version of the routine, since there's
+ * no objects in the container before this operation completes.
+ *
+ * Return: Success: Pointer to new file
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name,
+ unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL Class structure for callback info */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Get the connector's class */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop->connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_file_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLfile_create
+ *
+ * Purpose: Creates a file
+ *
+ * Return: Success: Pointer to the new file
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
+ hid_t dxpl_id, void **req)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("*x", "*sIuiii**x", name, flags, fcpl_id, fapl_id, dxpl_id, req);
+
+ /* Get the VOL info from the fapl */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info")
+
+ /* Get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create file")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLfile_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__file_open
+ *
+ * Purpose: Opens a file through the VOL.
+ *
+ * Return: Success: Pointer to file.
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__file_open(const H5VL_class_t *cls, const char *name, unsigned flags,
+ hid_t fapl_id, hid_t dxpl_id, void **req)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->file_cls.open)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'file open' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_file_open
+ *
+ * Purpose: Opens a file through the VOL.
+ *
+ * Note: Does not have a 'static' version of the routine, since there's
+ * no objects in the container before this operation completes.
+ *
+ * Return: Success: Pointer to file.
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_file_open(const H5VL_connector_prop_t *connector_prop, const char *name,
+ unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL Class structure for callback info */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Get the connector's class */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop->connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_file_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLfile_open
+ *
+ * Purpose: Opens a file
+ *
+ * Return: Success: Pointer to the file
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id,
+ void **req)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("*x", "*sIuii**x", name, flags, fapl_id, dxpl_id, req);
+
+ /* Get the VOL info from the fapl */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info")
+
+ /* Get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open file")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLfile_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__file_get
+ *
+ * Purpose: Get specific information about the file through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->file_cls.get)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file get' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->file_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_file_get
+ *
+ * Purpose: Get specific information about the file through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type,
+ 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_file_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLfile_get
+ *
+ * Purpose: Gets information about the file
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVgi**xx", obj, connector_id, get_type, dxpl_id, req,
+ arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__file_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute file get callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLfile_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__file_specific
+ *
+ * Purpose: Perform File specific operations through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->file_cls.specific)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file specific' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_file_specific
+ *
+ * Purpose: Perform File specific operations through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type,
+ hid_t dxpl_id, void **req, ...)
+{
+ const H5VL_class_t *cls; /* VOL connector's class struct */
+ va_list arguments; /* Argument list passed from the API call */
+ hbool_t arg_started = FALSE; /* Whether the va_list has been started */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Start access to the varargs, so they are available in all situations below */
+ HDva_start(arguments, req);
+ arg_started = TRUE;
+
+ /* Special treatment of file access check */
+ if(specific_type == H5VL_FILE_IS_ACCESSIBLE) {
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ va_list tmp_args; /* argument list passed from the API call */
+ hid_t fapl_id; /* File access property list for accessing the file */
+
+ /* Get the file access property list to access the file */
+ HDva_copy(tmp_args, arguments);
+ fapl_id = va_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)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list")
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info")
+
+ /* Get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+ } /* end if */
+ /* Set wrapper info in API context, for all other operations */
+ else {
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Set the VOL connector class pointer */
+ cls = vol_obj->connector->cls;
+ } /* end else */
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__file_specific(vol_obj ? vol_obj->data : NULL, cls, specific_type, 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)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_file_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLfile_specific
+ *
+ * Purpose: Performs a connector-specific operation on a file
+ *
+ * Note: The 'obj' parameter is allowed to be NULL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVhi**xx", obj, connector_id, specific_type, dxpl_id, req,
+ arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__file_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file specific callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLfile_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__file_optional
+ *
+ * Purpose: Perform a connector specific operation
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->file_cls.optional)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file optional' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->file_cls.optional)(obj, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_file_optional
+ *
+ * Purpose: Perform a connector specific operation
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_file_optional(const H5VL_object_t *vol_obj, 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_file_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLfile_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on a file
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__file_optional(obj, cls, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLfile_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__file_close
+ *
+ * Purpose: Closes a file through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(obj);
+ HDassert(cls);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->file_cls.close)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file close' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->file_cls.close)(obj, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_file_close
+ *
+ * Purpose: Closes a file through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__file_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_file_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLfile_close
+ *
+ * Purpose: Closes a file
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLfile_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__file_close(obj, cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLfile_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__group_create
+ *
+ * Purpose: Creates a group through the VOL
+ *
+ * Return: Success: Pointer to new group
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->group_cls.create)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group create' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->group_cls.create)(obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__group_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_group_create
+ *
+ * Purpose: Creates a group through the VOL
+ *
+ * Return: Success: Pointer to new group
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_group_create(const H5VL_object_t *vol_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)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__group_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, gcpl_id, gapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_group_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLgroup_create
+ *
+ * Purpose: Creates a group
+ *
+ * Return: Success: Pointer to the new group
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name,
+ hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, gcpl_id,
+ gapl_id, dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__group_create(obj, loc_params, cls, name, gcpl_id, gapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create group")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLgroup_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__group_open
+ *
+ * Purpose: Opens a group through the VOL
+ *
+ * Return: Success: Pointer to group
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__group_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ const char *name, hid_t gapl_id, hid_t dxpl_id, void **req)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->group_cls.open)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group open' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->group_cls.open)(obj, loc_params, name, gapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__group_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_group_open
+ *
+ * Purpose: Opens a group through the VOL
+ *
+ * Return: Success: Pointer to group
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_group_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t gapl_id, hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__group_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, gapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_group_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLgroup_open
+ *
+ * Purpose: Opens a group
+ *
+ * Return: Success: Pointer to the group
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name,
+ hid_t gapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("*x", "*x*xi*sii**x", obj, loc_params, connector_id, name, gapl_id,
+ dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__group_open(obj, loc_params, cls, name, gapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLgroup_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__group_get
+ *
+ * Purpose: Get specific information about the group through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->group_cls.get)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group get' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__group_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_group_get
+ *
+ * Purpose: Get specific information about the group through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type,
+ 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_group_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLgroup_get
+ *
+ * Purpose: Gets information about the group
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVii**xx", obj, connector_id, get_type, dxpl_id, req,
+ arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__group_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLgroup_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__group_specific
+ *
+ * Purpose: Specific operation on groups through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->group_cls.specific)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group specific' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__group_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_group_specific
+ *
+ * Purpose: Specific operation on groups through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type,
+ 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_group_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLgroup_specific
+ *
+ * Purpose: Performs a connector-specific operation on a group
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVji**xx", obj, connector_id, specific_type, dxpl_id, req,
+ arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__group_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLgroup_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__group_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->group_cls.optional)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group optional' method")
+
+ /* Call the corresponding VOL callback */
+ if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__group_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_group_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_group_optional(const H5VL_object_t *vol_obj, 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_group_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLgroup_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on a group
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if((ret_value = H5VL__group_optional(obj, cls, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLgroup_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__group_close
+ *
+ * Purpose: Closes a group through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ /* Sanity check */
+ HDassert(obj);
+ HDassert(cls);
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->group_cls.close)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group close' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->group_cls.close)(obj, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__group_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_group_close
+ *
+ * Purpose: Closes a group through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__group_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_group_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLgroup_close
+ *
+ * Purpose: Closes a group
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLgroup_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__group_close(obj, cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close group")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLgroup_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__link_create
+ *
+ * Purpose: Creates a link through the VOL
+ *
+ * Note: The 'obj' parameter is allowed to be NULL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->link_cls.create)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link create' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->link_cls.create)(create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_link_create
+ *
+ * Purpose: Creates a link through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj,
+ const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id,
+ void **req)
+{
+ H5VL_object_t tmp_vol_obj; /* Temporary object token of */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Special case for hard links */
+ if(H5VL_LINK_CREATE_HARD == create_type && NULL == vol_obj->data) {
+ H5P_genplist_t *plist; /* Property list pointer */
+
+ /* Get the VOL data pointer from the fapl */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list")
+ if(H5P_peek(plist, H5VL_PROP_LINK_TARGET, &tmp_vol_obj.data) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info")
+ } /* end if */
+ else
+ /* Use the VOL object passed in */
+ tmp_vol_obj.data = vol_obj->data;
+ tmp_vol_obj.connector = vol_obj->connector;
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(tmp_vol_obj.data, tmp_vol_obj.connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__link_create(create_type, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_link_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLlink_create
+ *
+ * Purpose: Creates a link
+ *
+ * Note: The 'obj' parameter is allowed to be NULL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
+ hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE8("e", "Vk*x*xiiii**x", create_type, obj, loc_params, connector_id,
+ lcpl_id, lapl_id, dxpl_id, req);
+
+ /* Get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLlink_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__link_copy
+ *
+ * Purpose: Copys a link from src to dst.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
+ const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, hid_t lcpl_id,
+ hid_t lapl_id, hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->link_cls.copy)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link copy' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->link_cls.copy)(src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_link_copy
+ *
+ * Purpose: Copys a link from src to dst.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1,
+ const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id,
+ hid_t lapl_id, hid_t dxpl_id, void **req)
+{
+ const H5VL_object_t *vol_obj; /* VOL object for object with data */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ vol_obj = (src_vol_obj->data ? src_vol_obj : dst_vol_obj);
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__link_copy((src_vol_obj->data ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_link_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLlink_copy
+ *
+ * Purpose: Copies a link to a new location
+ *
+ * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
+ const H5VL_loc_params_t *loc_params2, hid_t connector_id, hid_t lcpl_id,
+ hid_t lapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE9("e", "*x*x*x*xiiii**x", src_obj, loc_params1, dst_obj, loc_params2,
+ connector_id, lcpl_id, lapl_id, dxpl_id, req);
+
+ /* Get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLlink_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__link_move
+ *
+ * Purpose: Moves a link from src to dst.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
+ const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, hid_t lcpl_id,
+ hid_t lapl_id, hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->link_cls.move)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link move' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->link_cls.move)(src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_move() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_link_move
+ *
+ * Purpose: Moves a link from src to dst.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1,
+ const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id,
+ hid_t lapl_id, hid_t dxpl_id, void **req)
+{
+ const H5VL_object_t *vol_obj; /* VOL object for object with data */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ vol_obj = (src_vol_obj ? src_vol_obj : dst_vol_obj);
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__link_move((src_vol_obj ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_link_move() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLlink_move
+ *
+ * Purpose: Moves a link to another location
+ *
+ * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
+ const H5VL_loc_params_t *loc_params2, hid_t connector_id, hid_t lcpl_id,
+ hid_t lapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE9("e", "*x*x*x*xiiii**x", src_obj, loc_params1, dst_obj, loc_params2,
+ connector_id, lcpl_id, lapl_id, dxpl_id, req);
+
+ /* Get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__link_move(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "unable to move object")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLlink_move() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__link_get
+ *
+ * Purpose: Get specific information about the link through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->link_cls.get)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link get' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_link_get
+ *
+ * Purpose: Get specific information about the link through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ H5VL_link_get_t get_type, 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_link_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLlink_get
+ *
+ * Purpose: Gets information about a link
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("e", "*x*xiVli**xx", obj, loc_params, connector_id, get_type, dxpl_id,
+ req, arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__link_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLlink_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__link_specific
+ *
+ * Purpose: Specific operation on links through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->link_cls.specific)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link specific' method")
+
+ /* Call the corresponding VOL callback */
+ if((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_link_specific
+ *
+ * Purpose: Specific operation on links through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ H5VL_link_specific_t specific_type, 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_link_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLlink_specific
+ *
+ * Purpose: Performs a connector-specific operation on a link
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("e", "*x*xiVmi**xx", obj, loc_params, connector_id, specific_type,
+ dxpl_id, req, arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if((ret_value = H5VL__link_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLlink_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__link_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->link_cls.optional)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link optional' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_link_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_link_optional(const H5VL_object_t *vol_obj, 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_link_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLlink_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on a link
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__link_optional(obj, cls, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLlink_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__object_open
+ *
+ * Purpose: Opens a object through the VOL
+ *
+ * Return: Success: Pointer to the object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__object_open(void *obj, const H5VL_loc_params_t *params, const H5VL_class_t *cls, H5I_type_t *opened_type,
+ hid_t dxpl_id, void **req)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->object_cls.open)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'object open' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->object_cls.open)(obj, params, opened_type, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__object_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_object_open
+ *
+ * Purpose: Opens a object through the VOL
+ *
+ * Return: Success: Pointer to the object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params,
+ H5I_type_t *opened_type, hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__object_open(vol_obj->data, params, vol_obj->connector->cls, opened_type, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_object_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLobject_open
+ *
+ * Purpose: Opens an object
+ *
+ * Return: Success: Pointer to the object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLobject_open(void *obj, const H5VL_loc_params_t *params, hid_t connector_id, H5I_type_t *opened_type,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("*x", "*x*xi*Iti**x", obj, params, connector_id, opened_type, dxpl_id,
+ req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__object_open(obj, params, cls, opened_type, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open object")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLobject_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__object_copy
+ *
+ * Purpose: Copies an object to another destination through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name,
+ void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name,
+ const H5VL_class_t *cls, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id,
+ void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->object_cls.copy)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object copy' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->object_cls.copy)(src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, ocpypl_id, lcpl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__object_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_object_copy
+ *
+ * Purpose: Copies an object to another destination through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_params_t *src_loc_params,
+ const char *src_name, const H5VL_object_t *dst_obj, const H5VL_loc_params_t *dst_loc_params,
+ const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id,
+ void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Make sure that the VOL connectors are the same */
+ if(src_obj->connector->cls->value != dst_obj->connector->cls->value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "objects are accessed through different VOL connectors and can't be copied")
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(src_obj->data, src_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__object_copy(src_obj->data, src_loc_params, src_name, dst_obj->data, dst_loc_params, dst_name, src_obj->connector->cls, ocpypl_id, lcpl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_object_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLobject_copy
+ *
+ * Purpose: Copies an object to another location
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params,
+ const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params,
+ const char *dst_name, hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE11("e", "*x*x*s*x*x*siiii**x", src_obj, src_loc_params, src_name,
+ dst_obj, dst_loc_params, dst_name, connector_id, ocpypl_id, lcpl_id,
+ dxpl_id, req);
+
+ /* Check args and get class pointers */
+ if(NULL == src_obj || NULL == dst_obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__object_copy(src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, cls, ocpypl_id, lcpl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLobject_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__object_get
+ *
+ * Purpose: Get specific information about the object through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->object_cls.get)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object get' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->object_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__object_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_object_get
+ *
+ * Purpose: Get specific information about the object through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ H5VL_object_get_t get_type, 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_object_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLobject_get
+ *
+ * Purpose: Gets information about an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("e", "*x*xiVni**xx", obj, loc_params, connector_id, get_type, dxpl_id,
+ req, arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__object_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object get callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLobject_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__object_specific
+ *
+ * Purpose: Specific operation on objects through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->object_cls.specific)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object specific' method")
+
+ /* Call the corresponding VOL callback */
+ if((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__object_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_object_specific
+ *
+ * Purpose: Specific operation on objects through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ H5VL_object_specific_t specific_type, 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_object_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLobject_specific
+ *
+ * Purpose: Performs a connector-specific operation on an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("e", "*x*xiVoi**xx", obj, loc_params, connector_id, specific_type,
+ dxpl_id, req, arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->object_cls.specific)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `object specific' method")
+
+ /* Bypass the H5VLint layer, calling the VOL callback directly */
+ if((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object specific callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLobject_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__object_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->object_cls.optional)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object optional' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->object_cls.optional)(obj, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__object_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_object_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_object_optional(const H5VL_object_t *vol_obj, 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_object_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLobject_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__object_optional(obj, cls, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLobject_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__datatype_commit
+ *
+ * Purpose: Commits a datatype to the file through the VOL
+ *
+ * Return: Success: Pointer to the new datatype
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ 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)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->datatype_cls.commit)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'datatype commit' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->datatype_cls.commit)(obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__datatype_commit() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_datatype_commit
+ *
+ * Purpose: Commits a datatype to the file through the VOL
+ *
+ * Return: Success: Pointer to the new datatype
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_datatype_commit(const H5VL_object_t *vol_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)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__datatype_commit(vol_obj->data, loc_params, vol_obj->connector->cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_datatype_commit() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdatatype_commit
+ *
+ * Purpose: Commits a datatype to the file
+ *
+ * Return: Success: Pointer to the new datatype
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id,
+ hid_t tapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE10("*x", "*x*xi*siiiii**x", obj, loc_params, connector_id, name,
+ type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__datatype_commit(obj, loc_params, cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to commit datatype")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdatatype_commit() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__datatype_open
+ *
+ * Purpose: Opens a named datatype through the VOL
+ *
+ * Return: Success: Pointer to the datatype
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ const char *name, hid_t tapl_id, hid_t dxpl_id, void **req)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->datatype_cls.open)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->datatype_cls.open)(obj, loc_params, name, tapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__datatype_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_datatype_open
+ *
+ * Purpose: Opens a named datatype through the VOL
+ *
+ * Return: Success: Pointer to the datatype
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_datatype_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t tapl_id, hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__datatype_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, tapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_datatype_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdatatype_open
+ *
+ * Purpose: Opens a named datatype
+ *
+ * Return: Success: Pointer to the datatype
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ const char *name, hid_t tapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("*x", "*x*xi*sii**x", obj, loc_params, connector_id, name, tapl_id,
+ dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__datatype_open(obj, loc_params, cls, name, tapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open datatype")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdatatype_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__datatype_get
+ *
+ * Purpose: Get specific information about the datatype through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->datatype_cls.get)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype get' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__datatype_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_datatype_get
+ *
+ * Purpose: Get specific information about the datatype through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type,
+ 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_datatype_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdatatype_get
+ *
+ * Purpose: Gets information about the datatype
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVei**xx", obj, connector_id, get_type, dxpl_id, req,
+ arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->datatype_cls.get)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `datatype get' method")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__datatype_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdatatype_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__datatype_specific
+ *
+ * Purpose: Specific operation on datatypes through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->datatype_cls.specific)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype specific' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__datatype_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_datatype_specific
+ *
+ * Purpose: Specific operation on datatypes through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type,
+ 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_datatype_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdatatype_specific
+ *
+ * Purpose: Performs a connector-specific operation on a datatype
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVfi**xx", obj, connector_id, specific_type, dxpl_id, req,
+ arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__datatype_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdatatype_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__datatype_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->datatype_cls.optional)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype optional' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->datatype_cls.optional)(obj, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__datatype_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_datatype_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_datatype_optional(const H5VL_object_t *vol_obj, 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 */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_datatype_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdatatype_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on a datatype
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdatatype_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__datatype_optional(obj, cls, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdatatype_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__datatype_close
+ *
+ * Purpose: Closes a datatype through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->datatype_cls.close)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype close' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->datatype_cls.close)(obj, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__datatype_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_datatype_close
+ *
+ * Purpose: Closes a datatype through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__datatype_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_datatype_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdatatype_close
+ *
+ * Purpose: Closes a datatype
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__datatype_close(obj, cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdatatype_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__request_wait
+ *
+ * Purpose: Waits on an asychronous request through the VOL
+ *
+ * Note: Releases the request if the operation has completed and the
+ * connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__request_wait(void *req, const H5VL_class_t *cls, uint64_t timeout,
+ H5ES_status_t *status)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(req);
+ HDassert(cls);
+ HDassert(status);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->request_cls.wait)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async wait' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->request_cls.wait)(req, timeout, status) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__request_wait() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_request_wait
+ *
+ * Purpose: Waits on an asychronous request through the VOL
+ *
+ * Note: Releases the request if the operation has completed and the
+ * connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout,
+ H5ES_status_t *status)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(vol_obj);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__request_wait(vol_obj->data, vol_obj->connector->cls, timeout, status) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_request_wait() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLrequest_wait
+ *
+ * Purpose: Waits on a request
+ *
+ * Note: Releases the request if the operation has completed and the
+ * connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_status_t *status)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE4("e", "*xiUL*Es", req, connector_id, timeout, status);
+
+ /* Get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__request_wait(req, cls, timeout, status) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLrequest_wait() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__request_notify
+ *
+ * Purpose: Registers a user callback to be invoked when an asynchronous
+ * operation completes
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__request_notify(void *req, const H5VL_class_t *cls, H5VL_request_notify_t cb,
+ void *ctx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(req);
+ HDassert(cls);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->request_cls.notify)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async notify' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->request_cls.notify)(req, cb, ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request notify failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__request_notify() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_request_notify
+ *
+ * Purpose: Registers a user callback to be invoked when an asynchronous
+ * operation completes
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb,
+ void *ctx)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__request_notify(vol_obj->data, vol_obj->connector->cls, cb, ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "request notify failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_request_notify() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLrequest_notify
+ *
+ * Purpose: Registers a user callback to be invoked when an asynchronous
+ * operation completes
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb,
+ void *ctx)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE4("e", "*xix*x", req, connector_id, cb, ctx);
+
+ /* Get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__request_notify(req, cls, cb, ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to register notify callback for request")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLrequest_notify() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__request_cancel
+ *
+ * Purpose: Cancels an asynchronous request through the VOL
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__request_cancel(void *req, const H5VL_class_t *cls)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(req);
+ HDassert(cls);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->request_cls.cancel)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async cancel' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->request_cls.cancel)(req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__request_cancel() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_request_cancel
+ *
+ * Purpose: Cancels an asynchronous request through the VOL
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_request_cancel(const H5VL_object_t *vol_obj)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__request_cancel(vol_obj->data, vol_obj->connector->cls) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_request_cancel() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLrequest_cancel
+ *
+ * Purpose: Cancels a request
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLrequest_cancel(void *req, hid_t connector_id)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "*xi", req, connector_id);
+
+ /* Get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__request_cancel(req, cls) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLrequest_cancel() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__request_specific
+ *
+ * Purpose: Specific operation on asynchronous request through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__request_specific(void *req, const H5VL_class_t *cls,
+ H5VL_request_specific_t specific_type, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(req);
+ HDassert(cls);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->request_cls.specific)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async specific' method")
+
+ /* Call the corresponding VOL callback */
+ if((ret_value = (cls->request_cls.specific)(req, specific_type, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__request_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_request_specific
+ *
+ * Purpose: Specific operation on asynchronous request through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_request_specific(const H5VL_object_t *vol_obj,
+ H5VL_request_specific_t specific_type, ...)
+{
+ va_list arguments; /* Argument list passed from the API call */
+ hbool_t arg_started = FALSE; /* Whether the va_list has been started */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_request_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLrequest_specific
+ *
+ * Purpose: Performs a connector-specific operation on an asynchronous request
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type,
+ va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE4("e", "*xiVrx", req, connector_id, specific_type, arguments);
+
+ /* Get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if((ret_value = H5VL__request_specific(req, cls, specific_type, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLrequest_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__request_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__request_optional(void *req, const H5VL_class_t *cls, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(req);
+ HDassert(cls);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->request_cls.optional)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async optional' method")
+
+ /* Call the corresponding VOL callback */
+ if((ret_value = (cls->request_cls.optional)(req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__request_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_request_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_request_optional(const H5VL_object_t *vol_obj, ...)
+{
+ va_list arguments; /* Argument list passed from the API call */
+ hbool_t arg_started = FALSE; /* Whether the va_list has been started */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ 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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_request_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLrequest_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on an asynchronous request
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLrequest_optional(void *req, hid_t connector_id, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE3("e", "*xix", req, connector_id, arguments);
+
+ /* Get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if((ret_value = H5VL__request_optional(req, cls, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLrequest_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__request_free
+ *
+ * Purpose: Frees an asynchronous request through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__request_free(void *req, const H5VL_class_t *cls)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(req);
+ HDassert(cls);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->request_cls.free)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async free' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->request_cls.free)(req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__request_free() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_request_free
+ *
+ * Purpose: Frees an asynchronous request through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_request_free(const H5VL_object_t *vol_obj)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding VOL callback */
+ if(H5VL__request_free(vol_obj->data, vol_obj->connector->cls) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_request_free() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLrequest_free
+ *
+ * Purpose: Frees a request
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLrequest_free(void *req, hid_t connector_id)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "*xi", req, connector_id);
+
+ /* Get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__request_free(req, cls) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to free request")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLrequest_free() */
+
diff --git a/src/H5VLint.c b/src/H5VLint.c
index e246989..d51be0c 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -30,11 +30,11 @@
/***********/
#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
#include "H5Tprivate.h" /* Datatypes */
#include "H5VLpkg.h" /* Virtual Object Layer */
@@ -43,19 +43,33 @@
/* Local Macros */
/****************/
+
/******************/
/* Local Typedefs */
/******************/
+/* Object wrapping context info */
+typedef struct H5VL_wrap_ctx_t {
+ unsigned rc; /* Ref. count for the # of times the context was set / reset */
+ const H5VL_t *connector; /* VOL connector for "outermost" class to start wrap */
+ void *obj_wrap_ctx; /* "wrap context" for outermost connector */
+} H5VL_wrap_ctx_t;
+
+
/********************/
/* Package Typedefs */
/********************/
+
/********************/
/* Local Prototypes */
/********************/
+static herr_t H5VL__free_cls(H5VL_class_t *cls);
+static void *H5VL__wrap_obj(void *obj);
+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);
-static herr_t H5VL_free_cls(H5VL_class_t *cls);
/*********************/
/* Package Variables */
@@ -64,6 +78,7 @@ static herr_t H5VL_free_cls(H5VL_class_t *cls);
/* Package initialization variable */
hbool_t H5_PKG_INIT_VAR = FALSE;
+
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -77,15 +92,22 @@ static const H5I_class_t H5I_VOL_CLS[1] = {{
H5I_VOL, /* ID class value */
0, /* Class flags */
0, /* # of reserved IDs for class */
- (H5I_free_t)H5VL_free_cls /* Callback routine for closing objects of this class */
+ (H5I_free_t)H5VL__free_cls /* Callback routine for closing objects of this class */
}};
+/* Declare a free list to manage the H5VL_class_t struct */
+H5FL_DEFINE_STATIC(H5VL_class_t);
+
/* Declare a free list to manage the H5VL_t struct */
H5FL_DEFINE(H5VL_t);
/* Declare a free list to manage the H5VL_object_t struct */
H5FL_DEFINE(H5VL_object_t);
+/* Declare a free list to manage the H5VL_wrap_ctx_t struct */
+H5FL_DEFINE_STATIC(H5VL_wrap_ctx_t);
+
+
/*-------------------------------------------------------------------------
* Function: H5VL_init
@@ -132,7 +154,7 @@ H5VL__init_package(void)
/* Initialize the atom group for the VL IDs */
if (H5I_register_type(H5I_VOL_CLS) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize H5VL interface");
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize H5VL interface")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -157,27 +179,27 @@ H5VL_term_package(void)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if (H5_PKG_INIT_VAR) {
+ if(H5_PKG_INIT_VAR) {
if (H5I_nmembers(H5I_VOL) > 0) {
(void)H5I_clear_type(H5I_VOL, FALSE, FALSE);
n++;
- }
+ } /* end if */
else {
- /* Destroy the VOL driver ID group */
+ /* Destroy the VOL connector ID group */
n += (H5I_dec_type_ref(H5I_VOL) > 0);
/* Mark interface as closed */
if (0 == n)
H5_PKG_INIT_VAR = FALSE;
- }
- }
+ } /* end else */
+ } /* end if */
FUNC_LEAVE_NOAPI(n)
} /* end H5VL_term_package() */
/*-------------------------------------------------------------------------
- * Function: H5VL_free_cls
+ * Function: H5VL__free_cls
*
* Purpose: Frees a file VOL class struct and returns an indication of
* success. This function is used as the free callback for the
@@ -189,27 +211,218 @@ H5VL_term_package(void)
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_free_cls(H5VL_class_t *cls)
+H5VL__free_cls(H5VL_class_t *cls)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(cls);
- /* XXX: Need to retrieve the VOL termination property list for the
- * terminate operation - JTH
- */
- if (cls->terminate && cls->terminate(H5P_DEFAULT) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL driver did not terminate cleanly");
+ /* Shut down the VOL connector */
+ if(cls->terminate && cls->terminate() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly")
+
+ /* Release the class */
+ H5MM_xfree((void *)cls->name); /* Casting away const OK -QAK */
+ H5FL_FREE(H5VL_class_t, cls);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__free_cls() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__wrap_obj
+ *
+ * Purpose: Wraps a library object with possible VOL connector wrappers, to
+ * match the VOL connector stack for the file.
+ *
+ * Return: Success: Wrapped object pointer
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, October 7, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__wrap_obj(void *obj)
+{
+ H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check arguments */
+ HDassert(obj);
+
+ /* Retrieve the VOL object wrapping context */
+ if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't get VOL object wrap context")
+
+ /* 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)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object")
+ } /* end if */
+ else
+ ret_value = obj;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__wrap_obj() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__new_vol_obj
+ *
+ * Purpose: Creates a new VOL object, to use when registering an ID.
+ *
+ * Return: Success: VOL object pointer
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, October 7, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5VL_object_t *
+H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t wrap_obj)
+{
+ H5VL_object_t *new_vol_obj = NULL; /* Pointer to new VOL object */
+ H5VL_object_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check arguments */
+ HDassert(object);
+ HDassert(vol_connector);
+
+ /* Make sure type number is valid */
+ if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE && type != H5I_FILE && type != H5I_GROUP)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, NULL, "invalid type number")
+
+ /* Create the new VOL object */
+ if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_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)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't wrap library object")
+ } /* end if */
+ else
+ new_vol_obj->data = object;
+
+ /* Bump the reference count on the VOL connector */
+ vol_connector->nrefs++;
+
+ /* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */
+ if(H5I_DATATYPE == type) {
+ if(NULL == (ret_value = (H5VL_object_t *)H5T_construct_datatype(new_vol_obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "can't construct datatype object")
+ } /* end if */
+ else
+ ret_value = (H5VL_object_t *)new_vol_obj;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__new_vol_obj() */
- /* XXX (VOL MERGE): We'll leak memory if the name string was dynamically allocated. */
- H5MM_xfree(cls);
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_conn_copy
+ *
+ * Purpose: Copy VOL connector ID & info.
+ *
+ * Note: This is an "in-place" copy.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_conn_copy(H5VL_connector_prop_t *connector_prop)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ if(connector_prop) {
+ /* Copy the connector ID & info, if there is one */
+ if(connector_prop->connector_id > 0) {
+ /* Increment the reference count on connector ID and copy connector info */
+ if(H5I_inc_ref(connector_prop->connector_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID")
+
+ /* Copy connector info, if it exists */
+ if(connector_prop->connector_info) {
+ H5VL_class_t *connector; /* Pointer to connector */
+ void *new_connector_info = NULL; /* Copy of connector info */
+
+ /* Retrieve the connector for the ID */
+ if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop->connector_id)))
+ HGOTO_ERROR(H5E_PLIST, 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_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed")
+
+ /* Set the connector info to the copy */
+ connector_prop->connector_info = new_connector_info;
+ } /* end if */
+ } /* end if */
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_conn_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_conn_free
+ *
+ * Purpose: Free VOL connector ID & info.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_conn_free(const H5VL_connector_prop_t *info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ if(info) {
+ /* Free the connector info (if it exists) and decrement the ID */
+ if(info->connector_id > 0) {
+ if(info->connector_info) {
+ H5VL_class_t *connector; /* Pointer to connector */
+
+ /* Retrieve the connector for the ID */
+ if(NULL == (connector = (H5VL_class_t *)H5I_object(info->connector_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Free the connector info */
+ if(H5VL_free_connector_info(connector, (void *)info->connector_info) < 0) /* Casting away const OK - QAK */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
+ } /* end if */
+
+ /* Decrement reference count for connector ID */
+ if(H5I_dec_ref(info->connector_id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID")
+ } /* end if */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_free_cls() */
+} /* end H5VL_conn_free() */
/*-------------------------------------------------------------------------
@@ -225,40 +438,25 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5VL_register(H5I_type_t type, const void *object, H5VL_t *vol_driver, hbool_t app_ref)
+H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref)
{
- H5VL_object_t *vol_obj = NULL;
- hid_t ret_value = H5I_INVALID_HID;
+ H5VL_object_t *vol_obj = NULL; /* VOL object wrapper for library object */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
/* Check arguments */
HDassert(object);
- HDassert(vol_driver);
-
- /* Set up VOL object to wrap the passed-in data */
- if (NULL == (vol_obj = H5FL_CALLOC(H5VL_object_t)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate top object structure");
- vol_obj->driver = vol_driver;
- vol_obj->data = object;
+ HDassert(vol_connector);
- vol_driver->nrefs++;
-
- /* Datatypes need special handling under the VOL, since they have a non-VOL aspect */
- if (H5I_DATATYPE == type) {
-
- H5T_t *dt = NULL;
-
- if (NULL == (dt = H5T_construct_datatype(vol_obj)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "can't construct datatype object");
-
- if ((ret_value = H5I_register(type, dt, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle");
- }
- else {
- if ((ret_value = H5I_register(type, vol_obj, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle");
- }
+ /* Set up VOL object for the passed-in data */
+ /* (Does not wrap object, since it's from a VOL callback) */
+ if(NULL == (vol_obj = H5VL__new_vol_obj(type, object, vol_connector, FALSE)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object")
+
+ /* Register VOL object as _object_ type, for future object API calls */
+ if((ret_value = H5I_register(type, vol_obj, app_ref)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -284,41 +482,24 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref, hid_t existing_id)
+H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref, hid_t existing_id)
{
H5VL_object_t *new_vol_obj = NULL; /* Pointer to new VOL object */
- void *stored_obj = NULL; /* Pointer to the object that will be stored */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check arguments */
HDassert(object);
- HDassert(vol_driver);
+ HDassert(vol_connector);
- /* Make sure type number is valid */
- if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE && type != H5I_FILE && type != H5I_GROUP)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
-
- /* Set up the new VOL object */
- if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate memory for VOL object");
- new_vol_obj->driver = vol_driver;
- new_vol_obj->data = object;
-
- /* Bump the reference count on the VOL driver */
- vol_driver->nrefs++;
-
- /* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */
- if(H5I_DATATYPE == type) {
- if(NULL == (stored_obj = (void *)H5T_construct_datatype(new_vol_obj)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't construct datatype object");
- }
- else
- stored_obj = (void *)new_vol_obj;
+ /* Set up VOL object for the passed-in data */
+ /* (Wraps object, since it's a library object) */
+ if(NULL == (new_vol_obj = H5VL__new_vol_obj(type, object, vol_connector, TRUE)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object")
/* Call the underlying H5I function to complete the registration */
- if(H5I_register_using_existing_id(type, stored_obj, app_ref, existing_id) < 0)
+ if(H5I_register_using_existing_id(type, new_vol_obj, app_ref, existing_id) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register object under existing ID")
done:
@@ -330,8 +511,8 @@ done:
* Function: H5VL_register_using_vol_id
*
* Purpose: Utility function to create a user ID for an object created
- * or opened through the VOL. Uses the VOL driver's ID to
- * get the driver information instead of it being passed in.
+ * or opened through the VOL. Uses the VOL connector's ID to
+ * get the connector information instead of it being passed in.
*
* Return: Success: A valid HDF5 ID
* Failure: H5I_INVALID_HID
@@ -339,28 +520,29 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5VL_register_using_vol_id(H5I_type_t type, const void *obj, hid_t driver_id, hbool_t app_ref)
+H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref)
{
H5VL_class_t *cls = NULL;
- H5VL_t *driver = NULL; /* VOL driver struct */
+ H5VL_t *connector = NULL; /* VOL connector struct */
hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_NOAPI(FAIL)
- if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL driver ID");
+ /* Get the VOL class object from the connector's ID */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL connector ID")
/* Setup VOL info struct */
- if (NULL == (driver = H5FL_CALLOC(H5VL_t)))
- HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VOL info struct");
- driver->cls = cls;
- driver->id = driver_id;
- if (H5I_inc_ref(driver->id, FALSE) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver");
+ if(NULL == (connector = H5FL_CALLOC(H5VL_t)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate VOL info struct")
+ connector->cls = cls;
+ connector->id = connector_id;
+ if(H5I_inc_ref(connector->id, FALSE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
/* Get an ID for the VOL object */
- if ((ret_value = H5VL_register(type, obj, driver, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle");
+ if((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -371,7 +553,7 @@ done:
* Function: H5VL_free_object
*
* Purpose: Wrapper to unregister an object ID with a VOL aux struct
- * and decrement ref count on VOL driver ID
+ * and decrement ref count on VOL connector ID
*
* Return: SUCCEED/FAIL
*
@@ -387,13 +569,13 @@ H5VL_free_object(H5VL_object_t *vol_obj)
/* Check arguments */
HDassert(vol_obj);
- vol_obj->driver->nrefs --;
+ vol_obj->connector->nrefs --;
- if (0 == vol_obj->driver->nrefs) {
- if (H5I_dec_ref(vol_obj->driver->id) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL driver");
- vol_obj->driver = H5FL_FREE(H5VL_t, vol_obj->driver);
- }
+ if(0 == vol_obj->connector->nrefs) {
+ if(H5I_dec_ref(vol_obj->connector->id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector")
+ vol_obj->connector = H5FL_FREE(H5VL_t, vol_obj->connector);
+ } /* end if */
vol_obj = H5FL_FREE(H5VL_object_t, vol_obj);
@@ -403,20 +585,20 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL_register_driver
+ * Function: H5VL_register_connector
*
- * Purpose: Registers a new VOL driver as a member of the virtual object
+ * Purpose: Registers a new VOL connector as a member of the virtual object
* layer class.
*
- * Return: Success: A VOL driver ID which is good until the
- * library is closed or the driver is unregistered.
+ * Return: Success: A VOL connector ID which is good until the
+ * library is closed or the connector is unregistered.
*
* Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
-H5VL_register_driver(const void *_cls, size_t size, hbool_t app_ref)
+H5VL_register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id)
{
const H5VL_class_t *cls = (const H5VL_class_t *)_cls;
H5VL_class_t *saved = NULL;
@@ -428,38 +610,47 @@ H5VL_register_driver(const void *_cls, size_t size, hbool_t app_ref)
HDassert(cls);
/* Copy the class structure so the caller can reuse or free it */
- if (NULL == (saved = (H5VL_class_t *)H5MM_calloc(size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for VOL driver class struct");
- HDmemcpy(saved, cls, size);
+ if (NULL == (saved = H5FL_CALLOC(H5VL_class_t)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL connector class struct")
+ HDmemcpy(saved, cls, sizeof(H5VL_class_t));
+ if(NULL == (saved->name = H5MM_strdup(cls->name)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL connector name")
+
+ /* Initialize the VOL connector */
+ if(cls->initialize && cls->initialize(vipl_id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to init VOL connector")
/* Create the new class ID */
if ((ret_value = H5I_register(H5I_VOL, saved, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver ID");
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
done:
- if (ret_value < 0)
- if (saved)
- H5MM_xfree(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_driver() */
+} /* end H5VL_register_connector() */
/*-------------------------------------------------------------------------
- * Function: H5VL_get_driver_name
+ * Function: H5VL_get_connector_name
*
- * Purpose: Private version of H5VLget_driver_name
+ * Purpose: Private version of H5VLget_connector_name
*
- * Return: Success: The length of the driver name
+ * Return: Success: The length of the connector name
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
ssize_t
-H5VL_get_driver_name(hid_t id, char *name /*out*/, size_t size)
+H5VL_get_connector_name(hid_t id, char *name /*out*/, size_t size)
{
- H5VL_object_t *vol_obj = NULL;
- const H5VL_class_t *cls = NULL;
+ H5VL_object_t *vol_obj;
+ const H5VL_class_t *cls;
size_t len;
ssize_t ret_value = -1;
@@ -467,23 +658,23 @@ H5VL_get_driver_name(hid_t id, char *name /*out*/, size_t size)
/* get the object pointer */
if (NULL == (vol_obj = H5VL_vol_object(id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier");
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid VOL identifier")
- cls = vol_obj->driver->cls;
+ cls = vol_obj->connector->cls;
len = HDstrlen(cls->name);
- if (name) {
- HDstrncpy(name, cls->name, MIN(len + 1,size));
- if (len >= size)
- name[size-1]='\0';
- }
+ if(name) {
+ HDstrncpy(name, cls->name, MIN(len + 1, size));
+ if(len >= size)
+ name[size - 1] = '\0';
+ } /* end if */
/* Set the return value for the API call */
ret_value = (ssize_t)len;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_get_driver_name() */
+} /* end H5VL_get_connector_name() */
/*-------------------------------------------------------------------------
@@ -503,149 +694,108 @@ H5VL_object_t *
H5VL_vol_object(hid_t id)
{
void *obj = NULL;
- H5I_type_t obj_type = H5I_get_type(id);
+ H5I_type_t obj_type;
H5VL_object_t *ret_value = NULL;
FUNC_ENTER_NOAPI(NULL)
+ obj_type = H5I_get_type(id);
if (H5I_FILE == obj_type || H5I_GROUP == obj_type || H5I_ATTR == obj_type ||
- H5I_DATASET == obj_type || H5I_DATATYPE == obj_type) {
- /* get the object */
+ H5I_DATASET == obj_type || H5I_DATATYPE == obj_type) {
+ /* Get the object */
if (NULL == (obj = H5I_object(id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier")
/* if this is a datatype, get the VOL object attached to the H5T_t struct */
- if (H5I_DATATYPE == obj_type) {
+ if (H5I_DATATYPE == obj_type)
if (NULL == (obj = H5T_get_named_type((H5T_t *)obj)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype");
- }
- }
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype")
+ } /* end if */
else
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier type to function");
-
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier type to function")
ret_value = (H5VL_object_t *)obj;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_vol_object() */
/*-------------------------------------------------------------------------
- * Function: H5VL_object
+ * Function: H5VL_object_data
*
- * Purpose: Utility function to return the VOL object pointer associated with
- * a hid_t.
+ * Purpose: Correctly retrieve the 'data' field for a VOL object (H5VL_object),
+ * even for nested / stacked VOL connectors.
*
- * Return: Success: object pointer
- * Failure: NULL
+ * Return: Success: object pointer
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
void *
-H5VL_object(hid_t id)
+H5VL_object_data(const H5VL_object_t *vol_obj)
{
- H5VL_object_t *vol_obj = NULL;
- void *ret_value = NULL;
+ void *ret_value = NULL;
- FUNC_ENTER_NOAPI(NULL)
-
- /* Get the symbol table entry */
- switch (H5I_get_type(id)) {
- case H5I_GROUP:
- case H5I_DATASET:
- case H5I_FILE:
- case H5I_ATTR:
- /* get the object */
- if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier");
-
- ret_value = vol_obj->data;
- break;
- case H5I_DATATYPE:
- {
- H5T_t *dt = NULL;
-
- /* get the object */
- if (NULL == (dt = (H5T_t *)H5I_object(id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier");
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
- /* Get the actual datatype object that should be the vol_obj */
- if (NULL == (vol_obj = H5T_get_named_type(dt)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype");
+ /* 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);
+ else
+ ret_value = vol_obj->data;
- ret_value = vol_obj->data;
- break;
- }
- case H5I_UNINIT:
- case H5I_BADID:
- case H5I_DATASPACE:
- case H5I_REFERENCE:
- case H5I_VFL:
- case H5I_VOL:
- case H5I_GENPROP_CLS:
- case H5I_GENPROP_LST:
- case H5I_ERROR_CLASS:
- case H5I_ERROR_MSG:
- case H5I_ERROR_STACK:
- case H5I_NTYPES:
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type");
- }
-done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_object() */
+} /* end H5VL_object_data() */
/*-------------------------------------------------------------------------
- * Function: H5VL_object_verify
+ * Function: H5VL__object
*
- * Purpose: Utility function to return the VOL object pointer associated
- * with an identifier.
+ * Purpose: Internal function to return the VOL object pointer associated
+ * with an hid_t.
*
* Return: Success: object pointer
* Failure: NULL
*
*-------------------------------------------------------------------------
*/
-void *
-H5VL_object_verify(hid_t id, H5I_type_t obj_type)
+static void *
+H5VL__object(hid_t id, H5I_type_t obj_type)
{
H5VL_object_t *vol_obj = NULL;
void *ret_value = NULL;
- FUNC_ENTER_NOAPI(NULL)
+ FUNC_ENTER_STATIC
- /* Get the symbol table entry */
- switch (obj_type) {
+ /* Get the underlying object */
+ switch(obj_type) {
case H5I_GROUP:
case H5I_DATASET:
case H5I_FILE:
case H5I_ATTR:
/* get the object */
- if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(id, obj_type)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier");
-
- ret_value = vol_obj->data;
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier")
break;
+
case H5I_DATATYPE:
{
H5T_t *dt = NULL;
/* get the object */
- if (NULL == (dt = (H5T_t *)H5I_object_verify(id, obj_type)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier");
+ if (NULL == (dt = (H5T_t *)H5I_object(id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier")
/* Get the actual datatype object that should be the vol_obj */
if (NULL == (vol_obj = H5T_get_named_type(dt)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype");
-
- ret_value = vol_obj->data;
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype")
break;
}
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_DATASPACE:
- case H5I_REFERENCE:
case H5I_VFL:
case H5I_VOL:
case H5I_GENPROP_CLS:
@@ -656,1613 +806,311 @@ H5VL_object_verify(hid_t id, H5I_type_t obj_type)
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type")
- }
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_object_verify() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_driver_data
- *
- * Purpose: Get the VOL-specific data stored in a VOL object
- *
- * Return: Success: Pointer to the data
- *
- * Failure: NULL (technically can't fail)
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VL_driver_data(H5VL_object_t *vol_obj)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- HDassert(vol_obj);
-
- FUNC_LEAVE_NOAPI(vol_obj->data)
-} /* end H5VL_driver_data() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_attr_create
- *
- * Purpose: Creates an attribute through the VOL
- *
- * Return: Success: pointer to the new attribute
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name,
- hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
-{
- void *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* check if the corresponding VOL create callback exists */
- if (NULL == cls->attr_cls.create)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'attr create' method")
-
- /* call the corresponding VOL create callback */
- if (NULL == (ret_value = (cls->attr_cls.create)
- (obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_attr_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_attr_open
- *
- * Purpose: Opens an attribute through the VOL
- *
- * Return: Success: pointer to the new attr.
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name,
- hid_t aapl_id, hid_t dxpl_id, void **req)
-{
- void *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* check if the type specific corresponding VOL open callback exists */
- if(NULL == cls->attr_cls.open)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'attr open' method")
-
- /* call the corresponding VOL open callback */
- if(NULL == (ret_value = (cls->attr_cls.open)
- (obj, loc_params, name, aapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_attr_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_attr_read
- *
- * Purpose: Reads data from attr through the VOL
- *
- * Return: Success: Non Negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t H5VL_attr_read(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, void *buf,
- hid_t dxpl_id, void **req)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->attr_cls.read)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr read' method")
- if((ret_value = (cls->attr_cls.read)(attr, mem_type_id, buf, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "read failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_attr_read() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_attr_write
- *
- * Purpose: Writes data to attr through the VOL
- *
- * Return: Success: Non Negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t H5VL_attr_write(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf,
- hid_t dxpl_id, void **req)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->attr_cls.write)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr write' method")
- if((ret_value = (cls->attr_cls.write)(attr, mem_type_id, buf, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "write failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_attr_write() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_attr_get
- *
- * Purpose: Get specific information about the attribute through the VOL
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type,
- hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->attr_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr get' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_attr_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_attr_specific
- *
- * Purpose: specific operation on attributes through the VOL
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->attr_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr specific' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_attr_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_attr_optional
- *
- * Purpose: optional operation specific to drivers.
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->attr_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr optional' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_attr_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_attr_close
- *
- * Purpose: Closes an attribute through the VOL
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_attr_close(void *attr, const H5VL_class_t *cls, hid_t dxpl_id, void **req)
-{
- herr_t ret_value = SUCCEED;
-
- HDassert(attr);
- HDassert(cls);
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check if the corresponding VOL callback exists */
- if (NULL == cls->attr_cls.close)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr close' method");
+ } /* end switch */
- /* Call the corresponding VOL callback */
- if ((ret_value = (cls->attr_cls.close)(attr, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed");
+ /* Set the return value */
+ ret_value = H5VL_object_data(vol_obj);
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_attr_close() */
+} /* end H5VL__object() */
/*-------------------------------------------------------------------------
- * Function: H5VL_dataset_create
- *
- * Purpose: Creates a dataset through the VOL
+ * Function: H5VL_object
*
- * Return: Success: pointer to dataset
+ * Purpose: Utility function to return the VOL object pointer associated with
+ * a hid_t.
*
- * Failure: NULL
+ * Return: Success: object pointer
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
void *
-H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name,
- hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
+H5VL_object(hid_t id)
{
- void *ret_value; /* Return value */
+ void *ret_value = NULL;
FUNC_ENTER_NOAPI(NULL)
- /* check if the corresponding VOL create callback exists */
- if(NULL == cls->dataset_cls.create)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'dataset create' method")
-
- /* call the corresponding VOL create callback */
- if(NULL == (ret_value = (cls->dataset_cls.create)
- (obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed")
+ /* Get the underlying object */
+ if(NULL == (ret_value = H5VL__object(id, H5I_get_type(id))))
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_dataset_create() */
+} /* end H5VL_object() */
/*-------------------------------------------------------------------------
- * Function: H5VL_dataset_open
- *
- * Purpose: Opens a dataset through the VOL
+ * Function: H5VL_object_verify
*
- * Return: Success: pointer to dataset
+ * Purpose: Utility function to return the VOL object pointer associated
+ * with an identifier.
*
- * Failure: NULL
+ * Return: Success: object pointer
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
void *
-H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name,
- hid_t dapl_id, hid_t dxpl_id, void **req)
+H5VL_object_verify(hid_t id, H5I_type_t obj_type)
{
- void *ret_value; /* Return value */
+ void *ret_value = NULL;
FUNC_ENTER_NOAPI(NULL)
- /* check if the type specific corresponding VOL open callback exists */
- if(NULL == cls->dataset_cls.open)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'dset open' method")
-
- /* call the corresponding VOL open callback */
- if(NULL == (ret_value = (cls->dataset_cls.open)
- (obj, loc_params, name, dapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_dataset_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_dataset_read
- *
- * Purpose: Reads data from dataset through the VOL
-*
- * Return: Success: Non Negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t plist_id, void *buf, void **req)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->dataset_cls.read)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset read' method")
- if((ret_value = (cls->dataset_cls.read)
- (dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "read failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_dataset_read() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_dataset_write
- *
- * Purpose: Writes data from dataset through the VOL
- *
- * Return: Success: Non Negative
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_dataset_write(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t plist_id, const void *buf, void **req)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->dataset_cls.write)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset write' method")
- if((ret_value = (cls->dataset_cls.write)
- (dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_dataset_write() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_dataset_get
- *
- * Purpose: Get specific information about the dataset through the VOL
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_dataset_get(void *dset, const H5VL_class_t *cls, H5VL_dataset_get_t get_type,
- hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->dataset_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset get' method")
+ /* Check of ID of correct type */
+ if(obj_type != H5I_get_type(id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier")
- va_start (arguments, req);
- if((ret_value = (cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
- va_end (arguments);
+ /* Get the underlying object */
+ if(NULL == (ret_value = H5VL__object(id, obj_type)))
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_dataset_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_dataset_specific
- *
- * Purpose: specific operation on datasets through the VOL
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type,
- hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->dataset_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset specific' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->dataset_cls.specific)
- (obj, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_dataset_specific() */
+} /* end H5VL_object_verify() */
/*-------------------------------------------------------------------------
- * Function: H5VL_dataset_optional
- *
- * Purpose: optional operation specific to drivers.
+ * Function: H5VL_cmp_connector_cls
*
- * Return: Success: non negative
+ * Purpose: Compare VOL class for a connector
*
- * Failure: negative
+ * Return: Positive if VALUE1 is greater than VALUE2, negative if
+ * VALUE2 is greater than VALUE1 and zero if VALUE1 and
+ * VALUE2 are equal.
*
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...)
+H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_class_t *cls2)
{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if(NULL == cls->dataset_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset optional' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback")
- va_end (arguments);
+ /* Sanity checks */
+ HDassert(cls1);
+ HDassert(cls2);
+
+ /* Compare connector "values" */
+ if(cls1->value < cls2->value) {
+ *cmp_value = -1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ if(cls1->value > cls2->value) {
+ *cmp_value = 1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ HDassert(cls1->value == cls2->value);
+
+ /* Compare connector names */
+ if(cls1->name == NULL && cls2->name != NULL) {
+ *cmp_value = -1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ if(cls1->name != NULL && cls2->name == NULL) {
+ *cmp_value = 1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ if(0 != (*cmp_value = HDstrcmp(cls1->name, cls2->name)))
+ HGOTO_DONE(SUCCEED)
+
+ /* Compare connector VOL API versions */
+ if(cls1->version < cls2->version) {
+ *cmp_value = -1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ if(cls1->version > cls2->version) {
+ *cmp_value = 1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ HDassert(cls1->version == cls2->version);
+
+ /* Compare connector info */
+ if(cls1->info_size < cls2->info_size) {
+ *cmp_value = -1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ if(cls1->info_size > cls2->info_size) {
+ *cmp_value = 1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ HDassert(cls1->info_size == cls2->info_size);
+
+ /* Set comparison value to 'equal' */
+ *cmp_value = 0;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_dataset_optional() */
+} /* end H5VL_cmp_connector_cls() */
/*-------------------------------------------------------------------------
- * Function: H5VL_dataset_close
+ * Function: H5VL_set_vol_wrapper
*
- * Purpose: Closes a dataset through the VOL
+ * Purpose: Set up object wrapping context for current VOL connector
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED / FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_dataset_close(void *dset, const H5VL_class_t *cls, hid_t dxpl_id, void **req)
+H5VL_set_vol_wrapper(void *obj, const H5VL_t *connector)
{
- herr_t ret_value = SUCCEED;
+ H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */
+ void *obj_wrap_ctx = NULL; /* VOL connector's wrapping context */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- HDassert(dset);
- HDassert(cls);
-
- /* Check if the corresponding VOL callback exists */
- if (NULL == cls->dataset_cls.close)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dset close' method");
-
- /* Call the corresponding VOL callback */
- if ((ret_value = (cls->dataset_cls.close)(dset, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed");
-
-done:
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_dataset_close() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_file_create
- *
- * Purpose: Creates a file through the VOL
- *
- * Return: Success: pointer to file.
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-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)
-{
- void *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* check if the corresponding VOL create callback exists */
- if(NULL == cls->file_cls.create)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'file create' method")
- /* call the corresponding VOL create callback */
- if(NULL == (ret_value = (cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_file_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_file_open
- *
- * Purpose: Opens a file through the VOL.
- *
- * Return: Success: pointer to file.
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id,
- hid_t dxpl_id, void **req)
-{
- void *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
+ /* Sanity checks */
+ HDassert(obj);
+ HDassert(connector);
+
+ /* Retrieve the VOL object wrap context */
+ if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context")
+
+ /* 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) {
+ /* Sanity check */
+ HDassert(connector->cls->free_wrap_ctx);
+
+ /* Get the wrap context from the connector */
+ if((connector->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 */
+
+ /* Allocate VOL object wrapper context */
+ if(NULL == (vol_wrap_ctx = H5FL_MALLOC(H5VL_wrap_ctx_t)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate VOL wrap context")
+
+ /* Set up VOL object wrapper context */
+ vol_wrap_ctx->rc = 1;;
+ vol_wrap_ctx->connector = connector;
+ vol_wrap_ctx->obj_wrap_ctx = obj_wrap_ctx;
+ } /* end if */
+ else
+ /* Incremeent ref count on existing wrapper context */
+ vol_wrap_ctx->rc++;
- /* check if the corresponding VOL create callback exists */
- if(NULL == cls->file_cls.open)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'file open' method")
- /* call the corresponding VOL create callback */
- if(NULL == (ret_value = (cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed")
+ /* Save the wrapper context */
+ if(H5CX_set_vol_wrap_ctx(vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context")
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_file_open() */
+ if(ret_value < 0 && vol_wrap_ctx)
+ /* Release object wrapping context */
+ H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx);
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_file_get
- *
- * Purpose: Get specific information about the file through the VOL
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type,
- hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->file_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file get' method")
-
- va_start(arguments, req);
- if((ret_value = (cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
- va_end(arguments);
-
-done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_file_get() */
+} /* end H5VL_set_vol_wrapper() */
/*-------------------------------------------------------------------------
- * Function: H5VL_file_specific
+ * Function: H5VL_reset_vol_wrapper
*
- * Purpose: perform File specific operations through the VOL
+ * Purpose: Reset object wrapping context for current VOL connector
*
- * Return: Success: non negative
- * Failure: negative
+ * Return: SUCCEED / FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t specific_type,
- hid_t dxpl_id, void **req, ...)
+H5VL_reset_vol_wrapper(void)
{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
+ H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if(specific_type == H5VL_FILE_IS_ACCESSIBLE) {
- H5P_genplist_t *plist; /* Property list pointer */
- H5VL_driver_prop_t driver_prop; /* Property for VOL driver ID & info */
- va_list tmp_args; /* argument list passed from the API call */
- hid_t fapl_id;
-
- va_start (tmp_args, req);
- fapl_id = va_arg (tmp_args, hid_t);
- va_end (tmp_args);
-
- /* get the VOL info from the fapl */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
-
- if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL driver info")
-
- if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
-
- va_start (arguments, req);
- if((ret_value = (cls->file_cls.specific)
- (file, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed")
- va_end (arguments);
- }
+ /* Retrieve the VOL object wrap context */
+ if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context")
+
+ /* Check for VOL object wrap context */
+ if(NULL == vol_wrap_ctx)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "no VOL object wrap context?")
+
+ /* Decrement ref count on wrapping context */
+ vol_wrap_ctx->rc--;
+
+ /* Release context if the ref count drops to zero */
+ if(0 == vol_wrap_ctx->rc) {
+ /* 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release connector's object wrapping context")
+ } /* end if */
+
+ /* Release object wrapping context */
+ H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx);
+
+ /* Reset the wrapper context */
+ if(H5CX_set_vol_wrap_ctx(NULL) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context")
+ } /* end if */
else {
- if(NULL == cls->file_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file specific' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->file_cls.specific)
- (file, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed")
- va_end (arguments);
- }
+ /* Save the updated wrapper context */
+ if(H5CX_set_vol_wrap_ctx(vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context")
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_file_specific() */
+} /* end H5VL_reset_vol_wrapper() */
/*-------------------------------------------------------------------------
- * Function: H5VL_file_optional
+ * Function: H5VL_wrap_register
*
- * Purpose: perform a driver specific operation
+ * Purpose: Wrap an object and register an ID for it
*
- * Return: Success: non negative
- * Failure: negative
+ * Return: SUCCEED / FAIL
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5VL_file_optional(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->file_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file optional' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "optional failed")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_file_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_file_close
- *
- * Purpose: Closes a file through the VOL
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(file);
- HDassert(cls);
-
- /* Check if the corresponding VOL callback exists */
- if (NULL == cls->file_cls.close)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file close' method");
-
- /* Call the corresponding VOL callback */
- if ((ret_value = (cls->file_cls.close)(file, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "close failed");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_file_close() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_group_create
- *
- * Purpose: Creates a group through the VOL
- *
- * Return: Success: pointer to new group.
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name,
- hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
-{
- void *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* check if the corresponding VOL create callback exists */
- if(NULL == cls->group_cls.create)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'group create' method")
-
- /* call the corresponding VOL create callback */
- if(NULL == (ret_value = (cls->group_cls.create)
- (obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_group_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_group_open
- *
- * Purpose: Opens a group through the VOL
- *
- * Return: Success: pointer to new group.
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name,
- hid_t gapl_id, hid_t dxpl_id, void **req)
-{
- void *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- if(NULL == cls->group_cls.open)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'group open' method")
-
- if(NULL == (ret_value = (cls->group_cls.open)
- (obj, loc_params, name, gapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_group_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_group_get
- *
- * Purpose: Get specific information about the group through the VOL
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type,
- hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->group_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group get' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->group_cls.get)
- (obj, get_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_group_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_group_specific
- *
- * Purpose: specific operation on groups through the VOL
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type,
- hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->group_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group specific' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->group_cls.specific)
- (obj, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_group_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_group_optional
- *
- * Purpose: optional operation specific to drivers.
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->group_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group optional' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_group_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_group_close
- *
- * Purpose: Closes a group through the VOL
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req)
-{
- herr_t ret_value = SUCCEED;
-
- HDassert(grp);
- HDassert(cls);
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check if the corresponding VOL callback exists */
- if (NULL == cls->group_cls.close)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group close' method");
-
- /* Call the corresponding VOL callback */
- if ((ret_value = (cls->group_cls.close)(grp, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_group_close() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_link_create
- *
- * Purpose: Creates a hard link through the VOL
- *
- * Return: Non-negative on success/Negative on failure
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params,
- const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* check if the corresponding VOL create callback exists */
- if(NULL == cls->link_cls.create)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link create' method")
- /* call the corresponding VOL create callback */
- if((ret_value = (cls->link_cls.create)
- (create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link create failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_link_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_link_copy
- *
- * Purpose: Copys a link from src to dst.
- *
- * Return: Non-negative on success/Negative on failure
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj,
- H5VL_loc_params_t loc_params2, const H5VL_class_t *cls,
- hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* check if the corresponding VOL copy callback exists */
- if(NULL == cls->link_cls.copy)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link copy' method")
-
- /* call the corresponding VOL copy callback */
- if((ret_value = (cls->link_cls.copy)
- (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id,
- lapl_id, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link copy failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_link_copy() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_link_move
- *
- * Purpose: Moves a link from src to dst.
- *
- * Return: Non-negative on success/Negative on failure
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj,
- H5VL_loc_params_t loc_params2, const H5VL_class_t *cls,
- hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* check if the corresponding VOL move callback exists */
- if(NULL == cls->link_cls.move)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link move' method")
-
- /* call the corresponding VOL move callback */
- if((ret_value = (cls->link_cls.move)
- (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id,
- lapl_id, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link move failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_link_move() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_link_get
- *
- * Purpose: Get specific information about the link through the VOL
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type,
- hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->link_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link get' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->link_cls.get)
- (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_link_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_link_specific
- *
- * Purpose: specific operation on links through the VOL
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->link_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link specific' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->link_cls.specific)
- (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_link_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_link_optional
- *
- * Purpose: optional operation specific to drivers.
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->link_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link optional' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_link_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_object_open
- *
- * Purpose: Opens a object through the VOL
- *
- * Return: Success: User ID of the new object.
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VL_object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, H5I_type_t *opened_type,
- hid_t dxpl_id, void **req)
-{
- void *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* check if the corresponding VOL open callback exists */
- if(NULL == cls->object_cls.open)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'object open' method")
-
- /* call the corresponding VOL open callback */
- if(NULL == (ret_value = (cls->object_cls.open)
- (obj, params, opened_type, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_object_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_object_copy
- *
- * Purpose: Copies an object to another destination through the VOL
- *
- * Return: Success: Non Negative
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const H5VL_class_t *cls1, const char *src_name,
- void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls2, const char *dst_name,
- hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Make sure that the VOL drivers are the same */
- if (cls1->value != cls2->value)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL drivers and can't be linked")
-
- if(NULL == cls1->object_cls.copy)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object copy' method")
-
- if((ret_value = (cls1->object_cls.copy)
- (src_obj, loc_params1, src_name, dst_obj, loc_params2, dst_name, ocpypl_id,
- lcpl_id, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "copy failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_object_copy() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_object_get
- *
- * Purpose: Get specific information about the object through the VOL
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_object_get_t get_type,
- hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->object_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object get' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->object_cls.get)
- (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_object_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_object_specific
- *
- * Purpose: specific operation on objects through the VOL
- *
- * Return: Success: non negative
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->object_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object specific' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->object_cls.specific)
- (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_object_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_object_optional
- *
- * Purpose: optional operation specific to drivers.
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->object_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object optional' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_object_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_datatype_commit
- *
- * Purpose: Commits a datatype to the file through the VOL
- *
- * Return: Success: Positive
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, 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)
-{
- void *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* check if the corresponding VOL commit callback exists */
- if(NULL == cls->datatype_cls.commit)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'datatype commit' method")
-
- /* call the corresponding VOL commit callback */
- if(NULL == (ret_value = (cls->datatype_cls.commit)
- (obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "commit failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_datatype_commit() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_datatype_open
- *
- * Purpose: Opens a named datatype through the VOL
- *
- * Return: Success: User ID of the datatype.
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name,
- hid_t tapl_id, hid_t dxpl_id, void **req)
-{
- void *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* check if the type specific corresponding VOL open callback exists */
- if(NULL == cls->datatype_cls.open)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback");
-
- /* call the corresponding VOL open callback */
- if(NULL == (ret_value = (cls->datatype_cls.open)
- (obj, loc_params, name, tapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_datatype_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_datatype_get
- *
- * Purpose: Get specific information about the datatype through the VOL
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type,
- hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check if the corresponding VOL callback exists */
- if (NULL == cls->datatype_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype get' method");
- va_start (arguments, req);
-
- /* Call the corresponding VOL callback */
- if ((ret_value = (cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed");
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_datatype_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_datatype_specific
- *
- * Purpose: specific operation on datatypes through the VOL
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type,
- hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->datatype_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype specific' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->datatype_cls.specific)
- (obj, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_datatype_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_datatype_optional
- *
- * Purpose: optional operation specific to drivers.
- *
- * Return: Success: non negative
- *
- * Failure: negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...)
-{
- va_list arguments; /* argument list passed from the API call */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if(NULL == cls->datatype_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype optional' method")
-
- va_start (arguments, req);
- if((ret_value = (cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback")
- va_end (arguments);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_datatype_optional() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_datatype_close
- *
- * Purpose: Closes a datatype through the VOL
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_datatype_close(void *dt, const H5VL_class_t *cls, hid_t dxpl_id, void **req)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check if the corresponding VOL callback exists */
- if (NULL == cls->datatype_cls.close)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype close' method");
-
- /* Call the corresponding VOL callback */
- if ((ret_value = (cls->datatype_cls.close)(dt, dxpl_id, req)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_datatype_close() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_request_cancel
- *
- * Purpose: Cancels an asynchronous request through the VOL
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(req);
- HDassert(cls);
- HDassert(status);
-
- /* Check if the corresponding VOL callback exists */
- if (NULL == cls->async_cls.cancel)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'async cancel' method");
-
- /* Call the corresponding VOL callback */
- if ((ret_value = (cls->async_cls.cancel)(req, status)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_request_cancel() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_request_test
- *
- * Purpose: Tests an asynchronous request through the VOL
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status)
+hid_t
+H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref)
{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
+ H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */
+ void *new_obj; /* Newly wrapped object */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- HDassert(req);
- HDassert(cls);
- HDassert(status);
-
- /* Check if the corresponding VOL callback exists */
- if (NULL == cls->async_cls.test)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'async test' method");
-
- /* Call the corresponding VOL callback */
- if ((ret_value = (cls->async_cls.test)(req, status)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request test failed");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_request_test() */
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_request_wait
- *
- * Purpose: Waits on an asychronous request through the VOL
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status)
-{
- herr_t ret_value = SUCCEED;
+ /* Sanity check */
+ HDassert(obj);
- FUNC_ENTER_NOAPI(FAIL)
+ /* If the datatype is already VOL-managed, the datatype's vol_obj
+ * field will get clobbered later, so disallow this.
+ */
+ if(type == H5I_DATATYPE)
+ if(TRUE == H5T_already_vol_managed((const H5T_t *)obj))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype")
- HDassert(req);
- HDassert(cls);
- HDassert(status);
+ /* Wrap the object with VOL connector info */
+ if(NULL == (new_obj = H5VL__wrap_obj(obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't wrap library object")
- /* Check if the corresponding VOL callback exists */
- if (NULL == cls->async_cls.wait)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'async wait' method");
+ /* Retrieve the VOL object wrapping context */
+ if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context")
+ if(NULL == vol_wrap_ctx || NULL == vol_wrap_ctx->connector)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "VOL object wrap context or its connector is NULL???")
- /* Call the corresponding VOL callback */
- if ((ret_value = (cls->async_cls.wait)(req, status)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed");
+ /* Get an ID for the object */
+ if((ret_value = H5VL_register_using_vol_id(type, new_obj, vol_wrap_ctx->connector->id, app_ref)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_request_wait() */
+} /* end H5VL_wrap_register() */
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index e71e08e..fe0fd4e 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -11,228 +11,142 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Purpose: The native VOL driver 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" /* VOL drivers */
-#include "H5VLnative_private.h" /* Native VOL driver */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+#include "H5VLnative_private.h" /* Native VOL connector */
-/*
- * The VOL driver identification number.
- */
-static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID;
+/* The VOL connector identification number */
+static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID;
/* Prototypes */
-static H5F_t *H5VL_native_get_file(void *obj, H5I_type_t type);
static herr_t H5VL__native_term(void);
-/* Atrribute callbacks */
-static void *H5VL_native_attr_create(void *obj, 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, 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, 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_close(void *attr, hid_t dxpl_id, void **req);
-
-/* Dataset callbacks */
-static void *H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
-static void *H5VL_native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL_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, 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, 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 *dset, H5VL_group_specific_t specific_type, 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,
- 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, H5VL_loc_params_t loc_params1,
- void *dst_obj, 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, H5VL_loc_params_t loc_params1,
- void *dst_obj, 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, 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, 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, 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, H5VL_loc_params_t loc_params1, const char *src_name,
- void *dst_obj, 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, 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, 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, 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, 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 driver class struct */
+/* Native VOL connector class struct */
static H5VL_class_t H5VL_native_cls_g = {
H5VL_NATIVE_VERSION, /* version */
H5VL_NATIVE_VALUE, /* value */
H5VL_NATIVE_NAME, /* name */
+ 0, /* capability flags */
NULL, /* initialize */
- NULL, /* terminate */
- (size_t)0, /* fapl size */
- NULL, /* fapl copy */
- NULL, /* fapl free */
+ 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 */
{ /* attribute_cls */
- H5VL_native_attr_create, /* create */
- H5VL_native_attr_open, /* open */
- H5VL_native_attr_read, /* read */
- H5VL_native_attr_write, /* write */
- H5VL_native_attr_get, /* get */
- H5VL_native_attr_specific, /* specific */
- NULL, /* optional */
- H5VL_native_attr_close /* close */
+ H5VL__native_attr_create, /* create */
+ H5VL__native_attr_open, /* open */
+ H5VL__native_attr_read, /* read */
+ H5VL__native_attr_write, /* write */
+ H5VL__native_attr_get, /* get */
+ H5VL__native_attr_specific, /* specific */
+ H5VL__native_attr_optional, /* optional */
+ H5VL__native_attr_close /* close */
},
{ /* dataset_cls */
- H5VL_native_dataset_create, /* create */
- H5VL_native_dataset_open, /* open */
- H5VL_native_dataset_read, /* read */
- H5VL_native_dataset_write, /* write */
- H5VL_native_dataset_get, /* get */
- H5VL_native_dataset_specific, /* specific */
- H5VL_native_dataset_optional, /* optional */
- H5VL_native_dataset_close /* close */
+ H5VL__native_dataset_create, /* create */
+ H5VL__native_dataset_open, /* open */
+ H5VL__native_dataset_read, /* read */
+ H5VL__native_dataset_write, /* write */
+ H5VL__native_dataset_get, /* get */
+ H5VL__native_dataset_specific, /* specific */
+ H5VL__native_dataset_optional, /* optional */
+ H5VL__native_dataset_close /* close */
},
{ /* datatype_cls */
- H5VL_native_datatype_commit, /* commit */
- H5VL_native_datatype_open, /* open */
- H5VL_native_datatype_get, /* get */
- H5VL_native_datatype_specific, /* specific */
+ H5VL__native_datatype_commit, /* commit */
+ H5VL__native_datatype_open, /* open */
+ H5VL__native_datatype_get, /* get */
+ H5VL__native_datatype_specific, /* specific */
NULL, /* optional */
- H5VL_native_datatype_close /* close */
+ H5VL__native_datatype_close /* close */
},
{ /* file_cls */
- H5VL_native_file_create, /* create */
- H5VL_native_file_open, /* open */
- H5VL_native_file_get, /* get */
- H5VL_native_file_specific, /* specific */
- H5VL_native_file_optional, /* optional */
- H5VL_native_file_close /* close */
+ H5VL__native_file_create, /* create */
+ H5VL__native_file_open, /* open */
+ H5VL__native_file_get, /* get */
+ H5VL__native_file_specific, /* specific */
+ H5VL__native_file_optional, /* optional */
+ H5VL__native_file_close /* close */
},
{ /* group_cls */
- H5VL_native_group_create, /* create */
- H5VL_native_group_open, /* open */
- H5VL_native_group_get, /* get */
- H5VL_native_group_specific, /* specific */
- NULL, /* optional */
- H5VL_native_group_close /* close */
+ H5VL__native_group_create, /* create */
+ H5VL__native_group_open, /* open */
+ H5VL__native_group_get, /* get */
+ H5VL__native_group_specific, /* specific */
+ H5VL__native_group_optional, /* optional */
+ H5VL__native_group_close /* close */
},
{ /* link_cls */
- H5VL_native_link_create, /* create */
- H5VL_native_link_copy, /* copy */
- H5VL_native_link_move, /* move */
- H5VL_native_link_get, /* get */
- H5VL_native_link_specific, /* specific */
+ H5VL__native_link_create, /* create */
+ H5VL__native_link_copy, /* copy */
+ H5VL__native_link_move, /* move */
+ H5VL__native_link_get, /* get */
+ H5VL__native_link_specific, /* specific */
NULL /* optional */
},
{ /* object_cls */
- H5VL_native_object_open, /* open */
- H5VL_native_object_copy, /* copy */
- H5VL_native_object_get, /* get */
- H5VL_native_object_specific, /* specific */
- H5VL_native_object_optional /* optional */
+ H5VL__native_object_open, /* open */
+ H5VL__native_object_copy, /* copy */
+ H5VL__native_object_get, /* get */
+ H5VL__native_object_specific, /* specific */
+ H5VL__native_object_optional /* optional */
},
- { /* async_cls */
+ { /* request_cls */
+ NULL, /* wait */
+ NULL, /* notify */
NULL, /* cancel */
- NULL, /* test */
- NULL /* wait */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* free */
},
NULL /* optional */
};
/*-------------------------------------------------------------------------
- * Function: H5VL_native_init
+ * Function: H5VL_native_register
*
- * Purpose: Initialize this VOL driver by registering it with the
- * library.
+ * Purpose: Register the native VOL connector and retrieve an ID for it.
*
- * Return: Success: The ID for the native driver
+ * Return: Success: The ID for the native connector
* Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
-H5VL_native_init(void)
+H5VL_native_register(void)
{
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
- /* Register the native VOL driver, if it isn't already */
- if(NULL == H5I_object_verify(H5VL_NATIVE_ID_g, H5I_VOL)) {
- if((H5VL_NATIVE_ID_g = H5VL_register_driver((const H5VL_class_t *)&H5VL_native_cls_g,
- sizeof(H5VL_class_t), TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL driver")
- }
+ /* Register the native VOL connector, if it isn't already */
+ if(NULL == H5I_object_verify(H5VL_NATIVE_ID_g, H5I_VOL))
+ if((H5VL_NATIVE_ID_g = H5VL_register_connector((const H5VL_class_t *)&H5VL_native_cls_g, TRUE, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL connector")
/* Set return value */
ret_value = H5VL_NATIVE_ID_g;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_init() */
-
-/* XXX (VOL_MERGE): TEMPORARY */
-hid_t
-H5VL_native_get_driver_id(void)
-{
- return H5VL_NATIVE_ID_g;
-}
+} /* end H5VL_native_register() */
/*---------------------------------------------------------------------------
@@ -249,3285 +163,9 @@ H5VL__native_term(void)
{
FUNC_ENTER_STATIC_NOERR
- /* Reset VFL ID */
+ /* Reset VOL ID */
H5VL_NATIVE_ID_g = H5I_INVALID_HID;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5VL__native_term() */
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_fapl_native
- *
- * Purpose: Modify the file access property list to use the H5VL_NATIVE
- * driver defined in this source file.
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_fapl_native(hid_t fapl_id)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value;
-
- FUNC_ENTER_API(FAIL)
- H5TRACE1("e", "i", fapl_id);
-
- if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
-
- ret_value = H5P_set_vol(plist, H5VL_NATIVE_ID_g, NULL);
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Pset_fapl_native() */
-
-
-/*---------------------------------------------------------------------------
- * Function: H5VL_native_get_file
- *
- * Purpose: Utility routine to get file struct for an object via the
- * native VOL driver.
- *
- * Returns: SUCCESS: A pointer to the H5F_t struct for the file
- * associated with the object.
- * FAILURE: NULL
- *
- *---------------------------------------------------------------------------
- */
-static H5F_t *
-H5VL_native_get_file(void *obj, H5I_type_t type)
-{
- H5F_t *ret_value = NULL; /* File pointer */
- H5O_loc_t *oloc = NULL; /* Object location for ID */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- switch(type) {
- case H5I_FILE:
- ret_value = (H5F_t *)obj;
- break;
- case H5I_GROUP:
- {
- H5G_t *grp;
- grp = (H5G_t *)obj;
- oloc = H5G_oloc(grp);
- break;
- }
- case H5I_DATATYPE:
- {
- H5T_t *dt;
- dt = (H5T_t *)obj;
- oloc = H5T_oloc(dt);
- break;
- }
- case H5I_DATASET:
- {
- H5D_t *dset;
- dset = (H5D_t *)obj;
- oloc = H5D_oloc(dset);
- break;
- }
-
- case H5I_ATTR:
- {
- H5A_t *attr;
- attr = (H5A_t *)obj;
- oloc = H5A_oloc(attr);
- break;
- }
- case H5I_UNINIT:
- case H5I_BADID:
- case H5I_DATASPACE:
- case H5I_REFERENCE:
- case H5I_VFL:
- case H5I_VOL:
- case H5I_GENPROP_CLS:
- case H5I_GENPROP_LST:
- case H5I_ERROR_CLASS:
- case H5I_ERROR_MSG:
- case H5I_ERROR_STACK:
- case H5I_NTYPES:
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
- }
-
- if(!ret_value) {
- if (!oloc)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "object is not assocated with a file")
- ret_value = oloc->file;
- }
- if(!ret_value)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "object is not associated with a file")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5VL_native_get_file */
-
-
-/*---------------------------------------------------------------------------
- * Function: H5VL_native_register
- *
- * Purpose: Utility routine to register an ID with the native VOL driver
- * as an auxilary object.
- *
- * Returns: Success: An ID for the object
- * Failure: H5I_INVALID_HID
- *
- *---------------------------------------------------------------------------
- */
-hid_t
-H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref)
-{
- hid_t ret_value = H5I_INVALID_HID;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(obj);
-
- /* If the datatype is already VOL-managed, the datatype's vol_obj
- * field will get clobbered later, so disallow this.
- */
- if(type == H5I_DATATYPE)
- if(((H5T_t *)obj)->vol_obj != NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can only get an ID for an uncommitted datatype")
-
- /* Get an ID for the object */
- if((ret_value = H5VL_register_using_vol_id(type, obj, H5VL_NATIVE_ID_g, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_register() */
-
-
-/*---------------------------------------------------------------------------
- * Function: H5VL_native_unregister
- *
- * Purpose: Utility routine to decrement ref count on Native VOL driver
- * objects.
- *
- * Returns: SUCCEED/FAIL
- *
- *---------------------------------------------------------------------------
- */
-herr_t
-H5VL_native_unregister(hid_t obj_id)
-{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* get the driver pointer */
- if(NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid ID")
-
- /* free object */
- if(H5VL_free_object(vol_obj) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_unregister() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_native_attr_create
- *
- * Purpose: Creates an attribute on an object.
- *
- * Return: Success: attr id.
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5VL_native_attr_create(void *obj, 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_NOAPI_NOINIT
-
- /* 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 driver 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")
- }
- 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")
- }
- 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 a attr inside a native h5 file.
- *
- * Return: Success: attr id.
- * Failure: NULL
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5VL_native_attr_open(void *obj, 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_NOAPI_NOINIT
-
- /* 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)
- }
- 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")
- }
- 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")
- }
- 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 in data from attribute.
- *
- * 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_NOAPI_NOINIT
-
- 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 out data to attribute.
- *
- * 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_NOAPI_NOINIT
-
- 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 certain 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_NOAPI_NOINIT
-
- 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:
- {
- H5VL_loc_params_t loc_params = va_arg(arguments, 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)
- HDONE_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:
- {
- H5VL_loc_params_t loc_params = va_arg(arguments, 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)
- HDONE_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)
- HDONE_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")
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_attr_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_native_attr_specific
- *
- * Purpose: Specific operations for attributes
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Mohamad Chaarawi
- * August, 2014
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL_native_attr_specific(void *obj, 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_NOAPI_NOINIT
-
- /* 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")
- /* XXX: Do I need to clean this up? */
-
- 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")
- }
- 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")
- }
- 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")
- }
- 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")
- }
- 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")
- }
- 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")
- }
- 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");
- }
- 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")
- }
- 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")
- }
- else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute rename parameters")
- break;
- }
- default:
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
- }
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_attr_specific() */
-
-
-/*-------------------------------------------------------------------------
- * 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_NOAPI_NOINIT
-
- 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, 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_NOAPI_NOINIT
-
- /* 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")
- }
- /* 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")
- }
- 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")
- }
- }
- 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, 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_NOAPI_NOINIT
-
- 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_NOAPI_NOINIT
-
- /* 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_NOAPI_NOINIT
-
- /* 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_NOAPI_NOINIT
-
- 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")
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_dataset_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_native_dataset_specific
- *
- * Purpose: Specific operations for datasets
- *
- * 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_NOAPI_NOINIT
-
- 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")
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_dataset_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_native_dataset_optional
- *
- * Purpose: Perform a driver 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_NOAPI_NOINIT
-
- 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")
- }
-
-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_NOAPI_NOINIT
-
- 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_NOAPI_NOINIT
-
- /* 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_NOAPI_NOINIT
-
- /* 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: Gets certain data 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_NOAPI_NOINIT
-
- 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;
- }
- 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;
- }
-
- 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 = H5VL_native_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';
- }
-
- /* Set the return value for the API call */
- *ret = (ssize_t)len;
- break;
- }
- /* H5Iget_file_id */
- case H5VL_OBJECT_GET_FILE:
- {
- H5I_type_t type = va_arg(arguments, H5I_type_t);
- void **ret = va_arg(arguments, void **);
-
- if(NULL == (f = H5VL_native_get_file(obj, type)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- f->id_exists = TRUE;
- *ret = (void*)f;
- 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: Perform an operation
- *
- * 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_NOAPI_NOINIT
-
- 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 = H5VL_native_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")
- }
- 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")
- }
- }
- 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;
- }
- default:
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_file_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_native_file_optional
- *
- * Purpose: Perform a driver 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_NOAPI_NOINIT
-
- 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 *);
-
- f = (H5F_t *)obj;
-
- /* 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 );
-
- f = (H5F_t *)obj;
- /* 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 *);
-
- f = (H5F_t *)obj;
- /* 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);
-
- f = (H5F_t *)obj;
- /* 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 = H5VL_native_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 *);
-
- f = (H5F_t *)obj;
- /* 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 *);
-
- f = (H5F_t *)obj;
- /* 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;
-
- f = (H5F_t *)obj;
- /* 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);
-
- f = (H5F_t *)obj;
-
- /* 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;
- }
- /* H5Fclear_elink_file_cache */
- case H5VL_FILE_CLEAR_ELINK_CACHE:
- {
- f = (H5F_t *)obj;
-
- /* 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;
- }
- /* H5Freopen */
- case H5VL_FILE_REOPEN:
- {
- void **ret = va_arg(arguments, void **);
- H5F_t *new_file = NULL;
-
- f = (H5F_t *)obj;
-
- /* Reopen the file through the VOL driver */
- if(NULL == (new_file = H5F__reopen(f)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file")
-
- new_file->id_exists = TRUE;
-
- *ret = (void *)new_file;
- break;
- }
- /* H5Freset_mdc_hit_rate_stats */
- case H5VL_FILE_RESET_MDC_HIT_RATE:
- {
- f = (H5F_t *)obj;
- /* 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 *);
-
- f = (H5F_t *)obj;
- /* 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 *);
-
- f = (H5F_t *)obj;
-
- 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:
- {
- f = (H5F_t *)obj;
-
- 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:
- {
- f = (H5F_t *)obj;
-
- /* 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:
- {
- f = (H5F_t *)obj;
-
- /* 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 *);
-
- f = (H5F_t *)obj;
-
- /* 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_SET_LATEST_FORMAT:
- {
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
- break;
- }
- case H5VL_FILE_FORMAT_CONVERT:
- {
- f = (H5F_t *)obj;
-
- /* 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:
- {
- f = (H5F_t *)obj;
-
- /* 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 *);
-
- f = (H5F_t *)obj;
-
- /* 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:
- {
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
- break;
- }
-
- default:
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
- }
-
-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_NOAPI_NOINIT
-
- /* 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")
- }
-
- /* 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, 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_NOAPI_NOINIT
-
- /* 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")
- }
- /* 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")
- }
- 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")
- }
- }
- 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, 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_NOAPI_NOINIT
-
- /* 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: Gets data 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_NOAPI_NOINIT
-
- 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:
- {
- H5VL_loc_params_t loc_params = va_arg(arguments, 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")
- }
- 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")
- }
- 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")
- }
- 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")
- }
-
-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_NOAPI_NOINIT
-
- 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")
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_group_specific() */
-
-
-/*-------------------------------------------------------------------------
- * 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_NOAPI_NOINIT
-
- 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, 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_NOAPI_NOINIT
-
- /* 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")
- }
- 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")
- }
- 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")
- }
-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, H5VL_loc_params_t loc_params1,
- void *dst_obj, 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_NOAPI_NOINIT
-
- 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, H5VL_loc_params_t loc_params1,
- void *dst_obj, 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_NOAPI_NOINIT
-
- 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: Gets certain data about a link
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Mohamad Chaarawi
- * April, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL_native_link_get(void *obj, 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_NOAPI_NOINIT
-
- 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")
- }
- 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")
- }
- 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")
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_link_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_native_link_specific
- *
- * Purpose: Specific operations with links
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Mohamad Chaarawi
- * April, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL_native_link_specific(void *obj, 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_NOAPI_NOINIT
-
- 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")
- }
- 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")
- }
- }
- 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")
- }
- 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")
- }
- }
- 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")
- }
- 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")
- }
- else
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
- break;
- }
- default:
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_link_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_native_object_open
- *
- * Purpose: Opens a 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, 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_NOAPI_NOINIT
-
- 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)))
- HDONE_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")
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_object_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_native_object_copy
- *
- * Purpose: Copys a object inside a native h5 file.
- *
- * Return: Success: object id.
- * Failure: NULL
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL_native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name,
- void *dst_obj, 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_NOAPI_NOINIT
-
- /* 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")
-
- /* Open 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, 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_NOAPI_NOINIT
-
- 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;
- }
- default:
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object")
- }
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_object_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_native_object_specific
- *
- * Purpose: Perform a driver specific operation for an objectibute
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL_native_object_specific(void *obj, 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_NOAPI_NOINIT
-
- 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)
- }
- 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")
- }
- 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")
- }
- 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")
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_object_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_native_object_optional
- *
- * Purpose: Perform a driver 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_NOAPI_NOINIT
-
- 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")
- }
- 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")
- }
- 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")
- }
-
- /* Release the object location */
- if(H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
- }
- else {
- HGOTO_ERROR(H5E_VOL, 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")
- }
- 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")
- }
- 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")
- }
- 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")
- }
- 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");
- }
-
-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, 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_NOAPI_NOINIT
-
- /* 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")
- }
- 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")
- }
- 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, 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_NOAPI_NOINIT
-
- 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: Gets certain 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_NOAPI_NOINIT
-
- 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")
- }
-
-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_NOAPI_NOINIT
-
- 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")
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_datatype_specific() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_native_datatype_close
- *
- * Purpose: Closes an 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_NOAPI_NOINIT
-
- 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 832c758..916151b 100644
--- a/src/H5VLnative.h
+++ b/src/H5VLnative.h
@@ -11,26 +11,85 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Purpose: The public header file for the native VOL driver.
+ * Purpose: The public header file for the native VOL connector.
*/
#ifndef _H5VLnative_H
#define _H5VLnative_H
-/* Characteristics of the native VOL driver */
+/* Identifier for the native VOL connector */
+#define H5VL_NATIVE (H5VL_native_register())
+
+/* Characteristics of the native VOL connector */
#define H5VL_NATIVE_NAME "native"
#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 */
+
+/* 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
-H5_DLL herr_t H5Pset_fapl_native(hid_t fapl_id);
+/* Private functions */
+H5_DLL hid_t H5VL_native_register(void);
#ifdef __cplusplus
}
#endif
#endif /* _H5VLnative_H */
+
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..994af16
--- /dev/null
+++ b/src/H5VLnative_file.c
@@ -0,0 +1,811 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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_LOGFAIL, 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_LOGFAIL, 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_LOGFAIL, 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;
+ }
+
+ 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
index 79a6e1c..1bf4da2 100644
--- a/src/H5VLnative_private.h
+++ b/src/H5VLnative_private.h
@@ -11,30 +11,78 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Purpose: The private header file for the native VOL driver.
+ * Purpose: The private header file for the native VOL connector.
*/
#ifndef _H5VLnative_private_H
#define _H5VLnative_private_H
-/* Include driver's public header */
-#include "H5VLnative.h"
-
-/* Initializer function for native VOL driver */
-#define H5VL_NATIVE (H5VL_native_init())
-
+#include "H5VLnative.h" /* Native VOL connector */
#ifdef __cplusplus
extern "C" {
#endif
-H5_DLL hid_t H5VL_native_get_driver_id(void);
-H5_DLL hid_t H5VL_native_init(void);
-H5_DLL hid_t H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref);
-H5_DLL herr_t H5VL_native_unregister(hid_t obj_id);
+/* 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
new file mode 100644
index 0000000..8b83e2e
--- /dev/null
+++ b/src/H5VLpassthru.c
@@ -0,0 +1,2702 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: 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.
+ */
+
+
+/* Header files needed */
+/* (Public HDF5 and standard C / POSIX only) */
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "hdf5.h"
+#include "H5VLpassthru.h"
+
+
+/**********/
+/* Macros */
+/**********/
+
+/* Whether to display log messge when callback is invoked */
+/* (Uncomment to enable) */
+/* #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 */
+/************/
+
+/* The pass through VOL info object */
+typedef struct H5VL_pass_through_t {
+ hid_t under_vol_id; /* ID for underlying VOL connector */
+ void *under_object; /* Info object for underlying VOL connector */
+} H5VL_pass_through_t;
+
+/* The pass through VOL wrapper context */
+typedef struct H5VL_pass_through_wrap_ctx_t {
+ hid_t under_vol_id; /* VOL ID for under VOL */
+ void *under_wrap_ctx; /* Object wrapping context for under VOL */
+} H5VL_pass_through_wrap_ctx_t;
+
+
+/********************* */
+/* Function prototypes */
+/********************* */
+
+/* Helper routines */
+static herr_t H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id,
+ H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...);
+static herr_t H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id,
+ H5VL_request_specific_t specific_type, ...);
+static H5VL_pass_through_t *H5VL_pass_through_new_obj(void *under_obj,
+ hid_t under_vol_id);
+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);
+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);
+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);
+
+/* 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);
+static void *H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_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_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req);
+
+/* Dataset callbacks */
+static void *H5VL_pass_through_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_pass_through_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_pass_through_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_pass_through_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_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req);
+
+/* Datatype callbacks */
+static void *H5VL_pass_through_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_pass_through_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_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_datatype_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req);
+
+/* File callbacks */
+static void *H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
+static void *H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req);
+
+/* Group callbacks */
+static void *H5VL_pass_through_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_pass_through_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_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req);
+
+/* Link callbacks */
+static herr_t H5VL_pass_through_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_pass_through_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_pass_through_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_pass_through_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_pass_through_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);
+static herr_t H5VL_pass_through_link_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Object callbacks */
+static void *H5VL_pass_through_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_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_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_pass_through_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_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Async request callbacks */
+static herr_t H5VL_pass_through_request_wait(void *req, uint64_t timeout, H5ES_status_t *status);
+static herr_t H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx);
+static herr_t H5VL_pass_through_request_cancel(void *req);
+static herr_t H5VL_pass_through_request_specific(void *req, H5VL_request_specific_t specific_type, va_list arguments);
+static herr_t H5VL_pass_through_request_optional(void *req, va_list arguments);
+static herr_t H5VL_pass_through_request_free(void *req);
+
+/*******************/
+/* Local variables */
+/*******************/
+
+/* Pass through VOL connector class struct */
+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 */
+ 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 */
+ { /* 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 */
+ },
+ { /* 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 */
+ },
+ { /* 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 */
+ },
+ { /* 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 */
+ },
+ { /* 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 */
+ },
+ { /* 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 */
+ },
+ { /* 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 */
+ },
+ NULL /* optional */
+};
+
+/* The connector identification number, initialized at runtime */
+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
+ *
+ * Return: Success: Pointer to the new pass through object
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Monday, December 3, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5VL_pass_through_t *
+H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id)
+{
+ H5VL_pass_through_t *new_obj;
+
+ new_obj = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t));
+ new_obj->under_object = under_obj;
+ new_obj->under_vol_id = under_vol_id;
+ H5Iinc_ref(new_obj->under_vol_id);
+
+ return new_obj;
+} /* end H5VL__pass_through_new_obj() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__pass_through_free_obj
+ *
+ * Purpose: Release a pass through object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Monday, December 3, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_free_obj(H5VL_pass_through_t *obj)
+{
+ H5Idec_ref(obj->under_vol_id);
+ free(obj);
+
+ 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.
+ *
+ * Return: Success: The ID for the pass-through VOL connector
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, November 28, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL_pass_through_register(void)
+{
+ /* Clear the error stack */
+ H5Eclear2(H5E_DEFAULT);
+
+ /* Singleton register the pass-through VOL connector ID */
+ if(H5I_VOL != H5Iget_type(H5VL_PASSTHRU_g))
+ H5VL_PASSTHRU_g = H5VLregister_connector(&H5VL_pass_through_g, H5P_DEFAULT);
+
+ return H5VL_PASSTHRU_g;
+} /* end H5VL_pass_through_register() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_init
+ *
+ * Purpose: Initialize this VOL connector, performing any necessary
+ * operations for the connector that will apply to all containers
+ * accessed with the connector.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_init(hid_t vipl_id)
+{
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL INIT\n");
+#endif
+
+ /* Shut compiler up about unused parameter */
+ vipl_id = vipl_id;
+
+ return 0;
+} /* end H5VL_pass_through_init() */
+
+
+/*---------------------------------------------------------------------------
+ * 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).
+ *
+ * Return: Success: 0
+ * Failure: (Can't fail)
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_term(void)
+{
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL TERM\n");
+#endif
+
+ /* Reset VOL ID */
+ H5VL_PASSTHRU_g = H5I_INVALID_HID;
+
+ return 0;
+} /* end H5VL_pass_through_term() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_info_copy
+ *
+ * Purpose: Duplicate the connector's info object.
+ *
+ * Returns: Success: New connector info object
+ * Failure: NULL
+ *
+ *---------------------------------------------------------------------------
+ */
+static void *
+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_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL INFO Copy\n");
+#endif
+
+ /* Allocate new VOL info struct for the pass through connector */
+ new_info = (H5VL_pass_through_info_t *)calloc(1, sizeof(H5VL_pass_through_info_t));
+
+ /* Increment reference count on underlying VOL ID, and copy the VOL info */
+ new_info->under_vol_id = info->under_vol_id;
+ H5Iinc_ref(new_info->under_vol_id);
+ 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;
+} /* end H5VL_pass_through_info_copy() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_info_cmp
+ *
+ * Purpose: Compare two of the connector's info objects, setting *cmp_value,
+ * following the same rules as strcmp().
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_info_cmp(int *cmp_value, const void *_info1, const void *_info2)
+{
+ 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_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL INFO Compare\n");
+#endif
+
+ /* Sanity checks */
+ assert(info1);
+ assert(info2);
+
+ /* Initialize comparison value */
+ *cmp_value = 0;
+
+ /* Compare under VOL connector classes */
+ H5VLcmp_connector_cls(cmp_value, info1->under_vol_id, info2->under_vol_id);
+ if(*cmp_value != 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;
+} /* end H5VL_pass_through_info_cmp() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_info_free
+ *
+ * Purpose: Release an info object for the connector.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_info_free(void *_info)
+{
+ H5VL_pass_through_info_t *info = (H5VL_pass_through_info_t *)_info;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL INFO Free\n");
+#endif
+
+ /* Release underlying VOL ID and info */
+ if(info->under_vol_info)
+ H5VLfree_connector_info(info->under_vol_id, info->under_vol_info);
+ H5Idec_ref(info->under_vol_id);
+
+ /* Free pass through info object itself */
+ free(info);
+
+ return 0;
+} /* end H5VL_pass_through_info_free() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_info_to_str
+ *
+ * Purpose: Serialize an info object for this connector into a string
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_info_to_str(const void *_info, char **str)
+{
+ const H5VL_pass_through_info_t *info = (const H5VL_pass_through_info_t *)_info;
+ H5VL_class_value_t under_value = (H5VL_class_value_t)-1;
+ char *under_vol_string = NULL;
+ size_t under_vol_str_len = 0;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL INFO To String\n");
+#endif
+
+ /* Get value and string for underlying VOL connector */
+ H5VLget_value(info->under_vol_id, &under_value);
+ H5VLconnector_info_to_str(info->under_vol_info, info->under_vol_id, &under_vol_string);
+
+ /* Determine length of underlying VOL info string */
+ if(under_vol_string)
+ under_vol_str_len = strlen(under_vol_string);
+
+ /* Allocate space for our info */
+ *str = (char *)H5allocate_memory(32 + under_vol_str_len, (hbool_t)0);
+ assert(*str);
+
+ /* 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;
+} /* end H5VL_pass_through_info_to_str() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_str_to_info
+ *
+ * Purpose: Deserialize a string into an info object for this connector.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_str_to_info(const char *str, void **_info)
+{
+ H5VL_pass_through_info_t *info;
+ unsigned under_vol_value;
+ const char *under_vol_info_start, *under_vol_info_end;
+ hid_t under_vol_id;
+ void *under_vol_info = NULL;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL INFO String To Info\n");
+#endif
+
+ /* Retrieve the underlying VOL connector value and info */
+ sscanf(str, "under_vol=%u;", &under_vol_value);
+ under_vol_id = H5VLregister_connector_by_value((H5VL_class_value_t)under_vol_value, H5P_DEFAULT);
+ under_vol_info_start = strchr(str, '{');
+ under_vol_info_end = strrchr(str, '}');
+ assert(under_vol_info_end > under_vol_info_start);
+ if(under_vol_info_end != (under_vol_info_start + 1)) {
+ char *under_vol_info_str;
+
+ under_vol_info_str = (char *)malloc((size_t)(under_vol_info_end - under_vol_info_start));
+ memcpy(under_vol_info_str, under_vol_info_start + 1, (size_t)((under_vol_info_end - under_vol_info_start) - 1));
+ *(under_vol_info_str + (under_vol_info_end - under_vol_info_start)) = '\0';
+
+ H5VLconnector_str_to_info(under_vol_info_str, under_vol_id, &under_vol_info);
+
+ free(under_vol_info_str);
+ } /* end else */
+
+ /* Allocate new pass-through VOL connector info and set its fields */
+ info = (H5VL_pass_through_info_t *)calloc(1, sizeof(H5VL_pass_through_info_t));
+ info->under_vol_id = under_vol_id;
+ info->under_vol_info = under_vol_info;
+
+ /* Set return value */
+ *_info = info;
+
+ return 0;
+} /* end H5VL_pass_through_str_to_info() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_get_object
+ *
+ * Purpose: Retrieve the 'data' for a VOL object.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_get_object(const void *obj)
+{
+ const H5VL_pass_through_t *o = (const H5VL_pass_through_t *)obj;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL Get object\n");
+#endif
+
+ return H5VLget_object(o->under_object, o->under_vol_id);
+} /* end H5VL_pass_through_get_object() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_get_wrap_ctx
+ *
+ * Purpose: Retrieve a "wrapper context" for an object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+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_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL WRAP CTX Get\n");
+#endif
+
+ /* Allocate new VOL object wrapping context for the pass through connector */
+ new_wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)calloc(1, sizeof(H5VL_pass_through_wrap_ctx_t));
+
+ /* Increment reference count on underlying VOL ID, and copy the VOL info */
+ new_wrap_ctx->under_vol_id = o->under_vol_id;
+ H5Iinc_ref(new_wrap_ctx->under_vol_id);
+ H5VLget_wrap_ctx(o->under_object, o->under_vol_id, &new_wrap_ctx->under_wrap_ctx);
+
+ /* Set wrap context to return */
+ *wrap_ctx = new_wrap_ctx;
+
+ return 0;
+} /* end H5VL_pass_through_get_wrap_ctx() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_wrap_object
+ *
+ * Purpose: Use a "wrapper context" to wrap a data object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_wrap_object(void *obj, 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_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);
+ if(under)
+ new_obj = H5VL_pass_through_new_obj(under, wrap_ctx->under_vol_id);
+ else
+ new_obj = NULL;
+
+ return new_obj;
+} /* end H5VL_pass_through_wrap_object() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_free_wrap_ctx
+ *
+ * Purpose: Release a "wrapper context" for an object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+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_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL WRAP CTX Free\n");
+#endif
+
+ /* Release underlying VOL ID and wrap context */
+ if(wrap_ctx->under_wrap_ctx)
+ H5VLfree_wrap_ctx(wrap_ctx->under_wrap_ctx, wrap_ctx->under_vol_id);
+ H5Idec_ref(wrap_ctx->under_vol_id);
+
+ /* Free pass through wrap context object itself */
+ free(wrap_ctx);
+
+ return 0;
+} /* end H5VL_pass_through_free_wrap_ctx() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_create
+ *
+ * Purpose: Creates an attribute on an object.
+ *
+ * Return: Success: Pointer to attribute object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_pass_through_t *attr;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL ATTRIBUTE Create\n");
+#endif
+
+ under = H5VLattr_create(o->under_object, loc_params, o->under_vol_id, name, acpl_id, aapl_id, dxpl_id, req);
+ if(under) {
+ attr = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ attr = NULL;
+
+ return (void*)attr;
+} /* end H5VL_pass_through_attr_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_open
+ *
+ * Purpose: Opens an attribute on an object.
+ *
+ * Return: Success: Pointer to attribute object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *attr;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL ATTRIBUTE Open\n");
+#endif
+
+ under = H5VLattr_open(o->under_object, loc_params, o->under_vol_id, name, aapl_id, dxpl_id, req);
+ if(under) {
+ attr = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ attr = NULL;
+
+ return (void *)attr;
+} /* end H5VL_pass_through_attr_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_read
+ *
+ * Purpose: Reads data from attribute.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL ATTRIBUTE Read\n");
+#endif
+
+ ret_value = H5VLattr_read(o->under_object, o->under_vol_id, mem_type_id, buf, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_attr_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_write
+ *
+ * Purpose: Writes data to attribute.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL ATTRIBUTE Write\n");
+#endif
+
+ ret_value = H5VLattr_write(o->under_object, o->under_vol_id, mem_type_id, buf, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_attr_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_get
+ *
+ * Purpose: Gets information about an attribute
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL ATTRIBUTE Get\n");
+#endif
+
+ ret_value = H5VLattr_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_attr_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_specific
+ *
+ * Purpose: Specific operation on attribute
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_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)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL ATTRIBUTE Specific\n");
+#endif
+
+ ret_value = H5VLattr_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_attr_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_optional
+ *
+ * Purpose: Perform a connector-specific operation on an attribute
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL ATTRIBUTE Optional\n");
+#endif
+
+ ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_attr_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_close
+ *
+ * Purpose: Closes an attribute.
+ *
+ * Return: Success: 0
+ * Failure: -1, attr not closed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL ATTRIBUTE Close\n");
+#endif
+
+ ret_value = H5VLattr_close(o->under_object, o->under_vol_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ /* Release our wrapper, if underlying attribute was closed */
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_pass_through_attr_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_create
+ *
+ * Purpose: Creates a dataset in a container
+ *
+ * Return: Success: Pointer to a dataset object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_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)
+{
+ H5VL_pass_through_t *dset;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL DATASET Create\n");
+#endif
+
+ under = H5VLdataset_create(o->under_object, loc_params, o->under_vol_id, name, dcpl_id, dapl_id, dxpl_id, req);
+ if(under) {
+ dset = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ dset = NULL;
+
+ return (void *)dset;
+} /* end H5VL_pass_through_dataset_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_open
+ *
+ * Purpose: Opens a dataset in a container
+ *
+ * Return: Success: Pointer to a dataset object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t dapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *dset;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL DATASET Open\n");
+#endif
+
+ under = H5VLdataset_open(o->under_object, loc_params, o->under_vol_id, name, dapl_id, dxpl_id, req);
+ if(under) {
+ dset = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ dset = NULL;
+
+ return (void *)dset;
+} /* end H5VL_pass_through_dataset_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_read
+ *
+ * Purpose: Reads data elements from a dataset into a buffer.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id,
+ hid_t file_space_id, hid_t plist_id, void *buf, void **req)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL DATASET Read\n");
+#endif
+
+ ret_value = H5VLdataset_read(o->under_object, o->under_vol_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_dataset_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_write
+ *
+ * Purpose: Writes data elements from a buffer into a dataset.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id,
+ hid_t file_space_id, hid_t plist_id, const void *buf, void **req)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL DATASET Write\n");
+#endif
+
+ ret_value = H5VLdataset_write(o->under_object, o->under_vol_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_dataset_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_get
+ *
+ * Purpose: Gets information about a dataset
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL DATASET Get\n");
+#endif
+
+ ret_value = H5VLdataset_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_dataset_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_specific
+ *
+ * Purpose: Specific operation on a dataset
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL H5Dspecific\n");
+#endif
+
+ ret_value = H5VLdataset_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_dataset_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_optional
+ *
+ * Purpose: Perform a connector-specific operation on a dataset
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL DATASET Optional\n");
+#endif
+
+ ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_dataset_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_close
+ *
+ * Purpose: Closes a dataset.
+ *
+ * Return: Success: 0
+ * Failure: -1, dataset not closed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL DATASET Close\n");
+#endif
+
+ ret_value = H5VLdataset_close(o->under_object, o->under_vol_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ /* Release our wrapper, if underlying dataset was closed */
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_pass_through_dataset_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_datatype_commit
+ *
+ * Purpose: Commits a datatype inside a container.
+ *
+ * Return: Success: Pointer to datatype object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_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)
+{
+ H5VL_pass_through_t *dt;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL DATATYPE Commit\n");
+#endif
+
+ under = H5VLdatatype_commit(o->under_object, loc_params, o->under_vol_id, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req);
+ if(under) {
+ dt = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ dt = NULL;
+
+ return (void *)dt;
+} /* end H5VL_pass_through_datatype_commit() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_datatype_open
+ *
+ * Purpose: Opens a named datatype inside a container.
+ *
+ * Return: Success: Pointer to datatype object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t tapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *dt;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL DATATYPE Open\n");
+#endif
+
+ under = H5VLdatatype_open(o->under_object, loc_params, o->under_vol_id, name, tapl_id, dxpl_id, req);
+ if(under) {
+ dt = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ dt = NULL;
+
+ return (void *)dt;
+} /* end H5VL_pass_through_datatype_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_datatype_get
+ *
+ * Purpose: Get information about a datatype
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)dt;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL DATATYPE Get\n");
+#endif
+
+ ret_value = H5VLdatatype_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_datatype_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_datatype_specific
+ *
+ * Purpose: Specific operations for datatypes
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL DATATYPE Specific\n");
+#endif
+
+ ret_value = H5VLdatatype_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_datatype_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_datatype_optional
+ *
+ * Purpose: Perform a connector-specific operation on a datatype
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_datatype_optional(void *obj, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL DATATYPE Optional\n");
+#endif
+
+ ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_datatype_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_datatype_close
+ *
+ * Purpose: Closes a datatype.
+ *
+ * Return: Success: 0
+ * Failure: -1, datatype not closed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL DATATYPE Close\n");
+#endif
+
+ assert(o->under_object);
+
+ ret_value = H5VLdatatype_close(o->under_object, o->under_vol_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ /* Release our wrapper, if underlying datatype was closed */
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_pass_through_datatype_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_file_create
+ *
+ * Purpose: Creates a container using this connector
+ *
+ * Return: Success: Pointer to a file object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id,
+ hid_t fapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_info_t *info;
+ H5VL_pass_through_t *file;
+ hid_t under_fapl_id;
+ void *under;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL FILE Create\n");
+#endif
+
+ /* Get copy of our VOL info from FAPL */
+ H5Pget_vol_info(fapl_id, (void **)&info);
+
+ /* Copy the FAPL */
+ under_fapl_id = H5Pcopy(fapl_id);
+
+ /* Set the VOL ID and info for the underlying FAPL */
+ H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info);
+
+ /* Open the file with the underlying VOL connector */
+ under = H5VLfile_create(name, flags, fcpl_id, under_fapl_id, dxpl_id, req);
+ if(under) {
+ file = H5VL_pass_through_new_obj(under, info->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, info->under_vol_id);
+ } /* end if */
+ else
+ file = NULL;
+
+ /* Close underlying FAPL */
+ H5Pclose(under_fapl_id);
+
+ /* Release copy of our VOL info */
+ H5VL_pass_through_info_free(info);
+
+ return (void *)file;
+} /* end H5VL_pass_through_file_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_file_open
+ *
+ * Purpose: Opens a container created with this connector
+ *
+ * Return: Success: Pointer to a file object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_info_t *info;
+ H5VL_pass_through_t *file;
+ hid_t under_fapl_id;
+ void *under;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL FILE Open\n");
+#endif
+
+ /* Get copy of our VOL info from FAPL */
+ H5Pget_vol_info(fapl_id, (void **)&info);
+
+ /* Copy the FAPL */
+ under_fapl_id = H5Pcopy(fapl_id);
+
+ /* Set the VOL ID and info for the underlying FAPL */
+ H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info);
+
+ /* Open the file with the underlying VOL connector */
+ under = H5VLfile_open(name, flags, under_fapl_id, dxpl_id, req);
+ if(under) {
+ file = H5VL_pass_through_new_obj(under, info->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, info->under_vol_id);
+ } /* end if */
+ else
+ file = NULL;
+
+ /* Close underlying FAPL */
+ H5Pclose(under_fapl_id);
+
+ /* Release copy of our VOL info */
+ H5VL_pass_through_info_free(info);
+
+ return (void *)file;
+} /* end H5VL_pass_through_file_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_file_get
+ *
+ * Purpose: Get info about a file
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL FILE Get\n");
+#endif
+
+ ret_value = H5VLfile_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ 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.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id,
+ H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...)
+{
+ va_list arguments;
+ herr_t ret_value;
+
+ va_start(arguments, req);
+ ret_value = H5VLfile_specific(obj, connector_id, specific_type, dxpl_id, req, arguments);
+ va_end(arguments);
+
+ return ret_value;
+} /* end H5VL_pass_through_file_specific_reissue() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_file_specific
+ *
+ * Purpose: Specific operation on file
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
+ hid_t under_vol_id = -1;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL FILE Specific\n");
+#endif
+
+ /* Unpack arguments to get at the child file pointer when mounting a file */
+ if(specific_type == H5VL_FILE_MOUNT) {
+ H5I_type_t loc_type;
+ const char *name;
+ H5VL_pass_through_t *child_file;
+ hid_t plist_id;
+
+ /* Retrieve parameters for 'mount' operation, so we can unwrap the child file */
+ 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);
+
+ /* Keep the correct underlying VOL ID for possible async request token */
+ 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, (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;
+ hid_t fapl_id, under_fapl_id;
+ const char *name;
+ htri_t *ret;
+
+ /* Get the arguments for the 'is accessible' check */
+ fapl_id = va_arg(arguments, hid_t);
+ name = va_arg(arguments, const char *);
+ ret = va_arg(arguments, htri_t *);
+
+ /* Get copy of our VOL info from FAPL */
+ H5Pget_vol_info(fapl_id, (void **)&info);
+
+ /* Copy the FAPL */
+ under_fapl_id = H5Pcopy(fapl_id);
+
+ /* Set the VOL ID and info for the underlying FAPL */
+ H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info);
+
+ /* Keep the correct underlying VOL ID for possible async request token */
+ under_vol_id = info->under_vol_id;
+
+ /* Re-issue 'file specific' call */
+ ret_value = H5VL_pass_through_file_specific_reissue(NULL, info->under_vol_id, specific_type, dxpl_id, req, under_fapl_id, name, ret);
+
+ /* Close underlying FAPL */
+ H5Pclose(under_fapl_id);
+
+ /* Release copy of our VOL info */
+ H5VL_pass_through_info_free(info);
+ } /* end else-if */
+ else {
+ va_list my_arguments;
+
+ /* Make a copy of the argument list for later, if reopening */
+ if(specific_type == H5VL_FILE_REOPEN)
+ va_copy(my_arguments, arguments);
+
+ /* Keep the correct underlying VOL ID for possible async request token */
+ under_vol_id = o->under_vol_id;
+
+ ret_value = H5VLfile_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Wrap file struct pointer, if we reopened one */
+ if(specific_type == H5VL_FILE_REOPEN) {
+ if(ret_value >= 0) {
+ void **ret = va_arg(my_arguments, void **);
+
+ if(ret && *ret)
+ *ret = H5VL_pass_through_new_obj(*ret, o->under_vol_id);
+ } /* end if */
+
+ /* Finish use of copied vararg list */
+ va_end(my_arguments);
+ } /* end if */
+ } /* end else */
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_file_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_file_optional
+ *
+ * Purpose: Perform a connector-specific operation on a file
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL File Optional\n");
+#endif
+
+ ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_file_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_file_close
+ *
+ * Purpose: Closes a file.
+ *
+ * Return: Success: 0
+ * Failure: -1, file not closed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL FILE Close\n");
+#endif
+
+ ret_value = H5VLfile_close(o->under_object, o->under_vol_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ /* Release our wrapper, if underlying file was closed */
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_pass_through_file_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_group_create
+ *
+ * Purpose: Creates a group inside a container
+ *
+ * Return: Success: Pointer to a group object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_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)
+{
+ H5VL_pass_through_t *group;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL GROUP Create\n");
+#endif
+
+ under = H5VLgroup_create(o->under_object, loc_params, o->under_vol_id, name, gcpl_id, gapl_id, dxpl_id, req);
+ if(under) {
+ group = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ group = NULL;
+
+ return (void *)group;
+} /* end H5VL_pass_through_group_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_group_open
+ *
+ * Purpose: Opens a group inside a container
+ *
+ * Return: Success: Pointer to a group object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t gapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *group;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL GROUP Open\n");
+#endif
+
+ under = H5VLgroup_open(o->under_object, loc_params, o->under_vol_id, name, gapl_id, dxpl_id, req);
+ if(under) {
+ group = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ group = NULL;
+
+ return (void *)group;
+} /* end H5VL_pass_through_group_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_group_get
+ *
+ * Purpose: Get info about a group
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL GROUP Get\n");
+#endif
+
+ ret_value = H5VLgroup_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_group_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_group_specific
+ *
+ * Purpose: Specific operation on a group
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL GROUP Specific\n");
+#endif
+
+ ret_value = H5VLgroup_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_group_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_group_optional
+ *
+ * Purpose: Perform a connector-specific operation on a group
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL GROUP Optional\n");
+#endif
+
+ ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_group_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_group_close
+ *
+ * Purpose: Closes a group.
+ *
+ * Return: Success: 0
+ * Failure: -1, group not closed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL H5Gclose\n");
+#endif
+
+ ret_value = H5VLgroup_close(o->under_object, o->under_vol_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ /* Release our wrapper, if underlying file was closed */
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_pass_through_group_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_link_create
+ *
+ * Purpose: Creates a hard / soft / UD / external link.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_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)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ hid_t under_vol_id = -1;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL LINK Create\n");
+#endif
+
+ /* Try to retrieve the "under" VOL id */
+ if(o)
+ under_vol_id = o->under_vol_id;
+
+ /* Fix up the link target object for hard link creation */
+ if(H5VL_LINK_CREATE_HARD == create_type) {
+ void *cur_obj;
+
+ /* Retrieve the object for the link target */
+ H5Pget(lcpl_id, H5VL_PROP_LINK_TARGET, &cur_obj);
+
+ /* If it's a non-NULL pointer, find the 'under object' and re-set the property */
+ if(cur_obj) {
+ /* Check if we still need the "under" VOL ID */
+ if(under_vol_id < 0)
+ under_vol_id = ((H5VL_pass_through_t *)cur_obj)->under_vol_id;
+
+ /* Set the object for the link target */
+ H5Pset(lcpl_id, H5VL_PROP_LINK_TARGET, &(((H5VL_pass_through_t *)cur_obj)->under_object));
+ } /* end if */
+ } /* end if */
+
+ ret_value = H5VLlink_create(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_link_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_link_copy
+ *
+ * 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
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_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)
+{
+ H5VL_pass_through_t *o_src = (H5VL_pass_through_t *)src_obj;
+ H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj;
+ hid_t under_vol_id = -1;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL LINK Copy\n");
+#endif
+
+ /* Retrieve the "under" VOL id */
+ if(o_src)
+ under_vol_id = o_src->under_vol_id;
+ else if(o_dst)
+ under_vol_id = o_dst->under_vol_id;
+ assert(under_vol_id > 0);
+
+ ret_value = H5VLlink_copy((o_src ? o_src->under_object : NULL), loc_params1, (o_dst ? o_dst->under_object : NULL), loc_params2, under_vol_id, lcpl_id, lapl_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_link_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * 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
+ * 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
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_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)
+{
+ H5VL_pass_through_t *o_src = (H5VL_pass_through_t *)src_obj;
+ H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj;
+ hid_t under_vol_id = -1;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL LINK Move\n");
+#endif
+
+ /* Retrieve the "under" VOL id */
+ if(o_src)
+ under_vol_id = o_src->under_vol_id;
+ else if(o_dst)
+ under_vol_id = o_dst->under_vol_id;
+ assert(under_vol_id > 0);
+
+ ret_value = H5VLlink_move((o_src ? o_src->under_object : NULL), loc_params1, (o_dst ? o_dst->under_object : NULL), loc_params2, under_vol_id, lcpl_id, lapl_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_link_move() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_link_get
+ *
+ * Purpose: Get info about a link
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_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)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL LINK Get\n");
+#endif
+
+ ret_value = H5VLlink_get(o->under_object, loc_params, o->under_vol_id, get_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_link_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_link_specific
+ *
+ * Purpose: Specific operation on a link
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_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)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL LINK Specific\n");
+#endif
+
+ ret_value = H5VLlink_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_link_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_link_optional
+ *
+ * Purpose: Perform a connector-specific operation on a link
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_link_optional(void *obj, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL LINK Optional\n");
+#endif
+
+ ret_value = H5VLlink_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_link_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_object_open
+ *
+ * Purpose: Opens an object inside a container.
+ *
+ * Return: Success: Pointer to object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params,
+ H5I_type_t *opened_type, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *new_obj;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL OBJECT Open\n");
+#endif
+
+ under = H5VLobject_open(o->under_object, loc_params, o->under_vol_id, opened_type, dxpl_id, req);
+ if(under) {
+ new_obj = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ new_obj = NULL;
+
+ return (void *)new_obj;
+} /* end H5VL_pass_through_object_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_object_copy
+ *
+ * Purpose: Copies an object inside a container.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params,
+ const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params,
+ const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id,
+ void **req)
+{
+ H5VL_pass_through_t *o_src = (H5VL_pass_through_t *)src_obj;
+ H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL OBJECT Copy\n");
+#endif
+
+ ret_value = H5VLobject_copy(o_src->under_object, src_loc_params, src_name, o_dst->under_object, dst_loc_params, dst_name, o_src->under_vol_id, ocpypl_id, lcpl_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o_src->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_object_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_object_get
+ *
+ * Purpose: Get info about an object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_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)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL OBJECT Get\n");
+#endif
+
+ ret_value = H5VLobject_get(o->under_object, loc_params, o->under_vol_id, get_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_object_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_object_specific
+ *
+ * Purpose: Specific operation on an object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_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)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL OBJECT Specific\n");
+#endif
+
+ ret_value = H5VLobject_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_object_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_object_optional
+ *
+ * Purpose: Perform a connector-specific operation for an object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL OBJECT Optional\n");
+#endif
+
+ ret_value = H5VLobject_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_pass_through_object_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_request_wait
+ *
+ * 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
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_request_wait(void *obj, uint64_t timeout,
+ H5ES_status_t *status)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL REQUEST Wait\n");
+#endif
+
+ ret_value = H5VLrequest_wait(o->under_object, o->under_vol_id, timeout, status);
+
+ if(ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS)
+ H5VL_pass_through_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_pass_through_request_wait() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_request_notify
+ *
+ * Purpose: Registers a user callback to be invoked when an asynchronous
+ * operation completes
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL REQUEST Wait\n");
+#endif
+
+ ret_value = H5VLrequest_notify(o->under_object, o->under_vol_id, cb, ctx);
+
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_pass_through_request_notify() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_request_cancel
+ *
+ * Purpose: Cancels an asynchronous operation
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_request_cancel(void *obj)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL REQUEST Cancel\n");
+#endif
+
+ ret_value = H5VLrequest_cancel(o->under_object, o->under_vol_id);
+
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ 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.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id,
+ H5VL_request_specific_t specific_type, ...)
+{
+ va_list arguments;
+ herr_t ret_value;
+
+ va_start(arguments, specific_type);
+ ret_value = H5VLrequest_specific(obj, connector_id, specific_type, arguments);
+ va_end(arguments);
+
+ return ret_value;
+} /* end H5VL_pass_through_request_specific_reissue() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_request_specific
+ *
+ * Purpose: Specific operation on a request
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_type,
+ va_list arguments)
+{
+ herr_t ret_value = -1;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL REQUEST Specific\n");
+#endif
+
+ if(H5VL_REQUEST_WAITANY == specific_type ||
+ H5VL_REQUEST_WAITSOME == specific_type ||
+ H5VL_REQUEST_WAITALL == specific_type) {
+ va_list tmp_arguments;
+ size_t req_count;
+
+ /* Sanity check */
+ assert(obj == NULL);
+
+ /* Get enough info to call the underlying connector */
+ va_copy(tmp_arguments, arguments);
+ req_count = va_arg(tmp_arguments, size_t);
+
+ /* Can only use a request to invoke the underlying VOL connector when there's >0 requests */
+ if(req_count > 0) {
+ void **req_array;
+ void **under_req_array;
+ uint64_t timeout;
+ H5VL_pass_through_t *o;
+ size_t u; /* Local index variable */
+
+ /* Get the request array */
+ req_array = va_arg(tmp_arguments, void **);
+
+ /* Get a request to use for determining the underlying VOL connector */
+ o = (H5VL_pass_through_t *)req_array[0];
+
+ /* Create array of underlying VOL requests */
+ under_req_array = (void **)malloc(req_count * sizeof(void **));
+ for(u = 0; u < req_count; u++)
+ under_req_array[u] = ((H5VL_pass_through_t *)req_array[u])->under_object;
+
+ /* Remove the timeout value from the vararg list (it's used in all the calls below) */
+ timeout = va_arg(tmp_arguments, uint64_t);
+
+ /* Release requests that have completed */
+ if(H5VL_REQUEST_WAITANY == specific_type) {
+ size_t *index; /* Pointer to the index of completed request */
+ H5ES_status_t *status; /* Pointer to the request's status */
+
+ /* Retrieve the remaining arguments */
+ index = va_arg(tmp_arguments, size_t *);
+ assert(*index <= req_count);
+ status = va_arg(tmp_arguments, H5ES_status_t *);
+
+ /* Reissue the WAITANY 'request specific' call */
+ ret_value = H5VL_pass_through_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout, index, status);
+
+ /* Release the completed request, if it completed */
+ if(ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS) {
+ H5VL_pass_through_t *tmp_o;
+
+ tmp_o = (H5VL_pass_through_t *)req_array[*index];
+ H5VL_pass_through_free_obj(tmp_o);
+ } /* end if */
+ } /* end if */
+ else if(H5VL_REQUEST_WAITSOME == specific_type) {
+ size_t *outcount; /* # of completed requests */
+ unsigned *array_of_indices; /* Array of indices for completed requests */
+ H5ES_status_t *array_of_statuses; /* Array of statuses for completed requests */
+
+ /* Retrieve the remaining arguments */
+ outcount = va_arg(tmp_arguments, size_t *);
+ assert(*outcount <= req_count);
+ array_of_indices = va_arg(tmp_arguments, unsigned *);
+ array_of_statuses = va_arg(tmp_arguments, H5ES_status_t *);
+
+ /* Reissue the WAITSOME 'request specific' call */
+ ret_value = H5VL_pass_through_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout, outcount, array_of_indices, array_of_statuses);
+
+ /* If any requests completed, release them */
+ if(ret_value >= 0 && *outcount > 0) {
+ unsigned *idx_array; /* Array of indices of completed requests */
+
+ /* Retrieve the array of completed request indices */
+ idx_array = va_arg(tmp_arguments, unsigned *);
+
+ /* Release the completed requests */
+ for(u = 0; u < *outcount; u++) {
+ H5VL_pass_through_t *tmp_o;
+
+ tmp_o = (H5VL_pass_through_t *)req_array[idx_array[u]];
+ H5VL_pass_through_free_obj(tmp_o);
+ } /* end for */
+ } /* end if */
+ } /* end else-if */
+ else { /* H5VL_REQUEST_WAITALL == specific_type */
+ H5ES_status_t *array_of_statuses; /* Array of statuses for completed requests */
+
+ /* Retrieve the remaining arguments */
+ array_of_statuses = va_arg(tmp_arguments, H5ES_status_t *);
+
+ /* Reissue the WAITALL 'request specific' call */
+ ret_value = H5VL_pass_through_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout, array_of_statuses);
+
+ /* Release the completed requests */
+ if(ret_value >= 0) {
+ for(u = 0; u < req_count; u++) {
+ if(array_of_statuses[u] != H5ES_STATUS_IN_PROGRESS) {
+ H5VL_pass_through_t *tmp_o;
+
+ tmp_o = (H5VL_pass_through_t *)req_array[u];
+ H5VL_pass_through_free_obj(tmp_o);
+ } /* end if */
+ } /* end for */
+ } /* end if */
+ } /* end else */
+
+ /* Release array of requests for underlying connector */
+ free(under_req_array);
+ } /* end if */
+
+ /* Finish use of copied vararg list */
+ va_end(tmp_arguments);
+ } /* end if */
+ else
+ assert(0 && "Unknown 'specific' operation");
+
+ return ret_value;
+} /* end H5VL_pass_through_request_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_request_optional
+ *
+ * Purpose: Perform a connector-specific operation for a request
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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_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;
+} /* end H5VL_pass_through_request_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_request_free
+ *
+ * Purpose: Releases a request, allowing the operation to complete without
+ * application tracking
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_request_free(void *obj)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL REQUEST Free\n");
+#endif
+
+ ret_value = H5VLrequest_free(o->under_object, o->under_vol_id);
+
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_pass_through_request_free() */
+
diff --git a/src/H5VLpassthru.h b/src/H5VLpassthru.h
new file mode 100644
index 0000000..e640636
--- /dev/null
+++ b/src/H5VLpassthru.h
@@ -0,0 +1,46 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 public header file for the pass-through VOL connector.
+ */
+
+#ifndef _H5VLpassthru_H
+#define _H5VLpassthru_H
+
+/* Identifier for the pass-through VOL connector */
+#define H5VL_PASSTHRU (H5VL_pass_through_register())
+
+/* Characteristics of the pass-through VOL connector */
+#define H5VL_PASSTHRU_NAME "pass_through"
+#define H5VL_PASSTHRU_VALUE 505 /* VOL connector ID */
+#define H5VL_PASSTHRU_VERSION 0
+
+/* Pass-through VOL connector info */
+typedef struct H5VL_pass_through_info_t {
+ hid_t under_vol_id; /* VOL ID for under VOL */
+ void *under_vol_info; /* VOL info for under VOL */
+} H5VL_pass_through_info_t;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+H5_DLL hid_t H5VL_pass_through_register(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H5VLpassthru_H */
+
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index 003e6f5..ef5a81e 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -26,39 +26,50 @@
/* Library Private Typedefs */
/****************************/
-/* Internal struct to track VOL driver information for objects */
+/* Internal struct to track VOL connector information for objects */
typedef struct H5VL_t {
- const H5VL_class_t *cls; /* Pointer to driver class struct */
+ const H5VL_class_t *cls; /* Pointer to connector class struct */
int64_t nrefs; /* Number of references by objects using this struct */
- hid_t id; /* Identifier for the VOL driver */
+ hid_t id; /* Identifier for the VOL connector */
} H5VL_t;
/* Internal vol object structure returned to the API */
typedef struct H5VL_object_t {
- void *data; /* Pointer to driver-managed data for this object */
- H5VL_t *driver; /* Pointer to VOL driver struct */
+ void *data; /* Pointer to connector-managed data for this object */
+ H5VL_t *connector; /* Pointer to VOL connector struct */
} H5VL_object_t;
-/* Internal structure to hold the driver ID & info for FAPLs */
-typedef struct H5VL_driver_prop_t {
- hid_t driver_id; /* VOL driver's ID */
- const void *driver_info; /* VOL driver info, for open callbacks */
-} H5VL_driver_prop_t;
+/* Internal structure to hold the connector ID & info for FAPLs */
+typedef struct H5VL_connector_prop_t {
+ hid_t connector_id; /* VOL connector's ID */
+ const void *connector_info; /* VOL connector info, for open callbacks */
+} H5VL_connector_prop_t;
+
+/* Which kind of VOL connector field to use for searching */
+typedef enum H5VL_get_connector_kind_t {
+ H5VL_GET_CONNECTOR_BY_NAME, /* Name field is set */
+ H5VL_GET_CONNECTOR_BY_VALUE /* Value field is set */
+} H5VL_get_connector_kind_t;
+
/*****************************/
/* Library Private Variables */
/*****************************/
+
/******************************/
/* Library Private Prototypes */
/******************************/
/* Utility functions */
H5_DLL herr_t H5VL_init(void);
+H5_DLL herr_t H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_class_t *cls2);
+H5_DLL herr_t H5VL_conn_copy(H5VL_connector_prop_t *value);
+H5_DLL herr_t H5VL_conn_free(const H5VL_connector_prop_t *info);
-/* Functions that deal with VOL drivers */
-H5_DLL hid_t H5VL_register_driver(const void *cls, size_t size, hbool_t app_ref);
-H5_DLL ssize_t H5VL_get_driver_name(hid_t id, char *name/*out*/, size_t size);
+/* Functions that deal with VOL connectors */
+H5_DLL hid_t H5VL_register_connector(const void *cls, hbool_t app_ref, hid_t vipl_id);
+H5_DLL ssize_t H5VL_get_connector_name(hid_t id, char *name/*out*/, size_t size);
/* NOTE: The object and ID functions below deal in VOL objects (i.e.;
* H5VL_object_t). Similar non-VOL calls exist in H5Iprivate.h. Use
@@ -72,78 +83,103 @@ H5_DLL ssize_t H5VL_get_driver_name(hid_t id, char *name/*out*/, size_t size);
/* Functions that manipulate VOL objects */
H5_DLL void *H5VL_object(hid_t id);
+H5_DLL void *H5VL_object_data(const H5VL_object_t *vol_obj);
H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type);
-H5_DLL void *H5VL_driver_data(H5VL_object_t *obj);
H5_DLL H5VL_object_t *H5VL_vol_object(hid_t id);
H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj);
+/* Functions that wrap / unwrap VOL objects */
+H5_DLL herr_t H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj,
+ void **wrap_ctx);
+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);
+
/* ID registration functions */
-H5_DLL hid_t H5VL_register(H5I_type_t type, const void *object, H5VL_t *vol_driver, hbool_t app_ref);
-H5_DLL hid_t H5VL_register_using_vol_id(H5I_type_t type, const void *obj, hid_t driver_id, hbool_t app_ref);
-H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref, hid_t existing_id);
+H5_DLL hid_t H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref);
+H5_DLL hid_t H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref);
+H5_DLL hid_t H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref);
+H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref, hid_t existing_id);
+
+/**********************************
+ * VOL connector callback wrappers
+ *********************************/
+
+/* Connector "management" functions */
+H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info,
+ const void *src_info);
+H5_DLL herr_t H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value,
+ const void *info1, const void *info2);
+H5_DLL herr_t H5VL_free_connector_info(const H5VL_class_t *connector, void *info);
/* Attribute functions */
-H5_DLL void *H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
-H5_DLL void *H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_attr_read(void *attr, const H5VL_class_t *cls, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_attr_write(void *attr, const H5VL_class_t *cls, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_attr_close(void *attr, const H5VL_class_t *cls, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_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);
+H5_DLL void *H5VL_attr_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Dataset functions */
-H5_DLL void *H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
-H5_DLL void *H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_dataset_read(void *dset, const H5VL_class_t *cls, 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_dataset_write(void *dset, const H5VL_class_t *cls, 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_dataset_get(void *dset, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_dataset_close(void *dset, const H5VL_class_t *cls, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL_dataset_create(const H5VL_object_t *vol_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_dataset_open(const H5VL_object_t *vol_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_dataset_read(const H5VL_object_t *vol_obj, 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_dataset_write(const H5VL_object_t *vol_obj, 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_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_dataset_specific(const H5VL_object_t *cls, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* File functions */
-H5_DLL 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);
-H5_DLL void *H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL_file_open(const H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Group functions */
-H5_DLL void *H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
-H5_DLL void *H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_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_group_open(const H5VL_object_t *vol_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_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Link functions */
-H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_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_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, const H5VL_object_t *dst_vol_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_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, const H5VL_object_t *dst_vol_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_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...);
/* Object functions */
-H5_DLL void *H5VL_object_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5I_type_t *opened_type, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const H5VL_class_t *cls1, const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...);
+H5_DLL void *H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params, H5I_type_t *opened_type, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, const H5VL_object_t *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...);
/* Datatype functions */
-H5_DLL void *H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, 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_datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_datatype_get(void *dt, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_datatype_close(void *dt, const H5VL_class_t *cls, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL_datatype_commit(const H5VL_object_t *vol_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_datatype_open(const H5VL_object_t *vol_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_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_datatype_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Asynchronous functions */
-H5_DLL herr_t H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status);
-H5_DLL herr_t H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status);
-H5_DLL herr_t H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status);
+H5_DLL herr_t H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, H5ES_status_t *status);
+H5_DLL herr_t H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb, void *ctx);
+H5_DLL herr_t H5VL_request_cancel(const H5VL_object_t *vol_obj);
+H5_DLL herr_t H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_t specific_type, ...);
+H5_DLL herr_t H5VL_request_optional(const H5VL_object_t *vol_obj, ...);
+H5_DLL herr_t H5VL_request_free(const H5VL_object_t *vol_obj);
+
#endif /* _H5VLprivate_H */
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index 600de0d..22cf12b 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -52,7 +52,7 @@
/* Group creation property names */
#define H5VL_PROP_GRP_LCPL_ID "group_lcpl_id"
-/* Default VOL driver value */
+/* Default VOL connector value */
#define H5VL_VOL_DEFAULT 0
@@ -112,19 +112,19 @@ typedef enum H5VL_datatype_specific_t {
typedef enum H5VL_file_get_t {
H5VL_FILE_GET_FAPL, /* file access property list */
H5VL_FILE_GET_FCPL, /* file creation property list */
- H5VL_FILE_GET_INTENT, /* file intent */
+ 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_OBJECT_GET_FILE /* retrieve or resurrect file of object */
+ H5VL_FILE_GET_OBJ_IDS /* object ids in file */
} H5VL_file_get_t;
/* types for file SPECIFIC callback */
typedef enum H5VL_file_specific_t {
H5VL_FILE_FLUSH, /* Flush file */
- H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */
+ H5VL_FILE_REOPEN, /* Reopen the file */
H5VL_FILE_MOUNT, /* Mount a file */
- H5VL_FILE_UNMOUNT /* Un-Mount a file */
+ H5VL_FILE_UNMOUNT, /* Unmount a file */
+ H5VL_FILE_IS_ACCESSIBLE /* Check if a file is accessible */
} H5VL_file_specific_t;
/* types for group GET callback */
@@ -162,21 +162,29 @@ typedef enum H5VL_link_specific_t {
/* types for object GET callback */
typedef enum H5VL_object_get_t {
- H5VL_REF_GET_NAME, /* object name */
+ H5VL_REF_GET_NAME, /* object name, for reference */
H5VL_REF_GET_REGION, /* dataspace of region */
- H5VL_REF_GET_TYPE /* type of object */
+ H5VL_REF_GET_TYPE, /* type of object */
+ H5VL_ID_GET_NAME /* object name, for hid_t */
} H5VL_object_get_t;
/* types for object SPECIFIC callback */
typedef enum H5VL_object_specific_t {
- H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */
- H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */
- H5VL_OBJECT_VISIT, /* H5Ovisit(_by_name) */
- H5VL_REF_CREATE, /* H5Rcreate */
- H5VL_OBJECT_FLUSH,
- H5VL_OBJECT_REFRESH
+ H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */
+ H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */
+ H5VL_OBJECT_VISIT, /* H5Ovisit(_by_name) */
+ H5VL_REF_CREATE, /* H5Rcreate */
+ H5VL_OBJECT_FLUSH, /* H5{D|G|O|T}flush */
+ H5VL_OBJECT_REFRESH /* H5{D|G|O|T}refresh */
} H5VL_object_specific_t;
+/* types for async request SPECIFIC callback */
+typedef enum H5VL_request_specific_t {
+ H5VL_REQUEST_WAITANY, /* Wait until any request completes */
+ H5VL_REQUEST_WAITSOME, /* Wait until at least one requesst completes */
+ H5VL_REQUEST_WAITALL /* Wait until all requests complete */
+} H5VL_request_specific_t;
+
/* types for different ways that objects are located in an HDF5 container */
typedef enum H5VL_loc_type_t {
H5VL_OBJECT_BY_SELF,
@@ -229,14 +237,14 @@ typedef struct H5VL_loc_params_t {
/* H5A routines */
typedef struct H5VL_attr_class_t {
- void *(*create)(void *obj, H5VL_loc_params_t loc_params, const char *attr_name,
+ void *(*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 *(*open)(void *obj, H5VL_loc_params_t loc_params, const char *attr_name,
+ void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
hid_t aapl_id, hid_t dxpl_id, void **req);
herr_t (*read)(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req);
herr_t (*write)(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req);
herr_t (*get)(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type,
+ herr_t (*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);
herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
herr_t (*close) (void *attr, hid_t dxpl_id, void **req);
@@ -244,9 +252,9 @@ typedef struct H5VL_attr_class_t {
/* H5D routines */
typedef struct H5VL_dataset_class_t {
- void *(*create)(void *obj, H5VL_loc_params_t loc_params, const char *name,
+ void *(*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);
- void *(*open)(void *obj, H5VL_loc_params_t loc_params, const char *name,
+ void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t dapl_id, hid_t dxpl_id, void **req);
herr_t (*read)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
hid_t xfer_plist_id, void * buf, void **req);
@@ -261,9 +269,9 @@ typedef struct H5VL_dataset_class_t {
/* H5T routines*/
typedef struct H5VL_datatype_class_t {
- void *(*commit)(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id,
+ void *(*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);
- void *(*open)(void *obj, H5VL_loc_params_t loc_params, const char * name,
+ void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char * name,
hid_t tapl_id, hid_t dxpl_id, void **req);
herr_t (*get) (void *obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
herr_t (*specific)(void *obj, H5VL_datatype_specific_t specific_type,
@@ -286,9 +294,9 @@ typedef struct H5VL_file_class_t {
/* H5G routines */
typedef struct H5VL_group_class_t {
- void *(*create)(void *obj, H5VL_loc_params_t loc_params, const char *name,
+ void *(*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);
- void *(*open)(void *obj, H5VL_loc_params_t loc_params, const char *name,
+ void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t gapl_id, hid_t dxpl_id, void **req);
herr_t (*get)(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
herr_t (*specific)(void *obj, H5VL_group_specific_t specific_type,
@@ -299,86 +307,84 @@ typedef struct H5VL_group_class_t {
/* H5L routines */
typedef struct H5VL_link_class_t {
- herr_t (*create)(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params,
+ herr_t (*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);
- herr_t (*copy)(void *src_obj, H5VL_loc_params_t loc_params1,
- void *dst_obj, H5VL_loc_params_t loc_params2,
+ herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2,
hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req);
- herr_t (*move)(void *src_obj, H5VL_loc_params_t loc_params1,
- void *dst_obj, H5VL_loc_params_t loc_params2,
+ herr_t (*move)(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2,
hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type,
+ herr_t (*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);
- herr_t (*specific)(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type,
+ herr_t (*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);
herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
} H5VL_link_class_t;
/* H5O routines */
typedef struct H5VL_object_class_t {
- void *(*open)(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type,
+ void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type,
hid_t dxpl_id, void **req);
- herr_t (*copy)(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name,
- void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name,
+ herr_t (*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);
- herr_t (*get)(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type,
+ herr_t (*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);
- herr_t (*specific)(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type,
+ herr_t (*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);
herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
} H5VL_object_class_t;
-/* H5AO routines */
-typedef struct H5VL_async_class_t {
- herr_t (*cancel)(void **, H5ES_status_t *);
- herr_t (*test) (void **, H5ES_status_t *);
- herr_t (*wait) (void **, H5ES_status_t *);
-} H5VL_async_class_t;
-
-/* VOL category (internal, external, etc.)
- * XXX: This is intended to replace the H5VL_class_value_t struct, which seems
- * difficult to manage. It's currently unused so I don't break struct
- * compatibility with existing VOLs.
- */
-typedef enum H5VL_category_t {
- H5VL_INTERNAL, /* Internal VOL driver */
- H5VL_EXTERNAL /* External VOL driver (plugin) */
-} H5VL_category_t;
-
-/* enum value to identify the class of a VOL driver (mostly for comparison purposes) */
-typedef enum H5VL_class_value_t {
- H5_VOL_NATIVE = 0, /* This should be first */
- H5_VOL_MAX_LIB_VALUE = 128 /* This should be last */
-} H5VL_class_value_t;
-
-/* Class information for each VOL driver */
-/* XXX: We should consider adding a UUID/GUID field to this struct
- * as well as a H5VLregister_by_uuid() API call for people who
- * really care about getting a particular VOL driver.
- * XXX: We should also consider adding enough information so that
- * files can be opened without specifying the VOL driver.
- * e.g.: If we stored a UUID and version, we could search for
- * a matching VOL driver so a user did not have to make any
- * H5VL calls.
+/* Asynchronous request 'notify' callback */
+typedef herr_t (*H5VL_request_notify_t)(void *ctx, H5ES_status_t status);
+
+/* Async request operation routines */
+typedef struct H5VL_request_class_t {
+ herr_t (*wait)(void *req, uint64_t timeout, H5ES_status_t *status);
+ herr_t (*notify)(void *req, H5VL_request_notify_t cb, void *ctx);
+ herr_t (*cancel)(void *req);
+ herr_t (*specific)(void *req, H5VL_request_specific_t specific_type, va_list arguments);
+ herr_t (*optional)(void *req, va_list arguments);
+ herr_t (*free)(void *req);
+} H5VL_request_class_t;
+
+/*
+ * VOL connector identifiers. Values 0 through 255 are for connectors defined
+ * by the HDF5 library. Values 256 through 511 are available for testing new
+ * filters. Subsequent values should be obtained from the HDF5 development
+ * team at help@hdfgroup.org.
*/
+typedef int H5VL_class_value_t;
+
+/* VOL connector identifier values */
+#define H5_VOL_INVALID (-1) /* Invalid ID for VOL connector iD */
+#define H5_VOL_NATIVE 0 /* Native HDF5 file formnat VOL connector */
+#define H5_VOL_RESERVED 256 /* VOL connector IDs below this value are reserved for library use */
+#define H5_VOL_MAX 65535 /* Maximum VOL connector ID */
+
+/* Capability flags for connector */
+#define H5VL_CAP_FLAG_NONE 0 /* No special connector capabilities */
+#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Connector is threadsafe */
+
+/* Class information for each VOL connector */
typedef struct H5VL_class_t {
- /* XXX: How do we identify unique VOL drivers?
- * This is unclear, but for now we'll keep
- * all the ID fields from the original VOL
- * branch.
- */
- unsigned int version; /* VOL driver version #
- * XXX: Is this supposed to be a VOL driver
- * version number or a VOL API version
- * number? Maybe we need both?
- */
- H5VL_class_value_t value; /* value to identify driver */
- const char *name; /* Plugin name (MUST be unique!) */
- herr_t (*initialize)(hid_t vipl_id); /* Plugin initialization callback */
- herr_t (*terminate)(hid_t vtpl_id); /* Plugin termination callback */
- size_t fapl_size; /* size of the vol info in the fapl property */
- void * (*fapl_copy)(const void *info); /* callback to create a copy of the vol info */
- herr_t (*fapl_free)(void *info); /* callback to release the vol info copy */
+ 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 */
/* Data Model */
H5VL_attr_class_t attr_cls; /* attribute class callbacks */
@@ -390,7 +396,9 @@ typedef struct H5VL_class_t {
H5VL_object_class_t object_cls; /* object class callbacks */
/* Services */
- H5VL_async_class_t async_cls; /* asynchronous 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 */
} H5VL_class_t;
@@ -407,92 +415,118 @@ typedef struct H5VL_class_t {
extern "C" {
#endif
-/* VOL Driver/Plugin Functionality */
-H5_DLL herr_t H5VLinitialize(hid_t driver_id, hid_t vipl_id);
-H5_DLL herr_t H5VLterminate(hid_t driver_id, hid_t vtpl_id);
-H5_DLL herr_t H5VLclose(hid_t driver_id);
-H5_DLL hid_t H5VLregister_driver(const H5VL_class_t *cls);
-H5_DLL hid_t H5VLregister_driver_by_name(const char *driver_name);
-H5_DLL herr_t H5VLunregister_driver(hid_t driver_id);
-H5_DLL htri_t H5VLis_driver_registered(const char *name);
-H5_DLL hid_t H5VLget_driver_id(const char *name);
-H5_DLL ssize_t H5VLget_driver_name(hid_t id, char *name/*out*/, size_t size);
-H5_DLL hid_t H5VLregister(H5I_type_t obj_type, const void *obj, hid_t driver_id);
-H5_DLL void *H5VLobject(hid_t id);
-H5_DLL herr_t H5VLget_object(hid_t obj_id, void **obj);
-
-/* Attributes */
-H5_DLL void *H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
-H5_DLL void *H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLattr_read(void *attr, hid_t driver_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLattr_write(void *attr, hid_t driver_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLattr_get(void *obj, hid_t driver_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLattr_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLattr_close(void *attr, hid_t driver_id, hid_t dxpl_id, void **req);
-
-/* Datasets */
-H5_DLL void *H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
-H5_DLL void *H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLdataset_read(void *dset, hid_t driver_id, 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 H5VLdataset_write(void *dset, hid_t driver_id, 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 H5VLdataset_get(void *dset, hid_t driver_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t driver_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdataset_close(void *dset, hid_t driver_id, hid_t dxpl_id, void **req);
-
-/* Files */
+/* VOL Connector Functionality */
+H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id);
+H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id);
+H5_DLL hid_t H5VLregister_connector_by_value(H5VL_class_value_t connector_value, hid_t vipl_id);
+H5_DLL htri_t H5VLis_connector_registered(const char *name);
+H5_DLL hid_t H5VLget_connector_id(const char *name);
+H5_DLL ssize_t H5VLget_connector_name(hid_t id, char *name/*out*/, size_t size);
+H5_DLL herr_t H5VLclose(hid_t connector_id);
+H5_DLL herr_t H5VLunregister_connector(hid_t connector_id);
+
+
+/*****************************************************************************
+ * VOL callback wrappers and helper routines, for _VOL_connector_ authors only! *
+ * (Not part of the public API for _application_ developers) *
+ *****************************************************************************/
+
+/* Helper routines for VOL connector authors */
+H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2);
+
+
+/* Public wrappers for generic callbacks */
+H5_DLL herr_t H5VLinitialize(hid_t connector_id, hid_t vipl_id);
+H5_DLL herr_t H5VLterminate(hid_t connector_id);
+H5_DLL herr_t H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags);
+H5_DLL herr_t H5VLget_value(hid_t connector_id, H5VL_class_value_t *conn_value);
+H5_DLL herr_t H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_info);
+H5_DLL herr_t H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1,
+ const void *info2);
+H5_DLL herr_t H5VLfree_connector_info(hid_t connector_id, void *vol_info);
+H5_DLL herr_t H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str);
+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 herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id);
+
+/* Public wrappers for attribute callbacks */
+H5_DLL void *H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLattr_read(void *attr, hid_t connector_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLattr_write(void *attr, hid_t connector_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLattr_close(void *attr, hid_t connector_id, hid_t dxpl_id, void **req);
+
+/* Public wrappers for dataset callbacks */
+H5_DLL void *H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLdataset_read(void *dset, hid_t connector_id, 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 H5VLdataset_write(void *dset, hid_t connector_id, 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 H5VLdataset_get(void *dset, hid_t connector_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdataset_close(void *dset, hid_t connector_id, hid_t dxpl_id, void **req);
+
+/* Public wrappers for file callbacks */
H5_DLL void *H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLfile_get(void *file, hid_t driver_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLfile_specific(void *obj, hid_t driver_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLfile_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLfile_close(void *file, hid_t driver_id, hid_t dxpl_id, void **req);
-
-/* Groups */
-H5_DLL void *H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
-H5_DLL void *H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLgroup_get(void *obj, hid_t driver_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t driver_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLgroup_close(void *grp, hid_t driver_id, hid_t dxpl_id, void **req);
-
-/* Links */
-H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1,
- void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id,
+H5_DLL herr_t H5VLfile_get(void *file, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLfile_close(void *file, hid_t connector_id, hid_t dxpl_id, void **req);
+
+/* Public wrappers for group callbacks */
+H5_DLL void *H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLgroup_close(void *grp, hid_t connector_id, hid_t dxpl_id, void **req);
+
+/* Public wrappers for link callbacks */
+H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t connector_id,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1,
- void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id,
+H5_DLL herr_t H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t connector_id,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLlink_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments);
-
-/* Objects */
-H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t driver_id1, const char *src_name,
- void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id2, const char *dst_name,
- hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLobject_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments);
-
-/* Datatypes */
-H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, 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 *H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t driver_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t driver_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t driver_id, hid_t dxpl_id, void **req);
-
-/* Asynchronous Requests */
-H5_DLL herr_t H5VLrequest_cancel(void **req, hid_t driver_id, H5ES_status_t *status);
-H5_DLL herr_t H5VLrequest_test(void **req, hid_t driver_id, H5ES_status_t *status);
-H5_DLL herr_t H5VLrequest_wait(void **req, hid_t driver_id, H5ES_status_t *status);
+H5_DLL herr_t H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Public wrappers for object callbacks */
+H5_DLL void *H5VLobject_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLobject_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 connector_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Public wrappers for named datatype callbacks */
+H5_DLL void *H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, 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 *H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t connector_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t connector_id, hid_t dxpl_id, void **req);
+
+/* Public wrappers for asynchronous request callbacks */
+H5_DLL herr_t H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_status_t *status);
+H5_DLL herr_t H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb, void *ctx);
+H5_DLL herr_t H5VLrequest_cancel(void *req, hid_t connector_id);
+H5_DLL herr_t H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type, va_list arguments);
+H5_DLL herr_t H5VLrequest_optional(void *req, hid_t connector_id, va_list arguments);
+H5_DLL herr_t H5VLrequest_free(void *req, hid_t connector_id);
#ifdef __cplusplus
}
#endif
#endif /* _H5VLpublic_H */
+
diff --git a/src/H5Z.c b/src/H5Z.c
index 9dc358c..f41588f 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -586,7 +586,9 @@ static int
H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key)
{
H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */
+#ifdef H5_HAVE_PARALLEL
H5Z_object_t *object = (H5Z_object_t *)key;
+#endif /* H5_HAVE_PARALLEL */
int ret_value = FALSE; /* Return value */
FUNC_ENTER_STATIC
@@ -695,11 +697,11 @@ H5Z_filter_avail(H5Z_filter_t id)
HGOTO_DONE(TRUE)
key.id = (int)id;
- if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, key))) {
- if (H5Z_register(filter_info) < 0)
+ if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) {
+ if(H5Z_register(filter_info) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter")
HGOTO_DONE(TRUE)
- }
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1287,7 +1289,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags,
/* Try loading the filter */
key.id = (int)(pline->filter[idx].id);
- if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, key))) {
+ if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) {
/* Register the filter we loaded */
if(H5Z_register(filter_info) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter")
diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h
index 0df05f0..a2a44fa 100644
--- a/src/H5Zpublic.h
+++ b/src/H5Zpublic.h
@@ -25,7 +25,7 @@
* Filter identifiers. Values 0 through 255 are for filters defined by the
* HDF5 library. Values 256 through 511 are available for testing new
* filters. Subsequent values should be obtained from the HDF5 development
- * team at hdf5dev@ncsa.uiuc.edu. These values will never change because they
+ * team at help@hdfgroup.org. These values will never change because they
* appear in the HDF5 files.
*/
typedef int H5Z_filter_t;
diff --git a/src/H5private.h b/src/H5private.h
index 63f6858..f58faec 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -1393,6 +1393,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 +1498,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 */
@@ -2086,10 +2092,11 @@ H5_DLL herr_t H5CX_pop(void);
/*
* Use this macro for API functions that shouldn't perform _any_ initialization
* of the library or an interface, just perform tracing, etc. Examples
- * are: H5allocate_memory, H5is_library_threadsafe, etc.
+ * are: H5allocate_memory, H5is_library_threadsafe, public VOL callback
+ * wrappers (e.g. H5VLfile_create, H5VLdataset_read, etc.), etc.
*
*/
-#define FUNC_ENTER_API_NOINIT {{ \
+#define FUNC_ENTER_API_NOINIT {{{ \
FUNC_ENTER_API_COMMON \
H5_PUSH_FUNC \
BEGIN_MPE_LOG \
@@ -2102,7 +2109,7 @@ H5_DLL herr_t H5CX_pop(void);
* are: H5close, H5check_version, etc.
*
*/
-#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{ \
+#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{{{ \
FUNC_ENTER_API_VARS \
FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \
FUNC_ENTER_API_THREADSAFE; \
@@ -2289,14 +2296,14 @@ H5_DLL herr_t H5CX_pop(void);
(void)H5E_dump_api_stack(TRUE); \
FUNC_LEAVE_API_THREADSAFE \
return(ret_value); \
-}} /*end scope from beginning of FUNC_ENTER*/
+}}} /*end scope from beginning of FUNC_ENTER*/
/* Use this macro to match the FUNC_ENTER_API_NOINIT_NOERR_NOFS macro */
#define FUNC_LEAVE_API_NOFS(ret_value) \
FUNC_LEAVE_API_COMMON(ret_value); \
FUNC_LEAVE_API_THREADSAFE \
return(ret_value); \
-}} /*end scope from beginning of FUNC_ENTER*/
+}}}} /*end scope from beginning of FUNC_ENTER*/
#define FUNC_LEAVE_NOAPI(ret_value) \
; \
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/H5trace.c b/src/H5trace.c
index 08db09a..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:
@@ -834,8 +834,8 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5ES_STATUS_FAIL:
HDfprintf(out, "H5ES_STATUS_FAIL");
break;
- case H5ES_STATUS_CANCEL:
- HDfprintf(out, "H5ES_STATUS_CANCEL");
+ case H5ES_STATUS_CANCELED:
+ HDfprintf(out, "H5ES_STATUS_CANCELED");
break;
default:
@@ -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:
@@ -2572,6 +2564,22 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
} /* end else */
break;
+ case 'C':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ 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");
+ else
+ HDfprintf(out, "%ld", (long)class_val);
+ } /* end else */
+ break;
case 'c':
if(ptr) {
if(vp)
@@ -2580,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:
@@ -2618,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:
@@ -2644,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:
@@ -2667,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:
@@ -2690,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:
@@ -2711,9 +2719,6 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5VL_FILE_GET_OBJ_IDS:
HDfprintf(out, "H5VL_FILE_GET_OBJ_IDS");
break;
- case H5VL_OBJECT_GET_FILE:
- HDfprintf(out, "H5VL_OBJECT_GET_FILE");
- break;
default:
HDfprintf(out, "%ld", (long)get);
break;
@@ -2728,12 +2733,15 @@ 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:
HDfprintf(out, "H5VL_FILE_FLUSH");
break;
+ case H5VL_FILE_REOPEN:
+ HDfprintf(out, "H5VL_FILE_REOPEN");
+ break;
case H5VL_FILE_MOUNT:
HDfprintf(out, "H5VL_FILE_MOUNT");
break;
@@ -2757,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:
@@ -2780,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:
@@ -2803,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:
@@ -2829,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:
@@ -2855,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:
@@ -2881,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:
@@ -2893,6 +2901,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5VL_REF_GET_NAME:
HDfprintf(out, "H5VL_REF_GET_NAME");
break;
+ case H5VL_ID_GET_NAME:
+ HDfprintf(out, "H5VL_ID_GET_NAME");
+ break;
default:
HDfprintf(out, "%ld", (long)get);
break;
@@ -2907,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:
@@ -2934,6 +2945,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
} /* end else */
break;
+ case 'r':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_request_specific_t specific = (H5VL_request_specific_t)HDva_arg(ap, int);
+
+ switch(specific) {
+ case H5VL_REQUEST_WAITANY:
+ HDfprintf(out, "H5VL_REQUEST_WAITANY");
+ break;
+ case H5VL_REQUEST_WAITSOME:
+ HDfprintf(out, "H5VL_REQUEST_WAITSOME");
+ break;
+ case H5VL_REQUEST_WAITALL:
+ HDfprintf(out, "H5VL_REQUEST_WAITALL");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)specific);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
default:
HDfprintf(out, "BADTYPE(Z%c)", type[1]);
goto error;
@@ -2961,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);
@@ -2987,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;
@@ -3004,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:
@@ -3034,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 */
@@ -3048,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");
@@ -3067,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");
@@ -3093,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;
@@ -3121,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 ffdf844..c0be29c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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 H5VLint.c H5VLnative.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
@@ -141,7 +144,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers
H5MMpublic.h H5Opublic.h H5Ppublic.h \
H5PLextern.h H5PLpublic.h \
H5Rpublic.h H5Spublic.h H5Tpublic.h \
- H5VLnative.h H5VLpublic.h H5Zpublic.h
+ H5VLnative.h H5VLpassthru.h H5VLpublic.h H5Zpublic.h
# install libhdf5.settings in lib directory
settingsdir=$(libdir)
diff --git a/src/hdf5.h b/src/hdf5.h
index f19abd9..c12037f 100644
--- a/src/hdf5.h
+++ b/src/hdf5.h
@@ -52,7 +52,8 @@
#include "H5FDwindows.h" /* Win32 I/O */
#endif
-/* Virtual object layer drivers */
-#include "H5VLnative.h" /* Native VOL driver */
+/* Virtual object layer (VOL) connectors */
+#include "H5VLnative.h" /* Native VOL connector */
+#include "H5VLpassthru.h" /* Pass-through VOL connector */
#endif