From 851be6f4ec7e7022357a476f30d36757a4579662 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 28 Jun 2021 11:33:37 -0500 Subject: Most changes for fixing post open issues --- MANIFEST | 2 + fortran/test/t.c | 23 + fortran/test/t.h | 2 + fortran/test/tH5P_F03.F90 | 25 +- fortran/test/tf.F90 | 58 +- hl/test/h5hltest.h | 3 + hl/test/test_lite.c | 36 +- src/CMakeLists.txt | 1 + src/H5CX.c | 102 +++- src/H5CXprivate.h | 1 + src/H5Dprivate.h | 1 + src/H5F.c | 202 +------ src/H5Fefc.c | 132 +++-- src/H5Fint.c | 94 ++-- src/H5Fpkg.h | 6 +- src/H5Fprivate.h | 3 - src/H5Fquery.c | 23 - src/H5Ldeprec.c | 12 +- src/H5O.c | 4 +- src/H5Odeprec.c | 12 +- src/H5Pdxpl.c | 89 +++- src/H5Pprivate.h | 3 +- src/H5Rdeprec.c | 6 +- src/H5Rint.c | 54 +- src/H5T.c | 32 +- src/H5Tconv.c | 548 ++++++++++--------- src/H5Tpkg.h | 20 +- src/H5Tref.c | 210 ++++---- src/H5Tvlen.c | 112 ++-- src/H5VL.c | 2 +- src/H5VLcallback.c | 972 +++++++++++++++++++++++++++------- src/H5VLint.c | 65 ++- src/H5VLnative.c | 4 +- src/H5VLnative.h | 8 +- src/H5VLnative_file.c | 9 +- src/H5VLprivate.h | 13 +- src/H5VLtest.c | 10 +- src/H5private.h | 37 ++ src/Makefile.am | 2 +- test/Makefile.am | 2 +- test/cache_tagging.c | 158 +++--- test/efc.c | 663 ++++++++++------------- test/getname.c | 125 +++-- test/links.c | 226 ++++---- test/links_env.c | 128 +++-- test/objcopy.c | 759 +++++++++++++------------- test/testvdsswmr.sh.in | 18 +- test/tsohm.c | 55 +- test/vds.c | 92 ++-- test/vds_env.c | 325 ++++++------ test/vol.c | 154 +++++- tools/test/h5diff/testh5diff.sh.in | 282 +++++++++- tools/test/h5dump/testh5dumpvds.sh.in | 73 ++- tools/test/h5ls/testh5ls.sh.in | 63 ++- tools/test/h5ls/testh5lsvds.sh.in | 45 +- tools/test/h5repack/h5repack.sh.in | 64 ++- utils/CMakeLists.txt | 48 ++ utils/Makefile.am | 7 + 58 files changed, 3843 insertions(+), 2382 deletions(-) diff --git a/MANIFEST b/MANIFEST index 0615fd0..cab00a7 100644 --- a/MANIFEST +++ b/MANIFEST @@ -981,6 +981,7 @@ ./src/H5Pdapl.c ./src/H5Pdcpl.c ./src/H5Pdeprec.c +./src/H5Pdevelop.h ./src/H5Pdxpl.c ./src/H5Pencdec.c ./src/H5Pfapl.c @@ -2972,6 +2973,7 @@ # Utils directory ./utils/Makefile.am +./utils/vds_check_compat_vol.c # Mirror VFD utilities ./utils/mirror_vfd/Makefile.am diff --git a/fortran/test/t.c b/fortran/test/t.c index 6dce111..88d32ae 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 cae91ff..e2f072d 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1883,6 +1883,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"); @@ -1919,6 +1920,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); /* @@ -2069,17 +2075,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; @@ -2126,13 +2129,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; @@ -2195,17 +2196,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/src/CMakeLists.txt b/src/CMakeLists.txt index ff47c8e..dbd2c62 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}" ) diff --git a/src/H5CX.c b/src/H5CX.c index 01bf435..6a0608f 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -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: * * 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: + * + * 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 / * * 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: * * Programmer: Quincey Koziol - * Februrary 20, 2018 + * February 20, 2018 * *------------------------------------------------------------------------- */ @@ -2906,7 +2952,7 @@ H5CX_set_tag(haddr_t tag) * Return: * * Programmer: Quincey Koziol - * Februrary 20, 2018 + * February 20, 2018 * *------------------------------------------------------------------------- */ @@ -2936,7 +2982,7 @@ H5CX_set_ring(H5AC_ring_t ring) * Return: * * 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..20065d7 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -85,6 +85,7 @@ #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/H5F.c b/src/H5F.c index 5950d9e..05dbf99 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -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,9 +520,6 @@ 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 */ 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,9 @@ 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,7 +592,6 @@ 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 */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -660,14 +601,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,7 +620,6 @@ 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 */ @@ -703,12 +635,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 +651,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,9 +671,7 @@ 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 file_id = H5I_INVALID_HID; /* File ID */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_STATIC @@ -779,26 +696,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,7 +729,6 @@ 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 */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -836,14 +738,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,7 +758,6 @@ 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 */ @@ -880,12 +773,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 +789,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,7 +1342,6 @@ 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 */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -1472,16 +1351,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,7 +1370,6 @@ 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 */ @@ -1516,12 +1385,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 +1401,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 3f9a22f..50f8a7d 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,13 +213,11 @@ 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 */ 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 c2d3e77..4118beb 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 */ @@ -858,7 +885,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) { @@ -881,7 +908,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) { @@ -926,8 +953,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); @@ -939,7 +965,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 */ @@ -954,7 +979,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); @@ -975,7 +1000,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); @@ -990,7 +1015,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) @@ -1018,7 +1043,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); @@ -1121,7 +1146,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); @@ -1596,7 +1620,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) @@ -1630,15 +1653,15 @@ 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; +// 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 (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") @@ -2124,21 +2147,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..c9557d6 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -310,7 +310,6 @@ struct H5F_shared_t { /* 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 */ /* File space allocation information */ @@ -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 051abd9..7298b17 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -379,7 +379,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 */ @@ -442,7 +441,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 */ @@ -859,7 +857,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 04792b4..e57744c 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -1222,29 +1222,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, diff --git a/src/H5O.c b/src/H5O.c index 3ad14dd..6efc942 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -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/H5Pdxpl.c b/src/H5Pdxpl.c index 046b046..54ce509 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,13 @@ 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() */ @@ -2281,7 +2295,7 @@ herr_t H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper_t op, const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]) { - H5P_genplist_t *plist; /* Property list pointer */ + H5P_genplist_t *plist = NULL; /* Property list pointer */ H5S_t * space; /* Dataspace to hold selection */ hbool_t space_created = FALSE; /* Whether a new dataspace has been created */ hbool_t reset_prop_on_error = FALSE; /* Whether to reset the property on failure */ @@ -2379,3 +2393,76 @@ 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 6ebe5d3..42e1d6e 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..78b6b38 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,18 @@ 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() */ diff --git a/src/H5T.c b/src/H5T.c index 74b7655..5880553 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -253,7 +253,7 @@ 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.file_obj = NULL; \ dt->shared->u.atomic.u.r.loc = H5T_LOC_BADLOC; \ dt->shared->u.atomic.u.r.cls = NULL; \ } @@ -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 0c98633..f4796c8 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3161,283 +3161,283 @@ 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: - /* - * 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") - - /* Initialize source & destination strides */ - if (buf_stride) { - HDassert(buf_stride >= src->shared->size); - HDassert(buf_stride >= dst->shared->size); - H5_CHECK_OVERFLOW(buf_stride, size_t, ssize_t); - s_stride = d_stride = (ssize_t)buf_stride; - } /* end if */ - else { - H5_CHECK_OVERFLOW(src->shared->size, size_t, ssize_t); - H5_CHECK_OVERFLOW(dst->shared->size, size_t, ssize_t); - s_stride = (ssize_t)src->shared->size; - d_stride = (ssize_t)dst->shared->size; - } /* end else */ - if (bkg) { - if (bkg_stride) - b_stride = (ssize_t)bkg_stride; - else - b_stride = d_stride; - } /* end if */ - else - b_stride = 0; - - /* Get the size of the base types in src & dst */ - src_base_size = H5T_get_size(src->shared->parent); - dst_base_size = H5T_get_size(dst->shared->parent); - - /* Set up conversion path for base elements */ - if (NULL == (tpath = H5T_path_find(src->shared->parent, dst->shared->parent))) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "unable to convert between src and dest datatypes") - else if (!H5T_path_noop(tpath)) { - H5T_t *tsrc_cpy = NULL, *tdst_cpy = NULL; - - if (NULL == (tsrc_cpy = H5T_copy(src->shared->parent, H5T_COPY_ALL))) - 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, H5T_LOC_MEMORY) < 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, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set datatype location"); - - if (((tsrc_id = H5I_register(H5I_DATATYPE, tsrc_cpy, FALSE)) < 0) || - ((tdst_id = H5I_register(H5I_DATATYPE, tdst_cpy, FALSE)) < 0)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, - "unable to register types for conversion") - } /* end else-if */ - else - noop_conv = TRUE; - - /* Check if we need a temporary buffer for this conversion */ - if ((parent_is_vlen = H5T_detect_class(dst->shared->parent, H5T_VLEN, FALSE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_SYSTEM, FAIL, - "internal error when detecting variable-length class") - if (tpath->cdata.need_bkg || parent_is_vlen) { - /* Set up initial background buffer */ - tmp_buf_size = MAX(src_base_size, dst_base_size); - if (NULL == (tmp_buf = H5FL_BLK_CALLOC(vlen_seq, tmp_buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory allocation failed for type conversion") - } /* end if */ - - /* Get the allocation info */ - if (H5CX_get_vlen_alloc_info(&vl_alloc_info) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info") + case H5T_CONV_CONV: { + H5T_vlen_t *src_vl; /* Source VL type info */ + H5T_vlen_t *dst_vl; /* Destination VL type info */ - /* Set flags to indicate we are writing to or reading from the file */ - if (dst->shared->u.vlen.file != NULL) - write_to_file = TRUE; + /* + * 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; - /* Set the flag for nested VL case */ - if (write_to_file && parent_is_vlen && bkg != NULL) - nested = TRUE; + /* Initialize source & destination strides */ + if (buf_stride) { + HDassert(buf_stride >= src->shared->size); + HDassert(buf_stride >= dst->shared->size); + H5_CHECK_OVERFLOW(buf_stride, size_t, ssize_t); + s_stride = d_stride = (ssize_t)buf_stride; + } /* end if */ + else { + H5_CHECK_OVERFLOW(src->shared->size, size_t, ssize_t); + H5_CHECK_OVERFLOW(dst->shared->size, size_t, ssize_t); + s_stride = (ssize_t)src->shared->size; + d_stride = (ssize_t)dst->shared->size; + } /* end else */ + if (bkg) { + if (bkg_stride) + b_stride = (ssize_t)bkg_stride; + else + b_stride = d_stride; + } /* end if */ + else + b_stride = 0; - /* The outer loop of the type conversion macro, controlling which */ - /* direction the buffer is walked */ - while (nelmts > 0) { - /* Check if we need to go backwards through the buffer */ - if (d_stride > s_stride) { - /* Sanity check */ - HDassert(s_stride > 0); - HDassert(d_stride > 0); - HDassert(b_stride >= 0); + /* Get the size of the base types in src & dst */ + src_base_size = H5T_get_size(src->shared->parent); + dst_base_size = H5T_get_size(dst->shared->parent); - /* Compute the number of "safe" destination elements at */ - /* the end of the buffer (Those which don't overlap with */ - /* any source elements at the beginning of the buffer) */ - safe = - nelmts - (((nelmts * (size_t)s_stride) + ((size_t)d_stride - 1)) / (size_t)d_stride); - - /* If we're down to the last few elements, just wrap up */ - /* with a "real" reverse copy */ - if (safe < 2) { - s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride; - d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride; - b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride; - s_stride = -s_stride; - d_stride = -d_stride; - b_stride = -b_stride; + /* Set up conversion path for base elements */ + if (NULL == (tpath = H5T_path_find(src->shared->parent, dst->shared->parent))) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, + "unable to convert between src and dest datatypes") + else if (!H5T_path_noop(tpath)) { + H5T_t *tsrc_cpy = NULL, *tdst_cpy = NULL; + + if (NULL == (tsrc_cpy = H5T_copy(src->shared->parent, H5T_COPY_ALL))) + 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_vl->file_obj, H5T_LOC_MEMORY) < 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_vl->file_obj, H5T_LOC_MEMORY) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set datatype location"); + + if (((tsrc_id = H5I_register(H5I_DATATYPE, tsrc_cpy, FALSE)) < 0) || + ((tdst_id = H5I_register(H5I_DATATYPE, tdst_cpy, FALSE)) < 0)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, + "unable to register types for conversion") + } /* end else-if */ + else + noop_conv = TRUE; + + /* Check if we need a temporary buffer for this conversion */ + if ((parent_is_vlen = H5T_detect_class(dst->shared->parent, H5T_VLEN, FALSE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_SYSTEM, FAIL, + "internal error when detecting variable-length class") + if (tpath->cdata.need_bkg || parent_is_vlen) { + /* Set up initial background buffer */ + tmp_buf_size = MAX(src_base_size, dst_base_size); + if (NULL == (tmp_buf = H5FL_BLK_CALLOC(vlen_seq, tmp_buf_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for type conversion") + } /* end if */ - safe = nelmts; - } /* end if */ + /* Get the allocation info */ + if (H5CX_get_vlen_alloc_info(&vl_alloc_info) < 0) + 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_vl->file_obj != NULL) + write_to_file = TRUE; + + /* Set the flag for nested VL case */ + if (write_to_file && parent_is_vlen && bkg != NULL) + nested = TRUE; + + /* The outer loop of the type conversion macro, controlling which */ + /* direction the buffer is walked */ + while (nelmts > 0) { + /* Check if we need to go backwards through the buffer */ + if (d_stride > s_stride) { + /* Sanity check */ + HDassert(s_stride > 0); + HDassert(d_stride > 0); + HDassert(b_stride >= 0); + + /* Compute the number of "safe" destination elements at */ + /* the end of the buffer (Those which don't overlap with */ + /* any source elements at the beginning of the buffer) */ + safe = + nelmts - (((nelmts * (size_t)s_stride) + ((size_t)d_stride - 1)) / (size_t)d_stride); + + /* If we're down to the last few elements, just wrap up */ + /* with a "real" reverse copy */ + if (safe < 2) { + s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride; + d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride; + b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride; + s_stride = -s_stride; + d_stride = -d_stride; + b_stride = -b_stride; + + safe = nelmts; + } /* end if */ + else { + s = (uint8_t *)buf + (nelmts - safe) * (size_t)s_stride; + d = (uint8_t *)buf + (nelmts - safe) * (size_t)d_stride; + b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride; + } /* end else */ + } /* end if */ else { - s = (uint8_t *)buf + (nelmts - safe) * (size_t)s_stride; - d = (uint8_t *)buf + (nelmts - safe) * (size_t)d_stride; - b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride; + /* Single forward pass over all data */ + s = d = (uint8_t *)buf; + b = (uint8_t *)bkg; + safe = nelmts; } /* end else */ - } /* end if */ - else { - /* Single forward pass over all data */ - s = d = (uint8_t *)buf; - b = (uint8_t *)bkg; - safe = nelmts; - } /* end else */ - for (elmtno = 0; elmtno < safe; elmtno++) { - 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) - 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) - 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) - 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))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid source pointer") - } /* end if */ + for (elmtno = 0; elmtno < safe; elmtno++) { + hbool_t is_nil; /* Whether sequence is "nil" */ + + /* Check for "nil" source sequence */ + 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_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 src_size, dst_size; /*source & destination total size in bytes*/ - - src_size = seq_len * src_base_size; - dst_size = seq_len * dst_base_size; - - /* Check if conversion buffer is large enough, resize if - * necessary. If the SEQ_LEN is 0, allocate a minimal size buffer. - */ - if (!seq_len && !conv_buf) { - conv_buf_size = H5T_VLEN_MIN_CONF_BUF_SIZE; - if (NULL == (conv_buf = H5FL_BLK_CALLOC(vlen_seq, conv_buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for type conversion") + size_t seq_len; /* The number of elements in the current sequence */ + + /* Get length of element sequences */ + 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_vl->cls->getptr))(s))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid source pointer") } /* end if */ - else if (conv_buf_size < MAX(src_size, dst_size)) { - /* Only allocate conversion buffer in H5T_VLEN_MIN_CONF_BUF_SIZE increments */ - conv_buf_size = ((MAX(src_size, dst_size) / H5T_VLEN_MIN_CONF_BUF_SIZE) + 1) * - H5T_VLEN_MIN_CONF_BUF_SIZE; - if (NULL == (conv_buf = H5FL_BLK_REALLOC(vlen_seq, conv_buf, conv_buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for type conversion") - HDmemset(conv_buf, 0, conv_buf_size); - } /* 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) - HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data") - } /* end else */ + else { + size_t src_size, dst_size; /*source & destination total size in bytes*/ - if (!noop_conv) { - /* Check if temporary buffer is large enough, resize if necessary */ - /* (Chain off the conversion buffer size) */ - if (tmp_buf && tmp_buf_size < conv_buf_size) { - /* Set up initial background buffer */ - tmp_buf_size = conv_buf_size; - if (NULL == (tmp_buf = H5FL_BLK_REALLOC(vlen_seq, tmp_buf, tmp_buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for type conversion") - HDmemset(tmp_buf, 0, tmp_buf_size); - } /* end if */ + src_size = seq_len * src_base_size; + dst_size = seq_len * dst_base_size; + + /* Check if conversion buffer is large enough, resize if + * necessary. If the SEQ_LEN is 0, allocate a minimal size buffer. + */ + if (!seq_len && !conv_buf) { + conv_buf_size = H5T_VLEN_MIN_CONF_BUF_SIZE; + if (NULL == (conv_buf = H5FL_BLK_CALLOC(vlen_seq, conv_buf_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for type conversion") + } /* end if */ + else if (conv_buf_size < MAX(src_size, dst_size)) { + /* Only allocate conversion buffer in H5T_VLEN_MIN_CONF_BUF_SIZE increments */ + conv_buf_size = ((MAX(src_size, dst_size) / H5T_VLEN_MIN_CONF_BUF_SIZE) + 1) * + H5T_VLEN_MIN_CONF_BUF_SIZE; + if (NULL == (conv_buf = H5FL_BLK_REALLOC(vlen_seq, conv_buf, conv_buf_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for type conversion") + HDmemset(conv_buf, 0, conv_buf_size); + } /* end else-if */ + + /* Read in VL sequence */ + 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 */ + + if (!noop_conv) { + /* Check if temporary buffer is large enough, resize if necessary */ + /* (Chain off the conversion buffer size) */ + if (tmp_buf && tmp_buf_size < conv_buf_size) { + /* Set up initial background buffer */ + tmp_buf_size = conv_buf_size; + if (NULL == (tmp_buf = H5FL_BLK_REALLOC(vlen_seq, tmp_buf, tmp_buf_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for type conversion") + HDmemset(tmp_buf, 0, tmp_buf_size); + } /* end if */ - /* If we are writing and there is a nested VL type, read - * the sequence into the background buffer */ - if (nested) { - /* Sanity check */ - 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) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "bad sequence length") - - /* Read sequence if length > 0 */ - if (bg_seq_len > 0) { - if (tmp_buf_size < (bg_seq_len * MAX(src_base_size, dst_base_size))) { - tmp_buf_size = (bg_seq_len * MAX(src_base_size, dst_base_size)); - if (NULL == - (tmp_buf = H5FL_BLK_REALLOC(vlen_seq, tmp_buf, tmp_buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for type conversion") - HDmemset(tmp_buf, 0, tmp_buf_size); + /* If we are writing and there is a nested VL type, read + * the sequence into the background buffer */ + if (nested) { + /* Sanity check */ + HDassert(write_to_file); + + /* Get length of background element sequence */ + 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 */ + if (bg_seq_len > 0) { + if (tmp_buf_size < (bg_seq_len * MAX(src_base_size, dst_base_size))) { + tmp_buf_size = (bg_seq_len * MAX(src_base_size, dst_base_size)); + if (NULL == + (tmp_buf = H5FL_BLK_REALLOC(vlen_seq, tmp_buf, tmp_buf_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for type conversion") + HDmemset(tmp_buf, 0, tmp_buf_size); + } /* end if */ + + /* Read in background VL sequence */ + 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 */ - /* 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) - HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data") + /* If the sequence gets shorter, pad out the original sequence with zeros */ + if (bg_seq_len < seq_len) + HDmemset((uint8_t *)tmp_buf + dst_base_size * bg_seq_len, 0, + (seq_len - bg_seq_len) * dst_base_size); } /* end if */ - /* If the sequence gets shorter, pad out the original sequence with zeros */ - if (bg_seq_len < seq_len) - HDmemset((uint8_t *)tmp_buf + dst_base_size * bg_seq_len, 0, - (seq_len - bg_seq_len) * dst_base_size); + /* Convert VL sequence */ + if (H5T_convert(tpath, tsrc_id, tdst_id, seq_len, (size_t)0, (size_t)0, conv_buf, + tmp_buf) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") } /* end if */ - /* Convert VL sequence */ - if (H5T_convert(tpath, tsrc_id, tdst_id, seq_len, (size_t)0, (size_t)0, conv_buf, - tmp_buf) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") - } /* 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) - HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data") - - if (!noop_conv) { - /* For nested VL case, free leftover heap objects from the deeper level if the - * length of new data elements is shorter than the old data elements.*/ - if (nested && seq_len < bg_seq_len) { - const uint8_t *tmp; - size_t u; - - /* Sanity check */ - HDassert(write_to_file); - - 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) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, - "unable to remove heap object") - } /* end for */ - } /* end if */ - } /* end if */ - } /* end else */ - - /* Advance pointers */ - s += s_stride; - d += d_stride; - b += b_stride; - } /* end for */ + /* Write sequence to destination location */ + 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) { + /* For nested VL case, free leftover heap objects from the deeper level if the + * length of new data elements is shorter than the old data elements.*/ + if (nested && seq_len < bg_seq_len) { + const uint8_t *tmp; + size_t u; + + /* Sanity check */ + HDassert(write_to_file); + + 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_vl->cls->del))(dst_vl->file_obj, tmp) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove heap object") + } /* end for */ + } /* end if */ + } /* end if */ + } /* end else */ + + /* Advance pointers */ + s += s_stride; + d += d_stride; + b += b_stride; + } /* end for */ - /* Decrement number of elements left to convert */ - nelmts -= safe; - } /* end while */ + /* Decrement number of elements left to convert */ + nelmts -= safe; + } /* end while */ - /* Release the temporary datatype IDs used */ - if (tsrc_id >= 0) - H5I_dec_ref(tsrc_id); - if (tdst_id >= 0) - H5I_dec_ref(tdst_id); + /* Release the temporary datatype IDs used */ + if (tsrc_id >= 0) + H5I_dec_ref(tsrc_id); + if (tdst_id >= 0) + H5I_dec_ref(tdst_id); + } /* end case */ break; default: /* Some other command we don't know about yet.*/ @@ -3667,13 +3667,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 +3750,17 @@ 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) - HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, - "can't set reference data to 'nil'") + 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 +3772,19 @@ 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..877aa21 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; @@ -307,7 +309,7 @@ typedef struct H5T_vlen_t { 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) */ + 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; diff --git a/src/H5Tref.c b/src/H5Tref.c index cac8cf6..85c62c0 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -70,39 +70,39 @@ 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, +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, 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_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_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, const void *src_buf, +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 +156,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 +168,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 +188,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 +219,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 +239,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 +249,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 +267,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 +277,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 +298,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 +327,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 +357,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 +384,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 +406,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 +423,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 +431,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 +449,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 +523,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 +546,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 +556,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 +566,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 +637,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 +658,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 +668,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 +677,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 +726,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 +754,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 +764,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 +785,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 +803,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 +813,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 +825,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 +840,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 +857,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 +906,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 +917,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 +933,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 +950,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 +965,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 +982,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 +999,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 +1016,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 +1027,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 +1036,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 +1045,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 +1068,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 +1078,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 +1086,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 +1095,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 +1116,8 @@ 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 +1125,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 +1134,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 +1143,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 +1168,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 +1179,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 +1188,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 +1197,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 +1220,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 +1241,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 +1271,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 +1282,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 +1292,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 +1301,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..068ec3b 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, +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, const void *_vl); +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 */ diff --git a/src/H5VL.c b/src/H5VL.c index 2cece6d..d3e7c94 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -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 */ diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index baedbf1..cef0b6f 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,49 @@ 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 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_open_ctx_t; + /********************/ /* Package Typedefs */ /********************/ @@ -70,8 +115,10 @@ 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_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, @@ -219,7 +266,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 +278,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 +297,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 +309,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 +328,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 +340,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 +359,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 +371,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 */ /*------------------------------------------------------------------------- @@ -372,6 +419,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 bounce routine */ + if ((*wrap_op)(wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute bounce 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 +540,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 +552,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 +702,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 +710,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 +728,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 +751,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 +769,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 +777,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 +796,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 +812,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 +869,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 +881,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 +934,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 +948,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 +1001,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 +1015,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 +1065,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 +1077,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 +1149,36 @@ 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 +1193,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_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 +1207,27 @@ 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; + + /* Invoke bounce 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 bounce 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 +1298,35 @@ 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 +1340,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_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 +1353,24 @@ 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; + + /* Invoke bounce 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 bounce 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() */ /*------------------------------------------------------------------------- @@ -1255,9 +1451,12 @@ 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 */ + 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_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 +1465,46 @@ 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") + /* 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 VOL routine */ if (H5VL__attr_read(obj, cls, mem_type_id, buf, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read attribute") done: - FUNC_LEAVE_API_NOINIT(ret_value) + /* 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_API_WRAPPER(ret_value) } /* end H5VLattr_read() */ /*------------------------------------------------------------------------- @@ -1354,9 +1587,12 @@ H5VLattr_write(void *obj, hid_t connector_id, hid_t mem_type_id, const void *buf void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ + 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_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,12 +1601,46 @@ 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") + /* 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 VOL routine */ if (H5VL__attr_write(obj, cls, mem_type_id, buf, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write attribute") done: - FUNC_LEAVE_API_NOINIT(ret_value) + /* 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_API_WRAPPER(ret_value) } /* end H5VLattr_write() */ /*------------------------------------------------------------------------- @@ -1451,9 +1721,12 @@ 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 */ + 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_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 +1737,46 @@ 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") + /* 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 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") done: - FUNC_LEAVE_API_NOINIT(ret_value) + /* 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_API_WRAPPER(ret_value) } /* end H5VLattr_get() */ /*------------------------------------------------------------------------- @@ -1558,7 +1865,7 @@ H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto 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 */ @@ -1573,7 +1880,7 @@ H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto 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() */ /*------------------------------------------------------------------------- @@ -1659,7 +1966,7 @@ H5VLattr_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid 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 */ @@ -1674,7 +1981,7 @@ H5VLattr_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid 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() */ /*------------------------------------------------------------------------- @@ -1793,7 +2100,7 @@ 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 */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ @@ -1807,7 +2114,7 @@ H5VLattr_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close attribute") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_close() */ /*------------------------------------------------------------------------- @@ -1899,7 +2206,7 @@ H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connect 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); @@ -1915,7 +2222,7 @@ H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connect HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create dataset") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_create() */ /*------------------------------------------------------------------------- @@ -2002,7 +2309,7 @@ H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector 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 */ @@ -2016,7 +2323,7 @@ H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open dataset") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_open() */ /*------------------------------------------------------------------------- @@ -2103,7 +2410,7 @@ H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_spa 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); @@ -2118,7 +2425,7 @@ H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_spa HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_read() */ /*------------------------------------------------------------------------- @@ -2205,7 +2512,7 @@ H5VLdataset_write(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_sp 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); @@ -2220,7 +2527,7 @@ H5VLdataset_write(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_sp HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_write() */ /*------------------------------------------------------------------------- @@ -2305,7 +2612,7 @@ H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_args_t *args, hi 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 */ @@ -2319,7 +2626,7 @@ H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_args_t *args, hi HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset get callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_get() */ /*------------------------------------------------------------------------- @@ -2405,7 +2712,7 @@ H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_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) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -2419,7 +2726,7 @@ H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_args_t HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_specific() */ /*------------------------------------------------------------------------- @@ -2504,7 +2811,7 @@ H5VLdataset_optional(void *obj, 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) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -2518,7 +2825,7 @@ H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_optional() */ /*------------------------------------------------------------------------- @@ -2654,7 +2961,7 @@ 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 */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ @@ -2668,7 +2975,7 @@ H5VLdataset_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close dataset") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_close() */ /*------------------------------------------------------------------------- @@ -2758,7 +3065,7 @@ H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec 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); @@ -2774,7 +3081,7 @@ H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to commit datatype") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_commit() */ /*------------------------------------------------------------------------- @@ -2861,7 +3168,7 @@ H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto 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 */ @@ -2875,7 +3182,7 @@ H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open datatype") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_open() */ /*------------------------------------------------------------------------- @@ -2960,7 +3267,7 @@ H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_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) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -2974,7 +3281,7 @@ H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_args_t *args, HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_get() */ /*------------------------------------------------------------------------- @@ -3060,7 +3367,7 @@ H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_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) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -3074,7 +3381,7 @@ H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_args HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_specific() */ /*------------------------------------------------------------------------- @@ -3203,7 +3510,7 @@ H5VLdatatype_optional(void *obj, 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) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -3217,7 +3524,7 @@ H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_optional() */ /*------------------------------------------------------------------------- @@ -3347,7 +3654,7 @@ H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*ou 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 */ @@ -3361,7 +3668,7 @@ H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*ou HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_close() */ /*------------------------------------------------------------------------- @@ -3405,27 +3712,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 +3794,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 */ + 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 +3847,51 @@ 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() */ /*------------------------------------------------------------------------- @@ -3607,26 +4030,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 @@ -3634,13 +4074,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; @@ -3659,7 +4099,13 @@ 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, + /* 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, @@ -3672,6 +4118,44 @@ 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() */ @@ -3689,20 +4173,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 */ + 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") @@ -3711,8 +4226,51 @@ 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() */ /*------------------------------------------------------------------------- @@ -3795,7 +4353,7 @@ H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_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 */ @@ -3809,7 +4367,7 @@ H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_args_t *args, hid_t dx HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute file get callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_get() */ /*------------------------------------------------------------------------- @@ -3856,6 +4414,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 */ @@ -3903,7 +4462,44 @@ 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") @@ -3930,7 +4526,7 @@ H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_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) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -3942,7 +4538,7 @@ H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_args_t *args HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file specific callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_specific() */ /*------------------------------------------------------------------------- @@ -4026,7 +4622,7 @@ H5VLfile_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid 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 */ @@ -4040,7 +4636,7 @@ H5VLfile_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_optional() */ /*------------------------------------------------------------------------- @@ -4170,7 +4766,7 @@ 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 */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ @@ -4184,7 +4780,7 @@ H5VLfile_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_close() */ /*------------------------------------------------------------------------- @@ -4272,7 +4868,7 @@ H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector 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); @@ -4288,7 +4884,7 @@ H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create group") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_create() */ /*------------------------------------------------------------------------- @@ -4375,7 +4971,7 @@ H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i 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 */ @@ -4389,7 +4985,7 @@ H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_open() */ /*------------------------------------------------------------------------- @@ -4472,7 +5068,7 @@ H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_args_t *args, hid_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", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -4486,7 +5082,7 @@ H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_args_t *args, hid_t HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_get() */ /*------------------------------------------------------------------------- @@ -4571,7 +5167,7 @@ H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_args_t *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) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -4585,7 +5181,7 @@ H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_args_t *ar HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_specific() */ /*------------------------------------------------------------------------- @@ -4672,7 +5268,7 @@ H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hi 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 */ @@ -4687,7 +5283,7 @@ H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hi 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() */ /*------------------------------------------------------------------------- @@ -4817,7 +5413,7 @@ 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 */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ @@ -4831,7 +5427,7 @@ H5VLgroup_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close group") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_close() */ /*------------------------------------------------------------------------- @@ -4932,7 +5528,7 @@ H5VLlink_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_ 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 */ @@ -4944,7 +5540,7 @@ H5VLlink_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_create() */ /*------------------------------------------------------------------------- @@ -5038,7 +5634,7 @@ H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj 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) H5TRACE9("e", "*x*#*x*#iiiix", src_obj, loc_params1, dst_obj, loc_params2, connector_id, lcpl_id, lapl_id, dxpl_id, req); @@ -5051,7 +5647,7 @@ H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_copy() */ /*------------------------------------------------------------------------- @@ -5145,7 +5741,7 @@ H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj 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) H5TRACE9("e", "*x*#*x*#iiiix", src_obj, loc_params1, dst_obj, loc_params2, connector_id, lcpl_id, lapl_id, dxpl_id, req); @@ -5158,7 +5754,7 @@ H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "unable to move object") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_move() */ /*------------------------------------------------------------------------- @@ -5244,7 +5840,7 @@ H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, 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) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -5258,7 +5854,7 @@ H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_get() */ /*------------------------------------------------------------------------- @@ -5347,7 +5943,7 @@ H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto 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 */ @@ -5362,7 +5958,7 @@ H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto 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() */ /*------------------------------------------------------------------------- @@ -5448,7 +6044,7 @@ H5VLlink_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto 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 */ @@ -5462,7 +6058,7 @@ H5VLlink_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_optional() */ /*------------------------------------------------------------------------- @@ -5610,7 +6206,7 @@ H5VLobject_open(void *obj, const H5VL_loc_params_t *params, 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) H5TRACE6("*x", "*x*#i*Itix", obj, params, connector_id, opened_type, dxpl_id, req); /* Check args and get class pointer */ @@ -5624,7 +6220,7 @@ H5VLobject_open(void *obj, const H5VL_loc_params_t *params, hid_t connector_id, HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open object") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLobject_open() */ /*------------------------------------------------------------------------- @@ -5720,7 +6316,7 @@ H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const ch 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); @@ -5736,7 +6332,7 @@ H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const ch HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLobject_copy() */ /*------------------------------------------------------------------------- @@ -5822,7 +6418,7 @@ H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_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) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -5836,7 +6432,7 @@ H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object get callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLobject_get() */ /*------------------------------------------------------------------------- @@ -5925,7 +6521,7 @@ H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec 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 */ @@ -5940,7 +6536,7 @@ H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute object specific callback"); done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLobject_specific() */ /*------------------------------------------------------------------------- @@ -6026,7 +6622,7 @@ H5VLobject_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec 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 */ @@ -6040,7 +6636,7 @@ H5VLobject_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLobject_optional() */ /*------------------------------------------------------------------------- @@ -6197,7 +6793,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 */ @@ -6215,7 +6811,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() */ /*------------------------------------------------------------------------- @@ -6269,7 +6865,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 */ @@ -6285,7 +6881,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() */ /*------------------------------------------------------------------------- @@ -6373,7 +6969,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 */ @@ -6385,7 +6981,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() */ /*------------------------------------------------------------------------- @@ -6466,7 +7062,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 */ @@ -6478,7 +7074,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() */ /*------------------------------------------------------------------------- @@ -6561,7 +7157,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 */ @@ -6573,7 +7169,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() */ /*------------------------------------------------------------------------- @@ -6653,7 +7249,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 */ @@ -6665,7 +7261,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() */ /*------------------------------------------------------------------------- @@ -6747,7 +7343,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 */ @@ -6760,7 +7356,7 @@ H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_args_t "unable to execute asynchronous request specific callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLrequest_specific() */ /*------------------------------------------------------------------------- @@ -6842,7 +7438,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 */ @@ -6855,7 +7451,7 @@ H5VLrequest_optional(void *req, hid_t connector_id, H5VL_optional_args_t *args) "unable to execute asynchronous request optional callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLrequest_optional() */ /*------------------------------------------------------------------------- @@ -6972,7 +7568,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 */ @@ -6984,7 +7580,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() */ /*------------------------------------------------------------------------- @@ -7068,7 +7664,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 */ @@ -7082,7 +7678,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() */ /*------------------------------------------------------------------------- @@ -7163,7 +7759,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 */ @@ -7177,7 +7773,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() */ /*------------------------------------------------------------------------- @@ -7260,7 +7856,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 */ @@ -7274,7 +7870,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() */ /*------------------------------------------------------------------------- @@ -7357,7 +7953,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 */ @@ -7371,7 +7967,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() */ /*------------------------------------------------------------------------- @@ -7479,7 +8075,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 */ @@ -7495,7 +8091,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() */ /*------------------------------------------------------------------------- @@ -7584,7 +8180,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 */ @@ -7602,7 +8198,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() */ /*------------------------------------------------------------------------- @@ -7691,7 +8287,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 */ @@ -7709,7 +8305,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() */ /*------------------------------------------------------------------------- @@ -7792,7 +8388,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 */ @@ -7806,5 +8402,5 @@ H5VLoptional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dx HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute 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 70c8112..5fe2c5a 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -917,7 +917,8 @@ 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 */ @@ -940,8 +941,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: @@ -1041,7 +1041,7 @@ done: * *------------------------------------------------------------------------- */ -hsize_t +size_t H5VL_object_inc_rc(H5VL_object_t *vol_obj) { FUNC_ENTER_NOAPI_NOERR_NOFS @@ -1086,6 +1086,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 @@ -1099,7 +1152,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 */ @@ -1114,7 +1167,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..5a9c1d3 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..6550387 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -97,10 +97,11 @@ 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_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); @@ -206,10 +207,8 @@ 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 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, diff --git a/src/H5VLtest.c b/src/H5VLtest.c index 1f99ce5..0769fff 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 */ @@ -94,3 +97,4 @@ H5VL__reparse_def_vol_conn_variable_test(void) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__reparse_def_vol_conn_variable_test() */ + diff --git a/src/H5private.h b/src/H5private.h index ed17d4c..4f74d16 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2092,6 +2092,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 @@ -2250,6 +2251,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 */ \ @@ -2507,6 +2530,20 @@ 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) diff --git a/test/Makefile.am b/test/Makefile.am index d465664..2a25450 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -211,7 +211,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 06de174..759112e 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -4292,6 +4292,7 @@ check_external_link_open_tags(void) #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,94 @@ 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) - TEST_ERROR; + /* ================== */ + /* 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. */ diff --git a/test/efc.c b/test/efc.c index e61eb1b..12636b6 100644 --- a/test/efc.c +++ b/test/efc.c @@ -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,9 @@ 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 +537,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 +550,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 +585,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 +607,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 +633,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 +669,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 +691,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 +761,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 +788,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 +799,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 +819,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 +838,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 +860,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 +875,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 +897,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 +923,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 +953,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 +981,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 +1019,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 +1057,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 +1085,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 +1129,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 +1187,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 +1231,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 +1304,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 +1356,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 +1409,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 +1460,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 +1521,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 +1585,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 +1672,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 +1756,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 +1786,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 +1881,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 +1911,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 +1988,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 +2088,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 +2185,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 +2217,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 +2249,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 +2259,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 +2361,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 +2371,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 +2439,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 +2474,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 +2484,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 +2537,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 */ + 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 +2635,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 200c426..75a5841 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 f022783..9222666 100644 --- a/test/links.c +++ b/test/links.c @@ -16673,6 +16673,7 @@ 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 */ + hbool_t is_native; /* Whether native VOL connector is being used */ herr_t status; /* Generic return value */ if (new_format) @@ -16680,6 +16681,15 @@ obj_exists(hid_t fapl, hbool_t new_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); @@ -16772,8 +16782,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) @@ -16799,8 +16811,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 */ @@ -16824,8 +16838,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 */ @@ -16850,8 +16866,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) @@ -16874,8 +16892,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 */ @@ -16901,8 +16921,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 */ @@ -16918,8 +16940,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) @@ -16934,8 +16958,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) @@ -16950,8 +16976,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) @@ -16967,8 +16995,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) @@ -22572,6 +22602,7 @@ main(void) for (new_format = FALSE; new_format <= TRUE; new_format++) { hid_t my_fapl; + hbool_t is_native; /* Whether native VOL connector is being used */ /* Check for FAPL to use */ if (new_format) { @@ -22611,88 +22642,99 @@ main(void) nerrors += test_deprec(my_fapl, new_format); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* tests for external link */ - /* Test external file cache first, so it sees the default efc setting on the fapl - */ - nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; - - /* This test cannot run with the EFC because it assumes that an - * intermediate file is not held open - */ - nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; - - /* This test cannot run with the EFC because the EFC cannot currently - * reopen a cached file with a different intent - */ - nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + if (H5VL_fapl_is_native(my_fapl, &is_native) < 0) + TEST_ERROR; - /* Try external link tests both with and without the external file cache */ - for (efc = FALSE; efc <= TRUE; efc++) { - if (efc) { - if (H5Pset_elink_file_cache_size(my_fapl, 8) < 0) - TEST_ERROR - HDprintf("\n---Testing with external file cache---\n"); - } /* end if */ - else { - if (H5Pset_elink_file_cache_size(my_fapl, 0) < 0) - TEST_ERROR - HDprintf("\n---Testing without external file cache---\n"); - } /* end else */ + /* Skip tests external link tests when using non-native VOL connectors */ + if (!is_native) { + HDputs(" External link tests skipped - not using native VOL connector"); + } + else { + /* tests for external link */ + /* Test external file cache first, so it sees the default efc setting on the fapl + */ + nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; + + /* This test cannot run with the EFC because it assumes that an + * intermediate file is not held open + */ + nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; + + /* This test cannot run with the EFC because the EFC cannot currently + * reopen a cached file with a different intent + */ + nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + + /* Try external link tests both with and without the external file cache */ + for (efc = FALSE; efc <= TRUE; efc++) { + if (efc) { + if (H5Pset_elink_file_cache_size(my_fapl, 8) < 0) + TEST_ERROR + HDprintf("\n---Testing with external file cache---\n"); + } /* end if */ + else { + if (H5Pset_elink_file_cache_size(my_fapl, 0) < 0) + TEST_ERROR + HDprintf("\n---Testing without external file cache---\n"); + } /* end else */ - nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += external_link_root_deprec(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_root_deprec(my_fapl, new_format) < 0 ? 1 : 0; #endif /* H5_NO_DEPRECATED_SYMBOLS */ - nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += external_link_query_deprec(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_query_deprec(my_fapl, new_format) < 0 ? 1 : 0; #endif /* H5_NO_DEPRECATED_SYMBOLS */ - nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += external_link_closing_deprec(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_closing_deprec(my_fapl, new_format) < 0 ? 1 : 0; #endif /* H5_NO_DEPRECATED_SYMBOLS */ - nerrors += external_link_endian(new_format) < 0 ? 1 : 0; - nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; - - nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_endian(new_format) < 0 ? 1 : 0; + nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; + + nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0; #ifdef H5_HAVE_WINDOW_PATH - nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0; #endif - nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; - } /* with/without external file cache */ + nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; + } /* with/without external file cache */ + } /* These tests assume that external links are a form of UD links, * so assume that everything that passed for external links diff --git a/test/links_env.c b/test/links_env.c index 590be20..4e5721e 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 */ + 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 e01083d..f833898 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -8339,11 +8339,11 @@ 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 */ + 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; @@ -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,352 @@ 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 + /* Check for operating with native (only) VOL connector */ + is_native = FALSE; + if (H5VL_fapl_is_native(src_fapl, &is_native) < 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; - - /* 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 - 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) + /* 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 + + /* 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 9673aa3..7a93ab0 100644 --- a/test/testvdsswmr.sh.in +++ b/test/testvdsswmr.sh.in @@ -92,7 +92,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_check_compat_vol tool from $(topdir)/utils +../utils/vds_check_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 fcbb06a..3b68708 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -21,9 +21,10 @@ * This file needs to access private information from the H5F package. * This file also needs to access the file testing code. */ -#define H5F_FRIEND /* suppress error about including H5Fpkg */ +#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 */ /*------------------------------------------------------------------------- diff --git a/test/vds.c b/test/vds.c index 88ac4eb..d0ead4c 100644 --- a/test/vds.c +++ b/test/vds.c @@ -12289,12 +12289,18 @@ 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 */ int nerrors = 0; /* Testing setup */ 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 */ @@ -12340,53 +12346,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 58d90fc..633b7a3 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: diff --git a/test/vol.c b/test/vol.c index c7586d5..6073671 100644 --- a/test/vol.c +++ b/test/vol.c @@ -28,7 +28,14 @@ #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" @@ -2097,6 +2104,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) @@ -2131,6 +2282,7 @@ main(void) nerrors += test_basic_link_operation() < 0 ? 1 : 0; nerrors += test_basic_datatype_operation() < 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..f727c7a 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_CHECK_COMPAT_VOL=../../../utils/vds_check_compat_vol # The vds_check_compat_vol tool name +VDS_CHECK_COMPAT_VOL_BIN=`pwd`/$VDS_CHECK_COMPAT_VOL # The path of the vds_check_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_check_compat_vol tool from $(topdir)/utils +$VDS_CHECK_COMPAT_VOL_BIN +COMPAT_VOL=$? + # ############################################################################ # # Common usage # ############################################################################ @@ -966,22 +975,70 @@ 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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +1068,95 @@ 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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +1174,37 @@ 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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +1220,15 @@ 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 +# Note: Requires VOL connector that supports external links +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 +1246,15 @@ 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 / / +# Note: Requires VOL connector that supports external links +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 +1271,51 @@ 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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +1324,26 @@ 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 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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 +1419,28 @@ 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 + +# Note: Requires VOL connector that supports external links +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 + +# Note: Requires VOL connector that supports external links +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..e93b67b 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_CHECK_COMPAT_VOL=../../../utils/vds_check_compat_vol # The vds_check_compat_vol tool name +VDS_CHECK_COMPAT_VOL_BIN=`pwd`/$VDS_CHECK_COMPAT_VOL # The path of the vds_check_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,55 @@ 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_check_compat_vol tool from $(topdir)/utils +$VDS_CHECK_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 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST tvds-1.ddl --enable-error-stack 1_vds.h5 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST tvds-2.ddl --enable-error-stack 2_vds.h5 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST tvds-3_1.ddl --enable-error-stack 3_1_vds.h5 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST tvds-3_2.ddl --enable-error-stack 3_2_vds.h5 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST tvds-4.ddl --enable-error-stack 4_vds.h5 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST tvds-5.ddl --enable-error-stack 5_vds.h5 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST vds-first.ddl --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST vds-gap1.ddl -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5 + # Note: Requires VOL connector that supports external links + 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 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST tvds_layout-1.ddl -p --enable-error-stack 1_vds.h5 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST tvds_layout-2.ddl -p --enable-error-stack 2_vds.h5 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST tvds_layout-3_1.ddl -p --enable-error-stack 3_1_vds.h5 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST tvds_layout-3_2.ddl -p --enable-error-stack 3_2_vds.h5 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST tvds_layout-4.ddl -p --enable-error-stack 4_vds.h5 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST tvds_layout-5.ddl -p --enable-error-stack 5_vds.h5 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST vds_layout-eiger.ddl -p --enable-error-stack vds-eiger.h5 + # Note: Requires VOL connector that supports external links + 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..4e86395 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_CHECK_COMPAT_VOL=../../../utils/vds_check_compat_vol # The vds_check_compat_vol tool name +VDS_CHECK_COMPAT_VOL_BIN=`pwd`/$VDS_CHECK_COMPAT_VOL # The path of the vds_check_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_check_compat_vol tool from $(topdir)/utils +$VDS_CHECK_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,41 @@ 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 +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST textlinksrc-1.ls 0 -w80 --follow-symlinks -r textlinksrc.h5 +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST textlinksrc-2.ls 0 -w80 --follow-symlinks -rv textlinksrc.h5/ext_link5 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST textlinksrc-6.ls 0 -w80 --follow-symlinks textlinksrc.h5 +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST textlinksrc-7.ls 0 -w80 --follow-symlinks textlinksrc.h5/ext_link1 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST textlinksrc-1-old.ls 0 -w80 -Er textlinksrc.h5 +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST textlinksrc-2-old.ls 0 -w80 -Erv textlinksrc.h5/ext_link5 +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST textlinksrc-3-old.ls 0 -w80 -Er textlinksrc.h5/ext_link1 +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST textlinksrc-6-old.ls 0 -w80 -E textlinksrc.h5 +# Note: Requires VOL connector that supports external links +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 +# Note: Requires VOL connector that supports external links +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..cfdfa6b 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_CHECK_COMPAT_VOL=../../../utils/vds_check_compat_vol # The vds_check_compat_vol tool name +VDS_CHECK_COMPAT_VOL_BIN=`pwd`/$VDS_CHECK_COMPAT_VOL # The path of the vds_check_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,27 @@ 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_check_compat_vol tool from $(topdir)/utils +$VDS_CHECK_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 +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST tvds-1.ls 0 -w80 -v -S 1_vds.h5 +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST tvds-2.ls 0 -w80 -v -S 2_vds.h5 +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST tvds-3_1.ls 0 -w80 -v -S 3_1_vds.h5 +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST tvds-3_2.ls 0 -w80 -v -S 3_2_vds.h5 +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST tvds-4.ls 0 -w80 -v -S 4_vds.h5 +# Note: Requires VOL connector that supports external links +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 3756a95..9b826b3 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_CHECK_COMPAT_VOL=../../../utils/vds_check_compat_vol # The vds_check_compat_vol tool name +VDS_CHECK_COMPAT_VOL_BIN=`pwd`/$VDS_CHECK_COMPAT_VOL # The path of the vds_check_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 ### @@ -1316,6 +1339,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_check_compat_vol tool from $(topdir)/utils +$VDS_CHECK_COMPAT_VOL_BIN +COMPAT_VOL=$? + TOOLTEST_HELP h5repack-help.txt -h # copy files (these files have no filters) @@ -1732,31 +1762,36 @@ 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 + # Note: Requires VOL connector that supports external links + 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 + # Note: Requires VOL connector that supports external links + 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 + # Note: Requires VOL connector that supports external links + 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 + # Note: Requires VOL connector that supports external links + 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 + # Note: Requires VOL connector that supports external links + COMPAT_VOL_TEST VERIFY_LAYOUT_VDS vds_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI fi ################################################################ @@ -1789,11 +1824,15 @@ 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 - -TOOLTESTSV h5copy_extlinks_src-merge h5copy_extlinks_src.h5 --merge +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST TOOLTEST_DUMP textlinkfar-base textlinkfar.h5 --enable-error-stack +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST TOOLTEST_DUMP textlinksrc-base textlinksrc.h5 --enable-error-stack +# Note: Requires VOL connector that supports external links +COMPAT_VOL_TEST TOOLTEST_DUMP textlinktar-base textlinktar.h5 --enable-error-stack + +# Note: Requires VOL connector that supports external links +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 @@ -1810,7 +1849,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/CMakeLists.txt b/utils/CMakeLists.txt index 2d5626e..a1093ae 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -2,3 +2,51 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_UTILS C) add_subdirectory (mirror_vfd) + +#----------------------------------------------------------------------------- +# Add the vds_check_compat_vol executable +#----------------------------------------------------------------------------- + +set (vds_check_compat_vol_SOURCES ${HDF5_UTILS_SOURCE_DIR}/vds_check_compat_vol.c) +add_executable (vds_check_compat_vol ${vds_check_compat_vol_SOURCES}) +target_include_directories (vds_check_compat_vol PRIVATE "${HDF5_UITLS_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (vds_check_compat_vol STATIC) + target_link_libraries (vds_check_compat_vol PRIVATE ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (vds_check_compat_vol SHARED) + target_link_libraries (vds_check_compat_vol PRIVATE ${HDF5_LIBSH_TARGET}) +endif () +set_target_properties (vds_check_compat_vol PROPERTIES FOLDER utils) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};vds_check_compat_vol") +set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} vds_check_compat_vol) + +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_UTILS_FORMAT vds_check_compat_vol) +endif () + +############################################################################## +############################################################################## +### I N S T A L L A T I O N ### +############################################################################## +############################################################################## + +#----------------------------------------------------------------------------- +# Rules for Installation of tools using make Install target +#----------------------------------------------------------------------------- +if (HDF5_EXPORTED_TARGETS) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} utilsapplications) + endforeach () + + install ( + TARGETS + ${H5_DEP_EXECUTABLES} + EXPORT + ${HDF5_EXPORTED_TARGETS} + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT utilsapplications + ) +endif () diff --git a/utils/Makefile.am b/utils/Makefile.am index 288da37..f690f9b 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -23,4 +23,11 @@ CONFIG=ordered # All subdirectories SUBDIRS=mirror_vfd +AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_builddir)/src -I$(top_srcdir)/test + +bin_PROGRAMS = vds_check_compat_vol + +# All programs depend on the hdf5 library +LDADD=$(LIBH5TEST) $(LIBHDF5) + include $(top_srcdir)/config/conclude.am -- cgit v0.12