summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2019-12-13 19:48:03 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2019-12-13 19:48:03 (GMT)
commit8ae9bfa1d9f642afcc11e12bda5b1eeb2c9b7510 (patch)
treefaf73a6fb72fcc9db151b39c635261050ef4794b
parentbbdb0306556459531d9e19bc6dae3c602341bdcf (diff)
parent5b751543ca7be96a91cd2db55976188f9ddbace1 (diff)
downloadhdf5-8ae9bfa1d9f642afcc11e12bda5b1eeb2c9b7510.zip
hdf5-8ae9bfa1d9f642afcc11e12bda5b1eeb2c9b7510.tar.gz
hdf5-8ae9bfa1d9f642afcc11e12bda5b1eeb2c9b7510.tar.bz2
Merge pull request #2142 in HDFFV/hdf5 from ~NFORTNE2/hdf5_naf:tmp_112 to hdf5_1_12
* commit '5b751543ca7be96a91cd2db55976188f9ddbace1': 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.
-rw-r--r--src/H5A.c23
-rw-r--r--src/H5Aprivate.h1
-rw-r--r--src/H5F.c24
-rw-r--r--src/H5Fprivate.h1
-rw-r--r--src/H5G.c23
-rw-r--r--src/H5Gprivate.h1
-rw-r--r--src/H5M.c23
-rw-r--r--src/H5Mprivate.h1
-rw-r--r--src/H5VL.c33
-rw-r--r--src/H5VLint.c19
-rw-r--r--src/H5trace.c6
11 files changed, 153 insertions, 2 deletions
diff --git a/src/H5A.c b/src/H5A.c
index abf8694..dcb013f 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -100,6 +100,29 @@ 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
H5A__init_package -- Initialize interface-specific information
diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h
index 342ffc8..b288228 100644
--- a/src/H5Aprivate.h
+++ b/src/H5Aprivate.h
@@ -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);
diff --git a/src/H5F.c b/src/H5F.c
index 35176fc..41eac3e 100644
--- a/src/H5F.c
+++ b/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
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index cfb796c..4008eb8 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -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);
diff --git a/src/H5G.c b/src/H5G.c
index 85515d3..d194469 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -144,6 +144,29 @@ 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
*
* Purpose: Initializes the H5G interface.
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index f149f29..b735dbd 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -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);
diff --git a/src/H5M.c b/src/H5M.c
index adb4df0..ef5b4d9 100644
--- a/src/H5M.c
+++ b/src/H5M.c
@@ -78,6 +78,29 @@ 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
H5M__init_package -- Initialize interface-specific information
USAGE
diff --git a/src/H5Mprivate.h b/src/H5Mprivate.h
index c841e75..3d0e8cc 100644
--- a/src/H5Mprivate.h
+++ b/src/H5Mprivate.h
@@ -65,6 +65,7 @@
/****************************/
/* Library Private Typedefs */
/****************************/
+H5_DLL herr_t H5M_init(void);
/*****************************/
diff --git a/src/H5VL.c b/src/H5VL.c
index 6790465..df05396 100644
--- a/src/H5VL.c
+++ b/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")
diff --git a/src/H5VLint.c b/src/H5VLint.c
index 284b266..bc50a38 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -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")
diff --git a/src/H5trace.c b/src/H5trace.c
index 74f6adf..06e093a 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -2837,6 +2837,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;
@@ -2855,6 +2858,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;