summaryrefslogtreecommitdiffstats
path: root/src/H5Oainfo.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2009-01-29 21:02:07 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2009-01-29 21:02:07 (GMT)
commitaf7ced00f61794ca59f5bbdf49ea562353e6564b (patch)
tree5421bb9bc9c1c208df5d073f5c953b8157e5439c /src/H5Oainfo.c
parentf7464a512916d18cd7f3d04393ce8ddb1f16c5aa (diff)
downloadhdf5-af7ced00f61794ca59f5bbdf49ea562353e6564b.zip
hdf5-af7ced00f61794ca59f5bbdf49ea562353e6564b.tar.gz
hdf5-af7ced00f61794ca59f5bbdf49ea562353e6564b.tar.bz2
[svn-r16380] Purpose: Enable copying of dense attributes
Description: Attribute object copy routines have been moved from H5Oattr.c to H5Aint.c. These routines are now shared between compact and densely stored attributes. New routines written to support the copying of dense attributes. This patch wasmostly written by Peter Cao. Tested: jam, smirom (h5committest)
Diffstat (limited to 'src/H5Oainfo.c')
-rw-r--r--src/H5Oainfo.c66
1 files changed, 56 insertions, 10 deletions
diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c
index 2a9d403..7f6a55d 100644
--- a/src/H5Oainfo.c
+++ b/src/H5Oainfo.c
@@ -48,6 +48,9 @@ static herr_t H5O_ainfo_pre_copy_file(H5F_t *file_src, const void *mesg_src,
static void *H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src,
H5F_t *file_dst, hbool_t *recompute_size, H5O_copy_t *cpy_info, void *udata,
hid_t dxpl_id);
+static herr_t H5O_ainfo_post_copy_file(const H5O_loc_t *src_oloc,
+ const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst, hid_t dxpl_id,
+ H5O_copy_t *cpy_info);
static herr_t H5O_ainfo_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
FILE * stream, int indent, int fwidth);
@@ -69,7 +72,7 @@ const H5O_msg_class_t H5O_MSG_AINFO[1] = {{
NULL, /*can share method */
H5O_ainfo_pre_copy_file, /* pre copy native value to file */
H5O_ainfo_copy_file, /* copy native value to file */
- NULL, /* post copy native value to file */
+ H5O_ainfo_post_copy_file, /* post copy native value to file */
NULL, /* get creation index */
NULL, /* set creation index */
H5O_ainfo_debug /*debug the message */
@@ -393,15 +396,14 @@ H5O_ainfo_pre_copy_file(H5F_t UNUSED *file_src, const void UNUSED *native_src,
* Return: Success: Ptr to _DEST
* Failure: NULL
*
- * Programmer: Quincey Koziol
- * March 9, 2007
+ * Programmer: Peter Cao
+ * July 18, 2007
*
*-------------------------------------------------------------------------
*/
static void *
-H5O_ainfo_copy_file(H5F_t UNUSED *file_src, void *mesg_src,
- H5F_t UNUSED *file_dst, hbool_t UNUSED *recompute_size,
- H5O_copy_t UNUSED *cpy_info, void UNUSED *udata, hid_t UNUSED dxpl_id)
+H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
+ hbool_t *recompute_size, H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id)
{
H5O_ainfo_t *ainfo_src = (H5O_ainfo_t *)mesg_src;
H5O_ainfo_t *ainfo_dst = NULL;
@@ -416,10 +418,6 @@ H5O_ainfo_copy_file(H5F_t UNUSED *file_src, void *mesg_src,
HDassert(cpy_info);
HDassert(!cpy_info->copy_without_attr);
-/* XXX: Bail out for now, if the source object has densely stored attributes */
- if(H5F_addr_defined(ainfo_src->fheap_addr))
- HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, NULL, "densely stored attributes not supported yet")
-
/* Allocate space for the destination message */
if(NULL == (ainfo_dst = H5FL_MALLOC(H5O_ainfo_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
@@ -427,6 +425,16 @@ H5O_ainfo_copy_file(H5F_t UNUSED *file_src, void *mesg_src,
/* Copy the top level of the information */
*ainfo_dst = *ainfo_src;
+ if(H5F_addr_defined(ainfo_src->fheap_addr)) {
+ /* copy dense attribute */
+
+ if(H5A_dense_create(file_dst, dxpl_id, ainfo_dst) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes")
+
+ if ( (H5A_dense_copy_file_all(file_src, ainfo_src, file_dst, ainfo_dst, recompute_size, cpy_info, dxpl_id)) <0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes")
+ }
+
/* Set return value */
ret_value = ainfo_dst;
@@ -440,6 +448,44 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5O_ainfo_post_copy_file
+ *
+ * Purpose: Finish copying a message from between files.
+ * We have to copy the values of a reference attribute in the
+ * post copy because H5O_post_copy_file() fails at the case that
+ * an object may have a reference attribute that points to the
+ * object itself.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Peter Cao
+ * July 25, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_ainfo_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src,
+ H5O_loc_t *dst_oloc, void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info)
+{
+ H5O_ainfo_t *ainfo_src = (const H5O_ainfo_t *)mesg_src;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_ainfo_post_copy_file)
+
+ HDassert(ainfo_src);
+
+ if(H5F_addr_defined(ainfo_src->fheap_addr)) {
+ if ( H5A_dense_post_copy_file_all(src_oloc, ainfo_src, dst_oloc,
+ (H5O_ainfo_t *)mesg_dst, dxpl_id, cpy_info) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "can't copy attribute")
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5O_ainfo_post_copy_file() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_ainfo_debug
*
* Purpose: Prints debugging info for a message.