summaryrefslogtreecommitdiffstats
path: root/src/H5Osdspace.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-02-04 07:37:15 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-02-04 07:37:15 (GMT)
commit0a8bba91530eb333e7d3f17e18aac12db44eda63 (patch)
tree9b6cf88bc5113878ddeca5facadc1c3347ba0654 /src/H5Osdspace.c
parentf555ac654b71f0bcaab99775f8c2fe1dac26bfab (diff)
downloadhdf5-0a8bba91530eb333e7d3f17e18aac12db44eda63.zip
hdf5-0a8bba91530eb333e7d3f17e18aac12db44eda63.tar.gz
hdf5-0a8bba91530eb333e7d3f17e18aac12db44eda63.tar.bz2
[svn-r13232] Description:
Remove the "scaffolding" for shared message method invocation and simplify the way shared messages are dealt with in general. Tested on: FreeBSD/32 6.2 (duty) Mac OS X/32 10.4.8 (amazon)
Diffstat (limited to 'src/H5Osdspace.c')
-rw-r--r--src/H5Osdspace.c157
1 files changed, 31 insertions, 126 deletions
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 1d406d9..c111824 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -31,11 +31,8 @@ static void *H5O_sdspace_copy(const void *_mesg, void *_dest);
static size_t H5O_sdspace_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_sdspace_reset(void *_mesg);
static herr_t H5O_sdspace_free(void *_mesg);
-static void *H5O_sdspace_get_share(const void *_mesg, H5O_shared_t *sh);
-static herr_t H5O_sdspace_set_share(void *_mesg, const H5O_shared_t *sh);
-static htri_t H5O_sdspace_is_shared(const void *_mesg);
-static herr_t H5O_sdspace_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t *type,
- const void *mesg_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void *_udata);
+static herr_t H5O_sdspace_pre_copy_file(H5F_t *file_src, const void *mesg_src,
+ hbool_t *deleted, const H5O_copy_t *cpy_info, void *_udata);
static herr_t H5O_sdspace_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
FILE * stream, int indent, int fwidth);
@@ -53,6 +50,8 @@ static herr_t H5O_sdspace_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
#undef H5O_SHARED_LINK_REAL
#define H5O_SHARED_COPY_FILE H5O_sdspace_shared_copy_file
#undef H5O_SHARED_COPY_FILE_REAL
+#define H5O_SHARED_DEBUG H5O_sdspace_shared_debug
+#define H5O_SHARED_DEBUG_REAL H5O_sdspace_debug
#include "H5Oshared.h" /* Shared Object Header Message Callbacks */
/* This message derives from H5O message class */
@@ -60,6 +59,7 @@ const H5O_msg_class_t H5O_MSG_SDSPACE[1] = {{
H5O_SDSPACE_ID, /* message id number */
"dataspace", /* message name for debugging */
sizeof(H5S_extent_t), /* native message size */
+ TRUE, /* messages are sharable? */
H5O_sdspace_shared_decode, /* decode message */
H5O_sdspace_shared_encode, /* encode message */
H5O_sdspace_copy, /* copy the native value */
@@ -68,16 +68,14 @@ const H5O_msg_class_t H5O_MSG_SDSPACE[1] = {{
H5O_sdspace_free, /* free method */
H5O_sdspace_shared_delete, /* file delete method */
H5O_sdspace_shared_link, /* link method */
- H5O_sdspace_get_share, /* get share method */
- H5O_sdspace_set_share, /* set share method */
+ H5O_shared_copy, /* set share method */
NULL, /*can share method */
- H5O_sdspace_is_shared, /* is shared method */
H5O_sdspace_pre_copy_file, /* pre copy native value to file */
H5O_sdspace_shared_copy_file,/* copy native value to file */
NULL, /* post copy native value to file */
NULL, /* get creation index */
NULL, /* set creation index */
- H5O_sdspace_debug /* debug the message */
+ H5O_sdspace_shared_debug /* debug the message */
}};
/* Initial version of the dataspace information */
@@ -437,111 +435,19 @@ H5O_sdspace_reset(void *_mesg)
* Programmer: Quincey Koziol
* Thursday, March 30, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_sdspace_free (void *mesg)
+H5O_sdspace_free(void *mesg)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_free)
- assert (mesg);
+ HDassert(mesg);
- H5FL_FREE(H5S_extent_t,mesg);
+ H5FL_FREE(H5S_extent_t, mesg);
FUNC_LEAVE_NOAPI(SUCCEED)
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_sdspace_get_share
- *
- * Purpose: Gets sharing information from the message
- *
- * Return: Shared message on success/NULL on failure
- *
- * Programmer: James Laird
- * Tuesday, October 10, 2006
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5O_sdspace_get_share(const void *_mesg, H5O_shared_t *sh /*out*/)
-{
- const H5S_extent_t *mesg = (const H5S_extent_t *)_mesg;
- void *ret_value = NULL;
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_get_share)
-
- HDassert (mesg);
-
- ret_value = H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_sdspace_get_share() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_sdspace_set_share
- *
- * Purpose: Sets sharing information for the message
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: James Laird
- * Tuesday, October 10, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_sdspace_set_share(void *_mesg/*in,out*/, const H5O_shared_t *sh)
-{
- H5S_extent_t *mesg = (H5S_extent_t *)_mesg;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_set_share)
-
- HDassert (mesg);
- HDassert (sh);
-
- if(NULL == H5O_msg_copy(H5O_SHARED_ID, sh, &(mesg->sh_loc)))
- ret_value = FAIL;
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_sdspace_set_share() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_sdspace_is_shared
- *
- * Purpose: Determines if this dataspace is shared (committed or a SOHM)
- * or not.
- *
- * Return: TRUE if dataspace is shared
- * FALSE if dataspace is not shared
- * Negative on failure
- *
- * Programmer: James Laird
- * Monday, October 16, 2006
- *
- *-------------------------------------------------------------------------
- */
-static htri_t
-H5O_sdspace_is_shared(const void *_mesg)
-{
- const H5S_extent_t *mesg = (const H5S_extent_t *)_mesg;
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_is_shared)
-
- HDassert(mesg);
-
- /* Dataspaces can't currently be committed, but this should let the
- * library read a "committed dataspace" if we ever create one in
- * the future.
- */
- FUNC_LEAVE_NOAPI(H5O_IS_SHARED(mesg->sh_loc.flags))
-} /* end H5O_sdspace_is_shared() */
+} /* end H5O_sdspace_free() */
/*-------------------------------------------------------------------------
@@ -560,9 +466,8 @@ H5O_sdspace_is_shared(const void *_mesg)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_sdspace_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *type,
- const void *mesg_src, hbool_t UNUSED *deleted, const H5O_copy_t UNUSED *cpy_info,
- void *_udata)
+H5O_sdspace_pre_copy_file(H5F_t *file_src, const void *mesg_src,
+ hbool_t UNUSED *deleted, const H5O_copy_t UNUSED *cpy_info, void *_udata)
{
const H5S_extent_t *src_space_extent = (const H5S_extent_t *)mesg_src; /* Source dataspace extent */
H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */
@@ -617,44 +522,44 @@ static herr_t
H5O_sdspace_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *mesg,
FILE * stream, int indent, int fwidth)
{
- const H5S_extent_t *sdim = (const H5S_extent_t *) mesg;
- unsigned u; /* local counting variable */
+ const H5S_extent_t *sdim = (const H5S_extent_t *)mesg;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_debug)
/* check args */
- assert(f);
- assert(sdim);
- assert(stream);
- assert(indent >= 0);
- assert(fwidth >= 0);
+ HDassert(f);
+ HDassert(sdim);
+ HDassert(stream);
+ HDassert(indent >= 0);
+ HDassert(fwidth >= 0);
HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
"Rank:",
(unsigned long) (sdim->rank));
- if(sdim->rank>0) {
+ if(sdim->rank > 0) {
+ unsigned u; /* local counting variable */
+
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:");
- for (u = 0; u < sdim->rank; u++)
+ for(u = 0; u < sdim->rank; u++)
HDfprintf (stream, "%s%Hu", u?", ":"", sdim->size[u]);
HDfprintf (stream, "}\n");
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Dim Max:");
- if (sdim->max) {
+ if(sdim->max) {
HDfprintf (stream, "{");
- for (u = 0; u < sdim->rank; u++) {
- if (H5S_UNLIMITED==sdim->max[u]) {
+ for(u = 0; u < sdim->rank; u++) {
+ if(H5S_UNLIMITED==sdim->max[u])
HDfprintf (stream, "%sINF", u?", ":"");
- } else {
+ else
HDfprintf (stream, "%s%Hu", u?", ":"", sdim->max[u]);
- }
- }
+ } /* end for */
HDfprintf (stream, "}\n");
- } else {
+ } /* end if */
+ else
HDfprintf (stream, "CONSTANT\n");
- }
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
-}
+} /* end H5O_sdspace_debug() */