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/H5SMcache.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/H5SMcache.c')
-rw-r--r-- | src/H5SMcache.c | 261 |
1 files changed, 118 insertions, 143 deletions
diff --git a/src/H5SMcache.c b/src/H5SMcache.c index e7cd29e..af08355 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -26,31 +26,27 @@ /* Module Setup */ /****************/ -#include "H5SMmodule.h" /* This source code file is part of the H5SM module */ - +#include "H5SMmodule.h" /* This source code file is part of the H5SM module */ /***********/ /* Headers */ /***********/ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5SMpkg.h" /* Shared object header messages */ -#include "H5WBprivate.h" /* Wrapped Buffers */ - +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5SMpkg.h" /* Shared object header messages */ +#include "H5WBprivate.h" /* Wrapped Buffers */ /****************/ /* Local Macros */ /****************/ - /******************/ /* Local Typedefs */ /******************/ - /********************/ /* Local Prototypes */ /********************/ @@ -58,74 +54,65 @@ /* Metadata cache (H5AC) callbacks */ static herr_t H5SM__cache_table_get_initial_load_size(void *udata, size_t *image_len); static htri_t H5SM__cache_table_verify_chksum(const void *image_ptr, size_t len, void *udata_ptr); -static void *H5SM__cache_table_deserialize(const void *image, size_t len, - void *udata, hbool_t *dirty); +static void * H5SM__cache_table_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); static herr_t H5SM__cache_table_image_len(const void *thing, size_t *image_len); -static herr_t H5SM__cache_table_serialize(const H5F_t *f, void *image, - size_t len, void *thing); +static herr_t H5SM__cache_table_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5SM__cache_table_free_icr(void *thing); static herr_t H5SM__cache_list_get_initial_load_size(void *udata, size_t *image_len); static htri_t H5SM__cache_list_verify_chksum(const void *image_ptr, size_t len, void *udata_ptr); -static void *H5SM__cache_list_deserialize(const void *image, size_t len, - void *udata, hbool_t *dirty); +static void * H5SM__cache_list_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); static herr_t H5SM__cache_list_image_len(const void *thing, size_t *image_len); -static herr_t H5SM__cache_list_serialize(const H5F_t *f, void *image, - size_t len, void *thing); +static herr_t H5SM__cache_list_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5SM__cache_list_free_icr(void *thing); - /*********************/ /* Package Variables */ /*********************/ /* H5SM inherits cache-like properties from H5AC */ const H5AC_class_t H5AC_SOHM_TABLE[1] = {{ - H5AC_SOHM_TABLE_ID, /* Metadata client ID */ - "shared message table", /* Metadata client name (for debugging) */ - H5FD_MEM_SOHM_TABLE, /* File space memory type for client */ - H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */ - H5SM__cache_table_get_initial_load_size, /* 'get_initial_load_size' callback */ - NULL, /* 'get_final_load_size' callback */ - H5SM__cache_table_verify_chksum, /* 'verify_chksum' callback */ - H5SM__cache_table_deserialize, /* 'deserialize' callback */ - H5SM__cache_table_image_len, /* 'image_len' callback */ - NULL, /* 'pre_serialize' callback */ - H5SM__cache_table_serialize, /* 'serialize' callback */ - NULL, /* 'notify' callback */ - H5SM__cache_table_free_icr, /* 'free_icr' callback */ - NULL, /* 'fsf_size' callback */ + H5AC_SOHM_TABLE_ID, /* Metadata client ID */ + "shared message table", /* Metadata client name (for debugging) */ + H5FD_MEM_SOHM_TABLE, /* File space memory type for client */ + H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */ + H5SM__cache_table_get_initial_load_size, /* 'get_initial_load_size' callback */ + NULL, /* 'get_final_load_size' callback */ + H5SM__cache_table_verify_chksum, /* 'verify_chksum' callback */ + H5SM__cache_table_deserialize, /* 'deserialize' callback */ + H5SM__cache_table_image_len, /* 'image_len' callback */ + NULL, /* 'pre_serialize' callback */ + H5SM__cache_table_serialize, /* 'serialize' callback */ + NULL, /* 'notify' callback */ + H5SM__cache_table_free_icr, /* 'free_icr' callback */ + NULL, /* 'fsf_size' callback */ }}; const H5AC_class_t H5AC_SOHM_LIST[1] = {{ - H5AC_SOHM_LIST_ID, /* Metadata client ID */ - "shared message list", /* Metadata client name (for debugging) */ - H5FD_MEM_SOHM_TABLE, /* File space memory type for client */ - H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */ - H5SM__cache_list_get_initial_load_size, /* 'get_initial_load_size' callback */ - NULL, /* 'get_final_load_size' callback */ - H5SM__cache_list_verify_chksum, /* 'verify_chksum' callback */ - H5SM__cache_list_deserialize, /* 'deserialize' callback */ - H5SM__cache_list_image_len, /* 'image_len' callback */ - NULL, /* 'pre_serialize' callback */ - H5SM__cache_list_serialize, /* 'serialize' callback */ - NULL, /* 'notify' callback */ - H5SM__cache_list_free_icr, /* 'free_icr' callback */ - NULL, /* 'fsf_size' callback */ + H5AC_SOHM_LIST_ID, /* Metadata client ID */ + "shared message list", /* Metadata client name (for debugging) */ + H5FD_MEM_SOHM_TABLE, /* File space memory type for client */ + H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */ + H5SM__cache_list_get_initial_load_size, /* 'get_initial_load_size' callback */ + NULL, /* 'get_final_load_size' callback */ + H5SM__cache_list_verify_chksum, /* 'verify_chksum' callback */ + H5SM__cache_list_deserialize, /* 'deserialize' callback */ + H5SM__cache_list_image_len, /* 'image_len' callback */ + NULL, /* 'pre_serialize' callback */ + H5SM__cache_list_serialize, /* 'serialize' callback */ + NULL, /* 'notify' callback */ + H5SM__cache_list_free_icr, /* 'free_icr' callback */ + NULL, /* 'fsf_size' callback */ }}; - /*****************************/ /* Library Private Variables */ /*****************************/ - /*******************/ /* Local Variables */ /*******************/ - - /*------------------------------------------------------------------------- * Function: H5SM__cache_table_get_initial_load_size() * @@ -143,7 +130,7 @@ const H5AC_class_t H5AC_SOHM_LIST[1] = {{ static herr_t H5SM__cache_table_get_initial_load_size(void *_udata, size_t *image_len) { - const H5SM_table_cache_ud_t *udata = (const H5SM_table_cache_ud_t *)_udata; /* User data for callback */ + const H5SM_table_cache_ud_t *udata = (const H5SM_table_cache_ud_t *)_udata; /* User data for callback */ FUNC_ENTER_STATIC_NOERR @@ -158,7 +145,6 @@ H5SM__cache_table_get_initial_load_size(void *_udata, size_t *image_len) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SM__cache_table_get_initial_load_size() */ - /*------------------------------------------------------------------------- * Function: H5SM__cache_table_verify_chksum * @@ -175,10 +161,10 @@ H5SM__cache_table_get_initial_load_size(void *_udata, size_t *image_len) htri_t H5SM__cache_table_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; /* Return value */ + 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; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -188,13 +174,12 @@ H5SM__cache_table_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU /* Get stored and computed checksums */ H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); - if(stored_chksum != computed_chksum) + if (stored_chksum != computed_chksum) ret_value = FALSE; FUNC_LEAVE_NOAPI(ret_value) } /* end H5SM__cache_table_verify_chksum() */ - /*------------------------------------------------------------------------- * Function: H5SM__cache_table_deserialize * @@ -212,16 +197,16 @@ H5SM__cache_table_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU *------------------------------------------------------------------------- */ static void * -H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, - void *_udata, hbool_t H5_ATTR_UNUSED *dirty) +H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, + hbool_t H5_ATTR_UNUSED *dirty) { - H5F_t *f; /* File pointer -- from user data */ - H5SM_master_table_t *table = NULL; /* Shared message table that we deserializing */ - H5SM_table_cache_ud_t *udata = (H5SM_table_cache_ud_t *)_udata; /* Pointer to user data */ - const uint8_t *image = (const uint8_t *)_image; /* Pointer into input buffer */ - uint32_t stored_chksum; /* Stored metadata checksum value */ - size_t u; /* Counter variable for index headers */ - void *ret_value = NULL; /* Return value */ + H5F_t * f; /* File pointer -- from user data */ + H5SM_master_table_t * table = NULL; /* Shared message table that we deserializing */ + H5SM_table_cache_ud_t *udata = (H5SM_table_cache_ud_t *)_udata; /* Pointer to user data */ + const uint8_t * image = (const uint8_t *)_image; /* Pointer into input buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + size_t u; /* Counter variable for index headers */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -239,7 +224,7 @@ H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l HDassert(H5F_SOHM_VERS(f) == HDF5_SHAREDHEADER_VERSION); /* Allocate space for the master table in memory */ - if(NULL == (table = H5FL_CALLOC(H5SM_master_table_t))) + if (NULL == (table = H5FL_CALLOC(H5SM_master_table_t))) HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed") /* Read number of indexes and version from file superblock */ @@ -253,22 +238,23 @@ H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l HDassert(table->table_size == len); /* Check magic number */ - if(HDmemcmp(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM table signature") image += H5_SIZEOF_MAGIC; /* Allocate space for the index headers in memory*/ - if(NULL == (table->indexes = (H5SM_index_header_t *)H5FL_ARR_MALLOC(H5SM_index_header_t, (size_t)table->num_indexes))) + if (NULL == (table->indexes = + (H5SM_index_header_t *)H5FL_ARR_MALLOC(H5SM_index_header_t, (size_t)table->num_indexes))) HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed for SOHM indexes") /* Read in the index headers */ - for(u = 0; u < table->num_indexes; ++u) { + for (u = 0; u < table->num_indexes; ++u) { /* Verify correct version of index list */ - if(H5SM_LIST_VERSION != *image++) + if (H5SM_LIST_VERSION != *image++) HGOTO_ERROR(H5E_SOHM, H5E_VERSION, NULL, "bad shared message list version number") /* Type of the index (list or B-tree) */ - table->indexes[u].index_type= (H5SM_index_type_t)*image++; + table->indexes[u].index_type = (H5SM_index_type_t)*image++; /* Type of messages in the index */ UINT16DECODE(image, table->indexes[u].mesg_types); @@ -291,7 +277,7 @@ H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l /* Address of the index's heap */ H5F_addr_decode(f, &image, &(table->indexes[u].heap_addr)); - /* Compute the size of a list index for this SOHM index */ + /* Compute the size of a list index for this SOHM index */ table->indexes[u].list_size = H5SM_LIST_SIZE(f, table->indexes[u].list_max); } /* end for */ @@ -307,14 +293,13 @@ H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l ret_value = table; done: - if(!ret_value && table) - if(H5SM__table_free(table) < 0) + if (!ret_value && table) + if (H5SM__table_free(table) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTFREE, NULL, "unable to destroy sohm table") FUNC_LEAVE_NOAPI(ret_value) } /* end H5SM__cache_table_deserialize() */ - /*------------------------------------------------------------------------- * Function: H5SM__cache_table_image_len * @@ -333,7 +318,8 @@ done: static herr_t H5SM__cache_table_image_len(const void *_thing, size_t *image_len) { - const H5SM_master_table_t *table = (const H5SM_master_table_t *)_thing; /* Shared message table to query */ + const H5SM_master_table_t *table = + (const H5SM_master_table_t *)_thing; /* Shared message table to query */ FUNC_ENTER_STATIC_NOERR @@ -348,7 +334,6 @@ H5SM__cache_table_image_len(const void *_thing, size_t *image_len) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SM__cache_table_image_len() */ - /*------------------------------------------------------------------------- * Function: H5SM__cache_table_serialize * @@ -364,13 +349,12 @@ H5SM__cache_table_image_len(const void *_thing, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, - void *_thing) +H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5SM_master_table_t *table = (H5SM_master_table_t *)_thing; /* Shared message table to encode */ - uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */ - uint32_t computed_chksum; /* Computed metadata checksum value */ - size_t u; /* Counter variable */ + uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t computed_chksum; /* Computed metadata checksum value */ + size_t u; /* Counter variable */ FUNC_ENTER_STATIC_NOERR @@ -392,7 +376,7 @@ H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_ image += H5_SIZEOF_MAGIC; /* Encode each index header */ - for(u = 0; u < table->num_indexes; ++u) { + for (u = 0; u < table->num_indexes; ++u) { /* Version for this list */ *image++ = H5SM_LIST_VERSION; @@ -435,7 +419,6 @@ H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_ /* no H5SM_cache_table_notify() function */ /*****************************************/ - /*------------------------------------------------------------------------- * Function: H5SM__cache_table_free_icr * @@ -456,8 +439,8 @@ H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_ static herr_t H5SM__cache_table_free_icr(void *_thing) { - H5SM_master_table_t *table = (H5SM_master_table_t *)_thing; /* Shared message table to release */ - herr_t ret_value = SUCCEED; /* Return value */ + H5SM_master_table_t *table = (H5SM_master_table_t *)_thing; /* Shared message table to release */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -467,14 +450,13 @@ H5SM__cache_table_free_icr(void *_thing) HDassert(table->cache_info.type == H5AC_SOHM_TABLE); /* Destroy Shared Object Header Message table */ - if(H5SM__table_free(table) < 0) + if (H5SM__table_free(table) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTRELEASE, FAIL, "unable to free shared message table") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5SM_cache_table_free_icr() */ - /*------------------------------------------------------------------------- * Function: H5SM__cache_list_get_initial_load_size() * @@ -493,7 +475,7 @@ done: static herr_t H5SM__cache_list_get_initial_load_size(void *_udata, size_t *image_len) { - const H5SM_list_cache_ud_t *udata = (const H5SM_list_cache_ud_t *)_udata; /* User data for callback */ + const H5SM_list_cache_ud_t *udata = (const H5SM_list_cache_ud_t *)_udata; /* User data for callback */ FUNC_ENTER_STATIC_NOERR @@ -509,7 +491,6 @@ H5SM__cache_list_get_initial_load_size(void *_udata, size_t *image_len) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SM__cache_list_get_initial_load_size() */ - /*------------------------------------------------------------------------- * Function: H5SM__cache_list_verify_chksum * @@ -526,12 +507,12 @@ H5SM__cache_list_get_initial_load_size(void *_udata, size_t *image_len) htri_t H5SM__cache_list_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, void *_udata) { - const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ - H5SM_list_cache_ud_t *udata = (H5SM_list_cache_ud_t *)_udata; /* User data for callback */ - size_t chk_size; /* Exact size of the node with checksum at the end */ - uint32_t stored_chksum; /* Stored metadata checksum value */ - uint32_t computed_chksum; /* Computed metadata checksum value */ - htri_t ret_value = TRUE; /* Return value */ + const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + H5SM_list_cache_ud_t *udata = (H5SM_list_cache_ud_t *)_udata; /* User data for callback */ + size_t chk_size; /* Exact size of the node with checksum at the end */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + uint32_t computed_chksum; /* Computed metadata checksum value */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -545,13 +526,12 @@ H5SM__cache_list_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, vo /* Get stored and computed checksums */ H5F_get_checksums(image, chk_size, &stored_chksum, &computed_chksum); - if(stored_chksum != computed_chksum) - ret_value = FALSE; + if (stored_chksum != computed_chksum) + ret_value = FALSE; FUNC_LEAVE_NOAPI(ret_value) } /* end H5SM__cache_list_verify_chksum() */ - /*------------------------------------------------------------------------- * Function: H5SM__cache_list_deserialize * @@ -568,16 +548,16 @@ H5SM__cache_list_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, vo *------------------------------------------------------------------------- */ static void * -H5SM__cache_list_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, - void *_udata, hbool_t H5_ATTR_UNUSED *dirty) +H5SM__cache_list_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, + hbool_t H5_ATTR_UNUSED *dirty) { - H5SM_list_t *list = NULL; /* The SOHM list being read in */ - H5SM_list_cache_ud_t *udata = (H5SM_list_cache_ud_t *)_udata; /* User data for callback */ - H5SM_bt2_ctx_t ctx; /* Message encoding context */ - const uint8_t *image = (const uint8_t *)_image; /* Pointer into input buffer */ - uint32_t stored_chksum; /* Stored metadata checksum value */ - size_t u; /* Counter variable for messages in list */ - void *ret_value = NULL; /* Return value */ + H5SM_list_t * list = NULL; /* The SOHM list being read in */ + H5SM_list_cache_ud_t *udata = (H5SM_list_cache_ud_t *)_udata; /* User data for callback */ + H5SM_bt2_ctx_t ctx; /* Message encoding context */ + const uint8_t * image = (const uint8_t *)_image; /* Pointer into input buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + size_t u; /* Counter variable for messages in list */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -590,24 +570,24 @@ H5SM__cache_list_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED le HDassert(dirty); /* Allocate space for the SOHM list data structure */ - if(NULL == (list = H5FL_MALLOC(H5SM_list_t))) + if (NULL == (list = H5FL_MALLOC(H5SM_list_t))) HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed") HDmemset(&list->cache_info, 0, sizeof(H5AC_info_t)); /* Allocate list in memory as an array*/ - if(NULL == (list->messages = (H5SM_sohm_t *)H5FL_ARR_MALLOC(H5SM_sohm_t, udata->header->list_max))) + if (NULL == (list->messages = (H5SM_sohm_t *)H5FL_ARR_MALLOC(H5SM_sohm_t, udata->header->list_max))) HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "file allocation failed for SOHM list") list->header = udata->header; /* Check magic number */ - if(HDmemcmp(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM list signature") image += H5_SIZEOF_MAGIC; /* Read messages into the list array */ ctx.sizeof_addr = H5F_SIZEOF_ADDR(udata->f); - for(u = 0; u < udata->header->num_messages; u++) { - if(H5SM__message_decode(image, &(list->messages[u]), &ctx) < 0) + for (u = 0; u < udata->header->num_messages; u++) { + if (H5SM__message_decode(image, &(list->messages[u]), &ctx) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "can't decode shared message") image += H5SM_SOHM_ENTRY_SIZE(udata->f); @@ -622,15 +602,15 @@ H5SM__cache_list_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED le HDassert((size_t)(image - (const uint8_t *)_image) <= udata->header->list_size); /* Initialize the rest of the array */ - for(u = udata->header->num_messages; u < udata->header->list_max; u++) + for (u = udata->header->num_messages; u < udata->header->list_max; u++) list->messages[u].location = H5SM_NO_LOC; /* Set return value */ ret_value = list; done: - if(!ret_value && list) { - if(list->messages) + if (!ret_value && list) { + if (list->messages) list->messages = H5FL_ARR_FREE(H5SM_sohm_t, list->messages); list = H5FL_FREE(H5SM_list_t, list); } /* end if */ @@ -638,7 +618,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5SM__cache_list_deserialize() */ - /*------------------------------------------------------------------------- * Function: H5SM__cache_list_image_len * @@ -655,7 +634,7 @@ done: static herr_t H5SM__cache_list_image_len(const void *_thing, size_t *image_len) { - const H5SM_list_t *list = (const H5SM_list_t *)_thing; /* Shared message list to query */ + const H5SM_list_t *list = (const H5SM_list_t *)_thing; /* Shared message list to query */ FUNC_ENTER_STATIC_NOERR @@ -671,7 +650,6 @@ H5SM__cache_list_image_len(const void *_thing, size_t *image_len) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SM__cache_list_image_len() */ - /*------------------------------------------------------------------------- * Function: H5SM__cache_list_serialize * @@ -687,16 +665,15 @@ H5SM__cache_list_image_len(const void *_thing, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, - void *_thing) +H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { - H5SM_list_t *list = (H5SM_list_t *)_thing ; /* Instance being serialized */ - H5SM_bt2_ctx_t ctx; /* Message encoding context */ - uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */ - uint32_t computed_chksum; /* Computed metadata checksum value */ - size_t mesgs_serialized; /* Number of messages serialized */ - size_t u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + H5SM_list_t * list = (H5SM_list_t *)_thing; /* Instance being serialized */ + H5SM_bt2_ctx_t ctx; /* Message encoding context */ + uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t computed_chksum; /* Computed metadata checksum value */ + size_t mesgs_serialized; /* Number of messages serialized */ + size_t u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -715,16 +692,16 @@ H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_U /* serialize messages from the messages array */ mesgs_serialized = 0; - ctx.sizeof_addr = H5F_SIZEOF_ADDR(f); - for(u = 0; ((u < list->header->list_max) && (mesgs_serialized < list->header->num_messages)); u++) { - if(list->messages[u].location != H5SM_NO_LOC) { - if(H5SM__message_encode(image, &(list->messages[u]), &ctx) < 0) + ctx.sizeof_addr = H5F_SIZEOF_ADDR(f); + for (u = 0; ((u < list->header->list_max) && (mesgs_serialized < list->header->num_messages)); u++) { + if (list->messages[u].location != H5SM_NO_LOC) { + if (H5SM__message_encode(image, &(list->messages[u]), &ctx) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTFLUSH, FAIL, "unable to serialize shared message") image += H5SM_SOHM_ENTRY_SIZE(f); ++mesgs_serialized; } /* end if */ - } /* end for */ + } /* end for */ HDassert(mesgs_serialized == list->header->num_messages); @@ -746,7 +723,6 @@ done: /* no H5SM_cache_list_notify() function */ /****************************************/ - /*------------------------------------------------------------------------- * Function: H5SM__cache_list_free_icr * @@ -767,8 +743,8 @@ done: static herr_t H5SM__cache_list_free_icr(void *_thing) { - H5SM_list_t *list = (H5SM_list_t *)_thing; /* Shared message list to release */ - herr_t ret_value = SUCCEED; /* Return value */ + H5SM_list_t *list = (H5SM_list_t *)_thing; /* Shared message list to release */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -778,10 +754,9 @@ H5SM__cache_list_free_icr(void *_thing) HDassert(list->cache_info.type == H5AC_SOHM_LIST); /* Destroy Shared Object Header Message list */ - if(H5SM__list_free(list) < 0) + if (H5SM__list_free(list) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTRELEASE, FAIL, "unable to free shared message list") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_cache_list_free_icr() */ - |