From c4162e5ce5d79d468a7e628b6dd4be0792e5a470 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 28 Nov 2000 11:38:39 -0500 Subject: [svn-r3010] Purpose: Bug fix Description: When the v1.2 compatibility code was turned on, internal functions in the library were getting confused. Solution: Separated guts of H5Pget_driver call into an API function (the definition of which depends on the compatibility switch) and an internal function which always behaves like the v1.3/4 function. Replaced API function calls in the library code with the internal function. Platforms tested: FreeBSD 4.2 (hawkwind) --- src/H5FDcore.c | 2 +- src/H5FDfamily.c | 6 +++--- src/H5FDgass.c | 4 ++-- src/H5FDmpio.c | 10 ++++----- src/H5FDmulti.c | 10 ++++----- src/H5FDsrb.c | 4 ++-- src/H5FDstream.c | 2 +- src/H5P.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++-------- src/H5Pprivate.h | 1 + 9 files changed, 73 insertions(+), 28 deletions(-) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 60717ad..7b278ab 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -218,7 +218,7 @@ H5Pget_fapl_core(hid_t fapl_id, size_t *increment/*out*/, if (H5P_FILE_ACCESS!=H5Pget_class(fapl_id)) HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl"); - if (H5FD_CORE!=H5Pget_driver(fapl_id)) + if (H5FD_CORE!=H5P_get_driver(fapl_id)) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); if (NULL==(fa=H5Pget_driver_info(fapl_id))) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 6b6881d..0211829 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -223,7 +223,7 @@ H5Pget_fapl_family(hid_t fapl_id, hsize_t *memb_size/*out*/, if (H5P_FILE_ACCESS!=H5Pget_class(fapl_id)) HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl"); - if (H5FD_FAMILY!=H5Pget_driver(fapl_id)) + if (H5FD_FAMILY!=H5P_get_driver(fapl_id)) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); if (NULL==(fa=H5Pget_driver_info(fapl_id))) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); @@ -828,7 +828,7 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hs * Get the member data transfer property list. If the transfer property * list does not belong to this driver then assume defaults */ - if (H5P_DEFAULT!=dxpl_id && H5FD_FAMILY==H5Pget_driver(dxpl_id)) { + if (H5P_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(dxpl_id)) { H5FD_family_dxpl_t *dx = H5Pget_driver_info(dxpl_id); assert(H5P_DATASET_XFER==H5Pget_class(dxpl_id)); @@ -891,7 +891,7 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, h * Get the member data transfer property list. If the transfer property * list does not belong to this driver then assume defaults. */ - if (H5P_DEFAULT!=dxpl_id && H5FD_FAMILY==H5Pget_driver(dxpl_id)) { + if (H5P_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(dxpl_id)) { H5FD_family_dxpl_t *dx = H5Pget_driver_info(dxpl_id); assert(H5P_DATASET_XFER==H5Pget_class(dxpl_id)); diff --git a/src/H5FDgass.c b/src/H5FDgass.c index ebfe4a5..aadca8b 100644 --- a/src/H5FDgass.c +++ b/src/H5FDgass.c @@ -263,7 +263,7 @@ H5Pget_fapl_gass(hid_t fapl_id, GASS_Info *info/*out*/) if (H5P_FILE_ACCESS!=H5Pget_class(fapl_id)) HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl"); - if (H5FD_GASS!=H5Pget_driver(fapl_id)) + if (H5FD_GASS!=H5P_get_driver(fapl_id)) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); if (NULL==(fa=H5Pget_driver_info(fapl_id))) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); @@ -324,7 +324,7 @@ H5FD_gass_open(const char *name, unsigned flags, hid_t fapl_id, strcpy (filename, name); /* Obtain a pointer to gass-specific file access properties */ - if (H5P_DEFAULT==fapl_id || H5FD_GASS!=H5Pget_driver(fapl_id)) { + if (H5P_DEFAULT==fapl_id || H5FD_GASS!=H5P_get_driver(fapl_id)) { GASS_INFO_NULL (_fa.info); /* _fa.info = GASS_INFO_NULL; */ /* _fa.info = {0,0}; */ /*default*/ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 17d0acb..fb49c62 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -293,7 +293,7 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) if (H5P_FILE_ACCESS!=H5Pget_class(fapl_id)) HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl"); - if (H5FD_MPIO!=H5Pget_driver(fapl_id)) + if (H5FD_MPIO!=H5P_get_driver(fapl_id)) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); if (NULL==(fa=H5Pget_driver_info(fapl_id))) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); @@ -386,7 +386,7 @@ H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode/*out*/) if (H5P_DATASET_XFER!=H5Pget_class(dxpl_id)) HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); - if (H5FD_MPIO!=H5Pget_driver(dxpl_id)) + if (H5FD_MPIO!=H5P_get_driver(dxpl_id)) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); if (NULL==(dx=H5Pget_driver_info(dxpl_id))) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); @@ -715,7 +715,7 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, #endif /* Obtain a pointer to mpio-specific file access properties */ - if (H5P_DEFAULT==fapl_id || H5FD_MPIO!=H5Pget_driver(fapl_id)) { + if (H5P_DEFAULT==fapl_id || H5FD_MPIO!=H5P_get_driver(fapl_id)) { _fa.comm = MPI_COMM_SELF; /*default*/ _fa.info = MPI_INFO_NULL; /*default*/ fa = &_fa; @@ -1098,7 +1098,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add #endif /* Obtain the data transfer properties */ - if (H5P_DEFAULT==dxpl_id || H5FD_MPIO!=H5Pget_driver(dxpl_id)) { + if (H5P_DEFAULT==dxpl_id || H5FD_MPIO!=H5P_get_driver(dxpl_id)) { _dx.xfer_mode = H5FD_MPIO_INDEPENDENT; /*the default*/ dx = &_dx; } else { @@ -1340,7 +1340,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id/*unused*/, #endif /* Obtain the data transfer properties */ - if (H5P_DEFAULT==dxpl_id || H5FD_MPIO!=H5Pget_driver(dxpl_id)) { + if (H5P_DEFAULT==dxpl_id || H5FD_MPIO!=H5P_get_driver(dxpl_id)) { _dx.xfer_mode = H5FD_MPIO_INDEPENDENT; /*the default*/ dx = &_dx; } else { diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 455039a..2ae128d 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -469,7 +469,7 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, if (H5P_FILE_ACCESS!=H5Pget_class(fapl_id)) H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1); - if (H5FD_MULTI!=H5Pget_driver(fapl_id)) + if (H5FD_MULTI!=H5P_get_driver(fapl_id)) H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1); if (NULL==(fa=H5Pget_driver_info(fapl_id))) H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1); @@ -586,7 +586,7 @@ H5Pget_dxpl_multi(hid_t dxpl_id, hid_t *memb_dxpl/*out*/) if (H5P_FILE_ACCESS!=H5Pget_class(dxpl_id)) H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1); - if (H5FD_MULTI!=H5Pget_driver(dxpl_id)) + if (H5FD_MULTI!=H5P_get_driver(dxpl_id)) H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1); if (NULL==(dx=H5Pget_driver_info(dxpl_id))) H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1); @@ -1134,7 +1134,7 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, */ if (NULL==(file=calloc(1, sizeof(H5FD_multi_t)))) H5Epush_ret(func, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL); - if (H5P_DEFAULT==fapl_id || H5FD_MULTI!=H5Pget_driver(fapl_id)) { + if (H5P_DEFAULT==fapl_id || H5FD_MULTI!=H5P_get_driver(fapl_id)) { close_fapl = fapl_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE); } @@ -1578,7 +1578,7 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsi H5Eclear(); /* Get the data transfer properties */ - if (H5P_DEFAULT!=dxpl_id && H5FD_MULTI==H5Pget_driver(dxpl_id)) { + if (H5P_DEFAULT!=dxpl_id && H5FD_MULTI==H5P_get_driver(dxpl_id)) { dx = H5Pget_driver_info(dxpl_id); } @@ -1633,7 +1633,7 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hs H5Eclear(); /* Get the data transfer properties */ - if (H5P_DEFAULT!=dxpl_id && H5FD_MULTI==H5Pget_driver(dxpl_id)) { + if (H5P_DEFAULT!=dxpl_id && H5FD_MULTI==H5P_get_driver(dxpl_id)) { dx = H5Pget_driver_info(dxpl_id); } diff --git a/src/H5FDsrb.c b/src/H5FDsrb.c index 68de6d5..1cb2d86 100644 --- a/src/H5FDsrb.c +++ b/src/H5FDsrb.c @@ -213,7 +213,7 @@ H5Pget_fapl_srb(hid_t fapl_id, SRB_Info *info/*out*/) if(H5P_FILE_ACCESS != H5Pget_class(fapl_id)) HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl"); - if(H5FD_SRB != H5Pget_driver(fapl_id)) + if(H5FD_SRB != H5P_get_driver(fapl_id)) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); if(NULL==(fa=H5Pget_driver_info(fapl_id))) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); @@ -262,7 +262,7 @@ H5FD_srb_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if (ADDR_OVERFLOW(maxaddr)) HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); - if(H5P_DEFAULT==fapl_id || H5FD_SRB!=H5Pget_driver(fapl_id)) { + if(H5P_DEFAULT==fapl_id || H5FD_SRB!=H5P_get_driver(fapl_id)) { memset((void*)&_fa, 0, sizeof(H5FD_srb_fapl_t)); fa = &_fa; } diff --git a/src/H5FDstream.c b/src/H5FDstream.c index 7462699..fd5e306 100644 --- a/src/H5FDstream.c +++ b/src/H5FDstream.c @@ -316,7 +316,7 @@ herr_t H5Pget_fapl_stream(hid_t fapl_id, H5FD_stream_fapl_t *fapl /* out */) { HRETURN_ERROR (H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl"); } - if (H5FD_STREAM != H5Pget_driver (fapl_id)) + if (H5FD_STREAM != H5P_get_driver (fapl_id)) { HRETURN_ERROR (H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); } diff --git a/src/H5P.c b/src/H5P.c index f88ec60..c99928e 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -1849,16 +1849,62 @@ H5Pget_driver(hid_t plist_id) * Robb Matzke, 1999-08-05 * If the driver ID is H5FD_VFD_DEFAULT then substitute the current value of * H5FD_SEC2. + * + * Quincey Koziol 2000-11-28 + * Added internal function.. *------------------------------------------------------------------------- */ hid_t H5Pget_driver(hid_t plist_id) { + hid_t ret_value=-1; + + FUNC_ENTER (H5Pget_driver, FAIL); + H5TRACE1("i","i",plist_id); + + ret_value = H5P_get_driver(plist_id); + + FUNC_LEAVE(ret_value); +} +#endif /* WANT_H5_V1_2_COMPAT */ + + +/*------------------------------------------------------------------------- + * Function: H5P_get_driver + * + * Purpose: Return the ID of the low-level file driver. PLIST_ID should + * be a file access property list or data transfer propert list. + * + * Return: Success: A low-level driver ID which is the same ID + * used when the driver was set for the property + * list. The driver ID is only valid as long as + * the file driver remains registered. + * + * Failure: Negative + * + * Programmer: Robb Matzke + * Thursday, February 26, 1998 + * + * Modifications: + * Robb Matzke, 1999-08-03 + * Rewritten to use the virtual file layer. + * + * Robb Matzke, 1999-08-05 + * If the driver ID is H5FD_VFD_DEFAULT then substitute the current value + * of H5FD_SEC2. + * + * Quincey Koziol 2000-11-28 + * Added internal function.. + *------------------------------------------------------------------------- + */ +hid_t +H5P_get_driver(hid_t plist_id) +{ H5F_access_t *fapl=NULL; H5D_xfer_t *dxpl=NULL; hid_t ret_value=-1; - FUNC_ENTER (H5Pget_driver, FAIL); + FUNC_ENTER (H5P_get_driver, FAIL); H5TRACE1("i","i",plist_id); if (H5P_FILE_ACCESS==H5P_get_class(plist_id) && @@ -1879,8 +1925,6 @@ H5Pget_driver(hid_t plist_id) FUNC_LEAVE(ret_value); } -#endif /* WANT_H5_V1_2_COMPAT */ - /*------------------------------------------------------------------------- * Function: H5Pget_driver_info @@ -1990,7 +2034,7 @@ H5Pget_stdio(hid_t plist_id) /* Check arguments and test driver */ if (H5P_FILE_ACCESS==H5P_get_class(plist_id) && - (H5FD_STDIO == H5Pget_driver(plist_id))) { + (H5FD_STDIO == H5P_get_driver(plist_id))) { ret_value=SUCCEED; } else { @@ -2062,7 +2106,7 @@ H5Pget_sec2(hid_t plist_id) /* Check arguments and test driver */ if (H5P_FILE_ACCESS==H5P_get_class(plist_id) && - (H5FD_SEC2 == H5Pget_driver(plist_id))) { + (H5FD_SEC2 == H5P_get_driver(plist_id))) { ret_value=SUCCEED; } else { @@ -2144,7 +2188,7 @@ H5Pget_core(hid_t plist_id, size_t *increment/*out*/) /* Check arguments */ if (H5P_FILE_ACCESS==H5P_get_class(plist_id) && - (H5FD_CORE == H5Pget_driver(plist_id)) && + (H5FD_CORE == H5P_get_driver(plist_id)) && H5Pget_fapl_core(plist_id,increment,NULL)>=0) { ret_value=SUCCEED; } @@ -2251,7 +2295,7 @@ H5Pget_split(hid_t plist_id, size_t meta_ext_size, char *meta_ext/*out*/, HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); } - if (H5FD_MULTI != H5Pget_driver(plist_id)) { + if (H5FD_MULTI != H5P_get_driver(plist_id)) { HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "the split driver is not set"); } @@ -2381,7 +2425,7 @@ H5Pget_family(hid_t plist_id, hsize_t *memb_size/*out*/, HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); } - if (H5FD_FAMILY == H5Pget_driver(plist_id)) { + if (H5FD_FAMILY == H5P_get_driver(plist_id)) { HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "the family driver is not set"); } @@ -2494,7 +2538,7 @@ H5Pget_mpi(hid_t plist_id, MPI_Comm *comm, MPI_Info *info) HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); } - if (H5FD_MPIO == H5Pget_driver(plist_id)) { + if (H5FD_MPIO == H5P_get_driver(plist_id)) { HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "the mpi driver is not set"); } diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 38ae95f..646b5d5 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -104,5 +104,6 @@ __DLL__ hid_t H5P_create(H5P_class_t type, H5P_t *plist); __DLL__ void *H5P_copy(H5P_class_t type, const void *src); __DLL__ herr_t H5P_close(void *plist); __DLL__ H5P_class_t H5P_get_class(hid_t tid); +__DLL__ hid_t H5P_get_driver(hid_t plist_id); #endif -- cgit v0.12