[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)
This commit is contained in:
Quincey Koziol 2014-04-09 00:08:21 -05:00
parent f32690b53c
commit 3de25ee226
27 changed files with 447 additions and 55 deletions

View File

@ -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;

View File

@ -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
/*--------------------------------------------------------------------------

View File

@ -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,

View File

@ -93,6 +93,30 @@ H5D__init_pub_interface(void)
FUNC_LEAVE_NOAPI(H5D_init())
} /* 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

View File

@ -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
/*-------------------------------------------------------------------------

View File

@ -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*/

View File

@ -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,

View File

@ -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);

View File

@ -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

View File

@ -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 */

View File

@ -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*/

View File

@ -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

View File

@ -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);

View File

@ -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);
if((n = H5I_nmembers(H5I_GROUP)))
H5I_clear_type(H5I_GROUP, FALSE, FALSE);
else {
/* Close deprecated interface */
n += H5G__term_deprec_interface();
/* Mark closed */
H5_interface_initialize_g = 0;
n = 1; /*H5I*/
} /* end 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 */
} /* end if */
FUNC_LEAVE_NOAPI(n)

View File

@ -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

View File

@ -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);
/*

View File

@ -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() */
/*--------------------------------------------------------------------------

View File

@ -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

View File

@ -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);

View File

@ -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,

View File

@ -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*/

View File

@ -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

View File

@ -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,

View File

@ -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 */

View File

@ -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

View File

@ -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,

View File

@ -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);
}