summaryrefslogtreecommitdiffstats
path: root/src/H5S.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5S.c')
-rw-r--r--src/H5S.c95
1 files changed, 74 insertions, 21 deletions
diff --git a/src/H5S.c b/src/H5S.c
index feeefbb..747d297 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -44,6 +44,7 @@
/********************/
/* Local Prototypes */
/********************/
+static herr_t H5S__close_cb(void *space, void **request);
static htri_t H5S__is_simple(const H5S_t *sdim);
/*****************************/
@@ -81,23 +82,44 @@ H5FL_ARR_DEFINE(hsize_t, H5S_MAX_RANK);
/* Dataspace ID class */
static const H5I_class_t H5I_DATASPACE_CLS[1] = {{
- H5I_DATASPACE, /* ID class value */
- 0, /* Class flags */
- 2, /* # of reserved IDs for class */
- (H5I_free_t)H5S_close /* Callback routine for closing objects of this class */
+ H5I_DATASPACE, /* ID class value */
+ 0, /* Class flags */
+ 2, /* # of reserved IDs for class */
+ (H5I_free_t)H5S__close_cb /* Callback routine for closing objects of this class */
}};
/* Dataspace selection iterator ID class */
static const H5I_class_t H5I_SPACE_SEL_ITER_CLS[1] = {{
- H5I_SPACE_SEL_ITER, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
- (H5I_free_t)H5S_sel_iter_close /* Callback routine for closing objects of this class */
+ H5I_SPACE_SEL_ITER, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5S__sel_iter_close_cb /* Callback routine for closing objects of this class */
}};
/* Flag indicating "top" of interface has been initialized */
static hbool_t H5S_top_package_initialize_s = FALSE;
+/*-------------------------------------------------------------------------
+ * Function: H5S_init
+ *
+ * Purpose: Initialize the interface from some other layer.
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5S_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 H5S_init() */
+
/*--------------------------------------------------------------------------
NAME
H5S__init_package -- Initialize interface-specific information
@@ -115,11 +137,11 @@ H5S__init_package(void)
FUNC_ENTER_PACKAGE
- /* Initialize the atom group for the dataspace IDs */
+ /* Initialize the ID group for the dataspace IDs */
if (H5I_register_type(H5I_DATASPACE_CLS) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace ID class")
- /* Initialize the atom group for the dataspace selction iterator IDs */
+ /* Initialize the ID group for the dataspace selction iterator IDs */
if (H5I_register_type(H5I_SPACE_SEL_ITER_CLS) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to initialize dataspace selection iterator ID class")
@@ -141,7 +163,7 @@ done:
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
- Release IDs for the atom group, deferring full interface shutdown
+ Release IDs for the ID group, deferring full interface shutdown
until later (in H5S_term_package).
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
@@ -185,7 +207,7 @@ H5S_top_term_package(void)
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
- Release the atom group and any other resources allocated.
+ Release the ID group and any other resources allocated.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
Can't report errors...
@@ -222,6 +244,37 @@ H5S_term_package(void)
FUNC_LEAVE_NOAPI(n)
} /* end H5S_term_package() */
+/*-------------------------------------------------------------------------
+ * Function: H5S__close_cb
+ *
+ * Purpose: Called when the ref count reaches zero on a dataspace's ID
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, April 8, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5S__close_cb(void *_space, void H5_ATTR_UNUSED **request)
+{
+ H5S_t *space = (H5S_t *)_space; /* The dataspace to close */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(space);
+
+ /* Close the dataspace object */
+ if (H5S_close(space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CLOSEERROR, FAIL, "unable to close dataspace");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__close_cb() */
+
/*--------------------------------------------------------------------------
NAME
H5S_get_validiated_dataspace
@@ -382,9 +435,9 @@ H5Screate(H5S_class_t type)
if (NULL == (new_ds = H5S_create(type)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace")
- /* Atomize */
+ /* Register */
if ((ret_value = H5I_register(H5I_DATASPACE, new_ds, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
done:
if (ret_value < 0)
@@ -531,9 +584,9 @@ H5Scopy(hid_t space_id)
if (NULL == (dst = H5S_copy(src, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace")
- /* Atomize */
+ /* Register */
if ((ret_value = H5I_register(H5I_DATASPACE, dst, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID")
done:
if (ret_value < 0)
@@ -1230,7 +1283,7 @@ H5Sis_simple(hid_t space_id)
/* Check args and all the boring stuff. */
if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace")
ret_value = H5S__is_simple(space);
@@ -1276,7 +1329,7 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], con
/* Check args */
if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace")
if (rank > 0 && dims == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified")
if (rank < 0 || rank > H5S_MAX_RANK)
@@ -1432,9 +1485,9 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/
if (NULL == (space = H5S_create_simple((unsigned)rank, dims, maxdims)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, H5I_INVALID_HID, "can't create simple dataspace")
- /* Atomize */
+ /* Register */
if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID")
done:
if (ret_value < 0)
@@ -1804,7 +1857,7 @@ H5Sset_extent_none(hid_t space_id)
/* Check args */
if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace")
/* Clear the previous extent from the dataspace */
if (H5S__extent_release(&space->extent) < 0)