mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-23 16:20:57 +08:00
Merge pull request #2139 in HDFFV/hdf5 from ~NFORTNE2/hdf5_naf:vol_init_fix to develop
* commit 'ce653ff82b7dd52b8e36a5eff7b1728c4b75d9f7': Modify H5VL initialization routines to initialize all VOL-managed object types. Modify H5VLwrap_register() to reject non-VOL-managed object types. Also fix overisights in h5trace.c from previous changes.
This commit is contained in:
commit
7aedeedf67
23
src/H5A.c
23
src/H5A.c
@ -99,6 +99,29 @@ static const H5I_class_t H5I_ATTR_CLS[1] = {{
|
||||
static hbool_t H5A_top_package_initialize_s = FALSE;
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5A_init
|
||||
*
|
||||
* Purpose: Initialize the interface from some other layer.
|
||||
*
|
||||
* Return: Success: non-negative
|
||||
*
|
||||
* Failure: negative
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5A_init(void)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
/* FUNC_ENTER() does all the work */
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5A_init() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
|
@ -73,6 +73,7 @@ typedef struct H5A_attr_iter_op_t {
|
||||
/***************************************/
|
||||
|
||||
/* General attribute routines */
|
||||
H5_DLL herr_t H5A_init(void);
|
||||
H5_DLL struct H5O_loc_t *H5A_oloc(H5A_t *attr);
|
||||
H5_DLL H5G_name_t *H5A_nameof(H5A_t *attr);
|
||||
H5_DLL H5T_t *H5A_type(const H5A_t *attr);
|
||||
|
24
src/H5F.c
24
src/H5F.c
@ -113,6 +113,30 @@ static const H5I_class_t H5I_FILE_CLS[1] = {{
|
||||
(H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */
|
||||
}};
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_init
|
||||
*
|
||||
* Purpose: Initialize the interface from some other layer.
|
||||
*
|
||||
* Return: Success: non-negative
|
||||
*
|
||||
* Failure: negative
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5F_init(void)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
/* FUNC_ENTER() does all the work */
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5F_init() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
|
@ -730,6 +730,7 @@ typedef enum H5F_prefix_open_t {
|
||||
/***************************************/
|
||||
|
||||
/* Private functions */
|
||||
H5_DLL herr_t H5F_init(void);
|
||||
H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
|
||||
H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/);
|
||||
H5_DLL hid_t H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref);
|
||||
|
23
src/H5G.c
23
src/H5G.c
@ -142,6 +142,29 @@ static const H5I_class_t H5I_GROUP_CLS[1] = {{
|
||||
static hbool_t H5G_top_package_initialize_s = FALSE;
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5G_init
|
||||
*
|
||||
* Purpose: Initialize the interface from some other layer.
|
||||
*
|
||||
* Return: Success: non-negative
|
||||
*
|
||||
* Failure: negative
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5G_init(void)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
/* FUNC_ENTER() does all the work */
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5G_init() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5G__init_package
|
||||
|
@ -186,6 +186,7 @@ typedef struct H5G_entry_t H5G_entry_t;
|
||||
* Library prototypes... These are the ones that other packages routinely
|
||||
* call.
|
||||
*/
|
||||
H5_DLL herr_t H5G_init(void);
|
||||
H5_DLL struct H5O_loc_t *H5G_oloc(H5G_t *grp);
|
||||
H5_DLL H5G_name_t * H5G_nameof(const H5G_t *grp);
|
||||
H5_DLL H5F_t *H5G_fileof(H5G_t *grp);
|
||||
|
23
src/H5M.c
23
src/H5M.c
@ -76,6 +76,29 @@ static const H5I_class_t H5I_MAP_CLS[1] = {{
|
||||
static hbool_t H5M_top_package_initialize_s = FALSE;
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5M_init
|
||||
*
|
||||
* Purpose: Initialize the interface from some other layer.
|
||||
*
|
||||
* Return: Success: non-negative
|
||||
*
|
||||
* Failure: negative
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5M_init(void)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
/* FUNC_ENTER() does all the work */
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5M_init() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
NAME
|
||||
|
@ -65,6 +65,7 @@
|
||||
/****************************/
|
||||
/* Library Private Typedefs */
|
||||
/****************************/
|
||||
H5_DLL herr_t H5M_init(void);
|
||||
|
||||
|
||||
/*****************************/
|
||||
|
33
src/H5VL.c
33
src/H5VL.c
@ -477,6 +477,9 @@ done:
|
||||
* iteration routine callbacks (i.e. the callbacks from H5Aiterate*,
|
||||
* H5Literate* / H5Lvisit*, and H5Ovisit* ).
|
||||
*
|
||||
* type must be a VOL-managed object class (H5I_FILE,
|
||||
* H5I_GROUP, H5I_DATATYPE, H5I_DATASET, H5I_MAP, or H5I_ATTR).
|
||||
*
|
||||
* Return: Success: Non-negative hid_t for the object.
|
||||
* Failure: Negative (H5I_INVALID_HID)
|
||||
*
|
||||
@ -492,8 +495,34 @@ H5VLwrap_register(void *obj, H5I_type_t type)
|
||||
H5TRACE2("i", "*xIt", obj, type);
|
||||
|
||||
/* Check args */
|
||||
if(type <= H5I_BADID || type >= H5I_NTYPES)
|
||||
HGOTO_ERROR(H5E_VOL, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number")
|
||||
/* Use a switch here for (hopefully) better performance than a series of
|
||||
* equality checks. We could also group these types together in H5I_type_t,
|
||||
* make some assertions here to guarantee that, then just check the range.
|
||||
*/
|
||||
switch(type) {
|
||||
case H5I_FILE:
|
||||
case H5I_GROUP:
|
||||
case H5I_DATATYPE:
|
||||
case H5I_DATASET:
|
||||
case H5I_MAP:
|
||||
case H5I_ATTR:
|
||||
/* VOL-managed objects, call is valid */
|
||||
break;
|
||||
case H5I_UNINIT:
|
||||
case H5I_BADID:
|
||||
case H5I_DATASPACE:
|
||||
case H5I_VFL:
|
||||
case H5I_VOL:
|
||||
case H5I_GENPROP_CLS:
|
||||
case H5I_GENPROP_LST:
|
||||
case H5I_ERROR_CLASS:
|
||||
case H5I_ERROR_MSG:
|
||||
case H5I_ERROR_STACK:
|
||||
case H5I_SPACE_SEL_ITER:
|
||||
case H5I_NTYPES:
|
||||
default:
|
||||
HGOTO_ERROR(H5E_VOL, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number")
|
||||
} /* end switch */
|
||||
if(NULL == obj)
|
||||
HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "obj is NULL")
|
||||
|
||||
|
@ -30,10 +30,15 @@
|
||||
/***********/
|
||||
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Aprivate.h" /* Attributes */
|
||||
#include "H5CXprivate.h" /* API Contexts */
|
||||
#include "H5Dprivate.h" /* Datasets */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5Fprivate.h" /* Files */
|
||||
#include "H5FLprivate.h" /* Free lists */
|
||||
#include "H5Gprivate.h" /* Groups */
|
||||
#include "H5Iprivate.h" /* IDs */
|
||||
#include "H5Mprivate.h" /* Maps */
|
||||
#include "H5MMprivate.h" /* Memory management */
|
||||
#include "H5PLprivate.h" /* Plugins */
|
||||
#include "H5Tprivate.h" /* Datatypes */
|
||||
@ -189,6 +194,20 @@ H5VL_init_phase2(void)
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
/* Initialize all packages for VOL-managed objects */
|
||||
if(H5T_init() < 0)
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize datatype interface")
|
||||
if(H5D_init() < 0)
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize dataset interface")
|
||||
if(H5F_init() < 0)
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize file interface")
|
||||
if(H5G_init() < 0)
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize group interface")
|
||||
if(H5A_init() < 0)
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize attribute interface")
|
||||
if(H5M_init() < 0)
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize map interface")
|
||||
|
||||
/* Set up the default VOL connector in the default FAPL */
|
||||
if(H5VL__set_def_conn() < 0)
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to set default VOL connector")
|
||||
|
@ -2841,6 +2841,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
|
||||
H5VL_file_specific_t specific = (H5VL_file_specific_t)HDva_arg(ap, int);
|
||||
|
||||
switch(specific) {
|
||||
case H5VL_FILE_POST_OPEN:
|
||||
HDfprintf(out, "H5VL_FILE_POST_OPEN");
|
||||
break;
|
||||
case H5VL_FILE_FLUSH:
|
||||
HDfprintf(out, "H5VL_FILE_FLUSH");
|
||||
break;
|
||||
@ -2859,6 +2862,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
|
||||
case H5VL_FILE_DELETE:
|
||||
HDfprintf(out, "H5VL_FILE_DELETE");
|
||||
break;
|
||||
case H5VL_FILE_IS_EQUAL:
|
||||
HDfprintf(out, "H5VL_FILE_IS_EQUAL");
|
||||
break;
|
||||
default:
|
||||
HDfprintf(out, "%ld", (long)specific);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user