diff options
72 files changed, 6212 insertions, 2464 deletions
@@ -984,6 +984,7 @@ ./src/H5Pdapl.c ./src/H5Pdcpl.c ./src/H5Pdeprec.c +./src/H5Pdevelop.h ./src/H5Pdxpl.c ./src/H5Pencdec.c ./src/H5Pfapl.c @@ -2992,6 +2993,7 @@ # test utilities ./utils/test/Makefile.am ./utils/test/swmr_check_compat_vfd.c +./utils/test/vds_elink_compat_vol.c # high level libraries ./hl/Makefile.am diff --git a/fortran/test/t.c b/fortran/test/t.c index 6c856fa..8917940 100644 --- a/fortran/test/t.c +++ b/fortran/test/t.c @@ -25,6 +25,7 @@ #include "t.h" #include "H5Eprivate.h" +#include "H5VLprivate.h" /*---------------------------------------------------------------------------- * Name: h5_fixname_c @@ -155,3 +156,25 @@ nh5_env_nocleanup_c(int_f *status) if (HDgetenv(HDF5_NOCLEANUP)) *status = (int_f)1; } /* h5_env_nocleanup_c */ + +/*---------------------------------------------------------------------------- + * Name: h5vl_fapl_is_native_c + * Purpose: Invokes the H5VL_fapl_is_native() operation + * Inputs: fapl - file access property list + * flag - flag indicating whether VOL connector stack in FAPL is the native connector + * Returns: 0 on success, -1 on failure + * Programmer: Quincey Koziol + * June 24, 2021 + *---------------------------------------------------------------------------*/ +int_f +h5vl_fapl_is_native_c(hid_t_f *fapl_id, int_f *flag) +{ + int ret_value = 0; + hbool_t is_native = FALSE; + + ret_value = H5VL_fapl_is_native((hid_t)*fapl_id, &is_native); + if (ret_value >= 0) + *flag = (int_f)is_native; + + return ret_value; +} /* h5vl_fapl_is_native_c */ diff --git a/fortran/test/t.h b/fortran/test/t.h index 2066552..a09d0c0 100644 --- a/fortran/test/t.h +++ b/fortran/test/t.h @@ -34,3 +34,5 @@ H5_FCTESTDLL int_f nh5_cleanup_c(_fcd base_name, size_t_f *base_namelen, hid_t_f H5_FCTESTDLL H5_ATTR_NORETURN void nh5_exit_c(int_f *status); H5_FCTESTDLL void nh5_env_nocleanup_c(int_f *status); + +H5_FCDLL int_f h5vl_fapl_is_native_c(hid_t_f *fapl_id, int_f *flag); diff --git a/fortran/test/tH5P_F03.F90 b/fortran/test/tH5P_F03.F90 index 245a588..ea0b678 100644 --- a/fortran/test/tH5P_F03.F90 +++ b/fortran/test/tH5P_F03.F90 @@ -736,6 +736,7 @@ SUBROUTINE test_vds(total_error) INTEGER(SIZE_T) :: nsize LOGICAL :: IsRegular INTEGER(HSIZE_T) :: gap_size + LOGICAL :: IsNative ! For testing against vdsdims_out_correct(1,1) = DIM0_1*5 @@ -904,6 +905,9 @@ SUBROUTINE test_vds(total_error) CALL H5Pcreate_f(H5P_DATASET_ACCESS_F, dapl, error) CALL check("H5Pcreate_f", error, total_error) + ! + ! Check for native VOL connector + CALL H5VL_fapl_is_native_f(H5P_DEFAULT_F, IsNative, error) DO i = 1, 2 IF(i.NE.1)THEN @@ -924,10 +928,24 @@ SUBROUTINE test_vds(total_error) CALL check("H5Sget_simple_extent_dims_f", error, total_error) ! check VDS dimensions + ! + ! NOTE: + ! When not using the native VOL connector, the VDS will have a 0 for the + ! initial dimension. If the library is updated to support virtual datasets + ! with other VOL connector stacks (either passthroughs or other terminal + ! connectors), this code can be returned to just checking that the + ! dimensions are correct. QAK, 2021/06/24 DO j = 1, RANK - IF(vdsdims_out(j).NE.vdsdims_out_correct(i,j))THEN - total_error = total_error + 1 - EXIT + IF(IsNative.OR.j.GT.1)THEN + IF(vdsdims_out(j).NE.vdsdims_out_correct(i,j))THEN + total_error = total_error + 1 + EXIT + ENDIF + ELSE + IF(vdsdims_out(j).NE.0)THEN + total_error = total_error + 1 + EXIT + ENDIF ENDIF ENDDO @@ -942,7 +960,6 @@ SUBROUTINE test_vds(total_error) IF(virtual_view .NE. H5D_VDS_LAST_AVAILABLE_F)THEN total_error = total_error + 1 ENDIF - ENDIF ! Close diff --git a/fortran/test/tf.F90 b/fortran/test/tf.F90 index b2cb746..4d13fb9 100644 --- a/fortran/test/tf.F90 +++ b/fortran/test/tf.F90 @@ -135,7 +135,7 @@ CONTAINS !DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_fixname_f !DEC$endif - USE H5GLOBAL + USE H5GLOBAL, ONLY : HID_T, SIZE_T IMPLICIT NONE CHARACTER(LEN=*), INTENT(IN) :: base_name ! base name CHARACTER(LEN=*), INTENT(IN) :: full_name ! full name @@ -149,7 +149,7 @@ CONTAINS INTERFACE INTEGER FUNCTION h5_fixname_c(base_name, base_namelen, fapl, & full_name, full_namelen) - USE H5GLOBAL + USE H5GLOBAL, ONLY : HID_T, SIZE_T !DEC$ IF DEFINED(HDF5F90_WINDOWS) !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5_FIXNAME_C':: h5_fixname_c !DEC$ ENDIF @@ -195,7 +195,7 @@ CONTAINS !DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_cleanup_f !DEC$endif - USE H5GLOBAL + USE H5GLOBAL, ONLY : HID_T, SIZE_T IMPLICIT NONE CHARACTER(LEN=*), INTENT(IN) :: base_name ! base name INTEGER, INTENT(OUT) :: hdferr ! Error code @@ -205,7 +205,7 @@ CONTAINS INTERFACE INTEGER FUNCTION h5_cleanup_c(base_name, base_namelen, fapl) - USE H5GLOBAL + USE H5GLOBAL, ONLY : HID_T, SIZE_T !DEC$ IF DEFINED(HDF5F90_WINDOWS) !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5_CLEANUP_C':: h5_cleanup_c !DEC$ ENDIF @@ -304,6 +304,56 @@ CONTAINS END SUBROUTINE h5_env_nocleanup_f +!---------------------------------------------------------------------- +! Name: h5vl_fapl_is_native_f +! +! Purpose: Invokes the H5VL_fapl_is_native() operation +! +! Inputs: fapl - file access property list +! flag - flag indicating whether VOL connector stack in FAPL is the native connector +! +! Outputs: IsNative - .true. - FAPL indicates that VOL connector stack is just native connector +! .false. - Not the native connector +! hdferr - Returns 0 on success and -1 on failure +! +! Programmer: Quincey Koziol +! June 24, 2021 +! +!---------------------------------------------------------------------- + SUBROUTINE h5vl_fapl_is_native_f(fapl_id, IsNative, hdferr) +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_TEST_DLL) +!DEC$attributes dllexport :: h5vl_fapl_is_native_f +!DEC$endif + USE H5GLOBAL, ONLY : HID_T + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: fapl_id + LOGICAL, INTENT(OUT) :: IsNative + INTEGER, INTENT(OUT) :: hdferr +!***** + INTEGER :: flag ! "TRUE/FALSE" flag from C routine + + INTERFACE + INTEGER FUNCTION h5vl_fapl_is_native_c(fapl_id, flag) BIND(C,NAME='h5vl_fapl_is_native_c') + USE H5GLOBAL, ONLY : HID_T + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5VL_FAPL_IS_NATIVE_C':: h5vl_fapl_is_native_c + !DEC$ ENDIF + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: fapl_id + INTEGER :: flag + END FUNCTION h5vl_fapl_is_native_c + END INTERFACE + + hdferr = h5vl_fapl_is_native_c(fapl_id, flag) + IF(hdferr.GE.0) THEN + IsNative = .FALSE. + IF (flag .EQ. 1) IsNative = .TRUE. + ENDIF + + END SUBROUTINE h5vl_fapl_is_native_f + ! --------------------------------------------------------------------------------------------------- ! H5_SIZEOF routines ! diff --git a/hl/test/h5hltest.h b/hl/test/h5hltest.h index 14f3e14..f1d7aa9 100644 --- a/hl/test/h5hltest.h +++ b/hl/test/h5hltest.h @@ -27,6 +27,9 @@ /* Include the High-Level private header */ #include "H5HLprivate2.h" +/* Include library private headers needed for testing */ +#include "H5VLprivate.h" + /* Macros used in HL tests */ #define HL_TESTING2(WHAT) \ { \ diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 53f834a..2276b8f 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1928,6 +1928,7 @@ test_valid_path(void) { hid_t file_id, group; htri_t path_valid; + hbool_t is_native; const char *data_string_in = "test"; HL_TESTING2("H5LTpath_valid"); @@ -1964,6 +1965,11 @@ test_valid_path(void) * ****************************************************************/ + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + if (H5VL_fapl_is_native(H5P_DEFAULT, &is_native) < 0) + goto out; + file_id = H5Fcreate(FILE_NAME3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /* @@ -2114,17 +2120,14 @@ test_valid_path(void) * CHECK ABSOLUTE PATHS **************************************/ - if ((path_valid = H5LTpath_valid(file_id, "/", TRUE)) != TRUE) { + if ((path_valid = H5LTpath_valid(file_id, "/", TRUE)) != TRUE) goto out; - } - if ((path_valid = H5LTpath_valid(file_id, "/", FALSE)) != TRUE) { + if ((path_valid = H5LTpath_valid(file_id, "/", FALSE)) != TRUE) goto out; - } - if ((path_valid = H5LTpath_valid(file_id, "/G1", TRUE)) != TRUE) { + if ((path_valid = H5LTpath_valid(file_id, "/G1", TRUE)) != TRUE) goto out; - } if ((path_valid = H5LTpath_valid(file_id, "/G1/DS1", TRUE)) != TRUE) goto out; @@ -2171,13 +2174,11 @@ test_valid_path(void) if ((group = H5Gopen2(file_id, "/", H5P_DEFAULT)) < 0) goto out; - if ((path_valid = H5LTpath_valid(group, "/", TRUE)) != TRUE) { + if ((path_valid = H5LTpath_valid(group, "/", TRUE)) != TRUE) goto out; - } - if ((path_valid = H5LTpath_valid(group, "/", FALSE)) != TRUE) { + if ((path_valid = H5LTpath_valid(group, "/", FALSE)) != TRUE) goto out; - } if (H5Gclose(group) < 0) goto out; @@ -2240,17 +2241,20 @@ test_valid_path(void) if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", FALSE)) != TRUE) goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", TRUE)) != TRUE) - goto out; + if (is_native) { + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", TRUE)) != TRUE) + goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/DS1", TRUE)) != TRUE) - goto out; + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/DS1", TRUE)) != TRUE) + goto out; + } if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/G20", FALSE)) != TRUE) goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/DS1", TRUE)) != TRUE) - goto out; + if (is_native) + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/DS1", TRUE)) != TRUE) + goto out; if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/G20", FALSE)) != TRUE) goto out; diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index cfff680..bbe44f7 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -9622,6 +9622,38 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_hyper_vector_size(long dxpl_id, long vector_size) throws HDF5LibraryException, NullPointerException; + /** + * + * Set flag to indicate that an API wrapper for a plugin's + * public wrapper API call (e.g. H5VLfile_create, H5FDopen, etc) + * should open a new API context for the API call. + * + * @param dxpl_id + * IN: Dataset transfer property list identifier. + * @param new_api_ctx + * IN: Indicate that API wrapper should create new API context + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Pset_plugin_new_api_context(long dxpl_id, boolean new_api_ctx) + throws HDF5LibraryException; + + /** + * Retrieve "new API context" flag for plugin wrapper API calls. + * + * @param dxpl_id + * IN: Dataset transfer property list identifier. + * + * @return true if the given dxpl indicates API wrapper should create new API context + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native boolean H5Pget_plugin_new_api_context(long dxpl_id) + throws HDF5LibraryException; + // /////// Link creation property list (LCPL) routines /////// /** @@ -13573,6 +13605,16 @@ public class H5 implements java.io.Serializable { **/ public synchronized static native void H5VLunregister_connector(long connector_id) throws HDF5LibraryException; + /** + * H5VLfapl_is_native queries if a FAPL will use the native VOL connector. + * + * @param fapl_id + * The ID of the FAPL to query. + * @return true if fapl_id uses the native VOL connector. + * + **/ + public synchronized static native boolean H5VLfapl_is_native(long fapl_id) throws HDF5LibraryException; + // /////// unimplemented //////// // hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id); diff --git a/java/src/jni/h5pDXPLImp.c b/java/src/jni/h5pDXPLImp.c index c555d53..12618a6 100644 --- a/java/src/jni/h5pDXPLImp.c +++ b/java/src/jni/h5pDXPLImp.c @@ -448,6 +448,52 @@ done: } /* end Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios */ /* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_plugin_new_api_context + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1plugin_1new_1api_1context(JNIEnv *env, jclass clss, jlong dcpl_id, + jboolean new_api_ctx) +{ + hbool_t new_api_ctx_val; + herr_t retVal = FAIL; + + UNUSED(clss); + + new_api_ctx_val = (JNI_TRUE == new_api_ctx) ? TRUE : FALSE; + + if ((retVal = H5Pset_plugin_new_api_context((hid_t)dcpl_id, (hbool_t)new_api_ctx_val)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + return; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1plugin_1new_1api_1context */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_plugin_new_api_context + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1plugin_1new_1api_1context(JNIEnv *env, jclass clss, jlong dcpl_id) +{ + hbool_t new_api_ctx = FALSE; + jboolean bval = JNI_FALSE; + + UNUSED(clss); + + if (H5Pget_plugin_new_api_context((hid_t)dcpl_id, (hbool_t *)&new_api_ctx) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (new_api_ctx == TRUE) + bval = JNI_TRUE; + +done: + return bval; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1plugin_1new_1api_1context */ + +/* * TODO: H5Pset_vlen_mem_manager */ diff --git a/java/src/jni/h5pDXPLImp.h b/java/src/jni/h5pDXPLImp.h index 21c40c4..c03d61c 100644 --- a/java/src/jni/h5pDXPLImp.h +++ b/java/src/jni/h5pDXPLImp.h @@ -134,6 +134,21 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios(JNIEnv *, jclas jdoubleArray, jdoubleArray); /* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_plugin_new_api_context + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1plugin_1new_1api_1context(JNIEnv *, jclass, jlong, + jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_plugin_new_api_context + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1plugin_1new_1api_1context(JNIEnv *, jclass, jlong); + +/* * TODO: H5Pset_vlen_mem_manager */ diff --git a/java/src/jni/h5vlImp.c b/java/src/jni/h5vlImp.c index 40f8863..ae56e56 100644 --- a/java/src/jni/h5vlImp.c +++ b/java/src/jni/h5vlImp.c @@ -278,6 +278,27 @@ done: return; } /* end Java_hdf_hdf5lib_H5_H5VLunregister_1connector */ +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLfapl_is_native + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5VLfapl_1is_1native(JNIEnv *env, jclass clss, jlong fapl_id) +{ + hbool_t bval = JNI_FALSE; + + UNUSED(clss); + + if (H5VLfapl_is_native((hid_t)fapl_id, &bval) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + bval = (bval > 0) ? JNI_TRUE : JNI_FALSE; + +done: + return (jboolean)bval; +} + #ifdef __cplusplus } /* end extern "C" */ #endif /* __cplusplus */ diff --git a/java/src/jni/h5vlImp.h b/java/src/jni/h5vlImp.h index a17807f..0cc3366 100644 --- a/java/src/jni/h5vlImp.h +++ b/java/src/jni/h5vlImp.h @@ -93,6 +93,13 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5VLclose(JNIEnv *, jclass, jlong); */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5VLunregister_1connector(JNIEnv *, jclass, jlong); +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLfapl_is_native + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5VLfapl_1is_1native(JNIEnv *, jclass, jlong); + #ifdef __cplusplus } /* end extern "C" */ #endif /* __cplusplus */ diff --git a/java/test/TestH5Ocreate.java b/java/test/TestH5Ocreate.java index 78ea744..774a78d 100644 --- a/java/test/TestH5Ocreate.java +++ b/java/test/TestH5Ocreate.java @@ -276,18 +276,22 @@ public class TestH5Ocreate { @Test public void testH5Oget_info_externallink() { - H5O_info_t obj_info = null; - _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - try { - obj_info = H5.H5Oget_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5Oget_info: " + err); + if (H5.H5VLfapl_is_native(HDF5Constants.H5P_DEFAULT)) { + H5O_info_t obj_info = null; + + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + try { + obj_info = H5.H5Oget_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info", obj_info==null); + assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE); + assertTrue("Link Object Token", obj_info.token != null); } - assertFalse("H5Oget_info", obj_info==null); - assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE); - assertTrue("Link Object Token", obj_info.token != null); } @Test diff --git a/java/test/TestH5VL.java b/java/test/TestH5VL.java index 4253d20..49f0788 100644 --- a/java/test/TestH5VL.java +++ b/java/test/TestH5VL.java @@ -168,5 +168,10 @@ public class TestH5VL { public void testH5VLunregister_connector_NegativeID() throws Throwable { H5.H5VLunregister_connector(-1); } + + @Test(expected = HDF5LibraryException.class) + public void testH5VLfapl_is_native() throws Throwable { + H5.H5VLfapl_is_native(-1); + } } diff --git a/java/test/testfiles/JUnit-TestH5VL.txt b/java/test/testfiles/JUnit-TestH5VL.txt index ff94969..96247af 100644 --- a/java/test/testfiles/JUnit-TestH5VL.txt +++ b/java/test/testfiles/JUnit-TestH5VL.txt @@ -1,5 +1,6 @@ JUnit version 4.11 .testH5VLget_connector_id_by_name +.testH5VLfapl_is_native .testH5VLget_connector_id_by_value .testH5VLget_connector_id .testH5VLnative_init @@ -9,5 +10,5 @@ JUnit version 4.11 Time: XXXX -OK (7 tests) +OK (8 tests) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cde36c9..f326c4c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -520,6 +520,7 @@ set (H5P_SOURCES ) set (H5P_HDRS + ${HDF5_SRC_DIR}/H5Pdevelop.h ${HDF5_SRC_DIR}/H5Ppublic.h ) IDE_GENERATED_PROPERTIES ("H5P" "${H5P_HDRS}" "${H5P_SOURCES}" ) @@ -664,7 +664,7 @@ done: * Failure: Negative. * * Programmer: Quincey Koziol - * Februrary 22, 2018 + * February 22, 2018 * *------------------------------------------------------------------------- */ @@ -754,7 +754,7 @@ H5CX__get_context(void) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 22, 2018 + * February 22, 2018 * *------------------------------------------------------------------------- */ @@ -795,7 +795,7 @@ H5CX__push_common(H5CX_node_t *cnode) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 19, 2018 + * February 19, 2018 * *------------------------------------------------------------------------- */ @@ -828,7 +828,7 @@ done: * Return: <none> * * Programmer: Quincey Koziol - * Februrary 22, 2018 + * February 22, 2018 * *------------------------------------------------------------------------- */ @@ -850,6 +850,52 @@ H5CX_push_special(void) } /* end H5CX_push_special() */ /*------------------------------------------------------------------------- + * Function: H5CX_test_and_push + * + * Purpose: Pushes a context for an API call, if one isn't already pushed. + * + * Return: <none> + * + * Programmer: Quincey Koziol + * June 9, 2021 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_test_and_push(hbool_t *pushed) +{ + H5CX_node_t **head = NULL; /* Pointer to head of API context list */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(pushed); + + /* Check for API context already pushed */ + head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + if (NULL == *head) { + H5CX_node_t *cnode = NULL; /* Context node */ + + /* Allocate & clear API context node */ + if (NULL == (cnode = H5FL_CALLOC(H5CX_node_t))) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "unable to allocate new struct") + + /* Set context info */ + H5CX__push_common(cnode); + + /* Indicate that the context was pushed */ + *pushed = TRUE; + } /* end if */ + else + /* Context was not pushed */ + *pushed = FALSE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_test_and_push() */ + +/*------------------------------------------------------------------------- * Function: H5CX_retrieve_state * * Purpose: Retrieve the state of an API context, for later resumption. @@ -1312,7 +1358,7 @@ H5CX_set_lapl(hid_t lapl_id) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 19, 2018 + * February 19, 2018 * *------------------------------------------------------------------------- */ @@ -1567,7 +1613,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 20, 2018 + * February 20, 2018 * *------------------------------------------------------------------------- */ @@ -1699,7 +1745,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 20, 2018 + * February 20, 2018 * *------------------------------------------------------------------------- */ @@ -1729,7 +1775,7 @@ H5CX_get_tag(void) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 22, 2018 + * February 22, 2018 * *------------------------------------------------------------------------- */ @@ -1761,7 +1807,7 @@ H5CX_get_ring(void) * Return: TRUE / FALSE on success / <can't fail> * * Programmer: Quincey Koziol - * Februrary 23, 2018 + * February 23, 2018 * *------------------------------------------------------------------------- */ @@ -1793,7 +1839,7 @@ H5CX_get_coll_metadata_read(void) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -1889,7 +1935,7 @@ H5CX_get_mpio_rank0_bcast(void) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 23, 2018 + * February 23, 2018 * *------------------------------------------------------------------------- */ @@ -1925,7 +1971,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 25, 2018 + * February 25, 2018 * *------------------------------------------------------------------------- */ @@ -1960,7 +2006,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 25, 2018 + * February 25, 2018 * *------------------------------------------------------------------------- */ @@ -1995,7 +2041,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 25, 2018 + * February 25, 2018 * *------------------------------------------------------------------------- */ @@ -2030,7 +2076,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 25, 2018 + * February 25, 2018 * *------------------------------------------------------------------------- */ @@ -2065,7 +2111,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 25, 2018 + * February 25, 2018 * *------------------------------------------------------------------------- */ @@ -2102,7 +2148,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 25, 2018 + * February 25, 2018 * *------------------------------------------------------------------------- */ @@ -2137,7 +2183,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -2353,7 +2399,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -2388,7 +2434,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -2423,7 +2469,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -2878,7 +2924,7 @@ done: * Return: <none> * * Programmer: Quincey Koziol - * Februrary 20, 2018 + * February 20, 2018 * *------------------------------------------------------------------------- */ @@ -2906,7 +2952,7 @@ H5CX_set_tag(haddr_t tag) * Return: <none> * * Programmer: Quincey Koziol - * Februrary 20, 2018 + * February 20, 2018 * *------------------------------------------------------------------------- */ @@ -2936,7 +2982,7 @@ H5CX_set_ring(H5AC_ring_t ring) * Return: <none> * * Programmer: Quincey Koziol - * Februrary 23, 2018 + * February 23, 2018 * *------------------------------------------------------------------------- */ @@ -2966,7 +3012,7 @@ H5CX_set_coll_metadata_read(hbool_t cmdr) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -2999,7 +3045,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -3033,7 +3079,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -3658,7 +3704,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 19, 2018 + * February 19, 2018 * *------------------------------------------------------------------------- */ diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index c500356..53bcc4c 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -63,6 +63,7 @@ typedef struct H5CX_state_t { /* Library private routines */ #ifndef H5private_H H5_DLL herr_t H5CX_push(void); +H5_DLL herr_t H5CX_test_and_push(hbool_t *pushed); H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); #endif /* H5private_H */ H5_DLL void H5CX_push_special(void); diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index ad9794d..8e7fd38 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -79,12 +79,13 @@ #define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME \ "local_no_collective_cause" /* cause of broken collective I/O in each process */ #define H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME \ - "global_no_collective_cause" /* cause of broken collective I/O in all processes */ -#define H5D_XFER_EDC_NAME "err_detect" /* EDC */ -#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */ -#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */ -#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */ -#define H5D_XFER_DSET_IO_SEL_NAME "dset_io_selection" /* Dataset I/O selection */ + "global_no_collective_cause" /* cause of broken collective I/O in all processes */ +#define H5D_XFER_EDC_NAME "err_detect" /* EDC */ +#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */ +#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */ +#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */ +#define H5D_XFER_DSET_IO_SEL_NAME "dset_io_selection" /* Dataset I/O selection */ +#define H5D_XFER_PLUGIN_NEW_API_CTX_NAME "plugin_new_api_context" /* Plugin new API context */ #ifdef H5_HAVE_INSTRUMENTED_LIBRARY /* Collective chunk instrumentation properties */ #define H5D_XFER_COLL_CHUNK_LINK_HARD_NAME "coll_chunk_link_hard" diff --git a/src/H5ESint.c b/src/H5ESint.c index 6f9efe9..b3edaaa 100644 --- a/src/H5ESint.c +++ b/src/H5ESint.c @@ -294,7 +294,10 @@ H5ES__insert(H5ES_t *es, H5VL_t *connector, void *request_token, const char *app * there's no need to duplicate it. */ ev->op_info.api_name = caller; - if (NULL == (ev->op_info.api_args = H5MM_xstrdup(api_args))) + ev->op_info.api_args = H5MM_xstrdup(api_args); + + /* 'api_args' is allowed to be NULL, but if it isn't, check for allocation failure */ + if (api_args && NULL == ev->op_info.api_args) HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't copy API routine arguments") /* Append fully initialized event onto the event set's 'active' list */ @@ -817,14 +820,21 @@ H5ES__get_err_info_cb(H5ES_event_t *ev, void *_ctx) /* The 'app_func_name', 'app_file_name', and 'api_name' strings are statically allocated (by the compiler) * so there's no need to duplicate them internally, but they are duplicated * here, when they are given back to the user. + * + * They are also allowed to be NULL, so only check for NULL values from + * the strdup when the original string is non-NULL. */ - if (NULL == (ctx->curr_err_info->api_name = H5MM_strdup(ev->op_info.api_name))) + ctx->curr_err_info->api_name = H5MM_strdup(ev->op_info.api_name); + if (ev->op_info.api_name && NULL == ctx->curr_err_info->api_name) HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 API routine name") - if (NULL == (ctx->curr_err_info->api_args = H5MM_strdup(ev->op_info.api_args))) + ctx->curr_err_info->api_args = H5MM_strdup(ev->op_info.api_args); + if (ev->op_info.api_args && NULL == ctx->curr_err_info->api_args) HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 API routine arguments") - if (NULL == (ctx->curr_err_info->app_file_name = H5MM_strdup(ev->op_info.app_file_name))) + ctx->curr_err_info->app_file_name = H5MM_strdup(ev->op_info.app_file_name); + if (ev->op_info.app_file_name && NULL == ctx->curr_err_info->app_file_name) HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 application file name") - if (NULL == (ctx->curr_err_info->app_func_name = H5MM_strdup(ev->op_info.app_func_name))) + ctx->curr_err_info->app_func_name = H5MM_strdup(ev->op_info.app_func_name); + if (ev->op_info.app_func_name && NULL == ctx->curr_err_info->app_func_name) HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 application function name") ctx->curr_err_info->app_line_num = ev->op_info.app_line_num; ctx->curr_err_info->op_ins_count = ev->op_info.op_ins_count; @@ -69,7 +69,6 @@ static int H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNU static int H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void *key); /* Helper routines for sync/async API calls */ -static herr_t H5F__post_open_api_common(H5VL_object_t *vol_obj, void **token_ptr); static hid_t H5F__create_api_common(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id, void **token_ptr); static hid_t H5F__open_api_common(const char *filename, unsigned flags, hid_t fapl_id, void **token_ptr); @@ -510,43 +509,6 @@ done: } /* end H5Fis_accessible() */ /*------------------------------------------------------------------------- - * Function: H5F__post_open_api_common - * - * Purpose: This is the common function for 'post open' operations - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5F__post_open_api_common(H5VL_object_t *vol_obj, void **token_ptr) -{ - uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check for 'post open' callback */ - supported = 0; - if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't check for 'post open' operation") - if (supported & H5VL_OPT_QUERY_SUPPORTED) { - H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ - - /* Set up VOL callback arguments */ - vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN; - vol_cb_args.args = NULL; - - /* Make the 'post open' callback */ - if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to make file 'post open' callback") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__post_open_api_common() */ - -/*------------------------------------------------------------------------- * Function: H5F__create_api_common * * Purpose: This is the common function for creating new HDF5 files. @@ -558,10 +520,7 @@ done: static hid_t H5F__create_api_common(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id, void **token_ptr) { - void * 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 = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_STATIC @@ -589,18 +548,6 @@ H5F__create_api_common(const char *filename, unsigned flags, hid_t fcpl_id, hid_ if (H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Get the VOL info from the fapl */ - if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") - if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") - - /* Stash a copy of the "top-level" connector property, before any pass-through - * connectors modify or unwrap it. - */ - if (H5CX_set_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context") - /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for * reading and writing. @@ -610,14 +557,10 @@ H5F__create_api_common(const char *filename, unsigned flags, hid_t fcpl_id, hid_ 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(&connector_prop, filename, flags, fcpl_id, fapl_id, - H5P_DATASET_XFER_DEFAULT, token_ptr))) + if ((ret_value = + H5VL_file_create(filename, flags, fcpl_id, fapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") - /* Get an ID for the file */ - 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 register file handle") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__create_api_common() */ @@ -650,8 +593,7 @@ done: hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - H5VL_object_t *vol_obj = NULL; /* File object */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); @@ -660,14 +602,6 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if ((ret_value = H5F__create_api_common(filename, flags, fcpl_id, fapl_id, NULL)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously create file") - /* Get the file object */ - if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") - - /* Perform 'post open' operation */ - if (H5F__post_open_api_common(vol_obj, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") - done: FUNC_LEAVE_API(ret_value) } /* end H5Fcreate() */ @@ -687,10 +621,9 @@ hid_t H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t es_id) { - H5VL_object_t *vol_obj = NULL; /* File object */ - void * token = NULL; /* Request token for async operation */ - void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + void * token = NULL; /* Request token for async operation */ + void **token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE8("i", "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id); @@ -703,12 +636,14 @@ H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, c if ((ret_value = H5F__create_api_common(filename, flags, fcpl_id, fapl_id, token_ptr)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously create file") - /* Get the file object */ - if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") - /* If a token was created, add the token to the event set */ - if (NULL != token) + if (NULL != token) { + H5VL_object_t *vol_obj; /* File object */ + + /* Get the file object */ + if (NULL == (vol_obj = H5VL_vol_object(ret_value))) + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") + /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE8(__func__, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) { @@ -717,22 +652,7 @@ H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, c HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID") HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") } /* end if */ - - /* Reset token for 'post open' operation */ - /* (Unnecessary if create operation didn't change it, but not worth checking -QAK) */ - token = NULL; - - /* Perform 'post open' operation */ - if (H5F__post_open_api_common(vol_obj, token_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") - - /* If a token was created, add the token to the event set */ - if (NULL != token) - /* clang-format off */ - if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE8(__func__, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) - /* clang-format on */ - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + } /* end if */ done: FUNC_LEAVE_API(ret_value) @@ -752,10 +672,8 @@ done: static hid_t H5F__open_api_common(const char *filename, unsigned flags, hid_t fapl_id, void **token_ptr) { - void * 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 = H5I_INVALID_HID; /* Return value */ + hid_t file_id = H5I_INVALID_HID; /* File ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_STATIC @@ -779,26 +697,12 @@ H5F__open_api_common(const char *filename, unsigned flags, hid_t fapl_id, void * if (H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Get the VOL info from the fapl */ - if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") - if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") - - /* Stash a copy of the "top-level" connector property, before any pass-through - * connectors modify or unwrap it. - */ - if (H5CX_set_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context") - /* Open the file through the VOL layer */ - if (NULL == (new_file = H5VL_file_open(&connector_prop, filename, flags, fapl_id, - H5P_DATASET_XFER_DEFAULT, token_ptr))) + if (NULL == H5VL_file_open(filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr, &file_id)) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") - /* Get an ID for the file */ - 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 register file handle") + /* Set return value */ + ret_value = file_id; done: FUNC_LEAVE_NOAPI(ret_value) @@ -826,8 +730,7 @@ done: hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { - H5VL_object_t *vol_obj = NULL; /* File object */ - 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", "*sIui", filename, flags, fapl_id); @@ -836,14 +739,6 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if ((ret_value = H5F__open_api_common(filename, flags, fapl_id, NULL)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to synchronously open file") - /* Get the file object */ - if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") - - /* Perform 'post open' operation */ - if (H5F__post_open_api_common(vol_obj, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") - done: FUNC_LEAVE_API(ret_value) } /* end H5Fopen() */ @@ -864,10 +759,9 @@ hid_t H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, const char *filename, unsigned flags, hid_t fapl_id, hid_t es_id) { - H5VL_object_t *vol_obj = NULL; /* File object */ - void * token = NULL; /* Request token for async operation */ - void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + void * token = NULL; /* Request token for async operation */ + void **token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE7("i", "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id); @@ -880,12 +774,14 @@ H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, con if ((ret_value = H5F__open_api_common(filename, flags, fapl_id, token_ptr)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to asynchronously open file") - /* Get the file object */ - if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") - /* If a token was created, add the token to the event set */ - if (NULL != token) + if (NULL != token) { + H5VL_object_t *vol_obj = NULL; /* File object */ + + /* Get the file object */ + if (NULL == (vol_obj = H5VL_vol_object(ret_value))) + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") + /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE7(__func__, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) { @@ -894,22 +790,7 @@ H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, con HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID") HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") } /* end if */ - - /* Reset token for 'post open' operation */ - /* (Unnecessary if create operation didn't change it, but not worth checking -QAK) */ - token = NULL; - - /* Perform 'post open' operation */ - if (H5F__post_open_api_common(vol_obj, token_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") - - /* If a token was created, add the token to the event set */ - if (NULL != token) - /* clang-format off */ - if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(__func__, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) - /* clang-format on */ - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + } /* end if */ done: FUNC_LEAVE_API(ret_value) @@ -1462,8 +1343,7 @@ done: hid_t H5Freopen(hid_t file_id) { - H5VL_object_t *vol_obj = NULL; /* File object */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); @@ -1472,16 +1352,7 @@ H5Freopen(hid_t file_id) if ((ret_value = H5F__reopen_api_common(file_id, NULL)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to synchronously reopen file") - /* Get the file object */ - if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get handle for re-opened file") - - /* Perform 'post open' operation */ - if (H5F__post_open_api_common(vol_obj, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") - done: - /* XXX (VOL MERGE): If registration fails, file will not be closed */ FUNC_LEAVE_API(ret_value) } /* end H5Freopen() */ @@ -1500,10 +1371,9 @@ done: hid_t H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t file_id, hid_t es_id) { - H5VL_object_t *vol_obj = NULL; /* Object for loc_id */ - void * token = NULL; /* Request token for async operation */ - void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ - hid_t ret_value; /* Return value */ + void * token = NULL; /* Request token for async operation */ + void **token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ + hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "*s*sIuii", app_file, app_func, app_line, file_id, es_id); @@ -1516,12 +1386,14 @@ H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, h if ((ret_value = H5F__reopen_api_common(file_id, token_ptr)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to asynchronously reopen file") - /* Get the file object */ - if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get handle for re-opened file") - /* If a token was created, add the token to the event set */ - if (NULL != token) + if (NULL != token) { + H5VL_object_t *vol_obj = NULL; /* Object for loc_id */ + + /* Get the file object */ + if (NULL == (vol_obj = H5VL_vol_object(ret_value))) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get handle for re-opened file") + /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) { @@ -1530,22 +1402,7 @@ H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, h HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID") HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") } /* end if */ - - /* Reset token for 'post open' operation */ - /* (Unnecessary if create operation didn't change it, but not worth checking -QAK) */ - token = NULL; - - /* Perform 'post open' operation */ - if (H5F__post_open_api_common(vol_obj, token_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") - - /* If a token was created, add the token to the event set */ - if (NULL != token) - /* clang-format off */ - if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) - /* clang-format on */ - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + } /* end if */ done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Fefc.c b/src/H5Fefc.c index 2d4eff2..31cb7a2 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -63,6 +63,7 @@ struct H5F_efc_t { }; /* Private prototypes */ +static H5F_t *H5F__efc_open_real(const char *name, unsigned flags, hid_t fapl_id); static herr_t H5F__efc_release_real(H5F_efc_t *efc); static herr_t H5F__efc_remove_ent(H5F_efc_t *efc, H5F_efc_ent_t *ent); static void H5F__efc_try_close_tag1(H5F_shared_t *sf, H5F_shared_t **tail); @@ -119,6 +120,80 @@ done: } /* end H5F__efc_create() */ /*------------------------------------------------------------------------- + * Function: H5F__efc_open_real + * + * Purpose: Opens a file for the external file cache 'open' operation. + * + * Return: Pointer to open file on success + * NULL on failure + * + * Programmer: Quincey Koziol + * Saturday, June 12, 2021 + * + *------------------------------------------------------------------------- + */ +static H5F_t * +H5F__efc_open_real(const char *name, unsigned flags, hid_t fapl_id) +{ + H5VL_object_t *file_obj = NULL; /* Pointer to file VOL object */ + H5F_t * file = NULL; /* Pointer to opened file */ + hbool_t is_native; /* Whether the file VOL object is using the native VOL connector */ + H5F_t * ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(name); + + /* The data structures and algorithms that use this routine currently depend on + * having a native file object (H5F_t*). It seems possible to convert + * them to using a file VOL object (H5VL_object_t*), but that appears to + * be a fairly intensive task, so fail if the file VOL object is not using + * a "trivial" VOL connector stack, composed of only the native connector + * as the terminal connector, without any pass-through connectors. + */ + is_native = FALSE; + if (H5VL_fapl_is_native(fapl_id, &is_native) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't check for native VOL connector") + if (!is_native) + HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, NULL, "can't open files w/non-native VOL connector") + + /* Open the file VOL object */ + if (NULL == (file_obj = H5VL_file_open(name, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, NULL, NULL))) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") + + /* Get native file pointer from VOL object */ + if (NULL == (file = H5VL_object_data(file_obj))) { + /* Close opened file */ + if (H5F__close_obj(file_obj, NULL) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "can't close file") + + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get native file pointer") + } /* end if */ + + /* Release VOL object */ + if (H5VL_free_object(file_obj) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, NULL, "can't release file VOL object") + file_obj = NULL; + + /* Increment the number of open objects to prevent the file from being + * closed out from under us - "simulate" having an open file id. Note + * that this behaviour replaces the calls to H5F_incr_nopen_objs() and + * H5F_decr_nopen_objs() in H5L_extern_traverse(). + */ + /* NOTE: This assumes that file object is a _native_ file object and + * won't work with passthrough VOL connectors. + */ + file->nopen_objs++; + + /* Set return value */ + ret_value = file; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__efc_open_real() */ + +/*------------------------------------------------------------------------- * Function: H5F__efc_open * * Purpose: Opens a file using the external file cache. The target @@ -138,14 +213,12 @@ done: *------------------------------------------------------------------------- */ H5F_t * -H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) +H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fapl_id) { - H5F_efc_t * efc = NULL; /* External file cache for parent file */ - H5F_efc_ent_t * ent = NULL; /* Entry for target file in efc */ - hbool_t open_file = FALSE; /* Whether ent->file needs to be closed in case of error */ - H5P_genplist_t * plist; /* Property list pointer for FAPL */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - H5F_t * ret_value = NULL; /* Return value */ + H5F_efc_t * efc = NULL; /* External file cache for parent file */ + H5F_efc_ent_t *ent = NULL; /* Entry for target file in efc */ + hbool_t open_file = FALSE; /* Whether ent->file needs to be closed in case of error */ + H5F_t * ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -154,38 +227,16 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi HDassert(parent->shared); HDassert(name); - /* Get the VOL info from the fapl */ - if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, NULL, "not a file access property list") - if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get VOL connector info") - - /* Stash a copy of the "top-level" connector property, before any pass-through - * connectors modify or unwrap it. - */ - if (H5CX_set_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set VOL connector info in API context") - /* Get external file cache */ efc = parent->shared->efc; - /* Check if the EFC exists. If it does not, just call H5F_open(). We + /* Check if the EFC exists. If it does not, just open the file. We * support this so clients do not have to make 2 different calls depending * on the state of the efc. */ if (!efc) { - if (NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id))) + if (NULL == (ret_value = H5F__efc_open_real(name, flags, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") - /* Make file post open call */ - if (H5F__post_open(ret_value) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file") - - /* Increment the number of open objects to prevent the file from being - * closed out from under us - "simulate" having an open file id. Note - * that this behaviour replaces the calls to H5F_incr_nopen_objs() and - * H5F_decr_nopen_objs() in H5L_extern_traverse(). */ - ret_value->nopen_objs++; - HGOTO_DONE(ret_value) } /* end if */ @@ -250,18 +301,9 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi } /* end if */ else { /* Cannot cache file, just open file and return */ - if (NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id))) + if (NULL == (ret_value = H5F__efc_open_real(name, flags, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") - /* Make file post open call */ - if (H5F__post_open(ret_value) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file") - - /* Increment the number of open objects to prevent the file from - * being closed out from under us - "simulate" having an open - * file id */ - ret_value->nopen_objs++; - HGOTO_DONE(ret_value) } /* end else */ } /* end if */ @@ -275,18 +317,10 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Open the file */ - if (NULL == (ent->file = H5F_open(name, flags, fcpl_id, fapl_id))) + if (NULL == (ent->file = H5F__efc_open_real(name, flags, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") open_file = TRUE; - /* Make file post open call */ - if (H5F__post_open(ent->file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file") - - /* Increment the number of open objects to prevent the file from being - * closed out from under us - "simulate" having an open file id */ - ent->file->nopen_objs++; - /* Add the file to the cache */ /* Skip list */ if (H5SL_insert(efc->slist, ent, ent->name) < 0) @@ -372,6 +406,9 @@ H5F_efc_close(H5F_t *parent, H5F_t *file) * support this so clients do not have to make 2 different calls depending * on the state of the efc. */ if (!efc) { + /* NOTE: This assumes that file object is a _native_ file object and + * won't work with passthrough VOL connectors. + */ file->nopen_objs--; if (H5F_try_close(file, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close external file") @@ -387,6 +424,9 @@ H5F_efc_close(H5F_t *parent, H5F_t *file) for (ent = efc->LRU_head; ent && ent->file != file; ent = ent->LRU_next) ; if (!ent) { + /* NOTE: This assumes that file object is a _native_ file object and + * won't work with passthrough VOL connectors. + */ file->nopen_objs--; if (H5F_try_close(file, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close external file") diff --git a/src/H5Fint.c b/src/H5Fint.c index d772088..98001d9 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -218,6 +218,38 @@ H5F_term_package(void) } /* end H5F_term_package() */ /*------------------------------------------------------------------------- + * Function: H5F__close_obj + * + * Purpose: Close a file VOL object, possibly asynchronously. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5F__close_obj(H5VL_object_t *file_vol_obj, void **request) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + HDassert(file_vol_obj); + + /* Close the file */ + if (H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, request) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + + /* Free the VOL object; it is unnecessary to unwrap the VOL + * object before freeing it, as the object was not wrapped */ + if (H5VL_free_object(file_vol_obj) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__close_obj() */ + +/*------------------------------------------------------------------------- * Function: H5F__close_cb * * Purpose: Closes a file or causes the close operation to be pended. @@ -244,15 +276,10 @@ H5F__close_cb(H5VL_object_t *file_vol_obj, void **request) /* Sanity check */ HDassert(file_vol_obj); - /* Close the file */ - if (H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, request) < 0) + /* Close the file object */ + if (H5F__close_obj(file_vol_obj, request) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") - /* Free the VOL object; it is unnecessary to unwrap the VOL - * object before freeing it, as the object was not wrapped */ - if (H5VL_free_object(file_vol_obj) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__close_cb() */ @@ -302,6 +329,7 @@ static herr_t H5F__set_vol_conn(H5F_t *file) { H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + const H5VL_class_t * vol_cls; /* Pointer to VOL connector class for the container */ void * new_connector_info = NULL; /* Copy of connector info */ herr_t ret_value = SUCCEED; /* Return value */ @@ -320,13 +348,12 @@ H5F__set_vol_conn(H5F_t *file) HDassert(0 != connector_prop.connector_id); /* Retrieve the connector for the ID */ - if (NULL == (file->shared->vol_cls = (H5VL_class_t *)H5I_object(connector_prop.connector_id))) + if (NULL == (vol_cls = (H5VL_class_t *)H5I_object(connector_prop.connector_id))) HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Allocate and copy connector info, if it exists */ if (connector_prop.connector_info) - if (H5VL_copy_connector_info(file->shared->vol_cls, &new_connector_info, - connector_prop.connector_info) < 0) + if (H5VL_copy_connector_info(vol_cls, &new_connector_info, connector_prop.connector_info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "connector info copy failed") /* Cache the connector ID & info for the container */ @@ -859,7 +886,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Target file_name is an absolute pathname: see RM for detailed description */ if (H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) { /* Try opening file */ - src_file = H5F__efc_open(primary_file, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(primary_file, file_name, file_intent, fapl_id); /* Adjust temporary file name if file not opened */ if (NULL == src_file) { @@ -882,7 +909,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c } /* end if */ else if (H5_CHECK_ABS_DRIVE(file_name)) { /* Try opening file */ - src_file = H5F__efc_open(primary_file, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(primary_file, file_name, file_intent, fapl_id); /* Adjust temporary file name if file not opened */ if (NULL == src_file) { @@ -927,8 +954,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c } /* end if */ /* Try opening file */ - src_file = - H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(primary_file, full_name, file_intent, fapl_id); /* Release copy of file name */ full_name = (char *)H5MM_xfree(full_name); @@ -940,7 +966,6 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Leave if file was opened */ else break; - H5E_clear_stack(NULL); } /* end if */ } /* end while */ @@ -955,7 +980,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") /* Try opening file */ - src_file = H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(primary_file, full_name, file_intent, fapl_id); /* Release name */ full_name = (char *)H5MM_xfree(full_name); @@ -976,7 +1001,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") /* Try opening file */ - src_file = H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(primary_file, full_name, file_intent, fapl_id); /* Release name */ full_name = (char *)H5MM_xfree(full_name); @@ -991,7 +1016,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Try the relative file_name stored in temp_file_name */ if (src_file == NULL) { /* Try opening file */ - src_file = H5F__efc_open(primary_file, temp_file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(primary_file, temp_file_name, file_intent, fapl_id); /* Check for file not opened */ if (NULL == src_file) @@ -1019,7 +1044,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c actual_file_name = (char *)H5MM_xfree(actual_file_name); /* Try opening with the resolved name */ - src_file = H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(primary_file, full_name, file_intent, fapl_id); /* Release name */ full_name = (char *)H5MM_xfree(full_name); @@ -1122,7 +1147,6 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F if (NULL == (f = H5FL_CALLOC(H5F_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure") - f->id_exists = FALSE; if (shared) { HDassert(lf == NULL); @@ -1597,7 +1621,6 @@ H5F__dest(H5F_t *f, hbool_t flush) 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") - f->shared->vol_cls = NULL; /* Close the file */ if (H5FD_close(f->shared->lf) < 0) @@ -1631,16 +1654,6 @@ H5F__dest(H5F_t *f, hbool_t flush) f->open_name = (char *)H5MM_xfree(f->open_name); f->actual_name = (char *)H5MM_xfree(f->actual_name); if (f->vol_obj) { - void *vol_wrap_ctx = NULL; - - /* If a VOL wrapping context is available, retrieve it - * and unwrap file VOL object - */ - if (H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL object wrap context") - if (vol_wrap_ctx && (NULL == H5VL_object_unwrap(f->vol_obj))) - HDONE_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't unwrap VOL object") - if (H5VL_free_object(f->vol_obj) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") f->vol_obj = NULL; @@ -2131,21 +2144,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__post_open(H5F_t *f) +H5F__post_open(H5F_t *f, H5VL_object_t *vol_obj, hbool_t id_exists) { - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE_NOERR /* Sanity check arguments */ HDassert(f); + HDassert(vol_obj); - /* Store a vol object in the file struct */ - if (NULL == (f->vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, f, f->shared->vol_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't create VOL object") + /* Have an ID now? */ + f->id_exists = id_exists; -done: - FUNC_LEAVE_NOAPI(ret_value) + /* Store a VOL object in the file struct */ + (void)H5VL_object_inc_rc(vol_obj); + f->vol_obj = vol_obj; + + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5F__post_open() */ /*------------------------------------------------------------------------- diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index b016696..752abc0 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -309,9 +309,8 @@ struct H5F_shared_t { hbool_t closing; /* File is in the process of being closed */ /* Cached VOL connector ID & info */ - hid_t vol_id; /* ID of VOL connector for the container */ - const H5VL_class_t *vol_cls; /* Pointer to VOL connector class for the container */ - void * vol_info; /* Copy of VOL connector info for container */ + 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 */ @@ -404,7 +403,7 @@ H5_DLLVAR htri_t use_locks_env_g; /******************************/ /* General routines */ -H5_DLL herr_t H5F__post_open(H5F_t *f); +H5_DLL herr_t H5F__post_open(H5F_t *f, H5VL_object_t *vol_obj, hbool_t id_exists); H5_DLL H5F_t *H5F__reopen(H5F_t *f); H5_DLL herr_t H5F__flush(H5F_t *f); H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t fapl_id); @@ -413,6 +412,7 @@ H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo); 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__close_obj(H5VL_object_t *file_vol_obj, void **request); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); H5_DLL herr_t H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info); H5_DLL herr_t H5F__parse_file_lock_env_var(htri_t *use_locks); @@ -456,7 +456,7 @@ H5_DLL herr_t H5F__set_mpi_atomicity(H5F_t *file, hbool_t flag); /* External file cache routines */ H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles); -H5_DLL H5F_t * H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); +H5_DLL H5F_t * H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fapl_id); H5_DLL unsigned H5F__efc_max_nfiles(H5F_efc_t *efc); H5_DLL herr_t H5F__efc_release(H5F_efc_t *efc); H5_DLL herr_t H5F__efc_destroy(H5F_efc_t *efc); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index a5ccbab..02b61dc 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -377,7 +377,6 @@ typedef struct H5F_t H5F_t; #define H5F_NULL_FSM_ADDR(F) ((F)->shared->null_fsm_addr) #define H5F_GET_MIN_DSET_OHDR(F) ((F)->shared->crt_dset_min_ohdr_flag) #define H5F_SET_MIN_DSET_OHDR(F, V) ((F)->shared->crt_dset_min_ohdr_flag = (V)) -#define H5F_VOL_CLS(F) ((F)->shared->vol_cls) #define H5F_VOL_OBJ(F) ((F)->vol_obj) #define H5F_USE_FILE_LOCKING(F) ((F)->shared->use_file_locking) #else /* H5F_MODULE */ @@ -440,7 +439,6 @@ typedef struct H5F_t H5F_t; #define H5F_NULL_FSM_ADDR(F) (H5F_get_null_fsm_addr(F)) #define H5F_GET_MIN_DSET_OHDR(F) (H5F_get_min_dset_ohdr(F)) #define H5F_SET_MIN_DSET_OHDR(F, V) (H5F_set_min_dset_ohdr((F), (V))) -#define H5F_VOL_CLS(F) (H5F_get_vol_cls(F)) #define H5F_VOL_OBJ(F) (H5F_get_vol_obj(F)) #define H5F_USE_FILE_LOCKING(F) (H5F_get_use_file_locking(F)) #endif /* H5F_MODULE */ @@ -857,7 +855,6 @@ H5_DLL hbool_t H5F_get_point_of_no_return(const H5F_t *f); H5_DLL hbool_t H5F_get_null_fsm_addr(const H5F_t *f); H5_DLL hbool_t H5F_get_min_dset_ohdr(const H5F_t *f); H5_DLL herr_t H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize); -H5_DLL const H5VL_class_t *H5F_get_vol_cls(const H5F_t *f); H5_DLL H5VL_object_t *H5F_get_vol_obj(const H5F_t *f); H5_DLL hbool_t H5F_get_file_locking(const H5F_t *f); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index a625897..b800c55 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -1245,29 +1245,6 @@ H5F_get_null_fsm_addr(const H5F_t *f) } /* end H5F_get_null_fsm_addr() */ /*------------------------------------------------------------------------- - * Function: H5F_get_vol_cls - * - * Purpose: Get the VOL class for the file - * - * Return: VOL class pointer for file, can't fail - * - * Programmer: Quincey Koziol - * Saturday, August 17, 2019 - * - *------------------------------------------------------------------------- - */ -const H5VL_class_t * -H5F_get_vol_cls(const H5F_t *f) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(f); - HDassert(f->shared); - - FUNC_LEAVE_NOAPI(f->shared->vol_cls) -} /* end H5F_get_vol_cls */ - -/*------------------------------------------------------------------------- * Function: H5F_get_vol_obj * * Purpose: Get the VOL object for the file diff --git a/src/H5Ldeprec.c b/src/H5Ldeprec.c index 01e77f9..6fa6401 100644 --- a/src/H5Ldeprec.c +++ b/src/H5Ldeprec.c @@ -168,7 +168,7 @@ H5Literate1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, @@ -259,7 +259,7 @@ H5Literate_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, @@ -340,7 +340,7 @@ H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t l HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, @@ -435,7 +435,7 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, @@ -538,7 +538,7 @@ H5Lvisit1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterat HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, @@ -631,7 +631,7 @@ H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, @@ -120,9 +120,9 @@ H5O__open_api_common(hid_t loc_id, const char *name, hid_t lapl_id, void **token H5P_DATASET_XFER_DEFAULT, token_ptr))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") - /* Get an atom for the object */ + /* Get an ID for the object */ if ((ret_value = H5VL_register(opened_type, opened_obj, (*vol_obj_ptr)->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get ID for object handle") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 7def20a..136260c 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -365,7 +365,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") if (is_native_vol_obj) { @@ -584,7 +584,7 @@ H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo /*out*/, unsigned fields) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) @@ -650,7 +650,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) @@ -722,7 +722,7 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) @@ -976,7 +976,7 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1 HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) @@ -1081,7 +1081,7 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) diff --git a/src/H5Pdevelop.h b/src/H5Pdevelop.h new file mode 100644 index 0000000..c9d65c4 --- /dev/null +++ b/src/H5Pdevelop.h @@ -0,0 +1,87 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This file contains public declarations for the H5P (property list) developer + * support routines. + */ + +#ifndef _H5Pdevelop_H +#define _H5Pdevelop_H + +/* Include package's public header */ +#include "H5Ppublic.h" + +/*****************/ +/* Public Macros */ +/*****************/ + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * + * \ingroup DXPL + * + * \brief Sets "new API context" flag for plugin API wrapper call. + * + * \dxpl_id{plist_id} + * \param[in] new_api_ctx Indicate that API wrapper should create new API context + * \return \herr_t + * + * \details Set flag to indicate that an API wrapper for a plugin's + * public wrapper API call (e.g. H5VLfile_create, H5FDopen, etc) + * should open a new API context for the API call. + * + */ +H5_DLL herr_t H5Pset_plugin_new_api_context(hid_t plist_id, hbool_t new_api_ctx); + +/** + * \ingroup DXPL + * + * \brief Gets "new API context" flag for plugin API wrapper call. + * + * \dxpl_id{plist_id} + * \param[out] new_api_ctx Flag indicating API wrapper should create new API context + * \return \herr_t + * + * \details Retrieve "new API context" flag for plugin wrapper API calls. + * + */ +H5_DLL herr_t H5Pget_plugin_new_api_context(hid_t plist_id, hbool_t *new_api_ctx); + +#ifdef __cplusplus +} +#endif + +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + +#endif /* _H5Pdevelop_H */ diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 46dc94c..a47d8bd 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -169,6 +169,11 @@ #define H5D_XFER_DSET_IO_SEL_ENC H5P__dxfr_edc_enc #define H5D_XFER_DSET_IO_SEL_DEC H5P__dxfr_edc_dec #endif /* QAK */ +/* Definition for property */ +#define H5D_XFER_PLUGIN_NEW_API_CTX_SIZE sizeof(hbool_t) +#define H5D_XFER_PLUGIN_NEW_API_CTX_DEF FALSE +#define H5D_XFER_PLUGIN_NEW_API_CTX_ENC H5P__encode_hbool_t +#define H5D_XFER_PLUGIN_NEW_API_CTX_DEC H5P__decode_hbool_t /******************/ /* Local Typedefs */ @@ -278,6 +283,8 @@ static const H5T_conv_cb_t H5D_def_conv_cb_g = static const void * H5D_def_xfer_xform_g = H5D_XFER_XFORM_DEF; /* Default value for data transform */ static const H5S_t *H5D_def_dset_io_sel_g = H5D_XFER_DSET_IO_SEL_DEF; /* Default value for dataset I/O selection */ +static const hbool_t H5D_def_new_api_ctx_g = + H5D_XFER_PLUGIN_NEW_API_CTX_DEF; /* Default value for plugin new API context */ /*------------------------------------------------------------------------- * Function: H5P__dxfr_reg_prop @@ -442,6 +449,12 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) H5D_XFER_DSET_IO_SEL_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the plugin new API context property */ + if (H5P__register_real(pclass, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, H5D_XFER_PLUGIN_NEW_API_CTX_SIZE, + &H5D_def_new_api_ctx_g, NULL, NULL, NULL, H5D_XFER_PLUGIN_NEW_API_CTX_ENC, + H5D_XFER_PLUGIN_NEW_API_CTX_DEC, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dxfr_reg_prop() */ @@ -2379,3 +2392,75 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_dataset_io_hyperslab_selection() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_plugin_new_api_context + * + * Purpose: Set flag to indicate that an API wrapper for a plugin's + * public wrapper API call (e.g. H5VLfile_create, H5FDopen, etc) + * should open a new API context for the API call. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Jun 11, 2021 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_plugin_new_api_context(hid_t plist_id, hbool_t new_api_ctx) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ib", plist_id, new_api_ctx); + + /* Get the plist structure */ + if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADID, FAIL, "can't find object for ID") + + /* Update property list */ + if (H5P_set(plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &new_api_ctx) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_plugin_new_api_context() */ + +/*------------------------------------------------------------------------- + * Function: H5Pget_plugin_new_api_context + * + * Purpose: Retrieve "new API context" flag for plugin wrapper API calls. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Jun 11, 2021 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_plugin_new_api_context(hid_t plist_id, hbool_t *new_api_ctx /*out*/) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ix", plist_id, new_api_ctx); + + /* Check argument */ + if (NULL == new_api_ctx) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "'new_api_ctx' pointer is NULL") + + /* Get the plist structure */ + if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADID, FAIL, "can't find object for ID") + + /* Query property list */ + if (H5P_get(plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, new_api_ctx) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_plugin_new_api_context() */ diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 7cbb397..15a04a7 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -20,7 +20,8 @@ /* Early typedefs to avoid circular dependencies */ typedef struct H5P_genplist_t H5P_genplist_t; -/* Include package's public header */ +/* Include package's public headers */ +#include "H5Pdevelop.h" #include "H5Ppublic.h" /* Private headers needed by this file */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 3f1d70f..e18b7f9 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -104,7 +104,7 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(vol_obj, &is_native) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -409,7 +409,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(vol_obj, &is_native) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -659,7 +659,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(vol_obj, &is_native) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't query if file uses native VOL connector") diff --git a/src/H5Rint.c b/src/H5Rint.c index e1a5dcd..eafc5c4 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -542,12 +542,8 @@ H5R__get_loc_id(const H5R_ref_priv_t *ref) hid_t H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id) { - H5P_genplist_t * plist; /* Property list for FAPL */ - void * new_file = NULL; /* File object opened */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - H5VL_object_t * vol_obj = NULL; /* VOL object for file */ - uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ - hid_t ret_value = H5I_INVALID_HID; + hid_t file_id = H5I_INVALID_HID; /* New file's ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_PACKAGE @@ -557,54 +553,19 @@ H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id) if (H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Get the VOL info from the fapl */ - if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") - if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") - - /* Stash a copy of the "top-level" connector property, before any pass-through - * connectors modify or unwrap it. - */ - if (H5CX_set_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, - "can't set VOL connector info in API context") - /* Open the file */ /* (Must open file read-write to allow for object modifications) */ - if (NULL == (new_file = H5VL_file_open(&connector_prop, H5R_REF_FILENAME(ref), H5F_ACC_RDWR, fapl_id, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if (NULL == H5VL_file_open(H5R_REF_FILENAME(ref), H5F_ACC_RDWR, fapl_id, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, &file_id)) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") - /* Get an ID for the file */ - if ((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle") - - /* Get the file object */ - if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier") - - /* Make the 'post open' callback */ - supported = 0; - if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation") - if (supported & H5VL_OPT_QUERY_SUPPORTED) { - H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ - - /* Set up VOL callback arguments */ - vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN; - vol_cb_args.args = NULL; - - /* Make the 'post open' callback */ - if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID, - "unable to make file 'post open' callback") - } /* end if */ - /* Attach loc_id to reference */ - if (H5R__set_loc_id((H5R_ref_priv_t *)ref, ret_value, FALSE, TRUE) < 0) + if (H5R__set_loc_id((H5R_ref_priv_t *)ref, file_id, FALSE, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "unable to attach location id to reference") + /* Set return value */ + ret_value = file_id; + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__reopen_file() */ @@ -252,10 +252,10 @@ { \ H5T_INIT_TYPE_ALLOC_COMMON(H5T_REFERENCE) \ H5T_INIT_TYPE_NUM_COMMON(H5T_ORDER_NONE) \ - dt->shared->force_conv = TRUE; \ - dt->shared->u.atomic.u.r.file = NULL; \ - dt->shared->u.atomic.u.r.loc = H5T_LOC_BADLOC; \ - dt->shared->u.atomic.u.r.cls = NULL; \ + dt->shared->force_conv = TRUE; \ + dt->shared->u.atomic.u.r.file_obj = NULL; \ + dt->shared->u.atomic.u.r.loc = H5T_LOC_BADLOC; \ + dt->shared->u.atomic.u.r.cls = NULL; \ } #define H5T_INIT_TYPE_OBJREF_CORE \ @@ -4821,9 +4821,9 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) } /* Don't allow VL types in different files to compare as equal */ - if (dt1->shared->u.vlen.file < dt2->shared->u.vlen.file) + if (dt1->shared->u.vlen.file_obj < dt2->shared->u.vlen.file_obj) HGOTO_DONE(-1); - if (dt1->shared->u.vlen.file > dt2->shared->u.vlen.file) + if (dt1->shared->u.vlen.file_obj > dt2->shared->u.vlen.file_obj) HGOTO_DONE(1); break; @@ -4970,9 +4970,9 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) HGOTO_DONE(-1); if (dt1->shared->u.atomic.u.r.loc > dt2->shared->u.atomic.u.r.loc) HGOTO_DONE(1); - if (dt1->shared->u.atomic.u.r.file < dt2->shared->u.atomic.u.r.file) + if (dt1->shared->u.atomic.u.r.file_obj < dt2->shared->u.atomic.u.r.file_obj) HGOTO_DONE(-1); - if (dt1->shared->u.atomic.u.r.file > dt2->shared->u.atomic.u.r.file) + if (dt1->shared->u.atomic.u.r.file_obj > dt2->shared->u.atomic.u.r.file_obj) HGOTO_DONE(1); break; @@ -5832,7 +5832,7 @@ done: USAGE htri_t H5T_set_loc(dt,f,loc) H5T_t *dt; IN/OUT: Pointer to the datatype to mark - H5F_t *f; IN: Pointer to the file the datatype is in + H5VL_object_t *file_obj; IN: Pointer to the VOL file object the datatype is in H5T_loc_t loc IN: location of type RETURNS @@ -5846,7 +5846,7 @@ done: -------------------------------------------------------------------------- */ htri_t -H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) +H5T_set_loc(H5T_t *dt, H5VL_object_t *file_obj, H5T_loc_t loc) { htri_t changed; /* Whether H5T_set_loc changed the type (even if the size didn't change) */ htri_t ret_value = 0; /* Indicate that success, but no location change */ @@ -5871,7 +5871,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) old_size = dt->shared->parent->shared->size; /* Mark the VL, compound or array type */ - if ((changed = H5T_set_loc(dt->shared->parent, file, loc)) < 0) + if ((changed = H5T_set_loc(dt->shared->parent, file_obj, loc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location") if (changed > 0) ret_value = changed; @@ -5912,7 +5912,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) old_size = memb_type->shared->size; /* Mark the VL, compound, enum or array type */ - if ((changed = H5T_set_loc(memb_type, file, loc)) < 0) + if ((changed = H5T_set_loc(memb_type, file_obj, loc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); if (changed > 0) ret_value = changed; @@ -5951,14 +5951,14 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) if (dt->shared->parent->shared->force_conv && H5T_IS_COMPLEX(dt->shared->parent->shared->type) && (dt->shared->parent->shared->type != H5T_REFERENCE)) { - if ((changed = H5T_set_loc(dt->shared->parent, file, loc)) < 0) + if ((changed = H5T_set_loc(dt->shared->parent, file_obj, loc)) < 0) 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, file, loc)) < 0) + if ((changed = H5T__vlen_set_loc(dt, file_obj, loc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); if (changed > 0) ret_value = changed; @@ -5966,7 +5966,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) case H5T_REFERENCE: /* Reference types go through type conversion */ - if ((ret_value = H5T__ref_set_loc(dt, file, loc)) < 0) + if ((ret_value = H5T__ref_set_loc(dt, file_obj, loc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "Unable to set reference location"); break; @@ -6308,17 +6308,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_patch_vlen_file(H5T_t *dt, H5VL_object_t *file) +H5T_patch_vlen_file(H5T_t *dt, H5VL_object_t *file_obj) { FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ HDassert(dt); HDassert(dt->shared); - HDassert(file); + HDassert(file_obj); - if ((dt->shared->type == H5T_VLEN) && dt->shared->u.vlen.file != file) - dt->shared->u.vlen.file = file; + if ((dt->shared->type == H5T_VLEN) && dt->shared->u.vlen.file_obj != file_obj) + dt->shared->u.vlen.file_obj = file_obj; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5T_patch_vlen_file() */ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 273bb23..08468eb 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3161,12 +3161,17 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si /* QAK - Nothing to do currently */ break; - case H5T_CONV_CONV: + case H5T_CONV_CONV: { + H5T_vlen_t *src_vl; /* Source VL type info */ + H5T_vlen_t *dst_vl; /* Destination VL type info */ + /* * Conversion. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + src_vl = &src->shared->u.vlen; + dst_vl = &dst->shared->u.vlen; /* Initialize source & destination strides */ if (buf_stride) { @@ -3205,14 +3210,14 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy src type for conversion") /* References need to know about the src file */ if (tsrc_cpy->shared->type == H5T_REFERENCE) - if (H5T_set_loc(tsrc_cpy, src->shared->u.vlen.file, src->shared->u.vlen.loc) < 0) + if (H5T_set_loc(tsrc_cpy, src_vl->file_obj, src_vl->loc) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set datatype location"); if (NULL == (tdst_cpy = H5T_copy(dst->shared->parent, H5T_COPY_ALL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy dst type for conversion") /* References need to know about the dst file */ if (tdst_cpy->shared->type == H5T_REFERENCE) - if (H5T_set_loc(tdst_cpy, dst->shared->u.vlen.file, dst->shared->u.vlen.loc) < 0) + if (H5T_set_loc(tdst_cpy, dst_vl->file_obj, dst_vl->loc) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set datatype location"); if (((tsrc_id = H5I_register(H5I_DATATYPE, tsrc_cpy, FALSE)) < 0) || @@ -3240,7 +3245,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info") /* Set flags to indicate we are writing to or reading from the file */ - if (dst->shared->u.vlen.file != NULL) + if (dst_vl->file_obj != NULL) write_to_file = TRUE; /* Set the flag for nested VL case */ @@ -3292,25 +3297,25 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si hbool_t is_nil; /* Whether sequence is "nil" */ /* Check for "nil" source sequence */ - if ((*(src->shared->u.vlen.cls->isnull))(src->shared->u.vlen.file, s, &is_nil) < 0) + if ((*(src_vl->cls->isnull))(src_vl->file_obj, s, &is_nil) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if VL data is 'nil'") else if (is_nil) { /* Write "nil" sequence to destination location */ - if ((*(dst->shared->u.vlen.cls->setnull))(dst->shared->u.vlen.file, d, b) < 0) + if ((*(dst_vl->cls->setnull))(dst_vl->file_obj, d, b) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set VL data to 'nil'") } /* end else-if */ else { size_t seq_len; /* The number of elements in the current sequence */ /* Get length of element sequences */ - if ((*(src->shared->u.vlen.cls->getlen))(src->shared->u.vlen.file, s, &seq_len) < 0) + if ((*(src_vl->cls->getlen))(src_vl->file_obj, s, &seq_len) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "bad sequence length") /* If we are reading from memory and there is no conversion, just get the pointer to * sequence */ if (write_to_file && noop_conv) { /* Get direct pointer to sequence */ - if (NULL == (conv_buf = (*(src->shared->u.vlen.cls->getptr))(s))) + if (NULL == (conv_buf = (*(src_vl->cls->getptr))(s))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid source pointer") } /* end if */ else { @@ -3339,8 +3344,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si } /* end else-if */ /* Read in VL sequence */ - if ((*(src->shared->u.vlen.cls->read))(src->shared->u.vlen.file, s, conv_buf, - src_size) < 0) + if ((*(src_vl->cls->read))(src_vl->file_obj, s, conv_buf, src_size) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data") } /* end else */ @@ -3363,8 +3367,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si HDassert(write_to_file); /* Get length of background element sequence */ - if ((*(dst->shared->u.vlen.cls->getlen))(dst->shared->u.vlen.file, b, - &bg_seq_len) < 0) + if ((*(dst_vl->cls->getlen))(dst_vl->file_obj, b, &bg_seq_len) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "bad sequence length") /* Read sequence if length > 0 */ @@ -3379,9 +3382,8 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si } /* end if */ /* Read in background VL sequence */ - if ((*(dst->shared->u.vlen.cls->read))(dst->shared->u.vlen.file, b, - tmp_buf, - bg_seq_len * dst_base_size) < 0) + if ((*(dst_vl->cls->read))(dst_vl->file_obj, b, tmp_buf, + bg_seq_len * dst_base_size) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data") } /* end if */ @@ -3398,8 +3400,8 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si } /* end if */ /* Write sequence to destination location */ - if ((*(dst->shared->u.vlen.cls->write))(dst->shared->u.vlen.file, &vl_alloc_info, d, - conv_buf, b, seq_len, dst_base_size) < 0) + if ((*(dst_vl->cls->write))(dst_vl->file_obj, &vl_alloc_info, d, conv_buf, b, seq_len, + dst_base_size) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data") if (!noop_conv) { @@ -3415,7 +3417,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si tmp = (uint8_t *)tmp_buf + seq_len * dst_base_size; for (u = seq_len; u < bg_seq_len; u++, tmp += dst_base_size) { /* Delete sequence in destination location */ - if ((*(dst->shared->u.vlen.cls->del))(dst->shared->u.vlen.file, tmp) < 0) + if ((*(dst_vl->cls->del))(dst_vl->file_obj, tmp) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove heap object") } /* end for */ @@ -3438,7 +3440,8 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si H5I_dec_ref(tsrc_id); if (tdst_id >= 0) H5I_dec_ref(tdst_id); - break; + } /* end case */ + break; default: /* Some other command we don't know about yet.*/ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") @@ -3667,13 +3670,19 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz break; case H5T_CONV_CONV: { + H5T_atomic_ref_t *src_ref; /* Source reference type info */ + H5T_atomic_ref_t *dst_ref; /* Destination reference type info */ + /* * Conversion. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + src_ref = &src->shared->u.atomic.u.r; + dst_ref = &dst->shared->u.atomic.u.r; - HDassert(src->shared->u.atomic.u.r.cls); + HDassert(src_ref->cls); + HDassert(dst_ref->cls); /* Initialize source & destination strides */ if (buf_stride) { @@ -3744,22 +3753,19 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz hbool_t is_nil; /* Whether reference is "nil" */ /* Check for "nil" source reference */ - if ((*(src->shared->u.atomic.u.r.cls->isnull))(src->shared->u.atomic.u.r.file, s, - &is_nil) < 0) + if ((*(src_ref->cls->isnull))(src_ref->file_obj, s, &is_nil) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if reference data is 'nil'") if (is_nil) { /* Write "nil" reference to destination location */ - if ((*(dst->shared->u.atomic.u.r.cls->setnull))(dst->shared->u.atomic.u.r.file, d, - b) < 0) + if ((*(dst_ref->cls->setnull))(dst_ref->file_obj, d, b) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set reference data to 'nil'") } /* end else-if */ else { /* Get size of references */ - if (0 == (buf_size = src->shared->u.atomic.u.r.cls->getsize( - src->shared->u.atomic.u.r.file, s, src->shared->size, - dst->shared->u.atomic.u.r.file, &dst_copy))) + if (0 == (buf_size = src_ref->cls->getsize(src_ref->file_obj, s, src->shared->size, + dst_ref->file_obj, &dst_copy))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to obtain size of reference") /* Check if conversion buffer is large enough, resize if necessary. */ @@ -3771,24 +3777,21 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz HDmemset(conv_buf, 0, conv_buf_size); } /* end if */ - if (dst_copy && (src->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) + if (dst_copy && (src_ref->loc == H5T_LOC_DISK)) H5MM_memcpy(conv_buf, s, buf_size); else { /* Read reference */ - if (src->shared->u.atomic.u.r.cls->read( - src->shared->u.atomic.u.r.file, s, src->shared->size, - dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0) + if (src_ref->cls->read(src_ref->file_obj, s, src->shared->size, dst_ref->file_obj, + conv_buf, buf_size) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read reference data") } /* end else */ - if (dst_copy && (dst->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) + if (dst_copy && (dst_ref->loc == H5T_LOC_DISK)) H5MM_memcpy(d, conv_buf, buf_size); else { /* Write reference to destination location */ - if (dst->shared->u.atomic.u.r.cls->write( - src->shared->u.atomic.u.r.file, conv_buf, buf_size, - src->shared->u.atomic.u.r.rtype, dst->shared->u.atomic.u.r.file, d, - dst->shared->size, b) < 0) + if (dst_ref->cls->write(src_ref->file_obj, conv_buf, buf_size, src_ref->rtype, + dst_ref->file_obj, d, dst->shared->size, b) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write reference data") } /* end else */ } /* end else */ diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 51ecaca..95c5732 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -199,6 +199,15 @@ typedef struct H5T_ref_class_t { H5T_ref_writefunc_t write; /* write reference from buffer */ } H5T_ref_class_t; +typedef struct H5T_atomic_ref_t { + H5R_type_t rtype; /* type of reference stored */ + unsigned version; /* version of encoded reference */ + hbool_t opaque; /* opaque reference type */ + H5T_loc_t loc; /* location of data in buffer */ + H5VL_object_t * file_obj; /* File VOL object (if data is on disk) */ + const H5T_ref_class_t *cls; /* Pointer to ref class callbacks */ +} H5T_atomic_ref_t; + typedef struct H5T_atomic_t { H5T_order_t order; /* byte order */ size_t prec; /* precision in bits */ @@ -226,14 +235,7 @@ typedef struct H5T_atomic_t { H5T_str_t pad; /* space or null padding of extra bytes */ } s; /* string types */ - struct { - H5R_type_t rtype; /* type of reference stored */ - unsigned version; /* version of encoded reference */ - hbool_t opaque; /* opaque reference type */ - H5T_loc_t loc; /* location of data in buffer */ - H5VL_object_t * file; /* file VOL pointer (if data is on disk) */ - const H5T_ref_class_t *cls; /* Pointer to ref class callbacks */ - } r; /* reference types */ + H5T_atomic_ref_t r; /* Reference type info */ } u; } H5T_atomic_t; @@ -302,13 +304,13 @@ typedef struct H5T_vlen_class_t { /* A VL datatype */ typedef struct H5T_vlen_t { - H5T_vlen_type_t type; /* Type of VL data in buffer */ - H5T_loc_t loc; /* Location of VL data in buffer */ - H5T_cset_t cset; /* For VL string: character set */ - H5T_str_t pad; /* For VL string: space or null padding of - * extra bytes */ - H5VL_object_t * file; /* File object (if VL data is on disk) */ - const H5T_vlen_class_t *cls; /* Pointer to VL class callbacks */ + H5T_vlen_type_t type; /* Type of VL data in buffer */ + H5T_loc_t loc; /* Location of VL data in buffer */ + H5T_cset_t cset; /* For VL string: character set */ + H5T_str_t pad; /* For VL string: space or null padding of + * extra bytes */ + H5VL_object_t * file_obj; /* File VOL object (if VL data is on disk) */ + const H5T_vlen_class_t *cls; /* Pointer to VL class callbacks */ } H5T_vlen_t; /* An opaque datatype */ diff --git a/src/H5Tref.c b/src/H5Tref.c index cac8cf6..3a6a8c7 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -70,39 +70,40 @@ struct H5Tref_dsetreg { /* Local Prototypes */ /********************/ -static herr_t H5T__ref_mem_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull); -static herr_t H5T__ref_mem_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf); -static size_t H5T__ref_mem_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, hbool_t *dst_copy); -static herr_t H5T__ref_mem_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); -static herr_t H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, - void *bg_buf); - -static herr_t H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull); -static herr_t H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf); -static size_t H5T__ref_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, hbool_t *dst_copy); -static herr_t H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); -static herr_t H5T__ref_disk_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, +static herr_t H5T__ref_mem_isnull(const H5VL_object_t *src_file_obj, const void *src_buf, hbool_t *isnull); +static herr_t H5T__ref_mem_setnull(H5VL_object_t *dst_file_obj, void *dst_buf, void *bg_buf); +static size_t H5T__ref_mem_getsize(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, hbool_t *dst_copy); +static herr_t H5T__ref_mem_read(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, void *dst_buf, size_t dst_size); +static herr_t H5T__ref_mem_write(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5R_type_t src_type, H5VL_object_t *dst_file_obj, void *dst_buf, + size_t dst_size, void *bg_buf); + +static herr_t H5T__ref_disk_isnull(const H5VL_object_t *src_file_obj, const void *src_buf, hbool_t *isnull); +static herr_t H5T__ref_disk_setnull(H5VL_object_t *dst_file_obj, void *dst_buf, void *bg_buf); +static size_t H5T__ref_disk_getsize(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, hbool_t *dst_copy); +static herr_t H5T__ref_disk_read(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, void *dst_buf, size_t dst_size); +static herr_t H5T__ref_disk_write(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5R_type_t src_type, H5VL_object_t *dst_file_obj, void *dst_buf, size_t dst_size, void *bg_buf); /* For compatibility */ -static herr_t H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull); -static size_t H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, hbool_t *dst_copy); -static herr_t H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); - -static herr_t H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, +static herr_t H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file_obj, const void *src_buf, + hbool_t *isnull); +static size_t H5T__ref_obj_disk_getsize(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, hbool_t *dst_copy); +static herr_t H5T__ref_obj_disk_read(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, void *dst_buf, size_t dst_size); + +static herr_t H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file_obj, const void *src_buf, hbool_t *isnull); -static size_t H5T__ref_dsetreg_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, hbool_t *dst_copy); -static herr_t H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); +static size_t H5T__ref_dsetreg_disk_getsize(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, hbool_t *dst_copy); +static herr_t H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, void *dst_buf, size_t dst_size); /*******************/ /* Local Variables */ @@ -156,7 +157,7 @@ static const H5T_ref_class_t H5T_ref_dsetreg_disk_g = { *------------------------------------------------------------------------- */ htri_t -H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) +H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file_obj, H5T_loc_t loc) { htri_t ret_value = FALSE; /* Indicate success, but no location change */ @@ -168,7 +169,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) HDassert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC); /* Only change the location if it's different */ - if (loc == dt->shared->u.atomic.u.r.loc && file == dt->shared->u.atomic.u.r.file) + if (loc == dt->shared->u.atomic.u.r.loc && file_obj == dt->shared->u.atomic.u.r.file_obj) HGOTO_DONE(FALSE) switch (loc) { @@ -188,7 +189,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) } /* end if */ /* Reset file ID (since this reference is in memory) */ - dt->shared->u.atomic.u.r.file = file; /* file is NULL */ + dt->shared->u.atomic.u.r.file_obj = file_obj; /* file is NULL */ if (dt->shared->u.atomic.u.r.opaque) { /* Size in memory, disk size is different */ @@ -219,16 +220,16 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) break; case H5T_LOC_DISK: /* Disk based reference datatype */ - HDassert(file); + HDassert(file_obj); /* Mark this type as being stored on disk */ dt->shared->u.atomic.u.r.loc = H5T_LOC_DISK; - /* Set file pointer (since this reference is on disk) */ - dt->shared->u.atomic.u.r.file = file; + /* Set VOL file object (since this reference is on disk) */ + dt->shared->u.atomic.u.r.file_obj = file_obj; /* dt now owns a reference to file */ - if (H5T_own_vol_obj(dt, file) < 0) + if (H5T_own_vol_obj(dt, file_obj) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "can't give ownership of VOL object") if (dt->shared->u.atomic.u.r.rtype == H5R_OBJECT1) { @@ -239,7 +240,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) hbool_t is_native = FALSE; /* Whether the file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(file, &is_native) < 0) + if (H5VL_object_is_native(file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") @@ -249,7 +250,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (f = (H5F_t *)H5VL_object_data(file))) + if (NULL == (f = (H5F_t *)H5VL_object_data(file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") /* Size on disk, memory size is different */ @@ -267,7 +268,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) hbool_t is_native = FALSE; /* Whether the file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(file, &is_native) < 0) + if (H5VL_object_is_native(file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") @@ -277,7 +278,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (f = (H5F_t *)H5VL_object_data(file))) + if (NULL == (f = (H5F_t *)H5VL_object_data(file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") /* Size on disk, memory size is different */ @@ -298,7 +299,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) vol_cb_args.args.get_cont_info.info = &cont_info; /* Get container info */ - if (H5VL_file_get(file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if (H5VL_file_get(file_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info") /* Retrieve min encode size (when references have no vlen part) */ @@ -327,8 +328,8 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) */ dt->shared->u.atomic.u.r.loc = H5T_LOC_BADLOC; - /* Reset file pointer */ - dt->shared->u.atomic.u.r.file = NULL; + /* Reset VOL file object */ + dt->shared->u.atomic.u.r.file_obj = NULL; /* Reset the function pointers */ dt->shared->u.atomic.u.r.cls = NULL; @@ -357,7 +358,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_mem_isnull(const H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, hbool_t *isnull) +H5T__ref_mem_isnull(const H5VL_object_t H5_ATTR_UNUSED *src_file_obj, const void *src_buf, hbool_t *isnull) { const unsigned char zeros[H5T_REF_MEM_SIZE] = {0}; herr_t ret_value = SUCCEED; @@ -384,7 +385,7 @@ H5T__ref_mem_isnull(const H5VL_object_t H5_ATTR_UNUSED *src_file, const void *sr *------------------------------------------------------------------------- */ static herr_t -H5T__ref_mem_setnull(H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, H5_ATTR_UNUSED void *bg_buf) +H5T__ref_mem_setnull(H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, void *dst_buf, H5_ATTR_UNUSED void *bg_buf) { herr_t ret_value = SUCCEED; @@ -406,8 +407,8 @@ H5T__ref_mem_setnull(H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, H5_A *------------------------------------------------------------------------- */ static size_t -H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, - size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, hbool_t *dst_copy) +H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file_obj, const void *src_buf, + size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file_obj, hbool_t *dst_copy) { H5VL_object_t * vol_obj = NULL; /* VOL object for src ref's location */ const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf; @@ -423,7 +424,7 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf HDassert(src_buf); HDassert(src_size == H5T_REF_MEM_SIZE); - if (NULL != dst_file) { + if (NULL != dst_file_obj) { hbool_t files_equal = TRUE; /* Whether src & dst references are in same file */ /* Retrieve VOL object */ @@ -431,7 +432,7 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") /* Set external flag if referenced file is not destination file */ - if (H5VL_file_is_same(vol_obj, dst_file, &files_equal) < 0) + if (H5VL_file_is_same(vol_obj, dst_file_obj, &files_equal) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, 0, "can't check if files are equal") flags |= !files_equal ? H5R_IS_EXTERNAL : 0; } @@ -449,14 +450,14 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf hbool_t is_native = FALSE; /* Whether the dest. file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(dst_file, &is_native) < 0) + if (H5VL_object_is_native(dst_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") /* Set the file's libver bounds if using the native VOL connector */ if (is_native) { H5F_t *dst_f; /* Native file struct */ - if (NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) + if (NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") H5CX_set_libver_bounds(dst_f); } /* end if */ @@ -523,8 +524,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, size_t H5_ATTR_UNUSED src_size, - H5VL_object_t *dst_file, void *dst_buf, size_t dst_size) +H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file_obj, const void *src_buf, + size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file_obj, void *dst_buf, size_t dst_size) { H5VL_object_t * vol_obj; /* VOL object for src ref's location */ const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf; @@ -546,7 +547,7 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s HDassert(dst_size); /* Memory-to-memory conversion to support vlen conversion */ - if (NULL == dst_file) { + if (NULL == dst_file_obj) { H5MM_memcpy(dst_buf, src_buf, dst_size); HGOTO_DONE(ret_value); } @@ -556,7 +557,7 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") /* Set external flag if referenced file is not destination file */ - if (H5VL_file_is_same(vol_obj, dst_file, &files_equal) < 0) + if (H5VL_file_is_same(vol_obj, dst_file_obj, &files_equal) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "can't check if files are equal") flags |= !files_equal ? H5R_IS_EXTERNAL : 0; @@ -566,14 +567,14 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s hbool_t is_native = FALSE; /* Whether the dest. file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(dst_file, &is_native) < 0) + if (H5VL_object_is_native(dst_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") /* Set the file's libver bounds if using the native VOL connector */ if (is_native) { H5F_t *dst_f; - if (NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) + if (NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") H5CX_set_libver_bounds(dst_f); } /* end if */ @@ -637,8 +638,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, - H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t dst_size, +H5T__ref_mem_write(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, H5R_type_t src_type, + H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, void *dst_buf, size_t dst_size, void H5_ATTR_UNUSED *bg_buf) { H5F_t * src_f = NULL; @@ -658,7 +659,7 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size HDcompile_assert(sizeof(*dst_ref) == sizeof(tmp_ref)); /* Memory-to-memory conversion to support vlen conversion */ - if (NULL == src_file) { + if (NULL == src_file_obj) { H5MM_memcpy(dst_buf, src_buf, src_size); HGOTO_DONE(ret_value); } @@ -668,7 +669,7 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(src_file, &is_native) < 0) + if (H5VL_object_is_native(src_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -677,7 +678,7 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") /* Make sure reference buffer is correctly initialized */ @@ -726,7 +727,7 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size /* If no filename set, this is not an external reference */ if (NULL == H5R_REF_FILENAME(&tmp_ref)) { /* TODO temporary hack to retrieve file object */ - if ((file_id = H5F_get_file_id(src_file, H5I_FILE, FALSE)) < 0) + if ((file_id = H5F_get_file_id(src_file_obj, H5I_FILE, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Attach loc ID to reference and hold reference to it, this is a @@ -754,7 +755,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull) +H5T__ref_disk_isnull(const H5VL_object_t *src_file_obj, const void *src_buf, hbool_t *isnull) { const uint8_t *p = (const uint8_t *)src_buf; H5R_type_t ref_type; @@ -764,7 +765,7 @@ H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t H5T_REF_LOG_DEBUG(""); /* Check parameters */ - HDassert(src_file); + HDassert(src_file_obj); HDassert(src_buf); HDassert(isnull); @@ -785,7 +786,7 @@ H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t vol_cb_args.args.is_null.isnull = isnull; /* Check if blob ID is "nil" */ - if (H5VL_blob_specific(src_file, (void *)p, &vol_cb_args) < 0) + if (H5VL_blob_specific(src_file_obj, (void *)p, &vol_cb_args) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'") } @@ -803,7 +804,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) +H5T__ref_disk_setnull(H5VL_object_t *dst_file_obj, void *dst_buf, void *bg_buf) { H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */ uint8_t * q = (uint8_t *)dst_buf; @@ -813,7 +814,7 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) FUNC_ENTER_STATIC H5T_REF_LOG_DEBUG(""); - HDassert(dst_file); + HDassert(dst_file_obj); HDassert(dst_buf); /* TODO Should get rid of bg stuff */ @@ -825,7 +826,7 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) vol_cb_args.op_type = H5VL_BLOB_DELETE; /* Remove blob for old data */ - if (H5VL_blob_specific(dst_file, (void *)p_bg, &vol_cb_args) < 0) + if (H5VL_blob_specific(dst_file_obj, (void *)p_bg, &vol_cb_args) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob") } /* end if */ @@ -840,7 +841,7 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) vol_cb_args.op_type = H5VL_BLOB_SETNULL; /* Set blob ID to "nil" */ - if (H5VL_blob_specific(dst_file, q, &vol_cb_args) < 0) + if (H5VL_blob_specific(dst_file_obj, q, &vol_cb_args) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'") done: @@ -857,8 +858,8 @@ done: *------------------------------------------------------------------------- */ static size_t -H5T__ref_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, size_t src_size, - H5VL_object_t H5_ATTR_UNUSED *dst_file, hbool_t *dst_copy) +H5T__ref_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, hbool_t *dst_copy) { const uint8_t *p = (const uint8_t *)src_buf; unsigned flags; @@ -906,8 +907,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_NDEBUG_UNUSED src_size, - H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t dst_size) +H5T__ref_disk_read(H5VL_object_t *src_file_obj, const void *src_buf, size_t H5_ATTR_NDEBUG_UNUSED src_size, + H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, void *dst_buf, size_t dst_size) { const uint8_t *p = (const uint8_t *)src_buf; uint8_t * q = (uint8_t *)dst_buf; @@ -917,7 +918,7 @@ H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_ FUNC_ENTER_STATIC H5T_REF_LOG_DEBUG(""); - HDassert(src_file); + HDassert(src_file_obj); HDassert(src_buf); HDassert(dst_buf); HDassert(dst_size); @@ -933,7 +934,7 @@ H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_ HDassert(src_size > (H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T)); /* Retrieve blob */ - if (H5VL_blob_get(src_file, p, q, blob_size, NULL) < 0) + if (H5VL_blob_get(src_file_obj, p, q, blob_size, NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get blob") done: @@ -950,8 +951,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, size_t src_size, - H5R_type_t H5_ATTR_UNUSED src_type, H5VL_object_t *dst_file, void *dst_buf, +H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file_obj, const void *src_buf, size_t src_size, + H5R_type_t H5_ATTR_UNUSED src_type, H5VL_object_t *dst_file_obj, void *dst_buf, size_t dst_size, void *bg_buf) { const uint8_t *p = (const uint8_t *)src_buf; @@ -965,7 +966,7 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, HDassert(src_buf); HDassert(src_size); - HDassert(dst_file); + HDassert(dst_file_obj); HDassert(dst_buf); /* TODO Should get rid of bg stuff */ @@ -982,7 +983,7 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, vol_cb_args.op_type = H5VL_BLOB_DELETE; /* Remove blob for old data */ - if (H5VL_blob_specific(dst_file, (void *)p_bg, &vol_cb_args) < 0) + if (H5VL_blob_specific(dst_file_obj, (void *)p_bg, &vol_cb_args) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob") } /* end if */ @@ -999,7 +1000,7 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, buf_size_left -= H5_SIZEOF_UINT32_T; /* Store blob */ - if (H5VL_blob_put(dst_file, p, src_size, q, NULL) < 0) + if (H5VL_blob_put(dst_file_obj, p, src_size, q, NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to put blob") done: @@ -1016,7 +1017,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull) +H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file_obj, const void *src_buf, hbool_t *isnull) { H5F_t * src_f; const uint8_t *p = (const uint8_t *)src_buf; @@ -1027,7 +1028,7 @@ H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbo H5T_REF_LOG_DEBUG(""); /* Check parameters */ - HDassert(src_file); + HDassert(src_file_obj); HDassert(src_buf); HDassert(isnull); @@ -1036,7 +1037,7 @@ H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbo hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(src_file, &is_native) < 0) + if (H5VL_object_is_native(src_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -1045,7 +1046,7 @@ H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbo #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") /* Get the object address */ @@ -1068,8 +1069,8 @@ done: *------------------------------------------------------------------------- */ static size_t -H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *src_buf, - size_t H5_ATTR_UNUSED src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file, +H5T__ref_obj_disk_getsize(H5VL_object_t *src_file_obj, const void H5_ATTR_UNUSED *src_buf, + size_t H5_ATTR_UNUSED src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, hbool_t H5_ATTR_UNUSED *dst_copy) { H5F_t *src_f; @@ -1078,7 +1079,7 @@ H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *sr FUNC_ENTER_STATIC H5T_REF_LOG_DEBUG(""); - HDassert(src_file); + HDassert(src_file_obj); HDassert(src_buf); #ifndef NDEBUG @@ -1086,7 +1087,7 @@ H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *sr hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(src_file, &is_native) < 0) + if (H5VL_object_is_native(src_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -1095,7 +1096,7 @@ H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *sr #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") HDassert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f)); @@ -1116,8 +1117,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t H5_ATTR_UNUSED dst_size) +H5T__ref_obj_disk_read(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, void *dst_buf, + size_t H5_ATTR_UNUSED dst_size) { H5F_t *src_f; herr_t ret_value = SUCCEED; @@ -1125,7 +1127,7 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ FUNC_ENTER_STATIC H5T_REF_LOG_DEBUG(""); - HDassert(src_file); + HDassert(src_file_obj); HDassert(src_buf); HDassert(dst_buf); @@ -1134,7 +1136,7 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(src_file, &is_native) < 0) + if (H5VL_object_is_native(src_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -1143,7 +1145,7 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") HDassert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f)); @@ -1168,7 +1170,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull) +H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file_obj, const void *src_buf, hbool_t *isnull) { H5F_t * src_f; const uint8_t *p = (const uint8_t *)src_buf; @@ -1179,7 +1181,7 @@ H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, H5T_REF_LOG_DEBUG(""); /* Check parameters */ - HDassert(src_file); + HDassert(src_file_obj); HDassert(src_buf); HDassert(isnull); @@ -1188,7 +1190,7 @@ H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(src_file, &is_native) < 0) + if (H5VL_object_is_native(src_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -1197,7 +1199,7 @@ H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") /* Get the heap address */ @@ -1220,8 +1222,8 @@ done: *------------------------------------------------------------------------- */ static size_t -H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void H5_ATTR_UNUSED *src_buf, - size_t H5_ATTR_UNUSED src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file, +H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file_obj, const void H5_ATTR_UNUSED *src_buf, + size_t H5_ATTR_UNUSED src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, hbool_t H5_ATTR_UNUSED *dst_copy) { size_t ret_value = sizeof(struct H5Tref_dsetreg); @@ -1241,14 +1243,14 @@ H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(src_file, &is_native) < 0) + if (H5VL_object_is_native(src_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ HDassert(is_native); /* Retrieve file from VOL object */ - if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f)); @@ -1271,8 +1273,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, +H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, void *dst_buf, size_t H5_ATTR_UNUSED dst_size) { H5F_t * src_f; @@ -1282,7 +1284,7 @@ H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t FUNC_ENTER_STATIC H5T_REF_LOG_DEBUG(""); - HDassert(src_file); + HDassert(src_file_obj); HDassert(src_buf); HDassert(dst_buf); HDassert(dst_size == sizeof(struct H5Tref_dsetreg)); @@ -1292,7 +1294,7 @@ H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(src_file, &is_native) < 0) + if (H5VL_object_is_native(src_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -1301,7 +1303,7 @@ H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f)); diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 080d725..ee32bf3 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -52,31 +52,31 @@ /********************/ /* Memory-based VL sequence callbacks */ -static herr_t H5T__vlen_mem_seq_getlen(H5VL_object_t *file, const void *_vl, size_t *len); +static herr_t H5T__vlen_mem_seq_getlen(H5VL_object_t *file_obj, const void *_vl, size_t *len); static void * H5T__vlen_mem_seq_getptr(void *_vl); -static herr_t H5T__vlen_mem_seq_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull); -static herr_t H5T__vlen_mem_seq_setnull(H5VL_object_t *file, void *_vl, void *_bg); -static herr_t H5T__vlen_mem_seq_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len); -static herr_t H5T__vlen_mem_seq_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, +static herr_t H5T__vlen_mem_seq_isnull(const H5VL_object_t *file_obj, void *_vl, hbool_t *isnull); +static herr_t H5T__vlen_mem_seq_setnull(H5VL_object_t *file_obj, void *_vl, void *_bg); +static herr_t H5T__vlen_mem_seq_read(H5VL_object_t *file_obj, void *_vl, void *_buf, size_t len); +static herr_t H5T__vlen_mem_seq_write(H5VL_object_t *file_obj, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size); /* Memory-based VL string callbacks */ -static herr_t H5T__vlen_mem_str_getlen(H5VL_object_t *file, const void *_vl, size_t *len); +static herr_t H5T__vlen_mem_str_getlen(H5VL_object_t *file_obj, const void *_vl, size_t *len); static void * H5T__vlen_mem_str_getptr(void *_vl); -static herr_t H5T__vlen_mem_str_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull); -static herr_t H5T__vlen_mem_str_setnull(H5VL_object_t *file, void *_vl, void *_bg); -static herr_t H5T__vlen_mem_str_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len); -static herr_t H5T__vlen_mem_str_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, +static herr_t H5T__vlen_mem_str_isnull(const H5VL_object_t *file_obj, void *_vl, hbool_t *isnull); +static herr_t H5T__vlen_mem_str_setnull(H5VL_object_t *file_obj, void *_vl, void *_bg); +static herr_t H5T__vlen_mem_str_read(H5VL_object_t *file_obj, void *_vl, void *_buf, size_t len); +static herr_t H5T__vlen_mem_str_write(H5VL_object_t *file_obj, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size); /* Disk-based VL sequence (and string) callbacks */ -static herr_t H5T__vlen_disk_getlen(H5VL_object_t *file, const void *_vl, size_t *len); -static herr_t H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull); -static herr_t H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *_bg); -static herr_t H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len); -static herr_t H5T__vlen_disk_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, - void *_buf, void *_bg, size_t seq_len, size_t base_size); -static herr_t H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl); +static herr_t H5T__vlen_disk_getlen(H5VL_object_t *file_obj, const void *_vl, size_t *len); +static herr_t H5T__vlen_disk_isnull(const H5VL_object_t *file_obj, void *_vl, hbool_t *isnull); +static herr_t H5T__vlen_disk_setnull(H5VL_object_t *file_obj, void *_vl, void *_bg); +static herr_t H5T__vlen_disk_read(H5VL_object_t *file_obj, void *_vl, void *_buf, size_t len); +static herr_t H5T__vlen_disk_write(H5VL_object_t *file_obj, const H5T_vlen_alloc_info_t *vl_alloc_info, + void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size); +static herr_t H5T__vlen_disk_delete(H5VL_object_t *file_obj, const void *_vl); /*********************/ /* Public Variables */ @@ -245,7 +245,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) +H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file_obj, H5T_loc_t loc) { htri_t ret_value = FALSE; /* Indicate success, but no location change */ @@ -256,10 +256,10 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) HDassert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC); /* Only change the location if it's different */ - if (loc != dt->shared->u.vlen.loc || file != dt->shared->u.vlen.file) { + if (loc != dt->shared->u.vlen.loc || file_obj != dt->shared->u.vlen.file_obj) { switch (loc) { case H5T_LOC_MEMORY: /* Memory based VL datatype */ - HDassert(NULL == file); + HDassert(NULL == file_obj); /* Mark this type as being stored in memory */ dt->shared->u.vlen.loc = H5T_LOC_MEMORY; @@ -288,8 +288,8 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) dt->shared->owned_vol_obj = NULL; } /* end if */ - /* Reset file pointer (since this VL is in memory) */ - dt->shared->u.vlen.file = NULL; + /* Reset VOL object (since this VL is in memory) */ + dt->shared->u.vlen.file_obj = NULL; break; /* Disk based VL datatype */ @@ -297,7 +297,7 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */ - HDassert(file); + HDassert(file_obj); /* Mark this type as being stored on disk */ dt->shared->u.vlen.loc = H5T_LOC_DISK; @@ -307,7 +307,7 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) vol_cb_args.args.get_cont_info.info = &cont_info; /* Get container info */ - if (H5VL_file_get(file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if (H5VL_file_get(file_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info") /* The datatype size is equal to 4 bytes for the sequence length @@ -318,11 +318,11 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* VL sequences and VL strings are stored identically on disk, so use the same functions */ dt->shared->u.vlen.cls = &H5T_vlen_disk_g; - /* Set file ID (since this VL is on disk) */ - dt->shared->u.vlen.file = file; + /* Set VOL object (since this VL is on disk) */ + dt->shared->u.vlen.file_obj = file_obj; /* dt now owns a reference to file */ - if (H5T_own_vol_obj(dt, file) < 0) + if (H5T_own_vol_obj(dt, file_obj) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't give ownership of VOL object") break; } @@ -336,8 +336,8 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* Reset the function pointers to access the VL information */ dt->shared->u.vlen.cls = NULL; - /* Reset file pointer */ - dt->shared->u.vlen.file = NULL; + /* Reset VOL object pointer */ + dt->shared->u.vlen.file_obj = NULL; break; case H5T_LOC_MAXLOC: @@ -367,7 +367,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_t *len) +H5T__vlen_mem_seq_getlen(H5VL_object_t H5_ATTR_UNUSED *file_obj, const void *_vl, size_t *len) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -441,7 +441,7 @@ H5T__vlen_mem_seq_getptr(void *_vl) *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hbool_t *isnull) +H5T__vlen_mem_seq_isnull(const H5VL_object_t H5_ATTR_UNUSED *file_obj, void *_vl, hbool_t *isnull) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -478,7 +478,7 @@ H5T__vlen_mem_seq_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hb *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5_ATTR_UNUSED *_bg) +H5T__vlen_mem_seq_setnull(H5VL_object_t H5_ATTR_UNUSED *file_obj, void *_vl, void H5_ATTR_UNUSED *_bg) { hvl_t vl; /* Temporary hvl_t to use during operation */ @@ -510,7 +510,7 @@ H5T__vlen_mem_seq_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5 *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, size_t len) +H5T__vlen_mem_seq_read(H5VL_object_t H5_ATTR_UNUSED *file_obj, void *_vl, void *buf, size_t len) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -550,7 +550,7 @@ H5T__vlen_mem_seq_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc_info_t *vl_alloc_info, +H5T__vlen_mem_seq_write(H5VL_object_t H5_ATTR_UNUSED *file_obj, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size) { hvl_t vl; /* Temporary hvl_t to use during operation */ @@ -604,7 +604,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_t *len) +H5T__vlen_mem_str_getlen(H5VL_object_t H5_ATTR_UNUSED *file_obj, const void *_vl, size_t *len) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const char *s = *(const char *const *)_vl; /* Pointer to the user's string information */ @@ -673,7 +673,7 @@ H5T__vlen_mem_str_getptr(void *_vl) *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hbool_t *isnull) +H5T__vlen_mem_str_isnull(const H5VL_object_t H5_ATTR_UNUSED *file_obj, void *_vl, hbool_t *isnull) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s = *(char **)_vl; /* Pointer to the user's string information */ @@ -705,7 +705,7 @@ H5T__vlen_mem_str_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hb *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5_ATTR_UNUSED *_bg) +H5T__vlen_mem_str_setnull(H5VL_object_t H5_ATTR_UNUSED *file_obj, void *_vl, void H5_ATTR_UNUSED *_bg) { char *t = NULL; /* Pointer to temporary buffer allocated */ @@ -730,7 +730,7 @@ H5T__vlen_mem_str_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5 *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, size_t len) +H5T__vlen_mem_str_read(H5VL_object_t H5_ATTR_UNUSED *file_obj, void *_vl, void *buf, size_t len) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s = *(char **)_vl; /* Pointer to the user's string information */ @@ -769,7 +769,7 @@ H5T__vlen_mem_str_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc_info_t *vl_alloc_info, +H5T__vlen_mem_str_write(H5VL_object_t H5_ATTR_UNUSED *file_obj, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size) { char * t; /* Pointer to temporary buffer allocated */ @@ -817,7 +817,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_t *seq_len) +H5T__vlen_disk_getlen(H5VL_object_t H5_ATTR_UNUSED *file_obj, const void *_vl, size_t *seq_len) { const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -846,7 +846,7 @@ H5T__vlen_disk_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_ *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull) +H5T__vlen_disk_isnull(const H5VL_object_t *file_obj, void *_vl, hbool_t *isnull) { H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */ uint8_t * vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -855,7 +855,7 @@ H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull) FUNC_ENTER_STATIC /* Check parameters */ - HDassert(file); + HDassert(file_obj); HDassert(vl); HDassert(isnull); @@ -867,7 +867,7 @@ H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull) vol_cb_args.args.is_null.isnull = isnull; /* Check if blob ID is "nil" */ - if (H5VL_blob_specific(file, vl, &vol_cb_args) < 0) + if (H5VL_blob_specific(file_obj, vl, &vol_cb_args) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'") done: @@ -887,7 +887,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg) +H5T__vlen_disk_setnull(H5VL_object_t *file_obj, void *_vl, void *bg) { H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */ uint8_t * vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -896,13 +896,13 @@ H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg) FUNC_ENTER_STATIC /* check parameters */ - HDassert(file); + HDassert(file_obj); HDassert(vl); /* Free heap object for old data */ if (bg != NULL) /* Delete sequence in destination location */ - if (H5T__vlen_disk_delete(file, bg) < 0) + if (H5T__vlen_disk_delete(file_obj, bg) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove background heap object") /* Set the length of the sequence */ @@ -912,7 +912,7 @@ H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg) vol_cb_args.op_type = H5VL_BLOB_SETNULL; /* Set blob ID to "nil" */ - if (H5VL_blob_specific(file, vl, &vol_cb_args) < 0) + if (H5VL_blob_specific(file_obj, vl, &vol_cb_args) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'") done: @@ -932,7 +932,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *buf, size_t len) +H5T__vlen_disk_read(H5VL_object_t *file_obj, void *_vl, void *buf, size_t len) { const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */ herr_t ret_value = SUCCEED; /* Return value */ @@ -940,7 +940,7 @@ H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *buf, size_t len) FUNC_ENTER_STATIC /* Check parameters */ - HDassert(file); + HDassert(file_obj); HDassert(vl); HDassert(buf); @@ -948,7 +948,7 @@ H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *buf, size_t len) vl += 4; /* Retrieve blob */ - if (H5VL_blob_get(file, vl, buf, len, NULL) < 0) + if (H5VL_blob_get(file_obj, vl, buf, len, NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get blob") done: @@ -968,7 +968,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_alloc_info, +H5T__vlen_disk_write(H5VL_object_t *file_obj, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_alloc_info, void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size) { uint8_t * vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -980,18 +980,18 @@ H5T__vlen_disk_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t H5_ATTR_UN /* check parameters */ HDassert(vl); HDassert(seq_len == 0 || buf); - HDassert(file); + HDassert(file_obj); /* Free heap object for old data, if non-NULL */ if (bg != NULL) - if (H5T__vlen_disk_delete(file, bg) < 0) + if (H5T__vlen_disk_delete(file_obj, bg) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove background heap object") /* Set the length of the sequence */ UINT32ENCODE(vl, seq_len); /* Store blob */ - if (H5VL_blob_put(file, buf, (seq_len * base_size), vl, NULL) < 0) + if (H5VL_blob_put(file_obj, buf, (seq_len * base_size), vl, NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to put blob") done: @@ -1011,7 +1011,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl) +H5T__vlen_disk_delete(H5VL_object_t *file_obj, const void *_vl) { const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1019,7 +1019,7 @@ H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl) FUNC_ENTER_STATIC /* Check parameters */ - HDassert(file); + HDassert(file_obj); /* Free heap object for old data */ if (vl != NULL) { @@ -1035,7 +1035,7 @@ H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl) /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_BLOB_DELETE; - if (H5VL_blob_specific(file, (void *)vl, &vol_cb_args) < 0) /* Casting away 'const' OK -QAK */ + if (H5VL_blob_specific(file_obj, (void *)vl, &vol_cb_args) < 0) /* Casting away 'const' OK -QAK */ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob") } /* end if */ } /* end if */ @@ -686,7 +686,7 @@ H5VLget_file_type(void *file_obj, hid_t connector_id, hid_t dtype_id) /* Create VOL object for file if necessary (force_conv will be TRUE if and * only if file needs to be passed to H5T_set_loc) */ if (H5T_GET_FORCE_CONV(dtype) && - (NULL == (file_vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, file_obj, connector_id)))) + (NULL == (file_vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, file_obj, connector_id, TRUE)))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object") /* Copy the datatype */ @@ -1077,3 +1077,37 @@ H5VLunregister_opt_operation(H5VL_subclass_t subcls, const char *op_name) done: FUNC_LEAVE_API(ret_value) } /* H5VLunregister_opt_operation() */ + +/*------------------------------------------------------------------------- + * Function: H5VLfapl_is_native + * + * Purpose: Query if a FAPL will use the native VOL connector. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfapl_is_native(hid_t fapl_id, hbool_t *is_native) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*b", fapl_id, is_native); + + /* Check args */ + if (NULL == is_native) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid is_native pointer") + + /* Check for default property list value */ + if (H5P_DEFAULT == fapl_id) + fapl_id = H5P_FILE_ACCESS_DEFAULT; + + /* Invoke the private API call */ + if (H5VL_fapl_is_native(fapl_id, is_native) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLfapl_is_native() */ diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 2369be5..a3d56df 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -28,6 +28,8 @@ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5ESprivate.h" /* Event Sets */ #include "H5Fprivate.h" /* File access */ @@ -60,6 +62,541 @@ typedef struct H5VL_file_open_find_connector_t { typedef herr_t (*H5VL_reg_opt_oper_t)(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req); +/* Typedef for common callback form of API operations */ +typedef herr_t (*H5VL_api_oper_t)(void *ctx); + +/* + * Context data structures for common callbacks for API operations + */ + +/* Attribute create "common" callback context data */ +typedef struct H5VL_attr_create_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + const char * name; + hid_t type_id; + hid_t space_id; + hid_t acpl_id; + hid_t aapl_id; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_attr_create_ctx_t; + +/* Attribute open "common" callback context data */ +typedef struct H5VL_attr_open_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + const char * name; + hid_t aapl_id; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_attr_open_ctx_t; + +/* Attribute read "common" callback context data */ +typedef struct H5VL_attr_read_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t mem_type_id; + void * buf; + hid_t dxpl_id; + void ** req; +} H5VL_attr_read_ctx_t; + +/* Attribute write "common" callback context data */ +typedef struct H5VL_attr_write_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t mem_type_id; + const void * buf; + hid_t dxpl_id; + void ** req; +} H5VL_attr_write_ctx_t; + +/* Attribute get "common" callback context data */ +typedef struct H5VL_attr_get_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_attr_get_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_attr_get_ctx_t; + +/* Attribute specific "common" callback context data */ +typedef struct H5VL_attr_specific_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t * loc_params; + H5VL_class_t * cls; + H5VL_attr_specific_args_t *args; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + herr_t ret_value; +} H5VL_attr_specific_ctx_t; + +/* Attribute optional "common" callback context data */ +typedef struct H5VL_attr_optional_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_optional_args_t *args; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + herr_t ret_value; +} H5VL_attr_optional_ctx_t; + +/* Attribute close "common" callback context data */ +typedef struct H5VL_attr_close_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t dxpl_id; + void ** req; +} H5VL_attr_close_ctx_t; + +/* Dataset create "common" callback context data */ +typedef struct H5VL_dataset_create_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + const char * name; + hid_t lcpl_id; + hid_t type_id; + hid_t space_id; + hid_t dcpl_id; + hid_t dapl_id; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_dataset_create_ctx_t; + +/* Dataset open "common" callback context data */ +typedef struct H5VL_dataset_open_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + const char * name; + hid_t dapl_id; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_dataset_open_ctx_t; + +/* Dataset read "common" callback context data */ +typedef struct H5VL_dataset_read_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t mem_type_id; + hid_t mem_space_id; + hid_t file_space_id; + void * buf; + hid_t dxpl_id; + void ** req; +} H5VL_dataset_read_ctx_t; + +/* Dataset write "common" callback context data */ +typedef struct H5VL_dataset_write_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t mem_type_id; + hid_t mem_space_id; + hid_t file_space_id; + const void * buf; + hid_t dxpl_id; + void ** req; +} H5VL_dataset_write_ctx_t; + +/* Dataset get "common" callback context data */ +typedef struct H5VL_dataset_get_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_dataset_get_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_dataset_get_ctx_t; + +/* Dataset specific "common" callback context data */ +typedef struct H5VL_dataset_specific_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_dataset_specific_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_dataset_specific_ctx_t; + +/* Dataset optional "common" callback context data */ +typedef struct H5VL_dataset_optional_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_optional_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_dataset_optional_ctx_t; + +/* Dataset close "common" callback context data */ +typedef struct H5VL_dataset_close_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t dxpl_id; + void ** req; +} H5VL_dataset_close_ctx_t; + +/* Named datatype commit "common" callback context data */ +typedef struct H5VL_datatype_commit_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + 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; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_datatype_commit_ctx_t; + +/* Named datatype open "common" callback context data */ +typedef struct H5VL_datatype_open_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + const char * name; + hid_t tapl_id; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_datatype_open_ctx_t; + +/* Datatype get "common" callback context data */ +typedef struct H5VL_datatype_get_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_datatype_get_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_datatype_get_ctx_t; + +/* Datatype specific "common" callback context data */ +typedef struct H5VL_datatype_specific_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_datatype_specific_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_datatype_specific_ctx_t; + +/* Datatype optional "common" callback context data */ +typedef struct H5VL_datatype_optional_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_optional_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_datatype_optional_ctx_t; + +/* Datatype close "common" callback context data */ +typedef struct H5VL_datatype_close_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t dxpl_id; + void ** req; +} H5VL_datatype_close_ctx_t; + +/* File get "common" callback context data */ +typedef struct H5VL_file_get_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_file_get_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_file_get_ctx_t; + +/* File specific "common" callback context data */ +typedef struct H5VL_file_specific_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_file_specific_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_file_specific_ctx_t; + +/* File optional "common" callback context data */ +typedef struct H5VL_file_optional_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_optional_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_file_optional_ctx_t; + +/* File close "common" callback context data */ +typedef struct H5VL_file_close_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t dxpl_id; + void ** req; +} H5VL_file_close_ctx_t; + +/* Group create "common" callback context data */ +typedef struct H5VL_group_create_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + const char * name; + hid_t lcpl_id; + hid_t gcpl_id; + hid_t gapl_id; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_group_create_ctx_t; + +/* Group open "common" callback context data */ +typedef struct H5VL_group_open_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + const char * name; + hid_t gapl_id; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_group_open_ctx_t; + +/* Group get "common" callback context data */ +typedef struct H5VL_group_get_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_group_get_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_group_get_ctx_t; + +/* Group specific "common" callback context data */ +typedef struct H5VL_group_specific_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_group_specific_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_group_specific_ctx_t; + +/* Group optional "common" callback context data */ +typedef struct H5VL_group_optional_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_optional_args_t *args; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + herr_t ret_value; +} H5VL_group_optional_ctx_t; + +/* Group close "common" callback context data */ +typedef struct H5VL_group_close_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t dxpl_id; + void ** req; +} H5VL_group_close_ctx_t; + +/* Link create "common" callback context data */ +typedef struct H5VL_link_create_ctx_t { + /* DOWN: API routine parameters */ + H5VL_link_create_args_t *args; + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + hid_t lcpl_id; + hid_t lapl_id; + hid_t dxpl_id; + void ** req; +} H5VL_link_create_ctx_t; + +/* Link copy "common" callback context data */ +typedef struct H5VL_link_copy_ctx_t { + /* DOWN: API routine parameters */ + void * src_obj; + const H5VL_loc_params_t *src_loc_params; + void * dst_obj; + const H5VL_loc_params_t *dst_loc_params; + H5VL_class_t * cls; + hid_t lcpl_id; + hid_t lapl_id; + hid_t dxpl_id; + void ** req; +} H5VL_link_copy_ctx_t; + +/* Link move "common" callback context data */ +typedef struct H5VL_link_move_ctx_t { + /* DOWN: API routine parameters */ + void * src_obj; + const H5VL_loc_params_t *src_loc_params; + void * dst_obj; + const H5VL_loc_params_t *dst_loc_params; + H5VL_class_t * cls; + hid_t lcpl_id; + hid_t lapl_id; + hid_t dxpl_id; + void ** req; +} H5VL_link_move_ctx_t; + +/* Link get "common" callback context data */ +typedef struct H5VL_link_get_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + H5VL_link_get_args_t * args; + hid_t dxpl_id; + void ** req; +} H5VL_link_get_ctx_t; + +/* Link specific "common" callback context data */ +typedef struct H5VL_link_specific_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t * loc_params; + H5VL_class_t * cls; + H5VL_link_specific_args_t *args; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + herr_t ret_value; +} H5VL_link_specific_ctx_t; + +/* Link optional "common" callback context data */ +typedef struct H5VL_link_optional_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + H5VL_optional_args_t * args; + hid_t dxpl_id; + void ** req; +} H5VL_link_optional_ctx_t; + +/* Object open "common" callback context data */ +typedef struct H5VL_object_open_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + H5I_type_t * opened_type; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_object_open_ctx_t; + +/* Object copy "common" callback context data */ +typedef struct H5VL_object_copy_ctx_t { + /* DOWN: API routine parameters */ + 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; + H5VL_class_t * cls; + hid_t ocpypl_id; + hid_t lcpl_id; + hid_t dxpl_id; + void ** req; +} H5VL_object_copy_ctx_t; + +/* Object get "common" callback context data */ +typedef struct H5VL_object_get_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + H5VL_object_get_args_t * args; + hid_t dxpl_id; + void ** req; +} H5VL_object_get_ctx_t; + +/* Object specific "common" callback context data */ +typedef struct H5VL_object_specific_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t * loc_params; + H5VL_class_t * cls; + H5VL_object_specific_args_t *args; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + herr_t ret_value; +} H5VL_object_specific_ctx_t; + +/* Object optional "common" callback context data */ +typedef struct H5VL_object_optional_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + H5VL_optional_args_t * args; + hid_t dxpl_id; + void ** req; +} H5VL_object_optional_ctx_t; + /********************/ /* Package Typedefs */ /********************/ @@ -70,47 +607,69 @@ typedef herr_t (*H5VL_reg_opt_oper_t)(void *obj, const H5VL_class_t *cls, H5VL_o static void * H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__attr_create_api_op(void *ctx); 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_open_api_op(void *ctx); 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_read_api_op(void *ctx); 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_write_api_op(void *ctx); static herr_t H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__attr_get_api_op(void *ctx); static herr_t H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__attr_specific_api_op(void *ctx); static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__attr_optional_api_op(void *ctx); static herr_t H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__attr_close_api_op(void *ctx); static void * H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__dataset_create_api_op(void *ctx); 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_open_api_op(void *ctx); 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 dxpl_id, void *buf, void **req); +static herr_t H5VL__dataset_read_api_op(void *ctx); 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 dxpl_id, const void *buf, void **req); +static herr_t H5VL__dataset_write_api_op(void *ctx); static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__dataset_get_api_op(void *ctx); static herr_t H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__dataset_specific_api_op(void *ctx); static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__dataset_optional_api_op(void *ctx); static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__dataset_close_api_op(void *ctx); 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 herr_t H5VL__datatype_commit_api_op(void *ctx); 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_open_api_op(void *ctx); static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__datatype_get_api_op(void *ctx); static herr_t H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__datatype_specific_api_op(void *ctx); static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__datatype_optional_api_op(void *ctx); static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__datatype_close_api_op(void *ctx); 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, @@ -119,50 +678,71 @@ static herr_t H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const v void *op_data); static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__file_get_api_op(void *ctx); static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__file_specific_api_op(void *ctx); static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__file_optional_api_op(void *ctx); static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__file_close_api_op(void *ctx); static void * H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__group_create_api_op(void *ctx); 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_open_api_op(void *ctx); static herr_t H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__group_get_api_op(void *ctx); static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__group_specific_api_op(void *ctx); static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__group_optional_api_op(void *ctx); static herr_t H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__group_close_api_op(void *ctx); static herr_t H5VL__link_create(H5VL_link_create_args_t *args, 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, +static herr_t H5VL__link_create_api_op(void *ctx); +static herr_t H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, void *dst_obj, + const H5VL_loc_params_t *dst_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_api_op(void *ctx); 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_move_api_op(void *ctx); static herr_t H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_link_get_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__link_get_api_op(void *ctx); static herr_t H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__link_specific_api_op(void *ctx); static herr_t H5VL__link_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__link_optional_api_op(void *ctx); 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_open_api_op(void *ctx); 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_copy_api_op(void *ctx); static herr_t H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_object_get_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__object_get_api_op(void *ctx); static herr_t H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__object_specific_api_op(void *ctx); static herr_t H5VL__object_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__object_optional_api_op(void *ctx); static herr_t H5VL__introspect_get_conn_cls(void *obj, const H5VL_class_t *cls, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); static herr_t H5VL__introspect_opt_query(void *obj, const H5VL_class_t *cls, H5VL_subclass_t subcls, @@ -219,7 +799,7 @@ 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 + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE2("e", "ii", connector_id, vipl_id); /* Check args */ @@ -231,7 +811,7 @@ H5VLinitialize(hid_t connector_id, hid_t vipl_id) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not initialize") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLinitialize() */ /*------------------------------------------------------------------------- @@ -250,7 +830,7 @@ 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 + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE1("e", "i", connector_id); /* Check args */ @@ -262,7 +842,7 @@ H5VLterminate(hid_t connector_id) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLterminate() */ /*--------------------------------------------------------------------------- @@ -281,7 +861,7 @@ H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags /*out*/) H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE2("e", "ix", connector_id, cap_flags); /* Check args */ @@ -293,7 +873,7 @@ H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags /*out*/) *cap_flags = cls->cap_flags; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLget_cap_flags */ /*--------------------------------------------------------------------------- @@ -312,7 +892,7 @@ H5VLget_value(hid_t connector_id, H5VL_class_value_t *value /*out*/) H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE2("e", "ix", connector_id, value); /* Check args */ @@ -324,7 +904,7 @@ H5VLget_value(hid_t connector_id, H5VL_class_value_t *value /*out*/) *value = cls->value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLget_value */ /*------------------------------------------------------------------------- @@ -361,7 +941,7 @@ H5VL__common_optional_op(hid_t id, H5I_type_t id_type, H5VL_reg_opt_oper_t reg_o /* (Must return value from callback, for iterators) */ if ((ret_value = (*reg_opt_op)((*vol_obj_ptr)->data, (*vol_obj_ptr)->connector->cls, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute generic 'optional' callback"); done: /* Reset object wrapping info in API context */ @@ -372,6 +952,68 @@ done: } /* end H5VL__common_optional_op() */ /*------------------------------------------------------------------------- + * Function: H5VL__common_api_op + * + * Purpose: Provide common wrapping for VOL callback API routines. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__common_api_op(hid_t dxpl_id, H5VL_api_oper_t wrap_op, void *wrap_ctx) +{ + H5P_genplist_t *dxpl_plist = NULL; /* DXPL property list pointer */ + hbool_t new_api_ctx = FALSE; /* Whether to start a new API context */ + hbool_t api_pushed = FALSE; /* Indicate that a new API context was pushed */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check for non-default DXPL */ + if (!(H5P_DEFAULT == dxpl_id || H5P_DATASET_XFER_DEFAULT == dxpl_id)) { + /* Check for 'new API context' flag */ + if (NULL == (dxpl_plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a dataset transfer property list") + if (H5P_get(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &new_api_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get value") + + /* Start a new API context, if requested */ + if (new_api_ctx) { + hbool_t reset_api_ctx = FALSE; /* Flag to reset the 'new API context' */ + + /* Push the API context */ + if (H5CX_push() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set API context") + api_pushed = TRUE; + + /* Reset 'new API context' flag for next layer down */ + if (H5P_set(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &reset_api_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to set value") + } /* end if */ + } /* end if */ + + /* Call the corresponding internal common wrapper routine */ + if ((*wrap_op)(wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation callback") + +done: + /* Pop the API context, if it was pushed */ + if (api_pushed) { + hbool_t undo_api_ctx = TRUE; /* Flag to reset the 'new API context' */ + + /* Undo change to 'new API context' flag */ + if (H5P_set(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &undo_api_ctx) < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to set value") + + (void)H5CX_pop(FALSE); + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__common_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VL_copy_connector_info * * Purpose: Copy the VOL info for a connector @@ -431,7 +1073,7 @@ H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_i H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "i**x*x", connector_id, dst_vol_info, src_vol_info); /* Check args and get class pointer */ @@ -443,7 +1085,7 @@ H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_i HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy VOL connector info object") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLcopy_connector_info() */ /*------------------------------------------------------------------------- @@ -593,7 +1235,7 @@ H5VLfree_connector_info(hid_t connector_id, void *info) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE2("e", "i*x", connector_id, info); /* Free the VOL connector info object */ @@ -601,7 +1243,7 @@ H5VLfree_connector_info(hid_t connector_id, void *info) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLfree_connector_info() */ /*--------------------------------------------------------------------------- @@ -619,7 +1261,7 @@ H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "*xi**s", info, connector_id, str); /* Only serialize info object, if it's non-NULL */ @@ -642,7 +1284,7 @@ H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str) *str = NULL; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLconnector_info_to_str() */ /*--------------------------------------------------------------------------- @@ -660,7 +1302,7 @@ H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info /*out { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "*six", str, connector_id, info); /* Call internal routine */ @@ -668,7 +1310,7 @@ H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info /*out HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "can't deserialize connector info") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLconnector_str_to_info() */ /*--------------------------------------------------------------------------- @@ -687,7 +1329,7 @@ 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 + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE2("*x", "*xi", obj, connector_id); /* Check args */ @@ -703,7 +1345,7 @@ H5VLget_object(void *obj, hid_t connector_id) ret_value = obj; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLget_object */ /*------------------------------------------------------------------------- @@ -760,7 +1402,7 @@ H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx /*out*/) H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "*xix", obj, connector_id, wrap_ctx); /* Check args and get class pointer */ @@ -772,7 +1414,7 @@ H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx /*out*/) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to retrieve VOL connector object wrap context") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLget_wrap_ctx() */ /*------------------------------------------------------------------------- @@ -825,7 +1467,7 @@ H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_c H5VL_class_t *cls; /* VOL connector's class struct */ void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE4("*x", "*xIti*x", obj, obj_type, connector_id, wrap_ctx); /* Check args and get class pointer */ @@ -839,7 +1481,7 @@ H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_c HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLwrap_object */ /*------------------------------------------------------------------------- @@ -892,7 +1534,7 @@ H5VLunwrap_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 + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE2("*x", "*xi", obj, connector_id); /* Check args and get class pointer */ @@ -906,7 +1548,7 @@ H5VLunwrap_object(void *obj, hid_t connector_id) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to unwrap object") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLunwrap_object */ /*------------------------------------------------------------------------- @@ -956,7 +1598,7 @@ 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 + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE2("e", "*xi", wrap_ctx, connector_id); /* Check args and get class pointer */ @@ -968,7 +1610,7 @@ H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector object wrap context") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLfree_wrap_ctx() */ /*------------------------------------------------------------------------- @@ -1040,6 +1682,37 @@ done: } /* end H5VL_attr_create() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_create_api_op + * + * Purpose: Callback for common API wrapper to create an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_create_api_op(void *_ctx) +{ + H5VL_attr_create_ctx_t *ctx = (H5VL_attr_create_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = + H5VL__attr_create(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, ctx->type_id, + ctx->space_id, ctx->acpl_id, ctx->aapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_create_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_create * * Purpose: Creates an attribute @@ -1054,10 +1727,11 @@ H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_ hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_attr_create_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE10("*x", "*x*#i*siiiiix", obj, loc_params, connector_id, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req); @@ -1067,13 +1741,28 @@ H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_ 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, type_id, space_id, acpl_id, - aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create attribute") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.type_id = type_id; + ctx.space_id = space_id; + ctx.acpl_id = acpl_id; + ctx.aapl_id = aapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_create_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_create() */ /*------------------------------------------------------------------------- @@ -1144,6 +1833,36 @@ done: } /* end H5VL_attr_open() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_open_api_op + * + * Purpose: Callback for common API wrapper to open an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_open_api_op(void *_ctx) +{ + H5VL_attr_open_ctx_t *ctx = (H5VL_attr_open_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = H5VL__attr_open(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, + ctx->aapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_open_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_open * * Purpose: Opens an attribute @@ -1157,10 +1876,11 @@ 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 /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_attr_open_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE7("*x", "*x*#i*siix", obj, loc_params, connector_id, name, aapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -1169,12 +1889,25 @@ H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id 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") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.aapl_id = aapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_open_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_open() */ /*------------------------------------------------------------------------- @@ -1242,6 +1975,35 @@ done: } /* end H5VL_attr_read() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_read_api_op + * + * Purpose: Callback for common API wrapper to read an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_read_api_op(void *_ctx) +{ + H5VL_attr_read_ctx_t *ctx = (H5VL_attr_read_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__attr_read(ctx->obj, ctx->cls, ctx->mem_type_id, ctx->buf, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_read_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_read * * Purpose: Reads data from an attribute @@ -1254,10 +2016,11 @@ done: herr_t H5VLattr_read(void *obj, hid_t connector_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_attr_read_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*xii*xix", obj, connector_id, mem_type_id, buf, dxpl_id, req); /* Check args and get class pointer */ @@ -1266,12 +2029,20 @@ H5VLattr_read(void *obj, hid_t connector_id, hid_t mem_type_id, void *buf, hid_t 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") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.mem_type_id = mem_type_id; + ctx.buf = buf; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_read_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_read() */ /*------------------------------------------------------------------------- @@ -1340,6 +2111,35 @@ done: } /* end H5VL_attr_write() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_write_api_op + * + * Purpose: Callback for common API wrapper to write an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_write_api_op(void *_ctx) +{ + H5VL_attr_write_ctx_t *ctx = (H5VL_attr_write_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__attr_write(ctx->obj, ctx->cls, ctx->mem_type_id, ctx->buf, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_write_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_write * * Purpose: Writes data to an attribute @@ -1353,10 +2153,11 @@ herr_t H5VLattr_write(void *obj, hid_t connector_id, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_attr_write_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*xii*xix", obj, connector_id, mem_type_id, buf, dxpl_id, req); /* Check args and get class pointer */ @@ -1365,18 +2166,26 @@ H5VLattr_write(void *obj, hid_t connector_id, hid_t mem_type_id, const void *buf 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") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.mem_type_id = mem_type_id; + ctx.buf = buf; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_write_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_write() */ /*------------------------------------------------------------------------- * Function: H5VL__attr_get * - * Purpose: Get specific information about the attribute through the VOL + * Purpose: Get information about the attribute through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -1405,7 +2214,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_attr_get * - * Purpose: Get specific information about the attribute through the VOL + * Purpose: Get information about the attribute through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -1438,6 +2247,35 @@ done: } /* end H5VL_attr_get() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_get_api_op + * + * Purpose: Callback for common API wrapper to get an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_get_api_op(void *_ctx) +{ + H5VL_attr_get_ctx_t *ctx = (H5VL_attr_get_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__attr_get(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get attribute information") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_get_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_get * * Purpose: Gets information about the attribute @@ -1450,10 +2288,11 @@ done: herr_t H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_attr_get_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -1464,12 +2303,19 @@ H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_args_t *args, hid_t dx if (NULL == args) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument struct") - /* Call the corresponding internal VOL routine */ - if (H5VL__attr_get(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get attribute information") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_get_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_get() */ /*------------------------------------------------------------------------- @@ -1542,6 +2388,34 @@ done: } /* end H5VL_attr_specific() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_specific_api_op + * + * Purpose: Callback for common API wrapper for attribute specific operation + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_specific_api_op(void *_ctx) +{ + H5VL_attr_specific_ctx_t *ctx = (H5VL_attr_specific_ctx_t *)_ctx; /* Get pointer to context */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + /* (Must capture return value from callback, for iterators) */ + ctx->ret_value = + H5VL__attr_specific(ctx->obj, ctx->loc_params, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__attr_specific_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_specific * * Purpose: Performs a connector-specific operation on an attribute @@ -1555,10 +2429,11 @@ herr_t H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_attr_specific_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -1567,13 +2442,25 @@ H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto 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 */ - /* (Must return value from callback, for iterators) */ - if ((ret_value = H5VL__attr_specific(obj, loc_params, cls, args, dxpl_id, req)) < 0) + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = -1; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_specific_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") + + /* Must return value from callback, for iterators */ + if ((ret_value = ctx.ret_value) < 0) HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'specific' callback"); done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_specific() */ /*------------------------------------------------------------------------- @@ -1600,7 +2487,7 @@ H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *ar /* Call the corresponding VOL callback */ /* (Must return value from callback, for iterators) */ if ((ret_value = (cls->attr_cls.optional)(obj, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute optional callback"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'optional' callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1632,7 +2519,7 @@ H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid /* Call the corresponding internal VOL routine */ /* (Must return value from callback, for iterators) */ if ((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute optional callback"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'optional' callback"); done: /* Reset object wrapping info in API context */ @@ -1643,6 +2530,33 @@ done: } /* end H5VL_attr_optional() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_optional_api_op + * + * Purpose: Callback for common API wrapper for attribute optional operation + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_optional_api_op(void *_ctx) +{ + H5VL_attr_optional_ctx_t *ctx = (H5VL_attr_optional_ctx_t *)_ctx; /* Get pointer to context */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + /* (Must capture return value from callback, for iterators) */ + ctx->ret_value = H5VL__attr_optional(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__attr_optional_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_optional * * Purpose: Performs an optional connector-specific operation on an attribute @@ -1656,10 +2570,11 @@ herr_t H5VLattr_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_attr_optional_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -1668,13 +2583,24 @@ H5VLattr_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid 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 */ - /* (Must return value from callback, for iterators) */ - if ((ret_value = H5VL__attr_optional(obj, cls, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute optional callback"); + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = -1; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_optional_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") + + /* Must return value from callback, for iterators */ + if ((ret_value = ctx.ret_value) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'optional' callback"); done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_optional() */ /*------------------------------------------------------------------------- @@ -1706,7 +2632,7 @@ H5VLattr_optional_op(const char *app_file, const char *app_func, unsigned app_li /* Call the common VOL connector optional routine */ if ((ret_value = H5VL__common_optional_op(attr_id, H5I_ATTR, H5VL__attr_optional, args, dxpl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute 'optional' callback") /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1778,6 +2704,35 @@ done: } /* end H5VL_attr_close() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_close_api_op + * + * Purpose: Callback for common API wrapper to close an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_close_api_op(void *_ctx) +{ + H5VL_attr_close_ctx_t *ctx = (H5VL_attr_close_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__attr_close(ctx->obj, ctx->cls, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_close_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_close * * Purpose: Closes an attribute @@ -1790,10 +2745,11 @@ done: herr_t H5VLattr_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_attr_close_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ @@ -1802,12 +2758,18 @@ H5VLattr_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) 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") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_close_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_close() */ /*------------------------------------------------------------------------- @@ -1882,6 +2844,37 @@ done: } /* end H5VL_dataset_create() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_create_api_op + * + * Purpose: Callback for common API wrapper to create a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_create_api_op(void *_ctx) +{ + H5VL_dataset_create_ctx_t *ctx = (H5VL_dataset_create_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = H5VL__dataset_create(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, + ctx->lcpl_id, ctx->type_id, ctx->space_id, + ctx->dcpl_id, ctx->dapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create dataset") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_create_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_create * * Purpose: Creates a dataset @@ -1896,10 +2889,11 @@ H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connect hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_dataset_create_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE11("*x", "*x*#i*siiiiiix", obj, loc_params, connector_id, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req); @@ -1909,13 +2903,29 @@ H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connect 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, lcpl_id, type_id, space_id, - 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) + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.lcpl_id = lcpl_id; + ctx.type_id = type_id; + ctx.space_id = space_id; + ctx.dcpl_id = dcpl_id; + ctx.dapl_id = dapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_create_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; + +done: + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_create() */ /*------------------------------------------------------------------------- @@ -1986,6 +2996,36 @@ done: } /* end H5VL_dataset_open() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_open_api_op + * + * Purpose: Callback for common API wrapper to open a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_open_api_op(void *_ctx) +{ + H5VL_dataset_open_ctx_t *ctx = (H5VL_dataset_open_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = H5VL__dataset_open(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, + ctx->dapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_open_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_open * * Purpose: Opens a dataset @@ -1999,10 +3039,11 @@ 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 /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_dataset_open_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE7("*x", "*x*#i*siix", obj, loc_params, connector_id, name, dapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -2011,12 +3052,25 @@ H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector 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") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.dapl_id = dapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_open_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_open() */ /*------------------------------------------------------------------------- @@ -2087,6 +3141,36 @@ done: } /* end H5VL_dataset_read() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_read_api_op + * + * Purpose: Callback for common API wrapper to read a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_read_api_op(void *_ctx) +{ + H5VL_dataset_read_ctx_t *ctx = (H5VL_dataset_read_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__dataset_read(ctx->obj, ctx->cls, ctx->mem_type_id, ctx->mem_space_id, ctx->file_space_id, + ctx->dxpl_id, ctx->buf, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_read_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_read * * Purpose: Reads data from a dataset @@ -2100,10 +3184,11 @@ 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 dxpl_id, void *buf, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_dataset_read_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE8("e", "*xiiiii*xx", obj, connector_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req); @@ -2113,12 +3198,22 @@ H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_spa 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, dxpl_id, buf, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.mem_type_id = mem_type_id; + ctx.mem_space_id = mem_space_id; + ctx.file_space_id = file_space_id; + ctx.buf = buf; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_read_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_read() */ /*------------------------------------------------------------------------- @@ -2189,6 +3284,36 @@ done: } /* end H5VL_dataset_write() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_write_api_op + * + * Purpose: Callback for common API wrapper to write a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_write_api_op(void *_ctx) +{ + H5VL_dataset_write_ctx_t *ctx = (H5VL_dataset_write_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__dataset_write(ctx->obj, ctx->cls, ctx->mem_type_id, ctx->mem_space_id, ctx->file_space_id, + ctx->dxpl_id, ctx->buf, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_write_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_write * * Purpose: Writes data to a dataset @@ -2202,10 +3327,11 @@ 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 dxpl_id, const void *buf, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_dataset_write_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE8("e", "*xiiiii*xx", obj, connector_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req); @@ -2215,12 +3341,22 @@ H5VLdataset_write(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_sp 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, dxpl_id, buf, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.mem_type_id = mem_type_id; + ctx.mem_space_id = mem_space_id; + ctx.file_space_id = file_space_id; + ctx.buf = buf; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_write_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_write() */ /*------------------------------------------------------------------------- @@ -2289,6 +3425,35 @@ done: } /* end H5VL_dataset_get() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_get_api_op + * + * Purpose: Callback for common API wrapper to get information about a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_get_api_op(void *_ctx) +{ + H5VL_dataset_get_ctx_t *ctx = (H5VL_dataset_get_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__dataset_get(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset 'get' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_get_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_get * * Purpose: Gets information about a dataset @@ -2302,10 +3467,11 @@ herr_t H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_dataset_get_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -2314,12 +3480,19 @@ H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_args_t *args, hi 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, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset get callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_get_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_get() */ /*------------------------------------------------------------------------- @@ -2346,7 +3519,7 @@ H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific /* Call the corresponding VOL callback */ if ((cls->dataset_cls.specific)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset 'specific' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2378,7 +3551,7 @@ H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_args_t /* Call the corresponding internal VOL routine */ if (H5VL__dataset_specific(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset 'specific' callback") done: /* Reset object wrapping info in API context */ @@ -2389,6 +3562,35 @@ done: } /* end H5VL_dataset_specific() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_specific_api_op + * + * Purpose: Callback for common API wrapper to issue specific operations on a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_specific_api_op(void *_ctx) +{ + H5VL_dataset_specific_ctx_t *ctx = (H5VL_dataset_specific_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__dataset_specific(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset 'specific' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_specific_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_specific * * Purpose: Performs a connector-specific operation on a dataset @@ -2402,10 +3604,11 @@ herr_t H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_dataset_specific_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -2414,12 +3617,19 @@ H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_args_t 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, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_specific_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_specific() */ /*------------------------------------------------------------------------- @@ -2446,7 +3656,7 @@ H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t /* Call the corresponding VOL callback */ if ((cls->dataset_cls.optional)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2477,7 +3687,7 @@ H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, /* Call the corresponding internal VOL routine */ if (H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset 'optional' callback") done: /* Reset object wrapping info in API context */ @@ -2488,6 +3698,35 @@ done: } /* end H5VL_dataset_optional() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_optional_api_op + * + * Purpose: Callback for common API wrapper to perform optional operation on a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_optional_api_op(void *_ctx) +{ + H5VL_dataset_optional_ctx_t *ctx = (H5VL_dataset_optional_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__dataset_optional(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset 'optional' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_optional_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_optional * * Purpose: Performs an optional connector-specific operation on a dataset @@ -2501,10 +3740,11 @@ herr_t H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_dataset_optional_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -2513,12 +3753,19 @@ H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *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") - /* Call the corresponding internal VOL routine */ - if (H5VL__dataset_optional(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_optional_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_optional() */ /*------------------------------------------------------------------------- @@ -2550,7 +3797,7 @@ H5VLdataset_optional_op(const char *app_file, const char *app_func, unsigned app /* Call the corresponding internal VOL routine */ if (H5VL__common_optional_op(dset_id, H5I_DATASET, H5VL__dataset_optional, args, dxpl_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset 'optional' callback") /* If a token was created, add the token to the event set */ if (NULL != token) @@ -2639,6 +3886,35 @@ done: } /* end H5VL_dataset_close() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_close_api_op + * + * Purpose: Callback for common API wrapper to close a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_close_api_op(void *_ctx) +{ + H5VL_dataset_close_ctx_t *ctx = (H5VL_dataset_close_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__dataset_close(ctx->obj, ctx->cls, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close dataset") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_close_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_close * * Purpose: Closes a dataset @@ -2651,10 +3927,11 @@ done: herr_t H5VLdataset_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_dataset_close_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ @@ -2663,12 +3940,18 @@ H5VLdataset_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out 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") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_close_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_close() */ /*------------------------------------------------------------------------- @@ -2741,6 +4024,37 @@ done: } /* end H5VL_datatype_commit() */ /*------------------------------------------------------------------------- + * Function: H5VL__datatype_commit_api_op + * + * Purpose: Callback for common API wrapper to create an named datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_commit_api_op(void *_ctx) +{ + H5VL_datatype_commit_ctx_t *ctx = (H5VL_datatype_commit_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = + H5VL__datatype_commit(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, ctx->type_id, + ctx->lcpl_id, ctx->tcpl_id, ctx->tapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to commit datatype") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_commit_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdatatype_commit * * Purpose: Commits a datatype to the file @@ -2755,10 +4069,11 @@ H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_datatype_commit_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE10("*x", "*x*#i*siiiiix", obj, loc_params, connector_id, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); @@ -2768,13 +4083,28 @@ H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec 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") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.type_id = type_id; + ctx.lcpl_id = lcpl_id; + ctx.tcpl_id = tcpl_id; + ctx.tapl_id = tapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__datatype_commit_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_commit() */ /*------------------------------------------------------------------------- @@ -2845,6 +4175,36 @@ done: } /* end H5VL_datatype_open() */ /*------------------------------------------------------------------------- + * Function: H5VL__datatype_open_api_op + * + * Purpose: Callback for common API wrapper to open a named datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_open_api_op(void *_ctx) +{ + H5VL_datatype_open_ctx_t *ctx = (H5VL_datatype_open_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = H5VL__datatype_open(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, + ctx->tapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, FAIL, "unable to open datatype") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_open_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdatatype_open * * Purpose: Opens a named datatype @@ -2858,10 +4218,11 @@ 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 /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_datatype_open_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE7("*x", "*x*#i*siix", obj, loc_params, connector_id, name, tapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -2870,12 +4231,25 @@ H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto 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") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.tapl_id = tapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__datatype_open_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_open() */ /*------------------------------------------------------------------------- @@ -2944,6 +4318,35 @@ done: } /* end H5VL_datatype_get() */ /*------------------------------------------------------------------------- + * Function: H5VL__datatype_get_api_op + * + * Purpose: Callback for common API wrapper to get information about a named datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_get_api_op(void *_ctx) +{ + H5VL_datatype_get_ctx_t *ctx = (H5VL_datatype_get_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__datatype_get(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype 'get' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_get_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdatatype_get * * Purpose: Gets information about the datatype @@ -2957,10 +4360,11 @@ herr_t H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_datatype_get_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -2969,12 +4373,19 @@ H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_args_t *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") - /* Call the corresponding internal VOL routine */ - if (H5VL__datatype_get(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__datatype_get_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_get() */ /*------------------------------------------------------------------------- @@ -3001,7 +4412,7 @@ H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specif /* Call the corresponding VOL callback */ if ((cls->datatype_cls.specific)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype 'specific' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -3033,7 +4444,7 @@ H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_args /* Call the corresponding internal VOL routine */ if (H5VL__datatype_specific(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype 'specific' callback") done: /* Reset object wrapping info in API context */ @@ -3044,6 +4455,35 @@ done: } /* end H5VL_datatype_specific() */ /*------------------------------------------------------------------------- + * Function: H5VL__datatype_specific_api_op + * + * Purpose: Callback for common API wrapper to perform a specific operation on a named datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_specific_api_op(void *_ctx) +{ + H5VL_datatype_specific_ctx_t *ctx = (H5VL_datatype_specific_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__datatype_specific(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype 'specific' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_specific_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdatatype_specific * * Purpose: Performs a connector-specific operation on a datatype @@ -3057,10 +4497,11 @@ herr_t H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_datatype_specific_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -3069,12 +4510,19 @@ H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_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") - /* Call the corresponding internal VOL routine */ - if (H5VL__datatype_specific(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__datatype_specific_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_specific() */ /*------------------------------------------------------------------------- @@ -3101,7 +4549,7 @@ H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t /* Call the corresponding VOL callback */ if ((cls->datatype_cls.optional)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -3132,7 +4580,7 @@ H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, /* Call the corresponding internal VOL routine */ if (H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype 'optional' callback") done: /* Reset object wrapping info in API context */ @@ -3176,7 +4624,7 @@ H5VL_datatype_optional_op(H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hi /* Call the corresponding internal VOL routine */ if (H5VL__datatype_optional((*vol_obj_ptr)->data, (*vol_obj_ptr)->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype 'optional' callback") done: /* Reset object wrapping info in API context */ @@ -3187,6 +4635,35 @@ done: } /* end H5VL_datatype_optional_op() */ /*------------------------------------------------------------------------- + * Function: H5VL__datatype_optional_api_op + * + * Purpose: Callback for common API wrapper to perform an optional operation on a named datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_optional_api_op(void *_ctx) +{ + H5VL_datatype_optional_ctx_t *ctx = (H5VL_datatype_optional_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__datatype_optional(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype 'optional' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_optional_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdatatype_optional * * Purpose: Performs an optional connector-specific operation on a datatype @@ -3200,10 +4677,11 @@ herr_t H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_datatype_optional_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -3212,12 +4690,19 @@ H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *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") - /* Call the corresponding internal VOL routine */ - if (H5VL__datatype_optional(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__datatype_optional_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_optional() */ /*------------------------------------------------------------------------- @@ -3332,6 +4817,35 @@ done: } /* end H5VL_datatype_close() */ /*------------------------------------------------------------------------- + * Function: H5VL__datatype_close_api_op + * + * Purpose: Callback for common API wrapper to close a named datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_close_api_op(void *_ctx) +{ + H5VL_datatype_close_ctx_t *ctx = (H5VL_datatype_close_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__datatype_close(ctx->obj, ctx->cls, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_close_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdatatype_close * * Purpose: Closes a datatype @@ -3344,10 +4858,11 @@ done: herr_t H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_datatype_close_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ @@ -3356,12 +4871,18 @@ H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*ou 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") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__datatype_close_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_close() */ /*------------------------------------------------------------------------- @@ -3405,27 +4926,69 @@ done: * 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 + * Return: Success: A file ID + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ -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) +hid_t +H5VL_file_create(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 */ + H5P_genplist_t * fapl_plist; /* Property list pointer */ + H5VL_class_t * cls; /* VOL class structure for callback info */ + H5VL_object_t * vol_obj = NULL; /* Temporary VOL object for file */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ + void * file = NULL; /* New file created */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI(FAIL) + + /* Get the VOL info from the fapl */ + if (NULL == (fapl_plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") + if (H5P_peek(fapl_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + + /* Stash a copy of the connector property */ + if (H5CX_set_vol_connector_prop(&connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context") /* 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") + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "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") + if (NULL == (file = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "file create failed") + + /* Create a temporary VOL object for the file struct */ + if (NULL == + (vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, file, connector_prop.connector_id, FALSE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "can't create VOL object") + + /* Check for 'post open' callback */ + supported = 0; + if (H5VL__introspect_opt_query(file, cls, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't query optional operation support") + if (supported & H5VL_OPT_QUERY_SUPPORTED) { + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */ + + /* Set up VOL callback arguments */ + file_opt_args.post_open.vol_obj = vol_obj; + file_opt_args.post_open.id_exists = TRUE; + vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN; + vol_cb_args.args = &file_opt_args; + + /* Make the 'post open' callback */ + if (H5VL__file_optional(file, cls, &vol_cb_args, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, H5I_INVALID_HID, "file optional failed") + } /* end if */ + + /* Register ID for VOL object, for future API calls */ + if ((ret_value = H5I_register(H5I_FILE, vol_obj, TRUE)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file ID") done: FUNC_LEAVE_NOAPI(ret_value) @@ -3445,19 +5008,50 @@ void * H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req /*out*/) { - 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 */ + H5P_genplist_t * fapl_plist = NULL; /* FAPL property list pointer */ + H5P_genplist_t * dxpl_plist = NULL; /* DXPL property list pointer */ + H5VL_object_t * vol_obj = NULL; /* Temporary VOL object for file */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_class_t * cls; /* VOL connector's class struct */ + hbool_t new_api_ctx = FALSE; /* Whether to start a new API context */ + hbool_t api_pushed = FALSE; /* Indicate that a new API context was pushed */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE6("*x", "*sIuiiix", 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))) + if (NULL == (fapl_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) 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") + if (H5P_peek(fapl_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't get VOL connector info") + + /* Check for non-default DXPL */ + if (!(H5P_DEFAULT == dxpl_id || H5P_DATASET_XFER_DEFAULT == dxpl_id)) { + /* Check for 'new API context' flag */ + if (NULL == (dxpl_plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a dataset transfer property list") + if (H5P_get(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &new_api_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to get value") + + /* Start a new API context, if requested */ + if (new_api_ctx) { + hbool_t reset_api_ctx = FALSE; /* Flag to reset the 'new API context' */ + + /* Push the API context */ + if (H5CX_push() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set API context") + api_pushed = TRUE; + + /* Reset 'new API context' flag for next layer down */ + if (H5P_set(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &reset_api_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "unable to set value") + + /* Stash a copy of the connector property */ + if (H5CX_set_vol_connector_prop(&connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL connector info in API context") + } /* end if */ + } /* end if */ /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) @@ -3467,8 +5061,53 @@ H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, 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") + /* Attempt 'post open' callback, for new API contexts */ + if (new_api_ctx) { + uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ + + /* Check for 'post open' callback */ + supported = 0; + if (H5VL__introspect_opt_query(ret_value, cls, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, + &supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't query optional operation support") + if (supported & H5VL_OPT_QUERY_SUPPORTED) { + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */ + + /* Create a temporary VOL object for the file struct */ + if (NULL == (vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, ret_value, + connector_prop.connector_id, FALSE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "can't create VOL object") + + /* Set up VOL callback arguments */ + file_opt_args.post_open.vol_obj = vol_obj; + file_opt_args.post_open.id_exists = TRUE; + vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN; + vol_cb_args.args = &file_opt_args; + + /* Make the 'post open' callback */ + if (H5VL__file_optional(ret_value, cls, &vol_cb_args, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "file optional failed") + } /* end if */ + } /* end if */ + done: - FUNC_LEAVE_API_NOINIT(ret_value) + /* Destroy temporary VOL file object */ + if (vol_obj && H5VL_free_object(vol_obj) < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRELEASE, NULL, "unable to free VOL object") + + /* Pop the API context, if it was pushed */ + if (api_pushed) { + hbool_t undo_api_ctx = TRUE; /* Flag to reset the 'new API context' */ + + /* Undo change to 'new API context' flag */ + if (H5P_set(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &undo_api_ctx) < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTSET, NULL, "unable to set value") + + (void)H5CX_pop(FALSE); + } /* end if */ + + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_create() */ /*------------------------------------------------------------------------- @@ -3624,26 +5263,43 @@ done: * 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. + * Return: Success: Pointer to file VOL object * Failure: NULL * *------------------------------------------------------------------------- */ -void * -H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, hid_t fapl_id, - hid_t dxpl_id, void **req) +H5VL_object_t * +H5VL_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req, + hid_t *ret_id /*out*/) { - H5VL_class_t *cls; /* VOL Class structure for callback info */ - void * ret_value = NULL; /* Return value */ + H5P_genplist_t * fapl_plist; /* Property list pointer */ + H5VL_class_t * cls; /* VOL class structure for callback info */ + H5VL_object_t * vol_obj = NULL; /* Temporary VOL object for file */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + void * file = NULL; /* File pointer */ + uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ + H5VL_object_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) + /* Get the VOL info from the fapl */ + if (NULL == (fapl_plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a file access property list") + if (H5P_peek(fapl_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't get VOL connector info") + + /* Stash a copy of the "top-level" connector property, before any pass-through + * connectors modify or unwrap it. + */ + if (H5CX_set_vol_connector_prop(&connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL connector info in API context") + /* 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") + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, 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))) { + if (NULL == (file = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) { hbool_t is_default_conn = TRUE; /* Opening the file failed - Determine whether we should search @@ -3651,13 +5307,13 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned * to attempt to open the file with. This only occurs if the default * VOL connector was used for the initial file open attempt. */ - H5VL__is_default_conn(fapl_id, connector_prop->connector_id, &is_default_conn); + H5VL__is_default_conn(fapl_id, connector_prop.connector_id, &is_default_conn); if (is_default_conn) { H5VL_file_open_find_connector_t find_connector_ud; herr_t iter_ret; - find_connector_ud.connector_prop = connector_prop; + find_connector_ud.connector_prop = &connector_prop; find_connector_ud.filename = name; find_connector_ud.cls = NULL; find_connector_ud.fapl_id = fapl_id; @@ -3676,8 +5332,14 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned */ H5E_clear_stack(NULL); - if (NULL == (ret_value = H5VL__file_open(find_connector_ud.cls, name, flags, - find_connector_ud.fapl_id, dxpl_id, req))) + /* Update the "top-level" connector property, before any pass-through + * connectors modify or unwrap it. + */ + if (H5CX_set_vol_connector_prop(&connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL connector info in API context") + + if (NULL == (file = H5VL__file_open(find_connector_ud.cls, name, flags, + find_connector_ud.fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "can't open file '%s' with VOL connector '%s'", name, find_connector_ud.cls->name) @@ -3689,6 +5351,46 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") } /* end if */ + /* Create a VOL object for the file struct */ + if (NULL == + (vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, file, connector_prop.connector_id, FALSE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "can't create VOL object") + + /* Check for 'post open' callback */ + supported = 0; + if (H5VL__introspect_opt_query(file, cls, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't query optional operation support") + if (supported & H5VL_OPT_QUERY_SUPPORTED) { + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */ + + /* Set up VOL callback arguments */ + file_opt_args.post_open.vol_obj = vol_obj; + file_opt_args.post_open.id_exists = + (ret_id != NULL); /* Set the 'id_exists' flag to TRUE when returning an ID */ + vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN; + vol_cb_args.args = &file_opt_args; + + /* Make the 'post open' callback */ + if (H5VL__file_optional(file, cls, &vol_cb_args, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "file optional failed") + } /* end if */ + + /* Check for registering ID for file */ + if (ret_id) { + hid_t file_id; /* File ID for file pointer */ + + /* Register ID for VOL object, for future API calls */ + if ((file_id = H5I_register(H5I_FILE, vol_obj, TRUE)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, NULL, "unable to register file ID") + + /* Set file ID to return */ + *ret_id = file_id; + } /* end if */ + + /* Set return value */ + ret_value = vol_obj; + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_open() */ @@ -3706,20 +5408,51 @@ done: void * H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req /*out*/) { - 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 */ + H5P_genplist_t * fapl_plist = NULL; /* FAPL property list pointer */ + H5P_genplist_t * dxpl_plist = NULL; /* DXPL property list pointer */ + H5VL_object_t * vol_obj = NULL; /* Temporary VOL object for file */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_class_t * cls; /* VOL connector's class struct */ + hbool_t new_api_ctx = FALSE; /* Whether to start a new API context */ + hbool_t api_pushed = FALSE; /* Indicate that a new API context was pushed */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE5("*x", "*sIuiix", name, flags, fapl_id, dxpl_id, req); /* Get the VOL info from the fapl */ - if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + if (NULL == (fapl_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) 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) + if (H5P_peek(fapl_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info") + /* Check for non-default DXPL */ + if (!(H5P_DEFAULT == dxpl_id || H5P_DATASET_XFER_DEFAULT == dxpl_id)) { + /* Check for 'new API context' flag */ + if (NULL == (dxpl_plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a dataset transfer property list") + if (H5P_get(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &new_api_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to get value") + + /* Start a new API context, if requested */ + if (new_api_ctx) { + hbool_t reset_api_ctx = FALSE; /* Flag to reset the 'new API context' */ + + /* Push the API context */ + if (H5CX_push() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set API context") + api_pushed = TRUE; + + /* Reset 'new API context' flag for next layer down */ + if (H5P_set(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &reset_api_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "unable to set value") + + /* Stash a copy of the connector property */ + if (H5CX_set_vol_connector_prop(&connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL connector info in API context") + } /* end if */ + } /* end if */ + /* 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") @@ -3728,8 +5461,53 @@ H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, vo 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") + /* Attempt 'post open' callback, for new API contexts */ + if (new_api_ctx) { + uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ + + /* Check for 'post open' callback */ + supported = 0; + if (H5VL__introspect_opt_query(ret_value, cls, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, + &supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't query optional operation support") + if (supported & H5VL_OPT_QUERY_SUPPORTED) { + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */ + + /* Create a temporary VOL object for the file struct */ + if (NULL == (vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, ret_value, + connector_prop.connector_id, FALSE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "can't create VOL object") + + /* Set up VOL callback arguments */ + file_opt_args.post_open.vol_obj = vol_obj; + file_opt_args.post_open.id_exists = TRUE; + vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN; + vol_cb_args.args = &file_opt_args; + + /* Make the 'post open' callback */ + if (H5VL__file_optional(ret_value, cls, &vol_cb_args, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "file optional failed") + } /* end if */ + } /* end if */ + done: - FUNC_LEAVE_API_NOINIT(ret_value) + /* Destroy temporary VOL file object */ + if (vol_obj && H5VL_free_object(vol_obj) < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRELEASE, NULL, "unable to free VOL object") + + /* Pop the API context, if it was pushed */ + if (api_pushed) { + hbool_t undo_api_ctx = TRUE; /* Flag to reset the 'new API context' */ + + /* Undo change to 'new API context' flag */ + if (H5P_set(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &undo_api_ctx) < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTSET, NULL, "unable to set value") + + (void)H5CX_pop(FALSE); + } /* end if */ + + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_open() */ /*------------------------------------------------------------------------- @@ -3797,6 +5575,35 @@ done: } /* end H5VL_file_get() */ /*------------------------------------------------------------------------- + * Function: H5VL__file_get_api_op + * + * Purpose: Callback for common API wrapper to get information about a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_get_api_op(void *_ctx) +{ + H5VL_file_get_ctx_t *ctx = (H5VL_file_get_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__file_get(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset 'get' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_get_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLfile_get * * Purpose: Gets information about the file @@ -3809,10 +5616,11 @@ done: herr_t H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_file_get_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -3821,12 +5629,19 @@ H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_args_t *args, hid_t dx 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, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute file get callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__file_get_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_get() */ /*------------------------------------------------------------------------- @@ -3873,6 +5688,7 @@ herr_t H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_args_t *args, hid_t dxpl_id, void **req) { const H5VL_class_t *cls; /* VOL connector's class struct */ + H5VL_object_t * reopen_vol_obj = NULL; /* Temporary VOL object for file */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3920,7 +5736,46 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_args_t *args if (H5VL__file_specific(vol_obj ? vol_obj->data : NULL, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + /* Special treatment of file re-open operation */ + if (args->op_type == H5VL_FILE_REOPEN) { + void * reopen_file; /* Pointer to re-opened file */ + uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ + + /* Get pointer to re-opened file */ + reopen_file = *args->args.reopen.file; + HDassert(reopen_file); + + /* Check for 'post open' callback */ + supported = 0; + if (H5VL__introspect_opt_query(reopen_file, cls, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, + &supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") + if (supported & H5VL_OPT_QUERY_SUPPORTED) { + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */ + + /* Create a temporary VOL object for the file struct */ + if (NULL == (reopen_vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, reopen_file, + vol_obj->connector->id, TRUE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't create VOL object") + + /* Set up VOL callback arguments */ + file_opt_args.post_open.vol_obj = reopen_vol_obj; + file_opt_args.post_open.id_exists = TRUE; + vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN; + vol_cb_args.args = &file_opt_args; + + /* Make the 'post open' callback */ + if (H5VL__file_optional(reopen_file, cls, &vol_cb_args, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") + } /* end if */ + } /* end if */ + done: + /* Destroy temporary VOL file object */ + if (reopen_vol_obj && H5VL_free_object(reopen_vol_obj) < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to free VOL object") + /* 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") @@ -3929,6 +5784,35 @@ done: } /* end H5VL_file_specific() */ /*------------------------------------------------------------------------- + * Function: H5VL__file_specific_api_op + * + * Purpose: Callback for common API wrapper to perform 'specific' operation on a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_specific_api_op(void *_ctx) +{ + H5VL_file_specific_ctx_t *ctx = (H5VL_file_specific_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__file_specific(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file 'specific' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_specific_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLfile_specific * * Purpose: Performs a connector-specific operation on a file @@ -3944,22 +5828,30 @@ herr_t H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_file_specific_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* 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, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file specific callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__file_specific_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_specific() */ /*------------------------------------------------------------------------- @@ -4027,6 +5919,35 @@ done: } /* end H5VL_file_optional() */ /*------------------------------------------------------------------------- + * Function: H5VL__file_optional_api_op + * + * Purpose: Callback for common API wrapper to perform 'optional' operation on a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_optional_api_op(void *_ctx) +{ + H5VL_file_optional_ctx_t *ctx = (H5VL_file_optional_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__file_optional(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file 'optional' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_optional_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLfile_optional * * Purpose: Performs an optional connector-specific operation on a file @@ -4040,10 +5961,11 @@ herr_t H5VLfile_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_file_optional_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -4052,12 +5974,19 @@ H5VLfile_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid 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, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__file_optional_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_optional() */ /*------------------------------------------------------------------------- @@ -4089,7 +6018,7 @@ H5VLfile_optional_op(const char *app_file, const char *app_func, unsigned app_li /* Call the corresponding internal VOL routine */ if (H5VL__common_optional_op(file_id, H5I_FILE, H5VL__file_optional, args, dxpl_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file 'optional' callback") /* If a token was created, add the token to the event set */ if (NULL != token) @@ -4172,6 +6101,35 @@ done: } /* end H5VL_file_close() */ /*------------------------------------------------------------------------- + * Function: H5VL__file_close_api_op + * + * Purpose: Callback for common API wrapper to close a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_close_api_op(void *_ctx) +{ + H5VL_file_close_ctx_t *ctx = (H5VL_file_close_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__file_close(ctx->obj, ctx->cls, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_close_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLfile_close * * Purpose: Closes a file @@ -4184,10 +6142,11 @@ done: herr_t H5VLfile_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_file_close_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ @@ -4196,12 +6155,18 @@ H5VLfile_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) 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") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__file_close_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_close() */ /*------------------------------------------------------------------------- @@ -4273,6 +6238,37 @@ done: } /* end H5VL_group_create() */ /*------------------------------------------------------------------------- + * Function: H5VL__group_create_api_op + * + * Purpose: Callback for common API wrapper to create a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_create_api_op(void *_ctx) +{ + H5VL_group_create_ctx_t *ctx = (H5VL_group_create_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == + (ctx->ret_value = H5VL__group_create(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, ctx->lcpl_id, + ctx->gcpl_id, ctx->gapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create group") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_create_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLgroup_create * * Purpose: Creates a group @@ -4286,10 +6282,11 @@ void * H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_group_create_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE9("*x", "*x*#i*siiiix", obj, loc_params, connector_id, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req); @@ -4299,13 +6296,27 @@ H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector 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, lcpl_id, gcpl_id, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create group") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.lcpl_id = lcpl_id; + ctx.gcpl_id = gcpl_id; + ctx.gapl_id = gapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__group_create_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_create() */ /*------------------------------------------------------------------------- @@ -4376,6 +6387,36 @@ done: } /* end H5VL_group_open() */ /*------------------------------------------------------------------------- + * Function: H5VL__group_open_api_op + * + * Purpose: Callback for common API wrapper to open a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_open_api_op(void *_ctx) +{ + H5VL_group_open_ctx_t *ctx = (H5VL_group_open_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = H5VL__group_open(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, + ctx->gapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, FAIL, "unable to open group") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_open_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLgroup_open * * Purpose: Opens a group @@ -4389,10 +6430,11 @@ 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 /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_group_open_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE7("*x", "*x*#i*siix", obj, loc_params, connector_id, name, gapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -4401,12 +6443,25 @@ H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i 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") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.gapl_id = gapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__group_open_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_open() */ /*------------------------------------------------------------------------- @@ -4474,6 +6529,35 @@ done: } /* end H5VL_group_get() */ /*------------------------------------------------------------------------- + * Function: H5VL__group_get_api_op + * + * Purpose: Callback for common API wrapper to get information about a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_get_api_op(void *_ctx) +{ + H5VL_group_get_ctx_t *ctx = (H5VL_group_get_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__group_get(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group 'get' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_get_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLgroup_get * * Purpose: Gets information about the group @@ -4486,10 +6570,11 @@ done: herr_t H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_group_get_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -4498,12 +6583,19 @@ H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_args_t *args, hid_t 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, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__group_get_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_get() */ /*------------------------------------------------------------------------- @@ -4530,7 +6622,7 @@ H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_arg /* Call the corresponding VOL callback */ if ((cls->group_cls.specific)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group 'specific' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -4561,7 +6653,7 @@ H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_args_t *ar /* Call the corresponding internal VOL routine */ if (H5VL__group_specific(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group 'specific' callback") done: /* Reset object wrapping info in API context */ @@ -4572,6 +6664,35 @@ done: } /* end H5VL_group_specific() */ /*------------------------------------------------------------------------- + * Function: H5VL__group_specific_api_op + * + * Purpose: Callback for common API wrapper to issue specific operations on a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_specific_api_op(void *_ctx) +{ + H5VL_group_specific_ctx_t *ctx = (H5VL_group_specific_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__group_specific(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group 'specific' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_specific_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLgroup_specific * * Purpose: Performs a connector-specific operation on a group @@ -4585,10 +6706,11 @@ herr_t H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_group_specific_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -4597,12 +6719,19 @@ H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_args_t *ar 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, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__group_specific_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_specific() */ /*------------------------------------------------------------------------- @@ -4630,7 +6759,7 @@ H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *a /* Call the corresponding VOL callback */ /* (Must return value from callback, for iterators) */ if ((ret_value = (cls->group_cls.optional)(obj, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group optional callback"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group 'optional' callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4662,7 +6791,7 @@ H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hi /* Call the corresponding internal VOL routine */ /* (Must return value from callback, for iterators) */ if ((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group optional callback"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group 'optional' callback"); done: /* Reset object wrapping info in API context */ @@ -4673,6 +6802,33 @@ done: } /* end H5VL_group_optional() */ /*------------------------------------------------------------------------- + * Function: H5VL__group_optional_api_op + * + * Purpose: Callback for common API wrapper to perform optional operation on a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_optional_api_op(void *_ctx) +{ + H5VL_group_optional_ctx_t *ctx = (H5VL_group_optional_ctx_t *)_ctx; /* Get pointer to context */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + /* (Must capture return value from callback, for iterators) */ + ctx->ret_value = H5VL__group_optional(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__group_optional_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLgroup_optional * * Purpose: Performs an optional connector-specific operation on a group @@ -4686,10 +6842,11 @@ herr_t H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_group_optional_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -4698,13 +6855,24 @@ H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hi 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 */ - /* (Must return value from callback, for iterators) */ - if ((ret_value = H5VL__group_optional(obj, cls, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group optional callback"); + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = -1; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__group_optional_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") + + /* Must return value from callback, for iterators */ + if ((ret_value = ctx.ret_value) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group 'optional' callback"); done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_optional() */ /*------------------------------------------------------------------------- @@ -4736,7 +6904,7 @@ H5VLgroup_optional_op(const char *app_file, const char *app_func, unsigned app_l /* Call the corresponding internal VOL routine */ if ((ret_value = H5VL__common_optional_op(group_id, H5I_GROUP, H5VL__group_optional, args, dxpl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group 'optional' callback") /* If a token was created, add the token to the event set */ if (NULL != token) @@ -4819,6 +6987,35 @@ done: } /* end H5VL_group_close() */ /*------------------------------------------------------------------------- + * Function: H5VL__group_close_api_op + * + * Purpose: Callback for common API wrapper to close a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_close_api_op(void *_ctx) +{ + H5VL_group_close_ctx_t *ctx = (H5VL_group_close_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__group_close(ctx->obj, ctx->cls, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close group") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_close_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLgroup_close * * Purpose: Closes a group @@ -4831,10 +7028,11 @@ done: herr_t H5VLgroup_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_group_close_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ @@ -4843,12 +7041,18 @@ H5VLgroup_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/ 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") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__group_close_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_close() */ /*------------------------------------------------------------------------- @@ -4931,6 +7135,36 @@ done: } /* end H5VL_link_create() */ /*------------------------------------------------------------------------- + * Function: H5VL__link_create_api_op + * + * Purpose: Callback for common API wrapper to create a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_create_api_op(void *_ctx) +{ + H5VL_link_create_ctx_t *ctx = (H5VL_link_create_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__link_create(ctx->args, ctx->obj, ctx->loc_params, ctx->cls, ctx->lcpl_id, ctx->lapl_id, + ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_create_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLlink_create * * Purpose: Creates a link @@ -4946,22 +7180,33 @@ herr_t H5VLlink_create(H5VL_link_create_args_t *args, 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 /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_link_create_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE8("e", "*!*x*#iiiix", args, 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(args, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link") + /* Set up context */ + ctx.args = args; + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.lcpl_id = lcpl_id; + ctx.lapl_id = lapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__link_create_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_create() */ /*------------------------------------------------------------------------- @@ -4975,9 +7220,9 @@ done: *------------------------------------------------------------------------- */ 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) +H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, void *dst_obj, + const H5VL_loc_params_t *dst_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 */ @@ -4988,7 +7233,8 @@ H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_o 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) + if ((cls->link_cls.copy)(src_obj, src_loc_params, dst_obj, dst_loc_params, lcpl_id, lapl_id, dxpl_id, + req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed") done: @@ -5006,8 +7252,8 @@ done: *------------------------------------------------------------------------- */ 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, +H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *src_loc_params, + const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *dst_loc_params, 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 */ @@ -5023,8 +7269,8 @@ H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_pa vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if (H5VL__link_copy(src_vol_obj->data, loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, - vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + if (H5VL__link_copy(src_vol_obj->data, src_loc_params, (dst_vol_obj ? dst_vol_obj->data : NULL), + dst_loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed") done: @@ -5036,6 +7282,36 @@ done: } /* end H5VL_link_copy() */ /*------------------------------------------------------------------------- + * Function: H5VL__link_copy_api_op + * + * Purpose: Callback for common API wrapper to copy a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_copy_api_op(void *_ctx) +{ + H5VL_link_copy_ctx_t *ctx = (H5VL_link_copy_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__link_copy(ctx->src_obj, ctx->src_loc_params, ctx->dst_obj, ctx->dst_loc_params, ctx->cls, + ctx->lcpl_id, ctx->lapl_id, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_copy_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLlink_copy * * Purpose: Copies a link to a new location @@ -5048,27 +7324,39 @@ done: *------------------------------------------------------------------------- */ 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, +H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, void *dst_obj, + const H5VL_loc_params_t *dst_loc_params, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_link_copy_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT - H5TRACE9("e", "*x*#*x*#iiiix", src_obj, loc_params1, dst_obj, loc_params2, connector_id, lcpl_id, lapl_id, - dxpl_id, req); + FUNC_ENTER_API_WRAPPER(FAIL) + H5TRACE9("e", "*x*#*x*#iiiix", src_obj, src_loc_params, dst_obj, dst_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_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") + /* Set up context */ + ctx.src_obj = src_obj; + ctx.src_loc_params = src_loc_params; + ctx.dst_obj = dst_obj; + ctx.dst_loc_params = dst_loc_params; + ctx.cls = cls; + ctx.lcpl_id = lcpl_id; + ctx.lapl_id = lapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__link_copy_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_copy() */ /*------------------------------------------------------------------------- @@ -5082,9 +7370,9 @@ done: *------------------------------------------------------------------------- */ 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) +H5VL__link_move(void *src_obj, const H5VL_loc_params_t *src_loc_params, void *dst_obj, + const H5VL_loc_params_t *dst_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 */ @@ -5095,7 +7383,8 @@ H5VL__link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_o 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) + if ((cls->link_cls.move)(src_obj, src_loc_params, dst_obj, dst_loc_params, lcpl_id, lapl_id, dxpl_id, + req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed") done: @@ -5113,8 +7402,8 @@ done: *------------------------------------------------------------------------- */ 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, +H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *src_loc_params, + const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *dst_loc_params, 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 */ @@ -5130,8 +7419,8 @@ H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_pa vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if (H5VL__link_move(src_vol_obj->data, loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, - vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + if (H5VL__link_move(src_vol_obj->data, src_loc_params, (dst_vol_obj ? dst_vol_obj->data : NULL), + dst_loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed") done: @@ -5143,6 +7432,36 @@ done: } /* end H5VL_link_move() */ /*------------------------------------------------------------------------- + * Function: H5VL__link_move_api_op + * + * Purpose: Callback for common API wrapper to move a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_move_api_op(void *_ctx) +{ + H5VL_link_move_ctx_t *ctx = (H5VL_link_move_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__link_move(ctx->src_obj, ctx->src_loc_params, ctx->dst_obj, ctx->dst_loc_params, ctx->cls, + ctx->lcpl_id, ctx->lapl_id, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "unable to move object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_move_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLlink_move * * Purpose: Moves a link to another location @@ -5155,27 +7474,39 @@ done: *------------------------------------------------------------------------- */ 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, +H5VLlink_move(void *src_obj, const H5VL_loc_params_t *src_loc_params, void *dst_obj, + const H5VL_loc_params_t *dst_loc_params, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_link_move_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT - H5TRACE9("e", "*x*#*x*#iiiix", src_obj, loc_params1, dst_obj, loc_params2, connector_id, lcpl_id, lapl_id, - dxpl_id, req); + FUNC_ENTER_API_WRAPPER(FAIL) + H5TRACE9("e", "*x*#*x*#iiiix", src_obj, src_loc_params, dst_obj, dst_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_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") + /* Set up context */ + ctx.src_obj = src_obj; + ctx.src_loc_params = src_loc_params; + ctx.dst_obj = dst_obj; + ctx.dst_loc_params = dst_loc_params; + ctx.cls = cls; + ctx.lcpl_id = lcpl_id; + ctx.lapl_id = lapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__link_move_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_move() */ /*------------------------------------------------------------------------- @@ -5245,6 +7576,35 @@ done: } /* end H5VL_link_get() */ /*------------------------------------------------------------------------- + * Function: H5VL__link_get_api_op + * + * Purpose: Callback for common API wrapper to get information about a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_get_api_op(void *_ctx) +{ + H5VL_link_get_ctx_t *ctx = (H5VL_link_get_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__link_get(ctx->obj, ctx->loc_params, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link 'get' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_get_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLlink_get * * Purpose: Gets information about a link @@ -5258,10 +7618,11 @@ herr_t H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_link_get_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -5270,12 +7631,20 @@ H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, 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, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__link_get_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_get() */ /*------------------------------------------------------------------------- @@ -5303,7 +7672,7 @@ H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_c /* Call the corresponding VOL callback */ /* (Must return value from callback, for iterators) */ if ((ret_value = (cls->link_cls.specific)(obj, loc_params, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link specific callback"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link 'specific' callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5337,7 +7706,7 @@ H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa /* (Must return value from callback, for iterators) */ if ((ret_value = H5VL__link_specific(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link specific callback"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link 'specific' callback"); done: /* Reset object wrapping info in API context */ @@ -5348,6 +7717,34 @@ done: } /* end H5VL_link_specific() */ /*------------------------------------------------------------------------- + * Function: H5VL__link_specific_api_op + * + * Purpose: Callback for common API wrapper to issue specific operations on a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_specific_api_op(void *_ctx) +{ + H5VL_link_specific_ctx_t *ctx = (H5VL_link_specific_ctx_t *)_ctx; /* Get pointer to context */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + /* (Must capture return value from callback, for iterators) */ + ctx->ret_value = + H5VL__link_specific(ctx->obj, ctx->loc_params, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__link_specific_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLlink_specific * * Purpose: Performs a connector-specific operation on a link @@ -5361,10 +7758,11 @@ herr_t H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_link_specific_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -5373,13 +7771,25 @@ H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto 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 */ - /* (Must return value from callback, for iterators) */ - if ((ret_value = H5VL__link_specific(obj, loc_params, cls, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link specific callback"); + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = -1; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__link_specific_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") + + /* Must return value from callback, for iterators */ + if ((ret_value = ctx.ret_value) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link 'specific' callback"); done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_specific() */ /*------------------------------------------------------------------------- @@ -5406,7 +7816,7 @@ H5VL__link_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_c /* Call the corresponding VOL callback */ if ((cls->link_cls.optional)(obj, loc_params, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5438,7 +7848,7 @@ H5VL_link_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa /* Call the corresponding internal VOL routine */ if (H5VL__link_optional(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link 'optional' callback") done: /* Reset object wrapping info in API context */ @@ -5449,6 +7859,35 @@ done: } /* end H5VL_link_optional() */ /*------------------------------------------------------------------------- + * Function: H5VL__link_optional_api_op + * + * Purpose: Callback for common API wrapper to issue optional operations on a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_optional_api_op(void *_ctx) +{ + H5VL_link_optional_ctx_t *ctx = (H5VL_link_optional_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__link_optional(ctx->obj, ctx->loc_params, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link 'optional' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_optional_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLlink_optional * * Purpose: Performs an optional connector-specific operation on a link @@ -5462,10 +7901,11 @@ herr_t H5VLlink_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_link_optional_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -5474,12 +7914,20 @@ H5VLlink_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto 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, loc_params, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__link_optional_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_optional() */ /*------------------------------------------------------------------------- @@ -5526,7 +7974,7 @@ H5VLlink_optional_op(const char *app_file, const char *app_func, unsigned app_li /* Call the corresponding internal VOL routine */ if (H5VL__link_optional(vol_obj->data, &loc_params, vol_obj->connector->cls, args, dxpl_id, token_ptr) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link 'optional' callback") /* If a token was created, add the token to the event set */ if (NULL != token) @@ -5554,7 +8002,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__object_open(void *obj, const H5VL_loc_params_t *params, const H5VL_class_t *cls, +H5VL__object_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5I_type_t *opened_type, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -5566,7 +8014,7 @@ H5VL__object_open(void *obj, const H5VL_loc_params_t *params, const H5VL_class_t 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))) + if (NULL == (ret_value = (cls->object_cls.open)(obj, loc_params, opened_type, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed") done: @@ -5584,7 +8032,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params, H5I_type_t *opened_type, +H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_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 */ @@ -5598,8 +8046,8 @@ H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params, 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))) + if (NULL == (ret_value = H5VL__object_open(vol_obj->data, loc_params, vol_obj->connector->cls, + opened_type, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed") done: @@ -5611,6 +8059,36 @@ done: } /* end H5VL_object_open() */ /*------------------------------------------------------------------------- + * Function: H5VL__object_open_api_op + * + * Purpose: Callback for common API wrapper to open an object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_open_api_op(void *_ctx) +{ + H5VL_object_open_ctx_t *ctx = (H5VL_object_open_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = H5VL__object_open(ctx->obj, ctx->loc_params, ctx->cls, ctx->opened_type, + ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, FAIL, "unable to open object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_open_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLobject_open * * Purpose: Opens an object @@ -5621,14 +8099,15 @@ done: *------------------------------------------------------------------------- */ void * -H5VLobject_open(void *obj, const H5VL_loc_params_t *params, hid_t connector_id, H5I_type_t *opened_type, +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 /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_object_open_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT - H5TRACE6("*x", "*x*#i*Itix", obj, params, connector_id, opened_type, dxpl_id, req); + FUNC_ENTER_API_WRAPPER(NULL) + H5TRACE6("*x", "*x*#i*Itix", obj, loc_params, connector_id, opened_type, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -5636,12 +8115,24 @@ H5VLobject_open(void *obj, const H5VL_loc_params_t *params, hid_t connector_id, 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") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.opened_type = opened_type; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__object_open_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLobject_open() */ /*------------------------------------------------------------------------- @@ -5720,6 +8211,36 @@ done: } /* end H5VL_object_copy() */ /*------------------------------------------------------------------------- + * Function: H5VL__object_copy_api_op + * + * Purpose: Callback for common API wrapper to copy a object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_copy_api_op(void *_ctx) +{ + H5VL_object_copy_ctx_t *ctx = (H5VL_object_copy_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__object_copy(ctx->src_obj, ctx->src_loc_params, ctx->src_name, ctx->dst_obj, ctx->dst_loc_params, + ctx->dst_name, ctx->cls, ctx->ocpypl_id, ctx->lcpl_id, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_copy_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLobject_copy * * Purpose: Copies an object to another location @@ -5734,10 +8255,11 @@ H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const ch 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 /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_copy_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE11("e", "*x*#*s*x*#*siiiix", src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, connector_id, ocpypl_id, lcpl_id, dxpl_id, req); @@ -5747,13 +8269,25 @@ H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const ch 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) + /* Set up context */ + ctx.src_obj = src_obj; + ctx.src_loc_params = src_loc_params; + ctx.src_name = src_name; + ctx.dst_obj = dst_obj; + ctx.dst_loc_params = dst_loc_params; + ctx.dst_name = dst_name; + ctx.cls = cls; + ctx.ocpypl_id = ocpypl_id; + ctx.lcpl_id = lcpl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__object_copy_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") + +done: + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLobject_copy() */ /*------------------------------------------------------------------------- @@ -5823,6 +8357,35 @@ done: } /* end H5VL_object_get() */ /*------------------------------------------------------------------------- + * Function: H5VL__object_get_api_op + * + * Purpose: Callback for common API wrapper to get information about a object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_get_api_op(void *_ctx) +{ + H5VL_object_get_ctx_t *ctx = (H5VL_object_get_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__object_get(ctx->obj, ctx->loc_params, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object 'get' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_get_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLobject_get * * Purpose: Gets information about an object @@ -5836,10 +8399,11 @@ herr_t H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_get_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_get_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -5848,12 +8412,20 @@ H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i 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, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object get callback") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__object_get_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLobject_get() */ /*------------------------------------------------------------------------- @@ -5926,6 +8498,34 @@ done: } /* end H5VL_object_specific() */ /*------------------------------------------------------------------------- + * Function: H5VL__object_specific_api_op + * + * Purpose: Callback for common API wrapper to issue specific operations on an object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_specific_api_op(void *_ctx) +{ + H5VL_object_specific_ctx_t *ctx = (H5VL_object_specific_ctx_t *)_ctx; /* Get pointer to context */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + /* (Must capture return value from callback, for iterators) */ + ctx->ret_value = + H5VL__object_specific(ctx->obj, ctx->loc_params, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__object_specific_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLobject_specific * * Purpose: Performs a connector-specific operation on an object @@ -5939,10 +8539,11 @@ herr_t H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_specific_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -5951,13 +8552,25 @@ H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec 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") - /* Bypass the H5VLint layer, calling the VOL callback directly */ - /* (Must return value from callback, for iterators) */ - if ((ret_value = (cls->object_cls.specific)(obj, loc_params, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute object specific callback"); + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = -1; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__object_specific_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") + + /* Must return value from callback, for iterators */ + if ((ret_value = ctx.ret_value) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link 'specific' callback"); done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLobject_specific() */ /*------------------------------------------------------------------------- @@ -5984,7 +8597,7 @@ H5VL__object_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL /* Call the corresponding VOL callback */ if ((cls->object_cls.optional)(obj, loc_params, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -6016,7 +8629,7 @@ H5VL_object_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_ /* Call the corresponding internal VOL routine */ if (H5VL__object_optional(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object 'optional' callback") done: /* Reset object wrapping info in API context */ @@ -6027,6 +8640,35 @@ done: } /* end H5VL_object_optional() */ /*------------------------------------------------------------------------- + * Function: H5VL__object_optional_api_op + * + * Purpose: Callback for common API wrapper to issue optional operations on an object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_optional_api_op(void *_ctx) +{ + H5VL_object_optional_ctx_t *ctx = (H5VL_object_optional_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__object_optional(ctx->obj, ctx->loc_params, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object 'optional' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_optional_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLobject_optional * * Purpose: Performs an optional connector-specific operation on an object @@ -6040,10 +8682,11 @@ herr_t H5VLobject_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_optional_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -6052,12 +8695,20 @@ H5VLobject_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec 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, loc_params, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__object_optional_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLobject_optional() */ /*------------------------------------------------------------------------- @@ -6105,7 +8756,7 @@ H5VLobject_optional_op(const char *app_file, const char *app_func, unsigned app_ /* Call the corresponding internal VOL routine */ if (H5VL__object_optional(vol_obj->data, &loc_params, vol_obj->connector->cls, args, dxpl_id, token_ptr) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object 'optional' callback") /* If a token was created, add the token to the event set */ if (NULL != token) @@ -6214,7 +8865,7 @@ H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id, H5VL_get_conn_lvl_t l H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiVLx", obj, connector_id, lvl, conn_cls); /* Check args */ @@ -6232,7 +8883,7 @@ H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id, H5VL_get_conn_lvl_t l HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLintrospect_get_conn_cls() */ /*------------------------------------------------------------------------- @@ -6286,7 +8937,7 @@ H5VLintrospect_get_cap_flags(const void *info, hid_t connector_id, unsigned *cap H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "*xix", info, connector_id, cap_flags); /* Check args */ @@ -6302,7 +8953,7 @@ H5VLintrospect_get_cap_flags(const void *info, hid_t connector_id, unsigned *cap HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector's capability flags") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLintrospect_get_cap_flags() */ /*------------------------------------------------------------------------- @@ -6390,7 +9041,7 @@ H5VLintrospect_opt_query(void *obj, hid_t connector_id, H5VL_subclass_t subcls, H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xiVSIsx", obj, connector_id, subcls, opt_type, flags); /* Get class pointer */ @@ -6402,7 +9053,7 @@ H5VLintrospect_opt_query(void *obj, hid_t connector_id, H5VL_subclass_t subcls, HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLintrospect_opt_query() */ /*------------------------------------------------------------------------- @@ -6483,7 +9134,7 @@ H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5VL_request_s H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiULx", req, connector_id, timeout, status); /* Get class pointer */ @@ -6495,7 +9146,7 @@ H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5VL_request_s HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLrequest_wait() */ /*------------------------------------------------------------------------- @@ -6578,7 +9229,7 @@ H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb, void H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiVN*x", req, connector_id, cb, ctx); /* Get class pointer */ @@ -6590,7 +9241,7 @@ H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb, void HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to register notify callback for request") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLrequest_notify() */ /*------------------------------------------------------------------------- @@ -6670,7 +9321,7 @@ H5VLrequest_cancel(void *req, hid_t connector_id, H5VL_request_status_t *status H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "*xix", req, connector_id, status); /* Get class pointer */ @@ -6682,7 +9333,7 @@ H5VLrequest_cancel(void *req, hid_t connector_id, H5VL_request_status_t *status HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLrequest_cancel() */ /*------------------------------------------------------------------------- @@ -6713,7 +9364,7 @@ H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific /* Call the corresponding VOL callback */ if ((cls->request_cls.specific)(req, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request specific callback") + "unable to execute asynchronous request 'specific' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -6742,7 +9393,7 @@ H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_args_t /* Call the corresponding internal VOL routine */ if (H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request specific callback") + "unable to execute asynchronous request 'specific' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -6764,7 +9415,7 @@ H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_args_t H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "*xi*!", req, connector_id, args); /* Get class pointer */ @@ -6774,10 +9425,10 @@ H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_args_t /* Call the corresponding internal VOL routine */ if (H5VL__request_specific(req, cls, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request specific callback") + "unable to execute asynchronous request 'specific' callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLrequest_specific() */ /*------------------------------------------------------------------------- @@ -6808,7 +9459,7 @@ H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_optional_args_t /* Call the corresponding VOL callback */ if ((cls->request_cls.optional)(req, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request optional callback") + "unable to execute asynchronous request 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -6837,7 +9488,7 @@ H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args) /* Call the corresponding internal VOL routine */ if (H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request optional callback") + "unable to execute asynchronous request 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -6859,7 +9510,7 @@ H5VLrequest_optional(void *req, hid_t connector_id, H5VL_optional_args_t *args) H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "*xi*!", req, connector_id, args); /* Get class pointer */ @@ -6869,10 +9520,10 @@ H5VLrequest_optional(void *req, hid_t connector_id, H5VL_optional_args_t *args) /* Call the corresponding internal VOL routine */ if (H5VL__request_optional(req, cls, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request optional callback") + "unable to execute asynchronous request 'optional' callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLrequest_optional() */ /*------------------------------------------------------------------------- @@ -6906,7 +9557,7 @@ H5VLrequest_optional_op(void *req, hid_t connector_id, H5VL_optional_args_t *arg /* Call the corresponding internal VOL routine */ if (H5VL__request_optional(req, cls, args) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute request optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute request 'optional' callback") done: FUNC_LEAVE_API(ret_value) @@ -6989,7 +9640,7 @@ 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 + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE2("e", "*xi", req, connector_id); /* Get class pointer */ @@ -7001,7 +9652,7 @@ H5VLrequest_free(void *req, hid_t connector_id) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to free request") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLrequest_free() */ /*------------------------------------------------------------------------- @@ -7085,7 +9736,7 @@ H5VLblob_put(void *obj, hid_t connector_id, const void *buf, size_t size, void * H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*xi*xz*x*x", obj, connector_id, buf, size, blob_id, ctx); /* Get class pointer */ @@ -7099,7 +9750,7 @@ H5VLblob_put(void *obj, hid_t connector_id, const void *buf, size_t size, void * HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "blob put failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLblob_put() */ /*------------------------------------------------------------------------- @@ -7180,7 +9831,7 @@ H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf /*out H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*xi*xxz*x", obj, connector_id, blob_id, buf, size, ctx); /* Get class pointer */ @@ -7194,7 +9845,7 @@ H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf /*out HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "blob get failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLblob_get() */ /*------------------------------------------------------------------------- @@ -7227,7 +9878,7 @@ H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob /* Call the corresponding VOL callback */ if ((cls->blob_cls.specific)(obj, blob_id, args) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob 'specific' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -7256,7 +9907,7 @@ H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specif /* Call the corresponding internal VOL routine */ if (H5VL__blob_specific(vol_obj->data, vol_obj->connector->cls, blob_id, args) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob 'specific' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -7277,7 +9928,7 @@ H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specif H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xi*x*!", obj, connector_id, blob_id, args); /* Get class pointer */ @@ -7291,7 +9942,7 @@ H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specif HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob specific operation failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLblob_specific() */ /*------------------------------------------------------------------------- @@ -7324,7 +9975,7 @@ H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_opti /* Call the corresponding VOL callback */ if ((cls->blob_cls.optional)(obj, blob_id, args) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -7353,7 +10004,7 @@ H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_optional_ar /* Call the corresponding internal VOL routine */ if (H5VL__blob_optional(vol_obj->data, vol_obj->connector->cls, blob_id, args) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -7374,7 +10025,7 @@ H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_optional_ar H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xi*x*!", obj, connector_id, blob_id, args); /* Get class pointer */ @@ -7388,7 +10039,7 @@ H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_optional_ar HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob optional operation failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLblob_optional() */ /*------------------------------------------------------------------------- @@ -7496,7 +10147,7 @@ H5VLtoken_cmp(void *obj, hid_t connector_id, const H5O_token_t *token1, const H5 H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*k*k*Is", obj, connector_id, token1, token2, cmp_value); /* Check args and get class pointer */ @@ -7512,7 +10163,7 @@ H5VLtoken_cmp(void *obj, hid_t connector_id, const H5O_token_t *token1, const H5 HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "object token comparison failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLtoken_cmp() */ /*------------------------------------------------------------------------- @@ -7601,7 +10252,7 @@ H5VLtoken_to_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const H5O_t H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xIti*k**s", obj, obj_type, connector_id, token, token_str); /* Check args and get class pointer */ @@ -7619,7 +10270,7 @@ H5VLtoken_to_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const H5O_t HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "object token to string failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLtoken_to_str() */ /*------------------------------------------------------------------------- @@ -7708,7 +10359,7 @@ H5VLtoken_from_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const cha H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xIti*s*k", obj, obj_type, connector_id, token_str, token); /* Check args and get class pointer */ @@ -7726,7 +10377,7 @@ H5VLtoken_from_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const cha HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "object token from string failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLtoken_from_str() */ /*------------------------------------------------------------------------- @@ -7752,7 +10403,7 @@ H5VL__optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, h /* Call the corresponding VOL callback */ if ((ret_value = (cls->optional)(obj, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute generic 'optional' callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7783,7 +10434,7 @@ H5VL_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dx /* Call the corresponding internal VOL routine */ if ((ret_value = H5VL__optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute generic 'optional' callback"); done: /* Reset object wrapping info in API context */ @@ -7809,7 +10460,7 @@ H5VLoptional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dx H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -7820,8 +10471,8 @@ H5VLoptional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dx /* Call the corresponding internal VOL routine */ if ((ret_value = H5VL__optional(obj, cls, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute generic 'optional' callback"); done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLoptional() */ diff --git a/src/H5VLint.c b/src/H5VLint.c index 936614f..a85ce4c 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -913,7 +913,7 @@ done: *------------------------------------------------------------------------- */ H5VL_object_t * -H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id) +H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t wrap_obj) { H5VL_class_t * cls = NULL; /* VOL connector class */ H5VL_t * connector = NULL; /* VOL connector struct */ @@ -936,8 +936,7 @@ H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id) conn_id_incr = TRUE; /* Set up VOL object for the passed-in data */ - /* (Wraps object, since it's a library object) */ - if (NULL == (ret_value = H5VL__new_vol_obj(type, obj, connector, TRUE))) + if (NULL == (ret_value = H5VL__new_vol_obj(type, obj, connector, wrap_obj))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't create VOL object") done: @@ -1037,7 +1036,7 @@ done: * *------------------------------------------------------------------------- */ -hsize_t +size_t H5VL_object_inc_rc(H5VL_object_t *vol_obj) { FUNC_ENTER_NOAPI_NOERR_NOFS @@ -1082,6 +1081,59 @@ done: } /* end H5VL_free_object() */ /*------------------------------------------------------------------------- + * Function: H5VL_fapl_is_native + * + * Purpose: Query if a FAPL will use the native VOL connector. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * Jun 17, 2021 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_fapl_is_native(hid_t fapl_id, hbool_t *is_native) +{ + H5P_genplist_t * fapl_plist; /* Property list pointer */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_class_t * cls; /* VOL class structure for callback info */ + const H5VL_class_t * native_cls; /* Native VOL connector class structs */ + int cmp_value; /* Comparison result */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check for default property list value */ + if (H5P_DEFAULT == fapl_id) + fapl_id = H5P_FILE_ACCESS_DEFAULT; + + /* Get the VOL info from the fapl */ + if (NULL == (fapl_plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list") + if (H5P_peek(fapl_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info") + + /* Get the connector's class */ + 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") + + /* Retrieve the native connector class */ + if (NULL == (native_cls = (H5VL_class_t *)H5I_object_verify(H5VL_NATIVE, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve native VOL connector class") + + /* Compare connector classes */ + if (H5VL_cmp_connector_cls(&cmp_value, cls, native_cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + + /* If classes compare equal, then the object is / is in a native connector's file */ + *is_native = (cmp_value == 0); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_fapl_is_native() */ + +/*------------------------------------------------------------------------- * Function: H5VL_object_is_native * * Purpose: Query if an object is (if it's a file object) / is in (if its @@ -1095,7 +1147,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_is_native(const H5VL_object_t *obj, hbool_t *is_native) +H5VL_object_is_native(const H5VL_object_t *obj, H5VL_get_conn_lvl_t lvl, hbool_t *is_native) { const H5VL_class_t *cls; /* VOL connector class structs for object */ const H5VL_class_t *native_cls; /* Native VOL connector class structs */ @@ -1110,7 +1162,7 @@ H5VL_object_is_native(const H5VL_object_t *obj, hbool_t *is_native) /* Retrieve the terminal connector class for the object */ cls = NULL; - if (H5VL_introspect_get_conn_cls(obj, H5VL_GET_CONN_LVL_TERM, &cls) < 0) + if (H5VL_introspect_get_conn_cls(obj, lvl, &cls) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class") /* Retrieve the native connector class */ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 18b5b9c..bdac930 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -385,7 +385,7 @@ H5VLnative_addr_to_token(hid_t loc_id, haddr_t addr, H5O_token_t *token) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Make sure that the VOL object is a native connector object */ - if (H5VL_object_is_native(vol_obj_container, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj_container, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") @@ -479,7 +479,7 @@ H5VLnative_token_to_addr(hid_t loc_id, H5O_token_t token, haddr_t *addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Make sure that the VOL object is a native connector object */ - if (H5VL_object_is_native(vol_obj_container, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj_container, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") diff --git a/src/H5VLnative.h b/src/H5VLnative.h index fe8ede2..42dc7bd 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -281,6 +281,12 @@ typedef struct H5VL_native_file_set_libver_bounds_t { H5F_libver_t high; /* Highest version possible */ } H5VL_native_file_set_libver_bounds_t; +/* Parameters for native connector's file 'post open' operation */ +typedef struct H5VL_native_file_post_open_t { + void * vol_obj; /* VOL object for "top" file object */ + hbool_t id_exists; /* Whether an ID (will) exists for this file */ +} H5VL_native_file_post_open_t; + /* Parameters for native connector's file 'optional' operations */ typedef union H5VL_native_file_optional_args_t { /* H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE */ @@ -392,7 +398,7 @@ typedef union H5VL_native_file_optional_args_t { #endif /* H5_HAVE_PARALLEL */ /* H5VL_NATIVE_FILE_POST_OPEN */ - /* No args */ + H5VL_native_file_post_open_t post_open; } H5VL_native_file_optional_args_t; /* Values for native VOL connector group optional VOL operations */ diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index 1e674dc..64e18e9 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -92,7 +92,6 @@ H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t /* 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; @@ -126,7 +125,6 @@ H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t H5 /* 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; @@ -719,7 +717,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* Finalize H5Fopen */ case H5VL_NATIVE_FILE_POST_OPEN: { /* Call package routine */ - if (H5F__post_open(f) < 0) + if (H5F__post_open(f, opt_args->post_open.vol_obj, opt_args->post_open.id_exists) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't finish opening file") break; } @@ -752,15 +750,12 @@ H5VL__native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_U 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)) { + if (H5F_ID_EXISTS(f) && (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_ID, H5E_CANTGET, FAIL, "invalid ID") diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index f929d03..65ef37c 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -97,12 +97,14 @@ H5_DLL void *H5VL_object_unwrap(const H5VL_object_t *vol_obj); 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 H5VL_object_t *H5VL_create_object(void *object, H5VL_t *vol_connector); -H5_DLL H5VL_object_t *H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id); -H5_DLL hsize_t H5VL_object_inc_rc(H5VL_object_t *obj); +H5_DLL H5VL_object_t *H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, + hbool_t wrap_obj); +H5_DLL size_t H5VL_object_inc_rc(H5VL_object_t *obj); H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj); -H5_DLL herr_t H5VL_object_is_native(const H5VL_object_t *obj, hbool_t *is_native); -H5_DLL herr_t H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2, - hbool_t *same_file); +H5_DLL herr_t H5VL_fapl_is_native(hid_t fapl_id, hbool_t *is_native); +H5_DLL herr_t H5VL_object_is_native(const H5VL_object_t *obj, H5VL_get_conn_lvl_t lvl, hbool_t *is_native); +H5_DLL herr_t H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2, + hbool_t *same_file); /* Functions that wrap / unwrap VOL objects */ H5_DLL herr_t H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, void **wrap_ctx); @@ -206,12 +208,12 @@ H5_DLL herr_t H5VL_datatype_optional_op(H5VL_object_t *vol_obj, H5VL_optional_ar H5_DLL herr_t H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* File functions */ -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(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_args_t *args, hid_t dxpl_id, - void **req); +H5_DLL hid_t H5VL_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, + void **req); +H5_DLL H5VL_object_t *H5VL_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, + void **req, hid_t *ret_id); +H5_DLL herr_t H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_args_t *args, hid_t dxpl_id, + void **req); H5_DLL herr_t H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_args_t *args, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, @@ -236,11 +238,11 @@ H5_DLL herr_t H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void H5_DLL herr_t H5VL_link_create(H5VL_link_create_args_t *args, 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, +H5_DLL herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *src_loc_params, + const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *dst_loc_params, 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, +H5_DLL herr_t H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *src_loc_params, + const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *dst_loc_params, 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_args_t *args, hid_t dxpl_id, void **req); @@ -250,7 +252,7 @@ H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, const H5VL_loc_pa H5VL_optional_args_t *args, hid_t dxpl_id, void **req); /* Object functions */ -H5_DLL void * H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params, +H5_DLL void * H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_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, diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 78e39e3..92e0dee 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -357,6 +357,18 @@ H5_DLL herr_t H5VLunregister_connector(hid_t connector_id); */ H5_DLL herr_t H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, uint64_t *flags); +/** + * \ingroup H5VL + * \brief Determine if a fapl is set to use the native VOL connector. + * + * \fapl_id + * \param[out] is_native Whether the fapl uses the native VOL connector. + * \return \herr_t + * + * \since 1.13.0 + */ +H5_DLL herr_t H5VLfapl_is_native(hid_t fapl_id, hbool_t *is_native); + #ifdef __cplusplus } #endif diff --git a/src/H5VLtest.c b/src/H5VLtest.c index 1f99ce5..998ec8d 100644 --- a/src/H5VLtest.c +++ b/src/H5VLtest.c @@ -31,9 +31,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5VLpkg.h" /* Virtual Object Layer */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5VLpkg.h" /* Virtual Object Layer */ /****************/ /* Local Macros */ diff --git a/src/H5private.h b/src/H5private.h index 2318f10..950ad6dc 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2046,6 +2046,7 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ /* Forward declaration of H5CXpush() / H5CXpop() */ /* (Including H5CXprivate.h creates bad circular dependencies - QAK, 3/18/2018) */ H5_DLL herr_t H5CX_push(void); +H5_DLL herr_t H5CX_test_and_push(hbool_t *pushed); H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); #ifndef NDEBUG @@ -2210,6 +2211,28 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); FUNC_ENTER_COMMON_NOERR(H5_IS_API(__func__)); \ { +/* + * Use this macro for public API functions for the various "plugin" wrappers. + * Examples are: public VOL callback wrappers (e.g. H5VLfile_create, + * H5VLdataset_read, etc.), public VFD callback wrappers (e.g. H5FDopen, + * H5FDread, etc.), etc. + * + */ +#define FUNC_ENTER_API_WRAPPER(err) \ + { \ + { \ + { \ + hbool_t pushed = FALSE; \ + \ + FUNC_ENTER_API_COMMON \ + H5_PUSH_FUNC \ + /* Push an API context, if there isn't already one */ \ + if (H5CX_test_and_push(&pushed) < 0) \ + HGOTO_ERROR(H5E_FUNC, H5E_CANTSET, err, "can't set API context") \ + \ + BEGIN_MPE_LOG \ + { + /* Note: this macro only works when there's _no_ interface initialization routine for the module */ #define FUNC_ENTER_NOAPI_INIT(err) \ /* Initialize the package, if appropriate */ \ @@ -2474,6 +2497,22 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); } \ } /*end scope from beginning of FUNC_ENTER*/ +/* Use this macro to match the FUNC_ENTER_API_WRAPPER macro */ +#define FUNC_LEAVE_API_WRAPPER(ret_value) \ + ; \ + } \ + FUNC_LEAVE_API_COMMON(ret_value); \ + if (pushed) \ + (void)H5CX_pop(TRUE); \ + H5_POP_FUNC \ + if (err_occurred) \ + (void)H5E_dump_api_stack(TRUE); \ + FUNC_LEAVE_API_THREADSAFE \ + return (ret_value); \ + } \ + } \ + } /*end scope from beginning of FUNC_ENTER*/ + #define FUNC_LEAVE_NOAPI(ret_value) \ ; \ } /*end scope from end of FUNC_ENTER*/ \ diff --git a/src/Makefile.am b/src/Makefile.am index ce6e3b1..c0a98ce 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -157,7 +157,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers # Public component author headers include_HEADERS += H5ESdevelop.h H5FDdevelop.h H5Idevelop.h H5Ldevelop.h \ - H5Tdevelop.h H5TSdevelop.h H5Zdevelop.h + H5Pdevelop.h H5Tdevelop.h H5TSdevelop.h H5Zdevelop.h # install libhdf5.settings in lib directory settingsdir=$(libdir) @@ -46,6 +46,7 @@ #include "H5FDdevelop.h" /* File drivers */ #include "H5Idevelop.h" /* ID management */ #include "H5Ldevelop.h" /* Links */ +#include "H5Pdevelop.h" /* Plugins */ #include "H5Tdevelop.h" /* Datatypes */ #include "H5TSdevelop.h" /* Threadsafety */ #include "H5Zdevelop.h" /* Data filters */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4e543fd..8afa7c4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -555,8 +555,8 @@ if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TEST_thread_id_FORMAT thread_id) endif () -if (HDF5_BUILD_UTILS) # requires mirror server - #-- Adding test for mirror_vfd +if (HDF5_BUILD_UTILS) + #-- Adding test for mirror_vfd (requires mirror server) add_executable (mirror_vfd ${mirror_vfd_SOURCES}) target_include_directories (mirror_vfd PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) diff --git a/test/Makefile.am b/test/Makefile.am index ff09003..57f89b0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -223,7 +223,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse test_swmr*.h5 cache_logging.h5 cache_logging.out vds_swmr.h5 vds_swmr_src_*.h5 \ swmr[0-2].h5 swmr_writer.out swmr_writer.log.* swmr_reader.out.* swmr_reader.log.* \ tbogus.h5.copy cache_image_test.h5 direct_chunk.h5 native_vol_test.h5 \ - splitter*.h5 splitter.log mirror_rw mirror_ro event_set_[0-9].h5 + splitter*.h5 splitter.log mirror_rw mirror_ro event_set_[0-9].h5 vol_public.h5 # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ diff --git a/test/cache_tagging.c b/test/cache_tagging.c index b69a501..fce0bf5 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -4288,10 +4288,11 @@ check_external_link_open_tags(void) hid_t gid = -1; /* Dataspace Identifier */ hid_t xid = -1; /* Dataspace Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ -#endif /* NDEBUG */ - H5O_native_info_t ninfo; /* Native object info struct */ - hid_t fapl = -1; /* File access prop list */ + int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ + H5O_native_info_t ninfo; /* Native object info struct */ + hid_t fapl = -1; /* File access prop list */ + hbool_t is_native; /* Whether the native VOL connector is being used */ haddr_t root_tag = 0; haddr_t root2_tag = 0; @@ -4306,9 +4307,14 @@ check_external_link_open_tags(void) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + if (H5VL_fapl_is_native(fapl, &is_native) < 0) + TEST_ERROR; + /* Create a test file */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR; + FAIL_STACK_ERROR; /* determine tag value of root group's object header */ if (get_object_header_tag(fid, &root_tag) < 0) @@ -4316,7 +4322,7 @@ check_external_link_open_tags(void) /* Create a second file */ if ((fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR; + FAIL_STACK_ERROR; /* determine tag value of root group's object header */ if (get_object_header_tag(fid2, &root2_tag) < 0) @@ -4324,26 +4330,26 @@ check_external_link_open_tags(void) /* Create group in second file */ if ((gid = H5Gcreate2(fid2, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR; + FAIL_STACK_ERROR; /* Close out second file */ if ((H5Gclose(gid)) < 0) - TEST_ERROR; + FAIL_STACK_ERROR; if ((H5Fclose(fid2)) < 0) - TEST_ERROR; + FAIL_STACK_ERROR; /* Create external link to second file */ if (H5Lcreate_external(FILENAME2, GROUPNAMEPATH, fid, LINKNAME, H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR; + FAIL_STACK_ERROR; /* Close and Reopen the file */ if (H5Fclose(fid) < 0) - TEST_ERROR; + FAIL_STACK_ERROR; if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl)) < 0) - TEST_ERROR; + FAIL_STACK_ERROR; if (H5Pclose(fapl) < 0) - TEST_ERROR; + FAIL_STACK_ERROR; /* Evict as much as we can from the cache so we can track full tag path */ if (evict_entries(fid) < 0) @@ -4353,78 +4359,95 @@ check_external_link_open_tags(void) /* Open External Link */ /* ================== */ - if ((xid = H5Gopen2(fid, LINKNAME, H5P_DEFAULT)) < 0) - TEST_ERROR; - if ((fid2 = H5Iget_file_id(xid)) < 0) - TEST_ERROR; - if (get_object_header_tag(xid, &link_tag) < 0) - TEST_ERROR; + H5E_BEGIN_TRY + { + xid = H5Gopen2(fid, LINKNAME, H5P_DEFAULT); + } + H5E_END_TRY + if (is_native) { + if (xid < 0) + FAIL_STACK_ERROR; + if ((fid2 = H5Iget_file_id(xid)) < 0) + FAIL_STACK_ERROR; + if (get_object_header_tag(xid, &link_tag) < 0) + TEST_ERROR; - /* Even though we do nothing with this, touching the internal - * data structures is needed for the test to pass. - */ - if (H5Oget_native_info(xid, &ninfo, H5O_NATIVE_INFO_ALL) < 0) - TEST_ERROR; + /* Even though we do nothing with this, touching the internal + * data structures is needed for the test to pass. + */ + if (H5Oget_native_info(xid, &ninfo, H5O_NATIVE_INFO_ALL) < 0) + FAIL_STACK_ERROR; - /* =================================== */ - /* Verification of Metadata Tag Values */ - /* =================================== */ + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ #ifndef NDEBUG - /* if verbose, print cache index to screen for visual verification */ - if (verbose) - dump_cache(fid); + /* if verbose, print cache index to screen for visual verification */ + if (verbose) + dump_cache(fid); #endif /* NDEBUG */ /* end debugging functions */ - /* verify tag value of first file's root group */ - if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0) - TEST_ERROR; - if (verify_tag(fid, H5AC_OHDR_CHK_ID, root_tag) < 0) - TEST_ERROR; + /* verify tag value of first file's root group */ + if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0) + TEST_ERROR; + if (verify_tag(fid, H5AC_OHDR_CHK_ID, root_tag) < 0) + TEST_ERROR; - /* verify there is a superblock entry with superblock tag. */ - if (verify_tag(fid2, H5AC_SUPERBLOCK_ID, H5AC__SUPERBLOCK_TAG) < 0) - TEST_ERROR; + /* verify there is a superblock entry with superblock tag. */ + if (verify_tag(fid2, H5AC_SUPERBLOCK_ID, H5AC__SUPERBLOCK_TAG) < 0) + TEST_ERROR; - /* verify tag value of linked file's root group */ - if (verify_tag(fid2, H5AC_OHDR_ID, root2_tag) < 0) - TEST_ERROR; - if (verify_tag(fid2, H5AC_LHEAP_PRFX_ID, root2_tag) < 0) - TEST_ERROR; - if (verify_tag(fid2, H5AC_BT_ID, root2_tag) < 0) - TEST_ERROR; - if (verify_tag(fid2, H5AC_SNODE_ID, root2_tag) < 0) - TEST_ERROR; + /* verify tag value of linked file's root group */ + if (verify_tag(fid2, H5AC_OHDR_ID, root2_tag) < 0) + TEST_ERROR; + if (verify_tag(fid2, H5AC_LHEAP_PRFX_ID, root2_tag) < 0) + TEST_ERROR; + if (verify_tag(fid2, H5AC_BT_ID, root2_tag) < 0) + TEST_ERROR; + if (verify_tag(fid2, H5AC_SNODE_ID, root2_tag) < 0) + TEST_ERROR; - /* verify tag value of linked group's object header */ - if (verify_tag(fid2, H5AC_OHDR_ID, link_tag) < 0) - TEST_ERROR; - if (verify_tag(fid2, H5AC_LHEAP_PRFX_ID, link_tag) < 0) - TEST_ERROR; - if (verify_tag(fid2, H5AC_BT_ID, link_tag) < 0) - TEST_ERROR; + /* verify tag value of linked group's object header */ + if (verify_tag(fid2, H5AC_OHDR_ID, link_tag) < 0) + TEST_ERROR; + if (verify_tag(fid2, H5AC_LHEAP_PRFX_ID, link_tag) < 0) + TEST_ERROR; + if (verify_tag(fid2, H5AC_BT_ID, link_tag) < 0) + TEST_ERROR; - /* verify no other entries present */ - if (verify_no_unknown_tags(fid) < 0) - TEST_ERROR; - if (verify_no_unknown_tags(fid2) < 0) - TEST_ERROR; + /* verify no other entries present */ + if (verify_no_unknown_tags(fid) < 0) + TEST_ERROR; + if (verify_no_unknown_tags(fid2) < 0) + TEST_ERROR; - /* Reset the changes we've made to the cache's data structures */ - if (reset_all_entries_investigated(fid) < 0) - TEST_ERROR; - if (reset_all_entries_investigated(fid2) < 0) - TEST_ERROR; + /* Reset the changes we've made to the cache's data structures */ + if (reset_all_entries_investigated(fid) < 0) + TEST_ERROR; + if (reset_all_entries_investigated(fid2) < 0) + TEST_ERROR; - /* =========================== */ - /* Close open objects and file */ - /* =========================== */ - if (H5Gclose(xid) < 0) + /* ================== */ + /* Close open objects */ + /* ================== */ + if (H5Gclose(xid) < 0) + FAIL_STACK_ERROR; + + /* ========== */ + /* Close file */ + /* ========== */ + if (H5Fclose(fid2) < 0) + FAIL_STACK_ERROR; + } + else if (xid >= 0) TEST_ERROR; + + /* ========== */ + /* Close file */ + /* ========== */ if (H5Fclose(fid) < 0) - TEST_ERROR; - if (H5Fclose(fid2) < 0) - TEST_ERROR; + FAIL_STACK_ERROR; /* ========================================== */ /* Finished Test. Print status and return. */ @@ -33,11 +33,6 @@ const char *FILENAME[] = {"efc0", "efc1", "efc2", "efc3", "efc4", "efc5", NULL}; #define N_FILENAMES 6 static char *filename[N_FILENAMES]; -/* Global property lists - just copies of the defaults (necessary to use - * internal functions */ -hid_t fcpl_id = H5I_INVALID_HID; -hid_t fapl_id = H5I_INVALID_HID; - /*------------------------------------------------------------------------- * Function: test_single * @@ -52,7 +47,7 @@ hid_t fapl_id = H5I_INVALID_HID; *------------------------------------------------------------------------- */ static unsigned -test_single(void) +test_single(hid_t fapl_id, hid_t fcpl_id) { H5F_t *f0 = NULL; /* Parent file containing EFC */ H5F_t *f1 = NULL; /* Child file */ @@ -84,8 +79,7 @@ test_single(void) * count = 2, release EFC, verify ref count = 1. Verifies a file can be * held open by the EFC. */ - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR @@ -103,13 +97,12 @@ test_single(void) /* Test 2: Verify that subsequent efc_open requests return the cached top * level file pointer. Open file 1 through EFC, close, open again, verify * file pointers are the same. */ - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR ftmp1 = f1; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR - if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (f1 != ftmp1) TEST_ERROR @@ -124,8 +117,7 @@ test_single(void) * that the one added first is evicted. Then reopen files in a different * order. Open each file normally after closing through EFC the first time * to track ref counts. */ - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR @@ -134,8 +126,7 @@ test_single(void) if (f1->shared->nrefs != 2) TEST_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, f2) < 0) FAIL_STACK_ERROR @@ -146,8 +137,7 @@ test_single(void) if (f2->shared->nrefs != 2) TEST_ERROR - if (NULL == - (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, f3) < 0) FAIL_STACK_ERROR @@ -160,8 +150,7 @@ test_single(void) if (f3->shared->nrefs != 2) TEST_ERROR - if (NULL == - (f4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, f4) < 0) FAIL_STACK_ERROR @@ -176,7 +165,7 @@ test_single(void) if (f4->shared->nrefs != 2) TEST_ERROR - if (NULL == (ftmp3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, ftmp3) < 0) FAIL_STACK_ERROR @@ -189,7 +178,7 @@ test_single(void) if (f4->shared->nrefs != 2) TEST_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, ftmp2) < 0) FAIL_STACK_ERROR @@ -202,7 +191,7 @@ test_single(void) if (f4->shared->nrefs != 2) TEST_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, ftmp1) < 0) FAIL_STACK_ERROR @@ -215,7 +204,7 @@ test_single(void) if (f4->shared->nrefs != 1) TEST_ERROR - if (NULL == (ftmp4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, ftmp4) < 0) FAIL_STACK_ERROR @@ -249,8 +238,7 @@ test_single(void) /* Test 4: Verify that files kept open through the EFC are not evicted by * H5F__efc_release(). */ - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR @@ -275,8 +263,7 @@ test_single(void) * filling up the cache. Open 4 files while holding the first open. Verify * that the second file is evicted. Close the first file, reopen the * second, and verify that the first file is evicted. */ - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR @@ -285,8 +272,7 @@ test_single(void) if (ftmp1->shared->nrefs != 2) TEST_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, f2) < 0) FAIL_STACK_ERROR @@ -295,16 +281,14 @@ test_single(void) if (ftmp2->shared->nrefs != 2) TEST_ERROR - if (NULL == - (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, f3) < 0) FAIL_STACK_ERROR if (ftmp2->shared->nrefs != 2) TEST_ERROR - if (NULL == - (f4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, f4) < 0) FAIL_STACK_ERROR @@ -317,7 +301,7 @@ test_single(void) FAIL_STACK_ERROR if (ftmp1->shared->nrefs != 2) TEST_ERROR - if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, f2) < 0) FAIL_STACK_ERROR @@ -325,7 +309,7 @@ test_single(void) TEST_ERROR if (ftmp2->shared->nrefs != 2) TEST_ERROR - if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR @@ -349,8 +333,7 @@ test_single(void) * prevents further files from being cached. Open and hold open 3 files * through the EFC, then open the fourth and verify that it was not added to * the EFC. */ - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR @@ -359,8 +342,7 @@ test_single(void) if (ftmp1->shared->nrefs != 2) TEST_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR @@ -369,8 +351,7 @@ test_single(void) if (ftmp2->shared->nrefs != 2) TEST_ERROR - if (NULL == - (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR @@ -379,8 +360,7 @@ test_single(void) if (ftmp3->shared->nrefs != 2) TEST_ERROR - if (NULL == - (f4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, f4) < 0) FAIL_STACK_ERROR @@ -422,11 +402,9 @@ test_single(void) /* Test 7: Test multiple file opens. Open a file twice, close it once, then * verify that it is not evicted by H5F__efc_release(). */ - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR @@ -476,7 +454,7 @@ error: *------------------------------------------------------------------------- */ static unsigned -test_graph_nocycle(void) +test_graph_nocycle(hid_t fapl_id, hid_t fcpl_id) { H5F_t *f0 = NULL; /* Parent file containing EFC */ H5F_t *f1 = NULL; /* Child file */ @@ -504,11 +482,9 @@ test_graph_nocycle(void) */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, f2) < 0) FAIL_STACK_ERROR @@ -532,10 +508,10 @@ test_graph_nocycle(void) if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == (f2 = H5F__efc_open(ftmp1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, - fapl_id))) + if (NULL == + (f2 = H5F__efc_open(ftmp1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_try_close(ftmp1, NULL) < 0) FAIL_STACK_ERROR @@ -562,11 +538,9 @@ test_graph_nocycle(void) if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, f2) < 0) FAIL_STACK_ERROR @@ -577,11 +551,9 @@ test_graph_nocycle(void) if (ftmp2->shared->nrefs != 2) TEST_ERROR - if (NULL == - (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f4 = H5F__efc_open(f3, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f4 = H5F__efc_open(f3, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, f4) < 0) FAIL_STACK_ERROR @@ -614,13 +586,11 @@ test_graph_nocycle(void) FAIL_STACK_ERROR if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, f3) < 0) FAIL_STACK_ERROR @@ -638,7 +608,7 @@ test_graph_nocycle(void) if (ftmp3->shared->nrefs != 2) TEST_ERROR - if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, f2) < 0) FAIL_STACK_ERROR @@ -664,18 +634,15 @@ test_graph_nocycle(void) * files. */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, f3) < 0) FAIL_STACK_ERROR - if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, f3) < 0) FAIL_STACK_ERROR @@ -703,25 +670,21 @@ test_graph_nocycle(void) * files. */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, f4) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f0, f3) < 0) FAIL_STACK_ERROR - if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR - if (NULL == (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, f4) < 0) FAIL_STACK_ERROR @@ -729,15 +692,15 @@ test_graph_nocycle(void) FAIL_STACK_ERROR if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR - if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR - if (NULL == (f4 = H5F__efc_open(f2, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f4 = H5F__efc_open(f2, filename[4], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, f4) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f0, f2) < 0) FAIL_STACK_ERROR - if (NULL == (f4 = H5F__efc_open(f3, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f4 = H5F__efc_open(f3, filename[4], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, f4) < 0) FAIL_STACK_ERROR @@ -799,7 +762,7 @@ error: *------------------------------------------------------------------------- */ static unsigned -test_graph_cycle(void) +test_graph_cycle(hid_t fapl_id, hid_t fcpl_id) { H5F_t *f0 = NULL; /* File */ H5F_t *f1 = NULL; /* File */ @@ -826,7 +789,7 @@ test_graph_cycle(void) */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, ftmp0) < 0) FAIL_STACK_ERROR @@ -837,7 +800,7 @@ test_graph_cycle(void) if (f0->shared->nrefs != 1) TEST_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, ftmp0) < 0) FAIL_STACK_ERROR @@ -857,10 +820,9 @@ test_graph_cycle(void) * the file is part of another file's EFC. */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp1) < 0) FAIL_STACK_ERROR @@ -877,10 +839,9 @@ test_graph_cycle(void) if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp1) < 0) FAIL_STACK_ERROR @@ -900,10 +861,9 @@ test_graph_cycle(void) /* Test 3: Simple 2 file cycle */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR @@ -916,10 +876,9 @@ test_graph_cycle(void) if (f0->shared->nrefs != 1) TEST_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR @@ -939,13 +898,11 @@ test_graph_cycle(void) /* Test 4: Simple 2 file cycle (indirectly referenced) */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp1) < 0) FAIL_STACK_ERROR @@ -967,19 +924,17 @@ test_graph_cycle(void) /* Test 5: Parallel double cycle */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp0) < 0) FAIL_STACK_ERROR @@ -999,19 +954,17 @@ test_graph_cycle(void) /* Test 6: Parallel double cycle with release */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp0) < 0) FAIL_STACK_ERROR @@ -1029,24 +982,21 @@ test_graph_cycle(void) /* Test 7: Chained parallel double cycle */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp1) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f1, f2) < 0) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp1) < 0) FAIL_STACK_ERROR @@ -1070,24 +1020,21 @@ test_graph_cycle(void) /* Test 8: Chained parallel double cycle with release */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp1) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f1, f2) < 0) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp1) < 0) FAIL_STACK_ERROR @@ -1111,10 +1058,9 @@ test_graph_cycle(void) FAIL_STACK_ERROR if (NULL == (ftmp0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp1) < 0) FAIL_STACK_ERROR @@ -1140,12 +1086,11 @@ test_graph_cycle(void) /* Test 10: Simple 2 file cycle, extra ID on second file */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR @@ -1185,21 +1130,19 @@ test_graph_cycle(void) /* Test 11: Parallel double cycle, extra ID on a child file */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp0) < 0) FAIL_STACK_ERROR @@ -1245,21 +1188,19 @@ test_graph_cycle(void) /* Test 12: Parallel double cycle, extra ID on a child file, with release */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp0) < 0) FAIL_STACK_ERROR @@ -1291,26 +1232,23 @@ test_graph_cycle(void) /* Test 13: Chained parallel double cycle, extra ID on a child file */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp1) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f1, f2) < 0) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp1) < 0) FAIL_STACK_ERROR @@ -1367,26 +1305,23 @@ test_graph_cycle(void) * release */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp1) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f1, f2) < 0) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp1) < 0) FAIL_STACK_ERROR @@ -1422,22 +1357,19 @@ test_graph_cycle(void) /* Test 15: One local and one remote cycle */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp2) < 0) FAIL_STACK_ERROR @@ -1478,22 +1410,19 @@ test_graph_cycle(void) /* Test 16: One local and one remote cycle, with release */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp2) < 0) FAIL_STACK_ERROR @@ -1532,24 +1461,21 @@ test_graph_cycle(void) /* Test 17: One local and one remote cycle, remote cycle held open */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp2) < 0) FAIL_STACK_ERROR @@ -1596,24 +1522,21 @@ test_graph_cycle(void) * release */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp2) < 0) FAIL_STACK_ERROR @@ -1663,42 +1586,37 @@ test_graph_cycle(void) * Also cycle between bottom (root) and top and cycles on the sides. */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, f3) < 0) FAIL_STACK_ERROR - if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, f3) < 0) FAIL_STACK_ERROR - if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp0) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f0, f3) < 0) FAIL_STACK_ERROR - if (NULL == - (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f4, ftmp1) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f1, f4) < 0) FAIL_STACK_ERROR - if (NULL == - (f5 = H5F__efc_open(f2, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f5 = H5F__efc_open(f2, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f5, ftmp2) < 0) FAIL_STACK_ERROR @@ -1755,42 +1673,37 @@ test_graph_cycle(void) * release the files instead of closing. */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, f3) < 0) FAIL_STACK_ERROR - if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, f3) < 0) FAIL_STACK_ERROR - if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp0) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f0, f3) < 0) FAIL_STACK_ERROR - if (NULL == - (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f4, ftmp1) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f1, f4) < 0) FAIL_STACK_ERROR - if (NULL == - (f5 = H5F__efc_open(f2, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f5 = H5F__efc_open(f2, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f5, ftmp2) < 0) FAIL_STACK_ERROR @@ -1844,33 +1757,29 @@ test_graph_cycle(void) * Also cycle between bottom (root) and top, cycles on sides held open. */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, f3) < 0) FAIL_STACK_ERROR - if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, f3) < 0) FAIL_STACK_ERROR - if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp0) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f0, f3) < 0) FAIL_STACK_ERROR - if (NULL == - (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f4, ftmp1) < 0) FAIL_STACK_ERROR @@ -1878,10 +1787,9 @@ test_graph_cycle(void) FAIL_STACK_ERROR if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f5 = H5F__efc_open(f2, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f5 = H5F__efc_open(f2, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f5, ftmp2) < 0) FAIL_STACK_ERROR @@ -1974,33 +1882,29 @@ test_graph_cycle(void) * Also release the files instead of closing. */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, f3) < 0) FAIL_STACK_ERROR - if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, f3) < 0) FAIL_STACK_ERROR - if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp0) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f0, f3) < 0) FAIL_STACK_ERROR - if (NULL == - (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f4, ftmp1) < 0) FAIL_STACK_ERROR @@ -2008,10 +1912,9 @@ test_graph_cycle(void) FAIL_STACK_ERROR if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f5 = H5F__efc_open(f2, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f5 = H5F__efc_open(f2, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f5, ftmp2) < 0) FAIL_STACK_ERROR @@ -2086,67 +1989,64 @@ test_graph_cycle(void) * itself). */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, ftmp0) < 0) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp1) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp2) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp3) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp0) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp1) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f2, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp2) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp3) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp0) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp1) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp2) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp3 = H5F__efc_open(f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp3 = H5F__efc_open(f3, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp3) < 0) FAIL_STACK_ERROR @@ -2189,67 +2089,64 @@ test_graph_cycle(void) * itself). Release the files instead of closing. */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f0, ftmp0) < 0) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp1) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp2) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp3) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp0) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp1) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f2, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp2) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f2, ftmp3) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp0) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp1) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp2) < 0) FAIL_STACK_ERROR - if (NULL == (ftmp3 = H5F__efc_open(f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp3 = H5F__efc_open(f3, filename[3], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f3, ftmp3) < 0) FAIL_STACK_ERROR @@ -2289,10 +2186,9 @@ test_graph_cycle(void) /* Test 25: File held open by EFC client interrupts cycle, with release */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR @@ -2322,17 +2218,15 @@ test_graph_cycle(void) /* Test 26: File held open by EFC does not interrupt cycle, with release */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR - if (NULL == - (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (f0->shared->nrefs != 2) TEST_ERROR @@ -2356,10 +2250,9 @@ test_graph_cycle(void) * interrupt cycle, but parent file does (no valid way around it) */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR @@ -2367,10 +2260,9 @@ test_graph_cycle(void) FAIL_STACK_ERROR if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == (f1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (f0->shared->nrefs != 2) TEST_ERROR @@ -2470,10 +2362,9 @@ test_graph_cycle(void) * release */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR @@ -2481,10 +2372,9 @@ test_graph_cycle(void) FAIL_STACK_ERROR if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == (f1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (f0->shared->nrefs != 2) TEST_ERROR @@ -2550,12 +2440,11 @@ test_graph_cycle(void) FAIL_STACK_ERROR if (H5Pset_elink_file_cache_size(fapl_id, 0) < 0) TEST_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5Pset_elink_file_cache_size(fapl_id, 8) < 0) TEST_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (f0->shared->nrefs != 2) TEST_ERROR @@ -2586,10 +2475,9 @@ test_graph_cycle(void) /* Test 30: File without EFC does not interrupt cycle */ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) FAIL_STACK_ERROR - if (NULL == - (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR - if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fapl_id))) FAIL_STACK_ERROR if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR @@ -2597,8 +2485,7 @@ test_graph_cycle(void) FAIL_STACK_ERROR if (H5Pset_elink_file_cache_size(fapl_id, 0) < 0) TEST_ERROR - if (NULL == - (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (NULL == (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fapl_id))) FAIL_STACK_ERROR if (H5Pset_elink_file_cache_size(fapl_id, 8) < 0) TEST_ERROR @@ -2651,73 +2538,89 @@ error: int main(void) { - unsigned nerrors = 0; /* track errors */ - H5P_genplist_t * plist; /* Property list pointer for FAPL */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ - int i; /* iterator */ + hid_t fapl_id = H5I_INVALID_HID; + hbool_t is_native; /* Whether native VOL connector is being used */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + int i; /* iterator */ + unsigned nerrors = 0; /* track errors */ /* Test Setup */ HDputs("Testing the external file cache"); /* Create property lists */ - fcpl_id = H5Pcreate(H5P_FILE_CREATE); fapl_id = h5_fileaccess(); - /* Allocate memory for filenames */ - for (i = 0; i < N_FILENAMES; i++) { - filename[i] = (char *)HDcalloc(PATH_MAX, sizeof(char)); - } + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + if (H5VL_fapl_is_native(fapl_id, &is_native) < 0) + FAIL_STACK_ERROR; - /* Patch filenames */ - h5_fixname(FILENAME[0], fapl_id, filename[0], PATH_MAX); - h5_fixname(FILENAME[1], fapl_id, filename[1], PATH_MAX); - h5_fixname(FILENAME[2], fapl_id, filename[2], PATH_MAX); - h5_fixname(FILENAME[3], fapl_id, filename[3], PATH_MAX); - h5_fixname(FILENAME[4], fapl_id, filename[4], PATH_MAX); - h5_fixname(FILENAME[5], fapl_id, filename[5], PATH_MAX); + if (is_native) { + hid_t fcpl_id = H5I_INVALID_HID; + H5P_genplist_t * plist; /* Property list pointer for FAPL */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - /* Push API context */ - if (H5CX_push() < 0) - FAIL_STACK_ERROR - api_ctx_pushed = TRUE; + fcpl_id = H5Pcreate(H5P_FILE_CREATE); - /* Get the VOL info from the fapl */ - plist = (H5P_genplist_t *)H5I_object(fapl_id); - H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop); + /* Allocate memory for filenames */ + for (i = 0; i < N_FILENAMES; i++) + filename[i] = (char *)HDcalloc(PATH_MAX, sizeof(char)); - /* Stash a copy of the "top-level" connector property, before any pass-through - * connectors modify or unwrap it. - */ - H5CX_set_vol_connector_prop(&connector_prop); + /* Patch filenames */ + h5_fixname(FILENAME[0], fapl_id, filename[0], PATH_MAX); + h5_fixname(FILENAME[1], fapl_id, filename[1], PATH_MAX); + h5_fixname(FILENAME[2], fapl_id, filename[2], PATH_MAX); + h5_fixname(FILENAME[3], fapl_id, filename[3], PATH_MAX); + h5_fixname(FILENAME[4], fapl_id, filename[4], PATH_MAX); + h5_fixname(FILENAME[5], fapl_id, filename[5], PATH_MAX); - /* Test Functions */ - nerrors += test_single(); - nerrors += test_graph_nocycle(); - nerrors += test_graph_cycle(); + /* Push API context */ + if (H5CX_push() < 0) + FAIL_STACK_ERROR + api_ctx_pushed = TRUE; - /* Close property lists */ - if (H5Pclose(fcpl_id) < 0) - TEST_ERROR + /* Get the VOL info from the fapl */ + plist = (H5P_genplist_t *)H5I_object(fapl_id); + H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop); - /* Verify symbol table messages are cached */ - nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); + /* Stash a copy of the "top-level" connector property, before any pass-through + * connectors modify or unwrap it. + */ + H5CX_set_vol_connector_prop(&connector_prop); - /* Pop API context */ - if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - FAIL_STACK_ERROR - api_ctx_pushed = FALSE; + /* Test Functions */ + nerrors += test_single(fapl_id, fcpl_id); + nerrors += test_graph_nocycle(fapl_id, fcpl_id); + nerrors += test_graph_cycle(fapl_id, fcpl_id); - if (nerrors) - goto error; + /* Close property lists */ + if (H5Pclose(fcpl_id) < 0) + FAIL_STACK_ERROR - HDputs("All external file cache tests passed."); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); - h5_clean_files(FILENAME, fapl_id); + /* Pop API context */ + if (api_ctx_pushed && H5CX_pop(FALSE) < 0) + FAIL_STACK_ERROR + api_ctx_pushed = FALSE; - for (i = 0; i < N_FILENAMES; i++) { - HDfree(filename[i]); - } + if (nerrors) + goto error; + + HDputs("All external file cache tests passed."); + + h5_clean_files(FILENAME, fapl_id); + + for (i = 0; i < N_FILENAMES; i++) + HDfree(filename[i]); + } /* end if */ + else { + HDputs("External file cache tests skipped - not using native VOL connector."); + + if (H5Pclose(fapl_id) < 0) + FAIL_STACK_ERROR + } /* end else */ return EXIT_SUCCESS; @@ -2733,9 +2636,8 @@ error: if (api_ctx_pushed) H5CX_pop(FALSE); - for (i = 0; i < N_FILENAMES; i++) { + for (i = 0; i < N_FILENAMES; i++) HDfree(filename[i]); - } return EXIT_FAILURE; } /* end main() */ diff --git a/test/getname.c b/test/getname.c index 485e3c1..aa1c726 100644 --- a/test/getname.c +++ b/test/getname.c @@ -3684,69 +3684,86 @@ test_elinks(hid_t fapl) char name[NAME_BUF_SIZE]; /* Buffer for storing object's name */ ssize_t namelen; /* Length of object's name */ hbool_t name_cached; /* Indicate if name is cached */ + hbool_t is_native; /* Whether native VOL connector is being used */ - /* Initialize the file names */ - h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1); - h5_fixname(FILENAME[2], fapl, filename2, sizeof filename2); - - /* Create files */ - if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR - if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR + TESTING("getting path to externally linked objects"); - /* Create a group in the second file */ - if ((group2 = H5Gcreate2(fid2, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Close Group */ - if (H5Gclose(group2) < 0) - FAIL_STACK_ERROR - - /* Create an external link in first file to the group in the second file */ - if (H5Lcreate_external(filename2, "Group2", fid1, "Link_to_Group2", H5P_DEFAULT, H5P_DEFAULT) < 0) - FAIL_STACK_ERROR - - /* Create an external link in second file to the external link in the first file */ - if (H5Lcreate_external(filename1, "Link_to_Group2", fid2, "Link_to_Link_to_Group2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - FAIL_STACK_ERROR + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + if (H5VL_fapl_is_native(fapl, &is_native) < 0) + TEST_ERROR; - /* Open the group in thesecond file through the external link */ - if ((group = H5Gopen2(fid1, "Link_to_Group2", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + /* Skip tests for expanding external links when using non-native VOL connectors */ + if (!is_native) { + SKIPPED(); + HDputs(" Not using native VOL connector"); + } + else { + /* Initialize the file names */ + h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[2], fapl, filename2, sizeof filename2); + + /* Create files */ + if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + + /* Create a group in the second file */ + if ((group2 = H5Gcreate2(fid2, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Close Group */ + if (H5Gclose(group2) < 0) + FAIL_STACK_ERROR + + /* Create an external link in first file to the group in the second file */ + if (H5Lcreate_external(filename2, "Group2", fid1, "Link_to_Group2", H5P_DEFAULT, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR + + /* Create an external link in second file to the external link in the first file */ + if (H5Lcreate_external(filename1, "Link_to_Group2", fid2, "Link_to_Link_to_Group2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + FAIL_STACK_ERROR + + /* Open the group in the second file through the external link */ + if ((group = H5Gopen2(fid1, "Link_to_Group2", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Query the external link object's name */ + *name = '\0'; + name_cached = FALSE; + namelen = H5I__get_name_test(group, (char *)name, sizeof(name), &name_cached); + if (!((HDstrcmp(name, "/Group2") == 0) && (namelen == 7) && name_cached)) + TEST_ERROR - /* Query the external link object's name */ - *name = '\0'; - name_cached = FALSE; - namelen = H5I__get_name_test(group, (char *)name, sizeof(name), &name_cached); - if (!((HDstrcmp(name, "/Group2") == 0) && (namelen == 7) && name_cached)) - TEST_ERROR + /* Close Group */ + if (H5Gclose(group) < 0) + FAIL_STACK_ERROR - /* Close Group */ - if (H5Gclose(group) < 0) - FAIL_STACK_ERROR + /* Open the group in the second file through the external link to the external link */ + if ((group = H5Gopen2(fid2, "Link_to_Link_to_Group2", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR - /* Open the group in the second file through the external link to the external link */ - if ((group = H5Gopen2(fid2, "Link_to_Link_to_Group2", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + /* Query the external link to external link object's name */ + *name = '\0'; + name_cached = FALSE; + namelen = H5I__get_name_test(group, (char *)name, sizeof(name), &name_cached); + if (!((HDstrcmp(name, "/Group2") == 0) && (namelen == 7) && name_cached)) + TEST_ERROR - /* Query the external link to external link object's name */ - *name = '\0'; - name_cached = FALSE; - namelen = H5I__get_name_test(group, (char *)name, sizeof(name), &name_cached); - if (!((HDstrcmp(name, "/Group2") == 0) && (namelen == 7) && name_cached)) - TEST_ERROR + /* Close Group */ + if (H5Gclose(group) < 0) + FAIL_STACK_ERROR - /* Close Group */ - if (H5Gclose(group) < 0) - FAIL_STACK_ERROR + /* Close files */ + if (H5Fclose(fid1) < 0) + FAIL_STACK_ERROR + if (H5Fclose(fid2) < 0) + FAIL_STACK_ERROR - /* Close files */ - if (H5Fclose(fid1) < 0) - FAIL_STACK_ERROR - if (H5Fclose(fid2) < 0) - FAIL_STACK_ERROR + PASSED(); + } return 0; diff --git a/test/links.c b/test/links.c index e1a9dba..1c01b0f 100644 --- a/test/links.c +++ b/test/links.c @@ -16676,16 +16676,26 @@ error: static int obj_exists(hid_t fapl, hbool_t new_format) { - char filename[NAME_BUF_SIZE]; /* Buffer for file name */ - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group ID */ - herr_t status; /* Generic return value */ + char filename[NAME_BUF_SIZE]; /* Buffer for file name */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hbool_t is_native; /* Whether native VOL connector is being used */ + herr_t status; /* Generic return value */ if (new_format) TESTING("object exists (w/new group format)") else TESTING("object exists") + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + if (H5VL_fapl_is_native(fapl, &is_native) < 0) + TEST_ERROR; + + /* Note that some testing will be skipped with non-native VOL connectors */ + if (!is_native) + HDputs(" Tests involving external links skipped - not using native VOL connector"); + /* Set up filename and create file*/ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); @@ -16778,8 +16788,10 @@ obj_exists(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE for external link in root group that points to object */ - if (TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT)) - TEST_ERROR + if (is_native) { + if (TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT)) + TEST_ERROR + } /* Create dangling (file doesn't exist) external link in non-root group */ if (H5Lcreate_external("nofile", "dangle", fid, "group/external1", H5P_DEFAULT, H5P_DEFAULT) < 0) @@ -16805,8 +16817,10 @@ obj_exists(hid_t fapl, hbool_t new_format) /* Verify that H5Oexists_by_name() returns TRUE for external link in non-root group that points to object */ - if (TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT)) - TEST_ERROR + if (is_native) { + if (TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT)) + TEST_ERROR + } /* Soft->External links */ /* Create soft-link in root group that points to dangling (file doesn't exist) external link */ @@ -16830,8 +16844,10 @@ obj_exists(hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if (TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT)) - TEST_ERROR + if (is_native) { + if (TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT)) + TEST_ERROR + } /* Create soft-link in root group that points to dangling (file doesn't exist) external link in non-root * group */ @@ -16856,8 +16872,10 @@ obj_exists(hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if (TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT)) - TEST_ERROR + if (is_native) { + if (TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT)) + TEST_ERROR + } /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link */ if (H5Lcreate_soft("/external1", fid, "group/soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) @@ -16880,8 +16898,10 @@ obj_exists(hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if (TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT)) - TEST_ERROR + if (is_native) { + if (TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT)) + TEST_ERROR + } /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link in * non-root group */ @@ -16907,8 +16927,10 @@ obj_exists(hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if (TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT)) - TEST_ERROR + if (is_native) { + if (TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT)) + TEST_ERROR + } /* External->Soft links */ /* Create external link in root group that points to dangling soft link in root group */ @@ -16924,8 +16946,10 @@ obj_exists(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if (TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT)) - TEST_ERROR + if (is_native) { + if (TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT)) + TEST_ERROR + } /* Create external link in root group that points to dangling soft link in non-root group */ if (H5Lcreate_external(filename, "group/soft1", fid, "elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) @@ -16940,8 +16964,10 @@ obj_exists(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if (TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT)) - TEST_ERROR + if (is_native) { + if (TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT)) + TEST_ERROR + } /* Create external link in non-root group that points to dangling soft link in root group */ if (H5Lcreate_external(filename, "soft1", fid, "group/elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) @@ -16956,8 +16982,10 @@ obj_exists(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if (TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT)) - TEST_ERROR + if (is_native) { + if (TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT)) + TEST_ERROR + } /* Create external link in non-root group that points to dangling soft link in non-root group */ if (H5Lcreate_external(filename, "group/soft1", fid, "group/elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) @@ -16973,8 +17001,10 @@ obj_exists(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if (TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT)) - TEST_ERROR + if (is_native) { + if (TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT)) + TEST_ERROR + } /* Close file created */ if (H5Fclose(fid) < 0) @@ -22578,7 +22608,8 @@ main(void) } for (new_format = FALSE; new_format <= TRUE; new_format++) { - hid_t my_fapl; + hid_t my_fapl; + hbool_t is_native; /* Whether native VOL connector is being used */ /* Check for FAPL to use */ if (new_format) { @@ -22618,9 +22649,21 @@ main(void) nerrors += test_deprec(my_fapl, new_format); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Skip external link tests for splitter VFD, which has external link-related bugs */ - if (HDstrcmp(env_h5_drvr, "splitter")) { + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + if (H5VL_fapl_is_native(my_fapl, &is_native) < 0) + TEST_ERROR; + /* Skip tests external link tests when using non-native VOL connectors */ + if (!is_native || 0 == HDstrcmp(env_h5_drvr, "splitter")) { + HDputs(" External link tests skipped - not using native VOL connector, or using splitter " + "VFD"); + } + else if (HDstrcmp(env_h5_drvr, "splitter") == 0) { + HDputs(" External link tests skipped - splitter VFD does not currently support external " + "links"); + } + else { /* tests for external link */ /* Test external file cache first, so it sees the default efc setting on the fapl */ @@ -22672,7 +22715,10 @@ main(void) nerrors += external_link_closing_deprec(my_fapl, new_format) < 0 ? 1 : 0; #endif /* H5_NO_DEPRECATED_SYMBOLS */ - if (!driver_uses_modified_filename) { + if (driver_uses_modified_filename) { + HDputs(" external_link_endian() test skipped - driver uses modified filename"); + } + else { nerrors += external_link_endian(new_format) < 0 ? 1 : 0; } @@ -22687,7 +22733,10 @@ main(void) nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0; - if (!driver_uses_modified_filename) { + if (driver_uses_modified_filename) { + HDputs(" external_set_elink_fapl1() test skipped - driver uses modified filename"); + } + else { nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; } diff --git a/test/links_env.c b/test/links_env.c index 7170132..8c1567d 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -56,76 +56,90 @@ static int external_link_env(hid_t fapl, hbool_t new_format); static int external_link_env(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - const char *envval = NULL; /* Pointer to environment variable */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t gid = H5I_INVALID_HID; /* Group IDs */ + const char *envval = NULL; /* Pointer to environment variable */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE]; /* Holders for filename */ + hbool_t is_native; /* Whether native VOL connector is being used */ if (new_format) TESTING("external links via environment variable (w/new group format)") else TESTING("external links via environment variable") - if ((envval = HDgetenv("HDF5_EXT_PREFIX")) == NULL) - envval = "nomatch"; - if (HDstrcmp(envval, ".:tmp_links_env") != 0) - TEST_ERROR - - /* Set up name for main file:"extlinks_env0" */ - h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); - - /* Set up name for external linked target file: "extlinks_env1" */ - h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); - - /* Create "tmp_links_env" directory */ - if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR - - /* Set up name (location) for the target file: "tmp_links_env/extlinks1" */ - h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3); - - /* Create the target file in "tmp_links_env" directory */ - if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - - /* Closing for target file */ - if (H5Gclose(gid) < 0) - TEST_ERROR - if (H5Fclose(fid) < 0) - TEST_ERROR + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + if (H5VL_fapl_is_native(fapl, &is_native) < 0) + TEST_ERROR; - /* Create the main file */ - if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - - /* Create external link to target file */ - if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Open object through external link */ - H5E_BEGIN_TRY - { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + /* Skip tests when using non-native VOL connectors */ + if (!is_native) { + SKIPPED(); + HDputs(" Not using native VOL connector"); } - H5E_END_TRY; - - /* Should be able to find the target file from pathnames set via HDF5_EXT_PREFIX */ - if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp_links_env directory."); - goto error; + else { + if ((envval = HDgetenv("HDF5_EXT_PREFIX")) == NULL) + envval = "nomatch"; + if (HDstrcmp(envval, ".:tmp_links_env") != 0) + TEST_ERROR + + /* Set up name for main file:"extlinks_env0" */ + h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); + + /* Set up name for external linked target file: "extlinks_env1" */ + h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); + + /* Create "tmp_links_env" directory */ + if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR + + /* Set up name (location) for the target file: "tmp_links_env/extlinks1" */ + h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3); + + /* Create the target file in "tmp_links_env" directory */ + if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Closing for target file */ + if (H5Gclose(gid) < 0) + TEST_ERROR + if (H5Fclose(fid) < 0) + TEST_ERROR + + /* Create the main file */ + if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Create external link to target file */ + if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open object through external link */ + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } + H5E_END_TRY; + + /* Should be able to find the target file from pathnames set via HDF5_EXT_PREFIX */ + if (gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp_links_env directory."); + goto error; + } + + /* closing for main file */ + if (H5Gclose(gid) < 0) + TEST_ERROR + if (H5Fclose(fid) < 0) + TEST_ERROR + + PASSED(); } - /* closing for main file */ - if (H5Gclose(gid) < 0) - TEST_ERROR - if (H5Fclose(fid) < 0) - TEST_ERROR - - PASSED(); return 0; error: diff --git a/test/objcopy.c b/test/objcopy.c index 911a45b..9f98cf9 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -8339,13 +8339,13 @@ error: static int test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) { - hid_t fid_src = -1, fid_dst = -1, fid_ext = -1; /* File IDs */ - hid_t sid = -1; /* Dataspace ID */ - hid_t did = -1, did2 = -1; /* Dataset ID */ - hid_t gid = -1, gid2 = -1; /* Group IDs */ - hid_t plid = -1; /* Object copy plist ID */ - hsize_t dim2d[2]; - hsize_t dim1d[1]; + hid_t fid_src = H5I_INVALID_HID, fid_dst = H5I_INVALID_HID, fid_ext = H5I_INVALID_HID; /* File IDs */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t did = H5I_INVALID_HID, did2 = H5I_INVALID_HID; /* Dataset ID */ + hid_t gid = H5I_INVALID_HID, gid2 = H5I_INVALID_HID; /* Group IDs */ + hid_t plid = H5I_INVALID_HID; /* Object copy plist ID */ + hsize_t dim2d[2]; + hsize_t dim1d[1]; H5L_info2_t linfo; int buf[DIM_SIZE_1][DIM_SIZE_2]; int i, j; @@ -8483,8 +8483,20 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ copy_options = 0; if (expand_soft) copy_options |= H5O_COPY_EXPAND_SOFT_LINK_FLAG; - if (expand_ext) + if (expand_ext) { + hbool_t is_native; /* Whether native VOL connector is being used */ + + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + if (H5VL_fapl_is_native(src_fapl, &is_native) < 0) + TEST_ERROR; + + /* Skip test for expanding external links when non-native VOL connector is used */ + HDputs(" Skipping external link expansion sub-test - not using native VOL connector"); + continue; + copy_options |= H5O_COPY_EXPAND_EXT_LINK_FLAG; + } /* end if */ if (H5Pset_copy_object(plid, copy_options) < 0) TEST_ERROR @@ -8826,138 +8838,151 @@ error: static int test_copy_ext_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) { - hid_t fid_src = -1, fid_dst = -1, fid_ext = -1; /* File IDs */ - hid_t sid = -1; /* Dataspace ID */ - hid_t did = -1, did2 = -1; /* Dataset IDs */ - hid_t gid = -1; /* Group ID */ + hid_t fid_src = H5I_INVALID_HID, fid_dst = H5I_INVALID_HID, fid_ext = H5I_INVALID_HID; /* File IDs */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t did = H5I_INVALID_HID, did2 = H5I_INVALID_HID; /* Dataset IDs */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ hsize_t dim2d[2]; int buf[DIM_SIZE_1][DIM_SIZE_2]; int i, j; char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; char ext_filename[NAME_BUF_SIZE]; + hbool_t is_native; /* Whether native VOL connector is being used */ TESTING("H5Ocopy(): object through external link"); - /* set initial data values */ - for (i = 0; i < DIM_SIZE_1; i++) - for (j = 0; j < DIM_SIZE_2; j++) - buf[i][j] = 10000 + 100 * i + j; + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + if (H5VL_fapl_is_native(src_fapl, &is_native) < 0) + TEST_ERROR; - /* Initialize the filenames */ - h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); - h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename); - h5_fixname(FILENAME[2], dst_fapl, ext_filename, sizeof ext_filename); + if (is_native) { + /* set initial data values */ + for (i = 0; i < DIM_SIZE_1; i++) + for (j = 0; j < DIM_SIZE_2; j++) + buf[i][j] = 10000 + 100 * i + j; - /* Reset file token checking info */ - token_reset(); + /* Initialize the filenames */ + h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); + h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename); + h5_fixname(FILENAME[2], dst_fapl, ext_filename, sizeof ext_filename); - /* create source file */ - if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) - TEST_ERROR + /* Reset file token checking info */ + token_reset(); - /* create group at the SRC file */ - if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + /* create source file */ + if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) + TEST_ERROR - /* attach attributes to the group */ - if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) - TEST_ERROR + /* create group at the SRC file */ + if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR - /* Set dataspace dimensions */ - dim2d[0] = DIM_SIZE_1; - dim2d[1] = DIM_SIZE_2; + /* attach attributes to the group */ + if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) + TEST_ERROR - /* create dataspace */ - if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0) - TEST_ERROR + /* Set dataspace dimensions */ + dim2d[0] = DIM_SIZE_1; + dim2d[1] = DIM_SIZE_2; - /* add a dataset to the group */ - if ((did = H5Dcreate2(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, - H5P_DEFAULT)) < 0) - TEST_ERROR - if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - TEST_ERROR + /* create dataspace */ + if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0) + TEST_ERROR - /* close dataspace */ - if (H5Sclose(sid) < 0) - TEST_ERROR - /* close the dataset */ - if (H5Dclose(did) < 0) - TEST_ERROR - /* close the group */ - if (H5Gclose(gid) < 0) - TEST_ERROR + /* add a dataset to the group */ + if ((did = H5Dcreate2(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) + TEST_ERROR + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + TEST_ERROR - /* create file to hold external links to the src file */ - if ((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) - TEST_ERROR + /* close dataspace */ + if (H5Sclose(sid) < 0) + TEST_ERROR + /* close the dataset */ + if (H5Dclose(did) < 0) + TEST_ERROR + /* close the group */ + if (H5Gclose(gid) < 0) + TEST_ERROR - /* create group in the file that will hold the external link */ - if ((gid = H5Gcreate2(fid_ext, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + /* create file to hold external links to the src file */ + if ((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) + TEST_ERROR - /* Create an external link to the dataset in the source file */ - if (H5Lcreate_external(src_filename, NAME_LINK_DATASET, fid_ext, NAME_LINK_EXTERN, H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* create group in the file that will hold the external link */ + if ((gid = H5Gcreate2(fid_ext, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR - /* close the group and file */ - if (H5Gclose(gid) < 0) - TEST_ERROR - if (H5Fclose(fid_ext) < 0) - TEST_ERROR + /* Create an external link to the dataset in the source file */ + if (H5Lcreate_external(src_filename, NAME_LINK_DATASET, fid_ext, NAME_LINK_EXTERN, H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* open the "extern" file with read-only */ - if ((fid_ext = H5Fopen(ext_filename, H5F_ACC_RDONLY, src_fapl)) < 0) - TEST_ERROR + /* close the group and file */ + if (H5Gclose(gid) < 0) + TEST_ERROR + if (H5Fclose(fid_ext) < 0) + TEST_ERROR - /* create destination file */ - if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) - TEST_ERROR + /* open the "extern" file with read-only */ + if ((fid_ext = H5Fopen(ext_filename, H5F_ACC_RDONLY, src_fapl)) < 0) + TEST_ERROR - /* Create an uncopied object in destination file so that tokens in source and destination files aren't the - * same */ - if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + /* create destination file */ + if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) + TEST_ERROR - /* copy the dataset from SRC to DST */ - if (H5Ocopy(fid_ext, NAME_LINK_EXTERN, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + /* Create an uncopied object in destination file so that tokens in source and destination files aren't + * the same */ + if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR - /* open the dataset through the external link */ - if ((did = H5Dopen2(fid_ext, NAME_LINK_EXTERN, H5P_DEFAULT)) < 0) - TEST_ERROR + /* copy the dataset from SRC to DST */ + if (H5Ocopy(fid_ext, NAME_LINK_EXTERN, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR - /* open the destination dataset */ - if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) - TEST_ERROR + /* open the dataset through the external link */ + if ((did = H5Dopen2(fid_ext, NAME_LINK_EXTERN, H5P_DEFAULT)) < 0) + TEST_ERROR - /* Check if the datasets are equal */ - if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) - TEST_ERROR + /* open the destination dataset */ + if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) + TEST_ERROR - /* close the destination dataset */ - if (H5Dclose(did2) < 0) - TEST_ERROR + /* Check if the datasets are equal */ + if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) + TEST_ERROR - /* close the source dataset */ - if (H5Dclose(did) < 0) - TEST_ERROR + /* close the destination dataset */ + if (H5Dclose(did2) < 0) + TEST_ERROR - /* close the SRC file */ - if (H5Fclose(fid_src) < 0) - TEST_ERROR + /* close the source dataset */ + if (H5Dclose(did) < 0) + TEST_ERROR - /* close the EXT file */ - if (H5Fclose(fid_ext) < 0) - TEST_ERROR + /* close the SRC file */ + if (H5Fclose(fid_src) < 0) + TEST_ERROR - /* close the DST file */ - if (H5Fclose(fid_dst) < 0) - TEST_ERROR + /* close the EXT file */ + if (H5Fclose(fid_ext) < 0) + TEST_ERROR + + /* close the DST file */ + if (H5Fclose(fid_dst) < 0) + TEST_ERROR + + PASSED(); + } + else { + SKIPPED(); + HDputs(" Not using native VOL connector"); + } - PASSED(); return 0; error: @@ -16498,338 +16523,354 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, int i, j; char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + hbool_t is_native; /* Whether native VOL connector is being used */ TESTING(test_desciption); - /* set initial data values */ - for (i = 0; i < DIM_SIZE_1; i++) - for (j = 0; j < DIM_SIZE_2; j++) - buf[i][j] = 10000 + 100 * i + j; - - /* Initialize the filenames */ - h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); - h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - - /* Reset file token checking info */ - token_reset(); - - /* create source file */ - if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) - TEST_ERROR - - /* create group at the SRC file */ - if ((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - - /* attach attributes to the group */ - if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) - TEST_ERROR - - /* Set dataspace dimensions */ - dim2d[0] = DIM_SIZE_1; - dim2d[1] = DIM_SIZE_2; + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + if (H5VL_fapl_is_native(src_fapl, &is_native) < 0) + TEST_ERROR; - /* create dataspace */ - if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0) - TEST_ERROR - - /* add a dataset to the top group */ - if ((did = H5Dcreate2(gid, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, - H5P_DEFAULT)) < 0) - TEST_ERROR - if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - TEST_ERROR - if (H5Dclose(did) < 0) - TEST_ERROR - - /* create a sub-group */ - if ((gid_sub = H5Gcreate2(fid_src, NAME_GROUP_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - - /* add a dataset to the sub group */ - if ((did = H5Dcreate2(gid_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, - H5P_DEFAULT)) < 0) - TEST_ERROR - if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - TEST_ERROR - if (H5Dclose(did) < 0) - TEST_ERROR - - /* create sub-sub-group */ - if ((gid_sub_sub = H5Gcreate2(gid_sub, NAME_GROUP_SUB_SUB2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - - /* add a dataset to the sub sub group */ - if ((did = H5Dcreate2(gid_sub_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, - H5P_DEFAULT)) < 0) - TEST_ERROR - if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - TEST_ERROR - - /* close dataset */ - if (H5Dclose(did) < 0) - TEST_ERROR - - /* close dataspace */ - if (H5Sclose(sid) < 0) - TEST_ERROR + /* Skip tests for expanding external links when using non-native VOL connectors */ + if (!is_native && (flag & H5O_COPY_EXPAND_EXT_LINK_FLAG)) { + SKIPPED(); + HDputs(" Not using native VOL connector"); + } + else { + /* set initial data values */ + for (i = 0; i < DIM_SIZE_1; i++) + for (j = 0; j < DIM_SIZE_2; j++) + buf[i][j] = 10000 + 100 * i + j; - if (H5Gclose(gid_sub_sub) < 0) - TEST_ERROR + /* Initialize the filenames */ + h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); + h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - if (H5Gclose(gid_sub) < 0) - TEST_ERROR + /* Reset file token checking info */ + token_reset(); - /* close the group */ - if (H5Gclose(gid) < 0) - FAIL_STACK_ERROR - - if ((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) { - /* Create group to copy */ - if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if (H5Lcreate_soft(NAME_DATASET_SUB_SUB, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0) - FAIL_STACK_ERROR - if (H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) - FAIL_STACK_ERROR - if (H5Gclose(gid) < 0) - FAIL_STACK_ERROR + /* create source file */ + if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) + TEST_ERROR - /* Create group to compare with */ - if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if (H5Lcreate_hard(fid_src, NAME_DATASET_SUB_SUB, H5L_SAME_LOC, NAME_LINK_SOFT2, H5P_DEFAULT, - H5P_DEFAULT) < 0) - FAIL_STACK_ERROR - if (H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) - FAIL_STACK_ERROR - if (H5Gclose(gid) < 0) - FAIL_STACK_ERROR - } /* end if */ + /* create group at the SRC file */ + if ((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR - if ((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0) { - char ext_filename[NAME_BUF_SIZE]; + /* attach attributes to the group */ + if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) + TEST_ERROR - h5_fixname(FILENAME[2], src_fapl, ext_filename, sizeof ext_filename); + /* Set dataspace dimensions */ + dim2d[0] = DIM_SIZE_1; + dim2d[1] = DIM_SIZE_2; - /* Create the external file and dataset */ - if ((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) - TEST_ERROR + /* create dataspace */ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR - if ((did = H5Dcreate2(fid_ext, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, + + /* add a dataset to the top group */ + if ((did = H5Dcreate2(gid, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR if (H5Dclose(did) < 0) TEST_ERROR - if (H5Fclose(fid_ext) < 0) - TEST_ERROR - /* Create group to copy */ - if (!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) { - if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - } /* end if */ - else if ((gid = H5Gopen2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) + /* create a sub-group */ + if ((gid_sub = H5Gcreate2(fid_src, NAME_GROUP_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if (H5Lcreate_external(ext_filename, NAME_DATASET_SIMPLE, fid_src, NAME_LINK_EXTERN, H5P_DEFAULT, - H5P_DEFAULT) < 0) + + /* add a dataset to the sub group */ + if ((did = H5Dcreate2(gid_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) TEST_ERROR - if (H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE, H5P_DEFAULT, - H5P_DEFAULT) < 0) + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR - if (H5Gclose(gid) < 0) + if (H5Dclose(did) < 0) TEST_ERROR - /* Create group to compare with */ - if (!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) { - if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - } /* end if */ - else if ((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) + /* create sub-sub-group */ + if ((gid_sub_sub = H5Gcreate2(gid_sub, NAME_GROUP_SUB_SUB2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < + 0) TEST_ERROR - if ((did = H5Dcreate2(fid_src, NAME_LINK_EXTERN2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, + + /* add a dataset to the sub sub group */ + if ((did = H5Dcreate2(gid_sub_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR - if (H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE2, H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + + /* close dataset */ if (H5Dclose(did) < 0) TEST_ERROR - if (H5Gclose(gid) < 0) - TEST_ERROR - /* Close dataspace */ + /* close dataspace */ if (H5Sclose(sid) < 0) TEST_ERROR - } /* end if */ - if ((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) { - if ((gid_ref = H5Gcreate2(fid_src, NAME_GROUP_REF, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if (H5Gclose(gid_sub_sub) < 0) TEST_ERROR - /* create an attribute of object references */ - if (attach_ref_attr(fid_src, gid_ref) < 0) + if (H5Gclose(gid_sub) < 0) TEST_ERROR - /* create an attribute of region references */ - if (attach_reg_ref_attr(fid_src, gid_ref) < 0) - TEST_ERROR + /* close the group */ + if (H5Gclose(gid) < 0) + FAIL_STACK_ERROR - /* create a dataset of region references */ - if (create_reg_ref_dataset(fid_src, gid_ref) < 0) - TEST_ERROR + if ((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) { + /* Create group to copy */ + if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if (H5Lcreate_soft(NAME_DATASET_SUB_SUB, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR + if (H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR + if (H5Gclose(gid) < 0) + FAIL_STACK_ERROR - /* Close group holding reference objects */ - if (H5Gclose(gid_ref) < 0) - TEST_ERROR - } /* end if */ + /* Create group to compare with */ + if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if (H5Lcreate_hard(fid_src, NAME_DATASET_SUB_SUB, H5L_SAME_LOC, NAME_LINK_SOFT2, H5P_DEFAULT, + H5P_DEFAULT) < 0) + FAIL_STACK_ERROR + if (H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR + if (H5Gclose(gid) < 0) + FAIL_STACK_ERROR + } /* end if */ - /* close the SRC file */ - if (H5Fclose(fid_src) < 0) - TEST_ERROR + if ((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0) { + char ext_filename[NAME_BUF_SIZE]; - /* open the source file with read-only */ - /* (except when expanding soft links */ - if ((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) { - if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDWR, src_fapl)) < 0) - TEST_ERROR - } /* end if */ - else if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) - TEST_ERROR + h5_fixname(FILENAME[2], src_fapl, ext_filename, sizeof ext_filename); - /* create destination file */ - if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) - TEST_ERROR + /* Create the external file and dataset */ + if ((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) + TEST_ERROR + if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0) + TEST_ERROR + if ((did = H5Dcreate2(fid_ext, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) + TEST_ERROR + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + TEST_ERROR + if (H5Dclose(did) < 0) + TEST_ERROR + if (H5Fclose(fid_ext) < 0) + TEST_ERROR - /* Create an uncopied object in destination file so that tokens in source and destination - files aren't the same */ - if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + /* Create group to copy */ + if (!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) { + if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + } /* end if */ + else if ((gid = H5Gopen2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) + TEST_ERROR + if (H5Lcreate_external(ext_filename, NAME_DATASET_SIMPLE, fid_src, NAME_LINK_EXTERN, H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if (H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE, H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if (H5Gclose(gid) < 0) + TEST_ERROR - /* create property to pass copy options */ - if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) - TEST_ERROR + /* Create group to compare with */ + if (!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) { + if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + } /* end if */ + else if ((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) + TEST_ERROR + if ((did = H5Dcreate2(fid_src, NAME_LINK_EXTERN2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) + TEST_ERROR + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + TEST_ERROR + if (H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE2, H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if (H5Dclose(did) < 0) + TEST_ERROR + if (H5Gclose(gid) < 0) + TEST_ERROR - /* set options for object copy */ - if (H5Pset_copy_object(pid, flag) < 0) - TEST_ERROR + /* Close dataspace */ + if (H5Sclose(sid) < 0) + TEST_ERROR + } /* end if */ - /* Verify object copy flags */ - if (H5Pget_copy_object(pid, &cpy_flags) < 0) - TEST_ERROR - if (cpy_flags != flag) - TEST_ERROR + if ((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) { + if ((gid_ref = H5Gcreate2(fid_src, NAME_GROUP_REF, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR - /* copy the group from SRC to DST */ - if (crt_intermediate_grp) { - /* Create link creation plist to pass in intermediate group creation */ - if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) + /* create an attribute of object references */ + if (attach_ref_attr(fid_src, gid_ref) < 0) + TEST_ERROR + + /* create an attribute of region references */ + if (attach_reg_ref_attr(fid_src, gid_ref) < 0) + TEST_ERROR + + /* create a dataset of region references */ + if (create_reg_ref_dataset(fid_src, gid_ref) < 0) + TEST_ERROR + + /* Close group holding reference objects */ + if (H5Gclose(gid_ref) < 0) + TEST_ERROR + } /* end if */ + + /* close the SRC file */ + if (H5Fclose(fid_src) < 0) TEST_ERROR - if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) + + /* open the source file with read-only */ + /* (except when expanding soft links */ + if ((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) { + if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDWR, src_fapl)) < 0) + TEST_ERROR + } /* end if */ + else if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR - if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, "/new_g0/new_g00", pid, lcpl_id) < 0) + /* create destination file */ + if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - if (H5Pclose(lcpl_id) < 0) + /* Create an uncopied object in destination file so that tokens in source and destination + files aren't the same */ + if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* open the group for copy */ - if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + /* create property to pass copy options */ + if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) + TEST_ERROR - /* open the destination group */ - if ((gid2 = H5Gopen2(fid_dst, "/new_g0/new_g00", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - } - else if (((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) || ((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0)) { - if (H5Ocopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, pid, H5P_DEFAULT) < 0) + /* set options for object copy */ + if (H5Pset_copy_object(pid, flag) < 0) + TEST_ERROR + + /* Verify object copy flags */ + if (H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR + if (cpy_flags != flag) + TEST_ERROR + + /* copy the group from SRC to DST */ + if (crt_intermediate_grp) { + /* Create link creation plist to pass in intermediate group creation */ + if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) + TEST_ERROR + if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) + TEST_ERROR + + if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, "/new_g0/new_g00", pid, lcpl_id) < 0) + TEST_ERROR + + if (H5Pclose(lcpl_id) < 0) + TEST_ERROR - if ((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) - /* Unlink dataset to copy from original location */ - /* (So group comparison works properly) */ - if (H5Ldelete(fid_src, NAME_DATASET_SUB_SUB, H5P_DEFAULT) < 0) + /* open the group for copy */ + if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* open the group for copy */ - if ((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + /* open the destination group */ + if ((gid2 = H5Gopen2(fid_dst, "/new_g0/new_g00", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + } + else if (((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) || + ((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0)) { + if (H5Ocopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, pid, H5P_DEFAULT) < 0) + TEST_ERROR - /* open the destination group */ - if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - } - else if (flag & (H5O_COPY_WITHOUT_ATTR_FLAG | H5O_COPY_PRESERVE_NULL_FLAG)) { - if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) - TEST_ERROR + if ((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) + /* Unlink dataset to copy from original location */ + /* (So group comparison works properly) */ + if (H5Ldelete(fid_src, NAME_DATASET_SUB_SUB, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR - /* open the group for copy */ - if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + /* open the group for copy */ + if ((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR - /* open the destination group */ - if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - } - else if (flag & H5O_COPY_SHALLOW_HIERARCHY_FLAG) { - if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) - TEST_ERROR + /* open the destination group */ + if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + } + else if (flag & (H5O_COPY_WITHOUT_ATTR_FLAG | H5O_COPY_PRESERVE_NULL_FLAG)) { + if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) + TEST_ERROR - /* open the group for copy */ - if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + /* open the group for copy */ + if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR - /* open the destination group */ - if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + /* open the destination group */ + if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + } + else if (flag & H5O_COPY_SHALLOW_HIERARCHY_FLAG) { + if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) + TEST_ERROR - /* Set the copy depth */ - depth = 1; - } - else if ((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) { - if (H5Ocopy(fid_src, NAME_GROUP_REF, fid_dst, NAME_GROUP_REF, pid, H5P_DEFAULT) < 0) - TEST_ERROR + /* open the group for copy */ + if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR - /* open the group for copy */ - if ((gid = H5Gopen2(fid_src, NAME_GROUP_REF, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + /* open the destination group */ + if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR - /* open the destination group */ - if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_REF, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - } - else { - /* Unknown flag */ - TEST_ERROR - } /* end else */ + /* Set the copy depth */ + depth = 1; + } + else if ((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) { + if (H5Ocopy(fid_src, NAME_GROUP_REF, fid_dst, NAME_GROUP_REF, pid, H5P_DEFAULT) < 0) + TEST_ERROR - /* Check if the groups are equal */ - if (compare_groups(gid, gid2, pid, depth, flag) != TRUE) - TEST_ERROR - if (H5Gclose(gid2) < 0) - TEST_ERROR - if (H5Gclose(gid) < 0) - TEST_ERROR + /* open the group for copy */ + if ((gid = H5Gopen2(fid_src, NAME_GROUP_REF, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR - /* close the SRC file */ - if (H5Fclose(fid_src) < 0) - TEST_ERROR + /* open the destination group */ + if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_REF, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + } + else { + /* Unknown flag */ + TEST_ERROR + } /* end else */ - /* close the DST file */ - if (H5Fclose(fid_dst) < 0) - TEST_ERROR + /* Check if the groups are equal */ + if (compare_groups(gid, gid2, pid, depth, flag) != TRUE) + TEST_ERROR + if (H5Gclose(gid2) < 0) + TEST_ERROR + if (H5Gclose(gid) < 0) + TEST_ERROR - /* close properties */ - if (H5Pclose(pid) < 0) - TEST_ERROR + /* close the SRC file */ + if (H5Fclose(fid_src) < 0) + TEST_ERROR + + /* close the DST file */ + if (H5Fclose(fid_dst) < 0) + TEST_ERROR + + /* close properties */ + if (H5Pclose(pid) < 0) + TEST_ERROR + + PASSED(); + } - PASSED(); return 0; error: diff --git a/test/testvdsswmr.sh.in b/test/testvdsswmr.sh.in index c57cc08..ea1d77d 100644 --- a/test/testvdsswmr.sh.in +++ b/test/testvdsswmr.sh.in @@ -104,7 +104,23 @@ if [ $rc -ne 0 ] ; then echo "The VFD specified by the HDF5_DRIVER environment variable" echo "does not support SWMR." echo - echo "SWMR acceptance tests skipped" + echo "Virtual dataset SWMR acceptance tests skipped" + echo + exit 0 +fi + +# Check to see if the VOL connector specified by the HDF5_VOL_CONNECTOR +# environment variable supports Virtual Datasets. +# +# Note: Depends on vds_elink_compat_vol tool from $(topdir)/utils +$bindir/vds_elink_compat_vol +rc=$? +if [ $rc -ne 0 ] ; then + echo + echo "The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo "variable does not support virtual datasets." + echo + echo "Virtual dataset SWMR acceptance tests skipped" echo exit 0 fi diff --git a/test/tsohm.c b/test/tsohm.c index 774378a..68550cb 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -23,7 +23,8 @@ */ #define H5F_FRIEND /* suppress error about including H5Fpkg */ #define H5F_TESTING -#include "H5Fpkg.h" /* File access */ +#include "H5Fpkg.h" /* File access */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Default SOHM values */ #define DEF_NUM_INDEXES 0 @@ -3225,11 +3226,12 @@ test_sohm_delete_revert(void) static void verify_dset_create_and_open_through_extlink_with_sohm(hid_t src_fcpl_id, hid_t dst_fcpl_id) { - hid_t src_file_id = -1; - hid_t dst_file_id = -1; - hid_t space_id = -1; - hid_t dset_id = -1; + hid_t src_file_id = H5I_INVALID_HID; + hid_t dst_file_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; hsize_t dims[] = {1, 1}; + hbool_t is_native; herr_t ret; /* Create files */ @@ -3242,20 +3244,31 @@ verify_dset_create_and_open_through_extlink_with_sohm(hid_t src_fcpl_id, hid_t d ret = H5Lcreate_external(FILENAME_DST, "/", src_file_id, "ext_link", H5P_DEFAULT, H5P_DEFAULT); CHECK_I(ret, "H5Lcreate_external"); + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + ret = H5VL_fapl_is_native(H5P_DEFAULT, &is_native); + CHECK_I(ret, "H5VL__fapl_is_native_test"); + /* Create a dataset through the external link */ space_id = H5Screate_simple(2, dims, dims); CHECK_I(space_id, "H5Screate_simple"); dset_id = H5Dcreate2(src_file_id, "ext_link/dataset", H5T_NATIVE_FLOAT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK_I(dset_id, "H5Dcreate2"); + if (is_native) { + CHECK_I(dset_id, "H5Dcreate2"); + + /* Close the dataset */ + ret = H5Sclose(space_id); + CHECK_I(ret, "H5Sclose"); + ret = H5Dclose(dset_id); + CHECK_I(ret, "H5Dclose"); + } + else + VERIFY(dset_id, H5I_INVALID_HID, "H5Dcreate2"); /* Close the dataset and both files to make sure everything gets flushed * out of memory */ - ret = H5Sclose(space_id); - CHECK_I(ret, "H5Sclose"); - ret = H5Dclose(dset_id); - CHECK_I(ret, "H5Dclose"); ret = H5Fclose(src_file_id); CHECK_I(ret, "H5Fclose"); ret = H5Fclose(dst_file_id); @@ -3265,16 +3278,18 @@ verify_dset_create_and_open_through_extlink_with_sohm(hid_t src_fcpl_id, hid_t d * the wrong file, it'll be impossible to read the dataset's object * header. */ - dst_file_id = H5Fopen(FILENAME_DST, H5F_ACC_RDONLY, H5P_DEFAULT); - CHECK_I(dst_file_id, "H5Fopen"); - dset_id = H5Dopen2(dst_file_id, "dataset", H5P_DEFAULT); - CHECK_I(dset_id, "H5Dopen2"); + if (is_native) { + dst_file_id = H5Fopen(FILENAME_DST, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK_I(dst_file_id, "H5Fopen"); + dset_id = H5Dopen2(dst_file_id, "dataset", H5P_DEFAULT); + CHECK_I(dset_id, "H5Dopen2"); - /* Cleanup */ - ret = H5Dclose(dset_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Fclose(dst_file_id); - CHECK_I(ret, "H5Fclose"); + /* Cleanup */ + ret = H5Dclose(dset_id); + CHECK_I(ret, "H5Dclose"); + ret = H5Fclose(dst_file_id); + CHECK_I(ret, "H5Fclose"); + } } /* verify_dset_create_and_open_through_extlink_with_sohm */ /*------------------------------------------------------------------------- @@ -12289,6 +12289,7 @@ main(void) int test_api_config; unsigned bit_config; H5F_libver_t low, high; /* Low and high bounds */ + hbool_t is_native; /* Whether native VOL connector is being used */ const char * env_h5_drvr; /* File Driver value from environment */ int nerrors = 0; @@ -12310,6 +12311,11 @@ main(void) h5_reset(); fapl = h5_fileaccess(); + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + if (H5VL_fapl_is_native(fapl, &is_native) < 0) + TEST_ERROR; + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); /* Create FAPLs for VDS and source files */ @@ -12355,53 +12361,61 @@ main(void) nerrors += test_api((test_api_config_t)test_api_config, vds_fapl, low); TESTING_2("Virtual dataset I/O") + + /* Skip tests for virtual dataset I/O when using non-native VOL connectors */ + if (!is_native) { + SKIPPED(); + HDputs(" Not using native VOL connector"); + } + else { #ifdef VDS_TEST_VERBOSE - HDputs(""); + HDputs(""); #else /* VDS_TEST_VERBOSE */ - tmp_nerrors = nerrors; + tmp_nerrors = nerrors; #endif /* VDS_TEST_VERBOSE */ - for (bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) { - /* Skip invalid configurations */ - if ((bit_config & TEST_IO_FCLOSE_SEMI) && (bit_config & TEST_IO_FCLOSE_STRONG)) - continue; - - /* Print message */ - PRINT_CONFIG( - "%s%s%s, %s file close degree", - bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", - bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", - bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : "", - bit_config & TEST_IO_FCLOSE_SEMI - ? "H5F_CLOSE_SEMI" - : (bit_config & TEST_IO_FCLOSE_STRONG ? "H5F_CLOSE_STRONG" : "H5F_CLOSE_WEAK")); - - /* Set file close degree */ - if (bit_config & TEST_IO_FCLOSE_SEMI) { - if (H5Pset_fclose_degree(vds_fapl, H5F_CLOSE_SEMI) < 0) - TEST_ERROR - } - else if (bit_config & TEST_IO_FCLOSE_STRONG) { - if (H5Pset_fclose_degree(vds_fapl, H5F_CLOSE_STRONG) < 0) - TEST_ERROR - } - else { - if (H5Pset_fclose_degree(vds_fapl, H5F_CLOSE_WEAK) < 0) - TEST_ERROR - } + for (bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) { + /* Skip invalid configurations */ + if ((bit_config & TEST_IO_FCLOSE_SEMI) && (bit_config & TEST_IO_FCLOSE_STRONG)) + continue; + + /* Print message */ + PRINT_CONFIG( + "%s%s%s, %s file close degree", + bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", + bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", + bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : "", + bit_config & TEST_IO_FCLOSE_SEMI + ? "H5F_CLOSE_SEMI" + : (bit_config & TEST_IO_FCLOSE_STRONG ? "H5F_CLOSE_STRONG" : "H5F_CLOSE_WEAK")); + + /* Set file close degree */ + if (bit_config & TEST_IO_FCLOSE_SEMI) { + if (H5Pset_fclose_degree(vds_fapl, H5F_CLOSE_SEMI) < 0) + TEST_ERROR + } + else if (bit_config & TEST_IO_FCLOSE_STRONG) { + if (H5Pset_fclose_degree(vds_fapl, H5F_CLOSE_STRONG) < 0) + TEST_ERROR + } + else { + if (H5Pset_fclose_degree(vds_fapl, H5F_CLOSE_WEAK) < 0) + TEST_ERROR + } - /* Run tests */ - nerrors += test_basic_io(bit_config, vds_fapl, src_fapl); - nerrors += test_vds_prefix_first(bit_config, vds_fapl, src_fapl); - nerrors += test_unlim(bit_config, vds_fapl, src_fapl); - nerrors += test_printf(bit_config, vds_fapl, src_fapl); - nerrors += test_all(bit_config, vds_fapl, src_fapl); - } + /* Run tests */ + nerrors += test_basic_io(bit_config, vds_fapl, src_fapl); + nerrors += test_vds_prefix_first(bit_config, vds_fapl, src_fapl); + nerrors += test_unlim(bit_config, vds_fapl, src_fapl); + nerrors += test_printf(bit_config, vds_fapl, src_fapl); + nerrors += test_all(bit_config, vds_fapl, src_fapl); + } #ifndef VDS_TEST_VERBOSE - if (tmp_nerrors == nerrors) - PASSED(); + if (tmp_nerrors == nerrors) + PASSED(); #endif /* VDS_TEST_VERBOSE */ + } nerrors += test_dapl_values(vds_fapl); diff --git a/test/vds_env.c b/test/vds_env.c index 5020db6..5e9c17d 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -17,6 +17,7 @@ * Purpose: Tests datasets with virtual layout. */ #include "h5test.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ const char *FILENAME[] = {"vds_env_virt_0", "vds_env_virt_3", "vds_env_src_2", "vds_env%%_src2", NULL}; @@ -66,201 +67,215 @@ test_vds_prefix_second(unsigned config, hid_t fapl) int fill = -1; /* Fill value */ int i, j; char buffer[1024]; /* buffer to read vds_prefix */ + hbool_t is_native; /* Whether native VOL connector is being used */ TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection with ENV prefix") - h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename); - h5_fixname(FILENAME[1], fapl, vfilename2, sizeof vfilename2); - h5_fixname(FILENAME[2], fapl, srcfilename, sizeof srcfilename); - h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map); - h5_fixname(FILENAME[3], fapl, srcfilenamepct, sizeof srcfilenamepct); - h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map); + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + if (H5VL_fapl_is_native(fapl, &is_native) < 0) + TEST_ERROR; - /* create tmp directory and get current working directory path */ - if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR - - /* Create DCPL */ - if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - TEST_ERROR - - /* Set fill value */ - if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) - TEST_ERROR - - /* Set prefix to a nonexistent directory, will be overwritten by environment variable */ - if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - TEST_ERROR - - if (H5Pset_virtual_prefix(dapl, "someprefix") < 0) - TEST_ERROR - if (H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0) - TEST_ERROR - - if (HDstrcmp(buffer, "someprefix") != 0) - FAIL_PUTS_ERROR("vds prefix not set correctly"); + /* Skip tests for virtual dataset I/O when using non-native VOL connectors */ + if (!is_native && (config & TEST_IO_DIFFERENT_FILE)) { + SKIPPED(); + HDputs(" Not using native VOL connector"); + } + else { + h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename); + h5_fixname(FILENAME[1], fapl, vfilename2, sizeof vfilename2); + h5_fixname(FILENAME[2], fapl, srcfilename, sizeof srcfilename); + h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map); + h5_fixname(FILENAME[3], fapl, srcfilenamepct, sizeof srcfilenamepct); + h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map); + + /* create tmp directory and get current working directory path */ + if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR - /* Create source dataspace */ - if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) - TEST_ERROR + /* Create DCPL */ + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR - /* Create virtual dataspace */ - if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) - TEST_ERROR + /* Set fill value */ + if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) + TEST_ERROR - /* Select all (should not be necessary, but just to be sure) */ - if (H5Sselect_all(srcspace[0]) < 0) - TEST_ERROR - if (H5Sselect_all(vspace[0]) < 0) - TEST_ERROR + /* Set prefix to a nonexistent directory, will be overwritten by environment variable */ + if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + TEST_ERROR - /* Add virtual layout mapping */ - if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", - srcspace[0]) < 0) - TEST_ERROR + if (H5Pset_virtual_prefix(dapl, "someprefix") < 0) + TEST_ERROR + if (H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0) + TEST_ERROR - /* Create virtual file */ - if ((vfile = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if (HDstrcmp(buffer, "someprefix") != 0) + FAIL_PUTS_ERROR("vds prefix not set correctly"); - /* Create source file if requested */ - if (config & TEST_IO_DIFFERENT_FILE) { - if (NULL == HDgetcwd(buffer, 1024)) - TEST_ERROR - if (HDchdir(TMPDIR) < 0) + /* Create source dataspace */ + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + + /* Create virtual dataspace */ + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if (HDchdir(buffer) < 0) + + /* Select all (should not be necessary, but just to be sure) */ + if (H5Sselect_all(srcspace[0]) < 0) TEST_ERROR - } - else { - srcfile[0] = vfile; - if (H5Iinc_ref(srcfile[0]) < 0) + if (H5Sselect_all(vspace[0]) < 0) TEST_ERROR - } - /* Create source dataset */ - if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - - /* Create virtual dataset */ - if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR - - /* Populate write buffer */ - for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; - - /* Write data directly to source dataset */ - if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) - TEST_ERROR + /* Add virtual layout mapping */ + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", + "src_dset", srcspace[0]) < 0) + TEST_ERROR - /* Close srcdset and srcfile if config option specified */ - if (config & TEST_IO_CLOSE_SRC) { - if (H5Dclose(srcdset[0]) < 0) + /* Create virtual file */ + if ((vfile = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - srcdset[0] = -1; + /* Create source file if requested */ if (config & TEST_IO_DIFFERENT_FILE) { - if (H5Fclose(srcfile[0]) < 0) + if (NULL == HDgetcwd(buffer, 1024)) + TEST_ERROR + if (HDchdir(TMPDIR) < 0) + TEST_ERROR + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + if (HDchdir(buffer) < 0) + TEST_ERROR + } + else { + srcfile[0] = vfile; + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - srcfile[0] = -1; } - } - /* Reopen virtual dataset and file if config option specified */ - if (config & TEST_IO_REOPEN_VIRT) { - if (H5Dclose(vdset) < 0) - TEST_ERROR - vdset = -1; - if (H5Fclose(vfile) < 0) + /* Create source dataset */ + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - vfile = -1; - if ((vfile = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0) - TEST_ERROR - if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + + /* Create virtual dataset */ + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR - } - /* Read data through virtual dataset */ - HDmemset(rbuf[0], 0, sizeof(rbuf)); - if (H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) - TEST_ERROR + /* Populate write buffer */ + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; - /* Verify read data */ - for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) { - for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if (rbuf[i][j] != buf[i][j]) { - TEST_ERROR - } - } + /* Write data directly to source dataset */ + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR - /* Adjust write buffer */ - for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); + /* Close srcdset and srcfile if config option specified */ + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; - /* Write data through virtual dataset */ - if (H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) - TEST_ERROR + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + } - /* Reopen srcdset and srcfile if config option specified */ - if (config & TEST_IO_CLOSE_SRC) { - if (config & TEST_IO_DIFFERENT_FILE) { - if (NULL == HDgetcwd(buffer, 1024)) + /* Reopen virtual dataset and file if config option specified */ + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR - if (HDchdir(TMPDIR) < 0) + vdset = -1; + if (H5Fclose(vfile) < 0) TEST_ERROR - if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) + vfile = -1; + if ((vfile = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if (HDchdir(buffer) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } - if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) + + /* Read data through virtual dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if (H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR - } - /* Read data directly from source dataset */ - HDmemset(rbuf[0], 0, sizeof(rbuf)); - if (H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) - TEST_ERROR + /* Verify read data */ + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) { + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != buf[i][j]) { + TEST_ERROR + } + } - /* Verify read data */ - for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if (rbuf[i][j] != buf[i][j]) + /* Adjust write buffer */ + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); + + /* Write data through virtual dataset */ + if (H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Reopen srcdset and srcfile if config option specified */ + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) { + if (NULL == HDgetcwd(buffer, 1024)) + TEST_ERROR + if (HDchdir(TMPDIR) < 0) + TEST_ERROR + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) + TEST_ERROR + if (HDchdir(buffer) < 0) + TEST_ERROR + } + if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) TEST_ERROR + } - /* Close */ - if (H5Dclose(vdset) < 0) - TEST_ERROR - vdset = -1; - if (H5Dclose(srcdset[0]) < 0) - TEST_ERROR - srcdset[0] = -1; - if (H5Fclose(srcfile[0]) < 0) - TEST_ERROR - srcfile[0] = -1; - if (H5Fclose(vfile) < 0) - TEST_ERROR - vfile = -1; - if (H5Sclose(srcspace[0]) < 0) - TEST_ERROR - srcspace[0] = -1; - if (H5Sclose(vspace[0]) < 0) - TEST_ERROR - vspace[0] = -1; - if (H5Pclose(dapl) < 0) - TEST_ERROR - dapl = -1; - if (H5Pclose(dcpl) < 0) - TEST_ERROR - dcpl = -1; + /* Read data directly from source dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if (H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != buf[i][j]) + TEST_ERROR + + /* Close */ + if (H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if (H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if (H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + if (H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if (H5Sclose(srcspace[0]) < 0) + TEST_ERROR + srcspace[0] = -1; + if (H5Sclose(vspace[0]) < 0) + TEST_ERROR + vspace[0] = -1; + if (H5Pclose(dapl) < 0) + TEST_ERROR + dapl = -1; + if (H5Pclose(dcpl) < 0) + TEST_ERROR + dcpl = -1; + + PASSED(); + } - PASSED(); return 0; error: @@ -28,7 +28,12 @@ #include "H5VLpkg.h" /* Virtual Object Layer */ /* Filename */ -const char *FILENAME[] = {"native_vol_test", NULL}; +const char *FILENAME[] = {"native_vol_test", /* 0 */ + "vol_public", /* 1 */ + NULL}; + +#define PUBLIC_VOL_API_DATASET_NAME "/Dataset1" +#define PUBLIC_VOL_API_DATASET_SIZE 10 #define NATIVE_VOL_TEST_GROUP_NAME "test_group" #define NATIVE_VOL_TEST_DATASET_NAME "test_dataset" @@ -2106,6 +2111,150 @@ error: } /* end test_async_vol_props() */ /*------------------------------------------------------------------------- + * Function: test_public_vol_api() + * + * Purpose: Test calling the public VOL routines directly. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_public_vol_api(void) +{ + char filename[1024]; + void * file; /* File object */ + void * dataset; /* Dataset object */ + H5VL_loc_params_t loc_params; /* VOL location parameters for operations */ + hid_t fapl_id = H5I_INVALID_HID; + hid_t fcpl_id = H5I_INVALID_HID; + hid_t lcpl_id = H5I_INVALID_HID; + hid_t dcpl_id = H5I_INVALID_HID; + hid_t dapl_id = H5I_INVALID_HID; + hid_t dxpl_id = H5I_INVALID_HID; + hid_t vol_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hsize_t curr_dims; + int wdata[PUBLIC_VOL_API_DATASET_SIZE]; + int rdata[PUBLIC_VOL_API_DATASET_SIZE]; + unsigned u; + + TESTING("Public VOL API"); + + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[1], fapl_id, filename, sizeof filename); + + /* Get property list IDs we need */ + /* (H5P_DEFAULT is not supported by public callback routines) */ + if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) + FAIL_STACK_ERROR + if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) + FAIL_STACK_ERROR + if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + FAIL_STACK_ERROR + if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + FAIL_STACK_ERROR + + /* Retrieve the current VOL connector ID */ + if (H5Pget_vol_id(fapl_id, &vol_id) < 0) + FAIL_STACK_ERROR + if (H5I_INVALID_HID == vol_id) + TEST_ERROR + + /* Create dataspace for operations */ + curr_dims = PUBLIC_VOL_API_DATASET_SIZE; + if ((space_id = H5Screate_simple(1, &curr_dims, NULL)) < 0) + FAIL_STACK_ERROR + + /* Indicate that a new API context should be pushed */ + if (H5Pset_plugin_new_api_context(dxpl_id, TRUE) < 0) + FAIL_STACK_ERROR + + /* Create a file */ + if (NULL == (file = H5VLfile_create(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id, dxpl_id, NULL))) + TEST_ERROR + + /* Set up VOL location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_FILE; + + /* Create a dataset */ + if (NULL == (dataset = H5VLdataset_create(file, &loc_params, vol_id, PUBLIC_VOL_API_DATASET_NAME, lcpl_id, + H5T_NATIVE_INT, space_id, dcpl_id, dapl_id, dxpl_id, NULL))) + TEST_ERROR + + /* Initialize data */ + for (u = 0; u < PUBLIC_VOL_API_DATASET_SIZE; u++) + wdata[u] = (int)u; + + /* Write data to the dataset */ + if (H5VLdataset_write(dataset, vol_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, wdata, NULL) < 0) + TEST_ERROR + + /* Read data from the dataset */ + if (H5VLdataset_read(dataset, vol_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, rdata, NULL) < 0) + TEST_ERROR + + /* Verify data */ + for (u = 0; u < PUBLIC_VOL_API_DATASET_SIZE; u++) + if (wdata[u] != rdata[u]) + TEST_ERROR + + /* Close dataset */ + if (H5VLdataset_close(dataset, vol_id, dxpl_id, NULL) < 0) + TEST_ERROR + + /* Close file */ + if (H5VLfile_close(file, vol_id, dxpl_id, NULL) < 0) + TEST_ERROR + + /* Close dataspace */ + if (H5Sclose(space_id) < 0) + FAIL_STACK_ERROR + + /* Close property lists */ + if (H5Pclose(fapl_id) < 0) + FAIL_STACK_ERROR + if (H5Pclose(fcpl_id) < 0) + FAIL_STACK_ERROR + if (H5Pclose(lcpl_id) < 0) + FAIL_STACK_ERROR + if (H5Pclose(dcpl_id) < 0) + FAIL_STACK_ERROR + if (H5Pclose(dapl_id) < 0) + FAIL_STACK_ERROR + if (H5Pclose(dxpl_id) < 0) + FAIL_STACK_ERROR + + /* Close VOL connector ID */ + if (H5VLclose(vol_id) < 0) + FAIL_STACK_ERROR + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5VLclose(vol_id); + H5Pclose(fapl_id); + H5Pclose(fcpl_id); + H5Pclose(lcpl_id); + H5Pclose(dcpl_id); + H5Pclose(dapl_id); + H5Pclose(dxpl_id); + H5Sclose(space_id); + } + H5E_END_TRY; + + return FAIL; +} /* end test_public_vol_api() */ + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Tests the virtual object layer interface (H5VL) @@ -2140,6 +2289,7 @@ main(void) nerrors += test_basic_link_operation() < 0 ? 1 : 0; nerrors += test_basic_datatype_operation(env_h5_drvr) < 0 ? 1 : 0; nerrors += test_async_vol_props() < 0 ? 1 : 0; + nerrors += test_public_vol_api() < 0 ? 1 : 0; if (nerrors) { HDprintf("***** %d Virtual Object Layer TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in index bd27dd0..573d657 100644 --- a/tools/test/h5diff/testh5diff.sh.in +++ b/tools/test/h5diff/testh5diff.sh.in @@ -35,6 +35,8 @@ EXIT_FAILURE=1 H5DIFF=../../src/h5diff/h5diff # The tool name H5DIFF_BIN=`pwd`/$H5DIFF # The path of the tool binary +VDS_ELINK_COMPAT_VOL=../../../utils/test/vds_elink_compat_vol # The vds_elink_compat_vol tool name +VDS_ELINK_COMPAT_VOL_BIN=`pwd`/$VDS_ELINK_COMPAT_VOL # The path of the vds_elink_compat_vol tool binary RM='rm -rf' CMP='cmp -s' @@ -595,6 +597,13 @@ COPY_TESTFILES_TO_TESTDIR # second copy of tvlstr.h5 $CP -f $SRC_TOOLS_TESTFILES/tvlstr.h5 $TESTDIR/tvlstr2.h5 +# Check to see if the VOL connector specified by the HDF5_VOL_CONNECTOR +# environment variable supports virtual datasets (and external links) +# +# Note: Depends on vds_elink_compat_vol tool from $(topdir)/utils/test +$VDS_ELINK_COMPAT_VOL_BIN +COMPAT_VOL=$? + # ############################################################################ # # Common usage # ############################################################################ @@ -966,22 +975,64 @@ TOOLTEST h5diff_402.txt --follow-symlinks -v h5diff_softlinks.h5 h5diff_softlink TOOLTEST h5diff_403.txt --follow-symlinks -v h5diff_softlinks.h5 h5diff_softlinks.h5 /softlink_dset1_1 /softlink_dset2 # extlink vs extlink (FILE)" -TOOLTEST h5diff_404.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 +ARGS="h5diff_404.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # extlink vs dset" -TOOLTEST h5diff_405.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_trg.h5 /ext_link_dset1 /target_group2/x_dset +ARGS="h5diff_405.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_trg.h5 /ext_link_dset1 /target_group2/x_dset" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # dset vs extlink" -TOOLTEST h5diff_406.txt --follow-symlinks -v h5diff_extlink_trg.h5 h5diff_extlink_src.h5 /target_group2/x_dset /ext_link_dset1 +ARGS="h5diff_406.txt --follow-symlinks -v h5diff_extlink_trg.h5 h5diff_extlink_src.h5 /target_group2/x_dset /ext_link_dset1" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # extlink vs extlink" -TOOLTEST h5diff_407.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset1 /ext_link_dset2 +ARGS="h5diff_407.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset1 /ext_link_dset2" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # softlink vs extlink" -TOOLTEST h5diff_408.txt --follow-symlinks -v h5diff_softlinks.h5 h5diff_extlink_src.h5 /softlink_dset1_1 /ext_link_dset2 +ARGS="h5diff_408.txt --follow-symlinks -v h5diff_softlinks.h5 h5diff_extlink_src.h5 /softlink_dset1_1 /ext_link_dset2" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # extlink vs softlink " -TOOLTEST h5diff_409.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_softlinks.h5 /ext_link_dset2 /softlink_dset1_1 +ARGS="h5diff_409.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_softlinks.h5 /ext_link_dset2 /softlink_dset1_1" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # linked_softlink vs linked_softlink (FILE)" TOOLTEST h5diff_410.txt --follow-symlinks -v h5diff_linked_softlink.h5 h5diff_linked_softlink.h5 @@ -1011,31 +1062,87 @@ TOOLTEST h5diff_417.txt --follow-symlinks -v h5diff_softlinks.h5 h5diff_softlink TOOLTEST h5diff_418.txt --follow-symlinks -v h5diff_softlinks.h5 h5diff_softlinks.h5 /softlink_dset2 /softlink_noexist # non-exist-extlink_file vs extlink" -TOOLTEST h5diff_419.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_noexist2 /ext_link_dset2 +ARGS="h5diff_419.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_noexist2 /ext_link_dset2" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # exlink vs non-exist-extlink_file" -TOOLTEST h5diff_420.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset2 /ext_link_noexist2 +ARGS="h5diff_420.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset2 /ext_link_noexist2" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # extlink vs non-exist-extlink_obj" -TOOLTEST h5diff_421.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset2 /ext_link_noexist1 +ARGS="h5diff_421.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset2 /ext_link_noexist1" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # non-exist-extlink_obj vs extlink" -TOOLTEST h5diff_422.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_noexist1 /ext_link_dset2 +ARGS="h5diff_422.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_noexist1 /ext_link_dset2" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # extlink_to_softlink_to_dset1 vs dset2" -TOOLTEST h5diff_423.txt --follow-symlinks -v h5diff_ext2softlink_src.h5 h5diff_ext2softlink_trg.h5 /ext_link_to_slink1 /dset2 +ARGS="h5diff_423.txt --follow-symlinks -v h5diff_ext2softlink_src.h5 h5diff_ext2softlink_trg.h5 /ext_link_to_slink1 /dset2" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # dset2 vs extlink_to_softlink_to_dset1" -TOOLTEST h5diff_424.txt --follow-symlinks -v h5diff_ext2softlink_trg.h5 h5diff_ext2softlink_src.h5 /dset2 /ext_link_to_slink1 +ARGS="h5diff_424.txt --follow-symlinks -v h5diff_ext2softlink_trg.h5 h5diff_ext2softlink_src.h5 /dset2 /ext_link_to_slink1" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # extlink_to_softlink_to_dset1 vs extlink_to_softlink_to_dset2" -TOOLTEST h5diff_425.txt --follow-symlinks -v h5diff_ext2softlink_src.h5 h5diff_ext2softlink_src.h5 /ext_link_to_slink1 /ext_link_to_slink2 +ARGS="h5diff_425.txt --follow-symlinks -v h5diff_ext2softlink_src.h5 h5diff_ext2softlink_src.h5 /ext_link_to_slink1 /ext_link_to_slink2" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # ############################################################################## # # Dangling links compare (--follow-symlinks and --no-dangling-links) # ############################################################################## # dangling links --follow-symlinks (FILE to FILE) -TOOLTEST h5diff_450.txt --follow-symlinks -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 +ARGS="h5diff_450.txt --follow-symlinks -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # dangling links --follow-symlinks and --no-dangling-links (FILE to FILE) TOOLTEST h5diff_451.txt --follow-symlinks -v --no-dangling-links h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 @@ -1053,13 +1160,34 @@ TOOLTEST h5diff_454.txt --follow-symlinks -v --no-dangling-links h5diff_softli TOOLTEST h5diff_455.txt --follow-symlinks -v --no-dangling-links h5diff_softlinks.h5 h5diff_softlinks.h5 /softlink_noexist /softlink_noexist # dangling link found for ext links (FILE to FILE) -TOOLTEST h5diff_456.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 +ARGS="h5diff_456.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # dangling link found for ext links (obj to obj). target file exist -TOOLTEST h5diff_457.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset1 /ext_link_noexist1 +ARGS="h5diff_457.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset1 /ext_link_noexist1" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # dangling link found for ext links (obj to obj). target file NOT exist -TOOLTEST h5diff_458.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset1 /ext_link_noexist2 +ARGS="h5diff_458.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset1 /ext_link_noexist2" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # dangling link found for ext links (obj to obj). Both dangle links TOOLTEST h5diff_459.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_noexist1 /ext_link_noexist2 @@ -1075,7 +1203,14 @@ TOOLTEST h5diff_467.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_dangl # ext dangling vs. ext dangling TOOLTEST h5diff_468.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link4 # ext link vs. ext dangling -TOOLTEST h5diff_469.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link2 +ARGS="h5diff_469.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link2" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi #---------------------------------------- # dangling links without follow symlink @@ -1093,7 +1228,14 @@ TOOLTEST h5diff_475.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_li # ############################################################################## # root TOOLTEST h5diff_500.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 / / -TOOLTEST h5diff_501.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 / / +ARGS="h5diff_501.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 / /" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # root vs group TOOLTEST h5diff_502.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 / /grp1/grp2/grp3 @@ -1110,19 +1252,47 @@ TOOLTEST h5diff_506.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_r # groups vs ext-link TOOLTEST h5diff_507.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /grp1 /elink_grp1 -TOOLTEST h5diff_508.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /grp1 /elink_grp1 +ARGS="h5diff_508.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /grp1 /elink_grp1" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # soft-link vs ext-link TOOLTEST h5diff_509.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /slink_grp1 /elink_grp1 -TOOLTEST h5diff_510.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /slink_grp1 /elink_grp1 +ARGS="h5diff_510.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /slink_grp1 /elink_grp1" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # circled ext links TOOLTEST h5diff_511.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /grp10 /grp11 -TOOLTEST h5diff_512.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /grp10 /grp11 +ARGS="h5diff_512.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /grp10 /grp11" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # circled soft2ext-link vs soft2ext-link TOOLTEST h5diff_513.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /slink_grp10 /slink_grp11 -TOOLTEST h5diff_514.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /slink_grp10 /slink_grp11 +ARGS="h5diff_514.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /slink_grp10 /slink_grp11" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi ############################################################################### # Test for group recursive diff via multi-linked external links @@ -1131,10 +1301,24 @@ TOOLTEST h5diff_514.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_r ############################################################################### # file vs file TOOLTEST h5diff_515.txt -v h5diff_grp_recurse_ext1.h5 h5diff_grp_recurse_ext2-1.h5 -TOOLTEST h5diff_516.txt -v --follow-symlinks h5diff_grp_recurse_ext1.h5 h5diff_grp_recurse_ext2-1.h5 +ARGS="h5diff_516.txt -v --follow-symlinks h5diff_grp_recurse_ext1.h5 h5diff_grp_recurse_ext2-1.h5" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # group vs group TOOLTEST h5diff_517.txt -v h5diff_grp_recurse_ext1.h5 h5diff_grp_recurse_ext2-1.h5 /g1 -TOOLTEST h5diff_518.txt -v --follow-symlinks h5diff_grp_recurse_ext1.h5 h5diff_grp_recurse_ext2-1.h5 /g1 +ARGS="h5diff_518.txt -v --follow-symlinks h5diff_grp_recurse_ext1.h5 h5diff_grp_recurse_ext2-1.h5 /g1" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links." +fi # ############################################################################## # # Exclude objects (--exclude-path) @@ -1210,9 +1394,25 @@ TOOLTEST h5diff_801.txt -v h5diff_dset1.h5 h5diff_dset3.h5 /g1/array /g1/array # ############################################################################## # VDS tests # ############################################################################## -TOOLTEST h5diff_v1.txt -v 1_vds.h5 2_vds.h5 +ARGS="h5diff_v1.txt -v 1_vds.h5 2_vds.h5" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support virtual datasets." +fi + TOOLTEST h5diff_v2.txt -r 1_vds.h5 2_vds.h5 -TOOLTEST h5diff_v3.txt -c 1_vds.h5 2_vds.h5 + +ARGS="h5diff_v3.txt -c 1_vds.h5 2_vds.h5" +if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $ARGS +else + SKIP $ARGS + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support virtual datasets." +fi # ############################################################################## diff --git a/tools/test/h5dump/testh5dumpvds.sh.in b/tools/test/h5dump/testh5dumpvds.sh.in index f2c486e..ba5723e 100644 --- a/tools/test/h5dump/testh5dumpvds.sh.in +++ b/tools/test/h5dump/testh5dumpvds.sh.in @@ -32,6 +32,9 @@ H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary H5IMPORT=../../src/h5import/h5import # The h5import tool name H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary +VDS_ELINK_COMPAT_VOL=../../../utils/test/vds_elink_compat_vol # The vds_elink_compat_vol tool name +VDS_ELINK_COMPAT_VOL_BIN=`pwd`/$VDS_ELINK_COMPAT_VOL # The path of the vds_elink_compat_vol tool binary + RM='rm -rf' CMP='cmp -s' DIFF='diff -c' @@ -418,6 +421,18 @@ SKIP() { echo " -SKIP-" } +# Check for compatible VOL connector +# Note: Requires VOL connector that supports external links and virtual datasets +COMPAT_VOL_TEST() { + if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $@ + else + SKIP $@ + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links or virtual datasets." + fi +} + # Print a line-line message left justified in a field of 70 characters # PRINT_H5DIFF() { @@ -487,31 +502,38 @@ IMPORTTEST() # prepare for test COPY_TESTFILES_TO_TESTDIR +# Check to see if the VOL connector specified by the HDF5_VOL_CONNECTOR +# environment variable supports virtual datasets (and external links) +# +# Note: Depends on vds_elink_compat_vol tool from $(topdir)/utils/test +$VDS_ELINK_COMPAT_VOL_BIN +COMPAT_VOL=$? + ####### test for dataset vds ###### # Data read if test $USE_FILTER_DEFLATE = "yes" ; then - TOOLTEST tvds-1.ddl --enable-error-stack 1_vds.h5 - TOOLTEST tvds-2.ddl --enable-error-stack 2_vds.h5 - TOOLTEST tvds-3_1.ddl --enable-error-stack 3_1_vds.h5 - TOOLTEST tvds-3_2.ddl --enable-error-stack 3_2_vds.h5 - TOOLTEST tvds-4.ddl --enable-error-stack 4_vds.h5 - TOOLTEST tvds-5.ddl --enable-error-stack 5_vds.h5 - TOOLTEST vds-first.ddl --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5 - TOOLTEST vds-gap1.ddl -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5 - TOOLTEST vds-gap2.ddl --vds-gap-size=2 --enable-error-stack vds-eiger.h5 + COMPAT_VOL_TEST tvds-1.ddl --enable-error-stack 1_vds.h5 + COMPAT_VOL_TEST tvds-2.ddl --enable-error-stack 2_vds.h5 + COMPAT_VOL_TEST tvds-3_1.ddl --enable-error-stack 3_1_vds.h5 + COMPAT_VOL_TEST tvds-3_2.ddl --enable-error-stack 3_2_vds.h5 + COMPAT_VOL_TEST tvds-4.ddl --enable-error-stack 4_vds.h5 + COMPAT_VOL_TEST tvds-5.ddl --enable-error-stack 5_vds.h5 + COMPAT_VOL_TEST vds-first.ddl --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5 + COMPAT_VOL_TEST vds-gap1.ddl -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5 + COMPAT_VOL_TEST vds-gap2.ddl --vds-gap-size=2 --enable-error-stack vds-eiger.h5 fi # Layout read if test $USE_FILTER_DEFLATE = "yes" ; then - TOOLTEST tvds_layout-1.ddl -p --enable-error-stack 1_vds.h5 - TOOLTEST tvds_layout-2.ddl -p --enable-error-stack 2_vds.h5 - TOOLTEST tvds_layout-3_1.ddl -p --enable-error-stack 3_1_vds.h5 - TOOLTEST tvds_layout-3_2.ddl -p --enable-error-stack 3_2_vds.h5 - TOOLTEST tvds_layout-4.ddl -p --enable-error-stack 4_vds.h5 - TOOLTEST tvds_layout-5.ddl -p --enable-error-stack 5_vds.h5 - TOOLTEST vds_layout-eiger.ddl -p --enable-error-stack vds-eiger.h5 - TOOLTEST vds_layout-maxmin.ddl -p --enable-error-stack vds-percival-unlim-maxmin.h5 + COMPAT_VOL_TEST tvds_layout-1.ddl -p --enable-error-stack 1_vds.h5 + COMPAT_VOL_TEST tvds_layout-2.ddl -p --enable-error-stack 2_vds.h5 + COMPAT_VOL_TEST tvds_layout-3_1.ddl -p --enable-error-stack 3_1_vds.h5 + COMPAT_VOL_TEST tvds_layout-3_2.ddl -p --enable-error-stack 3_2_vds.h5 + COMPAT_VOL_TEST tvds_layout-4.ddl -p --enable-error-stack 4_vds.h5 + COMPAT_VOL_TEST tvds_layout-5.ddl -p --enable-error-stack 5_vds.h5 + COMPAT_VOL_TEST vds_layout-eiger.ddl -p --enable-error-stack vds-eiger.h5 + COMPAT_VOL_TEST vds_layout-maxmin.ddl -p --enable-error-stack vds-percival-unlim-maxmin.h5 fi # Clean up temporary files/directories diff --git a/tools/test/h5ls/testh5ls.sh.in b/tools/test/h5ls/testh5ls.sh.in index ee0dad7..03af8c4 100644 --- a/tools/test/h5ls/testh5ls.sh.in +++ b/tools/test/h5ls/testh5ls.sh.in @@ -24,6 +24,8 @@ EXIT_FAILURE=1 H5LS=../../src/h5ls/h5ls # The tool name H5LS_BIN=`pwd`/$H5LS # The path of the tool binary +VDS_ELINK_COMPAT_VOL=../../../utils/test/vds_elink_compat_vol # The vds_elink_compat_vol tool name +VDS_ELINK_COMPAT_VOL_BIN=`pwd`/$VDS_ELINK_COMPAT_VOL # The path of the vds_elink_compat_vol tool binary RM='rm -rf' CMP='cmp -s' @@ -290,6 +292,24 @@ TOOLTEST() { fi } +# Print a "SKIP" message +SKIP() { + TESTING $H5LS $@ + echo " -SKIP-" +} + +# Check for compatible VOL connector +# Note: Requires VOL connector that supports external links and virtual datasets +COMPAT_VOL_TEST() { + if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $@ + else + SKIP $@ + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links or virtual datasets." + fi +} + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -298,6 +318,13 @@ TOOLTEST() { # prepare for test COPY_TESTFILES_TO_TESTDIR +# Check to see if the VOL connector specified by the HDF5_VOL_CONNECTOR +# environment variable supports virtual datasets (and external links) +# +# Note: Depends on vds_elink_compat_vol tool from $(topdir)/utils/test +$VDS_ELINK_COMPAT_VOL_BIN +COMPAT_VOL=$? + # Toss in a bunch of tests. Not sure if they are the right kinds. # test the help syntax TOOLTEST help-1.ls 0 -w80 -h @@ -334,29 +361,29 @@ TOOLTEST tsoftlinks-5.ls 0 --follow-symlinks tsoftlinks.h5/soft_dset1 # test for displaying external and user-defined links with --follow-symlinks TOOLTEST textlink-1.ls 0 -w80 -r textlink.h5 -TOOLTEST textlinksrc-1.ls 0 -w80 --follow-symlinks -r textlinksrc.h5 -TOOLTEST textlinksrc-2.ls 0 -w80 --follow-symlinks -rv textlinksrc.h5/ext_link5 -TOOLTEST textlinksrc-3.ls 0 -w80 --follow-symlinks -r textlinksrc.h5/ext_link1 +COMPAT_VOL_TEST textlinksrc-1.ls 0 -w80 --follow-symlinks -r textlinksrc.h5 +COMPAT_VOL_TEST textlinksrc-2.ls 0 -w80 --follow-symlinks -rv textlinksrc.h5/ext_link5 +COMPAT_VOL_TEST textlinksrc-3.ls 0 -w80 --follow-symlinks -r textlinksrc.h5/ext_link1 TOOLTEST textlinksrc-4.ls 0 -w80 -r textlinksrc.h5 TOOLTEST textlinksrc-5.ls 0 -w80 -r textlinksrc.h5/ext_link1 -TOOLTEST textlinksrc-6.ls 0 -w80 --follow-symlinks textlinksrc.h5 -TOOLTEST textlinksrc-7.ls 0 -w80 --follow-symlinks textlinksrc.h5/ext_link1 -TOOLTEST tudlink-1.ls 0 -w80 -r tudlink.h5 +COMPAT_VOL_TEST textlinksrc-6.ls 0 -w80 --follow-symlinks textlinksrc.h5 +COMPAT_VOL_TEST textlinksrc-7.ls 0 -w80 --follow-symlinks textlinksrc.h5/ext_link1 +COMPAT_VOL_TEST tudlink-1.ls 0 -w80 -r tudlink.h5 # test for displaying external links with -E # the option -E will be depriciated but keep it for backward compatibility -TOOLTEST textlinksrc-1-old.ls 0 -w80 -Er textlinksrc.h5 -TOOLTEST textlinksrc-2-old.ls 0 -w80 -Erv textlinksrc.h5/ext_link5 -TOOLTEST textlinksrc-3-old.ls 0 -w80 -Er textlinksrc.h5/ext_link1 -TOOLTEST textlinksrc-6-old.ls 0 -w80 -E textlinksrc.h5 -TOOLTEST textlinksrc-7-old.ls 0 -w80 -E textlinksrc.h5/ext_link1 +COMPAT_VOL_TEST textlinksrc-1-old.ls 0 -w80 -Er textlinksrc.h5 +COMPAT_VOL_TEST textlinksrc-2-old.ls 0 -w80 -Erv textlinksrc.h5/ext_link5 +COMPAT_VOL_TEST textlinksrc-3-old.ls 0 -w80 -Er textlinksrc.h5/ext_link1 +COMPAT_VOL_TEST textlinksrc-6-old.ls 0 -w80 -E textlinksrc.h5 +COMPAT_VOL_TEST textlinksrc-7-old.ls 0 -w80 -E textlinksrc.h5/ext_link1 # tests for no-dangling-links # if this option is given on dangling link, h5ls should return exit code 1 # when used alone , expect to print out help and return exit code 1 TOOLTEST textlinksrc-nodangle-1.ls 1 -w80 --no-dangling-links textlinksrc.h5 # external dangling link - expected exit code 1 -TOOLTEST textlinksrc-nodangle-2.ls 1 -w80 --follow-symlinks --no-dangling-links textlinksrc.h5 +COMPAT_VOL_TEST textlinksrc-nodangle-2.ls 1 -w80 --follow-symlinks --no-dangling-links textlinksrc.h5 # soft dangling link - expected exit code 1 TOOLTEST tsoftlinks-nodangle-1.ls 1 -w80 --follow-symlinks --no-dangling-links tsoftlinks.h5 # when used file with no dangling links - expected exit code 0 diff --git a/tools/test/h5ls/testh5lsvds.sh.in b/tools/test/h5ls/testh5lsvds.sh.in index 4814f85..e9623b0 100644 --- a/tools/test/h5ls/testh5lsvds.sh.in +++ b/tools/test/h5ls/testh5lsvds.sh.in @@ -21,6 +21,8 @@ EXIT_FAILURE=1 H5LS=../../src/h5ls/h5ls # The tool name H5LS_BIN=`pwd`/$H5LS # The path of the tool binary +VDS_ELINK_COMPAT_VOL=../../../utils/test/vds_elink_compat_vol # The vds_elink_compat_vol tool name +VDS_ELINK_COMPAT_VOL_BIN=`pwd`/$VDS_ELINK_COMPAT_VOL # The path of the vds_elink_compat_vol tool binary RM='rm -rf' CMP='cmp -s' @@ -229,6 +231,24 @@ TOOLTEST() { fi } +# Print a "SKIP" message +SKIP() { + TESTING $H5LS $@ + echo " -SKIP-" +} + +# Check for compatible VOL connector +# Note: Requires VOL connector that supports external links and virtual datasets +COMPAT_VOL_TEST() { + if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + TOOLTEST $@ + else + SKIP $@ + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links or virtual datasets." + fi +} + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -237,14 +257,21 @@ TOOLTEST() { # prepare for test COPY_TESTFILES_TO_TESTDIR +# Check to see if the VOL connector specified by the HDF5_VOL_CONNECTOR +# environment variable supports virtual datasets (and external links) +# +# Note: Depends on vds_elink_compat_vol tool from $(topdir)/utils/test +$VDS_ELINK_COMPAT_VOL_BIN +COMPAT_VOL=$? + ####### test for dataset vds ###### -TOOLTEST tvds-1.ls 0 -w80 -v -S 1_vds.h5 -TOOLTEST tvds-2.ls 0 -w80 -v -S 2_vds.h5 -TOOLTEST tvds-3_1.ls 0 -w80 -v -S 3_1_vds.h5 -TOOLTEST tvds-3_2.ls 0 -w80 -v -S 3_2_vds.h5 -TOOLTEST tvds-4.ls 0 -w80 -v -S 4_vds.h5 -TOOLTEST tvds-5.ls 0 -w80 -v -S 5_vds.h5 +COMPAT_VOL_TEST tvds-1.ls 0 -w80 -v -S 1_vds.h5 +COMPAT_VOL_TEST tvds-2.ls 0 -w80 -v -S 2_vds.h5 +COMPAT_VOL_TEST tvds-3_1.ls 0 -w80 -v -S 3_1_vds.h5 +COMPAT_VOL_TEST tvds-3_2.ls 0 -w80 -v -S 3_2_vds.h5 +COMPAT_VOL_TEST tvds-4.ls 0 -w80 -v -S 4_vds.h5 +COMPAT_VOL_TEST tvds-5.ls 0 -w80 -v -S 5_vds.h5 # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index 1e54670..e74bb4f 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -39,6 +39,9 @@ H5DUMP_BIN=`pwd`/$H5DUMP # The path of the h5dump tool binary H5STAT=../../src/h5stat/h5stat # The h5stat tool name H5STAT_BIN=`pwd`/$H5STAT # The path of the h5stat tool binary +VDS_ELINK_COMPAT_VOL=../../../utils/test/vds_elink_compat_vol # The vds_elink_compat_vol tool name +VDS_ELINK_COMPAT_VOL_BIN=`pwd`/$VDS_ELINK_COMPAT_VOL # The path of the vds_elink_compat_vol tool binary + RM='rm -rf' CMP='cmp' DIFF='diff -c' @@ -327,6 +330,26 @@ SKIP() { echo " -SKIP-" } +BOUNCE() { + ACTUAL_TEST=$1 + shift + $ACTUAL_TEST $@ +} + +# Check for compatible VOL connector +# Note: Requires VOL connector that supports external links and virtual datasets +COMPAT_VOL_TEST() { + if [ $COMPAT_VOL -eq $EXIT_SUCCESS ]; then + ACTUAL_TEST=$1 + shift + $ACTUAL_TEST $@ + else + SKIP $@ + echo " The VOL connector specified by the HDF5_VOL_CONNECTOR environment" + echo " variable does not support external links or virtual datasets." + fi +} + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -1327,6 +1350,13 @@ fi # prepare for test COPY_TESTFILES_TO_TESTDIR +# Check to see if the VOL connector specified by the HDF5_VOL_CONNECTOR +# environment variable supports virtual datasets (and external links) +# +# Note: Depends on vds_elink_compat_vol tool from $(topdir)/utils/test +$VDS_ELINK_COMPAT_VOL_BIN +COMPAT_VOL=$? + TOOLTEST_HELP h5repack-help.txt -h # copy files (these files have no filters) @@ -1743,31 +1773,31 @@ TOOLTEST_META meta_long h5repack_layout.h5 --metadata_block_size=8192 if test $USE_FILTER_DEFLATE != "yes" ; then SKIP vds_dset_chunk_20x10x5 else - VERIFY_LAYOUT_VDS vds_dset_chunk20x10x5 1_vds.h5 vds_dset CHUNKED --layout vds_dset:CHUNK=20x10x5 + COMPAT_VOL_TEST VERIFY_LAYOUT_VDS vds_dset_chunk20x10x5 1_vds.h5 vds_dset CHUNKED --layout vds_dset:CHUNK=20x10x5 fi if test $USE_FILTER_DEFLATE != "yes" ; then SKIP vds_chunk2x5x8 else - VERIFY_LAYOUT_VDS vds_chunk2x5x8 3_1_vds.h5 vds_dset CHUNKED -l vds_dset:CHUNK=2x5x8 + COMPAT_VOL_TEST VERIFY_LAYOUT_VDS vds_chunk2x5x8 3_1_vds.h5 vds_dset CHUNKED -l vds_dset:CHUNK=2x5x8 fi if test $USE_FILTER_DEFLATE != "yes" ; then SKIP vds_chunk3x6x9 else - VERIFY_LAYOUT_VDS vds_chunk3x6x9 2_vds.h5 vds_dset CHUNKED -l vds_dset:CHUNK=3x6x9 + COMPAT_VOL_TEST VERIFY_LAYOUT_VDS vds_chunk3x6x9 2_vds.h5 vds_dset CHUNKED -l vds_dset:CHUNK=3x6x9 fi if test $USE_FILTER_DEFLATE != "yes" ; then SKIP vds_compa 4_vds.h5 else - VERIFY_LAYOUT_VDS vds_compa 4_vds.h5 vds_dset COMPACT -l vds_dset:COMPA + COMPAT_VOL_TEST VERIFY_LAYOUT_VDS vds_compa 4_vds.h5 vds_dset COMPACT -l vds_dset:COMPA fi if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP vds_conti 4_vds.h5 + SKIP vds_conti 4_vds.h5 else - VERIFY_LAYOUT_VDS vds_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI + COMPAT_VOL_TEST VERIFY_LAYOUT_VDS vds_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI fi ################################################################ @@ -1800,11 +1830,11 @@ VERIFY_EXTERNAL_CONSOLIDATION -l CONTI #TOOLTEST_DUMP h5copy_extlinks_src-base h5copy_extlinks_src.h5 --enable-error-stack TOOLTEST_DUMP tsoftlinks-base tsoftlinks.h5 --enable-error-stack TOOLTEST_DUMP textlink-base textlink.h5 --enable-error-stack -TOOLTEST_DUMP textlinkfar-base textlinkfar.h5 --enable-error-stack -TOOLTEST_DUMP textlinksrc-base textlinksrc.h5 --enable-error-stack -TOOLTEST_DUMP textlinktar-base textlinktar.h5 --enable-error-stack +COMPAT_VOL_TEST TOOLTEST_DUMP textlinkfar-base textlinkfar.h5 --enable-error-stack +COMPAT_VOL_TEST TOOLTEST_DUMP textlinksrc-base textlinksrc.h5 --enable-error-stack +COMPAT_VOL_TEST TOOLTEST_DUMP textlinktar-base textlinktar.h5 --enable-error-stack -TOOLTESTSV h5copy_extlinks_src-merge h5copy_extlinks_src.h5 --merge +COMPAT_VOL_TEST TOOLTESTSV h5copy_extlinks_src-merge h5copy_extlinks_src.h5 --merge TOOLFAILSV tsoftlinks-merge tsoftlinks.h5 --merge TOOLTESTSV textlink-merge textlink.h5 --merge ### HDFFV-11128 needs fixed to enable the following test @@ -1821,7 +1851,8 @@ TOOLTEST_DUMP textlinkfar-prune textlinkfar.h5 --prune --enable-error-stack TOOLTEST_DUMP textlinksrc-prune textlinksrc.h5 --prune --enable-error-stack TOOLTEST_DUMP textlinktar-prune textlinktar.h5 --prune --enable-error-stack -TOOLTEST_DUMP h5copy_extlinks_src-mergeprune h5copy_extlinks_src.h5 --merge --prune --enable-error-stack +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST TOOLTEST_DUMP h5copy_extlinks_src-mergeprune h5copy_extlinks_src.h5 --merge --prune --enable-error-stack TOOLTEST_DUMP tsoftlinks-mergeprune tsoftlinks.h5 --merge --prune --enable-error-stack TOOLTEST_DUMP textlink-mergeprune textlink.h5 --merge --prune --enable-error-stack ### HDFFV-11128 needs fixed to enable the following test diff --git a/utils/test/CMakeLists.txt b/utils/test/CMakeLists.txt index 921fbd0..f0612c1 100644 --- a/utils/test/CMakeLists.txt +++ b/utils/test/CMakeLists.txt @@ -20,12 +20,15 @@ macro (ADD_H5_EXE file) endmacro () ############################################################################## -### S W I M M E R T E S T U T I L S ### +### T E S T U T I L S ### ############################################################################## set (H5_UTIL_TESTS) if (HDF5_TEST_SWMR) - set (H5_UTIL_TESTS ${H5_UTIL_TESTS} swmr_check_compat_vfd) + set (H5_UTIL_TESTS ${H5_UTIL_TESTS} + swmr_check_compat_vfd + vds_elink_compat_vol + ) endif () if (H5_UTIL_TESTS) diff --git a/utils/test/Makefile.am b/utils/test/Makefile.am index 164562f..b2a8b3c 100644 --- a/utils/test/Makefile.am +++ b/utils/test/Makefile.am @@ -23,7 +23,7 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib # These are our main targets, the tools -noinst_PROGRAMS=swmr_check_compat_vfd +noinst_PROGRAMS=swmr_check_compat_vfd vds_elink_compat_vol # Programs all depend on the hdf5 library, the tools library, and the HL # library. diff --git a/utils/test/vds_elink_compat_vol.c b/utils/test/vds_elink_compat_vol.c new file mode 100644 index 0000000..ebca924 --- /dev/null +++ b/utils/test/vds_elink_compat_vol.c @@ -0,0 +1,60 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Purpose: This is a small program that checks if the HDF5_VOL_CONNECTOR + * environment variable is set to a value that supports virtual + * datasets & external links. Currently that is limited to a + * VOL connector stack that is composed of _only_ the trivial + * single connector stack of the native VOL connector. + * + * It is intended for use in shell scripts. + */ + +#include "h5test.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Uses the default file access property lists, which is + * initialized with the VOL connector from the HDF5_VOL_CONNECTOR + * environment variable to determine if virtual datasets & external + * links are supported. + * + * Return: VOL connector supports virtual datasets & external links: EXIT_SUCCESS + * + * VOL connector does not support virtual datasets & external links, + * or failure: EXIT_FAILURE + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + hid_t fapl_id; + hbool_t is_native; /* Whether native VOL connector is being used */ + + /* Open the VDS file and dataset */ + if ((fapl_id = h5_fileaccess()) < 0) + return EXIT_FAILURE; + + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + if (H5VL_fapl_is_native(fapl_id, &is_native) < 0) + return EXIT_FAILURE; + + /* Currently, only the native VOL connector supports virtual datasets */ + if (is_native) + return EXIT_SUCCESS; + else + return EXIT_FAILURE; +} /* end main() */ |