diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2021-08-12 18:26:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-12 18:26:15 (GMT) |
commit | e2c47ffb01b42a3da930e2b175b40810d4bcfbca (patch) | |
tree | 7b6f0410430d29d09342106afae0f886a9b45963 /src/H5EAcache.c | |
parent | c2e61724aa19f84bda9fd730236d80f4af1e4e74 (diff) | |
download | hdf5-e2c47ffb01b42a3da930e2b175b40810d4bcfbca.zip hdf5-e2c47ffb01b42a3da930e2b175b40810d4bcfbca.tar.gz hdf5-e2c47ffb01b42a3da930e2b175b40810d4bcfbca.tar.bz2 |
Merge1 issue 839 PRs to hdf5 1 12 (#904)
* Fixes for a couple of trivial warnings (#676)
* Committing clang-format changes
* Trivial warning fixes:
* Removes an unused done target in H5Tbit.c
* Add (void) to quiet "ignored return value" warnings in the generators
(which generally ignore errors)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Removes alternative function enter/leave macro scheme (#678)
* Committing clang-format changes
* Converted BEGIN_FUNC, etc. macros to FUNC_ENTER
* Rips out the BEGIN_FUNC, etc. macros
* Removes 'end if', etc. comments from H5HL package
* Committing clang-format changes
* Fixes an H5EA iterate issue
* Fixes an issue in the H5FA iterator code
* Further cleanup in bin/trace after macro removal
* Iterator changes in H5EA and H5FA
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Various CMake changes (#679)
* Committing clang-format changes
* Several CMake updates:
* Removes unused HDF5_ENABLE_HSIZET
* Switches TEST_SHELL_SCRIPTS to ON
* Sets SH_PROGRAM to bash instead of sh
* Set default build type back to RelWithDebInfo
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* err_compat test cleanup (#681)
* Committing clang-format changes
* Cleans up err_compat test and output
* Formatted source
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* CMake fix for sporadic flush2 failures (#692)
* Committing clang-format changes
* Runs the flush1/flush2 tests in their own directory
Avoids file deletions by other tests.
* Revert "Runs the flush1/flush2 tests in their own directory"
This reverts commit 746c04882434cb502e4231de8f7dd5acb4949f54.
Also pulls the flush files from the clean list, which is a simpler fix.
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Ubsan fixes (#498)
* Fixed use of null pointer identified by UBSan
UBSan warned:
runtime error: member access within null pointer of type 'named_dt_t' (aka 'struct named_dt_t')
with these two tests:
H5REPACK-committed_dt_DFF
H5REPACK-committed_dt
Reformulated per @gnuoyd suggestion.
* Fixed undefined float -> unsigned char conversion in HL_test_image
* Removed dead skip_overflow_tests_g global
The global `skip_overflow_tests_g` was being set but never read.
* Don't treat 2d array as 1d array, fixing UBSan complaint in `CPP_testhdf5`
* Committing clang-format changes
* Remove extra ']' in line 730.
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
* BUG: DataSet assignment operator is missing (#503)
* BUG: DataSet assignment operator is missing
* Some compilers complain if the copy constructor is given explicitly
but the assignment operator is implicitly set to default.
* Explicitly defining the assignment operator allows us to properly
handle reference counters for shared resources.
* BUG: DataSet assignment operator is missing.
* Mimicking code of H5DataType::operator() as suggested by @bmribler.
* Added test
Description:
Added test for DataSet::operator= that Leengit added
Platform tested:
Linux/64 (jelly)
* Removed Author field.
* Commit clang format changes.
* Entry for Leengit's github PR #503
* Removed lines left by mistake
Co-authored-by: Binh-Minh Ribler <bmribler@hdfgroup.org>
Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
* Hdf5 merge pr7 (#516)
* Modify temporary rpath for testing in java example scripts.
* Update URL in source file Copyright headers for web copy of COPYING (license) file.
* Add release_docs/code-conventions.md file.
* Add script to test h5py.
* Fix script error.
* Add file h5pytest.yml.
* Test declaration of counter variables in for loops.
* Committing clang-format changes
* Committing clang-format changes
* Added [] to line 126 of H5LTanalyze.l.
Ran bin/genparser with flex v2.6.4 and Bison v3.0.4 on jelly.
* Revert "Added [] to line 126 of H5LTanalyze.l."
This reverts commit e4a9cee441efa75b16a8ee030c86189e186dd266.
* Revert extra commits to match canonical develop.
* Add cmake variable HDF5_LIB_INFIX (#7)
* Add cmake variable HDF5_LIB_INFIX
This infix is added to all library names after 'hdf5'.
e.g. the infix '_openmpi' results in the library name 'libhdf5_openmpi.so'
This name is used in packages on debian based systems.
(see https://packages.debian.org/jessie/amd64/libhdf5-openmpi-8/filelist)
This option is useful when testing projects on debian based systems with
custom builds of hdf5 while trying to minimize differences between the
custom setup and the environment created by installing system packages.
* Added RELEASE.txt entry for HDF5_LIB_INFIX.
Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Raphael Grimm <barcode@users.noreply.github.com>
* Fixes a segfault when H5Pset_mdc_log_options is called multiple times on a fapl (#601)
* Committing clang-format changes
* Fixes a segfault when H5Pset_mdc_log_options() is called multiple times
An internal string is incorrectly freed when the API call is invoked
multiple times on a property list, which will usually cause a segfault
to occur. On the first call the log location is NULL so the problem
doesn't occur.
Fixes HDFFV-11239
* Fixes typos
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Fix for a segfault when H5Pset_fapl_log is passed an invalid fapl ID (#607)
* Committing clang-format changes
* Fixes an issue where H5Pset_fapl_log sefaults when passed an invalid
fapl ID
This was due to a pointer-containing struct being memset after the first
internal API call. If the first call failed, the error condition would
check if the pointer was not NULL and then attempt to free it if not.
This would lead to the freeing of a wild pointer if an invalid fapl ID
were passed in.
This was fixed by reordering the memset and adding a test to ensure the
problem stays fixed.
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Fixes crashes when size_hint > UINT32_MAX is passed to H5Gcreate1 (#611)
* Committing clang-format changes
* Fixes incorrect size_hint handling in H5Gcreate1
* Updates the size hint type for group creation
* Updates the RELEASE.txt note
* Revert "Updates the RELEASE.txt note"
This reverts commit 3df386acca806d652bbe2209f7c4503b30f068ff.
* Reverts previous behavior to use a uint32_t struct field
* Updates RELEASE.txt
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Sean McBride <sean@rogue-research.com>
Co-authored-by: Lee Newberg <35611400+Leengit@users.noreply.github.com>
Co-authored-by: Binh-Minh Ribler <bmribler@hdfgroup.org>
Co-authored-by: Raphael Grimm <barcode@users.noreply.github.com>
Diffstat (limited to 'src/H5EAcache.c')
-rw-r--r-- | src/H5EAcache.c | 699 |
1 files changed, 398 insertions, 301 deletions
diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 2a3153c..eeac1a2 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -221,12 +221,13 @@ const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1] = {{ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len) +{ H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata; /* User data for callback */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(udata); HDassert(udata->f); @@ -235,7 +236,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = (size_t)H5EA_HEADER_SIZE_FILE(udata->f); -END_FUNC(STATIC) /* end H5EA__cache_hdr_get_initial_load_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_hdr_get_initial_load_size() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_hdr_verify_chksum @@ -250,13 +252,15 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_get_initial_load_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, - H5EA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) - - /* Local variables */ +static htri_t +H5EA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata) +{ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + htri_t ret_value = TRUE; + + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(image); @@ -267,7 +271,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, if (stored_chksum != computed_chksum) ret_value = FALSE; -END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */ + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5EA__cache_hdr_verify_chksum() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_hdr_deserialize @@ -282,16 +287,17 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, - H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty)) - - /* Local variables */ +static void * +H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) +{ H5EA_cls_id_t id; /* ID of extensible array class, as found in file */ H5EA_hdr_t * hdr = NULL; /* Extensible array info */ H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata; const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ + void * ret_value = NULL; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(image); @@ -301,24 +307,25 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Allocate space for the extensible array data structure */ if (NULL == (hdr = H5EA__hdr_alloc(udata->f))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for extensible array shared header") /* Set the extensible array header's address */ hdr->addr = udata->addr; /* Magic number */ if (HDmemcmp(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - H5E_THROW(H5E_BADVALUE, "wrong extensible array header signature") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header signature") image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5EA_HDR_VERSION) - H5E_THROW(H5E_VERSION, "wrong extensible array header version") + HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array header version") /* Extensible array class */ id = (H5EA_cls_id_t)*image++; if (id >= H5EA_NUM_CLS_ID) - H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") + HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class") hdr->cparam.cls = H5EA_client_class_g[id]; /* General array creation/configuration information */ @@ -379,20 +386,20 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Finish initializing extensible array header */ if (H5EA__hdr_init(hdr, udata->ctx_udata) < 0) - H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, "initialization failed for extensible array header") HDassert(hdr->size == len); /* Set return value */ ret_value = hdr; - CATCH - +done: /* Release resources */ if (!ret_value) if (hdr && H5EA__hdr_dest(hdr) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array header") -END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_hdr_deserialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_hdr_image_len @@ -406,12 +413,13 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_hdr_image_len(const void *_thing, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_hdr_image_len(const void *_thing, size_t *image_len) +{ const H5EA_hdr_t *hdr = (const H5EA_hdr_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(hdr); HDassert(image_len); @@ -419,7 +427,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = hdr->size; -END_FUNC(STATIC) /* end H5EA__cache_hdr_image_len() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_hdr_image_len() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_hdr_serialize @@ -433,14 +442,15 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_image_len() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)) - - /* Local variables */ +static herr_t +H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing) +{ H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the extensible array header */ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t metadata_chksum; /* Computed metadata checksum value */ + FUNC_ENTER_STATIC_NOERR + /* check arguments */ HDassert(f); HDassert(image); @@ -488,7 +498,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) == len); -END_FUNC(STATIC) /* end H5EA__cache_hdr_serialize() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_hdr_serialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_hdr_notify @@ -502,11 +513,13 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_serialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing)) +static herr_t +H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) +{ + H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the object */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC /* Sanity check */ HDassert(hdr); @@ -538,23 +551,24 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Destroy flush dependency on object header proxy */ if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent, (void *)hdr->top_proxy) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between extensible array and proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between extensible array and proxy") hdr->parent = NULL; } /* end if */ /* Detach from 'top' proxy for extensible array */ if (hdr->top_proxy) { if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between header and " - "extensible array 'top' proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between header and " + "extensible array 'top' proxy") /* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */ } /* end if */ break; default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") #else /* NDEBUG */ HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ @@ -563,9 +577,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, else HDassert(NULL == hdr->parent); - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_hdr_notify() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_hdr_notify() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_hdr_free_icr @@ -580,18 +594,23 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_notify() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_hdr_free_icr(void *thing)) +static herr_t +H5EA__cache_hdr_free_icr(void *thing) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(thing); /* Release the extensible array header */ if (H5EA__hdr_dest((H5EA_hdr_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array header") - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_hdr_free_icr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_hdr_free_icr() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_iblock_get_initial_load_size @@ -605,13 +624,14 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_free_icr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len) +{ H5EA_hdr_t * hdr = (H5EA_hdr_t *)_udata; /* User data for callback */ H5EA_iblock_t iblock; /* Fake index block for computing size */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(hdr); HDassert(image_len); @@ -626,7 +646,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = (size_t)H5EA_IBLOCK_SIZE(&iblock); -END_FUNC(STATIC) /* end H5EA__cache_iblock_get_initial_load_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_iblock_get_initial_load_size() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_iblock_verify_chksum @@ -641,13 +662,15 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_get_initial_load_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, - H5EA__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) - - /* Local variables */ +static htri_t +H5EA__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata) +{ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + htri_t ret_value = TRUE; + + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(image); @@ -658,7 +681,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, if (stored_chksum != computed_chksum) ret_value = FALSE; -END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_iblock_verify_chksum() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_iblock_deserialize @@ -673,17 +697,18 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, - H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty)) - - /* Local variables */ +static void * +H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) +{ H5EA_iblock_t *iblock = NULL; /* Index block info */ H5EA_hdr_t * hdr = (H5EA_hdr_t *)_udata; /* User data for callback */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ haddr_t arr_addr; /* Address of array header in the file */ size_t u; /* Local index variable */ + void * ret_value = NULL; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(image); @@ -691,28 +716,29 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Allocate the extensible array index block */ if (NULL == (iblock = H5EA__iblock_alloc(hdr))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for extensible array index block") /* Set the extensible array index block's address */ iblock->addr = hdr->idx_blk_addr; /* Magic number */ if (HDmemcmp(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - H5E_THROW(H5E_BADVALUE, "wrong extensible array index block signature") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array index block signature") image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5EA_IBLOCK_VERSION) - H5E_THROW(H5E_VERSION, "wrong extensible array index block version") + HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array index block version") /* Extensible array type */ if (*image++ != (uint8_t)hdr->cparam.cls->id) - H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") + HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class") /* Address of header for array that owns this block (just for file integrity checks) */ H5F_addr_decode(hdr->f, &image, &arr_addr); if (H5F_addr_ne(arr_addr, hdr->addr)) - H5E_THROW(H5E_BADVALUE, "wrong extensible array header address") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address") /* Internal information */ @@ -721,7 +747,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Convert from raw elements on disk into native elements in memory */ if ((hdr->cparam.cls->decode)(image, iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts, hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTDECODE, "can't decode extensible array index elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array index elements") image += (hdr->cparam.idx_blk_elmts * hdr->cparam.raw_elmt_size); } /* end if */ @@ -757,14 +783,14 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Set return value */ ret_value = iblock; - CATCH - +done: /* Release resources */ if (!ret_value) if (iblock && H5EA__iblock_dest(iblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array index block") -END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_iblock_deserialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_iblock_image_len @@ -778,12 +804,13 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_iblock_image_len(const void *_thing, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_iblock_image_len(const void *_thing, size_t *image_len) +{ const H5EA_iblock_t *iblock = (const H5EA_iblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(iblock); HDassert(image_len); @@ -791,7 +818,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = iblock->size; -END_FUNC(STATIC) /* end H5EA__cache_iblock_image_len() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_iblock_image_len() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_iblock_serialize @@ -805,14 +833,15 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_image_len() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, - void *_thing)) - - /* Local variables */ +static herr_t +H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing) +{ H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object to serialize */ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t metadata_chksum; /* Computed metadata checksum value */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* check arguments */ HDassert(f); @@ -843,7 +872,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Convert from native elements in memory into raw elements on disk */ if ((iblock->hdr->cparam.cls->encode)(image, iblock->elmts, (size_t)iblock->hdr->cparam.idx_blk_elmts, iblock->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTENCODE, "can't encode extensible array index elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array index elements") image += (iblock->hdr->cparam.idx_blk_elmts * iblock->hdr->cparam.raw_elmt_size); } /* end if */ @@ -874,9 +903,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) == len); - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_iblock_serialize() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_iblock_serialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_iblock_notify @@ -890,11 +919,13 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_serialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing)) +static herr_t +H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) +{ + H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC /* Sanity check */ HDassert(iblock); @@ -905,9 +936,10 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_AFTER_LOAD: /* Create flush dependency on extensible array header */ if (H5EA__create_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0) - H5E_THROW(H5E_CANTDEPEND, - "unable to create flush dependency between index block and header, address = %llu", - (unsigned long long)iblock->addr) + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTDEPEND, FAIL, + "unable to create flush dependency between index block and header, address = %llu", + (unsigned long long)iblock->addr) break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: @@ -923,30 +955,32 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on extensible array header */ if (H5EA__destroy_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between index block and header, address = %llu", - (unsigned long long)iblock->addr) + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between index block and header, address = %llu", + (unsigned long long)iblock->addr) /* Detach from 'top' proxy for extensible array */ if (iblock->top_proxy) { if (H5AC_proxy_entry_remove_child(iblock->top_proxy, iblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between index block and " - "extensible array 'top' proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between index block and " + "extensible array 'top' proxy") iblock->top_proxy = NULL; } /* end if */ break; default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") #else /* NDEBUG */ HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_iblock_notify() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_iblock_free_icr @@ -961,18 +995,23 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_iblock_free_icr(void *thing)) +static herr_t +H5EA__cache_iblock_free_icr(void *thing) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(thing); /* Release the extensible array index block */ if (H5EA__iblock_dest((H5EA_iblock_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free extensible array index block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array index block") - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_iblock_free_icr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_iblock_free_icr() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_sblock_get_initial_load_size @@ -986,13 +1025,14 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_free_icr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_sblock_get_initial_load_size(void *_udata, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_sblock_get_initial_load_size(void *_udata, size_t *image_len) +{ H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */ H5EA_sblock_t sblock; /* Fake super block for computing size */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(udata); HDassert(udata->hdr); @@ -1026,7 +1066,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = (size_t)H5EA_SBLOCK_SIZE(&sblock); -END_FUNC(STATIC) /* end H5EA__cache_sblock_get_initial_load_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_sblock_get_initial_load_size() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_sblock_verify_chksum @@ -1041,13 +1082,15 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_get_initial_load_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, - H5EA__cache_sblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) - - /* Local variables */ +static htri_t +H5EA__cache_sblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata) +{ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + htri_t ret_value = TRUE; + + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(image); @@ -1058,7 +1101,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, if (stored_chksum != computed_chksum) ret_value = FALSE; -END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_sblock_verify_chksum() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_sblock_deserialize @@ -1073,17 +1117,18 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, - H5EA__cache_sblock_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty)) - - /* Local variables */ +static void * +H5EA__cache_sblock_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) +{ H5EA_sblock_t * sblock = NULL; /* Super block info */ H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */ const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ haddr_t arr_addr; /* Address of array header in the file */ size_t u; /* Local index variable */ + void * ret_value = NULL; + + FUNC_ENTER_STATIC /* Sanity check */ HDassert(udata); @@ -1094,28 +1139,29 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Allocate the extensible array super block */ if (NULL == (sblock = H5EA__sblock_alloc(udata->hdr, udata->parent, udata->sblk_idx))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for extensible array super block") /* Set the extensible array super block's address */ sblock->addr = udata->sblk_addr; /* Magic number */ if (HDmemcmp(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - H5E_THROW(H5E_BADVALUE, "wrong extensible array super block signature") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array super block signature") image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5EA_SBLOCK_VERSION) - H5E_THROW(H5E_VERSION, "wrong extensible array super block version") + HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array super block version") /* Extensible array type */ if (*image++ != (uint8_t)udata->hdr->cparam.cls->id) - H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") + HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class") /* Address of header for array that owns this block (just for file integrity checks) */ H5F_addr_decode(udata->hdr->f, &image, &arr_addr); if (H5F_addr_ne(arr_addr, udata->hdr->addr)) - H5E_THROW(H5E_BADVALUE, "wrong extensible array header address") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address") /* Offset of block within the array's address space */ UINT64DECODE_VAR(image, sblock->block_off, udata->hdr->arr_off_size); @@ -1154,14 +1200,14 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Set return value */ ret_value = sblock; - CATCH - +done: /* Release resources */ if (!ret_value) if (sblock && H5EA__sblock_dest(sblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array super block") -END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_sblock_deserialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_sblock_image_len @@ -1175,12 +1221,13 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_sblock_image_len(const void *_thing, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_sblock_image_len(const void *_thing, size_t *image_len) +{ const H5EA_sblock_t *sblock = (const H5EA_sblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(sblock); HDassert(image_len); @@ -1188,7 +1235,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = sblock->size; -END_FUNC(STATIC) /* end H5EA__cache_sblock_image_len() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_sblock_image_len() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_sblock_serialize @@ -1202,16 +1250,16 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_image_len() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, - void *_thing)) - - /* Local variables */ +static herr_t +H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing) +{ H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object to serialize */ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t metadata_chksum; /* Computed metadata checksum value */ size_t u; /* Local index variable */ + FUNC_ENTER_STATIC_NOERR + /* check arguments */ HDassert(f); HDassert(image); @@ -1260,7 +1308,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) == len); -END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_sblock_serialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_sblock_notify @@ -1274,11 +1323,13 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing)) +static herr_t +H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing) +{ + H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC /* Sanity check */ HDassert(sblock); @@ -1289,8 +1340,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_AFTER_LOAD: /* Create flush dependency on index block */ if (H5EA__create_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0) - H5E_THROW( - H5E_CANTDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between super block and index block, address = %llu", (unsigned long long)sblock->addr) break; @@ -1299,8 +1350,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Destroy flush dependency on extensible array header, if set */ if (sblock->has_hdr_depend) { if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between super block and header, address = %llu", (unsigned long long)sblock->addr) sblock->has_hdr_depend = FALSE; @@ -1310,16 +1361,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on index block */ if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between super block and index block, address = %llu", (unsigned long long)sblock->addr) /* Destroy flush dependency on extensible array header, if set */ if (sblock->has_hdr_depend) { if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between super block and header, address = %llu", (unsigned long long)sblock->addr) sblock->has_hdr_depend = FALSE; @@ -1328,8 +1379,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Detach from 'top' proxy for extensible array */ if (sblock->top_proxy) { if (H5AC_proxy_entry_remove_child(sblock->top_proxy, sblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and " - "extensible array 'top' proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between super block and " + "extensible array 'top' proxy") sblock->top_proxy = NULL; } /* end if */ break; @@ -1345,15 +1397,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") #else /* NDEBUG */ HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_sblock_notify() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_sblock_free_icr @@ -1368,18 +1420,23 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_sblock_free_icr(void *thing)) +static herr_t +H5EA__cache_sblock_free_icr(void *thing) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(thing); /* Release the extensible array super block */ if (H5EA__sblock_dest((H5EA_sblock_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free extensible array super block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array super block") - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_sblock_free_icr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_sblock_free_icr() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_get_initial_load_size @@ -1393,13 +1450,14 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_free_icr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len) +{ H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */ H5EA_dblock_t dblock; /* Fake data block for computing size */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(udata); HDassert(udata->hdr); @@ -1434,7 +1492,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, else *image_len = H5EA_DBLOCK_PREFIX_SIZE(&dblock); -END_FUNC(STATIC) /* end H5EA__cache_dblock_get_initial_load_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_dblock_get_initial_load_size() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_verify_chksum @@ -1449,13 +1508,15 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_get_initial_load_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, - H5EA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) - - /* Local variables */ +static htri_t +H5EA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata) +{ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + htri_t ret_value = TRUE; + + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(image); @@ -1466,7 +1527,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, if (stored_chksum != computed_chksum) ret_value = FALSE; -END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_sblock_verify_chksum() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_deserialize @@ -1481,16 +1543,18 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, - H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty)) - - /* Local variables */ +static void * +H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, + hbool_t H5_ATTR_UNUSED *dirty) +{ H5EA_dblock_t * dblock = NULL; /* Data block info */ H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */ const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ haddr_t arr_addr; /* Address of array header in the file */ + void * ret_value = NULL; + + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(udata); @@ -1501,7 +1565,8 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Allocate the extensible array data block */ if (NULL == (dblock = H5EA__dblock_alloc(udata->hdr, udata->parent, udata->nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for extensible array data block") HDassert(((!dblock->npages) && (len == H5EA_DBLOCK_SIZE(dblock))) || (len == H5EA_DBLOCK_PREFIX_SIZE(dblock))); @@ -1511,21 +1576,21 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Magic number */ if (HDmemcmp(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - H5E_THROW(H5E_BADVALUE, "wrong extensible array data block signature") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array data block signature") image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5EA_DBLOCK_VERSION) - H5E_THROW(H5E_VERSION, "wrong extensible array data block version") + HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array data block version") /* Extensible array type */ if (*image++ != (uint8_t)udata->hdr->cparam.cls->id) - H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") + HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class") /* Address of header for array that owns this block (just for file integrity checks) */ H5F_addr_decode(udata->hdr->f, &image, &arr_addr); if (H5F_addr_ne(arr_addr, udata->hdr->addr)) - H5E_THROW(H5E_BADVALUE, "wrong extensible array header address") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address") /* Offset of block within the array's address space */ UINT64DECODE_VAR(image, dblock->block_off, udata->hdr->arr_off_size); @@ -1537,7 +1602,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Decode elements in data block */ /* Convert from raw elements on disk into native elements in memory */ if ((udata->hdr->cparam.cls->decode)(image, dblock->elmts, udata->nelmts, udata->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array data elements") image += (udata->nelmts * udata->hdr->cparam.raw_elmt_size); } /* end if */ @@ -1560,14 +1625,15 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Set return value */ ret_value = dblock; - CATCH +done: /* Release resources */ if (!ret_value) if (dblock && H5EA__dblock_dest(dblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block") -END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */ + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5EA__cache_dblock_deserialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_image_len @@ -1581,12 +1647,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_dblock_image_len(const void *_thing, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_dblock_image_len(const void *_thing, size_t *image_len) +{ const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(dblock); HDassert(image_len); @@ -1597,7 +1664,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, else *image_len = (size_t)H5EA_DBLOCK_PREFIX_SIZE(dblock); -END_FUNC(STATIC) /* end H5EA__cache_dblock_image_len() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_dblock_image_len() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_serialize @@ -1611,14 +1679,15 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_image_len() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, - void *_thing)) - - /* Local variables */ +static herr_t +H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing) +{ H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object to serialize */ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t metadata_chksum; /* Computed metadata checksum value */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* check arguments */ HDassert(f); @@ -1651,7 +1720,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Convert from native elements in memory into raw elements on disk */ if ((dblock->hdr->cparam.cls->encode)(image, dblock->elmts, dblock->nelmts, dblock->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array data elements") image += (dblock->nelmts * dblock->hdr->cparam.raw_elmt_size); } /* end if */ @@ -1664,9 +1733,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) == len); - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_dblock_serialize() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblock_serialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_notify @@ -1680,11 +1749,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_serialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing)) +static herr_t +H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) +{ + H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC /* Check arguments */ HDassert(dblock); @@ -1695,17 +1766,17 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_AFTER_LOAD: /* Create flush dependency on parent */ if (H5EA__create_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) - H5E_THROW(H5E_CANTDEPEND, - "unable to create flush dependency between data block and parent, address = %llu", - (unsigned long long)dblock->addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEPEND, FAIL, + "unable to create flush dependency between data block and parent, address = %llu", + (unsigned long long)dblock->addr) break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: /* Destroy flush dependency on extensible array header, if set */ if (dblock->has_hdr_depend) { if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between direct block and header, address = %llu", (unsigned long long)dblock->addr) dblock->has_hdr_depend = FALSE; @@ -1715,15 +1786,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on parent */ if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block and parent, address = %llu", - (unsigned long long)dblock->addr) + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between data block and parent, address = %llu", + (unsigned long long)dblock->addr) /* Destroy flush dependency on extensible array header, if set */ if (dblock->has_hdr_depend) { if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between data block and header, address = %llu", (unsigned long long)dblock->addr) dblock->has_hdr_depend = FALSE; @@ -1732,8 +1804,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Detach from 'top' proxy for extensible array */ if (dblock->top_proxy) { if (H5AC_proxy_entry_remove_child(dblock->top_proxy, dblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block and " - "extensible array 'top' proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between data block and " + "extensible array 'top' proxy") dblock->top_proxy = NULL; } /* end if */ break; @@ -1749,15 +1822,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") #else /* NDEBUG */ HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblock_notify() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_free_icr @@ -1772,18 +1845,23 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblock_free_icr(void *thing)) +static herr_t +H5EA__cache_dblock_free_icr(void *thing) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(thing); /* Release the extensible array data block */ if (H5EA__dblock_dest((H5EA_dblock_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free extensible array data block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array data block") - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_dblock_free_icr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblock_free_icr() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_fsf_size @@ -1814,12 +1892,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_free_icr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size)) - - /* Local variables */ +static herr_t +H5EA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size) +{ const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(dblock); HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); @@ -1828,7 +1907,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, *fsf_size = dblock->size; -END_FUNC(STATIC) /* end H5EA__cache_dblock_fsf_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_dblock_fsf_size() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblk_page_get_initial_load_size @@ -1842,12 +1922,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_fsf_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len) +{ H5EA_dblk_page_cache_ud_t *udata = (H5EA_dblk_page_cache_ud_t *)_udata; /* User data */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(udata); HDassert(udata->hdr); @@ -1856,7 +1937,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = (size_t)H5EA_DBLK_PAGE_SIZE(udata->hdr); -END_FUNC(STATIC) /* end H5EA__cache_dblk_page_get_initial_load_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_dblk_page_get_initial_load_size() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblk_page_verify_chksum @@ -1871,13 +1953,15 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_get_initial_load_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, - H5EA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) - - /* Local variables */ +static htri_t +H5EA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata) +{ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + htri_t ret_value = TRUE; + + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(image); @@ -1888,7 +1972,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, if (stored_chksum != computed_chksum) ret_value = FALSE; -END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblk_page_verify_chksum() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblk_page_deserialize @@ -1903,16 +1988,17 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, - H5EA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty)) - - /* Local variables */ +static void * +H5EA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) +{ H5EA_dblk_page_t * dblk_page = NULL; /* Data block page info */ H5EA_dblk_page_cache_ud_t *udata = (H5EA_dblk_page_cache_ud_t *)_udata; /* User data for loading data block page */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ + void * ret_value = NULL; + + FUNC_ENTER_STATIC /* Sanity check */ HDassert(udata); @@ -1922,7 +2008,8 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Allocate the extensible array data block page */ if (NULL == (dblk_page = H5EA__dblk_page_alloc(udata->hdr, udata->parent))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for extensible array data block page") /* Set the extensible array data block page's information */ dblk_page->addr = udata->dblk_page_addr; @@ -1933,7 +2020,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Convert from raw elements on disk into native elements in memory */ if ((udata->hdr->cparam.cls->decode)(image, dblk_page->elmts, udata->hdr->dblk_page_nelmts, udata->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array data elements") image += (udata->hdr->dblk_page_nelmts * udata->hdr->cparam.raw_elmt_size); /* Sanity check */ @@ -1954,14 +2041,13 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Set return value */ ret_value = dblk_page; - CATCH - +done: /* Release resources */ if (!ret_value) if (dblk_page && H5EA__dblk_page_dest(dblk_page) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page") - -END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */ + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block page") + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblk_page_deserialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblk_page_image_len @@ -1975,12 +2061,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_dblk_page_image_len(const void *_thing, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_dblk_page_image_len(const void *_thing, size_t *image_len) +{ const H5EA_dblk_page_t *dblk_page = (const H5EA_dblk_page_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(dblk_page); HDassert(image_len); @@ -1988,7 +2075,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = dblk_page->size; -END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_dblk_page_image_len() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblk_page_serialize @@ -2002,14 +2090,16 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, - size_t H5_ATTR_UNUSED len, void *_thing)) - - /* Local variables */ +static herr_t +H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len, + void *_thing) +{ H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object to serialize */ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t metadata_chksum; /* Computed metadata checksum value */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(f); @@ -2024,7 +2114,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Convert from native elements in memory into raw elements on disk */ if ((dblk_page->hdr->cparam.cls->encode)(image, dblk_page->elmts, dblk_page->hdr->dblk_page_nelmts, dblk_page->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array data elements") image += (dblk_page->hdr->dblk_page_nelmts * dblk_page->hdr->cparam.raw_elmt_size); /* Compute metadata checksum */ @@ -2036,9 +2126,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) == len); - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_dblk_page_serialize() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblk_page_serialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblk_page_notify @@ -2052,11 +2142,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_serialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing)) - - /* Local variables */ +static herr_t +H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing) +{ H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Sanity check */ HDassert(dblk_page); @@ -2067,8 +2159,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_AFTER_LOAD: /* Create flush dependency on parent */ if (H5EA__create_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0) - H5E_THROW( - H5E_CANTDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr) break; @@ -2077,10 +2169,10 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Destroy flush dependency on extensible array header, if set */ if (dblk_page->has_hdr_depend) { if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block page and header, " - "address = %llu", - (unsigned long long)dblk_page->addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between data block page and header, " + "address = %llu", + (unsigned long long)dblk_page->addr) dblk_page->has_hdr_depend = FALSE; } /* end if */ break; @@ -2088,27 +2180,27 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on parent */ if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr) /* Destroy flush dependency on extensible array header, if set */ if (dblk_page->has_hdr_depend) { if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block page and header, " - "address = %llu", - (unsigned long long)dblk_page->addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between data block page and header, " + "address = %llu", + (unsigned long long)dblk_page->addr) dblk_page->has_hdr_depend = FALSE; } /* end if */ /* Detach from 'top' proxy for extensible array */ if (dblk_page->top_proxy) { if (H5AC_proxy_entry_remove_child(dblk_page->top_proxy, dblk_page) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block page and " - "extensible array 'top' proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between data block page and " + "extensible array 'top' proxy") dblk_page->top_proxy = NULL; } /* end if */ break; @@ -2124,15 +2216,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") #else /* NDEBUG */ HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblk_page_notify() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblk_page_free_icr @@ -2147,15 +2239,20 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblk_page_free_icr(void *thing)) +static herr_t +H5EA__cache_dblk_page_free_icr(void *thing) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(thing); /* Release the extensible array data block page */ if (H5EA__dblk_page_dest((H5EA_dblk_page_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free extensible array data block page") - - CATCH + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array data block page") -END_FUNC(STATIC) /* end H5EA__cache_dblk_page_free_icr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblk_page_free_icr() */ |