summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-11-15 02:57:16 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-11-15 02:57:16 (GMT)
commit3cbd1175fec7a02d5a6804ac22fffe62488b010e (patch)
treeb1b93a009c93416bba7ea1ae9772d74525383ab0 /src/H5O.c
parent1957c147114fd268ac23c65ad6b52d405d9dd63c (diff)
downloadhdf5-3cbd1175fec7a02d5a6804ac22fffe62488b010e.zip
hdf5-3cbd1175fec7a02d5a6804ac22fffe62488b010e.tar.gz
hdf5-3cbd1175fec7a02d5a6804ac22fffe62488b010e.tar.bz2
[svn-r11714] Purpose:
New feature Description: Check in baseline for compact group revisions, which radically revises the source code for managing groups and object headers. WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! This initiates the "unstable" phase of the 1.7.x branch, leading up to the 1.8.0 release. Please test this code, but do _NOT_ keep files created with it - the format will change again before the release and you will not be able to read your old files!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! Solution: There's too many changes to really describe them all, but some of them include: - Stop abusing the H5G_entry_t structure and split it into two separate structures for non-symbol table node use within the library: H5O_loc_t for object locations in a file and H5G_name_t to store the path to an opened object. H5G_entry_t is now only used for storing symbol table entries on disk. - Retire H5G_namei() in favor of a more general mechanism for traversing group paths and issuing callbacks on objects located. This gets us out of the business of hacking H5G_namei() for new features, generally. - Revised H5O* routines to take a H5O_loc_t instead of H5G_entry_t - Lots more... Platforms tested: h5committested and maybe another dozen configurations.... :-)
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c604
1 files changed, 46 insertions, 558 deletions
diff --git a/src/H5O.c b/src/H5O.c
index f654d57..30538b2 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -65,10 +65,9 @@ typedef herr_t (*H5O_operator_int_t)(H5O_mesg_t *mesg/*in,out*/, unsigned idx,
unsigned * oh_flags_ptr, void *operator_data/*in,out*/);
/* PRIVATE PROTOTYPES */
-static herr_t H5O_init(H5F_t *f, hid_t dxpl_id, size_t size_hint,
+static herr_t H5O_new(H5F_t *f, hid_t dxpl_id, size_t size_hint,
H5G_entry_t *ent/*out*/, haddr_t header);
static herr_t H5O_reset_real(const H5O_class_t *type, void *native);
-static herr_t H5O_free_mesg(H5O_mesg_t *mesg);
static void * H5O_copy_real(const H5O_class_t *type, const void *mesg,
void *dst);
static int H5O_count_real (H5G_entry_t *ent, const H5O_class_t *type,
@@ -103,26 +102,8 @@ static herr_t H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type,
static herr_t H5O_iterate_real(const H5G_entry_t *ent, const H5O_class_t *type,
H5AC_protect_t prot, hbool_t internal, void *op, void *op_data, hid_t dxpl_id);
-/* Metadata cache callbacks */
-static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata1,
- void *_udata2);
-static herr_t H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh);
-static herr_t H5O_dest(H5F_t *f, H5O_t *oh);
-static herr_t H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy);
-static herr_t H5O_compute_size(const H5F_t *f, const H5O_t *oh, size_t *size_ptr);
-
-/* H5O inherits cache-like properties from H5AC */
-static const H5AC_class_t H5AC_OHDR[1] = {{
- H5AC_OHDR_ID,
- (H5AC_load_func_t)H5O_load,
- (H5AC_flush_func_t)H5O_flush,
- (H5AC_dest_func_t)H5O_dest,
- (H5AC_clear_func_t)H5O_clear,
- (H5AC_size_func_t)H5O_compute_size,
-}};
-
/* ID to type mapping */
-static const H5O_class_t *const message_type_g[] = {
+const H5O_class_t *const message_type_g[] = {
H5O_NULL, /*0x0000 Null */
H5O_SDSPACE, /*0x0001 Simple Dimensionality */
NULL, /*0x0002 Data space (fiber bundle?) */
@@ -160,16 +141,16 @@ static void *(*H5O_fast_g[H5G_NCACHED]) (const H5G_cache_t *,
void *);
/* Declare a free list to manage the H5O_t struct */
-H5FL_DEFINE_STATIC(H5O_t);
+H5FL_DEFINE(H5O_t);
/* Declare a free list to manage the H5O_mesg_t sequence information */
-H5FL_SEQ_DEFINE_STATIC(H5O_mesg_t);
+H5FL_SEQ_DEFINE(H5O_mesg_t);
/* Declare a free list to manage the H5O_chunk_t sequence information */
-H5FL_SEQ_DEFINE_STATIC(H5O_chunk_t);
+H5FL_SEQ_DEFINE(H5O_chunk_t);
/* Declare a free list to manage the chunk image information */
-H5FL_BLK_DEFINE_STATIC(chunk_image);
+H5FL_BLK_DEFINE(chunk_image);
/* Declare external the free list for time_t's */
H5FL_EXTERN(time_t);
@@ -179,6 +160,33 @@ H5FL_EXTERN(H5O_cont_t);
/*-------------------------------------------------------------------------
+ * Function: H5O_init
+ *
+ * Purpose: Initialize the interface from some other package.
+ *
+ * Return: Success: non-negative
+ *
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, September 28, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_init(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5O_init, FAIL)
+ /* FUNC_ENTER() does all the work */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_init() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_init_interface
*
* Purpose: Initialize the H5O interface.
@@ -255,7 +263,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5G_entry_t *ent/*out*/)
"file allocation failed for object header header");
/* initialize the object header */
- if (H5O_init(f, dxpl_id, size_hint, ent, header) != SUCCEED)
+ if (H5O_new(f, dxpl_id, size_hint, ent, header) != SUCCEED)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to initialize object header");
done:
@@ -264,7 +272,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_init
+ * Function: H5O_new
*
* Purpose: Initialize a new object header, sets the link count to 0,
* and caches the header. The object header is opened for
@@ -284,13 +292,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_init(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5G_entry_t *ent/*out*/, haddr_t header)
+H5O_new(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5G_entry_t *ent/*out*/, haddr_t header)
{
H5O_t *oh = NULL;
haddr_t tmp_addr;
herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_init);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_new);
/* check args */
assert(f);
@@ -457,518 +465,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_load
- *
- * Purpose: Loads an object header from disk.
- *
- * Return: Success: Pointer to the new object header.
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 5 1997
- *
- * Modifications:
- *
- * Robb Matzke, 1997-08-30
- * Plugged memory leaks that occur during error handling.
- *
- * Robb Matzke, 1998-01-07
- * Able to distinguish between constant and variable messages.
- *
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
- *
- * Quincey Koziol, 2002-7-180
- * Added dxpl parameter to allow more control over I/O from metadata
- * cache.
- *-------------------------------------------------------------------------
- */
-static H5O_t *
-H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
- void UNUSED * _udata2)
-{
- H5O_t *oh = NULL;
- H5O_t *ret_value;
- uint8_t buf[16], *p;
- size_t mesg_size;
- size_t hdr_size;
- unsigned id;
- int mesgno;
- unsigned curmesg = 0, nmesgs;
- unsigned chunkno;
- haddr_t chunk_addr;
- size_t chunk_size;
- uint8_t flags;
-
- FUNC_ENTER_NOAPI(H5O_load, NULL);
-
- /* check args */
- assert(f);
- assert(H5F_addr_defined(addr));
- assert(!_udata1);
- assert(!_udata2);
-
- /* allocate ohdr and init chunk list */
- if (NULL==(oh = H5FL_CALLOC(H5O_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
-
- /* read fixed-lenth part of object header */
- hdr_size = H5O_SIZEOF_HDR(f);
- assert(hdr_size<=sizeof(buf));
- if (H5F_block_read(f, H5FD_MEM_OHDR, addr, hdr_size, dxpl_id, buf) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header");
- p = buf;
-
- /* decode version */
- oh->version = *p++;
- if (H5O_VERSION != oh->version)
- HGOTO_ERROR(H5E_OHDR, H5E_VERSION, NULL, "bad object header version number");
-
- /* reserved */
- p++;
-
- /* decode number of messages */
- UINT16DECODE(p, nmesgs);
-
- /* decode link count */
- UINT32DECODE(p, oh->nlink);
-
- /* decode first chunk info */
- chunk_addr = addr + (hsize_t)hdr_size;
- UINT32DECODE(p, chunk_size);
-
- /* build the message array */
- oh->alloc_nmesgs = MAX(H5O_NMESGS, nmesgs);
- if (NULL==(oh->mesg=H5FL_SEQ_CALLOC(H5O_mesg_t,(size_t)oh->alloc_nmesgs)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
-
- /* read each chunk from disk */
- while (H5F_addr_defined(chunk_addr)) {
- /* increase chunk array size */
- if (oh->nchunks >= oh->alloc_nchunks) {
- unsigned na = oh->alloc_nchunks + H5O_NCHUNKS;
- H5O_chunk_t *x = H5FL_SEQ_REALLOC (H5O_chunk_t, oh->chunk, (size_t)na);
-
- if (!x)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
- oh->alloc_nchunks = na;
- oh->chunk = x;
- }
-
- /* read the chunk raw data */
- chunkno = oh->nchunks++;
- oh->chunk[chunkno].dirty = FALSE;
- oh->chunk[chunkno].addr = chunk_addr;
- oh->chunk[chunkno].size = chunk_size;
- if (NULL==(oh->chunk[chunkno].image = H5FL_BLK_MALLOC(chunk_image,chunk_size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
- if (H5F_block_read(f, H5FD_MEM_OHDR, chunk_addr, chunk_size, dxpl_id,
- oh->chunk[chunkno].image) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header data");
-
- /* load messages from this chunk */
- for (p = oh->chunk[chunkno].image; p < oh->chunk[chunkno].image + chunk_size; p += mesg_size) {
- UINT16DECODE(p, id);
- UINT16DECODE(p, mesg_size);
- assert (mesg_size==H5O_ALIGN (mesg_size));
- flags = *p++;
- p += 3; /*reserved*/
-
- /* Try to detect invalidly formatted object header messages */
- if (p + mesg_size > oh->chunk[chunkno].image + chunk_size)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "corrupt object header");
-
- /* Skip header messages we don't know about */
- /* (Usually from future versions of the library */
- if (id >= NELMTS(message_type_g) || NULL == message_type_g[id])
- continue;
-
- if (H5O_NULL_ID == id && oh->nmesgs > 0 &&
- H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id &&
- oh->mesg[oh->nmesgs - 1].chunkno == chunkno) {
- /* combine adjacent null messages */
- mesgno = oh->nmesgs - 1;
- oh->mesg[mesgno].raw_size += H5O_SIZEOF_MSGHDR(f) + mesg_size;
- } else {
- /* new message */
- if (oh->nmesgs >= nmesgs)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "corrupt object header");
- mesgno = oh->nmesgs++;
- oh->mesg[mesgno].type = message_type_g[id];
- oh->mesg[mesgno].dirty = FALSE;
- oh->mesg[mesgno].flags = flags;
- oh->mesg[mesgno].native = NULL;
- oh->mesg[mesgno].raw = p;
- oh->mesg[mesgno].raw_size = mesg_size;
- oh->mesg[mesgno].chunkno = chunkno;
- }
- }
-
- assert(p == oh->chunk[chunkno].image + chunk_size);
-
- /* decode next object header continuation message */
- for (chunk_addr = HADDR_UNDEF; !H5F_addr_defined(chunk_addr) && curmesg < oh->nmesgs; ++curmesg) {
- if (H5O_CONT_ID == oh->mesg[curmesg].type->id) {
- H5O_cont_t *cont;
-
- cont = (H5O_CONT->decode) (f, dxpl_id, oh->mesg[curmesg].raw, NULL);
- oh->mesg[curmesg].native = cont;
- chunk_addr = cont->addr;
- chunk_size = cont->size;
- cont->chunkno = oh->nchunks; /*the next chunk to allocate */
- }
- }
- }
-
- /* Set return value */
- ret_value = oh;
-
-done:
- if (!ret_value && oh) {
- if(H5O_dest(f,oh)<0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "unable to destroy object header data");
- }
-
- FUNC_LEAVE_NOAPI(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_flush
- *
- * Purpose: Flushes (and destroys) an object header.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 5 1997
- *
- * Modifications:
- *
- * Robb Matzke, 1998-01-07
- * Handles constant vs non-constant messages.
- *
- * rky, 1998-08-28
- * Only p0 writes metadata to disk.
- *
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
- *
- * Quincey Koziol, 2002-7-180
- * Added dxpl parameter to allow more control over I/O from metadata
- * cache.
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh)
-{
- uint8_t buf[16], *p;
- int id;
- unsigned u;
- H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
- H5O_cont_t *cont = NULL;
- herr_t (*encode)(H5F_t*, uint8_t*, const void*) = NULL;
- unsigned combine=0; /* Whether to combine the object header prefix & the first chunk */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5O_flush, FAIL);
-
- /* check args */
- assert(f);
- assert(H5F_addr_defined(addr));
- assert(oh);
-
- /* flush */
- if (oh->cache_info.is_dirty) {
- p = buf;
-
- /* encode version */
- *p++ = oh->version;
-
- /* reserved */
- *p++ = 0;
-
- /* encode number of messages */
- UINT16ENCODE(p, oh->nmesgs);
-
- /* encode link count */
- UINT32ENCODE(p, oh->nlink);
-
- /* encode body size */
- UINT32ENCODE(p, oh->chunk[0].size);
-
- /* zero to alignment */
- HDmemset (p, 0, (size_t)(H5O_SIZEOF_HDR(f)-12));
-
- /* write the object header prefix */
-
- /* Check if we can combine the object header prefix & the first chunk into one I/O operation */
- if(oh->chunk[0].dirty && (addr+H5O_SIZEOF_HDR(f))==oh->chunk[0].addr) {
- combine=1;
- } /* end if */
- else {
- if (H5F_block_write(f, H5FD_MEM_OHDR, addr, (size_t)H5O_SIZEOF_HDR(f),
- dxpl_id, buf) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header hdr to disk");
- } /* end else */
-
- /* encode messages */
- for (u = 0, curr_msg=&oh->mesg[0]; u < oh->nmesgs; u++,curr_msg++) {
- if (curr_msg->dirty) {
- p = curr_msg->raw - H5O_SIZEOF_MSGHDR(f);
-
- id = curr_msg->type->id;
- UINT16ENCODE(p, id);
- assert (curr_msg->raw_size<H5O_MAX_SIZE);
- UINT16ENCODE(p, curr_msg->raw_size);
- *p++ = curr_msg->flags;
- *p++ = 0; /*reserved*/
- *p++ = 0; /*reserved*/
- *p++ = 0; /*reserved*/
-
- if (curr_msg->native) {
- assert(curr_msg->type->encode);
-
- /* allocate file space for chunks that have none yet */
- if (H5O_CONT_ID == curr_msg->type->id &&
- !H5F_addr_defined(((H5O_cont_t *)(curr_msg->native))->addr)) {
- cont = (H5O_cont_t *) (curr_msg->native);
- assert(cont->chunkno < oh->nchunks);
- assert(!H5F_addr_defined(oh->chunk[cont->chunkno].addr));
- cont->size = oh->chunk[cont->chunkno].size;
-
- /* Free the space we'd reserved in the file to hold this chunk */
- H5MF_free_reserved(f, (hsize_t)cont->size);
-
- if (HADDR_UNDEF==(cont->addr=H5MF_alloc(f, H5FD_MEM_OHDR, dxpl_id, (hsize_t)cont->size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate space for object header data");
- oh->chunk[cont->chunkno].addr = cont->addr;
- }
-
- /*
- * Encode the message. If the message is shared then we
- * encode a Shared Object message instead of the object
- * which is being shared.
- */
- assert(curr_msg->raw >=
- oh->chunk[curr_msg->chunkno].image);
- assert (curr_msg->raw_size ==
- H5O_ALIGN (curr_msg->raw_size));
- assert(curr_msg->raw + curr_msg->raw_size <=
- oh->chunk[curr_msg->chunkno].image +
- oh->chunk[curr_msg->chunkno].size);
- if (curr_msg->flags & H5O_FLAG_SHARED) {
- encode = H5O_SHARED->encode;
- } else {
- encode = curr_msg->type->encode;
- }
- if ((encode)(f, curr_msg->raw, curr_msg->native)<0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message");
- }
- curr_msg->dirty = FALSE;
- oh->chunk[curr_msg->chunkno].dirty = TRUE;
- }
- }
-
- /* write each chunk to disk */
- for (u = 0; u < oh->nchunks; u++) {
- if (oh->chunk[u].dirty) {
- assert(H5F_addr_defined(oh->chunk[u].addr));
- if(u==0 && combine) {
- /* Allocate space for the combined prefix and first chunk */
- if((p=H5FL_BLK_MALLOC(chunk_image,(H5O_SIZEOF_HDR(f)+oh->chunk[u].size)))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
-
- /* Copy in the prefix */
- HDmemcpy(p,buf,(size_t)H5O_SIZEOF_HDR(f));
-
- /* Copy in the first chunk */
- HDmemcpy(p+H5O_SIZEOF_HDR(f),oh->chunk[u].image,oh->chunk[u].size);
-
- /* Write the combined prefix/chunk out */
- if (H5F_block_write(f, H5FD_MEM_OHDR, addr,
- (H5O_SIZEOF_HDR(f)+oh->chunk[u].size),
- dxpl_id, p) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header data to disk");
-
- /* Release the memory for the combined prefix/chunk */
- p = H5FL_BLK_FREE(chunk_image,p);
- } /* end if */
- else {
- if (H5F_block_write(f, H5FD_MEM_OHDR, oh->chunk[u].addr,
- (oh->chunk[u].size),
- dxpl_id, oh->chunk[u].image) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header data to disk");
- } /* end else */
- oh->chunk[u].dirty = FALSE;
- } /* end if */
- } /* end for */
- oh->cache_info.is_dirty = FALSE;
- }
-
- if (destroy) {
- if(H5O_dest(f,oh)<0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data");
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_dest
- *
- * Purpose: Destroys an object header.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Jan 15 2003
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_dest(H5F_t UNUSED *f, H5O_t *oh)
-{
- unsigned i;
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_dest);
-
- /* check args */
- assert(oh);
-
- /* Verify that node is clean */
- assert (oh->cache_info.is_dirty==FALSE);
-
- /* destroy chunks */
- for (i = 0; i < oh->nchunks; i++) {
- /* Verify that chunk is clean */
- assert (oh->chunk[i].dirty==0);
-
- oh->chunk[i].image = H5FL_BLK_FREE(chunk_image,oh->chunk[i].image);
- }
- if(oh->chunk)
- oh->chunk = H5FL_SEQ_FREE(H5O_chunk_t,oh->chunk);
-
- /* destroy messages */
- for (i = 0; i < oh->nmesgs; i++) {
- /* Verify that message is clean */
- assert (oh->mesg[i].dirty==0);
-
- H5O_free_mesg(&oh->mesg[i]);
- }
- if(oh->mesg)
- oh->mesg = H5FL_SEQ_FREE(H5O_mesg_t,oh->mesg);
-
- /* destroy object header */
- H5FL_FREE(H5O_t,oh);
-
- FUNC_LEAVE_NOAPI(SUCCEED);
-} /* end H5O_dest() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_clear
- *
- * Purpose: Mark a object header in memory as non-dirty.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 20 2003
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy)
-{
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT(H5O_clear);
-
- /* check args */
- assert(oh);
-
- /* Mark chunks as clean */
- for (u = 0; u < oh->nchunks; u++)
- oh->chunk[u].dirty=FALSE;
-
- /* Mark messages as clean */
- for (u = 0; u < oh->nmesgs; u++)
- oh->mesg[u].dirty=FALSE;
-
- /* Mark whole header as clean */
- oh->cache_info.is_dirty=FALSE;
-
- if (destroy)
- if (H5O_dest(f, oh) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
-} /* end H5O_clear() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_compute_size
- *
- * Purpose: Compute the size in bytes of the specified instance of
- * H5O_t on disk, and return it in *len_ptr. On failure,
- * the value of *len_ptr is undefined.
- *
- * The value returned will probably be low unless the object
- * has just been flushed, as we simply total up the size of
- * the header with the sizes of the chunks. Thus any message
- * that has been added since the last flush will not be
- * reflected in the total.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 5/13/04
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_compute_size(const H5F_t *f, const H5O_t *oh, size_t *size_ptr)
-{
- unsigned u;
- size_t size;
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_compute_size);
-
- /* check args */
- HDassert(f);
- HDassert(oh);
- HDassert(size_ptr);
-
- size = H5O_SIZEOF_HDR(f);
-
- for (u = 0; u < oh->nchunks; u++)
- size += oh->chunk[u].size;
-
- HDassert(size >= H5O_SIZEOF_HDR(f));
-
- *size_ptr = size;
-
- FUNC_LEAVE_NOAPI(SUCCEED);
-} /* H5O_compute_size() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O_reset
*
* Purpose: Some message data structures have internal fields that
@@ -1102,7 +598,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5O_free_mesg(H5O_mesg_t *mesg)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_free_mesg)
@@ -1746,7 +1242,7 @@ H5O_find_in_ohdr(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t **type_p,
if (NULL == oh->mesg[u].native) {
assert(type->decode);
- oh->mesg[u].native = (type->decode) (f, dxpl_id, oh->mesg[u].raw, NULL);
+ oh->mesg[u].native = (type->decode) (f, dxpl_id, oh->mesg[u].raw);
if (NULL == oh->mesg[u].native)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, UFAIL, "unable to decode message");
}
@@ -3542,7 +3038,7 @@ H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_mesg_t *mesg, hbool_t adj_link)
*/
if (NULL == mesg->native) {
assert(type->decode);
- mesg->native = (type->decode) (f, dxpl_id, mesg->raw, NULL);
+ mesg->native = (type->decode) (f, dxpl_id, mesg->raw);
if (NULL == mesg->native)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode message");
} /* end if */
@@ -3750,7 +3246,7 @@ H5O_iterate_real(const H5G_entry_t *ent, const H5O_class_t *type, H5AC_protect_t
/* Decode the message if necessary */
HDassert(decode_type->decode);
- if (NULL == (idx_msg->native = (decode_type->decode) (ent->file, dxpl_id, idx_msg->raw, NULL)))
+ if (NULL == (idx_msg->native = (decode_type->decode) (ent->file, dxpl_id, idx_msg->raw)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode message")
} /* end if */
@@ -3856,7 +3352,7 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
int *sequence;
haddr_t tmp_addr;
herr_t ret_value = SUCCEED;
- void *(*decode)(H5F_t*, hid_t, const uint8_t*, H5O_shared_t*);
+ void *(*decode)(H5F_t*, hid_t, const uint8_t*);
herr_t (*debug)(H5F_t*, hid_t, const void*, FILE*, int, int)=NULL;
FUNC_ENTER_NOAPI(H5O_debug, FAIL);
@@ -3972,7 +3468,7 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
debug = oh->mesg[i].type->debug;
}
if (NULL==oh->mesg[i].native && decode)
- oh->mesg[i].native = (decode)(f, dxpl_id, oh->mesg[i].raw, NULL);
+ oh->mesg[i].native = (decode)(f, dxpl_id, oh->mesg[i].raw);
if (NULL==oh->mesg[i].native)
debug = NULL;
@@ -3989,17 +3485,9 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
H5O_shared_t *shared = (H5O_shared_t*)(oh->mesg[i].native);
void *mesg = NULL;
- if (shared->in_gh) {
- void *p = H5HG_read (f, dxpl_id, oh->mesg[i].native, NULL);
- mesg = (oh->mesg[i].type->decode)(f, dxpl_id, p, oh->mesg[i].native);
- H5MM_xfree (p);
- } else {
- mesg = H5O_read_real(&(shared->u.ent), oh->mesg[i].type, 0, NULL, dxpl_id);
- }
- if (oh->mesg[i].type->debug) {
- (oh->mesg[i].type->debug)(f, dxpl_id, mesg, stream, indent+3,
- MAX (0, fwidth-3));
- }
+ mesg = H5O_read_real(&(shared->ent), oh->mesg[i].type, 0, NULL, dxpl_id);
+ if (oh->mesg[i].type->debug)
+ (oh->mesg[i].type->debug)(f, dxpl_id, mesg, stream, indent+3, MAX (0, fwidth-3));
H5O_free_real(oh->mesg[i].type, mesg);
}
}