diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
commit | b2d661b508a7fc7a2592c13bc6bdc175551f075d (patch) | |
tree | 13baeb0d83a7c2a4c6299993c182b1227c2f6114 /src/H5Cprefetched.c | |
parent | 29ab58b58dce556639ea3154e262895773a8a8df (diff) | |
download | hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2 |
Clang-format of source files
Diffstat (limited to 'src/H5Cprefetched.c')
-rw-r--r-- | src/H5Cprefetched.c | 141 |
1 files changed, 57 insertions, 84 deletions
diff --git a/src/H5Cprefetched.c b/src/H5Cprefetched.c index 954dd60..53002b0 100644 --- a/src/H5Cprefetched.c +++ b/src/H5Cprefetched.c @@ -22,26 +22,22 @@ *------------------------------------------------------------------------- */ - /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5MMprivate.h" /* Memory management */ - +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MMprivate.h" /* Memory management */ /****************/ /* Local Macros */ /****************/ - /******************/ /* Local Typedefs */ /******************/ - /********************/ /* Local Prototypes */ /********************/ @@ -51,27 +47,20 @@ * Declarations for prefetched cache entry callbacks. * ****************************************************************************/ -static herr_t H5C__prefetched_entry_get_initial_load_size(void *udata_ptr, - size_t *image_len_ptr); -static herr_t H5C__prefetched_entry_get_final_load_size(const void *image_ptr, - size_t image_len, void *udata_ptr, size_t *actual_len_ptr); -static htri_t H5C__prefetched_entry_verify_chksum(const void *image_ptr, - size_t len, void *udata_ptr); -static void * H5C__prefetched_entry_deserialize(const void *image_ptr, - size_t len, void *udata, hbool_t *dirty_ptr); -static herr_t H5C__prefetched_entry_image_len(const void *thing, - size_t *image_len_ptr); -static herr_t H5C__prefetched_entry_pre_serialize(H5F_t *f, void *thing, - haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - unsigned *flags_ptr); -static herr_t H5C__prefetched_entry_serialize(const H5F_t *f, void *image_ptr, - size_t len, void *thing); -static herr_t H5C__prefetched_entry_notify(H5C_notify_action_t action, - void *thing); +static herr_t H5C__prefetched_entry_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr); +static herr_t H5C__prefetched_entry_get_final_load_size(const void *image_ptr, size_t image_len, + void *udata_ptr, size_t *actual_len_ptr); +static htri_t H5C__prefetched_entry_verify_chksum(const void *image_ptr, size_t len, void *udata_ptr); +static void * H5C__prefetched_entry_deserialize(const void *image_ptr, size_t len, void *udata, + hbool_t *dirty_ptr); +static herr_t H5C__prefetched_entry_image_len(const void *thing, size_t *image_len_ptr); +static herr_t H5C__prefetched_entry_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, + haddr_t *new_addr_ptr, size_t *new_len_ptr, + unsigned *flags_ptr); +static herr_t H5C__prefetched_entry_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing); +static herr_t H5C__prefetched_entry_notify(H5C_notify_action_t action, void *thing); static herr_t H5C__prefetched_entry_free_icr(void *thing); -static herr_t H5C__prefetched_entry_fsf_size(const void *thing, - hsize_t *fsf_size_ptr); - +static herr_t H5C__prefetched_entry_fsf_size(const void *thing, hsize_t *fsf_size_ptr); /*********************/ /* Package Variables */ @@ -80,17 +69,14 @@ static herr_t H5C__prefetched_entry_fsf_size(const void *thing, /* Declare external the free list for H5C_cache_entry_t's */ H5FL_EXTERN(H5C_cache_entry_t); - /*****************************/ /* Library Private Variables */ /*****************************/ - /*******************/ /* Local Variables */ /*******************/ - const H5AC_class_t H5AC_PREFETCHED_ENTRY[1] = {{ /* id = */ H5AC_PREFETCHED_ENTRY_ID, /* name = */ "prefetched entry", @@ -108,8 +94,6 @@ const H5AC_class_t H5AC_PREFETCHED_ENTRY[1] = {{ /* fsf_size = */ H5C__prefetched_entry_fsf_size, }}; - - /*************************************************************************** * With two exceptions, these functions should never be called, and thus * there is little point in documenting them separately as they all simply @@ -123,91 +107,83 @@ const H5AC_class_t H5AC_PREFETCHED_ENTRY[1] = {{ static herr_t H5C__prefetched_entry_get_initial_load_size(void H5_ATTR_UNUSED *udata_ptr, - size_t H5_ATTR_UNUSED *image_len_ptr) + size_t H5_ATTR_UNUSED *image_len_ptr) { FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */ - HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); + HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); FUNC_LEAVE_NOAPI(FAIL) } /* end H5C__prefetched_entry_get_initial_load_size() */ static herr_t H5C__prefetched_entry_get_final_load_size(const void H5_ATTR_UNUSED *image_ptr, - size_t H5_ATTR_UNUSED image_len, void H5_ATTR_UNUSED *udata_ptr, - size_t H5_ATTR_UNUSED *actual_len_ptr) + size_t H5_ATTR_UNUSED image_len, void H5_ATTR_UNUSED *udata_ptr, + size_t H5_ATTR_UNUSED *actual_len_ptr) { FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */ - HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); + HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); FUNC_LEAVE_NOAPI(FAIL) } /* end H5C__prefetched_entry_get_final_load_size() */ static htri_t -H5C__prefetched_entry_verify_chksum(const void H5_ATTR_UNUSED *image_ptr, - size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED *udata_ptr) +H5C__prefetched_entry_verify_chksum(const void H5_ATTR_UNUSED *image_ptr, size_t H5_ATTR_UNUSED len, + void H5_ATTR_UNUSED *udata_ptr) { FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */ - HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); + HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); FUNC_LEAVE_NOAPI(FAIL) } /* end H5C__prefetched_verify_chksum() */ - static void * -H5C__prefetched_entry_deserialize(const void H5_ATTR_UNUSED * image_ptr, - size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED * udata, - hbool_t H5_ATTR_UNUSED * dirty_ptr) +H5C__prefetched_entry_deserialize(const void H5_ATTR_UNUSED *image_ptr, size_t H5_ATTR_UNUSED len, + void H5_ATTR_UNUSED *udata, hbool_t H5_ATTR_UNUSED *dirty_ptr) { FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */ - HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); + HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); FUNC_LEAVE_NOAPI(NULL) } /* end H5C__prefetched_entry_deserialize() */ - static herr_t -H5C__prefetched_entry_image_len(const void H5_ATTR_UNUSED *thing, - size_t H5_ATTR_UNUSED *image_len_ptr) +H5C__prefetched_entry_image_len(const void H5_ATTR_UNUSED *thing, size_t H5_ATTR_UNUSED *image_len_ptr) { FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */ - HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); + HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); FUNC_LEAVE_NOAPI(FAIL) } /* end H5C__prefetched_entry_image_len() */ - static herr_t H5C__prefetched_entry_pre_serialize(H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *thing, - haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED len, - haddr_t H5_ATTR_UNUSED *new_addr_ptr, size_t H5_ATTR_UNUSED *new_len_ptr, - unsigned H5_ATTR_UNUSED *flags_ptr) + haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED len, + haddr_t H5_ATTR_UNUSED *new_addr_ptr, size_t H5_ATTR_UNUSED *new_len_ptr, + unsigned H5_ATTR_UNUSED *flags_ptr) { FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */ - HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); + HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); FUNC_LEAVE_NOAPI(FAIL) } /* end H5C__prefetched_entry_pre_serialize() */ - static herr_t -H5C__prefetched_entry_serialize(const H5F_t H5_ATTR_UNUSED *f, - void H5_ATTR_UNUSED *image_ptr, - size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED *thing) +H5C__prefetched_entry_serialize(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *image_ptr, + size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED *thing) { FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */ - HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); + HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); FUNC_LEAVE_NOAPI(FAIL) } /* end H5C__prefetched_entry_serialize() */ - /*------------------------------------------------------------------------- * Function: H5C__prefetched_entry_notify * @@ -228,9 +204,9 @@ H5C__prefetched_entry_serialize(const H5F_t H5_ATTR_UNUSED *f, static herr_t H5C__prefetched_entry_notify(H5C_notify_action_t action, void *_thing) { - H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)_thing; - unsigned u; - herr_t ret_value = SUCCEED; + H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)_thing; + unsigned u; + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -239,7 +215,7 @@ H5C__prefetched_entry_notify(H5C_notify_action_t action, void *_thing) HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(entry_ptr->prefetched); - switch(action) { + switch (action) { case H5C_NOTIFY_ACTION_AFTER_INSERT: case H5C_NOTIFY_ACTION_AFTER_LOAD: case H5C_NOTIFY_ACTION_AFTER_FLUSH: @@ -253,8 +229,8 @@ H5C__prefetched_entry_notify(H5C_notify_action_t action, void *_thing) break; case H5C_NOTIFY_ACTION_BEFORE_EVICT: - for(u = 0; u < entry_ptr->flush_dep_nparents; u++) { - H5C_cache_entry_t * parent_ptr; + for (u = 0; u < entry_ptr->flush_dep_nparents; u++) { + H5C_cache_entry_t *parent_ptr; /* Sanity checks */ HDassert(entry_ptr->flush_dep_parent); @@ -264,10 +240,11 @@ H5C__prefetched_entry_notify(H5C_notify_action_t action, void *_thing) HDassert(parent_ptr->flush_dep_nchildren > 0); /* Destroy flush dependency with flush dependency parent */ - if(H5C_destroy_flush_dependency(parent_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "unable to destroy prefetched entry flush dependency") + if (H5C_destroy_flush_dependency(parent_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, + "unable to destroy prefetched entry flush dependency") - if(parent_ptr->prefetched) { + if (parent_ptr->prefetched) { /* In prefetched entries, the fd_child_count field is * used in sanity checks elsewhere. Thus update this * field to reflect the destruction of the flush @@ -276,7 +253,7 @@ H5C__prefetched_entry_notify(H5C_notify_action_t action, void *_thing) HDassert(parent_ptr->fd_child_count > 0); (parent_ptr->fd_child_count)--; } /* end if */ - } /* end for */ + } /* end for */ break; default: @@ -288,7 +265,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5C__prefetched_entry_notify() */ - /*------------------------------------------------------------------------- * Function: H5C__prefetched_entry_free_icr * @@ -308,7 +284,7 @@ static herr_t H5C__prefetched_entry_free_icr(void *_thing) { H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)_thing; - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -318,15 +294,15 @@ H5C__prefetched_entry_free_icr(void *_thing) HDassert(entry_ptr->prefetched); /* Release array for flush dependency parent addresses */ - if(entry_ptr->fd_parent_addrs != NULL) { - HDassert(entry_ptr->fd_parent_count > 0); - entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_xfree((void *)entry_ptr->fd_parent_addrs); + if (entry_ptr->fd_parent_addrs != NULL) { + HDassert(entry_ptr->fd_parent_count > 0); + entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_xfree((void *)entry_ptr->fd_parent_addrs); } /* end if */ else - HDassert(entry_ptr->fd_parent_count == 0); + HDassert(entry_ptr->fd_parent_count == 0); - if(entry_ptr->image_ptr != NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "prefetched entry image buffer still attatched?") + if (entry_ptr->image_ptr != NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "prefetched entry image buffer still attatched?") entry_ptr = H5FL_FREE(H5C_cache_entry_t, entry_ptr); @@ -334,15 +310,12 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5C__prefetched_entry_free_icr() */ - static herr_t -H5C__prefetched_entry_fsf_size(const void H5_ATTR_UNUSED *thing, - hsize_t H5_ATTR_UNUSED *fsf_size_ptr) +H5C__prefetched_entry_fsf_size(const void H5_ATTR_UNUSED *thing, hsize_t H5_ATTR_UNUSED *fsf_size_ptr) { FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */ - HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); + HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn."); FUNC_LEAVE_NOAPI(FAIL) } /* end H5C__prefetched_entry_fsf_size() */ - |