diff options
Diffstat (limited to 'test/cache_common.c')
-rw-r--r-- | test/cache_common.c | 553 |
1 files changed, 324 insertions, 229 deletions
diff --git a/test/cache_common.c b/test/cache_common.c index 94034eb..c0bee24 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -76,17 +76,22 @@ static test_entry_t *notify_entries = NULL, *orig_notify_entries = NULL; hbool_t orig_entry_arrays_init = FALSE; -static herr_t pico_get_load_size(const void *udata_ptr, size_t *image_len_ptr); -static herr_t nano_get_load_size(const void *udata_ptr, size_t *image_len_ptr); -static herr_t micro_get_load_size(const void *udata_ptr, size_t *image_len_ptr); -static herr_t tiny_get_load_size(const void *udata_ptr, size_t *image_len_ptr); -static herr_t small_get_load_size(const void *udata_ptr, size_t *image_len_ptr); -static herr_t medium_get_load_size(const void *udata_ptr, size_t *image_len_ptr); -static herr_t large_get_load_size(const void *udata_ptr, size_t *image_len_ptr); -static herr_t huge_get_load_size(const void *udata_ptr, size_t *image_len_ptr); -static herr_t monster_get_load_size(const void *udata_ptr, size_t *image_len_ptr); -static herr_t variable_get_load_size(const void *udata_ptr, size_t *image_len_ptr); -static herr_t notify_get_load_size(const void *udata_ptr, size_t *image_len_ptr); +static herr_t pico_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr); +static herr_t nano_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr); +static herr_t micro_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr); +static herr_t tiny_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr); +static herr_t small_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr); +static herr_t medium_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr); +static herr_t large_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr); +static herr_t huge_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr); +static herr_t monster_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr); +static herr_t variable_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr); +static herr_t notify_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr); + +static herr_t variable_get_final_load_size(const void *image, size_t image_len, + void *udata, size_t *actual_len); + +static htri_t variable_verify_chksum(const void *image_ptr, size_t len, void *udata_ptr); static void *pico_deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr); @@ -111,62 +116,51 @@ static void *variable_deserialize(const void *image_ptr, size_t len, void *udata static void *notify_deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr); -static herr_t pico_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t nano_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t micro_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t tiny_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t small_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t medium_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t large_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t huge_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t monster_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t variable_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t notify_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); +static herr_t pico_image_len(const void *thing, size_t *image_len_ptr); +static herr_t nano_image_len(const void *thing, size_t *image_len_ptr); +static herr_t micro_image_len(const void *thing, size_t *image_len_ptr); +static herr_t tiny_image_len(const void *thing, size_t *image_len_ptr); +static herr_t small_image_len(const void *thing, size_t *image_len_ptr); +static herr_t medium_image_len(const void *thing, size_t *image_len_ptr); +static herr_t large_image_len(const void *thing, size_t *image_len_ptr); +static herr_t huge_image_len(const void *thing, size_t *image_len_ptr); +static herr_t monster_image_len(const void *thing, size_t *image_len_ptr); +static herr_t variable_image_len(const void *thing, size_t *image_len_ptr); +static herr_t notify_image_len(const void *thing, size_t *image_len_ptr); static herr_t pico_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t nano_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t micro_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t tiny_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t small_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t medium_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t large_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t huge_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t monster_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t variable_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t notify_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t pico_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing); @@ -210,11 +204,13 @@ static void mark_flush_dep_dirty(test_entry_t * entry_ptr); static void mark_flush_dep_clean(test_entry_t * entry_ptr); /* Generic callback routines */ -static herr_t get_load_size(const void *udata_ptr, size_t *image_len_ptr, +static herr_t get_initial_load_size(void *udata_ptr, size_t *image_len_ptr, int32_t entry_type); +static herr_t get_final_load_size(const void *image, size_t image_len, + void *udata, size_t *actual_len, int32_t entry_type); static void *deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr, int32_t entry_type); -static herr_t image_len(void *thing, size_t *image_len_ptr, int32_t entry_type); +static herr_t image_len(const void *thing, size_t *image_len_ptr, int32_t entry_type); static herr_t pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); @@ -317,165 +313,176 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = "pico_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)pico_get_load_size, - (H5C_deserialize_func_t)pico_deserialize, - (H5C_image_len_func_t)pico_image_len, - (H5AC_pre_serialize_func_t)pico_pre_serialize, - (H5C_serialize_func_t)pico_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)pico_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + pico_get_initial_load_size, + NULL, + NULL, + pico_deserialize, + pico_image_len, + pico_pre_serialize, + pico_serialize, + NULL, + pico_free_icr, + NULL, }, { NANO_ENTRY_TYPE, "nano_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)nano_get_load_size, - (H5C_deserialize_func_t)nano_deserialize, - (H5C_image_len_func_t)nano_image_len, - (H5AC_pre_serialize_func_t)nano_pre_serialize, - (H5C_serialize_func_t)nano_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)nano_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + nano_get_initial_load_size, + NULL, + NULL, + nano_deserialize, + nano_image_len, + nano_pre_serialize, + nano_serialize, + NULL, + nano_free_icr, + NULL, }, { MICRO_ENTRY_TYPE, "micro_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)micro_get_load_size, - (H5C_deserialize_func_t)micro_deserialize, - (H5C_image_len_func_t)micro_image_len, - (H5AC_pre_serialize_func_t)micro_pre_serialize, - (H5C_serialize_func_t)micro_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)micro_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + micro_get_initial_load_size, + NULL, + NULL, + micro_deserialize, + micro_image_len, + micro_pre_serialize, + micro_serialize, + NULL, + micro_free_icr, + NULL, }, { TINY_ENTRY_TYPE, "tiny_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)tiny_get_load_size, - (H5C_deserialize_func_t)tiny_deserialize, - (H5C_image_len_func_t)tiny_image_len, - (H5AC_pre_serialize_func_t)tiny_pre_serialize, - (H5C_serialize_func_t)tiny_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)tiny_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + tiny_get_initial_load_size, + NULL, + NULL, + tiny_deserialize, + tiny_image_len, + tiny_pre_serialize, + tiny_serialize, + NULL, + tiny_free_icr, + NULL, }, { SMALL_ENTRY_TYPE, "small_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)small_get_load_size, - (H5C_deserialize_func_t)small_deserialize, - (H5C_image_len_func_t)small_image_len, - (H5AC_pre_serialize_func_t)small_pre_serialize, - (H5C_serialize_func_t)small_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)small_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + small_get_initial_load_size, + NULL, + NULL, + small_deserialize, + small_image_len, + small_pre_serialize, + small_serialize, + NULL, + small_free_icr, + NULL, }, { MEDIUM_ENTRY_TYPE, "medium_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)medium_get_load_size, - (H5C_deserialize_func_t)medium_deserialize, - (H5C_image_len_func_t)medium_image_len, - (H5AC_pre_serialize_func_t)medium_pre_serialize, - (H5C_serialize_func_t)medium_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)medium_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + medium_get_initial_load_size, + NULL, + NULL, + medium_deserialize, + medium_image_len, + medium_pre_serialize, + medium_serialize, + NULL, + medium_free_icr, + NULL, }, { LARGE_ENTRY_TYPE, "large_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)large_get_load_size, - (H5C_deserialize_func_t)large_deserialize, - (H5C_image_len_func_t)large_image_len, - (H5AC_pre_serialize_func_t)large_pre_serialize, - (H5C_serialize_func_t)large_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)large_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + large_get_initial_load_size, + NULL, + NULL, + large_deserialize, + large_image_len, + large_pre_serialize, + large_serialize, + NULL, + large_free_icr, + NULL, }, { HUGE_ENTRY_TYPE, "huge_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)huge_get_load_size, - (H5C_deserialize_func_t)huge_deserialize, - (H5C_image_len_func_t)huge_image_len, - (H5AC_pre_serialize_func_t)huge_pre_serialize, - (H5C_serialize_func_t)huge_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)huge_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + huge_get_initial_load_size, + NULL, + NULL, + huge_deserialize, + huge_image_len, + huge_pre_serialize, + huge_serialize, + NULL, + huge_free_icr, + NULL, }, { MONSTER_ENTRY_TYPE, "monster_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)monster_get_load_size, - (H5C_deserialize_func_t)monster_deserialize, - (H5C_image_len_func_t)monster_image_len, - (H5AC_pre_serialize_func_t)monster_pre_serialize, - (H5C_serialize_func_t)monster_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)monster_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + monster_get_initial_load_size, + NULL, + NULL, + monster_deserialize, + monster_image_len, + monster_pre_serialize, + monster_serialize, + NULL, + monster_free_icr, + NULL, }, { VARIABLE_ENTRY_TYPE, "variable_entry", H5FD_MEM_DEFAULT, H5C__CLASS_SPECULATIVE_LOAD_FLAG, - (H5C_get_load_size_func_t)variable_get_load_size, - (H5C_deserialize_func_t)variable_deserialize, - (H5C_image_len_func_t)variable_image_len, - (H5AC_pre_serialize_func_t)variable_pre_serialize, - (H5C_serialize_func_t)variable_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)variable_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + variable_get_initial_load_size, + variable_get_final_load_size, + variable_verify_chksum, + variable_deserialize, + variable_image_len, + variable_pre_serialize, + variable_serialize, + NULL, + variable_free_icr, + NULL, }, { NOTIFY_ENTRY_TYPE, "notify_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)notify_get_load_size, - (H5C_deserialize_func_t)notify_deserialize, - (H5C_image_len_func_t)notify_image_len, - (H5AC_pre_serialize_func_t)notify_pre_serialize, - (H5C_serialize_func_t)notify_serialize, - (H5C_notify_func_t)notify_notify, - (H5C_free_icr_func_t)notify_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + notify_get_initial_load_size, + NULL, + NULL, + notify_deserialize, + notify_image_len, + notify_pre_serialize, + notify_serialize, + notify_notify, + notify_free_icr, + NULL, } }; @@ -592,10 +599,10 @@ check_write_permitted(const H5F_t H5_ATTR_UNUSED *f, hbool_t *write_permitted_pt /*------------------------------------------------------------------------- - * Function: get_load_size & friends + * Function: get_initial_load_size & friends * * Purpose: Query the image size for loading an entry. The helper - * functions funnel into get_load_size proper. + * functions funnel into get_initial_load_size proper. * * Return: SUCCEED * @@ -605,7 +612,7 @@ check_write_permitted(const H5F_t H5_ATTR_UNUSED *f, hbool_t *write_permitted_pt *------------------------------------------------------------------------- */ static herr_t -get_load_size(const void *udata, size_t *image_length, int32_t entry_type) +get_initial_load_size(void *udata, size_t *image_length, int32_t entry_type) { test_entry_t *entry; test_entry_t *base_addr; @@ -631,72 +638,185 @@ get_load_size(const void *udata, size_t *image_length, int32_t entry_type) *image_length = entry->size; return(SUCCEED); -} /* get_load_size() */ +} /* get_initial_load_size() */ static herr_t -pico_get_load_size(const void *udata, size_t *image_length) +pico_get_initial_load_size(void *udata, size_t *image_length) { - return get_load_size(udata, image_length, PICO_ENTRY_TYPE); + return get_initial_load_size(udata, image_length, PICO_ENTRY_TYPE); } static herr_t -nano_get_load_size(const void *udata, size_t *image_length) +nano_get_initial_load_size(void *udata, size_t *image_length) { - return get_load_size(udata, image_length, NANO_ENTRY_TYPE); + return get_initial_load_size(udata, image_length, NANO_ENTRY_TYPE); } static herr_t -micro_get_load_size(const void *udata, size_t *image_length) +micro_get_initial_load_size(void *udata, size_t *image_length) { - return get_load_size(udata, image_length, MICRO_ENTRY_TYPE); + return get_initial_load_size(udata, image_length, MICRO_ENTRY_TYPE); } static herr_t -tiny_get_load_size(const void *udata, size_t *image_length) +tiny_get_initial_load_size(void *udata, size_t *image_length) { - return get_load_size(udata, image_length, TINY_ENTRY_TYPE); + return get_initial_load_size(udata, image_length, TINY_ENTRY_TYPE); } static herr_t -small_get_load_size(const void *udata, size_t *image_length) +small_get_initial_load_size(void *udata, size_t *image_length) { - return get_load_size(udata, image_length, SMALL_ENTRY_TYPE); + return get_initial_load_size(udata, image_length, SMALL_ENTRY_TYPE); } static herr_t -medium_get_load_size(const void *udata, size_t *image_length) +medium_get_initial_load_size(void *udata, size_t *image_length) { - return get_load_size(udata, image_length, MEDIUM_ENTRY_TYPE); + return get_initial_load_size(udata, image_length, MEDIUM_ENTRY_TYPE); } static herr_t -large_get_load_size(const void *udata, size_t *image_length) +large_get_initial_load_size(void *udata, size_t *image_length) { - return get_load_size(udata, image_length, LARGE_ENTRY_TYPE); + return get_initial_load_size(udata, image_length, LARGE_ENTRY_TYPE); } static herr_t -huge_get_load_size(const void *udata, size_t *image_length) +huge_get_initial_load_size(void *udata, size_t *image_length) { - return get_load_size(udata, image_length, HUGE_ENTRY_TYPE); + return get_initial_load_size(udata, image_length, HUGE_ENTRY_TYPE); } static herr_t -monster_get_load_size(const void *udata, size_t *image_length) +monster_get_initial_load_size(void *udata, size_t *image_length) { - return get_load_size(udata, image_length, MONSTER_ENTRY_TYPE); + return get_initial_load_size(udata, image_length, MONSTER_ENTRY_TYPE); } static herr_t -variable_get_load_size(const void *udata, size_t *image_length) +variable_get_initial_load_size(void *udata, size_t *image_length) { - return get_load_size(udata, image_length, VARIABLE_ENTRY_TYPE); + return get_initial_load_size(udata, image_length, VARIABLE_ENTRY_TYPE); } static herr_t -notify_get_load_size(const void *udata, size_t *image_length) +notify_get_initial_load_size(void *udata, size_t *image_length) { - return get_load_size(udata, image_length, NOTIFY_ENTRY_TYPE); + return get_initial_load_size(udata, image_length, NOTIFY_ENTRY_TYPE); +} + + +/*------------------------------------------------------------------------- + * Function: get_final_load_size & friends + * + * Purpose: Query the final image size for loading an entry. The helper + * functions funnel into get_final_load_size proper. + * + * Return: SUCCEED + * + * Programmer: Quincey Koziol + * 11/18/16 + * + *------------------------------------------------------------------------- + */ +static herr_t +get_final_load_size(const void *image, size_t image_len, void *udata, + size_t *actual_len, int32_t entry_type) +{ + test_entry_t *entry; + test_entry_t *base_addr; + haddr_t addr = *(const haddr_t *)udata; + int32_t type; + int32_t idx; + + addr_to_type_and_index(addr, &type, &idx); + + base_addr = entries[type]; + entry = &(base_addr[idx]); + + HDassert(entry->type >= 0); + HDassert(entry->type == type); + HDassert(entry->type == entry_type); + HDassert(entry->type < NUMBER_OF_ENTRY_TYPES); + HDassert(entry->index == idx); + HDassert(entry->index >= 0); + HDassert(entry->index <= max_indices[type]); + HDassert(entry == entry->self); + HDassert(entry->addr == addr); + HDassert(type == VARIABLE_ENTRY_TYPE); + + /* Simulate SPECULATIVE read with a specified actual_len */ + if(entry->actual_len) { + *actual_len = entry->actual_len; + entry->size = entry->actual_len; + } /* end if */ + else + *actual_len = entry->size; + + return(SUCCEED); +} /* get_final_load_size() */ + +static herr_t +variable_get_final_load_size(const void *image, size_t image_len, + void *udata, size_t *actual_len) +{ + return get_final_load_size(image, image_len, udata, actual_len, VARIABLE_ENTRY_TYPE); +} + + +/*------------------------------------------------------------------------- + * Function: verify_chksum & friends + * (only done for VARIABLE_ENTRY_TYPE which has a speculative read) + * + * Purpose: Simulate checksum verification: + * --check is ok only after 'max_verify_ct' is reached + * --otherwise check is not ok + * + * Return: TRUE: checksum is ok + * FALSE: checksum is not ok + * + * Programmer: + * + *------------------------------------------------------------------------- + */ + +static htri_t +verify_chksum(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED len, void *udata, int32_t entry_type) +{ + test_entry_t *entry; + test_entry_t *base_addr; + haddr_t addr = *(const haddr_t *)udata; + int32_t type; + int32_t idx; + + addr_to_type_and_index(addr, &type, &idx); + + base_addr = entries[type]; + entry = &(base_addr[idx]); + + HDassert(entry->type >= 0); + HDassert(entry->type == type); + HDassert(entry->type == entry_type); + HDassert(entry->type < NUMBER_OF_ENTRY_TYPES); + HDassert(type == VARIABLE_ENTRY_TYPE); + HDassert(entry->index == idx); + HDassert(entry->index >= 0); + HDassert(entry->index <= max_indices[type]); + HDassert(entry == entry->self); + HDassert(entry->addr == addr); + + if(++entry->verify_ct >= entry->max_verify_ct) + return(TRUE); + else + return(FALSE); + +} /* verify_chksum() */ + +static htri_t +variable_verify_chksum(const void *image, size_t len, void *udata) +{ + return verify_chksum(image, len, udata, VARIABLE_ENTRY_TYPE); } @@ -872,9 +992,9 @@ notify_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty) *------------------------------------------------------------------------- */ herr_t -image_len(void *thing, size_t *image_length, int32_t entry_type) +image_len(const void *thing, size_t *image_length, int32_t entry_type) { - test_entry_t *entry; + const test_entry_t *entry; test_entry_t *base_addr; int32_t type; int32_t idx; @@ -882,7 +1002,7 @@ image_len(void *thing, size_t *image_length, int32_t entry_type) HDassert(thing); HDassert(image_length); - entry = (test_entry_t *)thing; + entry = (const test_entry_t *)thing; HDassert(entry->self == entry); @@ -909,78 +1029,67 @@ image_len(void *thing, size_t *image_length, int32_t entry_type) } /* image_len() */ herr_t -pico_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +pico_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, PICO_ENTRY_TYPE); } herr_t -nano_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +nano_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, NANO_ENTRY_TYPE); } herr_t -micro_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +micro_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, MICRO_ENTRY_TYPE); } herr_t -tiny_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +tiny_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, TINY_ENTRY_TYPE); } herr_t -small_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +small_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, SMALL_ENTRY_TYPE); } herr_t -medium_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +medium_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, MEDIUM_ENTRY_TYPE); } herr_t -large_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +large_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, LARGE_ENTRY_TYPE); } herr_t -huge_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +huge_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, HUGE_ENTRY_TYPE); } herr_t -monster_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +monster_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, MONSTER_ENTRY_TYPE); } herr_t -variable_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +variable_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, VARIABLE_ENTRY_TYPE); } herr_t -notify_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +notify_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, NOTIFY_ENTRY_TYPE); } @@ -1095,10 +1204,8 @@ pico_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1111,10 +1218,8 @@ nano_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1127,10 +1232,8 @@ micro_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1143,10 +1246,8 @@ tiny_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1159,10 +1260,8 @@ small_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1175,10 +1274,8 @@ medium_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1191,10 +1288,8 @@ large_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1207,10 +1302,8 @@ huge_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1223,10 +1316,8 @@ monster_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1239,10 +1330,8 @@ variable_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1255,10 +1344,8 @@ notify_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -2395,6 +2482,10 @@ reset_entries(void) base_addr[j].notify_after_insert_count = 0; base_addr[j].notify_before_evict_count = 0; + base_addr[j].actual_len = 0; + base_addr[j].max_verify_ct = 0; + base_addr[j].verify_ct = 0; + addr += (haddr_t)entry_size; alt_addr += (haddr_t)entry_size; } /* end for */ @@ -3958,6 +4049,10 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx) HDfprintf(stdout, "entry_ptr->addr = %d, entry_ptr->header.addr = %d\n", (int)(entry_ptr->addr), (int)(entry_ptr->header.addr)); + HDfprintf(stdout, + "entry_ptr->verify_ct = %d, entry_ptr->max_verify_ct = %d\n", + entry_ptr->verify_ct, entry_ptr->max_verify_ct); + H5Eprint2(H5E_DEFAULT, stdout); #endif pass = FALSE; failure_mssg = "error in H5C_protect()."; |