summaryrefslogtreecommitdiffstats
path: root/src/H5Oshared.h
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/H5Oshared.h
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/H5Oshared.h')
-rw-r--r--src/H5Oshared.h75
1 files changed, 64 insertions, 11 deletions
diff --git a/src/H5Oshared.h b/src/H5Oshared.h
index 70049c7..96fb938 100644
--- a/src/H5Oshared.h
+++ b/src/H5Oshared.h
@@ -66,7 +66,7 @@ H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, const uint8_t *p
/* Check for shared message */
if(mesg_flags & H5O_MSG_FLAG_SHARED) {
/* Retrieve native message info indirectly through shared message */
- if(NULL == (ret_value = H5O_shared_decode_new(f, dxpl_id, p, H5O_SHARED_TYPE)))
+ if(NULL == (ret_value = H5O_shared_decode(f, dxpl_id, p, H5O_SHARED_TYPE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message")
} /* end if */
else {
@@ -98,7 +98,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5_inline herr_t
-H5O_SHARED_ENCODE(H5F_t *f, uint8_t *p, const void *_mesg)
+H5O_SHARED_ENCODE(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg)
{
const H5O_shared_t *sh_mesg = (const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
herr_t ret_value = SUCCEED; /* Return value */
@@ -116,9 +116,9 @@ H5O_SHARED_ENCODE(H5F_t *f, uint8_t *p, const void *_mesg)
#endif /* H5O_SHARED_ENCODE_REAL */
/* Check for shared message */
- if(H5O_IS_SHARED(sh_mesg->flags)) {
+ if(H5O_IS_SHARED(sh_mesg->flags) && !disable_shared) {
/* Encode shared message into buffer */
- if(H5O_shared_encode_new(f, p, sh_mesg) < 0)
+ if(H5O_shared_encode(f, p, sh_mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message")
} /* end if */
else {
@@ -150,7 +150,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5_inline size_t
-H5O_SHARED_SIZE(const H5F_t *f, const void *_mesg)
+H5O_SHARED_SIZE(const H5F_t *f, hbool_t disable_shared, const void *_mesg)
{
const H5O_shared_t *sh_mesg = (const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
size_t ret_value; /* Return value */
@@ -168,9 +168,9 @@ H5O_SHARED_SIZE(const H5F_t *f, const void *_mesg)
#endif /* H5O_SHARED_SIZE_REAL */
/* Check for shared message */
- if(H5O_IS_SHARED(sh_mesg->flags)) {
+ if(H5O_IS_SHARED(sh_mesg->flags) && !disable_shared) {
/* Retrieve encoded size of shared message */
- if(0 == (ret_value = H5O_shared_size_new(f, sh_mesg)))
+ if(0 == (ret_value = H5O_shared_size(f, sh_mesg)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message")
} /* end if */
else {
@@ -220,7 +220,7 @@ H5O_SHARED_DELETE(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
/* Check for shared message */
if(H5O_IS_SHARED(sh_mesg->flags)) {
/* Decrement the reference count on the shared message/object */
- if(H5O_shared_delete_new(f, dxpl_id, sh_mesg, H5O_SHARED_TYPE, adj_link) < 0)
+ if(H5O_shared_delete(f, dxpl_id, sh_mesg, H5O_SHARED_TYPE, adj_link) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message")
} /* end if */
#ifdef H5O_SHARED_DELETE_REAL
@@ -272,7 +272,7 @@ H5O_SHARED_LINK(H5F_t *f, hid_t dxpl_id, const void *_mesg)
/* Check for shared message */
if(H5O_IS_SHARED(sh_mesg->flags)) {
/* Increment the reference count on the shared message/object */
- if(H5O_shared_link_new(f, dxpl_id, sh_mesg, H5O_SHARED_TYPE) < 0)
+ if(H5O_shared_link(f, dxpl_id, sh_mesg, H5O_SHARED_TYPE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for shared message")
} /* end if */
#ifdef H5O_SHARED_LINK_REAL
@@ -306,7 +306,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5_inline void *
-H5O_SHARED_COPY_FILE(H5F_t *file_src, const H5O_msg_class_t *mesg_type,
+H5O_SHARED_COPY_FILE(H5F_t *file_src,
void *_native_src, H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info,
void *udata)
{
@@ -336,7 +336,7 @@ H5O_SHARED_COPY_FILE(H5F_t *file_src, const H5O_msg_class_t *mesg_type,
HDmemset(dst_mesg, 0, sizeof(H5O_shared_t));
/* Handle sharing destination message */
- if(H5O_shared_copy_file_new(file_src, file_dst, dxpl_id, H5O_SHARED_TYPE,
+ if(H5O_shared_copy_file(file_src, file_dst, dxpl_id, H5O_SHARED_TYPE,
_native_src, dst_mesg, cpy_info, udata) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "unable to determine if message should be shared")
@@ -351,5 +351,58 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_SHARED_COPY_FILE() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_SHARED_DEBUG
+ *
+ * Purpose: Prints debugging info for a potentially shared message.
+ *
+ * Note: The actual name of this routine can be different in each source
+ * file that this header file is included in, and must be defined
+ * prior to including this header file.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, February 3, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5_inline herr_t
+H5O_SHARED_DEBUG(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
+ int indent, int fwidth)
+{
+ const H5O_shared_t *sh_mesg = (const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_SHARED_DEBUG)
+
+#ifndef H5O_SHARED_TYPE
+#error "Need to define H5O_SHARED_TYPE macro!"
+#endif /* H5O_SHARED_TYPE */
+#ifndef H5O_SHARED_DEBUG
+#error "Need to define H5O_SHARED_DEBUG macro!"
+#endif /* H5O_SHARED_DEBUG */
+#ifndef H5O_SHARED_DEBUG_REAL
+#error "Need to define H5O_SHARED_DEBUG_REAL macro!"
+#endif /* H5O_SHARED_DEBUG_REAL */
+
+ /* Check for shared message */
+ if(H5O_IS_SHARED(sh_mesg->flags)) {
+ /* Print shared message information */
+ if(H5O_shared_debug(sh_mesg, stream, indent, fwidth) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display shared message info")
+ } /* end if */
+
+ /* Call native message's debug callback */
+ if(H5O_SHARED_DEBUG_REAL(f, dxpl_id, _mesg, stream, indent, fwidth) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display native message info")
+
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_SHARED_DEBUG() */
+
#endif /* H5Oshared_H */