mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-21 01:04:10 +08:00
Remove virtual dataset refresh code's direct use of native VOL plugin's ID.
This commit is contained in:
parent
ce3d1ec9ea
commit
6e84fd8327
@ -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() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user