diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-05-23 02:16:41 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-05-23 02:16:41 (GMT) |
commit | c04a55d65e694b7c3e36813f48c24d43118f8e87 (patch) | |
tree | 545de5a9735eab1e44964c20c979565f0fa040d9 /src/H5Ocache.c | |
parent | 2232cf942df7b81ce44888a33e91fbe7077a1f6b (diff) | |
download | hdf5-c04a55d65e694b7c3e36813f48c24d43118f8e87.zip hdf5-c04a55d65e694b7c3e36813f48c24d43118f8e87.tar.gz hdf5-c04a55d65e694b7c3e36813f48c24d43118f8e87.tar.bz2 |
[svn-r13796] Description:
Clean up ISOHM code further and get rid of several non-optimal ways
of working with object headers.
Tested on:
FreeBSD/32 6.2 (duty)
Mac OS X/32 10.4.9 (amazon)
Diffstat (limited to 'src/H5Ocache.c')
-rw-r--r-- | src/H5Ocache.c | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 2f89327..b5c8c7d 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -102,121 +102,6 @@ const H5AC_class_t H5AC_OHDR[1] = {{ /*------------------------------------------------------------------------- - * Function: H5O_flush_msgs - * - * Purpose: Flushes messages for object header. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Nov 21 2005 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O_flush_msgs(H5F_t *f, H5O_t *oh) -{ - H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5O_flush_msgs, FAIL) - - /* check args */ - HDassert(f); - HDassert(oh); - - /* Encode any dirty messages */ - for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) { - if(curr_msg->dirty) { - uint8_t *p; /* Temporary pointer to encode with */ - unsigned msg_id; /* ID for message */ - - /* Point into message's chunk's image */ - p = curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh); - - /* Retrieve actual message ID, for unknown messages */ - if(curr_msg->type == H5O_MSG_UNKNOWN) - msg_id = *(H5O_unknown_t *)(curr_msg->native); - else - msg_id = (uint8_t)curr_msg->type->id; - - /* Encode the message prefix */ - if(oh->version == H5O_VERSION_1) - UINT16ENCODE(p, msg_id) - else - *p++ = (uint8_t)msg_id; - HDassert(curr_msg->raw_size < H5O_MESG_MAX_SIZE); - UINT16ENCODE(p, curr_msg->raw_size); - *p++ = curr_msg->flags; - - /* Only encode reserved bytes for version 1 of format */ - if(oh->version == H5O_VERSION_1) { - *p++ = 0; /*reserved*/ - *p++ = 0; /*reserved*/ - *p++ = 0; /*reserved*/ - } /* end for */ - /* Only encode creation index for version 2+ of format */ - else { - /* Only encode creation index if they are being tracked */ - if(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) - UINT16ENCODE(p, curr_msg->crt_idx); - } /* end else */ - HDassert(p == curr_msg->raw); - -#ifndef NDEBUG - /* Make certain that null messages aren't in chunks w/gaps */ - if(H5O_NULL_ID == msg_id) - HDassert(oh->chunk[curr_msg->chunkno].gap == 0); - - /* Unknown messages should always have a native pointer */ - if(curr_msg->type == H5O_MSG_UNKNOWN) - HDassert(curr_msg->native); -#endif /* NDEBUG */ - - /* Encode the message itself, if it's not an "unknown" message */ - if(curr_msg->native && curr_msg->type != H5O_MSG_UNKNOWN) { - /* - * Encode the message. If the message is shared then we - * encode a Shared Object message instead of the object - * which is being shared. - */ - HDassert(curr_msg->raw >= oh->chunk[curr_msg->chunkno].image); - HDassert(curr_msg->raw_size == H5O_ALIGN_OH(oh, curr_msg->raw_size)); - HDassert(curr_msg->raw + curr_msg->raw_size <= - oh->chunk[curr_msg->chunkno].image + (oh->chunk[curr_msg->chunkno].size - H5O_SIZEOF_CHKSUM_OH(oh))); -#ifndef NDEBUG -/* Sanity check that the message won't overwrite past it's allocated space */ -{ - size_t msg_size; - - msg_size = curr_msg->type->raw_size(f, FALSE, curr_msg->native); - msg_size = H5O_ALIGN_OH(oh, msg_size); - HDassert(msg_size <= curr_msg->raw_size); -} -#endif /* NDEBUG */ - HDassert(curr_msg->type->encode); - if((curr_msg->type->encode)(f, FALSE, curr_msg->raw, curr_msg->native) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message") - } /* end if */ - - /* Pass "modifiedness" from message to chunk */ - curr_msg->dirty = FALSE; - oh->chunk[curr_msg->chunkno].dirty = TRUE; - } /* end if */ - } /* end for */ - - /* Sanity check for the correct # of messages in object header */ - if(oh->nmesgs != u) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "corrupt object header - too few messages") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_flush_msgs() */ - - -/*------------------------------------------------------------------------- * Function: H5O_load * * Purpose: Loads an object header from disk. |