summaryrefslogtreecommitdiffstats
path: root/src/H5VL.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2015-09-14 20:22:39 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2015-09-14 20:22:39 (GMT)
commit81e4ce7805a034e7684f48a208621180cc168921 (patch)
treec6f3187d6a49a314674d642eabda0554386c90b9 /src/H5VL.c
parentc3649ea51764b1e7d2b82ca3d5a2ba4053f34a6d (diff)
parentb2f94f9faf805035e4d0e9cb76007204c8250e58 (diff)
downloadhdf5-81e4ce7805a034e7684f48a208621180cc168921.zip
hdf5-81e4ce7805a034e7684f48a208621180cc168921.tar.gz
hdf5-81e4ce7805a034e7684f48a208621180cc168921.tar.bz2
[svn-r27777] merge from trunk.
Diffstat (limited to 'src/H5VL.c')
-rw-r--r--src/H5VL.c140
1 files changed, 69 insertions, 71 deletions
diff --git a/src/H5VL.c b/src/H5VL.c
index 74e33b9..93019c9 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -27,10 +27,8 @@
/* Module Setup */
/****************/
-#define H5VL_PACKAGE /*suppress error about including H5VLpkg */
+#include "H5VLmodule.h" /* This source code file is part of the H5VL module */
-/* Interface initialization */
-#define H5_INTERFACE_INIT_FUNC H5VL_init_interface
/***********/
/* Headers */
@@ -49,6 +47,13 @@
/********************/
static herr_t H5VL_free_cls(H5VL_class_t *cls);
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
/*******************/
/* Local Variables */
/*******************/
@@ -65,16 +70,18 @@ static const H5I_class_t H5I_VOL_CLS[1] = {{
(H5I_free_t)H5VL_free_cls /* Callback routine for closing objects of this class */
}};
-
+/* Flag indicating "top" of interface has been initialized */
+static hbool_t H5VL_top_package_initialize_s = FALSE;
+
/*-------------------------------------------------------------------------
- * Function: H5VL_init
+ * Function:H5VL_init
*
- * Purpose: Initialize the interface from some other package.
+ * Purpose:Initialize the interface from some other package.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return:Success:non-negative
+ *Failure:negative
*
- * Programmer: Mohamad Chaarawi
+ * Programmer:Mohamad Chaarawi
* January, 2012
*
*-------------------------------------------------------------------------
@@ -92,85 +99,76 @@ done:
} /* end H5VL_init() */
-/*-------------------------------------------------------------------------
- * Function: H5VL_init_interface
- *
- * Purpose: Initialize the virtual object layer.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * January, 2012
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL_init_interface(void)
+/*--------------------------------------------------------------------------
+NAME
+ H5VL__init_package -- Initialize interface-specific information
+USAGE
+ herr_t H5VL__init_package()
+RETURNS
+ Non-negative on success/Negative on failure
+DESCRIPTION
+ Initializes any interface-specific data or routines.
+--------------------------------------------------------------------------*/
+herr_t
+H5VL__init_package(void)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
- /* register VOL ID type */
+ /* Initialize the atom group for the VL IDs */
if(H5I_register_type(H5I_VOL_CLS) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize interface")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_init_interface() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_term_interface
- *
- * Purpose: Terminate this interface: free all memory and reset global
- * variables to their initial values. Release all ID groups
- * associated with this interface.
- *
- * Return: Success: Positive if anything was done that might
- * have affected other interfaces; zero
- * otherwise.
- *
- * Failure: Never fails.
- *
- * Programmer: Mohamad Chaarawi
- * January, 2012
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
+} /* end H5VL__init_package() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5VL_term_package
+ PURPOSE
+ Terminate various H5VL objects
+ USAGE
+ void H5VL_term_package()
+ RETURNS
+ Non-negative on success/Negative on failure
+ DESCRIPTION
+ Release the atom group and any other resources allocated.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Can't report errors...
+
+ Finishes shutting down the interface, after H5VL_top_term_package()
+ is called
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
int
-H5VL_term_interface(void)
+H5VL_term_package(void)
{
- int n = 0, n1 = 0;
- hbool_t term = TRUE;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(H5_interface_initialize_g) {
- if((n1=H5I_nmembers(H5I_VOL))!=0) {
- H5I_clear_type(H5I_VOL, FALSE, FALSE);
- term = FALSE;
- } else {
- H5I_dec_type_ref(H5I_VOL);
- }
-
- if (term) {
- H5_interface_initialize_g = 0;
- n = 1;
+ if(H5_PKG_INIT_VAR) {
+
+ if(H5I_nmembers(H5I_VOL) > 0) {
+ (void)H5I_clear_type(H5I_VOL, FALSE, FALSE);
+ n++;
}
else {
- n = n1;
+ n += (H5I_dec_type_ref(H5I_VOL) > 0);
+
+ /* Mark interface as closed */
+ if(0 == n)
+ H5_PKG_INIT_VAR = FALSE;
}
- }
+ } /* end if */
FUNC_LEAVE_NOAPI(n)
-}
+} /* end H5VL_term_package() */
/*-------------------------------------------------------------------------
@@ -653,7 +651,7 @@ done:
herr_t
H5VLget_object(hid_t obj_id, void **obj)
{
- hid_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i**x", obj_id, obj);