summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-01-23 19:08:31 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-01-23 19:08:31 (GMT)
commitdc02b5bd22b61c52a6947f338691bc801baf1b91 (patch)
tree77013d8dc9fd43a3ddf3dfe88fe8f09fbe0b5ed0 /src
parent59eccdaf699634dfb16419200549268623ac4e9b (diff)
downloadhdf5-dc02b5bd22b61c52a6947f338691bc801baf1b91.zip
hdf5-dc02b5bd22b61c52a6947f338691bc801baf1b91.tar.gz
hdf5-dc02b5bd22b61c52a6947f338691bc801baf1b91.tar.bz2
[svn-r13182] Description:
Move filter pipeline message class to new "shared message interface" regime, along with minor fixups to implementation of calling that interface. Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src')
-rw-r--r--src/H5Ocache.c2
-rw-r--r--src/H5Omessage.c75
-rw-r--r--src/H5Onull.c1
-rw-r--r--src/H5Opkg.h8
-rw-r--r--src/H5Opline.c12
-rw-r--r--src/H5Oshared.c103
-rw-r--r--src/H5Oshared.h46
7 files changed, 122 insertions, 125 deletions
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 0970bed..02c8975 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -175,7 +175,7 @@ H5O_flush_msgs(H5F_t *f, H5O_t *oh)
encode = curr_msg->type->encode;
#ifndef NDEBUG
/* Sanity check that the message won't overwrite past it's allocated space */
-if(!(curr_msg->flags & H5O_MSG_FLAG_SHARED)) {
+if(!(curr_msg->flags & H5O_MSG_FLAG_SHARED) && !H5O_NEW_SHARED(curr_msg->type)) {
size_t msg_size;
msg_size = curr_msg->type->raw_size(f, curr_msg->native);
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index 14ab981..f80faf1 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -98,7 +98,7 @@ typedef struct {
static herr_t H5O_msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
unsigned overwrite, unsigned mesg_flags, unsigned update_flags,
- const void *mesg, hid_t dxpl_id, unsigned *oh_flags_ptr);
+ void *mesg, hid_t dxpl_id, unsigned *oh_flags_ptr);
static herr_t H5O_msg_reset_real(const H5O_msg_class_t *type, void *native);
static void *H5O_msg_copy_real(const H5O_msg_class_t *type, const void *mesg,
void *dst);
@@ -400,7 +400,7 @@ done:
static herr_t
H5O_msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
unsigned overwrite, unsigned mesg_flags, unsigned update_flags,
- const void *mesg, hid_t dxpl_id, unsigned *oh_flags_ptr)
+ void *mesg, hid_t dxpl_id, unsigned *oh_flags_ptr)
{
int sequence; /* Sequence # of message type to modify */
unsigned idx; /* Index of message to modify */
@@ -452,6 +452,8 @@ H5O_msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
if(!(mesg_flags & H5O_MSG_FLAG_DONTSHARE)) {
htri_t shared_mesg; /* Whether the message should be shared */
+/* XXX: Maybe this should be before the "try_delete" call? */
+/* (and the try_delete would need to use a copy of the message's shared info) */
if((shared_mesg = H5SM_try_share(f, dxpl_id, idx_msg->type->id, mesg)) > 0)
/* Mark the message as shared */
mesg_flags |= H5O_MSG_FLAG_SHARED;
@@ -608,7 +610,7 @@ H5O_msg_read_real(H5F_t *f, H5O_t *oh, unsigned type_id, int sequence,
H5O_LOAD_NATIVE(f, dxpl_id, &(oh->mesg[idx]), NULL)
/* Read the message in */
- if((oh->mesg[idx].flags & H5O_MSG_FLAG_SHARED) && !H5O_NEW_SHARED(oh->mesg[idx].flags)) {
+ if((oh->mesg[idx].flags & H5O_MSG_FLAG_SHARED) && !H5O_NEW_SHARED(type)) {
/*
* If the message is shared then then the native pointer points to an
* H5O_MSG_SHARED message. We use that information to look up the real
@@ -1863,10 +1865,9 @@ H5O_msg_copy_file(const H5O_msg_class_t *copy_type, const H5O_msg_class_t *mesg_
H5F_t *file_src, void *native_src, H5F_t *file_dst, hid_t dxpl_id,
hbool_t *shared, H5O_copy_t *cpy_info, void *udata)
{
- void *native_mesg=NULL;
- void *shared_mesg=NULL;
+ void *native_mesg = NULL;
+ void *shared_mesg = NULL;
hbool_t committed; /* TRUE if message is a committed message */
- htri_t try_share_ret; /* Value returned from H5SM_try_share */
void *ret_value;
FUNC_ENTER_NOAPI_NOINIT(H5O_msg_copy_file)
@@ -1895,7 +1896,7 @@ H5O_msg_copy_file(const H5O_msg_class_t *copy_type, const H5O_msg_class_t *mesg_
* to be copied is a committed datatype.
*/
if(NULL == (native_mesg = (copy_type->copy_file)(file_src, mesg_type, native_src, file_dst, dxpl_id, cpy_info, udata)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy object header message to file")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object header message to file")
/* Committed messages are always committed in the destination. Messages in
* the heap are not shared by default--they need to be "re-shared" in the
@@ -1903,36 +1904,50 @@ H5O_msg_copy_file(const H5O_msg_class_t *copy_type, const H5O_msg_class_t *mesg_
*/
if(committed == TRUE)
*shared = TRUE;
- else
- *shared = FALSE;
+ else {
+ if(!H5O_NEW_SHARED(copy_type)) {
+ *shared = FALSE;
+
+ /* If message isn't committed but can be shared, handle with implicit sharing. */
+ if(mesg_type->set_share) {
+ htri_t try_share_ret; /* Value returned from H5SM_try_share */
+
+ /* Try to share it in the destination file. */
+ if((try_share_ret = H5SM_try_share(file_dst, dxpl_id, mesg_type->id, native_mesg)) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_WRITEERROR, NULL, "unable to determine if message should be shared")
+
+ /* If it isn't shared, reset its sharing information. If it is
+ * shared, its sharing information will have been overwritten by
+ * H5SM_try_share.
+ */
+ if(try_share_ret == FALSE) {
+ if(H5O_msg_reset_share(mesg_type->id, native_mesg) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_WRITEERROR, NULL, "unable to reset sharing information in message")
+ } /* end if */
+ else {
+ /* Get shared message from native message */
+ if(NULL == (shared_mesg = H5O_msg_get_share(mesg_type->id, native_mesg, NULL)))
+ HGOTO_ERROR(H5E_SOHM, H5E_READERROR, NULL, "unable to get shared location from message")
- /* If message isn't committed but can be shared, handle with implicit sharing. */
- if(committed == FALSE && (mesg_type->set_share)) {
- /* Try to share it in the destination file. */
- if((try_share_ret = H5SM_try_share(file_dst, dxpl_id, mesg_type->id, native_mesg)) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_WRITEERROR, NULL, "unable to determine if message should be shared")
+ /* Free native message; the shared message is all we need to return */
+ H5O_msg_free(mesg_type->id, native_mesg);
- /* If it isn't shared, reset its sharing information. If it is
- * shared, its sharing information will have been overwritten by
- * H5SM_try_share.
- */
- if(try_share_ret == FALSE) {
- if(H5O_msg_reset_share(mesg_type->id, native_mesg) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_WRITEERROR, NULL, "unable to reset sharing information in message")
+ native_mesg = shared_mesg;
+ *shared = TRUE;
+ } /* end else */
+ } /* end if */
} /* end if */
else {
- /* Get shared message from native message */
- if(NULL == (shared_mesg = H5O_msg_get_share(mesg_type->id, native_mesg, NULL)))
- HGOTO_ERROR(H5E_SOHM, H5E_READERROR, NULL, "unable to get shared location from message")
+ htri_t is_shared; /* Whether new message is shared */
- /* Free native message; the shared message is all we need to return */
- H5O_msg_free(mesg_type->id, native_mesg);
-
- native_mesg = shared_mesg;
- *shared = TRUE;
+ /* Check if new message is shared */
+ if((is_shared = H5O_msg_is_shared(copy_type->id, native_mesg)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to query message's shared status")
+ *shared = is_shared;
} /* end else */
- } /* end if */
+ } /* end else */
+ /* Set return value */
ret_value = native_mesg;
done:
diff --git a/src/H5Onull.c b/src/H5Onull.c
index 20a3254..914d8be 100644
--- a/src/H5Onull.c
+++ b/src/H5Onull.c
@@ -44,6 +44,7 @@ const H5O_msg_class_t H5O_MSG_NULL[1] = {{
NULL, /*no link method */
NULL, /*no get share method */
NULL, /*no set share method */
+ NULL, /*no can share method */
NULL, /*no is_shared method */
NULL, /*no pre copy native value to file */
NULL, /*no copy native value to file */
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 0e4dbc3..29411d9 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -160,7 +160,7 @@
/* Temporary macro to define which message classes are using the "new"
* shared message "interface" for their methods.
*/
-#define H5O_NEW_SHARED(T) 0
+#define H5O_NEW_SHARED(T) (T == H5O_MSG_PLINE)
/* The "message class" type */
@@ -435,14 +435,14 @@ H5_DLL herr_t H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
/* Shared object operators */
H5_DLL void * H5O_shared_read(H5F_t *f, hid_t dxpl_id, const H5O_shared_t *shared,
const H5O_msg_class_t *type, void *mesg);
-H5_DLL herr_t H5O_shared_decode_new(H5F_t *f, const uint8_t *buf, H5O_shared_t *sh_mesg);
+H5_DLL void * H5O_shared_decode_new(H5F_t *f, hid_t dxpl_id, const uint8_t *buf, const H5O_msg_class_t *type);
H5_DLL herr_t H5O_shared_encode_new(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg);
H5_DLL size_t H5O_shared_size_new(const H5F_t *f, const H5O_shared_t *sh_mesg);
H5_DLL herr_t H5O_shared_delete_new(H5F_t *f, hid_t dxpl_id, const H5O_shared_t *sh_mesg,
hbool_t adj_link);
H5_DLL herr_t H5O_shared_link_new(H5F_t *f, hid_t dxpl_id, const H5O_shared_t *sh_mesg);
-H5_DLL void *H5O_shared_copy_file_new(H5F_t *file_src, const H5O_msg_class_t *mesg_type,
- const H5O_shared_t *shared_src, H5F_t *file_dst, hid_t dxpl_id,
+H5_DLL herr_t H5O_shared_copy_file_new(H5F_t *file_src, H5F_t *file_dst, hid_t dxpl_id,
+ const H5O_msg_class_t *mesg_type, const void *_native_src, void *_native_dst,
H5O_copy_t *cpy_info, void *udata);
diff --git a/src/H5Opline.c b/src/H5Opline.c
index ba9902d..199ad69 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -64,20 +64,20 @@ const H5O_msg_class_t H5O_MSG_PLINE[1] = {{
H5O_PLINE_ID, /* message id number */
"filter pipeline", /* message name for debugging */
sizeof(H5O_pline_t), /* native message size */
- H5O_pline_decode, /* decode message */
- H5O_pline_encode, /* encode message */
+ H5O_pline_shared_decode, /* decode message */
+ H5O_pline_shared_encode, /* encode message */
H5O_pline_copy, /* copy the native value */
- H5O_pline_size, /* size of raw message */
+ H5O_pline_shared_size, /* size of raw message */
H5O_pline_reset, /* reset method */
H5O_pline_free, /* free method */
- NULL, /* file delete method */
- NULL, /* link method */
+ H5O_pline_shared_delete, /* file delete method */
+ H5O_pline_shared_link, /* link method */
H5O_pline_get_share, /* get share method */
H5O_pline_set_share, /* set share method */
NULL, /*can share method */
H5O_pline_is_shared, /* is shared method */
H5O_pline_pre_copy_file, /* pre copy native value to file */
- NULL, /* copy native value to file */
+ H5O_pline_shared_copy_file, /* copy native value to file */
NULL, /* post copy native value to file */
NULL, /* get creation index */
NULL, /* set creation index */
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index 001b094..89409e2 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -279,31 +279,32 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5O_shared_decode_new(H5F_t *f, const uint8_t *buf, H5O_shared_t *sh_mesg)
+void *
+H5O_shared_decode_new(H5F_t *f, hid_t dxpl_id, const uint8_t *buf, const H5O_msg_class_t *type)
{
+ H5O_shared_t sh_mesg; /* Shared message info */
unsigned version; /* Shared message version */
- herr_t ret_value = SUCCEED; /* Return value */
+ void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_shared_decode_new)
/* Check args */
HDassert(f);
HDassert(buf);
- HDassert(sh_mesg);
+ HDassert(type);
/* Version */
version = *buf++;
if(version < H5O_SHARED_VERSION_1 || version > H5O_SHARED_VERSION_LATEST)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad version number for shared object message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for shared object message")
/* Get the shared information flags
* Flags are unused before version 3.
*/
if(version >= H5O_SHARED_VERSION_2)
- sh_mesg->flags = *buf++;
+ sh_mesg.flags = *buf++;
else {
- sh_mesg->flags = H5O_COMMITTED_FLAG;
+ sh_mesg.flags = H5O_COMMITTED_FLAG;
buf++;
} /* end else */
@@ -313,29 +314,33 @@ H5O_shared_decode_new(H5F_t *f, const uint8_t *buf, H5O_shared_t *sh_mesg)
/* Body */
if(version == H5O_SHARED_VERSION_1)
- H5G_obj_ent_decode(f, &buf, &(sh_mesg->u.oloc));
+ H5G_obj_ent_decode(f, &buf, &sh_mesg.u.oloc);
else if (version >= H5O_SHARED_VERSION_2) {
/* If this message is in the heap, copy a heap ID.
* Otherwise, it is a named datatype, so copy an H5O_loc_t.
*/
- if(sh_mesg->flags & H5O_SHARED_IN_HEAP_FLAG) {
+ if(sh_mesg.flags & H5O_SHARED_IN_HEAP_FLAG) {
HDassert(version >= H5O_SHARED_VERSION_3 );
- HDmemcpy(&(sh_mesg->u.heap_id), buf, sizeof(sh_mesg->u.heap_id));
+ HDmemcpy(&sh_mesg.u.heap_id, buf, sizeof(sh_mesg.u.heap_id));
}
else {
/* The H5O_COMMITTED_FLAG should be set if this message
* is from an older version before the flag existed.
*/
if(version < H5O_SHARED_VERSION_3)
- sh_mesg->flags = H5O_COMMITTED_FLAG;
+ sh_mesg.flags = H5O_COMMITTED_FLAG;
- HDassert(sh_mesg->flags & H5O_COMMITTED_FLAG);
+ HDassert(sh_mesg.flags & H5O_COMMITTED_FLAG);
- H5F_addr_decode(f, &buf, &(sh_mesg->u.oloc.addr));
- sh_mesg->u.oloc.file = f;
+ H5F_addr_decode(f, &buf, &sh_mesg.u.oloc.addr);
+ sh_mesg.u.oloc.file = f;
} /* end else */
} /* end else if */
+ /* Retrieve actual message, through decoded shared message info */
+ if(NULL == (ret_value = H5O_shared_read(f, dxpl_id, &sh_mesg, type, NULL)))
+ HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to retrieve native message")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_shared_decode_new() */
@@ -861,82 +866,54 @@ done:
*
* Purpose: Copies a message from _MESG to _DEST in file
*
- * Return: Success: Ptr to _DEST
- * Failure: NULL
+ * Return: Success: Non-negative
+ * Failure: Negative
*
* Programmer: Quincey Koziol
- * November 1, 2005
+ * January 22, 2007
*
*-------------------------------------------------------------------------
*/
-void *
-H5O_shared_copy_file_new(H5F_t *file_src, const H5O_msg_class_t *mesg_type,
- const H5O_shared_t *shared_src, H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info,
- void *udata)
+herr_t
+H5O_shared_copy_file_new(H5F_t *file_src, H5F_t *file_dst, hid_t dxpl_id,
+ const H5O_msg_class_t *mesg_type, const void *_native_src, void *_native_dst,
+ H5O_copy_t *cpy_info, void *udata)
{
- H5O_shared_t *shared_dst = NULL; /* The destination message if
- * it is a shared message */
- void *dst_mesg = NULL; /* The destination message if
- * it's an unshared message */
- void *ret_value; /* Return value */
+ const H5O_shared_t *shared_src = (const H5O_shared_t *)_native_src; /* Alias to shared info in native source */
+ H5O_shared_t *shared_dst = (H5O_shared_t *)_native_dst; /* Alias to shared info in native destination message */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_shared_copy_file_new)
/* check args */
- HDassert(shared_src);
+ HDassert(file_src);
HDassert(file_dst);
+ HDassert(mesg_type);
+ HDassert(shared_src);
+ HDassert(shared_dst);
HDassert(cpy_info);
-HDfprintf(stderr, "%s: Copying shared messages not supported yet!\n", FUNC);
-HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, NULL, "copying shared messages not supported yet")
-
/* Committed shared messages create a shared message at the destination
* and also copy the committed object that they point to.
- * SOHMs actually write a non-shared message at the destination.
+ *
+ * SOHMs try to share the destination message.
*/
if(shared_src->flags & H5O_COMMITTED_FLAG) {
- /* Allocate space for the destination message */
- if(NULL == (shared_dst = H5MM_malloc(sizeof(H5O_shared_t))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
-
- /* Reset group entry for new object */
- H5O_loc_reset(&(shared_dst->u.oloc));
+ /* Set up destination message's shared info */
shared_dst->u.oloc.file = file_dst;
-
- /* Set flags for new shared object */
shared_dst->flags = shared_src->flags;
/* Copy the shared object from source to destination */
if(H5O_copy_header_map(&(shared_src->u.oloc), &(shared_dst->u.oloc), dxpl_id, cpy_info, FALSE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object")
-
- /* Set return value */
- ret_value = shared_dst;
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
} /* end if */
else {
- HDassert(shared_src->flags & H5O_SHARED_IN_HEAP_FLAG);
-
- /* Read the shared message to get the original message */
- if(NULL == (dst_mesg = H5O_shared_read(file_src, dxpl_id, shared_src, mesg_type, NULL)))
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "unable to read shared message")
-
- if(mesg_type->copy_file) {
- /* Copy the original, un-shared message and return it */
- ret_value = (mesg_type->copy_file)(file_src, mesg_type, dst_mesg, file_dst, dxpl_id, cpy_info, udata);
- H5O_msg_free(mesg_type->id, dst_mesg);
- } /* end else */
- else
- ret_value = dst_mesg;
+ /* Try to share new message in the destination file. */
+ if(H5SM_try_share(file_dst, dxpl_id, mesg_type->id, _native_dst) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to determine if message should be shared")
} /* end else */
done:
- if(!ret_value) {
- if(shared_dst)
- H5O_msg_free(H5O_SHARED_ID, shared_dst);
- if(dst_mesg)
- H5O_msg_free(mesg_type->id, dst_mesg);
- } /* end if */
-
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_shared_copy_file_new() */
diff --git a/src/H5Oshared.h b/src/H5Oshared.h
index 2da769b..f7f84eb 100644
--- a/src/H5Oshared.h
+++ b/src/H5Oshared.h
@@ -65,15 +65,9 @@ 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) {
- H5O_shared_t sh_mesg; /* Shared message info */
-
- /* Retrieve shared message info by decoding info in buffer */
- if(H5O_shared_decode_new(f, p, &sh_mesg) < 0)
+ /* Retrieve native message info indirectly through shared message */
+ if(NULL == (ret_value = H5O_shared_decode_new(f, dxpl_id, p, H5O_SHARED_TYPE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message")
-
- /* Retrieve actual native message by reading it through shared info */
- if(NULL == (ret_value = H5O_shared_read(f, dxpl_id, &sh_mesg, H5O_SHARED_TYPE, NULL)))
- HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to retrieve native message")
} /* end if */
else {
/* Decode native message directly */
@@ -316,7 +310,7 @@ H5O_SHARED_COPY_FILE(H5F_t *file_src, const H5O_msg_class_t *mesg_type,
void *_native_src, H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info,
void *udata)
{
- const H5O_shared_t *sh_mesg = (const H5O_shared_t *)_native_src; /* Pointer to shared message portion of actual message */
+ void *dst_mesg = NULL; /* Destination message */
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_SHARED_COPY_FILE)
@@ -328,22 +322,32 @@ H5O_SHARED_COPY_FILE(H5F_t *file_src, const H5O_msg_class_t *mesg_type,
#error "Need to define H5O_SHARED_COPY_FILE macro!"
#endif /* H5O_SHARED_COPY_FILE */
- /* Check for shared message */
- if(H5O_IS_SHARED(sh_mesg->flags)) {
- /* Copy the shared message to another file */
- if(NULL == (ret_value = H5O_shared_copy_file_new(file_src, mesg_type, _native_src, file_dst, dxpl_id, cpy_info, udata)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy shared message to another file")
- } /* end if */
#ifdef H5O_SHARED_COPY_FILE_REAL
- else {
- /* Decrement the reference count on the native message directly */
- /* Copy the native message directly to another file */
- if(NULL == (ret_value = H5O_SHARED_COPY_FILE_REAL(file_src, mesg_type, _native_src, file_dst, dxpl_id, cpy_info, udata)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy native message to another file")
- } /* end else */
+ /* Call native message's copy file callback to copy the message */
+ if(NULL == (dst_mesg = H5O_SHARED_COPY_FILE_REAL(file_src, H5O_SHARED_TYPE, _native_src, file_dst, dxpl_id, cpy_info, udata)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy native message to another file")
+#else /* H5O_SHARED_COPY_FILE_REAL */
+ /* No copy file callback defined, just copy the message itself */
+ if(NULL == (dst_mesg = (H5O_SHARED_TYPE->copy)(_native_src, NULL)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy native message")
#endif /* H5O_SHARED_COPY_FILE_REAL */
+ /* Reset shared message info for new message */
+ 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,
+ _native_src, dst_mesg, cpy_info, udata) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "unable to determine if message should be shared")
+
+ /* Set return value */
+ ret_value = dst_mesg;
+
done:
+ if(!ret_value)
+ if(dst_mesg)
+ H5O_msg_free(H5O_SHARED_TYPE->id, dst_mesg);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_SHARED_COPY_FILE() */