summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-11-22 17:14:11 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-11-22 17:14:11 (GMT)
commit35ffb5bd1341b0b49096fae2554ba18046a30958 (patch)
tree76125ea42d3f13837e6fedd4c8ba950cf8456c91
parentd58b9bf5b22522cd51949941f1a61949467dc354 (diff)
downloadhdf5-35ffb5bd1341b0b49096fae2554ba18046a30958.zip
hdf5-35ffb5bd1341b0b49096fae2554ba18046a30958.tar.gz
hdf5-35ffb5bd1341b0b49096fae2554ba18046a30958.tar.bz2
[svn-r9556] Purpose:
Code cleanup & optimization Description: Improve ADF/CGNS benchmark by reducing the number of internal attribute copies made during creations, opens and writes. Added new H5O_iterate() routine for iterating through messages of a certain type in the object header (attributes are the only message currently that can have multiple instances in the object header). Cross-pollinated various minor code cleanups to reduce diffs between branches. Platforms tested: FreeBSD 4.10 (sleipnir) w/parallel Solaris 2.7 (arabica) Too minor to require h5committest
-rw-r--r--src/H5A.c170
-rw-r--r--src/H5Apkg.h2
-rw-r--r--src/H5D.c4
-rw-r--r--src/H5G.c16
-rw-r--r--src/H5Gstab.c2
-rw-r--r--src/H5O.c128
-rw-r--r--src/H5Oattr.c10
-rw-r--r--src/H5Odtype.c6
-rw-r--r--src/H5Oefl.c4
-rw-r--r--src/H5Ofill.c25
-rw-r--r--src/H5Olayout.c4
-rw-r--r--src/H5Omtime.c4
-rw-r--r--src/H5Oname.c4
-rw-r--r--src/H5Opkg.h2
-rw-r--r--src/H5Opline.c4
-rw-r--r--src/H5Oprivate.h12
-rw-r--r--src/H5Osdspace.c4
-rw-r--r--src/H5Oshared.c6
-rw-r--r--src/H5Ostab.c6
-rw-r--r--src/H5Tcommit.c2
-rw-r--r--src/H5Zszip.c2
21 files changed, 272 insertions, 145 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 1874187..a1e631b 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -41,6 +41,14 @@ static int H5A_get_index(H5G_entry_t *ent, const char *name, hid_t dxpl_id);
static hsize_t H5A_get_storage_size(const H5A_t *attr);
static herr_t H5A_rename(H5G_entry_t *ent, const char *old_name, const char *new_name, hid_t dxpl_id);
+/* Object header iterator callbacks */
+/* Data structure for callback for locating the index by name */
+typedef struct H5A_iter_cb1 {
+ const char *name;
+ int idx;
+} H5A_iter_cb1;
+static herr_t H5A_find_idx_by_name(const void *mesg, unsigned idx, void *op_data);
+
/* The number of reserved IDs in dataset ID group */
#define H5A_RESERVED_ATOMS 0
@@ -216,8 +224,7 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type,
const H5S_t *space, hid_t dxpl_id)
{
H5A_t *attr = NULL;
- H5A_t found_attr;
- int seq=0;
+ H5A_iter_cb1 cb; /* Iterator callback */
hid_t ret_value = FAIL;
FUNC_ENTER_NOAPI_NOINIT(H5A_create)
@@ -228,6 +235,14 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type,
assert(type);
assert(space);
+ /* Iterate over the existing attributes to check for duplicates */
+ cb.name=name;
+ cb.idx=(-1);
+ if((ret_value=H5O_iterate(ent,H5O_ATTR_ID,H5A_find_idx_by_name,&cb,dxpl_id))<0)
+ HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "error iterating over attributes")
+ if(ret_value>0)
+ HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, FAIL, "attribute already exists")
+
/* Check if the dataspace has an extent set (or is NULL) */
if( !(H5S_has_extent(space)) )
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace extent has not been set")
@@ -282,25 +297,8 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type,
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open")
attr->ent_opened=1;
- /* Read in the existing attributes to check for duplicates */
- seq=0;
- while(H5O_read(&(attr->ent), H5O_ATTR_ID, seq, &found_attr, dxpl_id)!=NULL) {
- /*
- * Compare found attribute name to new attribute name reject creation
- * if names are the same.
- */
- if(HDstrcmp(found_attr.name,attr->name)==0) {
- (void)H5O_reset (H5O_ATTR_ID, &found_attr);
- HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, FAIL, "attribute already exists")
- }
- if(H5O_reset (H5O_ATTR_ID, &found_attr)<0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info")
- seq++;
- }
- H5E_clear_stack(NULL);
-
/* Create the attribute message and save the attribute index */
- if (H5O_modify(&(attr->ent), H5O_ATTR_ID, H5O_NEW_MESG, 0, 1, attr, dxpl_id) < 0)
+ if (H5O_modify(&(attr->ent), H5O_ATTR_ID, H5O_NEW_MESG, 0, H5O_UPDATE_TIME, attr, dxpl_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages")
/* Register the new attribute and get an ID for it */
@@ -322,6 +320,52 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5A_find_idx_by_name
+ PURPOSE
+ Iterator callback to determine the index of a attribute
+ USAGE
+ herr_t H5A_find_idx_by_name (mesg, idx, op_data)
+ const H5A_t *mesg; IN: Pointer to attribute
+ unsigned idx; IN: Index of attribute
+ void *op_data; IN: Op data passed in
+ RETURNS
+ Non-negative on success, negative on failure
+
+ ERRORS
+
+ DESCRIPTION
+ This function determines if an attribute matches the name to search
+ for (from the 'op_data') and sets the index value in the 'op_data'.
+--------------------------------------------------------------------------*/
+static herr_t
+H5A_find_idx_by_name(const void *_mesg, unsigned idx, void *_op_data)
+{
+ const H5A_t *mesg = (const H5A_t *)_mesg; /* Pointer to attribute */
+ H5A_iter_cb1 *op_data = (H5A_iter_cb1 *)_op_data; /* Pointer to op data */
+ int ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5A_find_idx_by_name)
+
+ assert(mesg);
+ assert(op_data);
+
+ /*
+ * Compare found attribute name to queried name and set the idx in the
+ * callback info if names are the same.
+ */
+ if(HDstrcmp(mesg->name,op_data->name)==0) {
+ op_data->idx=idx;
+ ret_value=1;
+ } /* end if */
+ else
+ ret_value=0;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5A_find_idx_by_name() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5A_get_index
PURPOSE
Determine the index of an attribute in an object header
@@ -343,8 +387,7 @@ done:
static int
H5A_get_index(H5G_entry_t *ent, const char *name, hid_t dxpl_id)
{
- H5A_t found_attr;
- int i; /* Index variable */
+ H5A_iter_cb1 cb; /* Iterator callback */
int ret_value=FAIL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5A_get_index)
@@ -352,25 +395,13 @@ H5A_get_index(H5G_entry_t *ent, const char *name, hid_t dxpl_id)
assert(ent);
assert(name);
- /* Look up the attribute for the object */
- i=0;
- while(H5O_read(ent, H5O_ATTR_ID, i, &found_attr, dxpl_id)!=NULL) {
- /*
- * Compare found attribute name to new attribute name reject creation
- * if names are the same.
- */
- if(HDstrcmp(found_attr.name,name)==0) {
- if(H5O_reset (H5O_ATTR_ID, &found_attr)<0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info")
- HGOTO_DONE(i);
- }
- if(H5O_reset (H5O_ATTR_ID, &found_attr)<0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info")
- i++;
- }
- H5E_clear_stack(NULL);
-
- if(ret_value<0)
+ cb.name=name;
+ cb.idx=(-1);
+ if((ret_value=H5O_iterate(ent,H5O_ATTR_ID,H5A_find_idx_by_name,&cb,dxpl_id))<0)
+ HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "error iterating over attributes")
+ if(ret_value>0)
+ ret_value=cb.idx;
+ else
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "attribute not found")
done:
@@ -690,7 +721,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id)
HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "attribute not found")
/* Modify the attribute data */
- if (H5O_modify(&(attr->ent), H5O_ATTR_ID, idx, 0, 1, attr, dxpl_id) < 0)
+ if (H5O_modify(&(attr->ent), H5O_ATTR_ID, idx, 0, H5O_UPDATE_DATA_ONLY|H5O_UPDATE_TIME, attr, dxpl_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages")
} /* end if */
@@ -1267,7 +1298,7 @@ H5A_rename(H5G_entry_t *ent, const char *old_name, const char *new_name, hid_t d
found_attr.initialized=TRUE;
/* Modify the attribute message */
- if (H5O_modify(ent, H5O_ATTR_ID, idx, 0, 1, &found_attr, dxpl_id) < 0)
+ if (H5O_modify(ent, H5O_ATTR_ID, idx, 0, H5O_UPDATE_TIME, &found_attr, dxpl_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages")
/* Close the attribute */
@@ -1405,9 +1436,8 @@ done:
herr_t
H5Adelete(hid_t loc_id, const char *name)
{
- H5A_t found_attr;
H5G_entry_t *ent = NULL; /*symtab ent of object to attribute */
- int idx=0, found=-1;
+ int found;
herr_t ret_value;
FUNC_ENTER_API(H5Adelete, FAIL)
@@ -1421,25 +1451,8 @@ H5Adelete(hid_t loc_id, const char *name)
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- /* Look up the attribute for the object */
- idx=0;
- while(H5O_read(ent, H5O_ATTR_ID, idx, &found_attr, H5AC_dxpl_id)!=NULL) {
- /*
- * Compare found attribute name to new attribute name reject
- * creation if names are the same.
- */
- if(HDstrcmp(found_attr.name,name)==0) {
- if(H5O_reset (H5O_ATTR_ID, &found_attr)<0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info")
- found = idx;
- break;
- }
- if(H5O_reset (H5O_ATTR_ID, &found_attr)<0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info")
- idx++;
- }
- H5E_clear_stack(NULL);
- if (found<0)
+ /* Look up the attribute index for the object */
+ if((found=H5A_get_index(ent,name,H5AC_dxpl_id))<0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "attribute not found")
/* Delete the attribute from the location */
@@ -1506,7 +1519,7 @@ done:
*-------------------------------------------------------------------------
*/
H5A_t *
-H5A_copy(H5A_t *_new_attr, const H5A_t *old_attr)
+H5A_copy(H5A_t *_new_attr, const H5A_t *old_attr, unsigned update_flags)
{
H5A_t *new_attr=NULL;
hbool_t allocated_attr=FALSE; /* Whether the attribute was allocated */
@@ -1519,6 +1532,9 @@ H5A_copy(H5A_t *_new_attr, const H5A_t *old_attr)
/* get space */
if(_new_attr==NULL) {
+ /* Sanity check - We should not be only updating data if we don'y have anything */
+ HDassert(!(update_flags&H5O_UPDATE_DATA_ONLY));
+
if (NULL==(new_attr = H5FL_MALLOC(H5A_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
allocated_attr=TRUE;
@@ -1526,19 +1542,23 @@ H5A_copy(H5A_t *_new_attr, const H5A_t *old_attr)
else
new_attr=_new_attr;
- /* Copy the top level of the attribute */
- *new_attr = *old_attr;
+ if(!(update_flags&H5O_UPDATE_DATA_ONLY)) {
+ /* Copy the top level of the attribute */
+ *new_attr = *old_attr;
- /* Don't open the object header for a copy */
- new_attr->ent_opened=0;
+ /* Don't open the object header for a copy */
+ new_attr->ent_opened=0;
- /* Copy the guts of the attribute */
- new_attr->name=HDstrdup(old_attr->name);
- new_attr->dt=H5T_copy(old_attr->dt, H5T_COPY_ALL);
- new_attr->ds=H5S_copy(old_attr->ds, FALSE);
+ /* Copy the guts of the attribute */
+ new_attr->name=HDstrdup(old_attr->name);
+ new_attr->dt=H5T_copy(old_attr->dt, H5T_COPY_ALL);
+ new_attr->ds=H5S_copy(old_attr->ds, FALSE);
+ } /* end if */
if(old_attr->data) {
- if (NULL==(new_attr->data=H5MM_malloc(old_attr->data_size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ if(!(update_flags&H5O_UPDATE_DATA_ONLY) || new_attr->data==NULL) {
+ if (NULL==(new_attr->data=H5MM_malloc(old_attr->data_size)))
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ } /* end if */
HDmemcpy(new_attr->data,old_attr->data,old_attr->data_size);
} /* end if */
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index a354a48..976340d 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -55,7 +55,7 @@ struct H5A_t {
};
/* Function prototypes for H5A package scope */
-H5_DLL H5A_t *H5A_copy(H5A_t *new_attr, const H5A_t *old_attr);
+H5_DLL H5A_t *H5A_copy(H5A_t *new_attr, const H5A_t *old_attr, unsigned update_flags);
H5_DLL herr_t H5A_free(H5A_t *attr);
H5_DLL herr_t H5A_close(H5A_t *attr);
diff --git a/src/H5D.c b/src/H5D.c
index 456020b..c388184 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -2891,7 +2891,7 @@ H5D_close(H5D_t *dataset)
case H5D_COMPACT:
/* Update header message of layout for compact dataset. */
if(dataset->shared->layout.u.compact.dirty) {
- if(H5O_modify(&(dataset->ent), H5O_LAYOUT_ID, 0, 0, 1, &(dataset->shared->layout), H5AC_dxpl_id)<0)
+ if(H5O_modify(&(dataset->ent), H5O_LAYOUT_ID, 0, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), H5AC_dxpl_id)<0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to update layout message")
dataset->shared->layout.u.compact.dirty = FALSE;
} /* end if */
@@ -4134,7 +4134,7 @@ H5D_flush(H5F_t *f, hid_t dxpl_id, unsigned flags)
case H5D_COMPACT:
if(dataset->shared->layout.u.compact.dirty) {
- if(H5O_modify(&(dataset->ent), H5O_LAYOUT_ID, 0, 0, 1, &(dataset->shared->layout), dxpl_id)<0)
+ if(H5O_modify(&(dataset->ent), H5O_LAYOUT_ID, 0, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), dxpl_id)<0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message")
dataset->shared->layout.u.compact.dirty = FALSE;
} /* end if */
diff --git a/src/H5G.c b/src/H5G.c
index d30f6f0..23405d6 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -281,7 +281,7 @@ done:
hid_t
H5Gopen(hid_t loc_id, const char *name)
{
- hid_t ret_value = FAIL;
+ hid_t ret_value = FAIL;
H5G_t *grp = NULL;
H5G_entry_t *loc = NULL;
H5G_entry_t ent;
@@ -402,9 +402,9 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p,
if (!idx_p)
idx_p = &idx;
if (idx<0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified");
if (!op)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified");
/*
* Open the group on which to operate. We also create a group ID which
@@ -416,7 +416,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p,
H5Gclose(udata.group_id);
HGOTO_ERROR (H5E_ATOM, H5E_BADATOM, FAIL, "bad group atom");
}
-
+
/* Build udata to pass through H5B_iterate() to H5G_node_iterate() */
udata.skip = idx;
udata.ent = &(grp->ent);
@@ -1544,7 +1544,7 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/,
/* If this was an insert, make sure that the insert function was actually
* called (this catches no-op names like "." and "/") */
- if( action== H5G_NAMEI_INSERT && !did_insert)
+ if(action == H5G_NAMEI_INSERT && !did_insert)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group already exists");
done:
@@ -1793,7 +1793,6 @@ H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint, hid_t dxpl_id)
if (NULL==(grp->shared = H5FL_CALLOC(H5G_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
-
/* What file is the group being added to? */
if (NULL==(file=H5G_insertion_file(loc, name, dxpl_id)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to locate insertion point");
@@ -1825,10 +1824,11 @@ done:
if(H5O_delete(file, dxpl_id,grp->ent.header)<0)
HDONE_ERROR(H5E_SYM, H5E_CANTDELETE, NULL, "unable to delete object header");
} /* end if */
- if(grp!=NULL)
+ if(grp!=NULL) {
if(grp->shared != NULL)
H5FL_FREE(H5G_shared_t, grp->shared);
H5FL_FREE(H5G_t,grp);
+ }
} /* end if */
FUNC_LEAVE_NOAPI(ret_value);
@@ -2988,7 +2988,7 @@ H5G_set_comment(H5G_entry_t *loc, const char *name, const char *buf, hid_t dxpl_
/* Add the new message */
if (buf && *buf) {
comment.s = H5MM_xstrdup(buf);
- if (H5O_modify(&obj_ent, H5O_NAME_ID, H5O_NEW_MESG, 0, 1, &comment, dxpl_id)<0)
+ if (H5O_modify(&obj_ent, H5O_NAME_ID, H5O_NEW_MESG, 0, H5O_UPDATE_TIME, &comment, dxpl_id)<0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message");
H5O_reset(H5O_NAME_ID, &comment);
}
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index d270ceb..71b5603 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -109,7 +109,7 @@ H5G_stab_create(H5F_t *f, hid_t dxpl_id, size_t init, H5G_entry_t *self/*out*/)
* Insert the symbol table message into the object header and the symbol
* table entry.
*/
- if (H5O_modify(self, H5O_STAB_ID, H5O_NEW_MESG, H5O_FLAG_CONSTANT, 1, &stab, dxpl_id)<0) {
+ if (H5O_modify(self, H5O_STAB_ID, H5O_NEW_MESG, H5O_FLAG_CONSTANT, H5O_UPDATE_TIME, &stab, dxpl_id)<0) {
H5O_close(self);
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message");
}
diff --git a/src/H5O.c b/src/H5O.c
index 7cf7893..6c84e26 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -67,7 +67,7 @@ static herr_t H5O_share(H5F_t *f, hid_t dxpl_id, const H5O_class_t *type, const
static unsigned H5O_find_in_ohdr(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
const H5O_class_t **type_p, int sequence);
static int H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type,
- int overwrite, unsigned flags, unsigned update_time, const void *mesg,
+ int overwrite, unsigned flags, unsigned update_flags, const void *mesg,
hid_t dxpl_id);
static int H5O_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
const H5O_class_t *type, unsigned flags, const void *mesg);
@@ -83,7 +83,7 @@ static unsigned H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags,
const H5O_class_t *orig_type, const void *orig_mesg, H5O_shared_t *sh_mesg,
const H5O_class_t **new_type, const void **new_mesg, hid_t dxpl_id);
static herr_t H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type,
- const void *mesg, unsigned flags);
+ const void *mesg, unsigned flags, unsigned update_flags);
/* Metadata cache callbacks */
static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata1,
@@ -1183,7 +1183,7 @@ H5O_copy_real (const H5O_class_t *type, const void *mesg, void *dst)
assert (type->copy);
if (mesg) {
- if (NULL==(ret_value=(type->copy)(mesg, dst)))
+ if (NULL==(ret_value=(type->copy)(mesg, dst, 0)))
HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy object header message");
}
@@ -1629,7 +1629,7 @@ H5O_read_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mes
* the raw message) so we must copy the native message before
* returning.
*/
- if (NULL==(ret_value = (type->copy) (oh->mesg[idx].native, mesg)))
+ if (NULL==(ret_value = (type->copy) (oh->mesg[idx].native, mesg, 0)))
HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy message to user space");
}
@@ -1692,11 +1692,10 @@ H5O_find_in_ohdr(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t **type_p,
* Decode the message if necessary. If the message is shared then decode
* a shared message, ignoring the message type.
*/
- if (oh->mesg[u].flags & H5O_FLAG_SHARED) {
+ if (oh->mesg[u].flags & H5O_FLAG_SHARED)
type = H5O_SHARED;
- } else {
+ else
type = oh->mesg[u].type;
- }
if (NULL == oh->mesg[u].native) {
assert(type->decode);
@@ -1767,7 +1766,7 @@ done:
*/
int
H5O_modify(H5G_entry_t *ent, unsigned type_id, int overwrite,
- unsigned flags, unsigned update_time, const void *mesg, hid_t dxpl_id)
+ unsigned flags, unsigned update_flags, const void *mesg, hid_t dxpl_id)
{
const H5O_class_t *type; /* Actual H5O class type for the ID */
int ret_value; /* Return value */
@@ -1785,7 +1784,7 @@ H5O_modify(H5G_entry_t *ent, unsigned type_id, int overwrite,
assert (0==(flags & ~H5O_FLAG_BITS));
/* Call the "real" modify routine */
- if((ret_value= H5O_modify_real(ent, type, overwrite, flags, update_time, mesg, dxpl_id))<0)
+ if((ret_value= H5O_modify_real(ent, type, overwrite, flags, update_flags, mesg, dxpl_id))<0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header");
done:
@@ -1836,7 +1835,7 @@ done:
*/
static int
H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type, int overwrite,
- unsigned flags, unsigned update_time, const void *mesg, hid_t dxpl_id)
+ unsigned flags, unsigned update_flags, const void *mesg, hid_t dxpl_id)
{
H5O_t *oh=NULL;
int sequence;
@@ -1894,11 +1893,11 @@ H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type, int overwrite,
}
/* Write the information to the message */
- if(H5O_write_mesg(oh,idx,type,mesg,flags)<0)
+ if(H5O_write_mesg(oh,idx,type,mesg,flags,update_flags)<0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message");
/* Update the modification time message if any */
- if(update_time)
+ if(update_flags&H5O_UPDATE_TIME)
H5O_touch_oh(ent->file, oh, FALSE);
/* Set return value */
@@ -2086,7 +2085,7 @@ H5O_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t *type,
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create new message");
/* Write the information to the message */
- if(H5O_write_mesg(oh,idx,type,mesg,flags)<0)
+ if(H5O_write_mesg(oh,idx,type,mesg,flags,0)<0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message");
/* Set return value */
@@ -2189,7 +2188,7 @@ done:
*/
static herr_t
H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type,
- const void *mesg, unsigned flags)
+ const void *mesg, unsigned flags, unsigned update_flags)
{
H5O_mesg_t *idx_msg; /* Pointer to message to modify */
herr_t ret_value=SUCCEED; /* Return value */
@@ -2205,10 +2204,11 @@ H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type,
idx_msg=&oh->mesg[idx];
/* Reset existing native information */
- H5O_reset_real(type, idx_msg->native);
+ if(!(update_flags&H5O_UPDATE_DATA_ONLY))
+ H5O_reset_real(type, idx_msg->native);
/* Copy the native value for the message */
- if (NULL == (idx_msg->native = (type->copy) (mesg, idx_msg->native)))
+ if (NULL == (idx_msg->native = (type->copy) (mesg, idx_msg->native, update_flags)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy message to object header");
idx_msg->flags = flags;
@@ -3509,6 +3509,102 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5O_iterate
+ *
+ * Purpose: Iterate through object headers of a certain type.
+ *
+ * Return: Returns a negative value if something is wrong, the return
+ * value of the last operator if it was non-zero, or zero if all
+ * object headers were processed.
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Nov 19 2004
+ *
+ * Description:
+ * This function interates over the object headers of an object
+ * specified with 'ent' of type 'type_id'. For each object header of the
+ * object, the 'op_data' and some additional information (specified below) are
+ * passed to the 'op' function.
+ * The operation receives a pointer to the object header message for the
+ * object being iterated over ('mesg'), and the pointer to the operator data
+ * passed in to H5O_iterate ('op_data'). The return values from an operator
+ * are:
+ * A. Zero causes the iterator to continue, returning zero when all
+ * object headers of that type have been processed.
+ * B. Positive causes the iterator to immediately return that positive
+ * value, indicating short-circuit success.
+ * C. Negative causes the iterator to immediately return that value,
+ * indicating failure.
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_iterate(const H5G_entry_t *ent, unsigned type_id, H5O_operator_t op,
+ void *op_data, hid_t dxpl_id)
+{
+ H5O_t *oh=NULL; /* Pointer to actual object header */
+ const H5O_class_t *type; /* Actual H5O class type for the ID */
+ unsigned idx; /* Absolute index of current message in all messages */
+ unsigned sequence; /* Relative index of current message for messages of type */
+ H5O_mesg_t *idx_msg; /* Pointer to current message */
+ herr_t ret_value=0; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5O_iterate, FAIL);
+
+ /* check args */
+ assert(ent);
+ assert(ent->file);
+ assert(H5F_addr_defined(ent->header));
+ assert(type_id<NELMTS(message_type_g));
+ type=message_type_g[type_id]; /* map the type ID to the actual type object */
+ assert(type);
+
+ /* Protect the object header to iterate over */
+ if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header");
+
+ /* Iterate over messages */
+ for (sequence=0, idx = 0, idx_msg=&oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) {
+ if (type->id == idx_msg->type->id) {
+ /*
+ * Decode the message if necessary. If the message is shared then decode
+ * a shared message, ignoring the message type.
+ */
+ if (NULL == idx_msg->native) {
+ const H5O_class_t *decode_type;
+
+ if (idx_msg->flags & H5O_FLAG_SHARED)
+ decode_type = H5O_SHARED;
+ else
+ decode_type = type;
+
+ /* Decode the message if necessary */
+ assert(decode_type->decode);
+ if (NULL == (idx_msg->native = (decode_type->decode) (ent->file, dxpl_id, idx_msg->raw, NULL)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode message");
+ } /* end if */
+
+ /* Call the iterator callback */
+ if((ret_value=(op)(idx_msg->native,sequence,op_data))!=0)
+ break;
+
+ /* Increment sequence value for message type */
+ sequence++;
+ } /* end if */
+ } /* end for */
+
+done:
+ if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, FALSE) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header");
+
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5O_iterate() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_debug_id
*
* Purpose: Act as a proxy for calling the 'debug' method for a
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index 9f92c87..28da005 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -32,7 +32,7 @@
/* PRIVATE PROTOTYPES */
static herr_t H5O_attr_encode (H5F_t *f, uint8_t *p, const void *mesg);
static void *H5O_attr_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
-static void *H5O_attr_copy (const void *_mesg, void *_dest);
+static void *H5O_attr_copy (const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_attr_size (H5F_t *f, const void *_mesg);
static herr_t H5O_attr_reset (void *_mesg);
static herr_t H5O_attr_free (void *mesg);
@@ -368,8 +368,8 @@ done:
This function copies a native (memory) attribute message,
allocating the destination structure if necessary.
--------------------------------------------------------------------------*/
-static void *
-H5O_attr_copy(const void *_src, void *_dst)
+static void *
+H5O_attr_copy(const void *_src, void *_dst, unsigned update_flags)
{
const H5A_t *src = (const H5A_t *) _src;
void *ret_value; /* Return value */
@@ -380,7 +380,7 @@ H5O_attr_copy(const void *_src, void *_dst)
assert(src);
/* copy */
- if (NULL == (ret_value = H5A_copy(_dst,src)))
+ if (NULL == (ret_value = H5A_copy(_dst,src,update_flags)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "can't copy attribute");
done:
@@ -481,7 +481,7 @@ H5O_attr_reset(void *_mesg)
H5A_t *attr = (H5A_t *) _mesg;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_attr_reset);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_reset);
if (attr)
H5A_free(attr);
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 4aee2b9..25b9c05 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -28,7 +28,7 @@
/* PRIVATE PROTOTYPES */
static herr_t H5O_dtype_encode (H5F_t *f, uint8_t *p, const void *mesg);
static void *H5O_dtype_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
-static void *H5O_dtype_copy (const void *_mesg, void *_dest);
+static void *H5O_dtype_copy (const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_dtype_size (H5F_t *f, const void *_mesg);
static herr_t H5O_dtype_reset (void *_mesg);
static herr_t H5O_dtype_free (void *_mesg);
@@ -904,7 +904,7 @@ H5O_dtype_encode(H5F_t UNUSED *f, uint8_t *p, const void *mesg)
FUNC_ENTER_NOAPI_NOINIT(H5O_dtype_encode);
/* check args */
- /*assert(f);*/
+ assert(f);
assert(p);
assert(dt);
@@ -935,7 +935,7 @@ done:
allocating the destination structure if necessary.
--------------------------------------------------------------------------*/
static void *
-H5O_dtype_copy(const void *_src, void *_dst)
+H5O_dtype_copy(const void *_src, void *_dst, unsigned UNUSED update_flags)
{
const H5T_t *src = (const H5T_t *) _src;
H5T_t *dst = NULL;
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index c795956..7472084 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -33,7 +33,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_efl_encode(H5F_t *f, uint8_t *p, const void *_mesg);
-static void *H5O_efl_copy(const void *_mesg, void *_dest);
+static void *H5O_efl_copy(const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_efl_size(H5F_t *f, const void *_mesg);
static herr_t H5O_efl_reset(void *_mesg);
static herr_t H5O_efl_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
@@ -255,7 +255,7 @@ H5O_efl_encode(H5F_t *f, uint8_t *p, const void *_mesg)
*-------------------------------------------------------------------------
*/
static void *
-H5O_efl_copy(const void *_mesg, void *_dest)
+H5O_efl_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
{
const H5O_efl_t *mesg = (const H5O_efl_t *) _mesg;
H5O_efl_t *dest = (H5O_efl_t *) _dest;
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index f79c2d1..c1d1fd1 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -33,7 +33,7 @@
static void *H5O_fill_new_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg);
-static void *H5O_fill_new_copy(const void *_mesg, void *_dest);
+static void *H5O_fill_new_copy(const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_fill_new_size(H5F_t *f, const void *_mesg);
static herr_t H5O_fill_new_reset(void *_mesg);
static herr_t H5O_fill_new_free(void *_mesg);
@@ -42,7 +42,7 @@ static herr_t H5O_fill_new_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FIL
static void *H5O_fill_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_fill_encode(H5F_t *f, uint8_t *p, const void *_mesg);
-static void *H5O_fill_copy(const void *_mesg, void *_dest);
+static void *H5O_fill_copy(const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_fill_size(H5F_t *f, const void *_mesg);
static herr_t H5O_fill_reset(void *_mesg);
static herr_t H5O_fill_free(void *_mesg);
@@ -158,7 +158,7 @@ H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p,
} /* end if */
else
mesg->size=(-1);
-
+
/* Set return value */
ret_value = (void*)mesg;
@@ -293,7 +293,7 @@ static herr_t
H5O_fill_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
{
const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
-
+
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_encode);
assert(f);
@@ -328,7 +328,7 @@ H5O_fill_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
*-------------------------------------------------------------------------
*/
static void *
-H5O_fill_new_copy(const void *_mesg, void *_dest)
+H5O_fill_new_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
{
const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg;
H5O_fill_new_t *dest = (H5O_fill_new_t *)_dest;
@@ -400,7 +400,7 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5O_fill_copy(const void *_mesg, void *_dest)
+H5O_fill_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
{
const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
H5O_fill_t *dest = (H5O_fill_t *)_dest;
@@ -555,7 +555,7 @@ H5O_fill_new_reset(void *_mesg)
}
mesg->alloc_time = (H5D_alloc_time_t)0;
mesg->fill_time = (H5D_fill_time_t)0;
- mesg->fill_defined = FALSE;
+ mesg->fill_defined = FALSE;
FUNC_LEAVE_NOAPI(SUCCEED);
}
@@ -579,6 +579,7 @@ static herr_t
H5O_fill_reset(void *_mesg)
{
H5O_fill_t *mesg = (H5O_fill_t *)_mesg;
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_reset);
@@ -818,10 +819,10 @@ H5O_fill_convert(void *_fill, H5T_t *dset_type, hid_t dxpl_id)
H5O_fill_new_t *fill = _fill;
H5T_path_t *tpath=NULL; /*type conversion info */
void *buf=NULL, *bkg=NULL; /*conversion buffers */
- hid_t src_id=-1, dst_id=-1; /*data type identifiers */
+ hid_t src_id=-1, dst_id=-1; /*datatype identifiers */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5O_fill_convert, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_fill_convert);
assert(fill);
assert(dset_type);
@@ -838,7 +839,7 @@ H5O_fill_convert(void *_fill, H5T_t *dset_type, hid_t dxpl_id)
* Can we convert between source and destination data types?
*/
if (NULL==(tpath=H5T_path_find(fill->type, dset_type, NULL, NULL, dxpl_id)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
/* Don't bother doing anything if there will be no actual conversion */
if (!H5T_path_noop(tpath)) {
@@ -849,7 +850,7 @@ H5O_fill_convert(void *_fill, H5T_t *dset_type, hid_t dxpl_id)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register data type");
/*
- * Data type conversions are always done in place, so we need a buffer
+ * Datatype conversions are always done in place, so we need a buffer
* that is large enough for both source and destination.
*/
if (H5T_get_size(fill->type)>=H5T_get_size(dset_type)) {
@@ -864,7 +865,7 @@ H5O_fill_convert(void *_fill, H5T_t *dset_type, hid_t dxpl_id)
/* Do the conversion */
if (H5T_convert(tpath, src_id, dst_id, 1, 0, 0, buf, bkg, dxpl_id)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed");
/* Update the fill message */
if (buf!=fill->buf) {
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index e829606..28db75c 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -35,7 +35,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_layout_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_layout_encode(H5F_t *f, uint8_t *p, const void *_mesg);
-static void *H5O_layout_copy(const void *_mesg, void *_dest);
+static void *H5O_layout_copy(const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_layout_size(H5F_t *f, const void *_mesg);
static herr_t H5O_layout_reset (void *_mesg);
static herr_t H5O_layout_free (void *_mesg);
@@ -343,7 +343,7 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5O_layout_copy(const void *_mesg, void *_dest)
+H5O_layout_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
{
const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg;
H5O_layout_t *dest = (H5O_layout_t *) _dest;
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index 6044988..57e1de1 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -39,7 +39,7 @@ static size_t H5O_mtime_new_size(H5F_t *f, const void *_mesg);
static void *H5O_mtime_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_mtime_encode(H5F_t *f, uint8_t *p, const void *_mesg);
-static void *H5O_mtime_copy(const void *_mesg, void *_dest);
+static void *H5O_mtime_copy(const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_mtime_size(H5F_t *f, const void *_mesg);
static herr_t H5O_mtime_reset(void *_mesg);
static herr_t H5O_mtime_free(void *_mesg);
@@ -385,7 +385,7 @@ H5O_mtime_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
*-------------------------------------------------------------------------
*/
static void *
-H5O_mtime_copy(const void *_mesg, void *_dest)
+H5O_mtime_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
{
const time_t *mesg = (const time_t *) _mesg;
time_t *dest = (time_t *) _dest;
diff --git a/src/H5Oname.c b/src/H5Oname.c
index 0f1893d..b58246a 100644
--- a/src/H5Oname.c
+++ b/src/H5Oname.c
@@ -37,7 +37,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_name_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_name_encode(H5F_t *f, uint8_t *p, const void *_mesg);
-static void *H5O_name_copy(const void *_mesg, void *_dest);
+static void *H5O_name_copy(const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_name_size(H5F_t *f, const void *_mesg);
static herr_t H5O_name_reset(void *_mesg);
static herr_t H5O_name_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
@@ -166,7 +166,7 @@ H5O_name_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
*-------------------------------------------------------------------------
*/
static void *
-H5O_name_copy(const void *_mesg, void *_dest)
+H5O_name_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
{
const H5O_name_t *mesg = (const H5O_name_t *) _mesg;
H5O_name_t *dest = (H5O_name_t *) _dest;
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 866e1b7..6ddfd92 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -62,7 +62,7 @@ typedef struct H5O_class_t {
size_t native_size; /*size of native message */
void *(*decode)(H5F_t*, hid_t, const uint8_t*, struct H5O_shared_t*);
herr_t (*encode)(H5F_t*, uint8_t*, const void*);
- void *(*copy)(const void*, void*); /*copy native value */
+ void *(*copy)(const void*, void*, unsigned); /*copy native value */
size_t (*raw_size)(H5F_t*, const void*);/*sizeof raw val */
herr_t (*reset)(void *); /*free nested data structs */
herr_t (*free)(void *); /*free main data struct */
diff --git a/src/H5Opline.c b/src/H5Opline.c
index 3485968..5319a92 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -34,7 +34,7 @@
static herr_t H5O_pline_encode (H5F_t *f, uint8_t *p, const void *mesg);
static void *H5O_pline_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
-static void *H5O_pline_copy (const void *_mesg, void *_dest);
+static void *H5O_pline_copy (const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_pline_size (H5F_t *f, const void *_mesg);
static herr_t H5O_pline_reset (void *_mesg);
static herr_t H5O_pline_free (void *_mesg);
@@ -247,7 +247,7 @@ H5O_pline_encode (H5F_t UNUSED *f, uint8_t *p/*out*/, const void *mesg)
*-------------------------------------------------------------------------
*/
static void *
-H5O_pline_copy (const void *_src, void *_dst/*out*/)
+H5O_pline_copy (const void *_src, void *_dst/*out*/, unsigned UNUSED update_flags)
{
const H5O_pline_t *src = (const H5O_pline_t *)_src;
H5O_pline_t *dst = (H5O_pline_t *)_dst;
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index f70443a..3e256e2 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -49,6 +49,10 @@
#define H5O_FLAG_SHARED 0x02u
#define H5O_FLAG_BITS (H5O_FLAG_CONSTANT|H5O_FLAG_SHARED)
+/* Flags for updating messages */
+#define H5O_UPDATE_TIME 0x01u
+#define H5O_UPDATE_DATA_ONLY 0x02u
+
/* Header message IDs */
#define H5O_NULL_ID 0x0000 /* Null Message. */
#define H5O_SDSPACE_ID 0x0001 /* Simple Dataspace Message. */
@@ -220,6 +224,10 @@ typedef struct H5O_stab_t {
haddr_t heap_addr; /*address of name heap */
} H5O_stab_t;
+/* Typedef for iteration operations */
+typedef herr_t (*H5O_operator_t)(const void *mesg/*in*/, unsigned idx,
+ void *operator_data/*in,out*/);
+
/* General message operators */
H5_DLL herr_t H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint,
H5G_entry_t *ent/*out*/);
@@ -232,7 +240,7 @@ H5_DLL htri_t H5O_exists(H5G_entry_t *ent, unsigned type_id, int sequence,
H5_DLL void *H5O_read(H5G_entry_t *ent, unsigned type_id, int sequence,
void *mesg, hid_t dxpl_id);
H5_DLL int H5O_modify(H5G_entry_t *ent, unsigned type_id,
- int overwrite, unsigned flags, unsigned update_time, const void *mesg, hid_t dxpl_id);
+ int overwrite, unsigned flags, unsigned update_flags, const void *mesg, hid_t dxpl_id);
H5_DLL struct H5O_t * H5O_protect(H5G_entry_t *ent, hid_t dxpl_id);
H5_DLL herr_t H5O_unprotect(H5G_entry_t *ent, struct H5O_t *oh, hid_t dxpl_id);
H5_DLL int H5O_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, unsigned type_id,
@@ -254,6 +262,8 @@ H5_DLL size_t H5O_raw_size(unsigned type_id, H5F_t *f, const void *mesg);
H5_DLL herr_t H5O_get_share(unsigned type_id, H5F_t *f, const void *mesg, H5O_shared_t *share);
H5_DLL herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr);
H5_DLL herr_t H5O_get_info(H5G_entry_t *ent, H5O_stat_t *ostat, hid_t dxpl_id);
+H5_DLL herr_t H5O_iterate(const H5G_entry_t *ent, unsigned type_id, H5O_operator_t op,
+ void *op_data, hid_t dxpl_id);
H5_DLL herr_t H5O_debug_id(hid_t type_id, H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, int indent, int fwidth);
H5_DLL herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
int fwidth);
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index e130977..53f8c80 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -28,7 +28,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_sdspace_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg);
-static void *H5O_sdspace_copy(const void *_mesg, void *_dest);
+static void *H5O_sdspace_copy(const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_sdspace_size(H5F_t *f, const void *_mesg);
static herr_t H5O_sdspace_reset(void *_mesg);
static herr_t H5O_sdspace_free (void *_mesg);
@@ -277,7 +277,7 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *mesg)
--------------------------------------------------------------------------*/
static void *
-H5O_sdspace_copy(const void *mesg, void *dest)
+H5O_sdspace_copy(const void *mesg, void *dest, unsigned UNUSED update_flags)
{
const H5S_extent_t *src = (const H5S_extent_t *) mesg;
H5S_extent_t *dst = (H5S_extent_t *) dest;
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index 0024d8d..59c8278 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -41,7 +41,7 @@
static void *H5O_shared_decode (H5F_t*, hid_t dxpl_id, const uint8_t*, H5O_shared_t *sh);
static herr_t H5O_shared_encode (H5F_t*, uint8_t*, const void*);
-static void *H5O_shared_copy(const void *_mesg, void *_dest);
+static void *H5O_shared_copy(const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_shared_size (H5F_t*, const void *_mesg);
static herr_t H5O_shared_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg);
static herr_t H5O_shared_link(H5F_t *f, hid_t dxpl_id, const void *_mesg);
@@ -98,7 +98,7 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_shared_t *shared, const H5O_class_t
{
void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI(H5O_shared_read,NULL);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_shared_read);
/* check args */
assert(f);
@@ -344,7 +344,7 @@ H5O_shared_encode (H5F_t *f, uint8_t *buf/*out*/, const void *_mesg)
*-------------------------------------------------------------------------
*/
static void *
-H5O_shared_copy(const void *_mesg, void *_dest)
+H5O_shared_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
{
const H5O_shared_t *mesg = (const H5O_shared_t *) _mesg;
H5O_shared_t *dest = (H5O_shared_t *) _dest;
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index b47ad3b..4b061df 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -40,7 +40,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_stab_encode(H5F_t *f, uint8_t *p, const void *_mesg);
-static void *H5O_stab_copy(const void *_mesg, void *_dest);
+static void *H5O_stab_copy(const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_stab_size(H5F_t *f, const void *_mesg);
static herr_t H5O_stab_free (void *_mesg);
static herr_t H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg);
@@ -179,7 +179,7 @@ H5O_stab_fast(const H5G_cache_t *cache, const H5O_class_t *type, void *_mesg)
H5O_stab_t *stab = NULL;
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5O_stab_fast, NULL);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_stab_fast);
/* check args */
assert(cache);
@@ -222,7 +222,7 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5O_stab_copy(const void *_mesg, void *_dest)
+H5O_stab_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
{
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
H5O_stab_t *dest = (H5O_stab_t *) _dest;
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index a3b5c80..75e8b8f 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -157,7 +157,7 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id)
*/
if (H5O_create (file, dxpl_id, 64, &(type->ent))<0)
HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create data type object header");
- if (H5O_modify (&(type->ent), H5O_DTYPE_ID, 0, H5O_FLAG_CONSTANT, 1, type, dxpl_id)<0)
+ if (H5O_modify (&(type->ent), H5O_DTYPE_ID, 0, H5O_FLAG_CONSTANT, H5O_UPDATE_TIME, type, dxpl_id)<0)
HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message");
if (H5G_insert (loc, name, &(type->ent), dxpl_id)<0)
HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to name data type");
diff --git a/src/H5Zszip.c b/src/H5Zszip.c
index 5d0282a..42e588c 100644
--- a/src/H5Zszip.c
+++ b/src/H5Zszip.c
@@ -84,7 +84,7 @@ H5Z_class_t H5Z_SZIP[1] = {{
*-------------------------------------------------------------------------
*/
static herr_t
-H5Z_can_apply_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
+H5Z_can_apply_szip(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id)
{
unsigned dtype_size; /* Datatype's size (in bits) */
H5T_order_t dtype_order; /* Datatype's endianness order */