From 3de25ee2264f80b4a842af10c69893f4e635951f Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 9 Apr 2014 00:08:21 -0500 Subject: [svn-r24998] Description: Check in Neil's changes for correctly handling case where library is reinitialized through a deprecated routine. Tested on: Linux 2.4.x/32 (jam) --- src/H5A.c | 3 ++ src/H5Adeprec.c | 24 +++++++++++++ src/H5Apkg.h | 1 + src/H5D.c | 24 +++++++++++++ src/H5Ddeprec.c | 24 +++++++++++++ src/H5Dint.c | 6 ++++ src/H5Dpkg.h | 2 ++ src/H5E.c | 3 ++ src/H5Edeprec.c | 38 ++++++++++++++++---- src/H5Epkg.h | 3 +- src/H5F.c | 3 ++ src/H5Fdeprec.c | 36 +++++++++++++++---- src/H5Fpkg.h | 1 + src/H5G.c | 23 ++++++------ src/H5Gdeprec.c | 36 +++++++++++++++---- src/H5Gpkg.h | 1 + src/H5P.c | 36 +++++++++++++++---- src/H5Pdeprec.c | 36 +++++++++++++++---- src/H5Pint.c | 6 ++++ src/H5Ppkg.h | 2 ++ src/H5R.c | 3 ++ src/H5Rdeprec.c | 39 ++++++++++++++++---- src/H5Rpkg.h | 1 + src/H5T.c | 4 +++ src/H5Tdeprec.c | 38 ++++++++++++++++---- src/H5Tpkg.h | 1 + test/tmisc.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 27 files changed, 448 insertions(+), 56 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index edac156..cb8dfba 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -184,6 +184,9 @@ H5A_term_interface(void) if((n = H5I_nmembers(H5I_ATTR))>0) { (void)H5I_clear_type(H5I_ATTR, FALSE, FALSE); } else { + /* Close deprecated interface */ + n += H5A__term_deprec_interface(); + (void)H5I_dec_type_ref(H5I_ATTR); H5_interface_initialize_g = 0; n = 1; diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 7202edf..10ee70b 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -105,6 +105,30 @@ H5A__init_deprec_interface(void) FUNC_LEAVE_NOAPI(H5A_init()) } /* H5A__init_deprec_interface() */ + +/*-------------------------------------------------------------------------- +NAME + H5A__term_deprec_interface -- Terminate interface +USAGE + herr_t H5A__term_deprec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5A__term_deprec_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + + FUNC_LEAVE_NOAPI(0) +} /* H5A__term_deprec_interface() */ + #ifndef H5_NO_DEPRECATED_SYMBOLS /*-------------------------------------------------------------------------- diff --git a/src/H5Apkg.h b/src/H5Apkg.h index 26c8dff..fa26a9a 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -185,6 +185,7 @@ H5_DLLVAR const H5B2_class_t H5A_BT2_CORDER[1]; /* Function prototypes for H5A package scope */ H5_DLL herr_t H5A_init(void); +H5_DLL herr_t H5A__term_deprec_interface(void); H5_DLL hid_t H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_t *space, hid_t acpl_id, hid_t dxpl_id); H5_DLL H5A_t * H5A_open_by_name(const H5G_loc_t *loc, const char *obj_name, diff --git a/src/H5D.c b/src/H5D.c index f47a84c..3422b5a 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -94,6 +94,30 @@ H5D__init_pub_interface(void) } /* H5D__init_pub_interface() */ +/*-------------------------------------------------------------------------- +NAME + H5D__term_pub_interface -- Terminate interface +USAGE + herr_t H5D__term_pub_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5D__term_pub_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + + FUNC_LEAVE_NOAPI(0) +} /* H5D__term_pub_interface() */ + + /*------------------------------------------------------------------------- * Function: H5Dcreate2 * diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 1999550..04cf032 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -106,6 +106,30 @@ H5D__init_deprec_interface(void) FUNC_LEAVE_NOAPI(H5D_init()) } /* H5D__init_deprec_interface() */ + +/*-------------------------------------------------------------------------- +NAME + H5D__term_deprec_interface -- Terminate interface +USAGE + herr_t H5D__term_deprec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5D__term_deprec_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + + FUNC_LEAVE_NOAPI(0) +} /* H5D__term_deprec_interface() */ + #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- diff --git a/src/H5Dint.c b/src/H5Dint.c index 15f5df7..753c5a4 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -251,6 +251,12 @@ H5D_term_interface(void) */ H5I_clear_type(H5I_DATASET, TRUE, FALSE); } else { + /* Close public interface */ + n += H5D__term_pub_interface(); + + /* Close deprecated interface */ + n += H5D__term_deprec_interface(); + H5I_dec_type_ref(H5I_DATASET); H5_interface_initialize_g = 0; n = 1; /*H5I*/ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index c3cee61..5a785a3 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -524,6 +524,8 @@ H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_BTREE[1]; /* Package Private Prototypes */ /******************************/ +H5_DLL herr_t H5D__term_pub_interface(void); +H5_DLL herr_t H5D__term_deprec_interface(void); H5_DLL H5D_t *H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id); H5_DLL H5D_t *H5D__create_named(const H5G_loc_t *loc, const char *name, diff --git a/src/H5E.c b/src/H5E.c index 0a42bcf..177ec55 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -322,6 +322,9 @@ H5E_term_interface(void) } /* end if */ } /* end if */ else { + /* Close deprecated interface */ + n += H5E__term_deprec_interface(); + /* Destroy the error class, message, and stack id groups */ H5I_dec_type_ref(H5I_ERROR_STACK); H5I_dec_type_ref(H5I_ERROR_CLASS); diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index 0d3083b..3e9444b 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -34,7 +34,7 @@ #define H5E_PACKAGE /*suppress error about including H5Epkg */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5E_init_deprec_interface +#define H5_INTERFACE_INIT_FUNC H5E__init_deprec_interface /***********/ @@ -82,13 +82,12 @@ /*******************/ -#ifndef H5_NO_DEPRECATED_SYMBOLS /*-------------------------------------------------------------------------- NAME - H5E_init_deprec_interface -- Initialize interface-specific information + H5E__init_deprec_interface -- Initialize interface-specific information USAGE - herr_t H5E_init_deprec_interface() + herr_t H5E__init_deprec_interface() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -97,13 +96,38 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5E_init_deprec_interface(void) +H5E__init_deprec_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(H5E_init()) -} /* H5E_init_deprec_interface() */ +} /* H5E__init_deprec_interface() */ + + +/*-------------------------------------------------------------------------- +NAME + H5E__term_deprec_interface -- Terminate interface +USAGE + herr_t H5E__term_deprec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5E__term_deprec_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + FUNC_LEAVE_NOAPI(0) +} /* H5E__term_deprec_interface() */ + +#ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- * Function: H5Eget_major diff --git a/src/H5Epkg.h b/src/H5Epkg.h index 9a1163a..bfaaf9d 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -132,6 +132,7 @@ H5_DLLVAR H5E_t H5E_stack_g[1]; /******************************/ /* Package Private Prototypes */ /******************************/ +H5_DLL herr_t H5E__term_deprec_interface(void); #ifdef H5_HAVE_THREADSAFE H5_DLL H5E_t *H5E_get_stack(void); #endif /* H5_HAVE_THREADSAFE */ @@ -146,5 +147,5 @@ H5_DLL herr_t H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data); H5_DLL herr_t H5E_pop(H5E_t *err_stack, size_t count); -#endif /* _H5HFpkg_H */ +#endif /* _H5Epkg_H */ diff --git a/src/H5F.c b/src/H5F.c index 5a06a4d..7760be7 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -204,6 +204,9 @@ H5F_term_interface(void) /* Make certain we've cleaned up all the shared file objects */ H5F_sfile_assert_num(0); + /* Close deprecated interface */ + n += H5F__term_deprec_interface(); + H5I_dec_type_ref(H5I_FILE); H5_interface_initialize_g = 0; n = 1; /*H5I*/ diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index e3945ff..c5a500a 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -34,7 +34,7 @@ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5F_init_deprec_interface +#define H5_INTERFACE_INIT_FUNC H5F__init_deprec_interface /***********/ @@ -85,9 +85,9 @@ /*-------------------------------------------------------------------------- NAME - H5F_init_deprec_interface -- Initialize interface-specific information + H5F__init_deprec_interface -- Initialize interface-specific information USAGE - herr_t H5F_init_deprec_interface() + herr_t H5F__init_deprec_interface() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -96,12 +96,36 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5F_init_deprec_interface(void) +H5F__init_deprec_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(H5F_init()) -} /* H5F_init_deprec_interface() */ +} /* H5F__init_deprec_interface() */ + + +/*-------------------------------------------------------------------------- +NAME + H5F__term_deprec_interface -- Terminate interface +USAGE + herr_t H5F__term_deprec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5F__term_deprec_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + + FUNC_LEAVE_NOAPI(0) +} /* H5F__term_deprec_interface() */ #ifndef H5_NO_DEPRECATED_SYMBOLS diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 11d2cd4..0f2f5df 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -295,6 +295,7 @@ H5_DLLVAR const H5AC_class_t H5AC_SUPERBLOCK[1]; /* General routines */ H5_DLL herr_t H5F_init(void); +H5_DLL herr_t H5F__term_deprec_interface(void); H5_DLL herr_t H5F_locate_signature(H5FD_t *file, hid_t dxpl_id, haddr_t *sig_addr); H5_DLL herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, hbool_t closing); diff --git a/src/H5G.c b/src/H5G.c index a9ec208..b31bc5d 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -224,16 +224,19 @@ H5G_term_interface(void) FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5_interface_initialize_g) { - if((n = H5I_nmembers(H5I_GROUP))) - H5I_clear_type(H5I_GROUP, FALSE, FALSE); - else { - /* Destroy the group object id group */ - H5I_dec_type_ref(H5I_GROUP); - - /* Mark closed */ - H5_interface_initialize_g = 0; - n = 1; /*H5I*/ - } /* end else */ + if((n = H5I_nmembers(H5I_GROUP))) + H5I_clear_type(H5I_GROUP, FALSE, FALSE); + else { + /* Close deprecated interface */ + n += H5G__term_deprec_interface(); + + /* Destroy the group object id group */ + H5I_dec_type_ref(H5I_GROUP); + + /* Mark closed */ + H5_interface_initialize_g = 0; + n = 1; /*H5I*/ + } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 9473011..17920ab 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -34,7 +34,7 @@ #define H5G_PACKAGE /*suppress error about including H5Gpkg */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5G_init_deprec_interface +#define H5_INTERFACE_INIT_FUNC H5G__init_deprec_interface /***********/ @@ -109,9 +109,9 @@ static H5G_obj_t H5G_obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, /*-------------------------------------------------------------------------- NAME - H5G_init_deprec_interface -- Initialize interface-specific information + H5G__init_deprec_interface -- Initialize interface-specific information USAGE - herr_t H5G_init_deprec_interface() + herr_t H5G__init_deprec_interface() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -120,12 +120,36 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5G_init_deprec_interface(void) +H5G__init_deprec_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(H5G__init()) -} /* H5G_init_deprec_interface() */ +} /* H5G__init_deprec_interface() */ + + +/*-------------------------------------------------------------------------- +NAME + H5G__term_deprec_interface -- Terminate interface +USAGE + herr_t H5G__term_deprec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5G__term_deprec_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + + FUNC_LEAVE_NOAPI(0) +} /* H5G__term_deprec_interface() */ #ifndef H5_NO_DEPRECATED_SYMBOLS diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index e2180c0..b194adb 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -352,6 +352,7 @@ H5_DLL herr_t H5G__traverse_special(const H5G_loc_t *grp_loc, * Utility functions */ H5_DLL herr_t H5G__init(void); +H5_DLL herr_t H5G__term_deprec_interface(void); H5_DLL const char *H5G__component(const char *name, size_t *size_p); /* diff --git a/src/H5P.c b/src/H5P.c index 9489e49..e561385 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -25,7 +25,7 @@ #define H5P_PACKAGE /*suppress error about including H5Ppkg */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5P_init_pub_interface +#define H5_INTERFACE_INIT_FUNC H5P__init_pub_interface /***********/ @@ -75,9 +75,9 @@ typedef struct { /*-------------------------------------------------------------------------- NAME - H5P_init_pub_interface -- Initialize interface-specific information + H5P__init_pub_interface -- Initialize interface-specific information USAGE - herr_t H5P_init_pub_interface() + herr_t H5P__init_pub_interface() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -86,12 +86,36 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5P_init_pub_interface(void) +H5P__init_pub_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(H5P_init()) -} /* H5P_init_pub_interface() */ +} /* H5P__init_pub_interface() */ + + +/*-------------------------------------------------------------------------- +NAME + H5P__term_pub_interface -- Terminate interface +USAGE + herr_t H5P__term_pub_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5P__term_pub_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + + FUNC_LEAVE_NOAPI(0) +} /* H5P__term_pub_interface() */ /*-------------------------------------------------------------------------- diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index cb5e10f..45b1d09 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -34,7 +34,7 @@ #define H5P_PACKAGE /*suppress error about including H5Ppkg */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5P_init_deprec_interface +#define H5_INTERFACE_INIT_FUNC H5P__init_deprec_interface /***********/ @@ -84,9 +84,9 @@ /*-------------------------------------------------------------------------- NAME - H5P_init_deprec_interface -- Initialize interface-specific information + H5P__init_deprec_interface -- Initialize interface-specific information USAGE - herr_t H5P_init_deprec_interface() + herr_t H5P__init_deprec_interface() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -95,12 +95,36 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5P_init_deprec_interface(void) +H5P__init_deprec_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(H5P_init()) -} /* H5P_init_deprec_interface() */ +} /* H5P__init_deprec_interface() */ + + +/*-------------------------------------------------------------------------- +NAME + H5P__term_deprec_interface -- Terminate interface +USAGE + herr_t H5P__term_deprec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5P__term_deprec_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + + FUNC_LEAVE_NOAPI(0) +} /* H5P__term_deprec_interface() */ #ifndef H5_NO_DEPRECATED_SYMBOLS diff --git a/src/H5Pint.c b/src/H5Pint.c index c2a17ba..6f57e78 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -559,6 +559,12 @@ H5P_term_interface(void) } /* end if */ } /* end if */ } else { + /* Close public interface */ + n += H5P__term_pub_interface(); + + /* Close deprecated interface */ + n += H5P__term_deprec_interface(); + H5I_dec_type_ref(H5I_GENPROP_LST); n++; /*H5I*/ H5I_dec_type_ref(H5I_GENPROP_CLS); diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 9d48c60..f80edb8 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -154,6 +154,8 @@ typedef int (*H5P_iterate_int_t)(H5P_genprop_t *prop, void *udata); /******************************/ /* Private functions, not part of the publicly documented API */ +H5_DLL herr_t H5P__term_pub_interface(void); +H5_DLL herr_t H5P__term_deprec_interface(void); H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type, H5P_cls_create_func_t cls_create, void *create_data, diff --git a/src/H5R.c b/src/H5R.c index 95d8548..b453295 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -165,6 +165,9 @@ H5R_term_interface(void) if ((n=H5I_nmembers(H5I_REFERENCE))) { H5I_clear_type(H5I_REFERENCE, FALSE, FALSE); } else { + /* Close deprecated interface */ + n += H5R__term_deprec_interface(); + H5I_dec_type_ref(H5I_REFERENCE); H5_interface_initialize_g = 0; n = 1; /*H5I*/ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index d0c79a8..ea30913 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -34,7 +34,7 @@ #define H5R_PACKAGE /*suppress error about including H5Rpkg */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5R_init_deprec_interface +#define H5_INTERFACE_INIT_FUNC H5R__init_deprec_interface /***********/ @@ -48,7 +48,7 @@ #include "H5Rpkg.h" /* References */ #include "H5Ppublic.h" /* for using H5P_DATASET_ACCESS_DEFAULT */ -#ifndef H5_NO_DEPRECATED_SYMBOLS + /****************/ /* Local Macros */ /****************/ @@ -87,9 +87,9 @@ /*-------------------------------------------------------------------------- NAME - H5R_init_deprec_interface -- Initialize interface-specific information + H5R__init_deprec_interface -- Initialize interface-specific information USAGE - herr_t H5R_init_deprec_interface() + herr_t H5R__init_deprec_interface() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -98,13 +98,38 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5R_init_deprec_interface(void) +H5R__init_deprec_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(H5R_init()) -} /* H5R_init_deprec_interface() */ +} /* H5R__init_deprec_interface() */ + + +/*-------------------------------------------------------------------------- +NAME + H5R__term_deprec_interface -- Terminate interface +USAGE + herr_t H5R__term_deprec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5R__term_deprec_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + FUNC_LEAVE_NOAPI(0) +} /* H5R__term_deprec_interface() */ + +#ifndef H5_NO_DEPRECATED_SYMBOLS /*-------------------------------------------------------------------------- NAME diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index 8c66a90..fd16754 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -55,6 +55,7 @@ /* General functions */ H5_DLL herr_t H5R_init(void); +H5_DLL herr_t H5R__term_deprec_interface(void); H5_DLL herr_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref, H5O_type_t *obj_type); H5_DLL hid_t H5R_dereference(H5F_t *file, hid_t dapl_id, hid_t dxpl_id, H5R_type_t ref_type, diff --git a/src/H5T.c b/src/H5T.c index 994c01e..cd3c48a 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1487,6 +1487,10 @@ H5T_term_interface(void) /* Unlock all datatypes, then free them */ /* note that we are ignoring the return value from H5I_iterate() */ H5I_iterate(H5I_DATATYPE, H5T_unlock_cb, NULL, FALSE); + + /* Close deprecated interface */ + n += H5T__term_deprec_interface(); + H5I_dec_type_ref(H5I_DATATYPE); /* Reset all the datatype IDs */ diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 32080fe..a8881fb 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -34,7 +34,7 @@ #define H5T_PACKAGE /*suppress error about including H5Tpkg */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_deprec_interface +#define H5_INTERFACE_INIT_FUNC H5T__init_deprec_interface /***********/ @@ -49,7 +49,6 @@ #include "H5Tpkg.h" /* Datatypes */ -#ifndef H5_NO_DEPRECATED_SYMBOLS /****************/ /* Local Macros */ /****************/ @@ -88,9 +87,9 @@ /*-------------------------------------------------------------------------- NAME - H5T_init_deprec_interface -- Initialize interface-specific information + H5T__init_deprec_interface -- Initialize interface-specific information USAGE - herr_t H5T_init_deprec_interface() + herr_t H5T__init_deprec_interface() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -99,13 +98,38 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5T_init_deprec_interface(void) +H5T__init_deprec_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_deprec_interface() */ +} /* H5T__init_deprec_interface() */ + + +/*-------------------------------------------------------------------------- +NAME + H5T__term_deprec_interface -- Terminate interface +USAGE + herr_t H5T__term_deprec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5T__term_deprec_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + FUNC_LEAVE_NOAPI(0) +} /* H5T__term_deprec_interface() */ + +#ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- * Function: H5Tcommit1 diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 8323e15..bd37829 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -508,6 +508,7 @@ H5FL_EXTERN(H5T_t); H5FL_EXTERN(H5T_shared_t); /* Common functions */ +H5_DLL herr_t H5T__term_deprec_interface(void); H5_DLL H5T_t *H5T__create(H5T_class_t type, size_t size); H5_DLL herr_t H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id); H5_DLL herr_t H5T__commit_named(const H5G_loc_t *loc, const char *name, diff --git a/test/tmisc.c b/test/tmisc.c index 512d029..cac6b04 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -316,6 +316,15 @@ unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset /* Definitions for misc. test #30 */ #define MISC30_FILE "tmisc30.h5" +/* Definitions for misc. test #31 */ +#define MISC31_FILE "tmisc31.h5" +#define MISC31_DSETNAME "dset" +#define MISC31_ATTRNAME1 "attr1" +#define MISC31_ATTRNAME2 "attr2" +#define MISC31_GROUPNAME "group" +#define MISC31_PROPNAME "misc31_prop" +#define MISC31_DTYPENAME "dtype" + /**************************************************************** ** ** test_misc1(): test unlinking a dataset from a group and immediately @@ -5195,6 +5204,105 @@ test_misc30(void) VERIFY(file_size[0], file_size[1], "test_misc30"); } /* end test_misc30() */ + +/**************************************************************** +** +** test_misc31(): Test reentering library through deprecated +* routines that register an id after calling +* H5close(). +** +****************************************************************/ +static void +test_misc31(void) +{ + hid_t file_id; /* File id */ + hid_t space_id; /* Dataspace id */ + hid_t dset_id; /* Dataset id */ + hid_t attr_id; /* Attribute id */ + hid_t group_id; /* Group id */ + hid_t dtype_id; /* Datatype id */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Deprecated routines initialize after H5close()\n")); + +#ifndef H5_NO_DEPRECATED_SYMBOLS + file_id = H5Fcreate(MISC31_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fcreate"); + + /* Test dataset package */ + space_id = H5Screate(H5S_SCALAR); + CHECK(space_id, FAIL, "H5Screate"); + dset_id = H5Dcreate1(file_id, MISC31_DSETNAME, H5T_NATIVE_INT, space_id, H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dcreate1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fopen"); + dset_id = H5Dopen1(file_id, MISC31_DSETNAME); + CHECK(dset_id, FAIL, "H5Dopen1"); + + /* Test attribute package */ + space_id = H5Screate(H5S_SCALAR); + CHECK(space_id, FAIL, "H5Screate"); + attr_id = H5Acreate1(dset_id, MISC31_ATTRNAME1, H5T_NATIVE_INT, space_id, H5P_DEFAULT); + CHECK(attr_id, FAIL, "H5Acreate1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fopen"); + dset_id = H5Dopen1(file_id, MISC31_DSETNAME); + CHECK(dset_id, FAIL, "H5Dopen1"); + space_id = H5Screate(H5S_SCALAR); + CHECK(space_id, FAIL, "H5Screate"); + attr_id = H5Acreate1(dset_id, MISC31_ATTRNAME2, H5T_NATIVE_INT, space_id, H5P_DEFAULT); + CHECK(attr_id, FAIL, "H5Acreate1"); + + /* Test group package */ + group_id = H5Gcreate1(file_id, MISC31_GROUPNAME, 0); + CHECK(group_id, FAIL, "H5Gcreate1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fopen"); + group_id = H5Gopen1(file_id, MISC31_GROUPNAME); + CHECK(group_id, FAIL, "H5Gopen1"); + + /* Test property list package */ + ret = H5Pregister1(H5P_OBJECT_CREATE, MISC31_PROPNAME, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + CHECK(ret, FAIL, "H5Pregister1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + ret = H5Pregister1(H5P_OBJECT_CREATE, MISC31_PROPNAME, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + CHECK(ret, FAIL, "H5Pregister1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + + /* Test datatype package */ + file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fopen"); + dtype_id = H5Tcopy(H5T_NATIVE_INT); + CHECK(dtype_id, FAIL, "H5Tcopy"); + ret = H5Tcommit1(file_id, MISC31_DTYPENAME, dtype_id); + CHECK(ret, FAIL, "H5Tcommit1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fopen"); + dtype_id = H5Topen1(file_id, MISC31_DTYPENAME); + CHECK(ret, FAIL, "H5Topen1"); + ret = H5Fclose(file_id); + CHECK(ret, FAIL, "H5Fclose"); + ret = H5Tclose(dtype_id); + CHECK(ret, FAIL, "H5Tclose"); + +#else /* H5_NO_DEPRECATED_SYMBOLS */ + /* Output message about test being skipped */ + MESSAGE(5, (" ...Skipped")); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ +} /* end test_misc31() */ + + /**************************************************************** ** ** test_misc(): Main misc. test routine. @@ -5240,6 +5348,7 @@ test_misc(void) test_misc28(); /* Test that chunks are cached appropriately */ test_misc29(); /* Test that speculative metadata reads are handled correctly */ test_misc30(); /* Exercise local heap loading bug where free lists were getting dropped */ + test_misc31(); /* Test Reentering library through deprecated routines after H5close() */ } /* test_misc() */ @@ -5296,5 +5405,6 @@ cleanup_misc(void) HDremove(MISC28_FILE); HDremove(MISC29_COPY_FILE); HDremove(MISC30_FILE); + HDremove(MISC31_FILE); } -- cgit v0.12