diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2022-05-08 10:43:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-08 10:43:32 (GMT) |
commit | 6e6dbf2e81660a65d3aec955c85d59fa479f3b3b (patch) | |
tree | e8985303be6ca8bbd1ad5ebd34640f357fdaece7 /test/onion.c | |
parent | 3dd97b88e9f28dc38e1be413be0b80c6b805dd76 (diff) | |
download | hdf5-6e6dbf2e81660a65d3aec955c85d59fa479f3b3b.zip hdf5-6e6dbf2e81660a65d3aec955c85d59fa479f3b3b.tar.gz hdf5-6e6dbf2e81660a65d3aec955c85d59fa479f3b3b.tar.bz2 |
Onion VFD: Refactoring (#1756)
Diffstat (limited to 'test/onion.c')
-rw-r--r-- | test/onion.c | 451 |
1 files changed, 225 insertions, 226 deletions
diff --git a/test/onion.c b/test/onion.c index f5efcf8..7e2a17d 100644 --- a/test/onion.c +++ b/test/onion.c @@ -196,33 +196,33 @@ test_archival_index(void) /* Invalid version should fail */ aix.version++; - if (H5FD_onion_archival_index_is_valid(&aix)) + if (H5FD__onion_archival_index_is_valid(&aix)) TEST_ERROR; /* Invalid version should fail */ aix.version = 0; - if (H5FD_onion_archival_index_is_valid(&aix)) + if (H5FD__onion_archival_index_is_valid(&aix)) TEST_ERROR; aix.version = H5FD__ONION_ARCHIVAL_INDEX_VERSION_CURR; /* NULL list should fail */ aix.list = NULL; - if (H5FD_onion_archival_index_is_valid(&aix)) + if (H5FD__onion_archival_index_is_valid(&aix)) TEST_ERROR; /* List not full should fail */ aix.list = sorted_incomplete; - if (H5FD_onion_archival_index_is_valid(&aix)) + if (H5FD__onion_archival_index_is_valid(&aix)) TEST_ERROR; /* Unsorted list should fail */ aix.list = unsorted; - if (H5FD_onion_archival_index_is_valid(&aix)) + if (H5FD__onion_archival_index_is_valid(&aix)) TEST_ERROR; /* List with duplicates should fail */ aix.list = sorted_duplicates; - if (H5FD_onion_archival_index_is_valid(&aix)) + if (H5FD__onion_archival_index_is_valid(&aix)) TEST_ERROR; /* @@ -231,13 +231,13 @@ test_archival_index(void) /* Sorted list should pass */ aix.list = sorted; - if (!H5FD_onion_archival_index_is_valid(&aix)) + if (!H5FD__onion_archival_index_is_valid(&aix)) TEST_ERROR; /* Extra elements ignored (should pass) */ aix.list = sorted_partial; aix.n_entries = 4; - if (!H5FD_onion_archival_index_is_valid(&aix)) + if (!H5FD__onion_archival_index_is_valid(&aix)) TEST_ERROR; /* @@ -248,14 +248,14 @@ test_archival_index(void) aix.n_entries = 8; /* Check that address not in array returns zero */ - if (H5FD_onion_archival_index_find(&aix, 3, &entry_out_p) != 0) + if (H5FD__onion_archival_index_find(&aix, 3, &entry_out_p) != 0) TEST_ERROR; /* Pointer should remain unset */ if (entry_out_p != NULL) TEST_ERROR; /* Address found should return 1 */ - if (H5FD_onion_archival_index_find(&aix, 4, &entry_out_p) != 1) + if (H5FD__onion_archival_index_find(&aix, 4, &entry_out_p) != 1) TEST_ERROR; /* Pointer should be set */ if (NULL == entry_out_p) @@ -272,11 +272,11 @@ test_archival_index(void) aix.n_entries = 4; /* Address not in array should return 0 */ - if (H5FD_onion_archival_index_find(&aix, 1, &entry_out_p) != 0) + if (H5FD__onion_archival_index_find(&aix, 1, &entry_out_p) != 0) TEST_ERROR; /* Address not in array should return 0 */ - if (H5FD_onion_archival_index_find(&aix, 101, &entry_out_p) != 0) + if (H5FD__onion_archival_index_find(&aix, 101, &entry_out_p) != 0) TEST_ERROR; /* @@ -286,7 +286,7 @@ test_archival_index(void) entry_out_p = NULL; aix.n_entries = 0; /* actually populated list is irrelevant */ /* Address not in array should return 0 */ - if (H5FD_onion_archival_index_find(&aix, 3, &entry_out_p) != 0) + if (H5FD__onion_archival_index_find(&aix, 3, &entry_out_p) != 0) TEST_ERROR; /* Pointer should remain unset */ if (entry_out_p != NULL) @@ -311,8 +311,8 @@ error: static int test_revision_index(void) { - H5FD__onion_revision_index_t *rix_p = NULL; - H5FD_onion_index_entry_t entry = { + H5FD_onion_revision_index_t *rix_p = NULL; + H5FD_onion_index_entry_t entry = { 42, /* logi_page */ 111112, /* phys_addr */ }; @@ -322,7 +322,7 @@ test_revision_index(void) /* Test index creation */ - if (NULL == (rix_p = H5FD_onion_revision_index_init(ONION_TEST_PAGE_SIZE_5))) + if (NULL == (rix_p = H5FD__onion_revision_index_init(ONION_TEST_PAGE_SIZE_5))) TEST_ERROR; if (H5FD__ONION_REVISION_INDEX_VERSION_CURR != rix_p->version) TEST_ERROR; @@ -331,18 +331,18 @@ test_revision_index(void) /* Test missed search */ - if (H5FD_onion_revision_index_find(rix_p, entry.logi_page, &entry_out_p) != 0) + if (H5FD__onion_revision_index_find(rix_p, entry.logi_page, &entry_out_p) != 0) TEST_ERROR; /* Test successful insertion and lookup */ /* Insertion failed */ - if (H5FD_onion_revision_index_insert(rix_p, &entry) < 0) + if (H5FD__onion_revision_index_insert(rix_p, &entry) < 0) TEST_ERROR; if (1 != rix_p->n_entries) TEST_ERROR; /* Lookup failed */ - if (H5FD_onion_revision_index_find(rix_p, entry.logi_page, &entry_out_p) < 0) + if (H5FD__onion_revision_index_find(rix_p, entry.logi_page, &entry_out_p) < 0) TEST_ERROR; /* Failure to set output parameter */ if (NULL == entry_out_p) @@ -350,20 +350,20 @@ test_revision_index(void) if (entry.logi_page != entry_out_p->logi_page) TEST_ERROR; /* Seeking missing page should miss */ - if (H5FD_onion_revision_index_find(rix_p, entry.logi_page + 1, &entry_out_p) != 0) + if (H5FD__onion_revision_index_find(rix_p, entry.logi_page + 1, &entry_out_p) != 0) TEST_ERROR; /* Test / demonstrate stored entry independent of user object */ entry.logi_page = 100; entry.phys_addr = 101; - if (H5FD_onion_revision_index_insert(rix_p, &entry) < 0) + if (H5FD__onion_revision_index_insert(rix_p, &entry) < 0) TEST_ERROR; if (2 != rix_p->n_entries) TEST_ERROR; entry.logi_page = 500; entry.phys_addr = 501; - if (H5FD_onion_revision_index_find(rix_p, 100, &entry_out_p) < 0) + if (H5FD__onion_revision_index_find(rix_p, 100, &entry_out_p) < 0) TEST_ERROR; if (100 != entry_out_p->logi_page || 101 != entry_out_p->phys_addr) TEST_ERROR; @@ -373,7 +373,7 @@ test_revision_index(void) /* Error cases */ entry.logi_page = 100; /* phys_addr still 501, checksum bbbbbbbb */ - if (H5FD_onion_revision_index_insert(rix_p, &entry) >= 0) + if (H5FD__onion_revision_index_insert(rix_p, &entry) >= 0) TEST_ERROR; /* all components but sum must match */ entry.phys_addr = 101; @@ -381,18 +381,18 @@ test_revision_index(void) entry.logi_page = 100; entry.phys_addr = 101; - if (H5FD_onion_revision_index_insert(rix_p, &entry) < 0) + if (H5FD__onion_revision_index_insert(rix_p, &entry) < 0) TEST_ERROR; /* Should still be two unique entries, not three */ if (2 != rix_p->n_entries) TEST_ERROR; - if (H5FD_onion_revision_index_find(rix_p, 100, &entry_out_p) < 0) + if (H5FD__onion_revision_index_find(rix_p, 100, &entry_out_p) < 0) TEST_ERROR; if (100 != entry_out_p->logi_page || 101 != entry_out_p->phys_addr) TEST_ERROR; - if (H5FD_onion_revision_index_destroy(rix_p) < 0) + if (H5FD__onion_revision_index_destroy(rix_p) < 0) TEST_ERROR; PASSED(); @@ -400,7 +400,7 @@ test_revision_index(void) error: if (rix_p != NULL) - (void)H5FD_onion_revision_index_destroy(rix_p); + (void)H5FD__onion_revision_index_destroy(rix_p); return -1; } /* end test_revision_index() */ @@ -418,8 +418,8 @@ error: static int test_revision_index_collisions(void) { - H5FD__onion_revision_index_t *rix_p = NULL; - H5FD_onion_index_entry_t entry = { + H5FD_onion_revision_index_t *rix_p = NULL; + H5FD_onion_index_entry_t entry = { 0, /* logi_page */ 0, /* phys_addr */ }; @@ -429,13 +429,13 @@ test_revision_index_collisions(void) TESTING("revision index collisions"); - if (NULL == (rix_p = H5FD_onion_revision_index_init(ONION_TEST_PAGE_SIZE_5))) + if (NULL == (rix_p = H5FD__onion_revision_index_init(ONION_TEST_PAGE_SIZE_5))) TEST_ERROR; for (uint64_t i = 0; i < n_insert; i++) { entry.phys_addr = i; entry.logi_page = U64_EXP2(i) + offset_from_power; - if (H5FD_onion_revision_index_insert(rix_p, &entry) < 0) + if (H5FD__onion_revision_index_insert(rix_p, &entry) < 0) TEST_ERROR; } @@ -445,13 +445,13 @@ test_revision_index_collisions(void) for (uint64_t i = 0; i < n_insert; i++) { uint64_t page_id = U64_EXP2(i) + offset_from_power; - if (H5FD_onion_revision_index_find(rix_p, page_id, &entry_out_p) != 1) + if (H5FD__onion_revision_index_find(rix_p, page_id, &entry_out_p) != 1) TEST_ERROR; if (entry_out_p->phys_addr != i) TEST_ERROR; } - if (H5FD_onion_revision_index_destroy(rix_p) < 0) + if (H5FD__onion_revision_index_destroy(rix_p) < 0) TEST_ERROR; PASSED(); @@ -459,7 +459,7 @@ test_revision_index_collisions(void) error: if (rix_p != NULL) - (void)H5FD_onion_revision_index_destroy(rix_p); + (void)H5FD__onion_revision_index_destroy(rix_p); return -1; } /* end test_revision_index_collisions() */ @@ -479,8 +479,8 @@ error: static int test_revision_index_resizing(void) { - H5FD__onion_revision_index_t *rix_p = NULL; - H5FD_onion_index_entry_t entry = { + H5FD_onion_revision_index_t *rix_p = NULL; + H5FD_onion_index_entry_t entry = { 0, /* logi_page */ 0, /* phys_addr */ }; @@ -489,13 +489,13 @@ test_revision_index_resizing(void) TESTING("revision index resizing"); - if (NULL == (rix_p = H5FD_onion_revision_index_init(ONION_TEST_PAGE_SIZE_5))) + if (NULL == (rix_p = H5FD__onion_revision_index_init(ONION_TEST_PAGE_SIZE_5))) TEST_ERROR; for (uint64_t i = 0; i < n_insert; i++) { entry.logi_page = i; entry.phys_addr = ((uint64_t)(-1) - i); - if (H5FD_onion_revision_index_insert(rix_p, &entry) < 0) + if (H5FD__onion_revision_index_insert(rix_p, &entry) < 0) TEST_ERROR; } @@ -505,13 +505,13 @@ test_revision_index_resizing(void) for (uint64_t i = 0; i < n_insert; i++) { uint64_t page_id = i; - if (H5FD_onion_revision_index_find(rix_p, page_id, &entry_out_p) != 1) + if (H5FD__onion_revision_index_find(rix_p, page_id, &entry_out_p) != 1) TEST_ERROR; if (entry_out_p->phys_addr != ((uint64_t)(-1) - i)) TEST_ERROR; } - if (H5FD_onion_revision_index_destroy(rix_p) < 0) + if (H5FD__onion_revision_index_destroy(rix_p) < 0) TEST_ERROR; PASSED(); @@ -519,7 +519,7 @@ test_revision_index_resizing(void) error: if (rix_p != NULL) - (void)H5FD_onion_revision_index_destroy(rix_p); + (void)H5FD__onion_revision_index_destroy(rix_p); return -1; } /* end test_revision_index_resizing() */ @@ -536,8 +536,8 @@ error: static int test_revision_index_to_archival_index(void) { - H5FD__onion_revision_index_t *rix_p = NULL; - H5FD_onion_index_entry_t rix_entry = { + H5FD_onion_revision_index_t *rix_p = NULL; + H5FD_onion_index_entry_t rix_entry = { 0, /* logi_page */ 0, /* phys_addr */ }; @@ -555,7 +555,7 @@ test_revision_index_to_archival_index(void) * SETUP */ - if (NULL == (rix_p = H5FD_onion_revision_index_init(ONION_TEST_PAGE_SIZE_5))) + if (NULL == (rix_p = H5FD__onion_revision_index_init(ONION_TEST_PAGE_SIZE_5))) TEST_ERROR; /* Add scattered entries in reverse order. */ @@ -564,7 +564,7 @@ test_revision_index_to_archival_index(void) rix_entry.logi_page = n; rix_entry.phys_addr = n * 13; - if (H5FD_onion_revision_index_insert(rix_p, &rix_entry) < 0) + if (H5FD__onion_revision_index_insert(rix_p, &rix_entry) < 0) TEST_ERROR; } @@ -576,10 +576,10 @@ test_revision_index_to_archival_index(void) /* Successful merge into empty archival index */ - if (H5FD_onion_merge_revision_index_into_archival_index(rix_p, &aix) < 0) + if (H5FD__onion_merge_revision_index_into_archival_index(rix_p, &aix) < 0) TEST_ERROR; - if (!H5FD_onion_archival_index_is_valid(&aix)) + if (!H5FD__onion_archival_index_is_valid(&aix)) TEST_ERROR; if (n_insert != aix.n_entries) @@ -609,12 +609,12 @@ test_revision_index_to_archival_index(void) aix.list[1].phys_addr = (2003 * (n_insert + 1) + 47) * 13; aix.n_entries = 2; - if (!H5FD_onion_archival_index_is_valid(&aix)) + if (!H5FD__onion_archival_index_is_valid(&aix)) TEST_ERROR; - if (H5FD_onion_merge_revision_index_into_archival_index(rix_p, &aix) < 0) + if (H5FD__onion_merge_revision_index_into_archival_index(rix_p, &aix) < 0) TEST_ERROR; - if (!H5FD_onion_archival_index_is_valid(&aix)) + if (!H5FD__onion_archival_index_is_valid(&aix)) TEST_ERROR; if (n_insert + 2 != aix.n_entries) @@ -645,13 +645,13 @@ test_revision_index_to_archival_index(void) aix.list[1].phys_addr = 101; aix.n_entries = 2; - if (!H5FD_onion_archival_index_is_valid(&aix)) + if (!H5FD__onion_archival_index_is_valid(&aix)) TEST_ERROR; - if (H5FD_onion_merge_revision_index_into_archival_index(rix_p, &aix) < 0) + if (H5FD__onion_merge_revision_index_into_archival_index(rix_p, &aix) < 0) TEST_ERROR; - if (!H5FD_onion_archival_index_is_valid(&aix)) + if (!H5FD__onion_archival_index_is_valid(&aix)) TEST_ERROR; if (n_insert != aix.n_entries) @@ -671,7 +671,7 @@ test_revision_index_to_archival_index(void) /* CLEANUP */ - if (H5FD_onion_revision_index_destroy(rix_p) < 0) + if (H5FD__onion_revision_index_destroy(rix_p) < 0) TEST_ERROR; H5MM_xfree(aix.list); @@ -680,7 +680,7 @@ test_revision_index_to_archival_index(void) error: if (rix_p) - (void)H5FD_onion_revision_index_destroy(rix_p); + (void)H5FD__onion_revision_index_destroy(rix_p); H5MM_xfree(aix.list); return -1; @@ -894,8 +894,8 @@ test_header_encode_decode(void) 'O', 'H', 'D', 'H', /* NOTE: match signature define in onion_priv.h */ 1, 12, 0, 0, /* NOTE: update version w/ "current" as needed */ 0, 16, 0, 0, 0x11, 0x00, 0, 0, 0x02, 0, 0, 0, /* origin_eof */ - 0x40, 0xe2, 0x01, 0, 0, 0, 0, 0, /* whole_history_addr */ - 88, 0, 0, 0, 0, 0, 0, 0, /* whole_history_size */ + 0x40, 0xe2, 0x01, 0, 0, 0, 0, 0, /* history_addr */ + 88, 0, 0, 0, 0, 0, 0, 0, /* history_size */ 0, 0, 0, 0 /* sum populated below */ }; unsigned char * ptr = NULL; @@ -915,10 +915,10 @@ test_header_encode_decode(void) hdr.version = H5FD__ONION_HEADER_VERSION_CURR; hdr.flags = 12; hdr.origin_eof = 8589934609ull, hdr.page_size = 4096; - hdr.whole_history_addr = 123456; - hdr.whole_history_size = 88; + hdr.history_addr = 123456; + hdr.history_size = 88; - if (H5FD_onion_history_header_encode(&hdr, buf, &sum_out) != H5FD__ONION_ENCODED_SIZE_HEADER) + if (H5FD__onion_history_header_encode(&hdr, buf, &sum_out) != H5FD__ONION_ENCODED_SIZE_HEADER) TEST_ERROR; if (sum != sum_out) @@ -931,11 +931,11 @@ test_header_encode_decode(void) } } - hdr_out.version = H5FD__ONION_HEADER_VERSION_CURR; - hdr_out.flags = 0; - hdr_out.page_size = 0; - hdr_out.whole_history_addr = 0; - hdr_out.whole_history_size = 0; + hdr_out.version = H5FD__ONION_HEADER_VERSION_CURR; + hdr_out.flags = 0; + hdr_out.page_size = 0; + hdr_out.history_addr = 0; + hdr_out.history_size = 0; /* Invalid header signature prevents decoding. */ @@ -943,7 +943,7 @@ test_header_encode_decode(void) exp[3] = 'X'; /* invalidate encoded signature */ H5E_BEGIN_TRY { - size_ret = H5FD_onion_history_header_decode(exp, &hdr_out); + size_ret = H5FD__onion_history_header_decode(exp, &hdr_out); } H5E_END_TRY; if (0 != size_ret) @@ -957,7 +957,7 @@ test_header_encode_decode(void) exp[4] = 0; /* encoded version 0?!? */ H5E_BEGIN_TRY { - size_ret = H5FD_onion_history_header_decode(exp, &hdr_out); + size_ret = H5FD__onion_history_header_decode(exp, &hdr_out); } H5E_END_TRY; if (0 != size_ret) @@ -966,7 +966,7 @@ test_header_encode_decode(void) exp[4] = H5FD__ONION_HEADER_VERSION_CURR + 1; /* encoded super-version?! */ H5E_BEGIN_TRY { - size_ret = H5FD_onion_history_header_decode(exp, &hdr_out); + size_ret = H5FD__onion_history_header_decode(exp, &hdr_out); } H5E_END_TRY; if (0 != size_ret) @@ -977,7 +977,7 @@ test_header_encode_decode(void) /* Valid header can be decoded */ - if (H5FD_onion_history_header_decode(buf, &hdr_out) != H5FD__ONION_ENCODED_SIZE_HEADER) + if (H5FD__onion_history_header_decode(buf, &hdr_out) != H5FD__ONION_ENCODED_SIZE_HEADER) TEST_ERROR; if (H5FD__ONION_HEADER_VERSION_CURR != hdr_out.version) TEST_ERROR; @@ -985,9 +985,9 @@ test_header_encode_decode(void) TEST_ERROR; if (hdr.page_size != hdr_out.page_size) TEST_ERROR; - if (hdr.whole_history_addr != hdr_out.whole_history_addr) + if (hdr.history_addr != hdr_out.history_addr) TEST_ERROR; - if (hdr.whole_history_size != hdr_out.whole_history_size) + if (hdr.history_size != hdr_out.history_size) TEST_ERROR; PASSED(); @@ -998,10 +998,10 @@ error: } /* end test_header_encode_decode() */ /*----------------------------------------------------------------------------- - * Function: test_whole_history_encode_decode_empty() + * Function: test_history_encode_decode_empty() * - * Purpose: Verify onion whole-history encoding and decoding behavior. - * Tests the case of the "empty" whole-history. + * Purpose: Verify onion history encoding and decoding behavior. + * Tests the case of the "empty" history. * Verifies behavior in standard error cases. * * Return: PASSED : 0 @@ -1009,7 +1009,7 @@ error: *----------------------------------------------------------------------------- */ static int -test_whole_history_encode_decode_empty(void) +test_history_encode_decode_empty(void) { unsigned char buf[32]; unsigned char exp[32] = { @@ -1017,30 +1017,30 @@ test_whole_history_encode_decode_empty(void) 1, 0, 0, 0, /* NOTE: update version w/ "current" as needed */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* sum populated below */ }; - unsigned char * ptr = NULL; - uint32_t sum = 0; - uint32_t sum_out = 0; - size_t i = 0; - uint64_t size_ret = 0; - H5FD_onion_whole_history_t whs = { + unsigned char * ptr = NULL; + uint32_t sum = 0; + uint32_t sum_out = 0; + size_t i = 0; + uint64_t size_ret = 0; + H5FD_onion_history_t history = { H5FD__ONION_WHOLE_HISTORY_VERSION_CURR, 0, /* n_revisions */ NULL, /* list */ 0, /* checksum */ }; - H5FD_onion_whole_history_t whs_out = { + H5FD_onion_history_t history_out = { H5FD__ONION_WHOLE_HISTORY_VERSION_CURR, 0, /* n_revisions */ NULL, /* list */ 0, /* checksum */ }; - TESTING("encode/decode whole-history (empty and failures)"); + TESTING("encode/decode history (empty and failures)"); /* Generage checksum but don't store it yet */ sum = H5_checksum_fletcher32(exp, H5FD__ONION_ENCODED_SIZE_WHOLE_HISTORY - 4); ptr = exp + H5FD__ONION_ENCODED_SIZE_WHOLE_HISTORY - 4; UINT32ENCODE(ptr, sum); - if (H5FD_onion_whole_history_encode(&whs, buf, &sum_out) != H5FD__ONION_ENCODED_SIZE_WHOLE_HISTORY) + if (H5FD__onion_history_encode(&history, buf, &sum_out) != H5FD__ONION_ENCODED_SIZE_WHOLE_HISTORY) TEST_ERROR; for (i = 0; i < 20; i++) { if (exp[i] != buf[i]) { @@ -1050,14 +1050,14 @@ test_whole_history_encode_decode_empty(void) } if (sum != sum_out) TEST_ERROR; - whs.checksum = sum; /* set to compare later */ + history.checksum = sum; /* set to compare later */ /* Invalid signature prevents decoding */ exp[3] = 'X'; /* invalidate encoded signature */ H5E_BEGIN_TRY { - size_ret = H5FD_onion_whole_history_decode(exp, &whs_out); + size_ret = H5FD__onion_history_decode(exp, &history_out); } H5E_END_TRY; if (0 != size_ret) @@ -1070,7 +1070,7 @@ test_whole_history_encode_decode_empty(void) exp[4] = 0; /* encoded version 0?!? */ H5E_BEGIN_TRY { - size_ret = H5FD_onion_whole_history_decode(exp, &whs_out); + size_ret = H5FD__onion_history_decode(exp, &history_out); } H5E_END_TRY; if (0 != size_ret) @@ -1079,7 +1079,7 @@ test_whole_history_encode_decode_empty(void) exp[4] = H5FD__ONION_WHOLE_HISTORY_VERSION_CURR + 1; H5E_BEGIN_TRY { - size_ret = H5FD_onion_whole_history_decode(exp, &whs_out); + size_ret = H5FD__onion_history_decode(exp, &history_out); } H5E_END_TRY; if (0 != size_ret) @@ -1089,15 +1089,15 @@ test_whole_history_encode_decode_empty(void) /* Valid summary can be decoded */ - if (H5FD_onion_whole_history_decode(buf, &whs_out) != H5FD__ONION_ENCODED_SIZE_WHOLE_HISTORY) + if (H5FD__onion_history_decode(buf, &history_out) != H5FD__ONION_ENCODED_SIZE_WHOLE_HISTORY) TEST_ERROR; - if (H5FD__ONION_WHOLE_HISTORY_VERSION_CURR != whs_out.version) + if (H5FD__ONION_WHOLE_HISTORY_VERSION_CURR != history_out.version) TEST_ERROR; - if (whs.n_revisions != whs_out.n_revisions) + if (history.n_revisions != history_out.n_revisions) TEST_ERROR; - if (whs.checksum != whs_out.checksum) + if (history.checksum != history_out.checksum) TEST_ERROR; - if (NULL != whs_out.record_pointer_list) + if (NULL != history_out.record_locs) TEST_ERROR; PASSED(); @@ -1105,12 +1105,12 @@ test_whole_history_encode_decode_empty(void) error: return -1; -} /* end test_whole_history_encode_decode_empty() */ +} /* end test_history_encode_decode_empty() */ /*----------------------------------------------------------------------------- - * Function: test_whole_history_encode_decode() + * Function: test_history_encode_decode() * - * Purpose: Verify onion whole-history encoding and decoding behavior. + * Purpose: Verify onion history encoding and decoding behavior. * Encode/decode with some set of revision record pointers. * * Return: PASSED : 0 @@ -1118,7 +1118,7 @@ error: *----------------------------------------------------------------------------- */ static int -test_whole_history_encode_decode(void) +test_history_encode_decode(void) { unsigned char *buf = NULL; unsigned char exp[80] = { @@ -1134,100 +1134,100 @@ test_whole_history_encode_decode(void) /* final checksum */ 0, 0, 0, 0 /* sum populated below */ }; - unsigned char * buf_p = NULL; - uint32_t sum_out = 0; - size_t i = 0; - H5FD_onion_whole_history_t whs = { + unsigned char * buf_p = NULL; + uint32_t sum_out = 0; + size_t i = 0; + H5FD_onion_history_t history = { H5FD__ONION_WHOLE_HISTORY_VERSION_CURR, 3, /* n_revisions */ NULL, /* list set below */ 0, /* checksum not set by us */ }; - H5FD_onion_whole_history_t whs_out = { + H5FD_onion_history_t history_out = { H5FD__ONION_WHOLE_HISTORY_VERSION_CURR, 0, /* n_revisions must start as zero */ NULL, /* list */ 0, /* checksum */ }; - uint64_t exp_size = - H5FD__ONION_ENCODED_SIZE_WHOLE_HISTORY + H5FD__ONION_ENCODED_SIZE_RECORD_POINTER * whs.n_revisions; + uint64_t exp_size = H5FD__ONION_ENCODED_SIZE_WHOLE_HISTORY + + H5FD__ONION_ENCODED_SIZE_RECORD_POINTER * history.n_revisions; - TESTING("encode/decode whole-history"); + TESTING("encode/decode history"); if (80 != exp_size) TEST_ERROR; - whs.record_pointer_list = HDcalloc(whs.n_revisions, sizeof(H5FD_onion_record_pointer_t)); - if (NULL == whs.record_pointer_list) + history.record_locs = HDcalloc(history.n_revisions, sizeof(H5FD_onion_record_loc_t)); + if (NULL == history.record_locs) TEST_ERROR; - /* must match values in exp */ - whs.record_pointer_list[0].phys_addr = 568ull; - whs.record_pointer_list[0].record_size = 238ull; - whs.record_pointer_list[1].phys_addr = 241017ull; - whs.record_pointer_list[1].record_size = 4555ull; - whs.record_pointer_list[2].phys_addr = 918153371232ull; - whs.record_pointer_list[2].record_size = 240ull; + /* Must match values in exp */ + history.record_locs[0].phys_addr = 568ull; + history.record_locs[0].record_size = 238ull; + history.record_locs[1].phys_addr = 241017ull; + history.record_locs[1].record_size = 4555ull; + history.record_locs[2].phys_addr = 918153371232ull; + history.record_locs[2].record_size = 240ull; /* Populate revision pointer sums in exp */ - for (i = 0; i < whs.n_revisions; i++) { - uint64_t whs_pre = H5FD__ONION_ENCODED_SIZE_WHOLE_HISTORY - 4; - uint64_t ptr_pre = H5FD__ONION_ENCODED_SIZE_RECORD_POINTER - 4; - uint64_t ptr_size = H5FD__ONION_ENCODED_SIZE_RECORD_POINTER; + for (i = 0; i < history.n_revisions; i++) { + uint64_t history_pre = H5FD__ONION_ENCODED_SIZE_WHOLE_HISTORY - 4; + uint64_t ptr_pre = H5FD__ONION_ENCODED_SIZE_RECORD_POINTER - 4; + uint64_t ptr_size = H5FD__ONION_ENCODED_SIZE_RECORD_POINTER; - buf_p = exp + whs_pre + ptr_size * i; - whs.record_pointer_list[i].checksum = H5_checksum_fletcher32(buf_p, ptr_pre); + buf_p = exp + history_pre + ptr_size * i; + history.record_locs[i].checksum = H5_checksum_fletcher32(buf_p, ptr_pre); buf_p += ptr_pre; - UINT32ENCODE(buf_p, whs.record_pointer_list[i].checksum); + UINT32ENCODE(buf_p, history.record_locs[i].checksum); } /* Compute, populate, and store exp final sum */ - whs.checksum = H5_checksum_fletcher32(exp, exp_size - 4); - buf_p = exp + exp_size - 4; - UINT32ENCODE(buf_p, whs.checksum); + history.checksum = H5_checksum_fletcher32(exp, exp_size - 4); + buf_p = exp + exp_size - 4; + UINT32ENCODE(buf_p, history.checksum); if (NULL == (buf = HDmalloc(exp_size))) TEST_ERROR; - if (H5FD_onion_whole_history_encode(&whs, buf, &sum_out) != exp_size) + if (H5FD__onion_history_encode(&history, buf, &sum_out) != exp_size) TEST_ERROR; for (i = 0; i < exp_size; i++) { if (exp[i] != buf[i]) TEST_ERROR; } - if (whs.checksum != sum_out) + if (history.checksum != sum_out) TEST_ERROR; /* Initial decode, gets always-present components */ - whs_out.n_revisions = 0; /* must be initialized to 0 */ - if (H5FD_onion_whole_history_decode(exp, &whs_out) != exp_size) + history_out.n_revisions = 0; /* must be initialized to 0 */ + if (H5FD__onion_history_decode(exp, &history_out) != exp_size) TEST_ERROR; - if (H5FD__ONION_WHOLE_HISTORY_VERSION_CURR != whs_out.version) + if (H5FD__ONION_WHOLE_HISTORY_VERSION_CURR != history_out.version) TEST_ERROR; - if (whs.n_revisions != whs_out.n_revisions) + if (history.n_revisions != history_out.n_revisions) TEST_ERROR; /* Must be created by us */ - if (NULL != whs_out.record_pointer_list) + if (NULL != history_out.record_locs) TEST_ERROR; /* True decode requires allocating space for record pointers */ - whs_out.record_pointer_list = HDcalloc(whs_out.n_revisions, sizeof(H5FD_onion_record_pointer_t)); - if (NULL == whs_out.record_pointer_list) + history_out.record_locs = HDcalloc(history_out.n_revisions, sizeof(H5FD_onion_record_loc_t)); + if (NULL == history_out.record_locs) TEST_ERROR; - if (H5FD_onion_whole_history_decode(exp, &whs_out) != exp_size) + if (H5FD__onion_history_decode(exp, &history_out) != exp_size) TEST_ERROR; - if (H5FD__ONION_WHOLE_HISTORY_VERSION_CURR != whs_out.version) + if (H5FD__ONION_WHOLE_HISTORY_VERSION_CURR != history_out.version) TEST_ERROR; - if (whs.n_revisions != whs_out.n_revisions) + if (history.n_revisions != history_out.n_revisions) TEST_ERROR; - if (whs.checksum != whs_out.checksum) + if (history.checksum != history_out.checksum) TEST_ERROR; - if (NULL == whs_out.record_pointer_list) + if (NULL == history_out.record_locs) TEST_ERROR; - for (i = 0; i < whs.n_revisions; i++) { - H5FD_onion_record_pointer_t exp_rp = whs.record_pointer_list[i]; - H5FD_onion_record_pointer_t act_rp = whs_out.record_pointer_list[i]; + for (i = 0; i < history.n_revisions; i++) { + H5FD_onion_record_loc_t exp_rp = history.record_locs[i]; + H5FD_onion_record_loc_t act_rp = history_out.record_locs[i]; if (exp_rp.phys_addr != act_rp.phys_addr) TEST_ERROR; @@ -1237,20 +1237,20 @@ test_whole_history_encode_decode(void) TEST_ERROR; } - HDfree(whs_out.record_pointer_list); + HDfree(history_out.record_locs); HDfree(buf); - HDfree(whs.record_pointer_list); + HDfree(history.record_locs); PASSED(); return 0; error: - HDfree(whs_out.record_pointer_list); + HDfree(history_out.record_locs); HDfree(buf); - HDfree(whs.record_pointer_list); + HDfree(history.record_locs); return -1; -} /* end test_whole_history_encode_decode() */ +} /* end test_history_encode_decode() */ /*----------------------------------------------------------------------------- * @@ -1380,7 +1380,7 @@ test_revision_record_encode_decode(void) /* Test encode */ - if (H5FD_onion_revision_record_encode(&record, buf, &sum_out) != exp_size) + if (H5FD__onion_revision_record_encode(&record, buf, &sum_out) != exp_size) TEST_ERROR; hbool_t badness = FALSE; @@ -1419,7 +1419,7 @@ test_revision_record_encode_decode(void) exp[2] = 'Y'; H5E_BEGIN_TRY { - size_ret = H5FD_onion_revision_record_decode(exp, &r_out); + size_ret = H5FD__onion_revision_record_decode(exp, &r_out); } H5E_END_TRY; if (0 != size_ret) @@ -1430,7 +1430,7 @@ test_revision_record_encode_decode(void) exp[4] = 0; H5E_BEGIN_TRY { - size_ret = H5FD_onion_revision_record_decode(exp, &r_out); + size_ret = H5FD__onion_revision_record_decode(exp, &r_out); } H5E_END_TRY; if (0 != size_ret) @@ -1440,7 +1440,7 @@ test_revision_record_encode_decode(void) exp[4] = H5FD__ONION_REVISION_RECORD_VERSION_CURR + 1; H5E_BEGIN_TRY { - size_ret = H5FD_onion_revision_record_decode(exp, &r_out); + size_ret = H5FD__onion_revision_record_decode(exp, &r_out); } H5E_END_TRY; if (0 != size_ret) @@ -1450,7 +1450,7 @@ test_revision_record_encode_decode(void) /* Test successful decode */ /* Initial decode; get variable-length component sizes */ - if (H5FD_onion_revision_record_decode(exp, &r_out) != exp_size) + if (H5FD__onion_revision_record_decode(exp, &r_out) != exp_size) TEST_ERROR; if (record.comment_size != r_out.comment_size) TEST_ERROR; @@ -1466,7 +1466,7 @@ test_revision_record_encode_decode(void) TEST_ERROR; /* Decode into all components */ - if (H5FD_onion_revision_record_decode(exp, &r_out) != exp_size) + if (H5FD__onion_revision_record_decode(exp, &r_out) != exp_size) TEST_ERROR; if (H5FD__ONION_REVISION_RECORD_VERSION_CURR != r_out.version) TEST_ERROR; @@ -1590,7 +1590,7 @@ verify_history_as_expected_onion(H5FD_t *raw_file, struct expected_history *filt { unsigned char * buf = NULL; /* allocated area for actual file bytes */ H5FD_onion_history_header_t hdr_out; - H5FD_onion_whole_history_t whs_out; + H5FD_onion_history_t history_out; H5FD_onion_revision_record_t rev_out; uint64_t filesize = 0; uint64_t readsize = 0; @@ -1598,9 +1598,9 @@ verify_history_as_expected_onion(H5FD_t *raw_file, struct expected_history *filt hdr_out.version = H5FD__ONION_HEADER_VERSION_CURR; - whs_out.version = H5FD__ONION_WHOLE_HISTORY_VERSION_CURR; - whs_out.n_revisions = 0; - whs_out.record_pointer_list = NULL; + history_out.version = H5FD__ONION_WHOLE_HISTORY_VERSION_CURR; + history_out.n_revisions = 0; + history_out.record_locs = NULL; rev_out.version = H5FD__ONION_REVISION_RECORD_VERSION_CURR; rev_out.archival_index.version = H5FD__ONION_ARCHIVAL_INDEX_VERSION_CURR; @@ -1617,7 +1617,7 @@ verify_history_as_expected_onion(H5FD_t *raw_file, struct expected_history *filt if (H5FDread(raw_file, H5FD_MEM_DRAW, H5P_DEFAULT, 0, readsize, buf) < 0) TEST_ERROR; - readsize = H5FD_onion_history_header_decode(buf, &hdr_out); + readsize = H5FD__onion_history_header_decode(buf, &hdr_out); if (0 == readsize) TEST_ERROR; if (H5FD__ONION_HEADER_VERSION_CURR != hdr_out.version) @@ -1628,7 +1628,7 @@ verify_history_as_expected_onion(H5FD_t *raw_file, struct expected_history *filt TEST_ERROR; if (filter->page_size != hdr_out.page_size) TEST_ERROR; - if (hdr_out.whole_history_addr + hdr_out.whole_history_size != filesize) + if (hdr_out.history_addr + hdr_out.history_size != filesize) TEST_ERROR; if (filter->origin_eof != hdr_out.origin_eof) TEST_ERROR; @@ -1636,42 +1636,42 @@ verify_history_as_expected_onion(H5FD_t *raw_file, struct expected_history *filt HDfree(buf); buf = NULL; - /* Ingest whole-history */ + /* Ingest history */ - readsize = hdr_out.whole_history_size; + readsize = hdr_out.history_size; if (NULL == (buf = HDmalloc(readsize * sizeof(unsigned char)))) TEST_ERROR; - if (H5FDread(raw_file, H5FD_MEM_DRAW, H5P_DEFAULT, hdr_out.whole_history_addr, readsize, buf) < 0) + if (H5FDread(raw_file, H5FD_MEM_DRAW, H5P_DEFAULT, hdr_out.history_addr, readsize, buf) < 0) TEST_ERROR; /* Initial read, get count of revisions */ - readsize = H5FD_onion_whole_history_decode(buf, &whs_out); + readsize = H5FD__onion_history_decode(buf, &history_out); if (0 == readsize) TEST_ERROR; - if (H5FD__ONION_WHOLE_HISTORY_VERSION_CURR != whs_out.version) + if (H5FD__ONION_WHOLE_HISTORY_VERSION_CURR != history_out.version) TEST_ERROR; - if (HDmemcmp(&whs_out.checksum, &buf[readsize - 4], 4) != 0) + if (HDmemcmp(&history_out.checksum, &buf[readsize - 4], 4) != 0) TEST_ERROR; - if (whs_out.checksum != H5_checksum_fletcher32(buf, readsize - 4)) + if (history_out.checksum != H5_checksum_fletcher32(buf, readsize - 4)) TEST_ERROR; - if (filter->n_revisions != whs_out.n_revisions) + if (filter->n_revisions != history_out.n_revisions) TEST_ERROR; /* Final read, populate pointers to revision records */ - whs_out.record_pointer_list = HDcalloc(whs_out.n_revisions, sizeof(H5FD_onion_record_pointer_t)); - if (NULL == whs_out.record_pointer_list) + history_out.record_locs = HDcalloc(history_out.n_revisions, sizeof(H5FD_onion_record_loc_t)); + if (NULL == history_out.record_locs) TEST_ERROR; - if (H5FD_onion_whole_history_decode(buf, &whs_out) != readsize) + if (H5FD__onion_history_decode(buf, &history_out) != readsize) TEST_ERROR; /* Re-use buffer space to sanity-check checksum for record pointer(s). */ - HDassert(readsize >= sizeof(H5FD_onion_record_pointer_t)); - for (i = 0; i < whs_out.n_revisions; i++) { + HDassert(readsize >= sizeof(H5FD_onion_record_loc_t)); + for (i = 0; i < history_out.n_revisions; i++) { - HDmemcpy(buf, &whs_out.record_pointer_list[i].phys_addr, 8); - HDmemcpy(buf + 8, &whs_out.record_pointer_list[i].record_size, 8); + HDmemcpy(buf, &history_out.record_locs[i].phys_addr, 8); + HDmemcpy(buf + 8, &history_out.record_locs[i].record_size, 8); - if (whs_out.record_pointer_list[i].checksum != H5_checksum_fletcher32(buf, 16)) + if (history_out.record_locs[i].checksum != H5_checksum_fletcher32(buf, 16)) TEST_ERROR; } @@ -1680,9 +1680,9 @@ verify_history_as_expected_onion(H5FD_t *raw_file, struct expected_history *filt /* Ingest revision(s) */ - for (i = 0; i < whs_out.n_revisions; i++) { - H5FD_onion_record_pointer_t *rpp = &whs_out.record_pointer_list[i]; - struct expected_revision * erp = &filter->revisions[i]; + for (i = 0; i < history_out.n_revisions; i++) { + H5FD_onion_record_loc_t * rpp = &history_out.record_locs[i]; + struct expected_revision *erp = &filter->revisions[i]; rev_out.archival_index.list = NULL; rev_out.archival_index.n_entries = 0; @@ -1697,7 +1697,7 @@ verify_history_as_expected_onion(H5FD_t *raw_file, struct expected_history *filt TEST_ERROR; /* Initial revision read -- get fixed components */ - readsize = H5FD_onion_revision_record_decode(buf, &rev_out); + readsize = H5FD__onion_revision_record_decode(buf, &rev_out); if (0 == readsize) TEST_ERROR; if (rpp->record_size != readsize) @@ -1723,7 +1723,7 @@ verify_history_as_expected_onion(H5FD_t *raw_file, struct expected_history *filt if (NULL == rev_out.archival_index.list) TEST_ERROR; - readsize = H5FD_onion_revision_record_decode(buf, &rev_out); + readsize = H5FD__onion_revision_record_decode(buf, &rev_out); if (rpp->record_size != readsize) TEST_ERROR; @@ -1747,8 +1747,8 @@ verify_history_as_expected_onion(H5FD_t *raw_file, struct expected_history *filt HDfree(rev_out.archival_index.list); } - HDfree(whs_out.record_pointer_list); - whs_out.record_pointer_list = NULL; + HDfree(history_out.record_locs); + history_out.record_locs = NULL; return 0; @@ -1756,7 +1756,7 @@ error: HDfree(buf); HDfree(rev_out.comment); HDfree(rev_out.archival_index.list); - HDfree(whs_out.record_pointer_list); + HDfree(history_out.record_locs); return -1; @@ -1770,7 +1770,7 @@ error: * + open (not yet written) * + "Empty" .h5 file created * + .onion file created w/ only header (0 whole-hist addr) - * + .onion.recovery created w/ "empty" whole-history + * + .onion.recovery created w/ "empty" history * + Cannot open onionized canonical file (incomplete history, no rev) * * Inspect file contents on backing store. @@ -1789,8 +1789,8 @@ verify_stored_onion_create_0_open(struct onion_filepaths *paths, H5FD_onion_fapl 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* checksum encoded below */ }; - size_t whs_exp_bytes_size = 20; - unsigned char whs_exp_bytes[] = { + size_t history_exp_bytes_size = 20; + unsigned char history_exp_bytes[] = { 'O', 'W', 'H', 'S', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* checksum encoded below */ }; unsigned char *ptr = NULL; @@ -1811,9 +1811,9 @@ verify_stored_onion_create_0_open(struct onion_filepaths *paths, H5FD_onion_fapl UINT32ENCODE(ptr, sum); ptr = NULL; - /* Finish populating expected whole-history bytes */ - sum = H5_checksum_fletcher32(whs_exp_bytes, H5FD__ONION_ENCODED_SIZE_WHOLE_HISTORY - 4); - ptr = whs_exp_bytes + H5FD__ONION_ENCODED_SIZE_WHOLE_HISTORY - 4; + /* Finish populating expected history bytes */ + sum = H5_checksum_fletcher32(history_exp_bytes, H5FD__ONION_ENCODED_SIZE_WHOLE_HISTORY - 4); + ptr = history_exp_bytes + H5FD__ONION_ENCODED_SIZE_WHOLE_HISTORY - 4; UINT32ENCODE(ptr, sum); ptr = NULL; @@ -1847,8 +1847,8 @@ verify_stored_onion_create_0_open(struct onion_filepaths *paths, H5FD_onion_fapl if (compare_file_bytes_exactly(paths->onion, fapl_id, H5FD__ONION_ENCODED_SIZE_HEADER, hdr_exp_bytes) < 0) TEST_ERROR; - /* Look at history backing file: should have nascent whole-history */ - if (compare_file_bytes_exactly(paths->recovery, fapl_id, whs_exp_bytes_size, whs_exp_bytes) < 0) + /* Look at history backing file: should have nascent history */ + if (compare_file_bytes_exactly(paths->recovery, fapl_id, history_exp_bytes_size, history_exp_bytes) < 0) TEST_ERROR; /* Inspect .h5 file contents */ @@ -2213,15 +2213,15 @@ test_several_revisions_with_logical_gaps(void) 0, /* flags */ "first" /* comment */ }; - H5FD_t * file = NULL; /* Onion virtual file for read/write */ - struct expected_history filter; - unsigned char * buf = NULL; - struct revise_revision about[4]; - H5FD_onion_whole_history_t whs_out; - size_t i = 0; - haddr_t size = 0; - uint64_t a_off = ONION_TEST_PAGE_SIZE_5 + 7; /* 39 */ - uint64_t b_off = (((a_off + a_list_size_s + ONION_TEST_PAGE_SIZE_5 - 1) >> 5) << 5) + + H5FD_t * file = NULL; /* Onion virtual file for read/write */ + struct expected_history filter; + unsigned char * buf = NULL; + struct revise_revision about[4]; + H5FD_onion_history_t history_out; + size_t i = 0; + haddr_t size = 0; + uint64_t a_off = ONION_TEST_PAGE_SIZE_5 + 7; /* 39 */ + uint64_t b_off = (((a_off + a_list_size_s + ONION_TEST_PAGE_SIZE_5 - 1) >> 5) << 5) + ONION_TEST_PAGE_SIZE_5 + 7; /* full page between */ TESTING("multiple revisions with gaps and overlap"); @@ -2230,9 +2230,9 @@ test_several_revisions_with_logical_gaps(void) * SETUP * *********/ - whs_out.version = H5FD__ONION_WHOLE_HISTORY_VERSION_CURR; - whs_out.n_revisions = 0; - whs_out.record_pointer_list = NULL; + history_out.version = H5FD__ONION_WHOLE_HISTORY_VERSION_CURR; + history_out.n_revisions = 0; + history_out.record_locs = NULL; onion_info.backing_fapl_id = h5_fileaccess(); @@ -2516,7 +2516,7 @@ error: onion_filepaths_destroy(paths); } - HDfree(whs_out.record_pointer_list); + HDfree(history_out.record_locs); HDfree(buf); if (file != NULL) @@ -2662,7 +2662,7 @@ test_page_aligned_history_create(void) unsigned char * buf = NULL; struct revise_revision about[2]; H5FD_onion_history_header_t hdr_out; - H5FD_onion_whole_history_t whs_out; + H5FD_onion_history_t history_out; size_t i = 0; uint64_t a_off = b_list_size_s - a_list_size_s; @@ -2672,10 +2672,10 @@ test_page_aligned_history_create(void) * SETUP * *********/ - hdr_out.version = H5FD__ONION_HEADER_VERSION_CURR; - whs_out.version = H5FD__ONION_WHOLE_HISTORY_VERSION_CURR; - whs_out.n_revisions = 0; - whs_out.record_pointer_list = NULL; + hdr_out.version = H5FD__ONION_HEADER_VERSION_CURR; + history_out.version = H5FD__ONION_WHOLE_HISTORY_VERSION_CURR; + history_out.n_revisions = 0; + history_out.record_locs = NULL; onion_info.backing_fapl_id = h5_fileaccess(); fapl_id = H5Pcreate(H5P_FILE_ACCESS); @@ -2760,39 +2760,38 @@ test_page_aligned_history_create(void) TEST_ERROR; if (H5FDread(file, H5FD_MEM_DRAW, H5P_DEFAULT, 0, H5FD__ONION_ENCODED_SIZE_HEADER, buf) < 0) TEST_ERROR; - if (H5FD_onion_history_header_decode(buf, &hdr_out) != H5FD__ONION_ENCODED_SIZE_HEADER) + if (H5FD__onion_history_header_decode(buf, &hdr_out) != H5FD__ONION_ENCODED_SIZE_HEADER) TEST_ERROR; - if (hdr_out.whole_history_addr & ((1 << 5) - 1)) /* 5::PAGE_SIZE_5 */ + if (hdr_out.history_addr & ((1 << 5) - 1)) /* 5::PAGE_SIZE_5 */ TEST_ERROR; HDfree(buf); buf = NULL; - if (NULL == (buf = HDmalloc(hdr_out.whole_history_size))) + if (NULL == (buf = HDmalloc(hdr_out.history_size))) TEST_ERROR; - if (H5FDread(file, H5FD_MEM_DRAW, H5P_DEFAULT, hdr_out.whole_history_addr, hdr_out.whole_history_size, - buf) < 0) + if (H5FDread(file, H5FD_MEM_DRAW, H5P_DEFAULT, hdr_out.history_addr, hdr_out.history_size, buf) < 0) TEST_ERROR; - if (H5FD_onion_whole_history_decode(buf, &whs_out) != hdr_out.whole_history_size) + if (H5FD__onion_history_decode(buf, &history_out) != hdr_out.history_size) TEST_ERROR; - if (whs_out.n_revisions != 2) + if (history_out.n_revisions != 2) TEST_ERROR; - whs_out.record_pointer_list = HDcalloc(whs_out.n_revisions, sizeof(H5FD_onion_record_pointer_t)); - if (NULL == whs_out.record_pointer_list) + history_out.record_locs = HDcalloc(history_out.n_revisions, sizeof(H5FD_onion_record_loc_t)); + if (NULL == history_out.record_locs) TEST_ERROR; - if (H5FD_onion_whole_history_decode(buf, &whs_out) != hdr_out.whole_history_size) + if (H5FD__onion_history_decode(buf, &history_out) != hdr_out.history_size) TEST_ERROR; HDfree(buf); buf = NULL; - for (i = 0; i < whs_out.n_revisions; i++) { - H5FD_onion_record_pointer_t *rr_p = &whs_out.record_pointer_list[i]; - if (rr_p->phys_addr & ((1 << 5) - 1)) /* 5::PAGE_SIZE_5 */ + for (i = 0; i < history_out.n_revisions; i++) { + H5FD_onion_record_loc_t *rloc = &history_out.record_locs[i]; + if (rloc->phys_addr & ((1 << 5) - 1)) /* 5::PAGE_SIZE_5 */ TEST_ERROR; /* TODO: check phys_addr of each page entry? */ } - HDfree(whs_out.record_pointer_list); - whs_out.record_pointer_list = NULL; + HDfree(history_out.record_locs); + history_out.record_locs = NULL; if (H5FDclose(file) < 0) TEST_ERROR; @@ -2823,7 +2822,7 @@ error: onion_filepaths_destroy(paths); } - HDfree(whs_out.record_pointer_list); + HDfree(history_out.record_locs); HDfree(buf); if (file != NULL) @@ -4631,8 +4630,8 @@ main(void) nerrors -= test_revision_index_to_archival_index(); nerrors -= test_fapl(); nerrors -= test_header_encode_decode(); - nerrors -= test_whole_history_encode_decode_empty(); - nerrors -= test_whole_history_encode_decode(); + nerrors -= test_history_encode_decode_empty(); + nerrors -= test_history_encode_decode(); nerrors -= test_revision_record_encode_decode(); nerrors -= test_create_oniontarget(FALSE, FALSE); nerrors -= test_create_oniontarget(TRUE, FALSE); |