From 10382a1799504c5b2dea4c70881c021d1c0b04d1 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 31 Jan 2004 10:19:48 -0500 Subject: [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 --- src/H5F.c | 1 + src/H5FD.c | 26 ++++++++++++++++++++++++++ src/H5FDcore.c | 26 ++++++++++++++++++++++++++ src/H5FDcore.h | 1 + src/H5FDfamily.c | 26 ++++++++++++++++++++++++++ src/H5FDfamily.h | 1 + src/H5FDfphdf5.c | 26 ++++++++++++++++++++++++++ src/H5FDfphdf5.h | 1 + src/H5FDgass.c | 26 ++++++++++++++++++++++++++ src/H5FDgass.h | 1 + src/H5FDlog.c | 28 +++++++++++++++++++++++++++- src/H5FDlog.h | 1 + src/H5FDmpi.h | 2 +- src/H5FDmpio.c | 26 ++++++++++++++++++++++++++ src/H5FDmpio.h | 1 + src/H5FDmpiposix.c | 26 ++++++++++++++++++++++++++ src/H5FDmpiposix.h | 1 + src/H5FDmulti.c | 23 +++++++++++++++++++++++ src/H5FDmulti.h | 1 + src/H5FDsec2.c | 28 +++++++++++++++++++++++++++- src/H5FDsec2.h | 1 + src/H5FDsrb.c | 26 ++++++++++++++++++++++++++ src/H5FDsrb.h | 1 + src/H5FDstdio.c | 23 +++++++++++++++++++++++ src/H5FDstdio.h | 1 + src/H5FDstream.c | 26 ++++++++++++++++++++++++++ src/H5FDstream.h | 1 + 27 files changed, 348 insertions(+), 3 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index 03b7163..8d9719c 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -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 diff --git a/src/H5FD.c b/src/H5FD.c index 72a806d..8c1f834 100644 --- a/src/H5FD.c +++ b/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; diff --git a/src/H5FDcore.c b/src/H5FDcore.c index f803ffe..f74839e 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -178,6 +178,32 @@ done: } +/*--------------------------------------------------------------------------- + * Function: H5FD_core_term + * + * Purpose: Shut down the VFD + * + * Return: + * + * 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 * diff --git a/src/H5FDcore.h b/src/H5FDcore.h index 8df1d7e..0960425 100644 --- a/src/H5FDcore.h +++ b/src/H5FDcore.h @@ -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*/, diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 6b198ea..558b5b9 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -172,6 +172,32 @@ done: } +/*--------------------------------------------------------------------------- + * Function: H5FD_family_term + * + * Purpose: Shut down the VFD + * + * Return: + * + * 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 * diff --git a/src/H5FDfamily.h b/src/H5FDfamily.h index 11e8c67..c774bdb 100644 --- a/src/H5FDfamily.h +++ b/src/H5FDfamily.h @@ -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*/, diff --git a/src/H5FDfphdf5.c b/src/H5FDfphdf5.c index 04b9824..f30d25d 100644 --- a/src/H5FDfphdf5.c +++ b/src/H5FDfphdf5.c @@ -150,6 +150,32 @@ done: } +/*--------------------------------------------------------------------------- + * Function: H5FD_fphdf5_term + * + * Purpose: Shut down the VFD + * + * Return: + * + * 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 * Purpose: Store the user supplied MPIO communicator COMM and INFO diff --git a/src/H5FDfphdf5.h b/src/H5FDfphdf5.h index 1e3e0cf..b49545f 100644 --- a/src/H5FDfphdf5.h +++ b/src/H5FDfphdf5.h @@ -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); diff --git a/src/H5FDgass.c b/src/H5FDgass.c index 42440ab..3578b9f 100644 --- a/src/H5FDgass.c +++ b/src/H5FDgass.c @@ -217,6 +217,32 @@ done: } +/*--------------------------------------------------------------------------- + * Function: H5FD_gass_term + * + * Purpose: Shut down the VFD + * + * Return: + * + * 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 * diff --git a/src/H5FDgass.h b/src/H5FDgass.h index 29b78b3..1d599a0 100644 --- a/src/H5FDgass.h +++ b/src/H5FDgass.h @@ -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*/); diff --git a/src/H5FDlog.c b/src/H5FDlog.c index e1b84f2..d3f2949 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -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) @@ -276,6 +276,32 @@ done: } +/*--------------------------------------------------------------------------- + * Function: H5FD_log_term + * + * Purpose: Shut down the VFD + * + * Return: + * + * 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 * diff --git a/src/H5FDlog.h b/src/H5FDlog.h index 4685742..ca6aa05 100644 --- a/src/H5FDlog.h +++ b/src/H5FDlog.h @@ -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 diff --git a/src/H5FDmpi.h b/src/H5FDmpi.h index 10d2107..5ecc3cb 100644 --- a/src/H5FDmpi.h +++ b/src/H5FDmpi.h @@ -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 diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 6c5d50e..3b4b69f 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -209,6 +209,32 @@ done: } +/*--------------------------------------------------------------------------- + * Function: H5FD_mpio_term + * + * Purpose: Shut down the VFD + * + * Return: + * + * 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 * diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h index 0500989..912cbd8 100644 --- a/src/H5FDmpio.h +++ b/src/H5FDmpio.h @@ -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*/); diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index c6263f5..5cf68ef 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -277,6 +277,32 @@ done: } /* end H5FD_mpiposix_init() */ +/*--------------------------------------------------------------------------- + * Function: H5FD_mpiposix_term + * + * Purpose: Shut down the VFD + * + * Return: + * + * 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 * diff --git a/src/H5FDmpiposix.h b/src/H5FDmpiposix.h index 4849a44..12cd1f1 100644 --- a/src/H5FDmpiposix.h +++ b/src/H5FDmpiposix.h @@ -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*/); diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 07cd229..b0c5ea2 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -244,6 +244,29 @@ H5FD_multi_init(void) } +/*--------------------------------------------------------------------------- + * Function: H5FD_multi_term + * + * Purpose: Shut down the VFD + * + * Return: + * + * 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 * diff --git a/src/H5FDmulti.h b/src/H5FDmulti.h index 8250f4e..59c1336 100644 --- a/src/H5FDmulti.h +++ b/src/H5FDmulti.h @@ -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); diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 7400c0a..6bbebd0 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -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) @@ -235,6 +235,32 @@ done: } +/*--------------------------------------------------------------------------- + * Function: H5FD_sec2_term + * + * Purpose: Shut down the VFD + * + * Return: + * + * 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 * diff --git a/src/H5FDsec2.h b/src/H5FDsec2.h index 7d1e015..7242084 100644 --- a/src/H5FDsec2.h +++ b/src/H5FDsec2.h @@ -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 diff --git a/src/H5FDsrb.c b/src/H5FDsrb.c index 7f7b867..4f1ec55 100644 --- a/src/H5FDsrb.c +++ b/src/H5FDsrb.c @@ -196,6 +196,32 @@ done: } +/*--------------------------------------------------------------------------- + * Function: H5FD_srb_term + * + * Purpose: Shut down the VFD + * + * Return: + * + * 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 * diff --git a/src/H5FDsrb.h b/src/H5FDsrb.h index 86b7f91..053ca51 100644 --- a/src/H5FDsrb.h +++ b/src/H5FDsrb.h @@ -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); diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index ea53da9..d27e4d1 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -228,6 +228,29 @@ H5FD_stdio_init(void) } +/*--------------------------------------------------------------------------- + * Function: H5FD_stdio_term + * + * Purpose: Shut down the VFD + * + * Return: + * + * 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 * diff --git a/src/H5FDstdio.h b/src/H5FDstdio.h index 0b2b2b9..5c18a4f 100644 --- a/src/H5FDstdio.h +++ b/src/H5FDstdio.h @@ -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 diff --git a/src/H5FDstream.c b/src/H5FDstream.c index 9bcf627..60c414e 100644 --- a/src/H5FDstream.c +++ b/src/H5FDstream.c @@ -249,6 +249,32 @@ done: } +/*--------------------------------------------------------------------------- + * Function: H5FD_stream_term + * + * Purpose: Shut down the VFD + * + * Return: + * + * 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 * diff --git a/src/H5FDstream.h b/src/H5FDstream.h index 3641e08..851da42 100644 --- a/src/H5FDstream.h +++ b/src/H5FDstream.h @@ -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, -- cgit v0.12