From 6e84fd8327138e48bd515665c1919bc8cf22dc9f Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 27 Oct 2018 01:33:07 -0500 Subject: Remove virtual dataset refresh code's direct use of native VOL plugin's ID. --- src/H5Dvirtual.c | 21 ++++++++++++--------- src/H5VLnative.c | 8 -------- src/H5VLnative_private.h | 1 - test/vds_swmr_gen.c | 2 +- test/vds_swmr_reader.c | 9 ++++++++- test/vds_swmr_writer.c | 2 +- 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 7d127c2..3dc44c5 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -2963,7 +2963,6 @@ static herr_t H5D__virtual_refresh_source_dset(H5D_t **dset) { hid_t temp_id = H5I_INVALID_HID; /* Temporary dataset identifier */ - hid_t native_vol_id = H5I_INVALID_HID; /* ID for the native VOL driver */ H5VL_object_t *vol_obj = NULL; /* VOL object stored with the ID */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2972,13 +2971,16 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) /* Sanity check */ HDassert(dset && *dset); - /* Get the native VOL driver's ID */ -/* XXX (VOL MERGE): Need a better solution than this */ - if((native_vol_id = H5VL_native_get_driver_id()) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get native VOL driver ID") - /* Get a temporary identifier for this source dataset */ - if((temp_id = H5VL_register_using_vol_id(H5I_DATASET, *dset, native_vol_id, FALSE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((temp_id = H5VL_wrap_register(H5I_DATASET, *dset, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID") /* Refresh source dataset */ @@ -2988,7 +2990,8 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) /* Discard the identifier & replace the dataset */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_remove(temp_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID") - *dset = (H5D_t *)(vol_obj->data); + if(NULL == (*dset = (H5D_t *)H5VL_object_data(vol_obj))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve library object from VOL object") vol_obj->data = NULL; done: @@ -2996,7 +2999,7 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__virtual_refresh_source_dsets() */ +} /* end H5D__virtual_refresh_source_dset() */ /*------------------------------------------------------------------------- diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 69b010b..4d4311f 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -231,14 +231,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_native_init() */ -/* XXX (VOL_MERGE): TEMPORARY */ -hid_t -H5VL_native_get_driver_id(void) -{ -HDassert(0 && "H5VL_native_get_driver_id"); - return H5VL_NATIVE_ID_g; -} - /*--------------------------------------------------------------------------- * Function: H5VL__native_term diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h index 84df828..397d496 100644 --- a/src/H5VLnative_private.h +++ b/src/H5VLnative_private.h @@ -28,7 +28,6 @@ extern "C" { #endif -H5_DLL hid_t H5VL_native_get_driver_id(void); H5_DLL hid_t H5VL_native_init(hid_t vipl_id); #ifdef __cplusplus diff --git a/test/vds_swmr_gen.c b/test/vds_swmr_gen.c index 24c6131..1cb9744 100644 --- a/test/vds_swmr_gen.c +++ b/test/vds_swmr_gen.c @@ -61,7 +61,7 @@ main(void) map_start = 0; /* All SWMR files need to use the latest file format */ - if((faplid = H5Pcreate(H5P_FILE_ACCESS)) < 0) + if((faplid = h5_fileaccess()) < 0) TEST_ERROR if(H5Pset_libver_bounds(faplid, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR diff --git a/test/vds_swmr_reader.c b/test/vds_swmr_reader.c index 16f3abe..d0ec77b 100644 --- a/test/vds_swmr_reader.c +++ b/test/vds_swmr_reader.c @@ -18,6 +18,7 @@ int main(void) { hid_t fid = -1; /* HDF5 file ID */ + hid_t faplid = -1; /* file access property list ID */ hid_t did = -1; /* dataset ID */ hid_t msid = -1; /* memory dataspace ID */ hid_t fsid = -1; /* file dataspace ID */ @@ -34,7 +35,9 @@ main(void) /* Open the VDS file and dataset */ - if((fid = H5Fopen(VDS_FILE_NAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, H5P_DEFAULT)) < 0) + if((faplid = h5_fileaccess()) < 0) + TEST_ERROR + if((fid = H5Fopen(VDS_FILE_NAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, faplid)) < 0) TEST_ERROR if((did = H5Dopen2(fid, VDS_DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR @@ -103,6 +106,8 @@ main(void) } while (dims[0] < N_PLANES_TO_WRITE); /* Close file and dataset */ + if(H5Pclose(faplid) < 0) + TEST_ERROR if(H5Sclose(msid) < 0) TEST_ERROR if(H5Dclose(did) < 0) @@ -120,6 +125,8 @@ error: H5E_BEGIN_TRY { if(fid >= 0) (void)H5Fclose(fid); + if(faplid >= 0) + (void)H5Pclose(faplid); if(did >= 0) (void)H5Dclose(did); if(msid >= 0) diff --git a/test/vds_swmr_writer.c b/test/vds_swmr_writer.c index 7824aa0..d62ecaf 100644 --- a/test/vds_swmr_writer.c +++ b/test/vds_swmr_writer.c @@ -56,7 +56,7 @@ main(int argc, char *argv[]) /* Open the source file and dataset */ /* All SWMR files need to use the latest file format */ - if((faplid = H5Pcreate(H5P_FILE_ACCESS)) < 0) + if((faplid = h5_fileaccess()) < 0) TEST_ERROR if(H5Pset_libver_bounds(faplid, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR -- cgit v0.12