mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-12-03 02:32:04 +08:00
[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)
This commit is contained in:
parent
f8d5c76ee7
commit
c4162e5ce5
@ -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");
|
||||
|
@ -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));
|
||||
|
@ -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*/
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
|
62
src/H5P.c
62
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");
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user