diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2015-05-15 02:12:24 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2015-05-15 02:12:24 (GMT) |
commit | 197fa23dae4262f07b9f79e40e4719298c0aefec (patch) | |
tree | f750c02542d426fa9d008ef5dccf2c78b5b85102 /src | |
parent | 2e9d48a551045d958b193d9d7a9964ef18b75dda (diff) | |
download | hdf5-197fa23dae4262f07b9f79e40e4719298c0aefec.zip hdf5-197fa23dae4262f07b9f79e40e4719298c0aefec.tar.gz hdf5-197fa23dae4262f07b9f79e40e4719298c0aefec.tar.bz2 |
[svn-r27082] Description:
Clean up H5O interface, to align w/v3 metadata cache changes
Tested on:
MacOSX/64 10.10.3 (amazon) w/serial & parallel
Linux/32 2.6.* (jam) w/serial & parallel
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Ocache.c | 88 | ||||
-rw-r--r-- | src/H5Omessage.c | 42 |
2 files changed, 61 insertions, 69 deletions
diff --git a/src/H5Ocache.c b/src/H5Ocache.c index b1d94d8..3ccdf11 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -81,15 +81,15 @@ static herr_t H5O_cache_chk_clear(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_ static herr_t H5O_cache_chk_size(const H5F_t *f, const H5O_chunk_proxy_t *chk_proxy, size_t *size_ptr); /* Chunk proxy routines */ -static herr_t H5O_chunk_proxy_dest(H5O_chunk_proxy_t *chunk_proxy); +static herr_t H5O__chunk_proxy_dest(H5O_chunk_proxy_t *chunk_proxy); /* Chunk routines */ -static herr_t H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, +static herr_t H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, H5O_common_cache_ud_t *udata, hbool_t *dirty); -static herr_t H5O_chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno); +static herr_t H5O__chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno); /* Misc. routines */ -static herr_t H5O_add_cont_msg(H5O_cont_msgs_t *cont_msg_info, +static herr_t H5O__add_cont_msg(H5O_cont_msgs_t *cont_msg_info, const H5O_cont_t *cont); @@ -193,7 +193,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Allocate space for the object header data structure */ if(NULL == (oh = H5FL_CALLOC(H5O_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* File-specific, non-stored information */ oh->sizeof_size = H5F_SIZEOF_SIZE(udata->common.f); @@ -333,7 +333,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) buf = read_buf; /* Parse the first chunk */ - if(H5O_chunk_deserialize(oh, udata->common.addr, oh->chunk0_size, buf, &(udata->common), &oh->cache_info.is_dirty) < 0) + if(H5O__chunk_deserialize(oh, udata->common.addr, oh->chunk0_size, buf, &(udata->common), &oh->cache_info.is_dirty) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize first object header chunk") /* Note that we've loaded the object header from the file */ @@ -350,7 +350,7 @@ done: /* Release the [possibly partially initialized] object header on errors */ if(!ret_value && oh) if(H5O_free(oh) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header data") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header data") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_load() */ @@ -480,7 +480,7 @@ H5O_assert(oh); HDassert((size_t)(p - oh->chunk[0].image) == (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh))); /* Serialize messages for this chunk */ - if(H5O_chunk_serialize(f, oh, (unsigned)0) < 0) + if(H5O__chunk_serialize(f, oh, (unsigned)0) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "unable to serialize first object header chunk") /* Write the chunk out */ @@ -522,7 +522,7 @@ H5O_dest(H5F_t *f, H5O_t *oh) FUNC_ENTER_NOAPI_NOINIT - /* check args */ + /* Check arguments */ HDassert(oh); HDassert(oh->rc == 0); @@ -585,7 +585,7 @@ H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy) FUNC_ENTER_NOAPI_NOINIT - /* check args */ + /* Check arguments */ HDassert(oh); #ifdef H5_HAVE_PARALLEL @@ -603,16 +603,13 @@ H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy) for ( i = 0; i < oh->nchunks; i++ ) { - if ( H5O_chunk_serialize(f, oh, i) < 0 ) { - - HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, - "unable to serialize object header chunk") - } + if(H5O__chunk_serialize(f, oh, i) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "unable to serialize object header chunk") } } #endif /* H5_HAVE_PARALLEL */ - /* Mark messages as clean */ + /* Mark messages stored with the object header (i.e. messages in chunk 0) as clean */ for(u = 0; u < oh->nmesgs; u++) oh->mesg[u].dirty = FALSE; @@ -722,7 +719,7 @@ H5O_cache_chk_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) HDassert(udata->common.cont_msg_info); /* Parse the chunk */ - if(H5O_chunk_deserialize(udata->oh, udata->common.addr, udata->size, buf, &(udata->common), &chk_proxy->cache_info.is_dirty) < 0) + if(H5O__chunk_deserialize(udata->oh, udata->common.addr, udata->size, buf, &(udata->common), &chk_proxy->cache_info.is_dirty) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize object header chunk") /* Set the fields for the chunk proxy */ @@ -737,8 +734,8 @@ H5O_cache_chk_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) chk_proxy->oh = udata->oh; chk_proxy->chunkno = udata->chunkno; - /* Sanity check that the chunk representation we have in memory is the same - * as the one being brought in from disk. + /* Sanity check that the chunk representation we have in memory is + * the same as the one being brought in from disk. */ HDassert(0 == HDmemcmp(buf, chk_proxy->oh->chunk[chk_proxy->chunkno].image, chk_proxy->oh->chunk[chk_proxy->chunkno].size)); } /* end else */ @@ -757,7 +754,7 @@ done: /* Release the [possibly partially initialized] object header on errors */ if(!ret_value && chk_proxy) - if(H5O_chunk_proxy_dest(chk_proxy) < 0) + if(H5O__chunk_proxy_dest(chk_proxy) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header chunk proxy") FUNC_LEAVE_NOAPI(ret_value) @@ -788,7 +785,7 @@ H5O_cache_chk_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, /* flush */ if(chk_proxy->cache_info.is_dirty) { /* Serialize messages for this chunk */ - if(H5O_chunk_serialize(f, chk_proxy->oh, chk_proxy->chunkno) < 0) + if(H5O__chunk_serialize(f, chk_proxy->oh, chk_proxy->chunkno) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "unable to serialize object header continuation chunk") /* Write the chunk out */ @@ -850,7 +847,7 @@ H5O_cache_chk_dest(H5F_t *f, H5O_chunk_proxy_t *chk_proxy) } /* end if */ /* Destroy object header chunk proxy */ - if(H5O_chunk_proxy_dest(chk_proxy) < 0) + if(H5O__chunk_proxy_dest(chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to destroy object header chunk proxy") done: @@ -903,18 +900,13 @@ H5O_cache_chk_clear(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_t destroy) FUNC_ENTER_NOAPI_NOINIT - /* check args */ + /* Check arguments */ HDassert(chk_proxy); #ifdef H5_HAVE_PARALLEL - if ( ( chk_proxy->oh->cache_info.is_dirty ) && ( ! destroy ) ) { - - if ( H5O_chunk_serialize(f, chk_proxy->oh, chk_proxy->chunkno) < 0 ) { - - HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, - "unable to serialize object header chunk") - } - } + if((chk_proxy->oh->cache_info.is_dirty) && (!destroy)) + if(H5O__chunk_serialize(f, chk_proxy->oh, chk_proxy->chunkno) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "unable to serialize object header chunk") #endif /* H5_HAVE_PARALLEL */ /* Mark messages in chunk as clean */ @@ -966,7 +958,7 @@ H5O_cache_chk_size(const H5F_t UNUSED *f, const H5O_chunk_proxy_t *chk_proxy, si /*------------------------------------------------------------------------- - * Function: H5O_add_cont_msg + * Function: H5O__add_cont_msg * * Purpose: Add information from a continuation message to the list of * continuation messages in the object header @@ -981,12 +973,12 @@ H5O_cache_chk_size(const H5F_t UNUSED *f, const H5O_chunk_proxy_t *chk_proxy, si *------------------------------------------------------------------------- */ static herr_t -H5O_add_cont_msg(H5O_cont_msgs_t *cont_msg_info, const H5O_cont_t *cont) +H5O__add_cont_msg(H5O_cont_msgs_t *cont_msg_info, const H5O_cont_t *cont) { size_t contno; /* Continuation message index */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(cont_msg_info); @@ -1011,11 +1003,11 @@ H5O_add_cont_msg(H5O_cont_msgs_t *cont_msg_info, const H5O_cont_t *cont) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_add_cont_msg() */ +} /* H5O__add_cont_msg() */ /*------------------------------------------------------------------------- - * Function: H5O_chunk_deserialize + * Function: H5O__chunk_deserialize * * Purpose: Deserialize a chunk for an object header * @@ -1029,7 +1021,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, +H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, H5O_common_cache_ud_t *udata, hbool_t *dirty) { const uint8_t *p; /* Pointer into buffer to decode */ @@ -1042,7 +1034,7 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, #endif /* NDEBUG */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(oh); @@ -1063,7 +1055,7 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, } /* end if */ /* Init the chunk data info */ - chunkno = oh->nchunks++; + chunkno = (unsigned)oh->nchunks++; oh->chunk[chunkno].gap = 0; if(chunkno == 0) { /* First chunk's 'image' includes room for the object header prefix */ @@ -1294,7 +1286,7 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, oh->mesg[curmesg].native = cont; /* Add to continuation messages left to interpret */ - if(H5O_add_cont_msg(udata->cont_msg_info, cont) < 0) + if(H5O__add_cont_msg(udata->cont_msg_info, cont) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't add continuation message") /* Mark the message & chunk as dirty if the message was changed by decoding */ @@ -1350,11 +1342,11 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_chunk_deserialize() */ +} /* H5O__chunk_deserialize() */ /*------------------------------------------------------------------------- - * Function: H5O_chunk_serialize + * Function: H5O__chunk_serialize * * Purpose: Serialize a chunk for an object header * @@ -1368,13 +1360,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno) +H5O__chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno) { 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_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(f); @@ -1415,11 +1407,11 @@ H5O_chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_chunk_serialize() */ +} /* H5O__chunk_serialize() */ /*------------------------------------------------------------------------- - * Function: H5O_chunk_proxy_dest + * Function: H5O__chunk_proxy_dest * * Purpose: Destroy a chunk proxy object * @@ -1433,11 +1425,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_chunk_proxy_dest(H5O_chunk_proxy_t *chk_proxy) +H5O__chunk_proxy_dest(H5O_chunk_proxy_t *chk_proxy) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(chk_proxy); diff --git a/src/H5Omessage.c b/src/H5Omessage.c index f70fa72..d361194 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -73,10 +73,10 @@ typedef struct { /* Local Prototypes */ /********************/ -static herr_t H5O_msg_reset_real(const H5O_msg_class_t *type, void *native); -static herr_t H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, +static herr_t H5O__msg_reset_real(const H5O_msg_class_t *type, void *native); +static herr_t H5O__msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned *oh_modified, void *_udata/*in,out*/); -static herr_t H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, +static herr_t H5O__copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags, unsigned update_flags); @@ -224,7 +224,7 @@ H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *t HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "unable to create new message") /* Copy the information for the message */ - if(H5O_copy_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags) < 0) + if(H5O__copy_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to write message") #ifdef H5O_DEBUG H5O_assert(oh); @@ -426,7 +426,7 @@ H5O_msg_write_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *ty } /* end if */ /* Copy the information for the message */ - if(H5O_copy_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags) < 0) + if(H5O__copy_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message") #ifdef H5O_DEBUG H5O_assert(oh); @@ -586,7 +586,7 @@ H5O_msg_reset(unsigned type_id, void *native) HDassert(type); /* Call the "real" reset routine */ - if(H5O_msg_reset_real(type, native) < 0) + if(H5O__msg_reset_real(type, native) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "unable to reset object header") done: @@ -595,7 +595,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_msg_reset_real + * Function: H5O__msg_reset_real * * Purpose: Some message data structures have internal fields that * need to be freed. This function does that if appropriate @@ -610,11 +610,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_msg_reset_real(const H5O_msg_class_t *type, void *native) +H5O__msg_reset_real(const H5O_msg_class_t *type, void *native) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(type); @@ -630,7 +630,7 @@ H5O_msg_reset_real(const H5O_msg_class_t *type, void *native) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_msg_reset_real() */ +} /* end H5O__msg_reset_real() */ /*------------------------------------------------------------------------- @@ -719,7 +719,7 @@ H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native) HDassert(type); if(msg_native) { - H5O_msg_reset_real(type, msg_native); + H5O__msg_reset_real(type, msg_native); if(NULL != (type->free)) (type->free)(msg_native); else @@ -1049,7 +1049,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_msg_remove_cb + * Function: H5O__msg_remove_cb * * Purpose: Object header iterator callback routine to remove messages * of a particular type that match a particular sequence number, @@ -1064,14 +1064,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, +H5O__msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned *oh_modified, void *_udata/*in,out*/) { H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */ htri_t try_remove = FALSE; /* Whether to try removing a message */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(mesg); @@ -1109,7 +1109,7 @@ H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_msg_remove_cb() */ +} /* end H5O__msg_remove_cb() */ /*------------------------------------------------------------------------- @@ -1160,7 +1160,7 @@ H5O_msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, /* Iterate over the messages, deleting appropriate one(s) */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_msg_remove_cb; + op.u.lib_op = H5O__msg_remove_cb; if(H5O_msg_iterate_real(f, oh, type, &op, &udata, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "error iterating over messages") @@ -1950,7 +1950,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_copy_mesg + * Function: H5O__copy_mesg * * Purpose: Make a copy of the native object for an object header's * native message info @@ -1963,7 +1963,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, +H5O__copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags, unsigned update_flags) { @@ -1972,7 +1972,7 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -1986,7 +1986,7 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") /* Reset existing native information for the header's message */ - H5O_msg_reset_real(type, idx_msg->native); + H5O__msg_reset_real(type, idx_msg->native); /* Copy the native object for the message */ if(NULL == (idx_msg->native = (type->copy)(mesg, idx_msg->native))) @@ -2015,7 +2015,7 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_copy_mesg() */ +} /* end H5O__copy_mesg() */ /*------------------------------------------------------------------------- |