diff options
author | github-actions <41898282+github-actions[bot]@users.noreply.github.com> | 2021-11-17 21:24:30 (GMT) |
---|---|---|
committer | github-actions <41898282+github-actions[bot]@users.noreply.github.com> | 2021-11-17 21:24:30 (GMT) |
commit | 8cf9ba4a46e546a9c826709a83e7dce85ab9d177 (patch) | |
tree | 43cf7a2d2e3abe128bf0fa70bed08f9941c57e77 | |
parent | 59ab76ecc60877af53126ed854358d987b56dd97 (diff) | |
download | hdf5-8cf9ba4a46e546a9c826709a83e7dce85ab9d177.zip hdf5-8cf9ba4a46e546a9c826709a83e7dce85ab9d177.tar.gz hdf5-8cf9ba4a46e546a9c826709a83e7dce85ab9d177.tar.bz2 |
Committing clang-format changes
-rw-r--r-- | src/H5FDonion.c | 54 | ||||
-rw-r--r-- | test/onion.c | 125 |
2 files changed, 90 insertions, 89 deletions
diff --git a/src/H5FDonion.c b/src/H5FDonion.c index 73d4dda..5cd5179 100644 --- a/src/H5FDonion.c +++ b/src/H5FDonion.c @@ -1975,8 +1975,8 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma hdr_p->flags |= H5FD__ONION_HEADER_FLAG_DIVERGENT_HISTORY; if (H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_PAGE_ALIGNMENT & file->fa.creation_flags) { hdr_p->flags |= H5FD__ONION_HEADER_FLAG_PAGE_ALIGNMENT; - file->page_align_history = TRUE; - } + file->page_align_history = TRUE; + } if (HADDR_UNDEF == (canon_eof = H5FD_get_eof(file->backing_canon, H5FD_MEM_DEFAULT))) { HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "cannot get size of canonical file") @@ -2058,14 +2058,14 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma } } -//// - haddr_t canon_eof = 0; - if (HADDR_UNDEF == (canon_eof = H5FD_get_eof(file->backing_canon, H5FD_MEM_DEFAULT))) { - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "cannot get size of canonical file") + //// + haddr_t canon_eof = 0; + if (HADDR_UNDEF == (canon_eof = H5FD_get_eof(file->backing_canon, H5FD_MEM_DEFAULT))) { + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "cannot get size of canonical file") } if (H5FD_set_eoa(file->backing_canon, H5FD_MEM_DRAW, canon_eof) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't extend EOA") -//// + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't extend EOA") + //// /* Get the history header from the onion file */ if (H5FD__onion_ingest_history_header(&file->header, file->backing_onion, 0) < 0) @@ -2085,7 +2085,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get whole-history from backing store") /* Sanity check on revision ID */ - //if (fa->revision_id >= file->summary.n_revisions && + // if (fa->revision_id >= file->summary.n_revisions && if (fa->revision_id > file->summary.n_revisions && fa->revision_id != H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "target revision ID out of range") @@ -2093,8 +2093,9 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma if (file->summary.n_revisions > 0 && H5FD__onion_ingest_revision_record(&file->rev_record, file->backing_onion, &file->summary, MIN(fa->revision_id, (file->summary.n_revisions))) < 0) - //H5FD__onion_ingest_revision_record(&file->rev_record, file->backing_onion, &file->summary, - // MIN(fa->revision_id, (file->summary.n_revisions - 1))) < 0) + // H5FD__onion_ingest_revision_record(&file->rev_record, file->backing_onion, &file->summary, + // MIN(fa->revision_id, (file->summary.n_revisions - 1))) < + // 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get revision record from backing store") if (H5F_ACC_RDWR & flags) @@ -2262,7 +2263,7 @@ static herr_t H5FD__onion_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t offset, size_t len, void *_buf_out) { -HDputs("\n\nonion_read\n\n"); + HDputs("\n\nonion_read\n\n"); H5FD_onion_t * file = (H5FD_onion_t *)_file; uint64_t page_0 = 0; size_t n_pages = 0; @@ -2289,7 +2290,7 @@ HDputs("\n\nonion_read\n\n"); page_size_log2 = file->rev_record.archival_index.page_size_log2; page_0 = offset >> page_size_log2; n_pages = (len + page_size - 1) >> page_size_log2; -HDprintf("n_pages: %d\n", n_pages); + HDprintf("n_pages: %d\n", n_pages); /* Read, page-by-page */ for (i = 0; i < n_pages; i++) { @@ -2301,31 +2302,34 @@ HDprintf("n_pages: %d\n", n_pages); if (0 == i) { page_gap_head = offset & (((uint32_t)1 << page_size_log2) - 1); - // Check if we need to add an additional page to make up for the page_gap_head - if (page_gap_head > 0 && (page_gap_head + (bytes_to_read % page_size) > page_size || bytes_to_read % page_size == 0)) { - n_pages++; -HDputs("Incremented n_pages"); - } - } + // Check if we need to add an additional page to make up for the page_gap_head + if (page_gap_head > 0 && + (page_gap_head + (bytes_to_read % page_size) > page_size || bytes_to_read % page_size == 0)) { + n_pages++; + HDputs("Incremented n_pages"); + } + } if (n_pages - 1 == i) { page_gap_tail = page_size - bytes_to_read - page_gap_head; -HDprintf("Last page?: %d\n", i); - } + HDprintf("Last page?: %d\n", i); + } page_readsize = (size_t)page_size - page_gap_head - page_gap_tail; if (TRUE == file->is_open_rw && H5FD_onion_revision_index_find(file->rev_index, page_i, &entry_out_p)) { -HDputs("READING from revision index"); -HDprintf("page_size: %llu, page_gap_head: %llu, page_gap_tail: %llu, page_readsize: %llu\n", page_size, page_gap_head, page_gap_tail, page_readsize); + HDputs("READING from revision index"); + HDprintf("page_size: %llu, page_gap_head: %llu, page_gap_tail: %llu, page_readsize: %llu\n", + page_size, page_gap_head, page_gap_tail, page_readsize); if (H5FDread(file->backing_onion, H5FD_MEM_DRAW, H5P_DEFAULT, (haddr_t)entry_out_p->phys_addr + page_gap_head, page_readsize, buf_out) < 0) HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get working file data") } /* end if page exists in 'live' revision index */ else if (H5FD_onion_archival_index_find(&file->rev_record.archival_index, page_i, &entry_out_p)) { -HDputs("READING from archival index"); -HDprintf("page_size: %llu, page_gap_head: %llu, page_gap_tail: %llu, page_readsize: %llu\n", page_size, page_gap_head, page_gap_tail, page_readsize); + HDputs("READING from archival index"); + HDprintf("page_size: %llu, page_gap_head: %llu, page_gap_tail: %llu, page_readsize: %llu\n", + page_size, page_gap_head, page_gap_tail, page_readsize); if (H5FDread(file->backing_onion, H5FD_MEM_DRAW, H5P_DEFAULT, (haddr_t)entry_out_p->phys_addr + page_gap_head, page_readsize, buf_out) < 0) HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get previously-amended file data") diff --git a/test/onion.c b/test/onion.c index 9d711ce..e92a148 100644 --- a/test/onion.c +++ b/test/onion.c @@ -2992,9 +2992,9 @@ test_integration_create(void) ONION_TEST_PAGE_SIZE_5, /* page_size */ H5FD_ONION_STORE_TARGET_ONION, /* store_target */ H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST, - 0, /* force_write_open */ - 0, /* creation flags, was H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_PAGE_ALIGNMENT */ - "initial commit" /* comment */ + 0, /* force_write_open */ + 0, /* creation flags, was H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_PAGE_ALIGNMENT */ + "initial commit" /* comment */ }; hid_t file_id = H5I_INVALID_HID; @@ -3161,14 +3161,13 @@ test_integration_create(void) for (j = 0; j < 7; j++) dset_data[i][j] = i * 6 + j + 1; + for (i = 0; i < 4; i++) { + printf(" ["); + for (j = 0; j < 7; j++) + printf(" %3d", dset_data[i][j]); + printf("]\n"); + } - for (i = 0; i < 4; i++) { - printf(" ["); - for (j = 0; j < 7; j++) - printf(" %3d", dset_data[i][j]); - printf("]\n"); - } - HDputs("."); HDfflush(stdout); if (H5Dwrite(dset, H5T_STD_I32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data) < 0) @@ -3186,8 +3185,7 @@ test_integration_create(void) TEST_ERROR file_id = H5I_INVALID_HID; - -////////////////// + ////////////////// HDputs("."); fflush(stdout); @@ -3214,17 +3212,17 @@ test_integration_create(void) HDputs("."); HDfflush(stdout); - //dset_data[4][7]; + // dset_data[4][7]; for (i = 0; i < 4; i++) for (j = 0; j < 7; j++) dset_data[i][j] = i * 3 + j + 5; - for (i = 0; i < 4; i++) { - printf(" ["); - for (j = 0; j < 7; j++) - printf(" %3d", dset_data[i][j]); - printf("]\n"); - } + for (i = 0; i < 4; i++) { + printf(" ["); + for (j = 0; j < 7; j++) + printf(" %3d", dset_data[i][j]); + printf("]\n"); + } HDputs("."); HDfflush(stdout); @@ -3250,17 +3248,16 @@ test_integration_create(void) TEST_ERROR; fapl_id = H5I_INVALID_HID; - - // Read back data to check for validtiy - onion_info.revision_id = 2; - //onion_info.revision_id = 1; - fapl_id = H5Pcreate(H5P_FILE_ACCESS); + // Read back data to check for validtiy + onion_info.revision_id = 2; + // onion_info.revision_id = 1; + fapl_id = H5Pcreate(H5P_FILE_ACCESS); if (H5I_INVALID_HID == fapl_id) TEST_ERROR; if (H5Pset_fapl_onion(fapl_id, &onion_info) < 0) TEST_ERROR; - - HDputs("."); + + HDputs("."); fflush(stdout); file_id = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id); @@ -3282,38 +3279,38 @@ test_integration_create(void) } HDputs("."); - HDputs("\n\nREADING\n\n"); + HDputs("\n\nREADING\n\n"); + HDfflush(stdout); + int rdata[4][7]; + if (H5Dread(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]) < 0) + TEST_ERROR + + HDputs("\n\nDONE READING\n\n"); HDfflush(stdout); - int rdata[4][7]; - if (H5Dread(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]) < 0) - TEST_ERROR - - HDputs("\n\nDONE READING\n\n"); - HDfflush(stdout); - - for (i = 0; i < 4; i++) { - printf(" ["); - for (j = 0; j < 7; j++) - printf(" %3d", rdata[i][j]); - printf("]\n"); - } - - for (i = 0; i < 4; i++) { - for (j = 0; j < 7; j++) { - printf("i: %d, j: %d\n", i, j); - int expected = i * 3 + j + 5; - //int expected = i * 6 + j + 1; - if (rdata[i][j] != expected) { - printf("ERROR!!! Expected: %d, Got: %d\n", expected, rdata[i][j]); - HDfflush(stdout); - TEST_ERROR - } else { - //printf("Expected: %d, Got: %d\n", expected, rdata[i][j]); - HDfflush(stdout); - } - } - } + for (i = 0; i < 4; i++) { + printf(" ["); + for (j = 0; j < 7; j++) + printf(" %3d", rdata[i][j]); + printf("]\n"); + } + + for (i = 0; i < 4; i++) { + for (j = 0; j < 7; j++) { + printf("i: %d, j: %d\n", i, j); + int expected = i * 3 + j + 5; + // int expected = i * 6 + j + 1; + if (rdata[i][j] != expected) { + printf("ERROR!!! Expected: %d, Got: %d\n", expected, rdata[i][j]); + HDfflush(stdout); + TEST_ERROR + } + else { + // printf("Expected: %d, Got: %d\n", expected, rdata[i][j]); + HDfflush(stdout); + } + } + } if (H5Dclose(dset) < 0) TEST_ERROR @@ -3325,10 +3322,10 @@ test_integration_create(void) TEST_ERROR; fapl_id = H5I_INVALID_HID; - //HDremove(paths->canon); - //HDremove(paths->onion); - //HDremove(paths->recovery); - //onion_filepaths_destroy(paths); + // HDremove(paths->canon); + // HDremove(paths->onion); + // HDremove(paths->recovery); + // onion_filepaths_destroy(paths); PASSED(); return 0; @@ -3336,10 +3333,10 @@ test_integration_create(void) error: if (paths != NULL) { - //HDremove(paths->canon); - //HDremove(paths->onion); - //HDremove(paths->recovery); - //onion_filepaths_destroy(paths); + // HDremove(paths->canon); + // HDremove(paths->onion); + // HDremove(paths->recovery); + // onion_filepaths_destroy(paths); } if (dset != H5I_INVALID_HID) |