summaryrefslogtreecommitdiffstats
path: root/src/H5Oattribute.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-12-12 20:28:48 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-12-12 20:28:48 (GMT)
commite9522de4e1ec02209673fb45378d1525cd723949 (patch)
tree181a6d2310d48598eda000bd18853c83e922f258 /src/H5Oattribute.c
parent6bf1f234f273937911e61e54d5218c0664048f05 (diff)
downloadhdf5-e9522de4e1ec02209673fb45378d1525cd723949.zip
hdf5-e9522de4e1ec02209673fb45378d1525cd723949.tar.gz
hdf5-e9522de4e1ec02209673fb45378d1525cd723949.tar.bz2
[svn-r13056] Description:
Add H5SM_type_shared() internal routine to determine if a particular type of header message is sharable in a file. Correct off-by-one error in computing B-tree record size for densely stored attributes' name index. Further progress toward supporting shared attributes in dense storage. Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5Oattribute.c')
-rw-r--r--src/H5Oattribute.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 7d5e496..17d6dcd 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -161,7 +161,9 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned UNUSED sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/)
{
H5O_iter_cvt_t *udata = (H5O_iter_cvt_t *)_udata; /* Operator user data */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ H5A_t shared_attr; /* Copy of shared attribute */
+ H5A_t *attr; /* Pointer to attribute to insert */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_attr_to_dense_cb)
@@ -169,11 +171,23 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
HDassert(oh);
HDassert(mesg);
+ /* Check for shared attribute */
+ if(mesg->flags & H5O_MSG_FLAG_SHARED) {
+ /* Read the shared attribute in */
+ if(NULL == H5O_shared_read(udata->f, udata->dxpl_id, mesg->native, H5O_MSG_ATTR, &shared_attr))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5_ITER_ERROR, "unable to read shared attribute")
+
+ /* Point attribute to insert at shared attribute read in */
+ attr = &shared_attr;
+ } /* end if */
+ else
+ attr = mesg->native;
+
/* Insert attribute into dense storage */
- if(H5A_dense_insert(udata->f, udata->dxpl_id, oh, mesg->flags, mesg->native) < 0)
+ if(H5A_dense_insert(udata->f, udata->dxpl_id, oh, mesg->flags, attr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to add to dense storage")
- /* Convert message into a null message */
+ /* Convert message into a null message in the header */
if(H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message")
@@ -181,6 +195,10 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
*oh_flags_ptr |= H5AC__DIRTIED_FLAG;
done:
+ /* Release copy of shared attribute */
+ if(attr == &shared_attr)
+ H5O_attr_reset(&shared_attr);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_to_dense_cb() */