diff options
author | Sean McBride <sean@rogue-research.com> | 2023-08-02 13:39:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-02 13:39:15 (GMT) |
commit | 2b0badb90e4e516d0758efbd8ec96449188c7249 (patch) | |
tree | 074e38039b95ca7121a0117069974eff52a04519 /src/H5Cimage.c | |
parent | 56451503c55ef6e5f67fc3bb710f9e5b649b1af2 (diff) | |
download | hdf5-2b0badb90e4e516d0758efbd8ec96449188c7249.zip hdf5-2b0badb90e4e516d0758efbd8ec96449188c7249.tar.gz hdf5-2b0badb90e4e516d0758efbd8ec96449188c7249.tar.bz2 |
Made HGOTO_ERROR a do-while loop (#3308)
* Made HGOTO_ERROR a do-while loop
Diffstat (limited to 'src/H5Cimage.c')
-rw-r--r-- | src/H5Cimage.c | 142 |
1 files changed, 72 insertions, 70 deletions
diff --git a/src/H5Cimage.c b/src/H5Cimage.c index 96d22d7..87df542 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -260,18 +260,18 @@ H5C__construct_cache_image_buffer(H5F_t *f, H5C_t *cache_ptr) /* Allocate the buffer in which to construct the cache image block */ if (NULL == (cache_ptr->image_buffer = H5MM_malloc(cache_ptr->image_len + 1))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for cache image buffer") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for cache image buffer"); /* Construct the cache image block header image */ p = (uint8_t *)cache_ptr->image_buffer; if (H5C__encode_cache_image_header(f, cache_ptr, &p) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTENCODE, FAIL, "header image construction failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTENCODE, FAIL, "header image construction failed"); assert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) < cache_ptr->image_data_len); /* Construct the cache entry images */ for (u = 0; u < cache_ptr->num_entries_in_image; u++) if (H5C__encode_cache_image_entry(f, cache_ptr, &p, u) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTENCODE, FAIL, "entry image construction failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTENCODE, FAIL, "entry image construction failed"); assert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) < cache_ptr->image_data_len); /* Construct the adaptive resize status image -- not yet */ @@ -403,16 +403,16 @@ H5C__generate_cache_image(H5F_t *f, H5C_t *cache_ptr) /* Construct cache image */ if (H5C__construct_cache_image_buffer(f, cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't create metadata cache image") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't create metadata cache image"); /* Free image entries array */ if (H5C__free_image_entries_array(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't free image entries array") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't free image entries array"); /* Write cache image block if so configured */ if (cache_ptr->image_ctl.flags & H5C_CI__GEN_MDC_IMAGE_BLK) { if (H5C__write_cache_image(f, cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write metadata cache image block to file") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write metadata cache image block to file"); H5C__UPDATE_STATS_FOR_CACHE_IMAGE_CREATE(cache_ptr); } /* end if */ @@ -503,9 +503,9 @@ H5C__get_cache_image_config(const H5C_t *cache_ptr, H5C_cache_image_ctl_t *confi FUNC_ENTER_PACKAGE if (cache_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache_ptr on entry") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache_ptr on entry"); if (config_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad config_ptr on entry") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad config_ptr on entry"); *config_ptr = cache_ptr->image_ctl; @@ -551,7 +551,7 @@ H5C__read_cache_image(H5F_t *f, H5C_t *cache_ptr) */ if (H5F_block_read(f, H5FD_MEM_SUPER, cache_ptr->image_addr, cache_ptr->image_len, cache_ptr->image_buffer) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, "Can't read metadata cache image block") + HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, "Can't read metadata cache image block"); H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr); @@ -620,15 +620,15 @@ H5C__load_cache_image(H5F_t *f) /* Allocate space for the image */ if (NULL == (cache_ptr->image_buffer = H5MM_malloc(cache_ptr->image_len + 1))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for cache image buffer") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for cache image buffer"); /* Load the image from file */ if (H5C__read_cache_image(f, cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, "Can't read metadata cache image block") + HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, "Can't read metadata cache image block"); /* Reconstruct cache contents, from image */ if (H5C__reconstruct_cache_contents(f, cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "Can't reconstruct cache contents from image block") + HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "Can't reconstruct cache contents from image block"); /* Free the image buffer */ cache_ptr->image_buffer = H5MM_xfree(cache_ptr->image_buffer); @@ -645,7 +645,7 @@ H5C__load_cache_image(H5F_t *f) if (cache_ptr->delete_image) { if (H5F__super_ext_remove_msg(f, H5O_MDCI_MSG_ID) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, - "can't remove metadata cache image message from superblock extension") + "can't remove metadata cache image message from superblock extension"); /* Reset image block values */ cache_ptr->image_len = 0; @@ -825,7 +825,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) if (cache_ptr->load_image) { cache_ptr->load_image = FALSE; if (H5C__load_cache_image(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "can't load cache image") + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "can't load cache image"); } /* end if */ /* Before we start to generate the cache image (if requested), verify @@ -868,11 +868,11 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) */ if (cache_ptr->image_ctl.flags & H5C_CI__GEN_MDCI_SBE_MESG) if (H5C__write_cache_image_superblock_msg(f, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "creation of cache image SB mesg failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "creation of cache image SB mesg failed."); /* Serialize the cache */ if (H5C__serialize_cache(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "serialization of the cache failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "serialization of the cache failed"); /* Scan the cache and record data needed to construct the * cache image. In particular, for each entry we must record: @@ -891,7 +891,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) * manager code, this size should be correct. */ if (H5C__prep_for_file_close__scan_entries(f, cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C__prep_for_file_close__scan_entries failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C__prep_for_file_close__scan_entries failed"); assert(HADDR_UNDEF == cache_ptr->image_addr); #ifdef H5_HAVE_PARALLEL @@ -935,7 +935,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) (cache_ptr->image_addr = H5FD_alloc(f->shared->lf, H5FD_MEM_SUPER, f, (hsize_t)p0_image_len, &eoa_frag_addr, &eoa_frag_size))) HGOTO_ERROR(H5E_CACHE, H5E_NOSPACE, FAIL, - "can't allocate file space for metadata cache image") + "can't allocate file space for metadata cache image"); } /* end if */ else #endif /* H5_HAVE_PARALLEL */ @@ -947,7 +947,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) (hsize_t)(cache_ptr->image_data_len), &eoa_frag_addr, &eoa_frag_size))) HGOTO_ERROR(H5E_CACHE, H5E_NOSPACE, FAIL, - "can't allocate file space for metadata cache image") + "can't allocate file space for metadata cache image"); /* Make note of the eoa after allocation of the cache image * block. This value is used for sanity checking when we @@ -956,7 +956,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) */ assert(HADDR_UNDEF == f->shared->eoa_post_mdci_fsalloc); if (HADDR_UNDEF == (f->shared->eoa_post_mdci_fsalloc = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size"); /* For now, drop any fragment left over from the allocation of the * image block on the ground. A fragment should only be returned @@ -989,7 +989,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) */ if (cache_ptr->image_ctl.flags & H5C_CI__GEN_MDC_IMAGE_BLK) if (H5C__write_cache_image_superblock_msg(f, FALSE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "update of cache image SB mesg failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "update of cache image SB mesg failed"); /* At this point: * @@ -1027,7 +1027,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) */ if (cache_ptr->num_entries_in_image > 0) { if (H5C__prep_for_file_close__setup_image_entries_array(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINIT, FAIL, "can't setup image entries array.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINIT, FAIL, "can't setup image entries array."); /* Sort the entries */ qsort(cache_ptr->image_entries, (size_t)cache_ptr->num_entries_in_image, @@ -1044,7 +1044,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) if (cache_ptr->image_ctl.flags & H5C_CI__GEN_MDC_IMAGE_BLK) if (H5F__super_ext_remove_msg(f, H5O_MDCI_MSG_ID) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, - "can't remove MDC image msg from superblock ext") + "can't remove MDC image msg from superblock ext"); cache_ptr->image_ctl.generate_image = FALSE; } /* end else */ @@ -1096,11 +1096,11 @@ H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_image_ctl /* Check arguments */ if (cache_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache_ptr on entry") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache_ptr on entry"); /* Validate the config: */ if (H5C_validate_cache_image_config(config_ptr) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid cache image configuration") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid cache image configuration"); #ifdef H5_HAVE_PARALLEL /* The collective metadata write code is not currently compatible @@ -1164,26 +1164,26 @@ H5C_validate_cache_image_config(H5C_cache_image_ctl_t *ctl_ptr) FUNC_ENTER_NOAPI(FAIL) if (ctl_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL ctl_ptr on entry") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL ctl_ptr on entry"); if (ctl_ptr->version != H5C__CURR_CACHE_IMAGE_CTL_VER) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown cache image control version") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown cache image control version"); /* At present, we do not support inclusion of the adaptive resize * configuration in the cache image. Thus the save_resize_status * field must be FALSE. */ if (ctl_ptr->save_resize_status != FALSE) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unexpected value in save_resize_status field") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unexpected value in save_resize_status field"); /* At present, we do not support prefetched entry ageouts. Thus * the entry_ageout field must be set to * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE. */ if (ctl_ptr->entry_ageout != H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unexpected value in entry_ageout field") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unexpected value in entry_ageout field"); if ((ctl_ptr->flags & ~H5C_CI__ALL_FLAGS) != 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unknown flag set") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unknown flag set"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1289,38 +1289,38 @@ H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t * /* Check signature */ if (memcmp(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN) != 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image header signature") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image header signature"); p += H5C__MDCI_BLOCK_SIGNATURE_LEN; /* Check version */ version = *p++; if (version != (uint8_t)H5C__MDCI_BLOCK_VERSION_0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image version") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image version"); /* Decode flags */ flags = *p++; if (flags & H5C__MDCI_HEADER_HAVE_RESIZE_STATUS) have_resize_status = TRUE; if (have_resize_status) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "MDC resize status not yet supported") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "MDC resize status not yet supported"); /* Read image data length */ H5F_DECODE_LENGTH(f, p, cache_ptr->image_data_len); /* For now -- will become <= eventually */ if (cache_ptr->image_data_len != cache_ptr->image_len) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image data length") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image data length"); /* Read num entries */ UINT32DECODE(p, cache_ptr->num_entries_in_image); if (cache_ptr->num_entries_in_image == 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache entry count") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache entry count"); /* Verify expected length of header */ actual_header_len = (size_t)(p - *buf); expected_header_len = H5C__cache_image_block_header_size(f); if (actual_header_len != expected_header_len) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad header image len") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad header image len"); /* Update buffer pointer */ *buf = p; @@ -1415,7 +1415,7 @@ H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr, const uint /* Decode dirty dependency child count */ UINT16DECODE(p, fd_dirty_child_count); if (fd_dirty_child_count > fd_child_count) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid dirty flush dependency child count") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid dirty flush dependency child count"); /* Decode dependency parent count */ UINT16DECODE(p, fd_parent_count); @@ -1428,16 +1428,16 @@ H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr, const uint /* Decode entry offset */ H5F_addr_decode(f, &p, &addr); if (!H5_addr_defined(addr)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid entry offset") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid entry offset"); /* Decode entry length */ H5F_DECODE_LENGTH(f, p, size); if (size == 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid entry size") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid entry size"); /* Verify expected length of entry image */ if ((size_t)(p - *buf) != H5C__cache_image_block_entry_header_size(f)) - HGOTO_ERROR(H5E_CACHE, H5E_BADSIZE, FAIL, "Bad entry image len") + HGOTO_ERROR(H5E_CACHE, H5E_BADSIZE, FAIL, "Bad entry image len"); /* If parent count greater than zero, allocate array for parent * addresses, and decode addresses into the array. @@ -1446,18 +1446,19 @@ H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr, const uint int i; /* Local index variable */ if (NULL == (fd_parent_addrs = (haddr_t *)H5MM_malloc((size_t)(fd_parent_count)*H5F_SIZEOF_ADDR(f)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for fd parent addrs buffer") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, + "memory allocation failed for fd parent addrs buffer"); for (i = 0; i < fd_parent_count; i++) { H5F_addr_decode(f, &p, &(fd_parent_addrs[i])); if (!H5_addr_defined(fd_parent_addrs[i])) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid flush dependency parent offset") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid flush dependency parent offset"); } /* end for */ } /* end if */ /* Allocate buffer for entry image */ if (NULL == (image_ptr = H5MM_malloc(size + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer"); #if H5C_DO_MEMORY_SANITY_CHECKS H5MM_memcpy(((uint8_t *)image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); @@ -1552,7 +1553,7 @@ H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr, uint8_t * actual_header_len = (size_t)(p - *buf); expected_header_len = H5C__cache_image_block_header_size(f); if (actual_header_len != expected_header_len) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad header image len") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad header image len"); /* Update buffer pointer */ *buf = p; @@ -1601,7 +1602,7 @@ H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf, unsigne /* Encode type */ if ((ie_ptr->type_id < 0) || (ie_ptr->type_id > 255)) - HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "type_id out of range.") + HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "type_id out of range."); *p++ = (uint8_t)(ie_ptr->type_id); /* Compose and encode flags */ @@ -1623,17 +1624,17 @@ H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf, unsigne /* Validate and encode dependency child count */ if (ie_ptr->fd_child_count > H5C__MDCI_MAX_FD_CHILDREN) - HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "fd_child_count out of range") + HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "fd_child_count out of range"); UINT16ENCODE(p, (uint16_t)(ie_ptr->fd_child_count)); /* Validate and encode dirty dependency child count */ if (ie_ptr->fd_dirty_child_count > H5C__MDCI_MAX_FD_CHILDREN) - HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "fd_dirty_child_count out of range") + HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "fd_dirty_child_count out of range"); UINT16ENCODE(p, (uint16_t)(ie_ptr->fd_dirty_child_count)); /* Validate and encode dependency parent count */ if (ie_ptr->fd_parent_count > H5C__MDCI_MAX_FD_PARENTS) - HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "fd_parent_count out of range") + HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "fd_parent_count out of range"); UINT16ENCODE(p, (uint16_t)(ie_ptr->fd_parent_count)); /* Encode index in LRU */ @@ -1647,7 +1648,7 @@ H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf, unsigne /* Verify expected length of entry image */ if ((size_t)(p - *buf) != H5C__cache_image_block_entry_header_size(f)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad entry image len") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad entry image len"); /* Encode dependency parent offsets -- if any */ for (u = 0; u < ie_ptr->fd_parent_count; u++) @@ -1841,7 +1842,7 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr) if (NULL == (entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_calloc( sizeof(haddr_t) * (size_t)(entry_ptr->fd_parent_addrs)))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, - "memory allocation failed for fd parent addr array") + "memory allocation failed for fd parent addr array"); v = 0; for (u = 0; u < entry_ptr->flush_dep_nparents; u++) { @@ -2002,7 +2003,7 @@ H5C__prep_for_file_close__setup_image_entries_array(H5C_t *cache_ptr) /* Allocate and initialize image_entries array */ if (NULL == (image_entries = (H5C_image_entry_t *)H5MM_calloc( sizeof(H5C_image_entry_t) * (size_t)(cache_ptr->num_entries_in_image + 1)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for image_entries") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for image_entries"); /* Initialize (non-zero/NULL/FALSE) fields */ for (u = 0; u <= cache_ptr->num_entries_in_image; u++) { @@ -2199,7 +2200,7 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr) if (NULL == (entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_malloc( sizeof(haddr_t) * (size_t)(entry_ptr->fd_parent_count)))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, - "memory allocation failed for fd parent addrs buffer") + "memory allocation failed for fd parent addrs buffer"); for (int i = 0; i < (int)(entry_ptr->fd_parent_count); i++) { entry_ptr->fd_parent_addrs[i] = entry_ptr->flush_dep_parent[i]->addr; @@ -2220,7 +2221,7 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr) */ if (entry_ptr->flush_dep_nchildren > 0) { if (!entry_ptr->is_pinned) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "encountered unpinned fd parent?!?") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "encountered unpinned fd parent?!?"); entry_ptr->fd_child_count = entry_ptr->flush_dep_nchildren; entry_ptr->fd_dirty_child_count = entry_ptr->flush_dep_ndirty_children; @@ -2262,7 +2263,7 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr) * call, computation of the image size is delayed. */ if (H5C__prep_for_file_close__compute_fd_heights(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "computation of flush dependency heights failed?!?") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "computation of flush dependency heights failed?!?"); /* At this point, all entries that will appear in the cache * image should be marked correctly. Compute the size of the @@ -2386,7 +2387,7 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) /* Decode metadata cache image header */ p = (uint8_t *)cache_ptr->image_buffer; if (H5C__decode_cache_image_header(f, cache_ptr, &p) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "cache image header decode failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "cache image header decode failed"); assert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) < cache_ptr->image_len); /* The image_data_len and # of entries should be defined now */ @@ -2400,7 +2401,7 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) * entry in cache_ptr->image_entrise. */ if (NULL == (pf_entry_ptr = H5C__reconstruct_cache_entry(f, cache_ptr, &p))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "reconstruction of cache entry failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "reconstruction of cache entry failed"); /* Note that we make no checks on available cache space before * inserting the reconstructed entry into the metadata cache. @@ -2434,7 +2435,7 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) parent_ptr = NULL; H5C__SEARCH_INDEX(cache_ptr, pf_entry_ptr->fd_parent_addrs[v], parent_ptr, FAIL); if (parent_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "fd parent not in cache?!?") + HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "fd parent not in cache?!?"); /* Sanity checks */ assert(parent_ptr->addr == pf_entry_ptr->fd_parent_addrs[v]); @@ -2448,7 +2449,7 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) /* Setup the flush dependency */ if (H5C_create_flush_dependency(parent_ptr, pf_entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Can't restore flush dependency") + HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Can't restore flush dependency"); /* And now unprotect */ H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, parent_ptr, FAIL); @@ -2528,12 +2529,12 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) hbool_t write_permitted = FALSE; if (cache_ptr->check_write_permitted && (cache_ptr->check_write_permitted)(f, &write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "Can't get write_permitted") + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "Can't get write_permitted"); else write_permitted = cache_ptr->write_permitted; if (H5C__make_space_in_cache(f, 0, write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "H5C__make_space_in_cache failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "H5C__make_space_in_cache failed"); } /* end if */ done: @@ -2581,7 +2582,7 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b /* Allocate space for the prefetched cache entry */ if (NULL == (pf_entry_ptr = H5FL_CALLOC(H5C_cache_entry_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for prefetched cache entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for prefetched cache entry"); /* Get pointer to buffer */ p = *buf; @@ -2634,7 +2635,7 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b if (!file_is_rw) pf_entry_ptr->fd_dirty_child_count = 0; if (pf_entry_ptr->fd_dirty_child_count > pf_entry_ptr->fd_child_count) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid dirty flush dependency child count") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid dirty flush dependency child count"); /* Decode dependency parent count */ UINT16DECODE(p, pf_entry_ptr->fd_parent_count); @@ -2648,16 +2649,16 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b /* Decode entry offset */ H5F_addr_decode(f, &p, &pf_entry_ptr->addr); if (!H5_addr_defined(pf_entry_ptr->addr)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid entry offset") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid entry offset"); /* Decode entry length */ H5F_DECODE_LENGTH(f, p, pf_entry_ptr->size); if (pf_entry_ptr->size == 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid entry size") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid entry size"); /* Verify expected length of entry image */ if ((size_t)(p - *buf) != H5C__cache_image_block_entry_header_size(f)) - HGOTO_ERROR(H5E_CACHE, H5E_BADSIZE, NULL, "Bad entry image len") + HGOTO_ERROR(H5E_CACHE, H5E_BADSIZE, NULL, "Bad entry image len"); /* If parent count greater than zero, allocate array for parent * addresses, and decode addresses into the array. @@ -2667,18 +2668,19 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b if (NULL == (pf_entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_malloc( (size_t)(pf_entry_ptr->fd_parent_count) * H5F_SIZEOF_ADDR(f)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for fd parent addrs buffer") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, + "memory allocation failed for fd parent addrs buffer"); for (u = 0; u < pf_entry_ptr->fd_parent_count; u++) { H5F_addr_decode(f, &p, &(pf_entry_ptr->fd_parent_addrs[u])); if (!H5_addr_defined(pf_entry_ptr->fd_parent_addrs[u])) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid flush dependency parent offset") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid flush dependency parent offset"); } /* end for */ } /* end if */ /* Allocate buffer for entry image */ if (NULL == (pf_entry_ptr->image_ptr = H5MM_malloc(pf_entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer"); #if H5C_DO_MEMORY_SANITY_CHECKS H5MM_memcpy(((uint8_t *)pf_entry_ptr->image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ @@ -2764,7 +2766,7 @@ H5C__write_cache_image_superblock_msg(H5F_t *f, hbool_t create) /* Write metadata cache image message to superblock extension */ if (H5F__super_ext_write_msg(f, H5O_MDCI_MSG_ID, &mdci_msg, create, mesg_flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, - "can't write metadata cache image message to superblock extension") + "can't write metadata cache image message to superblock extension"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2804,7 +2806,7 @@ H5C__write_cache_image(H5F_t *f, const H5C_t *cache_ptr) /* Write the buffer (if serial access, or rank 0 for parallel access) */ if (H5F_block_write(f, H5FD_MEM_SUPER, cache_ptr->image_addr, cache_ptr->image_len, cache_ptr->image_buffer) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't write metadata cache image block to file") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't write metadata cache image block to file"); #ifdef H5_HAVE_PARALLEL } /* end if */ } /* end block */ |