diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2018-10-25 23:32:13 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2018-10-25 23:32:13 (GMT) |
commit | 4a328957243ca7502a4c4966d6598498be43e3cd (patch) | |
tree | b46c66d7532db54cdf010b577b9bdfcd9b2dbc8c /src | |
parent | 0df6e44a6e68da1614cf80b50ed7b208edaa5df7 (diff) | |
parent | 47f30b474bdc498c20bd6d2a0ba7e8947ab389f0 (diff) | |
download | hdf5-4a328957243ca7502a4c4966d6598498be43e3cd.zip hdf5-4a328957243ca7502a4c4966d6598498be43e3cd.tar.gz hdf5-4a328957243ca7502a4c4966d6598498be43e3cd.tar.bz2 |
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/hdffv/hdf5 into stackable_vol
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 63 | ||||
-rw-r--r-- | src/H5A.c | 54 | ||||
-rw-r--r-- | src/H5Adeprec.c | 20 | ||||
-rw-r--r-- | src/H5Aint.c | 1 | ||||
-rw-r--r-- | src/H5D.c | 12 | ||||
-rw-r--r-- | src/H5Ddeprec.c | 12 | ||||
-rw-r--r-- | src/H5Dint.c | 1 | ||||
-rw-r--r-- | src/H5Dvirtual.c | 4 | ||||
-rw-r--r-- | src/H5F.c | 18 | ||||
-rw-r--r-- | src/H5Fint.c | 16 | ||||
-rw-r--r-- | src/H5G.c | 12 | ||||
-rw-r--r-- | src/H5Gdeprec.c | 8 | ||||
-rw-r--r-- | src/H5Gint.c | 1 | ||||
-rw-r--r-- | src/H5Gtraverse.c | 2 | ||||
-rw-r--r-- | src/H5I.c | 38 | ||||
-rw-r--r-- | src/H5Iprivate.h | 26 | ||||
-rw-r--r-- | src/H5L.c | 8 | ||||
-rw-r--r-- | src/H5Lexternal.c | 2 | ||||
-rw-r--r-- | src/H5O.c | 40 | ||||
-rw-r--r-- | src/H5Odeprec.c | 10 | ||||
-rw-r--r-- | src/H5Oflush.c | 18 | ||||
-rw-r--r-- | src/H5Oint.c | 2 | ||||
-rw-r--r-- | src/H5Pfapl.c | 4 | ||||
-rw-r--r-- | src/H5R.c | 6 | ||||
-rw-r--r-- | src/H5Rdeprec.c | 8 | ||||
-rw-r--r-- | src/H5Tcommit.c | 4 | ||||
-rw-r--r-- | src/H5Tdeprec.c | 4 | ||||
-rw-r--r-- | src/H5VL.c | 100 | ||||
-rw-r--r-- | src/H5VLint.c | 216 | ||||
-rw-r--r-- | src/H5VLnative.c | 12 | ||||
-rw-r--r-- | src/H5VLnative.h | 7 | ||||
-rw-r--r-- | src/H5VLnative_private.h | 39 | ||||
-rw-r--r-- | src/H5VLprivate.h | 41 | ||||
-rw-r--r-- | src/H5VLpublic.h | 18 | ||||
-rw-r--r-- | src/hdf5.h | 3 |
35 files changed, 447 insertions, 383 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 287292a..a98fdb6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -836,6 +836,7 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5STprivate.h ${HDF5_SRC_DIR}/H5Tprivate.h ${HDF5_SRC_DIR}/H5TSprivate.h + ${HDF5_SRC_DIR}/H5VLnative_private.h ${HDF5_SRC_DIR}/H5VLprivate.h ${HDF5_SRC_DIR}/H5VMprivate.h ${HDF5_SRC_DIR}/H5WBprivate.h @@ -878,7 +879,6 @@ endif () # Setup the H5detect utility which generates H5Tinit with platform # specific type checks inside #----------------------------------------------------------------------------- -option (HDF5_USE_PREGEN "Use pre-generated Files" OFF) if (HDF5_USE_PREGEN) set (HDF5_GENERATED_SOURCE_DIR ${HDF5_USE_PREGEN_DIR}) else () @@ -896,31 +896,54 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) TARGET_C_PROPERTIES (H5detect STATIC) target_link_libraries (H5detect PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<PLATFORM_ID:Windows>:ws2_32.lib> - INTERFACE $<$<PLATFORM_ID:Emscripten>:"-O0"> + PRIVATE $<$<PLATFORM_ID:Emscripten>:"-O0"> ) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5detect> - ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c - DEPENDS H5detect - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} - ) - if (BUILD_SHARED_LIBS) - if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c) + if (HDF5_BATCH_H5DETECT) + configure_file ( + ${HDF5_SOURCE_DIR}/bin/batch/${HDF5_DETECT_BATCH_SCRIPT}.in + ${HDF5_BINARY_DIR}/${HDF5_DETECT_BATCH_SCRIPT} ESCAPE_QUOTES @ONLY + ) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + COMMAND ${HDF5_BATCH_CMD} + ARGS ${HDF5_BATCH_H5DETECT_SCRIPT} + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) + if (BUILD_SHARED_LIBS) add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5detect> - ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - DEPENDS H5detect - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" + DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ) - else () 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 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5detect> + ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) + if (BUILD_SHARED_LIBS) + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5detect> + ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) + endif () + endif () endif () else () - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c @@ -938,7 +961,7 @@ target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_ TARGET_C_PROPERTIES (H5make_libsettings STATIC) target_link_libraries (H5make_libsettings PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<PLATFORM_ID:Windows>:ws2_32.lib> - INTERFACE $<$<PLATFORM_ID:Emscripten>:"-O0"> + PRIVATE $<$<PLATFORM_ID:Emscripten>:"-O0"> ) add_custom_command ( @@ -948,6 +971,7 @@ add_custom_command ( DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) +set_source_files_properties (${HDF5_BINARY_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c @@ -956,6 +980,7 @@ if (BUILD_SHARED_LIBS) DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) + set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) endif () ## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" @@ -288,7 +288,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Set location parameters */ @@ -301,8 +301,8 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, 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_id(H5I_ATTR, attr, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ @@ -398,7 +398,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ @@ -407,8 +407,8 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, 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_id(H5I_ATTR, attr, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ @@ -467,7 +467,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_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 */ @@ -476,8 +476,8 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) 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_id(H5I_ATTR, attr, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ @@ -550,7 +550,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if (NULL == (vol_obj = H5VL_get_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 */ @@ -559,8 +559,8 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, 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_id(H5I_ATTR, attr, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ @@ -642,7 +642,7 @@ H5Aopen_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 location object */ - if(NULL == (vol_obj = H5VL_get_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 */ @@ -651,8 +651,8 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, 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_id(H5I_ATTR, attr, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ @@ -983,7 +983,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") loc_params.type = H5VL_OBJECT_BY_IDX; @@ -1128,7 +1128,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, loc_params.obj_type = H5I_get_type(loc_id); /* Get the object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ @@ -1192,7 +1192,7 @@ H5Aget_info_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 object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ @@ -1240,7 +1240,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ @@ -1305,7 +1305,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Rename the attribute */ @@ -1384,7 +1384,7 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.obj_type = H5I_get_type(loc_id); /* get the loc object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set wrapper info in API context */ @@ -1484,7 +1484,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* get the loc object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set wrapper info in API context */ @@ -1548,7 +1548,7 @@ H5Adelete(hid_t loc_id, const char *name) loc_params.obj_type = H5I_get_type(loc_id); /* Get the object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute */ @@ -1607,7 +1607,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, loc_params.obj_type = H5I_get_type(loc_id); /* Get the object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute */ @@ -1678,7 +1678,7 @@ H5Adelete_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 object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute through the VOL */ @@ -1754,7 +1754,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* get the object */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") loc_params.type = H5VL_OBJECT_BY_SELF; @@ -1807,7 +1807,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") /* get the object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") loc_params.type = H5VL_OBJECT_BY_NAME; diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index eb4f447..b7e9ec4 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -152,7 +152,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ @@ -161,8 +161,8 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, 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_id(H5I_ATTR, attr, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: /* Clean up on failure */ @@ -218,7 +218,7 @@ 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_get_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 */ @@ -227,8 +227,8 @@ H5Aopen_name(hid_t loc_id, const char *name) 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_id(H5I_ATTR, attr, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Clean up on failure */ @@ -287,7 +287,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_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 */ @@ -296,8 +296,8 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) 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_id(H5I_ATTR, attr, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Clean up on failure */ @@ -342,7 +342,7 @@ H5Aget_num_attrs(hid_t loc_id) loc_params.obj_type = H5I_get_type(loc_id); /* get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + 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 */ diff --git a/src/H5Aint.c b/src/H5Aint.c index af5e479..44b11a4 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.h" /* Native VOL plugin */ /****************/ @@ -169,8 +169,8 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle") done: /* Reset object wrapping info in API context */ @@ -266,8 +266,8 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: /* Cleanup on failure */ @@ -335,8 +335,8 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Register an atom for the dataset */ - if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: /* Reset object wrapping info in API context */ diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 4206e23..d7b3342 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -157,7 +157,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, loc_params.obj_type = H5I_get_type(loc_id); /* get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the dataset through the VOL */ @@ -166,8 +166,8 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: if (H5I_INVALID_HID == ret_value) @@ -217,7 +217,7 @@ H5Dopen1(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_get_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 dataset */ @@ -226,8 +226,8 @@ H5Dopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: if(H5I_INVALID_HID == ret_value) diff --git a/src/H5Dint.c b/src/H5Dint.c index 413de33..a9ac7ac 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -31,7 +31,6 @@ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative.h" /* Native VOL plugin */ /****************/ diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 8af4379..7d127c2 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -58,7 +58,7 @@ #include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property Lists */ #include "H5Sprivate.h" /* Dataspaces */ -#include "H5VLnative.h" /* Native VOL driver */ +#include "H5VLnative_private.h" /* Native VOL driver */ #include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -2978,7 +2978,7 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) 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_object_register(*dset, H5I_DATASET, native_vol_id, FALSE)) < 0) + if((temp_id = H5VL_register_using_vol_id(H5I_DATASET, *dset, native_vol_id, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID") /* Refresh source dataset */ @@ -677,8 +677,8 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") /* Get an atom for the file */ - if((ret_value = H5VL_register_id(H5I_FILE, new_file, plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + if((ret_value = H5VL_register(H5I_FILE, new_file, plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: FUNC_LEAVE_API(ret_value) @@ -757,8 +757,8 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") /* Get an ID for the file */ - if((ret_value = H5VL_register_id(H5I_FILE, new_file, plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + if((ret_value = H5VL_register(H5I_FILE, new_file, plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: FUNC_LEAVE_API(ret_value) @@ -794,7 +794,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) } /* get the file object */ - if(NULL == (vol_obj = H5VL_get_object(object_id))) + if(NULL == (vol_obj = H5VL_vol_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Flush the object */ @@ -883,8 +883,8 @@ H5Freopen(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file") /* Get an atom for the file */ - if((ret_value = H5VL_register_id(H5I_FILE, file, vol_obj->plugin, 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->plugin, 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 */ @@ -1288,7 +1288,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file or file object") /* Get the file object */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the filename via the VOL */ @@ -1334,7 +1334,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Get the file object */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the file information */ diff --git a/src/H5Fint.c b/src/H5Fint.c index 7edd985..b53a83c 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -38,7 +38,7 @@ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tprivate.h" /* Datatypes */ #include "H5VLprivate.h" /* VOL plugins */ -#include "H5VLnative.h" /* Native VOL plugin */ +#include "H5VLnative_private.h" /* Native VOL plugin */ /****************/ @@ -3303,7 +3303,7 @@ H5F__start_swmr_write(H5F_t *f) if(grp_dset_count > 0) { H5VL_object_t *vol_obj = NULL; - if(NULL == (vol_obj = H5VL_get_object(obj_ids[0]))) + if(NULL == (vol_obj = H5VL_vol_object(obj_ids[0]))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") vol_plugin = vol_obj->plugin; @@ -3505,12 +3505,12 @@ H5F_get_file_id(hid_t obj_id, H5I_type_t type) FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Get the object pointer */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") /* Set wrapper info in API context */ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Get the file through the VOL */ @@ -3522,7 +3522,7 @@ H5F_get_file_id(hid_t obj_id, H5I_type_t type) /* 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") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed") /* If the ID does not exist, register it with the VOL plugin */ if(H5I_INVALID_HID == ret_value) { @@ -3535,18 +3535,18 @@ if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) HDassert(vol_wrap_ctx); } if ((ret_value = H5VL_wrap_register(H5I_FILE, file, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") } /* end if */ 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") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") } /* end else */ done: /* Reset object wrapping info in API context */ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_file_id() */ @@ -376,8 +376,8 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: /* Reset object wrapping info in API context */ @@ -460,8 +460,8 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: /* Cleanup on failure */ @@ -528,8 +528,8 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Register an ID for the group */ - if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: /* Reset object wrapping info in API context */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 80f91a1..15fd7e8 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -240,8 +240,8 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->plugin, 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->plugin, 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) @@ -302,8 +302,8 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Get an atom for the group */ - if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: if(H5I_INVALID_HID == ret_value) diff --git a/src/H5Gint.c b/src/H5Gint.c index ef5007f..7b028e2 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.h" /* Virtual Object Layer (native) */ /****************/ diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 6ac74b0..eb8c778 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -43,7 +43,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Ppublic.h" /* Property Lists */ #include "H5WBprivate.h" /* Wrapped Buffers */ -#include "H5VLnative.h" /* Virtual Object Layer (native) */ +#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ @@ -810,7 +810,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_register_with_id + * Function: H5I_register_using_existing_id * * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it. * This routine will check to ensure the supplied ID is not already @@ -819,14 +819,17 @@ done: * registered (thus, it is possible to register one object under * multiple IDs). * + * NOTE: Intended for use in refresh calls, where we have to close + * and re-open the underlying data, then hook the object back + * up to the original ID. + * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref, hid_t id) +H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id) { - H5VL_object_t *new_vol_obj = NULL; /* pointer to new VOL object */ H5I_id_type_t *type_ptr; /* ptr to the type */ H5I_id_info_t *id_ptr; /* ptr to the new ID information */ herr_t ret_value = SUCCEED; /* return value */ @@ -835,10 +838,9 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t /* Check arguments */ HDassert(object); - HDassert(vol_plugin); /* Make sure ID is not already in use */ - if(NULL != (id_ptr = H5I__find_id(id))) + if(NULL != (id_ptr = H5I__find_id(existing_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "ID already in use") /* Make sure type number is valid */ @@ -852,36 +854,18 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Make sure requested ID belongs to object's type */ - if(H5I_TYPE(id) != type) + if(H5I_TYPE(existing_id) != type) HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "invalid type for provided ID") /* Allocate new structure to house this ID */ if(NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t))) HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed") - /* Set up the new VOL object */ - if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t))) - HGOTO_ERROR(H5E_ATOM, H5E_CANTALLOC, FAIL, "can't allocate memory for VOL object"); - new_vol_obj->plugin = vol_plugin; - new_vol_obj->data = object; - - /* Bump the reference count on the VOL plugin */ - vol_plugin->nrefs++; - /* Create the struct & insert requested ID */ - id_ptr->id = id; + id_ptr->id = existing_id; id_ptr->count = 1; /* initial reference count*/ id_ptr->app_count = !!app_ref; - if(H5I_DATATYPE == type) { - void *dt = NULL; - - if(NULL == (dt = (void *)H5T_construct_datatype(new_vol_obj))) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "can't construct datatype object"); - - id_ptr->obj_ptr = dt; - } - else - id_ptr->obj_ptr = new_vol_obj; + id_ptr->obj_ptr = object; /* Insert into the type */ if(H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) @@ -890,7 +874,7 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_register_with_id() */ +} /* end H5I_register_using_existing_id() */ /*------------------------------------------------------------------------- diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index 8fd7caa..9068b5f 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -67,13 +67,7 @@ typedef struct H5I_class_t { H5_DLL herr_t H5I_register_type(const H5I_class_t *cls); H5_DLL int64_t H5I_nmembers(H5I_type_t type); H5_DLL herr_t H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref); -H5_DLL hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref); -H5_DLL herr_t H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref, hid_t id); -H5_DLL void *H5I_subst(hid_t id, const void *new_object); -H5_DLL void *H5I_object(hid_t id); -H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type); H5_DLL H5I_type_t H5I_get_type(hid_t id); -H5_DLL void *H5I_remove(hid_t id); H5_DLL herr_t H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref); H5_DLL int H5I_get_ref(hid_t id, hbool_t app_ref); H5_DLL int H5I_inc_ref(hid_t id, hbool_t app_ref); @@ -83,6 +77,26 @@ H5_DLL int H5I_dec_app_ref_always_close(hid_t id); H5_DLL int H5I_dec_type_ref(H5I_type_t type); H5_DLL herr_t H5I_find_id(const void *object, H5I_type_t type, hid_t *id /*out*/); +/* NOTE: The object and ID functions below deal in non-VOL objects (i.e.; + * H5S_t, etc.). Similar VOL calls exist in H5VLprivate.h. Use + * the H5VL calls with objects that go through the VOL, such as + * datasets and groups, and the H5I calls with objects + * that do not, such as property lists and dataspaces. Datatypes + * are can be either named, where they will use the VOL, or not, + * and thus require special treatment. See the datatype docs for + * how to handle this. + */ + +/* Functions that manipulate objects */ +H5_DLL void *H5I_object(hid_t id); +H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type); +H5_DLL void *H5I_remove(hid_t id); +H5_DLL void *H5I_subst(hid_t id, const void *new_object); + +/* ID registration functions */ +H5_DLL hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref); +H5_DLL herr_t H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id); + /* Debugging functions */ H5_DLL herr_t H5I_dump_ids_for_type(H5I_type_t type); @@ -34,7 +34,7 @@ #include "H5Oprivate.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative.h" /* Virtual Object Layer (native) */ +#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ @@ -514,7 +514,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name loc_params.obj_type = H5I_get_type(link_loc_id); /* get the location object */ - if(NULL == (vol_obj = (H5VL_object_t *)H5VL_get_object(link_loc_id))) + if(NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(link_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the plist structure */ @@ -614,11 +614,11 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, if(H5L_SAME_LOC != cur_loc_id) /* Get the current location object */ - if (NULL == (vol_obj1 = (H5VL_object_t *)H5VL_get_object(cur_loc_id))) + 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) /* Get the new location object */ - if(NULL == (vol_obj2 = (H5VL_object_t *)H5VL_get_object(new_loc_id))) + 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 plugins are the same */ diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index eb732ee..ff045c8 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -34,7 +34,7 @@ #include "H5Opublic.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative.h" /* Native VOL Driver */ +#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ @@ -141,8 +141,8 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Get an atom for the object */ - if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: /* Reset object wrapping info in API context */ @@ -218,8 +218,8 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, &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_id(opened_type, opened_obj, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: FUNC_LEAVE_API(ret_value) @@ -287,8 +287,8 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Register the dataset ID */ - if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: FUNC_LEAVE_API(ret_value) @@ -361,11 +361,11 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, if(H5L_SAME_LOC != obj_id) /* get the location object */ - if(NULL == (vol_obj1 = H5VL_get_object(obj_id))) + 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) /* get the location object */ - if(NULL == (vol_obj2 = H5VL_get_object(new_loc_id))) + 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 */ @@ -428,7 +428,7 @@ H5Oincr_refcount(hid_t object_id) loc_params.obj_type = H5I_get_type(object_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(object_id))) + if(NULL == (vol_obj = H5VL_vol_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ @@ -479,7 +479,7 @@ H5Odecr_refcount(hid_t object_id) loc_params.obj_type = H5I_get_type(object_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(object_id))) + if(NULL == (vol_obj = H5VL_vol_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ @@ -531,7 +531,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set the location struct fields */ @@ -595,7 +595,7 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set wrapper info in API context */ @@ -664,7 +664,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set wrapper info in API context */ @@ -740,7 +740,7 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set wrapper info in API context */ @@ -791,7 +791,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) H5TRACE2("e", "i*s", obj_id, comment); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ @@ -865,7 +865,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set wrapper info in API context */ @@ -915,7 +915,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_get_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 */ @@ -984,7 +984,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Set wrapper info in API context */ @@ -1064,7 +1064,7 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set location parameters */ @@ -1158,7 +1158,7 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set location parameters */ diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 3d09b33..24fdb00 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -105,7 +105,7 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ @@ -157,7 +157,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ @@ -219,7 +219,7 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ @@ -285,7 +285,7 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set location parameters */ @@ -373,7 +373,7 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set location parameters */ diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 2ef5ab8..5a27aff 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -80,7 +80,7 @@ H5Oflush(hid_t obj_id) H5TRACE1("e", "i", obj_id); /* Check args */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Set up collective metadata if appropriate */ @@ -245,7 +245,7 @@ H5Orefresh(hid_t oid) H5TRACE1("e", "i", oid); /* Check args */ - if(NULL == (vol_obj = H5VL_get_object(oid))) + if(NULL == (vol_obj = H5VL_vol_object(oid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Set up collective metadata if appropriate */ @@ -323,7 +323,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) * The vol_obj will disappear when the underlying object is closed, so * we can't use that directly. */ - if(NULL == (vol_obj = H5VL_get_object(oid))) + if(NULL == (vol_obj = H5VL_vol_object(oid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") plugin = vol_obj->plugin; @@ -463,13 +463,13 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_plugin, 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 +478,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_plugin, 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: @@ -496,13 +496,13 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_plugin, 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((H5I_register_with_id(type, object, vol_plugin, 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_plugin, 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 61a913c..2b40d64 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -43,7 +43,7 @@ #endif /* H5O_ENABLE_BOGUS */ #include "H5Opkg.h" /* Object headers */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative.h" /* Virtual Object Layer (native) */ +#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 0e40603..c6387a3 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -42,14 +42,14 @@ #include "H5VLprivate.h" /* VOL plugins */ /* Includes needed to set as default file driver */ -#include "H5FDsec2.h" /* Posix unbuffered I/O 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 plugin */ -#include "H5VLnative.h" /* Native HDF5 file VOL plugin */ +#include "H5VLnative_private.h" /* Native VOL plugin */ /****************/ @@ -199,7 +199,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the VOL object */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Set location parameters */ @@ -214,8 +214,8 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r &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_id(opened_type, opened_obj, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 83d2783..a3e94ea 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -122,7 +122,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) loc_params.obj_type = H5I_get_type(id); /* Get the vol object */ - if (NULL == (vol_obj = H5VL_get_object(id))) + if (NULL == (vol_obj = H5VL_vol_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid file identifier") /* Get the object information */ @@ -173,7 +173,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") /* Get the VOL object */ - if (NULL == (vol_obj = H5VL_get_object(obj_id))) + if (NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") loc_params.type = H5VL_OBJECT_BY_REF; @@ -188,8 +188,8 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") /* Get an atom for the object */ - if ((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->plugin, 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->plugin, 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/H5Tcommit.c b/src/H5Tcommit.c index 8389352..3e59c82 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -616,8 +616,8 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) 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_id(H5I_DATATYPE, dt, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Reset object wrapping info in API context */ diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 2244f20..4cedbd3 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -203,8 +203,8 @@ H5Topen1(hid_t loc_id, const char *name) 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_id(H5I_DATATYPE, dt, vol_obj->plugin, 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->plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Cleanup on error */ @@ -105,7 +105,7 @@ H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data) /*------------------------------------------------------------------------- - * Function: H5VLregister + * Function: H5VLregister_plugin * * Purpose: Registers a new VOL plugin as a member of the virtual object * layer class. @@ -114,17 +114,17 @@ H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data) * library is closed or the plugin is * unregistered. * - * Failure: A negative value (H5I_INVALID_HID). + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t -H5VLregister(const H5VL_class_t *cls, hid_t vipl_id) +H5VLregister_plugin(const H5VL_class_t *cls, hid_t vipl_id) { H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "*xi", cls, vipl_id); /* Check arguments */ @@ -154,17 +154,17 @@ H5VLregister(const H5VL_class_t *cls, hid_t vipl_id) } /* end if */ else { /* Create a new class ID */ - if ((ret_value = H5VL_register(cls, TRUE, vipl_id)) < 0) + if ((ret_value = H5VL_register_plugin(cls, TRUE, vipl_id)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL plugin") } /* end else */ done: FUNC_LEAVE_API(ret_value) -} /* end H5VLregister() */ +} /* end H5VLregister_driver() */ /*------------------------------------------------------------------------- - * Function: H5VLregister_by_name + * Function: H5VLregister_plugin_by_name * * Purpose: Registers a new VOL plugin as a member of the virtual object * layer class. @@ -173,17 +173,17 @@ done: * library is closed or the plugin is * unregistered. * - * Failure: A negative value. + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t -H5VLregister_by_name(const char *name, hid_t vipl_id) +H5VLregister_plugin_by_name(const char *name, hid_t vipl_id) { H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "*si", name, vipl_id); /* Check arguments */ @@ -215,13 +215,13 @@ H5VLregister_by_name(const char *name, hid_t vipl_id) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL plugin") /* Register the plugin we loaded */ - if ((ret_value = H5VL_register(cls, TRUE, vipl_id)) < 0) + if ((ret_value = H5VL_register_plugin(cls, TRUE, vipl_id)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL plugin ID") } /* end else */ done: FUNC_LEAVE_API(ret_value) -} /* end H5VLregister_by_name() */ +} /* end H5VLregister_driver_by_name() */ /*------------------------------------------------------------------------- @@ -259,7 +259,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLunregister + * Function: H5VLunregister_plugin * * Purpose: Removes a VOL plugin ID from the library. This in no way affects * file access property lists which have been defined to use @@ -273,7 +273,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLunregister(hid_t vol_id) +H5VLunregister_driver(hid_t vol_id) { herr_t ret_value = SUCCEED; /* Return value */ @@ -290,11 +290,11 @@ H5VLunregister(hid_t vol_id) done: FUNC_LEAVE_API(ret_value) -} /* end H5VLunregister() */ +} /* end H5VLunregister_driver() */ /*------------------------------------------------------------------------- - * Function: H5VLis_registered + * Function: H5VLis_driver_registered * * Purpose: Tests whether a VOL class has been registered or not * @@ -307,7 +307,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5VLis_registered(const char *name) +H5VLis_driver_registered(const char *name) { H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ htri_t ret_value = FALSE; /* Return value */ @@ -327,7 +327,7 @@ H5VLis_registered(const char *name) done: FUNC_LEAVE_API(ret_value) -} /* end H5VLis_registered() */ +} /* end H5VLis_driver_registered() */ /*------------------------------------------------------------------------- @@ -468,67 +468,6 @@ done: FUNC_LEAVE_API(ret_value) } /* H5VLcmp_plugin_info() */ - -/*--------------------------------------------------------------------------- - * Function: H5VLobject_register - * - * Purpose: Public routine to create an HDF5 hid_t with library - * specific types, bypassing the limitation of H5Iregister. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *--------------------------------------------------------------------------- - */ -hid_t -H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t plugin_id) -{ - hid_t ret_value = FAIL; - - FUNC_ENTER_API(FAIL) - H5TRACE3("i", "*xIti", obj, obj_type, plugin_id); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object to register") - - if ((ret_value = H5VL_object_register(obj, obj_type, plugin_id, TRUE)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "unable to register object") - -done: - FUNC_LEAVE_API(ret_value) -} /* H5VLobject_register */ - - -/*------------------------------------------------------------------------- - * 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() */ - /*------------------------------------------------------------------------- * Routines below this are public wrappers for stackable VOL plugins, and * should not be called by applications. @@ -708,12 +647,13 @@ done: void * H5VLget_object(void *obj, hid_t plugin_id) { - H5VL_class_t *cls = NULL; + H5VL_class_t *cls; void *ret_value = NULL; FUNC_ENTER_API_NOINIT H5TRACE2("*x", "*xi", obj, plugin_id); + /* Check args */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") diff --git a/src/H5VLint.c b/src/H5VLint.c index fcc7fa7..3899ba2 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -225,20 +225,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_register_id + * Function: H5VL_register * - * Purpose: Wrapper to register an object ID with a VOL aux struct - * and increment ref count on VOL plugin ID + * Purpose: VOL-aware version of H5I_register. Constructs an H5VL_object_t + * from the passed-in object and registers that. Does the right + * thing with datatypes, which are complicated under the VOL. * - * Return: Success: A valid HDF5 ID + * Return: Success: A valid HDF5 ID * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t -H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref) +H5VL_register(H5I_type_t type, const void *object, H5VL_t *vol_plugin, hbool_t app_ref) { - H5VL_object_t *new_obj = NULL; + H5VL_object_t *vol_obj = NULL; hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI(H5I_INVALID_HID) @@ -247,35 +248,138 @@ H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ HDassert(object); HDassert(vol_plugin); - /* Setup VOL object */ - if (NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) + /* 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") - new_obj->plugin = vol_plugin; - new_obj->data = object; + vol_obj->plugin = vol_plugin; + vol_obj->data = object; /* Increment ref count, for new object */ vol_plugin->nrefs++; - /* Special wrapper for named datatypes */ + /* Datatypes need special handling under the VOL, since they have a non-VOL aspect */ if (H5I_DATATYPE == type) { H5T_t *dt; /* Wrap "real" (non-named) datatype around VOL object, so it's compatible with H5T interface */ - if (NULL == (dt = H5T_construct_datatype(new_obj))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "can't construct datatype object") + if (NULL == (dt = H5T_construct_datatype(vol_obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "can't construct datatype object") /* New object is _actually_ the datatype */ - new_obj = (H5VL_object_t *)dt; + vol_obj = (H5VL_object_t *)dt; } /* end if */ /* Register VOL object as _object_ type, for future object API calls */ /* (Except for named datatypes, as above) */ - if ((ret_value = H5I_register(type, new_obj, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle") + 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) +} /* end H5VL_register() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_register_using_existing_id + * + * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it. + * This routine will check to ensure the supplied ID is not already + * in use, and ensure that it is a valid ID for the given type, + * but will NOT check to ensure the OBJECT is not already + * registered (thus, it is possible to register one object under + * multiple IDs). + * + * NOTE: Intended for use in refresh calls, where we have to close + * and re-open the underlying data, then hook the VOL object back + * up to the original ID. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +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_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); + + /* 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; + + /* Call the underlying H5I function to complete the registration */ + if(H5I_register_using_existing_id(type, stored_obj, app_ref, existing_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register object under existing ID") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_register_using_existing_id() */ + + +/*------------------------------------------------------------------------- + * 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 plugin's ID to + * get the plugin information instead of it being passed in. + * + * Return: Success: A valid HDF5 ID + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5VL_register_using_vol_id(H5I_type_t type, const void *obj, hid_t plugin_id, hbool_t app_ref) +{ + H5VL_class_t *cls = NULL; + H5VL_t *plugin = NULL; /* VOL plugin struct */ + hid_t ret_value = H5I_INVALID_HID; + + FUNC_ENTER_NOAPI(FAIL) + + /* Get the VOL class object from the plugin's ID */ + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL plugin ID") + + /* Setup VOL info struct */ + if (NULL == (plugin = H5FL_CALLOC(H5VL_t))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate VOL info struct") + plugin->cls = cls; + plugin->id = plugin_id; + if (H5I_inc_ref(plugin->id, FALSE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") + + /* Get an ID for the VOL object */ + if ((ret_value = H5VL_register(type, obj, plugin, app_ref)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_register_id() */ +} /* end H5VL_register_using_vol_id() */ /*------------------------------------------------------------------------- @@ -314,7 +418,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_register + * Function: H5VL_register_plugin * * Purpose: Registers a new VOL plugin as a member of the virtual object * layer class. @@ -327,7 +431,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VL_register(const void *_cls, hbool_t app_ref, hid_t vipl_id) +H5VL_register_plugin(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; @@ -340,16 +444,16 @@ H5VL_register(const void *_cls, hbool_t app_ref, hid_t vipl_id) /* Copy the class structure so the caller can reuse or free it */ if (NULL == (saved = H5FL_CALLOC(H5VL_class_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for VOL plugin class struct") + HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for VOL plugin class struct") HDmemcpy(saved, cls, sizeof(H5VL_class_t)); /* Initialize the VOL plugin */ if(cls->initialize && cls->initialize(vipl_id) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, H5I_INVALID_HID, "unable to init VOL plugin") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to init VOL plugin") /* 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 plugin ID") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL plugin ID") done: if (ret_value < 0) @@ -357,47 +461,7 @@ done: H5FL_FREE(H5VL_class_t, saved); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_register() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_register - * - * Purpose: Utility function to create a user ID for an object created - * or opened through the VOL - * - * Return: Success: A valid HDF5 ID - * Failure: H5I_INVALID_HID - * - *------------------------------------------------------------------------- - */ -hid_t -H5VL_object_register(void *obj, H5I_type_t obj_type, hid_t plugin_id, hbool_t app_ref) -{ - H5VL_class_t *cls = NULL; - H5VL_t *plugin = NULL; /* VOL plugin struct */ - hid_t ret_value = H5I_INVALID_HID; - - FUNC_ENTER_NOAPI(FAIL) - - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL plugin ID") - - /* Setup VOL info struct */ - if (NULL == (plugin = H5FL_CALLOC(H5VL_t))) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VOL info struct") - plugin->cls = cls; - plugin->id = plugin_id; - if (H5I_inc_ref(plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") - - /* Get an ID for the VOL object */ - if ((ret_value = H5VL_register_id(obj_type, obj, plugin, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_register() */ +} /* end H5VL_register_plugin() */ /*------------------------------------------------------------------------- @@ -413,16 +477,16 @@ done: ssize_t H5VL_get_plugin_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; + ssize_t ret_value; FUNC_ENTER_NOAPI(FAIL) /* get the object pointer */ - if (NULL == (vol_obj = H5VL_get_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + if (NULL == (vol_obj = H5VL_vol_object(id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid VOL identifier") cls = vol_obj->plugin->cls; @@ -442,7 +506,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_get_object + * Function: H5VL_vol_object * * Purpose: Utility function to return the object pointer associated with * a hid_t. This routine is the same as H5I_object for all types @@ -455,7 +519,7 @@ done: *------------------------------------------------------------------------- */ H5VL_object_t * -H5VL_get_object(hid_t id) +H5VL_vol_object(hid_t id) { void *obj = NULL; H5I_type_t obj_type; @@ -482,7 +546,7 @@ H5VL_get_object(hid_t id) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_get_object() */ +} /* end H5VL_vol_object() */ /*------------------------------------------------------------------------- @@ -638,16 +702,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_verify() */ - -/* XXX (VOL MERGE): This could be a macro like in H5F */ -void * -H5VL_plugin_object(H5VL_object_t *vol_obj) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(vol_obj->data) -} /* end H5VL_plugin_object() */ - /*------------------------------------------------------------------------- * Function: H5VL_cmp_plugin_cls diff --git a/src/H5VLnative.c b/src/H5VLnative.c index d071b3a..b67caa6 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -40,8 +40,8 @@ #include "H5Rpkg.h" /* References */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tpkg.h" /* Datatypes */ -#include "H5VLprivate.h" /* VOL plugins */ -#include "H5VLnative.h" /* Native VOL plugin */ +#include "H5VLprivate.h" /* VOL drivers */ +#include "H5VLnative_private.h" /* Native VOL plugin */ /* * The VOL plugin identification number. @@ -221,8 +221,8 @@ H5VL_native_init(hid_t vipl_id) /* Register the native VOL plugin, if it isn't already */ if(NULL == H5I_object_verify(H5VL_NATIVE_ID_g, H5I_VOL)) - if((H5VL_NATIVE_ID_g = H5VL_register((const H5VL_class_t *)&H5VL_native_cls_g, TRUE, vipl_id)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL plugin") + if((H5VL_NATIVE_ID_g = H5VL_register_plugin((const H5VL_class_t *)&H5VL_native_cls_g, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL plugin") /* Set return value */ ret_value = H5VL_NATIVE_ID_g; @@ -388,7 +388,7 @@ done: *--------------------------------------------------------------------------- */ hid_t -H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref) +H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref) { hid_t ret_value = H5I_INVALID_HID; @@ -405,7 +405,7 @@ H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref) HDassert(0 && "H5VL_native_register"); /* Get an ID for the object */ - if((ret_value = H5VL_object_register(obj, type, H5VL_NATIVE_ID_g, app_ref)) < 0) + 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: diff --git a/src/H5VLnative.h b/src/H5VLnative.h index 6751601..d26c2d1 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -17,9 +17,6 @@ #ifndef _H5VLnative_H #define _H5VLnative_H -/* Initializer function for native VOL driver */ -#define H5VL_NATIVE (H5VL_native_init(H5P_DEFAULT)) - /* Characteristics of the native VOL driver */ #define H5VL_NATIVE_NAME "native" #define H5VL_NATIVE_VALUE H5_VOL_NATIVE /* enum value */ @@ -30,11 +27,7 @@ extern "C" { #endif -/* XXX (VOL_MERGE): Poor separation of public and private functionality here */ H5_DLL herr_t H5Pset_fapl_native(hid_t fapl_id); -H5_DLL hid_t H5VL_native_get_driver_id(void); -H5_DLL hid_t H5VL_native_init(hid_t vipl_id); -H5_DLL hid_t H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref); #ifdef __cplusplus } diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h new file mode 100644 index 0000000..873557a --- /dev/null +++ b/src/H5VLnative_private.h @@ -0,0 +1,39 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: The private header file for the native VOL driver. + */ + +#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(H5P_DEFAULT)) + + +#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); + +#ifdef __cplusplus +} +#endif + +#endif /* _H5VLnative_private_H */ diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 1da5a43..1defb13 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -53,25 +53,36 @@ typedef struct H5VL_plugin_prop_t { /* Library Private Prototypes */ /******************************/ -/* Common functions */ +/* Utility functions */ H5_DLL herr_t H5VL_init(void); -H5_DLL hid_t H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref); -H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj); -H5_DLL hid_t H5VL_register(const void *cls, hbool_t app_ref, hid_t vipl_id); -H5_DLL hid_t H5VL_object_register(void *obj, H5I_type_t obj_type, hid_t plugin_id, hbool_t app_ref); -H5_DLL hid_t H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref); -H5_DLL ssize_t H5VL_get_plugin_name(hid_t id, char *name/*out*/, size_t size); -H5_DLL H5VL_object_t *H5VL_get_object(hid_t id); -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_plugin_object(H5VL_object_t *obj); H5_DLL int H5VL_cmp_plugin_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls); H5_DLL int H5VL_copy_plugin_info(const H5VL_class_t *plugin, void **dst_info, const void *src_info); H5_DLL int H5VL_cmp_plugin_info(const H5VL_class_t *plugin, const void *info1, const void *info2); H5_DLL herr_t H5VL_free_plugin_info(const H5VL_class_t *plugin, void *info); + +/* Functions that deal with VOL plugins */ +H5_DLL hid_t H5VL_register_plugin(const void *cls, hbool_t app_ref, hid_t vipl_id); +H5_DLL ssize_t H5VL_get_plugin_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 + * the H5VL calls with objects that go through the VOL, such as + * datasets and groups, and the H5I calls with objects + * that do not, such as property lists and dataspaces. Datatypes + * are can be either named, where they will use the VOL, or not, + * and thus require special treatment. See the datatype docs for + * how to handle this. + */ + +/* Functions that manipulate VOL objects */ +H5_DLL void *H5VL_object(hid_t id); +H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type); +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 *plugin, void *obj, void **wrap_ctx); H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *plugin, void *wrap_ctx); @@ -80,6 +91,12 @@ H5_DLL herr_t H5VL_reset_vol_wrapper(void); H5_DLL void * H5VL_wrap_object(const H5VL_class_t *plugin, void *wrap_ctx, void *obj); +/* ID registration functions */ +H5_DLL hid_t H5VL_register(H5I_type_t type, const void *object, H5VL_t *vol_plugin, 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, 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); + /****************************** * VOL plugin callback wrappers *****************************/ diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index e345c2a..2daa5d4 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -409,23 +409,21 @@ extern "C" { #endif /* VOL Plugin Functionality */ -H5_DLL hid_t H5VLregister(const H5VL_class_t *cls, hid_t vipl_id); -H5_DLL hid_t H5VLregister_by_name(const char *plugin_name, hid_t vipl_id); -H5_DLL htri_t H5VLis_registered(const char *name); +H5_DLL hid_t H5VLregister_plugin(const H5VL_class_t *cls, hid_t vipl_id); +H5_DLL hid_t H5VLregister_plugin_by_name(const char *plugin_name, hid_t vipl_id); +H5_DLL htri_t H5VLis_plugin_registered(const char *name); H5_DLL hid_t H5VLget_plugin_id(const char *name); H5_DLL ssize_t H5VLget_plugin_name(hid_t id, char *name/*out*/, size_t size); H5_DLL herr_t H5VLclose(hid_t plugin_id); -H5_DLL herr_t H5VLunregister(hid_t plugin_id); +H5_DLL herr_t H5VLunregister_plugin(hid_t plugin_id); -/************************************************************************** - * VOL callback wrappers and helper routines, for VOL plugin authors only * - * (Not part of the public API for application developers) * - **************************************************************************/ +/***************************************************************************** + * VOL callback wrappers and helper routines, for _VOL_plugin_ authors only! * + * (Not part of the public API for _application_ developers) * + *****************************************************************************/ /* Helper routines for VOL plugin authors */ -H5_DLL hid_t H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t plugin_id); -H5_DLL void *H5VLobject(hid_t id); H5_DLL herr_t H5VLcmp_plugin_cls(int *cmp, hid_t plugin_id1, hid_t plugin_id2); H5_DLL herr_t H5VLcmp_plugin_info(int *cmp, hid_t plugin_id, const void *info1, const void *info2); @@ -52,4 +52,7 @@ #include "H5FDwindows.h" /* Win32 I/O */ #endif +/* Virtual object layer drivers */ +#include "H5VLnative.h" /* Native VOL driver */ + #endif |