diff options
Diffstat (limited to 'src/H5FDonion.c')
-rw-r--r-- | src/H5FDonion.c | 208 |
1 files changed, 104 insertions, 104 deletions
diff --git a/src/H5FDonion.c b/src/H5FDonion.c index 1daaeee..dcec221 100644 --- a/src/H5FDonion.c +++ b/src/H5FDonion.c @@ -284,16 +284,16 @@ H5Pget_fapl_onion(hid_t fapl_id, H5FD_onion_fapl_info_t *fa_out) H5TRACE2("e", "i*!", fapl_id, fa_out); if (NULL == fa_out) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL info-out pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL info-out pointer"); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid FAPL ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid FAPL ID"); if (H5FD_ONION != H5P_peek_driver(plist)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Incorrect VFL driver") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Incorrect VFL driver"); if (NULL == (info_ptr = (const H5FD_onion_fapl_info_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad VFL driver info") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad VFL driver info"); memcpy(fa_out, info_ptr, sizeof(H5FD_onion_fapl_info_t)); @@ -407,7 +407,7 @@ H5FD__onion_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*ou assert(file->original_file); if (file->original_file && H5FD_sb_encode(file->original_file, name, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTENCODE, FAIL, "unable to encode the superblock in R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTENCODE, FAIL, "unable to encode the superblock in R/W file"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -434,7 +434,7 @@ H5FD__onion_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) assert(file->original_file); if (H5FD_sb_load(file->original_file, name, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "unable to decode the superblock in R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "unable to decode the superblock in R/W file"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -470,20 +470,20 @@ H5FD__onion_commit_new_revision_record(H5FD_onion_t *file) if ((TRUE == file->is_open_rw) && (H5FD__onion_merge_revision_index_into_archival_index( file->rev_index, &file->curr_rev_record.archival_index) < 0)) - HGOTO_ERROR(H5E_VFL, H5E_INTERNAL, FAIL, "unable to update index to write") + HGOTO_ERROR(H5E_VFL, H5E_INTERNAL, FAIL, "unable to update index to write"); if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_REVISION_RECORD + (size_t)rec->comment_size + (H5FD_ONION_ENCODED_SIZE_INDEX_ENTRY * rec->archival_index.n_entries)))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer for encoded revision record") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer for encoded revision record"); if (0 == (size = H5FD__onion_revision_record_encode(rec, buf, &checksum))) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "problem encoding revision record") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "problem encoding revision record"); phys_addr = file->onion_eof; if (H5FD_set_eoa(file->onion_file, H5FD_MEM_DRAW, phys_addr + size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't modify EOA for new revision record") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't modify EOA for new revision record"); if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, phys_addr, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write new revision record") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write new revision record"); file->onion_eof = phys_addr + size; if (TRUE == file->align_history_on_pages) @@ -497,7 +497,7 @@ H5FD__onion_commit_new_revision_record(H5FD_onion_t *file) assert(history->record_locs == NULL); history->n_revisions = 1; if (NULL == (history->record_locs = H5MM_calloc(sizeof(H5FD_onion_record_loc_t)))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate temporary record pointer list") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate temporary record pointer list"); history->record_locs[0].phys_addr = phys_addr; history->record_locs[0].record_size = size; @@ -513,7 +513,7 @@ H5FD__onion_commit_new_revision_record(H5FD_onion_t *file) assert(history->record_locs != NULL); if (NULL == (new_list = H5MM_calloc((history->n_revisions + 1) * sizeof(H5FD_onion_record_loc_t)))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to resize record pointer list") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to resize record pointer list"); memcpy(new_list, history->record_locs, sizeof(H5FD_onion_record_loc_t) * history->n_revisions); H5MM_xfree(history->record_locs); history->record_locs = new_list; @@ -565,20 +565,20 @@ H5FD__onion_close(H5FD_t *_file) assert(file->recovery_file); if (H5FD__onion_commit_new_revision_record(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "Can't write revision record to backing store") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "Can't write revision record to backing store"); if (H5FD__onion_write_final_history(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "Can't write history to backing store") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "Can't write history to backing store"); /* Unset write-lock flag and write header */ if (file->is_open_rw) file->header.flags &= (uint32_t)~H5FD_ONION_HEADER_FLAG_WRITE_LOCK; if (H5FD__onion_write_header(&(file->header), file->onion_file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "Can't write updated header to backing store") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "Can't write updated header to backing store"); } } else - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid history target") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid history target"); done: @@ -709,37 +709,37 @@ H5FD__onion_create_truncate_onion(H5FD_onion_t *file, const char *filename, cons backing_fapl_id = H5FD__onion_get_legit_fapl_id(file->fa.backing_fapl_id); if (H5I_INVALID_HID == backing_fapl_id) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid backing FAPL ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid backing FAPL ID"); /* Create backing files for onion history */ if (NULL == (file->original_file = H5FD_open(filename, flags, backing_fapl_id, maxaddr))) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "cannot open the backing file") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "cannot open the backing file"); if (NULL == (file->onion_file = H5FD_open(name_onion, flags, backing_fapl_id, maxaddr))) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "cannot open the backing onion file") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "cannot open the backing onion file"); if (NULL == (file->recovery_file = H5FD_open(recovery_file_nameery, flags, backing_fapl_id, maxaddr))) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "cannot open the backing file") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "cannot open the backing file"); /* Write "empty" .h5 file contents (signature ONIONEOF) */ if (H5FD_set_eoa(file->original_file, H5FD_MEM_DRAW, 8) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't extend EOA") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't extend EOA"); if (H5FD_write(file->original_file, H5FD_MEM_DRAW, 0, 8, "ONIONEOF") < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "cannot write header to the backing h5 file") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "cannot write header to the backing h5 file"); /* Write nascent history (with no revisions) to "recovery" */ if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HISTORY))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer"); size = H5FD__onion_history_encode(history, buf, &history->checksum); if (H5FD_ONION_ENCODED_SIZE_HISTORY != size) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't encode history") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't encode history"); if (H5FD_set_eoa(file->recovery_file, H5FD_MEM_DRAW, size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't extend EOA") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't extend EOA"); if (H5FD_write(file->recovery_file, H5FD_MEM_DRAW, 0, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "cannot write history to the backing recovery file") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "cannot write history to the backing recovery file"); hdr->history_size = size; /* record for later use */ H5MM_xfree(buf); buf = NULL; @@ -749,14 +749,14 @@ H5FD__onion_create_truncate_onion(H5FD_onion_t *file, const char *filename, cons */ if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HEADER))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer"); size = H5FD__onion_header_encode(hdr, buf, &hdr->checksum); if (H5FD_ONION_ENCODED_SIZE_HEADER != size) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't encode history header") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't encode history header"); if (H5FD_set_eoa(file->onion_file, H5FD_MEM_DRAW, size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't extend EOA") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't extend EOA"); if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, 0, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "cannot write header to the backing onion file") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "cannot write header to the backing onion file"); file->onion_eof = (haddr_t)size; if (TRUE == file->align_history_on_pages) file->onion_eof = (file->onion_eof + (hdr->page_size - 1)) & (~(hdr->page_size - 1)); @@ -764,7 +764,7 @@ H5FD__onion_create_truncate_onion(H5FD_onion_t *file, const char *filename, cons rec->archival_index.list = NULL; if (NULL == (file->rev_index = H5FD__onion_revision_index_init(file->fa.page_size))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize revision index") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize revision index"); done: H5MM_xfree(buf); @@ -800,7 +800,7 @@ H5FD__onion_parse_config_str(const char *config_str, H5FD_onion_fapl_info_t *fa) FUNC_ENTER_PACKAGE if (!HDstrcmp(config_str, "")) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "configure string can't be empty") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "configure string can't be empty"); /* Initialize to the default values */ fa->version = H5FD_ONION_FAPL_INFO_VERSION_CURR; @@ -823,14 +823,14 @@ H5FD__onion_parse_config_str(const char *config_str, H5FD_onion_fapl_info_t *fa) /* Duplicate the configure string since strtok will mess with it */ if (NULL == (config_str_copy = H5MM_strdup(config_str))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't duplicate configure string") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't duplicate configure string"); /* Remove the curly brackets and space from the configure string */ H5FD__onion_remove_unused_symbols(config_str_copy); /* The configure string can't be empty after removing the curly brackets */ if (!HDstrcmp(config_str_copy, "")) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "configure string can't be empty") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "configure string can't be empty"); token1 = HDstrtok(config_str_copy, ":"); token2 = HDstrtok(NULL, ";"); @@ -869,7 +869,7 @@ H5FD__onion_parse_config_str(const char *config_str, H5FD_onion_fapl_info_t *fa) } else HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unknown token in the configure string: %s", - token1) + token1); } token1 = HDstrtok(NULL, ":"); @@ -923,12 +923,12 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma /* Check arguments */ if (!filename || !*filename) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); if (0 == maxaddr || HADDR_UNDEF == maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); assert(H5P_DEFAULT != fapl_id); if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); /* This VFD can be invoked by either H5Pset_fapl_onion() or * H5Pset_driver_by_name(). When invoked by the former, there will be @@ -938,39 +938,39 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma if (NULL == fa) { if (NULL == (config_str = H5P_peek_driver_config_str(plist))) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "missing VFL driver configure string") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "missing VFL driver configure string"); /* Allocate a new onion fapl info struct and fill it from the * configuration string */ if (NULL == (new_fa = H5MM_calloc(sizeof(H5FD_onion_fapl_info_t)))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate memory for onion fapl info struct") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate memory for onion fapl info struct"); if (H5FD__onion_parse_config_str(config_str, new_fa) < 0) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "failed to parse configure string") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "failed to parse configure string"); fa = new_fa; } /* Check for unsupported target values */ if (H5FD_ONION_STORE_TARGET_ONION != fa->store_target) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid store target") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid store target"); /* Allocate space for the file struct */ if (NULL == (file = H5FL_CALLOC(H5FD_onion_t))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct"); /* Allocate space for onion VFD file names */ if (NULL == (name_onion = H5MM_malloc(sizeof(char) * (HDstrlen(filename) + 7)))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate onion name string") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate onion name string"); HDsnprintf(name_onion, HDstrlen(filename) + 7, "%s.onion", filename); if (NULL == (recovery_file_nameery = H5MM_malloc(sizeof(char) * (HDstrlen(name_onion) + 10)))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate recovery name string") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate recovery name string"); HDsnprintf(recovery_file_nameery, HDstrlen(name_onion) + 10, "%s.recovery", name_onion); file->recovery_file_name = recovery_file_nameery; if (NULL == (file->recovery_file_name = H5MM_malloc(sizeof(char) * (HDstrlen(name_onion) + 10)))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate recovery name string") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate recovery name string"); HDsnprintf(file->recovery_file_name, HDstrlen(name_onion) + 10, "%s.recovery", name_onion); /* Translate H5P_DEFAULT to a real fapl ID, if necessary */ @@ -992,7 +992,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma /* Check that the page size is a power of two */ if ((fa->page_size == 0) || ((fa->page_size & (fa->page_size - 1)) != 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "page size is not a power of two") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "page size is not a power of two"); /* Assign the page size */ log2_page_size = HDlog2((double)(fa->page_size)); @@ -1013,7 +1013,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma /* Truncate and create everything as necessary */ if (H5FD__onion_create_truncate_onion(file, filename, name_onion, file->recovery_file_name, flags, maxaddr) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCREATE, NULL, "unable to create/truncate onionized files") + HGOTO_ERROR(H5E_VFL, H5E_CANTCREATE, NULL, "unable to create/truncate onionized files"); file->is_open_rw = TRUE; } else { @@ -1022,7 +1022,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma /* Open the existing file using the specified fapl */ if (NULL == (file->original_file = H5FD_open(filename, flags, backing_fapl_id, maxaddr))) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open canonical file (does not exist?)") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open canonical file (does not exist?)"); /* Try to open any existing onion file */ H5E_BEGIN_TRY @@ -1057,23 +1057,23 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma } if (HADDR_UNDEF == (canon_eof = H5FD_get_eof(file->original_file, H5FD_MEM_DEFAULT))) { - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "cannot get size of canonical file") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "cannot get size of canonical file"); } if (H5FD_set_eoa(file->original_file, H5FD_MEM_DRAW, canon_eof) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't extend EOA") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't extend EOA"); hdr->origin_eof = canon_eof; file->logical_eof = canon_eof; backing_fapl_id = H5FD__onion_get_legit_fapl_id(file->fa.backing_fapl_id); if (H5I_INVALID_HID == backing_fapl_id) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid backing FAPL ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid backing FAPL ID"); /* Create backing files for onion history */ if ((file->onion_file = H5FD_open(name_onion, (H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC), backing_fapl_id, maxaddr)) == NULL) { - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "cannot open the backing onion file") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "cannot open the backing onion file"); } /* Write history header with "no" history */ @@ -1082,27 +1082,27 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma H5FD_ONION_ENCODED_SIZE_HEADER + 1; /* TODO: comment these 2 or do some other way */ head_buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HEADER); if (NULL == head_buf) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate buffer") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate buffer"); size = H5FD__onion_header_encode(hdr, head_buf, &hdr->checksum); if (H5FD_ONION_ENCODED_SIZE_HEADER != size) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't encode history header") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't encode history header"); hist_buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HISTORY); if (NULL == hist_buf) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate buffer") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate buffer"); saved_size = size; history->n_revisions = 0; size = H5FD__onion_history_encode(history, hist_buf, &history->checksum); file->header.history_size = size; /* record for later use */ if (H5FD_ONION_ENCODED_SIZE_HISTORY != size) { - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't encode history") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't encode history"); } if (H5FD_set_eoa(file->onion_file, H5FD_MEM_DRAW, saved_size + size + 1) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't extend EOA") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't extend EOA"); if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, 0, saved_size, head_buf) < 0) { HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, NULL, - "cannot write header to the backing onion file") + "cannot write header to the backing onion file"); } file->onion_eof = (haddr_t)saved_size; @@ -1116,7 +1116,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma /* Write nascent history (with no revisions) to the backing onion file */ if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, saved_size + 1, size, hist_buf) < 0) { HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, NULL, - "cannot write history to the backing onion file") + "cannot write history to the backing onion file"); } file->header.history_size = size; /* record for later use */ @@ -1125,36 +1125,36 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma H5MM_xfree(hist_buf); } else { - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open onion file (does not exist?).") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open onion file (does not exist?)."); } } if (HADDR_UNDEF == (canon_eof = H5FD_get_eof(file->original_file, H5FD_MEM_DEFAULT))) { - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "cannot get size of canonical file") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "cannot get size of canonical file"); } if (H5FD_set_eoa(file->original_file, H5FD_MEM_DRAW, canon_eof) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't extend EOA") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't extend EOA"); /* Get the history header from the onion file */ if (H5FD__onion_ingest_header(&file->header, file->onion_file, 0) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get history header from backing store") + HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get history header from backing store"); file->align_history_on_pages = (file->header.flags & H5FD_ONION_HEADER_FLAG_PAGE_ALIGNMENT) ? TRUE : FALSE; if (H5FD_ONION_HEADER_FLAG_WRITE_LOCK & file->header.flags) { /* Opening a file twice in write mode is an error */ - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "Can't open file already opened in write-mode") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "Can't open file already opened in write-mode"); } else { /* Read in the history from the onion file */ if (H5FD__onion_ingest_history(&file->history, file->onion_file, file->header.history_addr, file->header.history_size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get history from backing store") + HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get history from backing store"); /* Sanity check on revision ID */ if (fa->revision_num > file->history.n_revisions && fa->revision_num != H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "target revision ID out of range") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "target revision ID out of range"); if (fa->revision_num == 0) { file->curr_rev_record.logical_eof = canon_eof; @@ -1163,12 +1163,12 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma H5FD__onion_ingest_revision_record( &file->curr_rev_record, file->onion_file, &file->history, MIN(fa->revision_num - 1, (file->history.n_revisions - 1))) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get revision record from backing store") + HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get revision record from backing store"); } if (H5F_ACC_RDWR & flags) if (H5FD__onion_open_rw(file, flags, maxaddr, new_open) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "can't write-open write-locked file") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "can't write-open write-locked file"); } } /* End if opening existing file */ @@ -1188,7 +1188,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma */ if (NULL == (file->curr_rev_record.comment = H5MM_strndup(fa->comment, H5FD_ONION_FAPL_INFO_COMMENT_MAX_LEN))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to duplicate comment string") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to duplicate comment string"); /* TODO: Lengths of strings should be size_t */ file->curr_rev_record.comment_size = (uint32_t)HDstrlen(fa->comment) + 1; @@ -1269,37 +1269,37 @@ H5FD__onion_open_rw(H5FD_onion_t *file, unsigned int flags, haddr_t maxaddr, boo */ if (file->header.flags & H5FD_ONION_HEADER_FLAG_WRITE_LOCK) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't write-open write-locked file") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't write-open write-locked file"); /* Copy history to recovery file */ if (NULL == (file->recovery_file = H5FD_open(file->recovery_file_name, (flags | H5F_ACC_CREAT | H5F_ACC_TRUNC), file->fa.backing_fapl_id, maxaddr))) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "unable to create recovery file") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "unable to create recovery file"); if (0 == (size = H5FD__onion_write_history(&file->history, file->recovery_file, 0, 0))) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write history to recovery file") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write history to recovery file"); if (size != file->header.history_size) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "written history differed from expected size") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "written history differed from expected size"); /* Set write-lock flag in onion header */ if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HEADER))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate space for encoded buffer") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate space for encoded buffer"); file->header.flags |= H5FD_ONION_HEADER_FLAG_WRITE_LOCK; if (0 == (size = H5FD__onion_header_encode(&file->header, buf, &checksum))) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "problem encoding history header") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "problem encoding history header"); if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, 0, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write updated history header") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write updated history header"); /* Prepare revision index and finalize write-mode open */ if (NULL == (file->rev_index = H5FD__onion_revision_index_init(file->fa.page_size))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize revision index") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize revision index"); file->curr_rev_record.parent_revision_num = file->curr_rev_record.revision_num; if (!new_open) file->curr_rev_record.revision_num += 1; @@ -1352,7 +1352,7 @@ H5FD__onion_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h assert(buf_out != NULL); if ((uint64_t)(offset + len) > file->logical_eoa) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Read extends beyond addressed space") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Read extends beyond addressed space"); if (0 == len) goto done; @@ -1389,14 +1389,14 @@ H5FD__onion_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h /* Page exists in 'live' revision index */ if (H5FD_read(file->onion_file, H5FD_MEM_DRAW, entry_out->phys_addr + page_gap_head, page_readsize, buf_out) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get working file data") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get working file data"); } else if (file->fa.revision_num != 0 && H5FD__onion_archival_index_find(&file->curr_rev_record.archival_index, page_i, &entry_out)) { /* Page exists in archival index */ if (H5FD_read(file->onion_file, H5FD_MEM_DRAW, entry_out->phys_addr + page_gap_head, page_readsize, buf_out) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get previously-amended file data") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get previously-amended file data"); } else { /* Page does not exist in either index */ @@ -1408,7 +1408,7 @@ H5FD__onion_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h /* Get all original bytes in page range */ if ((read_size > 0) && H5FD_read(file->original_file, type, addr_start, read_size, buf_out) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get original file data") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get original file data"); } /* Fill with 0s any gaps after end of original bytes @@ -1478,7 +1478,7 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, assert((uint64_t)(offset + len) <= file->logical_eoa); if (FALSE == file->is_open_rw) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Write not allowed if file not opened in write mode") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Write not allowed if file not opened in write mode"); if (0 == len) goto done; @@ -1489,7 +1489,7 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, n_pages = (len + page_size - 1) >> page_size_log2; if (NULL == (page_buf = H5MM_calloc(page_size * sizeof(unsigned char)))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "cannot allocate temporary buffer") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "cannot allocate temporary buffer"); /* Write, page-by-page */ for (size_t i = 0; i < n_pages; i++) { @@ -1521,14 +1521,14 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, if (page_gap_head | page_gap_tail) { /* Copy existing page verbatim. */ if (H5FD_read(file->onion_file, H5FD_MEM_DRAW, entry_out->phys_addr, page_size, page_buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get working file data") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get working file data"); /* Overlay delta from input buffer onto page buffer. */ memcpy(page_buf + page_gap_head, buf, page_n_used); write_buf = page_buf; } /* end if partial page */ if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, entry_out->phys_addr, page_size, write_buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "write amended page data to backing file") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "write amended page data to backing file"); buf += page_n_used; /* overflow never touched */ bytes_to_write -= page_n_used; @@ -1543,7 +1543,7 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, /* Copy existing page verbatim */ if (H5FD_read(file->onion_file, H5FD_MEM_DRAW, entry_out->phys_addr, page_size, page_buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get previously-amended data") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get previously-amended data"); } else { haddr_t addr_start = (haddr_t)(page_i * page_size); @@ -1553,7 +1553,7 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, /* Get all original bytes in page range */ if ((read_size > 0) && H5FD_read(file->original_file, type, addr_start, read_size, page_buf) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get original file data") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get original file data"); } /* Fill with 0s any gaps after end of original bytes @@ -1580,13 +1580,13 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, new_entry.phys_addr = file->onion_eof; if (H5FD_set_eoa(file->onion_file, H5FD_MEM_DRAW, file->onion_eof + page_size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't modify EOA for new page amendment") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't modify EOA for new page amendment"); if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, file->onion_eof, page_size, write_buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "write amended page data to backing file") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "write amended page data to backing file"); if (H5FD__onion_revision_index_insert(file->rev_index, &new_entry) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINSERT, FAIL, "can't insert new index entry into revision index") + HGOTO_ERROR(H5E_VFL, H5E_CANTINSERT, FAIL, "can't insert new index entry into revision index"); file->onion_eof += page_size; buf += page_n_used; /* possible overflow never touched */ @@ -1636,14 +1636,14 @@ H5FD__onion_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_A switch (op_code) { case H5FD_CTL_GET_NUM_REVISIONS: if (!output || !*output) - HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "the output parameter is null") + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "the output parameter is null"); **((uint64_t **)output) = file->history.n_revisions; break; /* Unknown op code */ default: if (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG) - HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "unknown op_code and fail if unknown flag is set") + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "unknown op_code and fail if unknown flag is set"); break; } @@ -1671,28 +1671,28 @@ H5FDonion_get_revision_count(const char *filename, hid_t fapl_id, uint64_t *revi /* Check args */ if (!filename || !HDstrcmp(filename, "")) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid file name"); if (!revision_count) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "revision count can't be null") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "revision count can't be null"); /* Make sure using the correct driver */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid FAPL ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid FAPL ID"); if (H5FD_ONION != H5P_peek_driver(plist)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Onion VFL driver") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Onion VFL driver"); /* Open the file with the driver */ if (NULL == (file = H5FD_open(filename, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF))) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "unable to open file with onion driver") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "unable to open file with onion driver"); /* Call the private function */ if (H5FD__get_onion_revision_count(file, revision_count) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "failed to get the number of revisions") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "failed to get the number of revisions"); done: /* Close H5FD_t structure pointer */ if (file && H5FD_close(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); FUNC_LEAVE_API(ret_value) } @@ -1722,7 +1722,7 @@ H5FD__get_onion_revision_count(H5FD_t *file, uint64_t *revision_count) /* Get the number of revisions via the ctl callback */ if (H5FD_ctl(file, op_code, flags, NULL, (void **)&revision_count) < 0) - HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed") + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1747,10 +1747,10 @@ H5FD__onion_write_final_history(H5FD_onion_t *file) /* TODO: history EOF may not be correct (under what circumstances?) */ if (0 == (size = H5FD__onion_write_history(&(file->history), file->onion_file, file->onion_eof, file->onion_eof))) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write final history") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write final history"); if (size != file->header.history_size) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "written history differed from expected size") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "written history differed from expected size"); /* Is last write operation to history file; no need to extend to page * boundary if set to page-align. |