mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-13 16:47:58 +08:00
[svn-r8134] Purpose:
Code cleanup Description: Add destructor to match constructor fr VFLs when they are shut down by the library. Solution: Added H5FD_*_term() routines to "undo" changes made in H5FD_*_init() routines. Platforms tested: IBM p690 (copper) too minor to require h5committest
This commit is contained in:
parent
efca86dc64
commit
10382a1799
@ -299,6 +299,7 @@ H5F_init_interface(void)
|
||||
/* Register predefined file drivers */
|
||||
H5E_BEGIN_TRY {
|
||||
if ((status=H5FD_SEC2)<0) goto end_registration; /*lint !e801 Tell lint that our use of goto is OK here */
|
||||
if ((status=H5FD_LOG)<0) goto end_registration; /*lint !e801 Tell lint that our use of goto is OK here */
|
||||
if ((status=H5FD_STDIO)<0) goto end_registration; /*lint !e801 Tell lint that our use of goto is OK here */
|
||||
if ((status=H5FD_FAMILY)<0) goto end_registration; /*lint !e801 Tell lint that our use of goto is OK here */
|
||||
#ifdef H5_HAVE_GASS
|
||||
|
26
src/H5FD.c
26
src/H5FD.c
@ -156,6 +156,32 @@ H5FD_term_interface(void)
|
||||
if (interface_initialize_g) {
|
||||
if ((n=H5I_nmembers(H5I_VFL))) {
|
||||
H5I_clear_group(H5I_VFL, FALSE);
|
||||
|
||||
/* Reset the VFL drivers, if they've been closed */
|
||||
if(H5I_nmembers(H5I_VFL)==0) {
|
||||
H5FD_sec2_term();
|
||||
H5FD_log_term();
|
||||
H5FD_stdio_term();
|
||||
H5FD_family_term();
|
||||
#ifdef H5_HAVE_GASS
|
||||
H5FD_gass_term();
|
||||
#endif
|
||||
#ifdef H5_HAVE_SRB
|
||||
H5FD_srb_term();
|
||||
#endif
|
||||
H5FD_core_term();
|
||||
H5FD_multi_term();
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
H5FD_mpio_term();
|
||||
H5FD_mpiposix_term();
|
||||
#ifdef H5_HAVE_FPHDF5
|
||||
H5FD_fphdf5_term();
|
||||
#endif /* H5_HAVE_FPHDF5 */
|
||||
#endif /* H5_HAVE_PARALLEL */
|
||||
#ifdef H5_HAVE_STREAM
|
||||
H5FD_stream_term();
|
||||
#endif
|
||||
} /* end if */
|
||||
} else {
|
||||
H5I_destroy_group(H5I_VFL);
|
||||
interface_initialize_g = 0;
|
||||
|
@ -177,6 +177,32 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Function: H5FD_core_term
|
||||
*
|
||||
* Purpose: Shut down the VFD
|
||||
*
|
||||
* Return: <none>
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Friday, Jan 30, 2004
|
||||
*
|
||||
* Modification:
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
H5FD_core_term(void)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_core_term)
|
||||
|
||||
/* Reset VFL ID */
|
||||
H5FD_CORE_g=0;
|
||||
|
||||
FUNC_LEAVE_NOAPI_VOID
|
||||
} /* end H5FD_core_term() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_fapl_core
|
||||
|
@ -29,6 +29,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
H5_DLL hid_t H5FD_core_init(void);
|
||||
H5_DLL void H5FD_core_term(void);
|
||||
H5_DLL herr_t H5Pset_fapl_core(hid_t fapl_id, size_t increment,
|
||||
hbool_t backing_store);
|
||||
H5_DLL herr_t H5Pget_fapl_core(hid_t fapl_id, size_t *increment/*out*/,
|
||||
|
@ -171,6 +171,32 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Function: H5FD_family_term
|
||||
*
|
||||
* Purpose: Shut down the VFD
|
||||
*
|
||||
* Return: <none>
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Friday, Jan 30, 2004
|
||||
*
|
||||
* Modification:
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
H5FD_family_term(void)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_family_term)
|
||||
|
||||
/* Reset VFL ID */
|
||||
H5FD_FAMILY_g=0;
|
||||
|
||||
FUNC_LEAVE_NOAPI_VOID
|
||||
} /* end H5FD_family_term() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_fapl_family
|
||||
|
@ -30,6 +30,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
H5_DLL hid_t H5FD_family_init(void);
|
||||
H5_DLL void H5FD_family_term(void);
|
||||
H5_DLL herr_t H5Pset_fapl_family(hid_t fapl_id, hsize_t memb_size,
|
||||
hid_t memb_fapl_id);
|
||||
H5_DLL herr_t H5Pget_fapl_family(hid_t fapl_id, hsize_t *memb_size/*out*/,
|
||||
|
@ -149,6 +149,32 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Function: H5FD_fphdf5_term
|
||||
*
|
||||
* Purpose: Shut down the VFD
|
||||
*
|
||||
* Return: <none>
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Friday, Jan 30, 2004
|
||||
*
|
||||
* Modification:
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
H5FD_fphdf5_term(void)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_fphdf5_term)
|
||||
|
||||
/* Reset VFL ID */
|
||||
H5FD_FPHDF5_g=0;
|
||||
|
||||
FUNC_LEAVE_NOAPI_VOID
|
||||
} /* end H5FD_fphdf5_term() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_fapl_fphdf5
|
||||
|
@ -102,6 +102,7 @@ H5_DLL herr_t H5Pget_fapl_fphdf5(hid_t fapl_id, MPI_Comm *comm,
|
||||
struct H5P_genplist_t;
|
||||
|
||||
H5_DLL hid_t H5FD_fphdf5_init(void);
|
||||
H5_DLL void H5FD_gass_term(void);
|
||||
H5_DLL unsigned H5FD_fphdf5_file_id(H5FD_t *_file);
|
||||
H5_DLL hbool_t H5FD_fphdf5_is_sap(H5FD_t *_file);
|
||||
H5_DLL hbool_t H5FD_fphdf5_is_captain(H5FD_t *_file);
|
||||
|
@ -216,6 +216,32 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Function: H5FD_gass_term
|
||||
*
|
||||
* Purpose: Shut down the VFD
|
||||
*
|
||||
* Return: <none>
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Friday, Jan 30, 2004
|
||||
*
|
||||
* Modification:
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
H5FD_gass_term(void)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_gass_term)
|
||||
|
||||
/* Reset VFL ID */
|
||||
H5FD_GASS_g=0;
|
||||
|
||||
FUNC_LEAVE_NOAPI_VOID
|
||||
} /* end H5FD_gass_term() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_fapl_gass
|
||||
|
@ -55,6 +55,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
hid_t H5FD_gass_init(void);
|
||||
void H5FD_gass_term(void);
|
||||
herr_t H5Pset_fapl_gass(hid_t fapl_id, GASS_Info info);
|
||||
herr_t H5Pget_fapl_gass(hid_t fapl_id, GASS_Info *info/*out*/);
|
||||
|
||||
|
@ -261,7 +261,7 @@ static int interface_initialize_g = 0;
|
||||
hid_t
|
||||
H5FD_log_init(void)
|
||||
{
|
||||
hid_t ret_value=H5FD_LOG_g; /* Return value */
|
||||
hid_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5FD_log_init, FAIL)
|
||||
|
||||
@ -275,6 +275,32 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Function: H5FD_log_term
|
||||
*
|
||||
* Purpose: Shut down the VFD
|
||||
*
|
||||
* Return: <none>
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Friday, Jan 30, 2004
|
||||
*
|
||||
* Modification:
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
H5FD_log_term(void)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_log_term)
|
||||
|
||||
/* Reset VFL ID */
|
||||
H5FD_LOG_g=0;
|
||||
|
||||
FUNC_LEAVE_NOAPI_VOID
|
||||
} /* end H5FD_log_term() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_fapl_log
|
||||
|
@ -58,6 +58,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
H5_DLL hid_t H5FD_log_init(void);
|
||||
H5_DLL void H5FD_log_term(void);
|
||||
H5_DLL herr_t H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned flags, size_t buf_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -61,7 +61,7 @@ typedef struct H5FD_class_mpi_t {
|
||||
/*
|
||||
* The view is set to this value
|
||||
*/
|
||||
extern char H5FD_mpi_native_g[];
|
||||
H5_DLLVAR char H5FD_mpi_native_g[];
|
||||
|
||||
/* Function prototypes */
|
||||
#ifdef __cplusplus
|
||||
|
@ -208,6 +208,32 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Function: H5FD_mpio_term
|
||||
*
|
||||
* Purpose: Shut down the VFD
|
||||
*
|
||||
* Return: <none>
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Friday, Jan 30, 2004
|
||||
*
|
||||
* Modification:
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
H5FD_mpio_term(void)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_mpio_term)
|
||||
|
||||
/* Reset VFL ID */
|
||||
H5FD_MPIO_g=0;
|
||||
|
||||
FUNC_LEAVE_NOAPI_VOID
|
||||
} /* end H5FD_mpio_term() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_fapl_mpio
|
||||
|
@ -45,6 +45,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
H5_DLL hid_t H5FD_mpio_init(void);
|
||||
H5_DLL void H5FD_mpio_term(void);
|
||||
H5_DLL herr_t H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info);
|
||||
H5_DLL herr_t H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/,
|
||||
MPI_Info *info/*out*/);
|
||||
|
@ -276,6 +276,32 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5FD_mpiposix_init() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Function: H5FD_mpiposix_term
|
||||
*
|
||||
* Purpose: Shut down the VFD
|
||||
*
|
||||
* Return: <none>
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Friday, Jan 30, 2004
|
||||
*
|
||||
* Modification:
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
H5FD_mpiposix_term(void)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_mpiposix_term)
|
||||
|
||||
/* Reset VFL ID */
|
||||
H5FD_MPIPOSIX_g=0;
|
||||
|
||||
FUNC_LEAVE_NOAPI_VOID
|
||||
} /* end H5FD_mpiposix_term() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_fapl_mpiposix
|
||||
|
@ -41,6 +41,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
H5_DLL hid_t H5FD_mpiposix_init(void);
|
||||
H5_DLL void H5FD_mpiposix_term(void);
|
||||
H5_DLL herr_t H5Pset_fapl_mpiposix(hid_t fapl_id, MPI_Comm comm, hbool_t use_gpfs);
|
||||
H5_DLL herr_t H5Pget_fapl_mpiposix(hid_t fapl_id, MPI_Comm *comm/*out*/, hbool_t *use_gpfs/*out*/);
|
||||
|
||||
|
@ -243,6 +243,29 @@ H5FD_multi_init(void)
|
||||
return H5FD_MULTI_g;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Function: H5FD_multi_term
|
||||
*
|
||||
* Purpose: Shut down the VFD
|
||||
*
|
||||
* Return: <none>
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Friday, Jan 30, 2004
|
||||
*
|
||||
* Modification:
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
H5FD_multi_term(void)
|
||||
{
|
||||
/* Reset VFL ID */
|
||||
H5FD_MULTI_g=0;
|
||||
|
||||
} /* end H5FD_multi_term() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_fapl_split
|
||||
|
@ -31,6 +31,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
H5_DLL hid_t H5FD_multi_init(void);
|
||||
H5_DLL void H5FD_multi_term(void);
|
||||
H5_DLL herr_t H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map,
|
||||
const hid_t *memb_fapl, const char * const *memb_name,
|
||||
const haddr_t *memb_addr, hbool_t relax);
|
||||
|
@ -220,7 +220,7 @@ H5FL_DEFINE_STATIC(H5FD_sec2_t);
|
||||
hid_t
|
||||
H5FD_sec2_init(void)
|
||||
{
|
||||
hid_t ret_value=H5FD_SEC2_g; /* Return value */
|
||||
hid_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5FD_sec2_init, FAIL)
|
||||
|
||||
@ -234,6 +234,32 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Function: H5FD_sec2_term
|
||||
*
|
||||
* Purpose: Shut down the VFD
|
||||
*
|
||||
* Return: <none>
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Friday, Jan 30, 2004
|
||||
*
|
||||
* Modification:
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
H5FD_sec2_term(void)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_sec2_term)
|
||||
|
||||
/* Reset VFL ID */
|
||||
H5FD_SEC2_g=0;
|
||||
|
||||
FUNC_LEAVE_NOAPI_VOID
|
||||
} /* end H5FD_sec2_term() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_fapl_sec2
|
||||
|
@ -30,6 +30,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
H5_DLL hid_t H5FD_sec2_init(void);
|
||||
H5_DLL void H5FD_sec2_term(void);
|
||||
H5_DLL herr_t H5Pset_fapl_sec2(hid_t fapl_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -195,6 +195,32 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Function: H5FD_srb_term
|
||||
*
|
||||
* Purpose: Shut down the VFD
|
||||
*
|
||||
* Return: <none>
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Friday, Jan 30, 2004
|
||||
*
|
||||
* Modification:
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
H5FD_srb_term(void)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_srb_term)
|
||||
|
||||
/* Reset VFL ID */
|
||||
H5FD_SRB_g=0;
|
||||
|
||||
FUNC_LEAVE_NOAPI_VOID
|
||||
} /* end H5FD_srb_term() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_fapl_srb
|
||||
|
@ -42,6 +42,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
H5_DLL hid_t H5FD_srb_init(void);
|
||||
H5_DLL void H5FD_srb_term(void);
|
||||
H5_DLL herr_t H5Pset_fapl_srb(hid_t fapl_id, SRB_Info info);
|
||||
H5_DLL herr_t H5Pget_fapl_srb(hid_t fapl_id, SRB_Info *info);
|
||||
|
||||
|
@ -227,6 +227,29 @@ H5FD_stdio_init(void)
|
||||
return(H5FD_STDIO_g);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Function: H5FD_stdio_term
|
||||
*
|
||||
* Purpose: Shut down the VFD
|
||||
*
|
||||
* Return: <none>
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Friday, Jan 30, 2004
|
||||
*
|
||||
* Modification:
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
H5FD_stdio_term(void)
|
||||
{
|
||||
/* Reset VFL ID */
|
||||
H5FD_STDIO_g=0;
|
||||
|
||||
} /* end H5FD_stdio_term() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_fapl_stdio
|
||||
|
@ -30,6 +30,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
H5_DLL hid_t H5FD_stdio_init(void);
|
||||
H5_DLL void H5FD_stdio_term(void);
|
||||
H5_DLL herr_t H5Pset_fapl_stdio(hid_t fapl_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -248,6 +248,32 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Function: H5FD_stream_term
|
||||
*
|
||||
* Purpose: Shut down the VFD
|
||||
*
|
||||
* Return: <none>
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Friday, Jan 30, 2004
|
||||
*
|
||||
* Modification:
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
H5FD_stream_term(void)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_stream_term)
|
||||
|
||||
/* Reset VFL ID */
|
||||
H5FD_STREAM_g=0;
|
||||
|
||||
FUNC_LEAVE_NOAPI_VOID
|
||||
} /* end H5FD_stream_term() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_fapl_stream
|
||||
|
@ -69,6 +69,7 @@ typedef struct H5FD_stream_fapl_t
|
||||
|
||||
/* prototypes of exported functions */
|
||||
H5_DLL hid_t H5FD_stream_init (void);
|
||||
H5_DLL void H5FD_stream_term(void);
|
||||
H5_DLL herr_t H5Pset_fapl_stream (hid_t fapl_id,
|
||||
H5FD_stream_fapl_t *fapl);
|
||||
H5_DLL herr_t H5Pget_fapl_stream (hid_t fapl_id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user