summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-07-05 20:04:55 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-07-05 20:04:55 (GMT)
commitdcb74e8adbd572a5e0c5737ae9106083de8c11b7 (patch)
tree6f3da26448aad0736193d5eb5596f5d9cd205dba
parent21ff623bf571d49735b73f5fa23d920071d35aa7 (diff)
downloadhdf5-dcb74e8adbd572a5e0c5737ae9106083de8c11b7.zip
hdf5-dcb74e8adbd572a5e0c5737ae9106083de8c11b7.tar.gz
hdf5-dcb74e8adbd572a5e0c5737ae9106083de8c11b7.tar.bz2
[svn-r13946] Description:
Back-port change of semantics for constant messages (to allow them to be deleted, but not modified) from the 1.8 branch. Tested on: Mac OS X/32 10.4.10 (amazon) Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
-rw-r--r--src/H5O.c30
-rw-r--r--test/ohdr.c45
2 files changed, 58 insertions, 17 deletions
diff --git a/src/H5O.c b/src/H5O.c
index 95159de..764f2c4 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -2073,28 +2073,24 @@ H5O_remove_cb(H5O_mesg_t *mesg/*in,out*/, unsigned idx, unsigned * oh_flags_ptr,
/*
* Keep track of how many times we failed trying to remove constant
* messages.
+ * (OK to remove constant messages - QAK)
*/
- if(mesg->flags & H5O_FLAG_CONSTANT) {
- udata->nfailed++;
- } /* end if */
- else {
- /* Free any space referred to in the file from this message */
- if(H5O_delete_mesg(udata->f, udata->dxpl_id, mesg, udata->adj_link) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5O_ITER_ERROR, "unable to delete file space for object header message")
+ /* Free any space referred to in the file from this message */
+ if(H5O_delete_mesg(udata->f, udata->dxpl_id, mesg, udata->adj_link) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5O_ITER_ERROR, "unable to delete file space for object header message")
- /* Free any native information */
- H5O_free_mesg(mesg);
+ /* Free any native information */
+ H5O_free_mesg(mesg);
- /* Change message type to nil and zero it */
- mesg->type = H5O_MSG_NULL;
- HDmemset(mesg->raw, 0, mesg->raw_size);
+ /* Change message type to nil and zero it */
+ mesg->type = H5O_MSG_NULL;
+ HDmemset(mesg->raw, 0, mesg->raw_size);
- /* Indicate that the message was modified */
- mesg->dirty = TRUE;
+ /* Indicate that the message was modified */
+ mesg->dirty = TRUE;
- /* Indicate that the object header was modified */
- *oh_flags_ptr = TRUE;
- } /* end else */
+ /* Indicate that the object header was modified */
+ *oh_flags_ptr = TRUE;
/* Break out now, if we've found the correct message */
if(udata->sequence != H5O_ALL)
diff --git a/test/ohdr.c b/test/ohdr.c
index 93ff854..6fe7535 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -67,6 +67,7 @@ main(void)
H5G_entry_t oh_ent;
time_t time_new, ro;
int i;
+ herr_t ret; /* Generic return value */
/* Reset library */
h5_reset();
@@ -275,6 +276,50 @@ main(void)
PASSED();
+ /*
+ * Constant message handling.
+ * (can't write to them, but should be able to remove them)
+ */
+ TESTING("constant message handling");
+ time_new = 22222222;
+ if(H5O_modify(&oh_ent, H5O_MTIME_NEW_ID, H5O_NEW_MESG, H5O_FLAG_CONSTANT, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) {
+ H5_FAILED();
+ H5Eprint(stdout);
+ goto error;
+ }
+ if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, TRUE)<0) {
+ H5_FAILED();
+ H5Eprint(stdout);
+ goto error;
+ }
+ if(NULL == H5O_read(&oh_ent, H5O_MTIME_NEW_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) {
+ H5_FAILED();
+ H5Eprint(stdout);
+ goto error;
+ }
+ if(ro != time_new) {
+ H5_FAILED();
+ HDfprintf(stdout, " got: {%ld}\n", (long)ro);
+ HDfprintf(stdout, " ans: {%ld}\n", (long)time_new);
+ goto error;
+ }
+ time_new = 33333333;
+ H5E_BEGIN_TRY {
+ ret = H5O_modify(&oh_ent, H5O_MTIME_NEW_ID, 0, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) {
+ H5_FAILED();
+ H5Eprint(stdout);
+ goto error;
+ }
+ if(H5O_remove(&oh_ent, H5O_MTIME_NEW_ID, H5O_ALL, TRUE, H5P_DATASET_XFER_DEFAULT) < 0) {
+ H5_FAILED();
+ H5Eprint(stdout);
+ goto error;
+ }
+ PASSED();
+
+
/* release resources */
TESTING("object header closing");
if (H5O_close(&oh_ent)<0) {