Migrate block_off_t to 64-bit with updated CLI parsing, VLQ serialization, and format specifiers

This commit is contained in:
Andrea Mazzoleni 2026-06-03 23:06:27 +02:00
parent ebfffa26d2
commit a580273265
13 changed files with 273 additions and 272 deletions

View file

@ -34,6 +34,8 @@ SnapRAID HISTORY
build time. When not specified, the existing runtime discovery
behaviour is preserved. Primarily intended for NixOS and other
non-FHS systems.
* Removed the 512 TiB limitation on hard disk size (when using the
default 128 KiB blocks).
14.8 2026/06
============

View file

@ -347,7 +347,7 @@ static int repair(struct snapraid_state* state, int rehash, unsigned pos, unsign
struct snapraid_file* file = failed[j].file;
block_off_t file_pos = failed[j].file_pos;
log_tag("repair_entry:%u:%s:%s:%s:%s:%s:%u:\n", j, desc, hash, data, disk->name, esc_tag(file->sub), file_pos);
log_tag("repair_entry:%u:%s:%s:%s:%s:%s:%" PRIu64 ":\n", j, desc, hash, data, disk->name, esc_tag(file->sub), file_pos);
} else {
log_tag("repair_entry:%u:%s:%s:%s:\n", j, desc, hash, data);
}
@ -1130,9 +1130,9 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
ret = handle_close(&handle[j]);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("%s:%u:%s:%s: Close error. %s.\n", es(errno), i, disk->name, esc_tag(report->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Close error. %s.\n", es(errno), i, disk->name, esc_tag(report->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping at block %u\n", i);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", i);
++unrecoverable_error;
goto bail;
@ -1145,9 +1145,9 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
ret = handle_create(&handle[j], file, state->file_mode);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("%s:%u:%s:%s: Create error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Create error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping at block %u\n", i);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", i);
++unrecoverable_error;
goto bail;
@ -1182,7 +1182,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
failed[failed_count].handle = &handle[j];
++failed_count;
log_tag("%s:%u:%s:%s: Open error at position %u. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), file_pos, strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Open error at position %" PRIu64 ". %s.\n", es(errno), i, disk->name, esc_tag(file->sub), file_pos, strerror(errno));
if (is_hw(errno)) {
++io_error;
@ -1222,23 +1222,23 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
&& handle[j].st.st_size > file->size
) {
log_error(ESOFT, "File '%s' is larger than expected.\n", handle[j].path);
log_tag("error:%u:%s:%s: Size error\n", i, disk->name, esc_tag(file->sub));
log_tag("error:%" PRIu64 ":%s:%s: Size error\n", i, disk->name, esc_tag(file->sub));
++soft_error;
if (fix) {
ret = handle_truncate(&handle[j], file);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("%s:%u:%s:%s: Truncate error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Truncate error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping at block %u\n", i);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", i);
++unrecoverable_error;
goto bail;
/* LCOV_EXCL_STOP */
}
log_tag("fixed:%u:%s:%s: Fixed size\n", i, disk->name, esc_tag(file->sub));
log_tag("fixed:%" PRIu64 ":%s:%s: Fixed size\n", i, disk->name, esc_tag(file->sub));
++recovered_error;
}
}
@ -1271,7 +1271,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
failed[failed_count].handle = &handle[j];
++failed_count;
log_tag("%s:%u:%s:%s: Read error at position %u. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), file_pos, strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Read error at position %" PRIu64 ". %s.\n", es(errno), i, disk->name, esc_tag(file->sub), file_pos, strerror(errno));
if (is_hw(errno)) {
++io_error;
@ -1334,7 +1334,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
failed[failed_count].handle = &handle[j];
++failed_count;
log_tag("error:%u:%s:%s: Data error at position %u, diff hash bits %u/%zu\n", i, disk->name, esc_tag(file->sub), file_pos, diff, BLOCK_HASH_SIZE * 8);
log_tag("error:%" PRIu64 ":%s:%s: Data error at position %" PRIu64 ", diff hash bits %u/%zu\n", i, disk->name, esc_tag(file->sub), file_pos, diff, BLOCK_HASH_SIZE * 8);
++silent_error;
continue;
}
@ -1377,7 +1377,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (parity[l]) {
ret = parity_read(parity[l], i, buffer_recov[l], state->block_size);
if (ret == -1) {
log_tag("parity_%s:%u:%s: Read error. %s.\n", es(errno), i, lev_config_name(l), strerror(errno));
log_tag("parity_%s:%" PRIu64 ":%s: Read error. %s.\n", es(errno), i, lev_config_name(l), strerror(errno));
buffer_recov[l] = 0; /* no parity to use */
@ -1403,7 +1403,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
/* print a list of all the errors in files */
for (j = 0; j < failed_count; ++j) {
if (failed[j].is_bad)
log_tag("unrecoverable:%u:%s:%s: Unrecoverable error at position %u\n", i, failed[j].disk->name, esc_tag(failed[j].file->sub), failed[j].file_pos);
log_tag("unrecoverable:%" PRIu64 ":%s:%s: Unrecoverable error at position %" PRIu64 "\n", i, failed[j].disk->name, esc_tag(failed[j].file->sub), failed[j].file_pos);
}
/* keep track of damaged files */
@ -1423,7 +1423,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
for (j = 0; j < failed_count; ++j) {
if (failed[j].is_bad && failed[j].is_outofdate) {
++partial_recover_error;
log_tag("unrecoverable:%u:%s:%s: Unrecoverable unsynced error at position %u\n", i, failed[j].disk->name, esc_tag(failed[j].file->sub), failed[j].file_pos);
log_tag("unrecoverable:%" PRIu64 ":%s:%s: Unrecoverable unsynced error at position %" PRIu64 "\n", i, failed[j].disk->name, esc_tag(failed[j].file->sub), failed[j].file_pos);
}
}
if (partial_recover_error != 0) {
@ -1449,7 +1449,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
/* mark that the read parity is wrong, setting ptr to 0 */
buffer_recov[l] = 0;
log_tag("parity_error:%u:%s: Data error, diff parity bits %u/%u\n", i, lev_config_name(l), diff, state->block_size * 8);
log_tag("parity_error:%" PRIu64 ":%s: Data error, diff parity bits %u/%u\n", i, lev_config_name(l), diff, state->block_size * 8);
++silent_error;
}
}
@ -1471,9 +1471,9 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
ret = handle_write(failed[j].handle, failed[j].file_pos, buffer[failed[j].index], state->block_size);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("%s:%u:%s:%s: Write error. %s.\n", es(errno), i, failed[j].disk->name, esc_tag(failed[j].file->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Write error. %s.\n", es(errno), i, failed[j].disk->name, esc_tag(failed[j].file->sub), strerror(errno));
log_fatal_errno(errno, failed[j].disk->name);
log_fatal(errno, "Stopping at block %u\n", i);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", i);
/* mark the file as damaged */
file_flag_set(failed[j].file, FILE_IS_DAMAGED);
@ -1496,7 +1496,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
*/
file_flag_set(failed[j].file, FILE_IS_FIXED);
log_tag("fixed:%u:%s:%s: Fixed data error at position %u\n", i, failed[j].disk->name, esc_tag(failed[j].file->sub), failed[j].file_pos);
log_tag("fixed:%" PRIu64 ":%s:%s: Fixed data error at position %" PRIu64 "\n", i, failed[j].disk->name, esc_tag(failed[j].file->sub), failed[j].file_pos);
++recovered_error;
}
@ -1523,16 +1523,16 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
ret = parity_write(parity[l], i, buffer[diskmax + l], state->block_size);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("%s:%u:%s: Write error. %s.\n", es(errno), i, lev_config_name(l), strerror(errno));
log_tag("%s:%" PRIu64 ":%s: Write error. %s.\n", es(errno), i, lev_config_name(l), strerror(errno));
log_fatal_errno(errno, lev_config_name(l));
log_fatal(errno, "Stopping at block %u\n", i);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", i);
++unrecoverable_error;
goto bail;
/* LCOV_EXCL_STOP */
}
log_tag("parity_fixed:%u:%s: Fixed data error\n", i, lev_config_name(l));
log_tag("parity_fixed:%" PRIu64 ":%s: Fixed data error\n", i, lev_config_name(l));
++recovered_error;
}
}
@ -1565,7 +1565,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
ret = file_post(state, fix, i, handle, diskmax);
if (ret == -1) {
/* LCOV_EXCL_START */
log_fatal(errno, "Stopping at block %u\n", i);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", i);
++unrecoverable_error;
goto bail;
@ -1664,7 +1664,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error creating ancestor '%s%s'. %s.\n", disk->dir, file->sub, strerror(errno));
log_tag("empty_%s:%u:%s:%s: Create ancestor error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("empty_%s:%" PRIu64 ":%s:%s: Create ancestor error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -1681,7 +1681,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (f == -1) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error creating '%s%s'. %s.\n", disk->dir, file->sub, strerror(errno));
log_tag("empty_%s:%u:%s:%s: Create error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("empty_%s:%" PRIu64 ":%s:%s: Create error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -1695,7 +1695,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error timing '%s%s'. %s.\n", disk->dir, file->sub, strerror(errno));
log_tag("empty_%s:%u:%s:%s: Time error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("empty_%s:%" PRIu64 ":%s:%s: Time error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -1711,7 +1711,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error closing '%s%s'. %s.\n", disk->dir, file->sub, strerror(errno));
log_tag("empty_%s:%u:%s:%s: Close error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("empty_%s:%" PRIu64 ":%s:%s: Close error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -1854,7 +1854,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error creating ancestor '%s%s'. %s.\n", disk->dir, slink->sub, strerror(errno));
log_tag("%slink_%s:%u:%s:%s: Create ancestor error. %s.\n", link, es(errno), i, disk->name, esc_tag(slink->sub), strerror(errno));
log_tag("%slink_%s:%" PRIu64 ":%s:%s: Create ancestor error. %s.\n", link, es(errno), i, disk->name, esc_tag(slink->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -1868,7 +1868,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0 && errno != ENOENT) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error removing '%s%s'. %s.\n", disk->dir, slink->sub, strerror(errno));
log_tag("%slink_%s:%u:%s:%s: Remove error. %s.\n", link, es(errno), i, disk->name, esc_tag(slink->sub), strerror(errno));
log_tag("%slink_%s:%" PRIu64 ":%s:%s: Remove error. %s.\n", link, es(errno), i, disk->name, esc_tag(slink->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -1883,7 +1883,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error writing hardlink '%s' to '%s'. %s.\n", path, pathto, strerror(errno));
log_tag("hardlink_%s:%u:%s:%s: Hardlink error. %s.\n", es(errno), i, disk->name, esc_tag(slink->sub), strerror(errno));
log_tag("hardlink_%s:%" PRIu64 ":%s:%s: Hardlink error. %s.\n", es(errno), i, disk->name, esc_tag(slink->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -1899,7 +1899,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error writing symlink '%s' to '%s'. %s.\n", path, slink->linkto, strerror(errno));
log_tag("symlink_%s:%u:%s:%s: Hardlink error. %s.\n", es(errno), i, disk->name, esc_tag(slink->sub), strerror(errno));
log_tag("symlink_%s:%" PRIu64 ":%s:%s: Hardlink error. %s.\n", es(errno), i, disk->name, esc_tag(slink->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -1961,7 +1961,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error creating ancestor '%s%s'. %s.\n", disk->dir, dir->sub, strerror(errno));
log_tag("dir_%s:%u:%s:%s: Create ancestor error. %s.\n", es(errno), i, disk->name, esc_tag(dir->sub), strerror(errno));
log_tag("dir_%s:%" PRIu64 ":%s:%s: Create ancestor error. %s.\n", es(errno), i, disk->name, esc_tag(dir->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -1975,7 +1975,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0 && errno != EEXIST) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error creating directory '%s%s'. %s.\n", disk->dir, dir->sub, strerror(errno));
log_tag("dir_%s:%u:%s:%s: Create directory error. %s.\n", es(errno), i, disk->name, esc_tag(dir->sub), strerror(errno));
log_tag("dir_%s:%" PRIu64 ":%s:%s: Create directory error. %s.\n", es(errno), i, disk->name, esc_tag(dir->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -2004,7 +2004,7 @@ bail:
ret = handle_close(&handle[j]);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("%s:%u:%s:%s: Close error. %s.\n", es(errno), blockmax, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Close error. %s.\n", es(errno), blockmax, disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
++unrecoverable_error;
@ -2059,7 +2059,7 @@ bail:
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error removing '%s'. %s.\n", path, strerror(errno));
log_tag("%s:%u:%s:%s: Close error. %s.\n", es(errno), blockmax, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Close error. %s.\n", es(errno), blockmax, disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
++unrecoverable_error;
@ -2189,7 +2189,7 @@ int state_check(struct snapraid_state* state, int fix, block_off_t blockstart, b
if (blockstart > blockmax) {
/* LCOV_EXCL_START */
log_fatal(EUSER, "Error in the specified starting block %u. It's larger than the parity size %u.\n", blockstart, blockmax);
log_fatal(EUSER, "Error in the specified starting block %" PRIu64 ". It's larger than the parity size %" PRIu64 ".\n", blockstart, blockmax);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -2218,7 +2218,7 @@ int state_check(struct snapraid_state* state, int fix, block_off_t blockstart, b
/* open for reading, and ignore error */
ret = parity_open(parity_ptr[l], &state->parity[l], l, state->file_mode, state->block_size, state->opt.parity_limit_size);
if (ret == -1) {
log_tag("parity_%s:%u:%s: Open error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_tag("parity_%s:%" PRIu64 ":%s: Open error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
if (is_hw(errno)) {
log_fatal_errno(errno, lev_config_name(l));
exit(EXIT_FAILURE);
@ -2257,7 +2257,7 @@ int state_check(struct snapraid_state* state, int fix, block_off_t blockstart, b
parity_ptr[l] = &parity[l];
ret = parity_open(parity_ptr[l], &state->parity[l], l, state->file_mode, state->block_size, state->opt.parity_limit_size);
if (ret == -1) {
log_tag("parity_%s:%u:%s: Open error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_tag("parity_%s:%" PRIu64 ":%s: Open error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
if (is_hw(errno)) {
log_fatal_errno(errno, lev_config_name(l));
exit(EXIT_FAILURE);
@ -2296,7 +2296,7 @@ int state_check(struct snapraid_state* state, int fix, block_off_t blockstart, b
ret = parity_truncate(parity_ptr[l]);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("parity_%s:%u:%s: Truncate error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_tag("parity_%s:%" PRIu64 ":%s: Truncate error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_fatal_errno(errno, lev_config_name(l));
++process_error;
@ -2308,7 +2308,7 @@ int state_check(struct snapraid_state* state, int fix, block_off_t blockstart, b
ret = parity_close(parity_ptr[l]);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("parity_%s:%u:%s: Close error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_tag("parity_%s:%" PRIu64 ":%s: Close error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_fatal_errno(errno, lev_config_name(l));
++process_error;

View file

@ -64,9 +64,9 @@ static void dry_data_reader(struct snapraid_worker* worker, struct snapraid_task
* This one is really an unexpected error, because we are only reading
* and closing a descriptor should never fail
*/
log_tag("%s:%u:%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(report->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(report->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping at block %u\n", blockcur);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", blockcur);
if (is_hw(errno)) {
task->state = TASK_STATE_IOERROR;
@ -80,11 +80,11 @@ static void dry_data_reader(struct snapraid_worker* worker, struct snapraid_task
ret = handle_open(handle, task->file, state->file_mode, 0);
if (ret == -1) {
log_tag("%s:%u:%s:%s: Open error. %s.\n", es(errno), blockcur, disk->name, esc_tag(task->file->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Open error. %s.\n", es(errno), blockcur, disk->name, esc_tag(task->file->sub), strerror(errno));
if (is_hw(errno)) {
/* LCOV_EXCL_START */
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping at block %u\n", blockcur);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", blockcur);
task->state = TASK_STATE_IOERROR;
return;
/* LCOV_EXCL_STOP */
@ -96,7 +96,7 @@ static void dry_data_reader(struct snapraid_worker* worker, struct snapraid_task
task->read_size = handle_read(handle, task->file_pos, buffer, state->block_size, 0);
if (task->read_size == -1) {
log_tag("%s:%u:%s:%s: Read error at position %u. %s.\n", es(errno), blockcur, disk->name, esc_tag(task->file->sub), task->file_pos, strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Read error at position %" PRIu64 ". %s.\n", es(errno), blockcur, disk->name, esc_tag(task->file->sub), task->file_pos, strerror(errno));
if (is_hw(errno)) {
/* LCOV_EXCL_START */
log_fatal_errno(errno, disk->name);
@ -128,7 +128,7 @@ static void dry_parity_reader(struct snapraid_worker* worker, struct snapraid_ta
/* read the parity */
ret = parity_read(parity_handle, blockcur, buffer, state->block_size);
if (ret == -1) {
log_tag("parity_%s:%u:%s: Read error. %s.\n", es(errno), blockcur, lev_config_name(level), strerror(errno));
log_tag("parity_%s:%" PRIu64 ":%s: Read error. %s.\n", es(errno), blockcur, lev_config_name(level), strerror(errno));
if (is_hw(errno)) {
/* LCOV_EXCL_START */
log_fatal_errno(errno, lev_config_name(level));
@ -260,7 +260,7 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit
if (io_error >= state->opt.io_error_limit) {
/* LCOV_EXCL_START */
log_fatal(EIO, "DANGER! Too many input/output errors in the %s disk. It isn't possible to continue.\n", disk->dir);
log_fatal(EIO, "Stopping at block %u\n", blockcur);
log_fatal(EIO, "Stopping at block %" PRIu64 "\n", blockcur);
goto bail;
/* LCOV_EXCL_STOP */
}
@ -313,7 +313,7 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit
if (io_error >= state->opt.io_error_limit) {
/* LCOV_EXCL_START */
log_fatal(EIO, "DANGER! Too many input/output errors in the %s disk. It isn't possible to continue.\n", lev_name(levcur));
log_fatal(EIO, "Stopping at block %u\n", blockcur);
log_fatal(EIO, "Stopping at block %" PRIu64 "\n", blockcur);
goto bail;
/* LCOV_EXCL_STOP */
}
@ -368,7 +368,7 @@ bail:
ret = handle_close(&handle[j]);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("%s:%u:%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
if (is_hw(errno)) {
@ -429,7 +429,7 @@ int state_dry(struct snapraid_state* state, block_off_t blockstart, block_off_t
if (blockstart > blockmax) {
/* LCOV_EXCL_START */
log_fatal(EUSER, "Error in the specified starting block %u. It's larger than the parity size %u.\n", blockstart, blockmax);
log_fatal(EUSER, "Error in the specified starting block %" PRIu64 ". It's larger than the parity size %" PRIu64 ".\n", blockstart, blockmax);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -447,7 +447,7 @@ int state_dry(struct snapraid_state* state, block_off_t blockstart, block_off_t
ret = parity_open(&parity_handle[l], &state->parity[l], l, state->file_mode, state->block_size, state->opt.parity_limit_size);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("parity_%s:%u:%s: Open error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_tag("parity_%s:%" PRIu64 ":%s: Open error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_fatal_errno(errno, lev_config_name(l));
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
@ -472,7 +472,7 @@ int state_dry(struct snapraid_state* state, block_off_t blockstart, block_off_t
ret = parity_close(&parity_handle[l]);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("parity_%s:%u:%s: Close error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_tag("parity_%s:%" PRIu64 ":%s: Close error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_fatal_errno(errno, lev_config_name(l));
++process_error;

View file

@ -655,13 +655,13 @@ struct snapraid_extent* extent_alloc(block_off_t parity_pos, struct snapraid_fil
if (count == 0) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Allocating empty extent for file '%s' at position '%u/%u'\n", file->sub, file_pos, file->blockmax);
log_fatal(EINTERNAL, "Internal inconsistency: Allocating empty extent for file '%s' at position '%" PRIu64 "/%" PRIu64 "'\n", file->sub, file_pos, file->blockmax);
os_abort();
/* LCOV_EXCL_STOP */
}
if (count > file->blockmax || file_pos > file->blockmax - count) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Allocating overflowing extent for file '%s' at position '%u:%u/%u'\n", file->sub, file_pos, count, file->blockmax);
log_fatal(EINTERNAL, "Internal inconsistency: Allocating overflowing extent for file '%s' at position '%" PRIu64 ":%" PRIu64 "/%" PRIu64 "'\n", file->sub, file_pos, count, file->blockmax);
os_abort();
/* LCOV_EXCL_STOP */
}
@ -806,7 +806,7 @@ void dealloc_import(struct snapraid_dealloc* dealloc, struct snapraid_file* file
break;
default :
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: State for dealloc block %u state %u\n", i, state);
log_fatal(EINTERNAL, "Internal inconsistency: State for dealloc block %" PRIu64 " state %u\n", i, state);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -1056,7 +1056,7 @@ static void extent_parity_check_foreach_unlock(void* void_arg, void* void_obj)
if (obj->count == 0) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Parity count zero for file '%s' at '%u'\n",
log_fatal(EINTERNAL, "Internal inconsistency: Parity count zero for file '%s' at '%" PRIu64 "'\n",
obj->file->sub, obj->parity_pos);
++arg->result;
return;
@ -1070,7 +1070,7 @@ static void extent_parity_check_foreach_unlock(void* void_arg, void* void_obj)
/* check the order */
if (prev->parity_pos >= obj->parity_pos) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Parity order for files '%s' at '%u:%u' and '%s' at '%u:%u'\n",
log_fatal(EINTERNAL, "Internal inconsistency: Parity order for files '%s' at '%" PRIu64 ":%" PRIu64 "' and '%s' at '%" PRIu64 ":%" PRIu64 "'\n",
prev->file->sub, prev->parity_pos, prev->count, obj->file->sub, obj->parity_pos, obj->count);
++arg->result;
return;
@ -1080,7 +1080,7 @@ static void extent_parity_check_foreach_unlock(void* void_arg, void* void_obj)
/* check that the extents don't overlap */
if (obj->parity_pos - prev->parity_pos < prev->count) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Parity overlap for files '%s' at '%u:%u' and '%s' at '%u:%u'\n",
log_fatal(EINTERNAL, "Internal inconsistency: Parity overlap for files '%s' at '%" PRIu64 ":%" PRIu64 "' and '%s' at '%" PRIu64 ":%" PRIu64 "'\n",
prev->file->sub, prev->parity_pos, prev->count, obj->file->sub, obj->parity_pos, obj->count);
++arg->result;
return;
@ -1106,7 +1106,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
if (obj->count == 0) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: File count zero for file '%s' at '%u'\n",
log_fatal(EINTERNAL, "Internal inconsistency: File count zero for file '%s' at '%" PRIu64 "'\n",
obj->file->sub, obj->file_pos);
++arg->result;
return;
@ -1122,7 +1122,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
/* check that the extent doesn't overflow the file */
if (prev->count > prev->file->blockmax || prev->file_pos > prev->file->blockmax - prev->count) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Delete end for file '%s' at '%u:%u' overflowing size '%u'\n",
log_fatal(EINTERNAL, "Internal inconsistency: Delete end for file '%s' at '%" PRIu64 ":%" PRIu64 "' overflowing size '%" PRIu64 "'\n",
prev->file->sub, prev->file_pos, prev->count, prev->file->blockmax);
++arg->result;
return;
@ -1132,7 +1132,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
/* check that the extent ends the file */
if (prev->file_pos + prev->count != prev->file->blockmax) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: File end for file '%s' at '%u:%u' instead of size '%u'\n",
log_fatal(EINTERNAL, "Internal inconsistency: File end for file '%s' at '%" PRIu64 ":%" PRIu64 "' instead of size '%" PRIu64 "'\n",
prev->file->sub, prev->file_pos, prev->count, prev->file->blockmax);
++arg->result;
return;
@ -1145,7 +1145,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
/* check that the extent doesn't overflow the file */
if (obj->count > obj->file->blockmax || obj->file_pos > obj->file->blockmax - obj->count) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Delete start for file '%s' at '%u:%u' overflowing size '%u'\n",
log_fatal(EINTERNAL, "Internal inconsistency: Delete start for file '%s' at '%" PRIu64 ":%" PRIu64 "' overflowing size '%" PRIu64 "'\n",
obj->file->sub, obj->file_pos, obj->count, obj->file->blockmax);
++arg->result;
return;
@ -1155,7 +1155,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
/* check that the extent starts the file */
if (obj->file_pos != 0) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: File start for file '%s' at '%u:%u'\n",
log_fatal(EINTERNAL, "Internal inconsistency: File start for file '%s' at '%" PRIu64 ":%" PRIu64 "'\n",
obj->file->sub, obj->file_pos, obj->count);
++arg->result;
return;
@ -1166,7 +1166,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
/* check the order */
if (prev->file_pos >= obj->file_pos) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: File order for file '%s' at '%u:%u' and at '%u:%u'\n",
log_fatal(EINTERNAL, "Internal inconsistency: File order for file '%s' at '%" PRIu64 ":%" PRIu64 "' and at '%" PRIu64 ":%" PRIu64 "'\n",
prev->file->sub, prev->file_pos, prev->count, obj->file_pos, obj->count);
++arg->result;
return;
@ -1177,7 +1177,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
/* check that the extents don't overlap */
if (obj->file_pos - prev->file_pos < prev->count) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Delete sequence for file '%s' at '%u:%u' and at '%u:%u'\n",
log_fatal(EINTERNAL, "Internal inconsistency: Delete sequence for file '%s' at '%" PRIu64 ":%" PRIu64 "' and at '%" PRIu64 ":%" PRIu64 "'\n",
prev->file->sub, prev->file_pos, prev->count, obj->file_pos, obj->count);
++arg->result;
return;
@ -1187,7 +1187,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
/* check that the extents are sequential */
if (prev->file_pos + prev->count != obj->file_pos) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: File sequence for file '%s' at '%u:%u' and at '%u:%u'\n",
log_fatal(EINTERNAL, "Internal inconsistency: File sequence for file '%s' at '%" PRIu64 ":%" PRIu64 "' and at '%" PRIu64 ":%" PRIu64 "'\n",
prev->file->sub, prev->file_pos, prev->count, obj->file_pos, obj->count);
++arg->result;
return;
@ -1385,7 +1385,7 @@ void fs_allocate(struct snapraid_disk* disk, block_off_t parity_pos, struct snap
/* check if the position will go outside the limit */
if (extent->parity_pos + extent->count == POS_NULL) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Parity position overflow allocating file '%s' at position '%u/%u' with count '%u' in disk '%s'\n", file->sub, file_pos, file->blockmax, extent->count, disk->name);
log_fatal(EINTERNAL, "Internal inconsistency: Parity position overflow allocating file '%s' at position '%" PRIu64 "/%" PRIu64 "' with count '%" PRIu64 "' in disk '%s'\n", file->sub, file_pos, file->blockmax, extent->count, disk->name);
os_abort();
/* LCOV_EXCL_STOP */
}
@ -1393,7 +1393,7 @@ void fs_allocate(struct snapraid_disk* disk, block_off_t parity_pos, struct snap
/* ensure that we are extending the extent at the end */
if (file_pos != extent->file_pos + extent->count) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Allocating file '%s' at position '%u/%u' in the middle of extent '%u:%u' in disk '%s'\n", file->sub, file_pos, file->blockmax, extent->file_pos, extent->count, disk->name);
log_fatal(EINTERNAL, "Internal inconsistency: Allocating file '%s' at position '%" PRIu64 "/%" PRIu64 "' in the middle of extent '%" PRIu64 ":%" PRIu64 "' in disk '%s'\n", file->sub, file_pos, file->blockmax, extent->file_pos, extent->count, disk->name);
os_abort();
/* LCOV_EXCL_STOP */
}
@ -1415,7 +1415,7 @@ void fs_allocate(struct snapraid_disk* disk, block_off_t parity_pos, struct snap
if (parity_extent != extent || file_extent != extent) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Allocating file '%s' at position '%u/%u' for existing extent '%u:%u' in disk '%s'\n", file->sub, file_pos, file->blockmax, extent->file_pos, extent->count, disk->name);
log_fatal(EINTERNAL, "Internal inconsistency: Allocating file '%s' at position '%" PRIu64 "/%" PRIu64 "' for existing extent '%" PRIu64 ":%" PRIu64 "' in disk '%s'\n", file->sub, file_pos, file->blockmax, extent->file_pos, extent->count, disk->name);
os_abort();
/* LCOV_EXCL_STOP */
}
@ -1439,7 +1439,7 @@ void fs_deallocate(struct snapraid_disk* disk, block_off_t parity_pos)
extent = fs_par2extent_get_unlock(disk, &disk->fs_last, parity_pos);
if (!extent) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Deallocating parity position '%u' for not existing extent in disk '%s'\n", parity_pos, disk->name);
log_fatal(EINTERNAL, "Internal inconsistency: Deallocating parity position '%" PRIu64 "' for not existing extent in disk '%s'\n", parity_pos, disk->name);
os_abort();
/* LCOV_EXCL_STOP */
}
@ -1500,7 +1500,7 @@ void fs_deallocate(struct snapraid_disk* disk, block_off_t parity_pos)
if (parity_extent != second_extent || file_extent != second_extent) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Deallocating parity position '%u' for splitting extent '%u:%u' in disk '%s'\n", parity_pos, second_extent->file_pos, second_extent->count, disk->name);
log_fatal(EINTERNAL, "Internal inconsistency: Deallocating parity position '%" PRIu64 "' for splitting extent '%" PRIu64 ":%" PRIu64 "' in disk '%s'\n", parity_pos, second_extent->file_pos, second_extent->count, disk->name);
os_abort();
/* LCOV_EXCL_STOP */
}
@ -1515,7 +1515,7 @@ struct snapraid_block* fs_file2block_get(struct snapraid_file* file, block_off_t
{
if (file_pos >= file->blockmax) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Dereferencing file '%s' at position '%u/%u'\n", file->sub, file_pos, file->blockmax);
log_fatal(EINTERNAL, "Internal inconsistency: Dereferencing file '%s' at position '%" PRIu64 "/%" PRIu64 "'\n", file->sub, file_pos, file->blockmax);
os_abort();
/* LCOV_EXCL_STOP */
}
@ -1620,10 +1620,10 @@ void bucket_to_list(tommy_hashdyn* bucket_hash, tommy_list* bucket_list, block_o
for (tommy_node* i = tommy_list_head(bucket_list); i != 0; i = i->next) {
struct snapraid_bucket* entry = i->data;
count += entry->count_scrubbed + entry->count_justsynced;
log_tag("bucket:entry:%" PRIu64 ":%u:%u\n", (uint64_t)entry->time_at, entry->count_scrubbed, entry->count_justsynced);
log_tag("bucket:entry:%" PRIu64 ":%" PRIu64 ":%" PRIu64 "\n", (uint64_t)entry->time_at, entry->count_scrubbed, entry->count_justsynced);
}
log_tag("bucket:block_count:%u\n", count);
log_tag("bucket:block_count:%" PRIu64 "\n", count);
log_tag("list:bucket_end\n");

View file

@ -270,11 +270,11 @@ struct snapraid_file {
uint64_t physical; /**< Physical offset of the file. */
data_off_t size; /**< Size of the file. */
struct snapraid_block* blockvec; /**< All the blocks of the file. */
int mtime_nsec; /**< Modification time nanoseconds. In the range 0 <= x < 1,000,000,000, or STAT_NSEC_INVALID if not present. */
block_off_t blockmax; /**< Number of blocks. */
char* sub; /**< Sub path of the file. Without the disk dir. The disk is implicit. */
int mtime_nsec; /**< Modification time nanoseconds. In the range 0 <= x < 1,000,000,000, or STAT_NSEC_INVALID if not present. */
uint16_t flag; /**< FILE_IS_* flags. */
uint16_t shared_flag; /**< FILE_IS_RELOCATED flag. Keep it separated as it's accessed by multiple threads */
char* sub; /**< Sub path of the file. Without the disk dir. The disk is implicit. */
/* nodes for data structures */
tommy_node nodelist;
@ -1141,7 +1141,7 @@ static inline struct snapraid_file* fs_par2file_get(struct snapraid_disk* disk,
ret = fs_par2file_find(disk, parity_pos, file_pos);
if (ret == 0) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Deresolving parity to file at position '%u' in disk '%s'\n", parity_pos, disk->name);
log_fatal(EINTERNAL, "Internal inconsistency: Deresolving parity to file at position '%" PRIu64 "' in disk '%s'\n", parity_pos, disk->name);
os_abort();
/* LCOV_EXCL_STOP */
}
@ -1165,7 +1165,7 @@ static inline block_off_t fs_file2par_get(struct snapraid_disk* disk, struct sna
ret = fs_file2par_find(disk, file, file_pos);
if (ret == POS_NULL) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Resolving file '%s' at position '%u/%u' in disk '%s'\n", file->sub, file_pos, file->blockmax, disk->name);
log_fatal(EINTERNAL, "Internal inconsistency: Resolving file '%s' at position '%" PRIu64 "/%" PRIu64 "' in disk '%s'\n", file->sub, file_pos, file->blockmax, disk->name);
os_abort();
/* LCOV_EXCL_STOP */
}
@ -1189,7 +1189,7 @@ static inline struct snapraid_block* fs_par2block_get(struct snapraid_disk* disk
ret = fs_par2block_find(disk, parity_pos);
if (ret == BLOCK_NULL) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Deresolving parity to block at position '%u' in disk '%s'\n", parity_pos, disk->name);
log_fatal(EINTERNAL, "Internal inconsistency: Deresolving parity to block at position '%" PRIu64 "' in disk '%s'\n", parity_pos, disk->name);
os_abort();
/* LCOV_EXCL_STOP */
}

View file

@ -49,7 +49,7 @@ static void dump_entry(void* void_entry)
struct snapraid_parity_entry* entry = void_entry;
printf("%12" PRIu64 " ", entry->low * (uint64_t)entry->block_size);
printf("%12" PRIu64 " ", (entry->high - entry->low + 1) * (uint64_t)entry->block_size);
printf("%8u ", entry->fragments);
printf("%8" PRIu64 " ", entry->fragments);
printf("%s\n", fmt_term(entry->disk, entry->file->sub));
}

View file

@ -410,9 +410,8 @@ int os_pclose(OS_FILE* stream);
/**
* Basic block position type.
* With 32 bits and 128k blocks you can address 256 TB.
*/
typedef uint32_t block_off_t;
typedef uint64_t block_off_t;
/**
* Basic data position type.

View file

@ -335,7 +335,7 @@ static void scan_file_deallocate(struct snapraid_scan* scan, struct snapraid_fil
*/
if (disk->first_free_block != 0) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency for first free position at '%u' deallocating file '%s'\n", disk->first_free_block, file->sub);
log_fatal(EINTERNAL, "Internal inconsistency for first free position at '%" PRIu64 "' deallocating file '%s'\n", disk->first_free_block, file->sub);
os_abort();
/* LCOV_EXCL_STOP */
}
@ -379,7 +379,7 @@ static void scan_file_deallocate(struct snapraid_scan* scan, struct snapraid_fil
break;
default :
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency in file '%s' deallocating block '%u:%u' state %u\n", file->sub, i, file->blockmax, block_state);
log_fatal(EINTERNAL, "Internal inconsistency in file '%s' deallocating block '%" PRIu64 ":%" PRIu64 "' state %u\n", file->sub, i, file->blockmax, block_state);
os_abort();
/* LCOV_EXCL_STOP */
}

View file

@ -138,9 +138,9 @@ static void scrub_data_reader(struct snapraid_worker* worker, struct snapraid_ta
* This one is really an unexpected error, because we are only reading
* and closing a descriptor should never fail
*/
log_tag("%s:%u:%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(report->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(report->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping at block %u\n", blockcur);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", blockcur);
if (is_hw(errno)) {
task->state = TASK_STATE_IOERROR;
@ -154,11 +154,11 @@ static void scrub_data_reader(struct snapraid_worker* worker, struct snapraid_ta
ret = handle_open(handle, task->file, state->file_mode, 0);
if (ret == -1) {
log_tag("%s:%u:%s:%s: Open error. %s.\n", es(errno), blockcur, disk->name, esc_tag(task->file->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Open error. %s.\n", es(errno), blockcur, disk->name, esc_tag(task->file->sub), strerror(errno));
if (is_hw(errno)) {
/* LCOV_EXCL_START */
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping at block %u\n", blockcur);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", blockcur);
task->state = TASK_STATE_IOERROR;
return;
/* LCOV_EXCL_STOP */
@ -187,7 +187,7 @@ static void scrub_data_reader(struct snapraid_worker* worker, struct snapraid_ta
task->read_size = handle_read(handle, task->file_pos, buffer, state->block_size, 0);
if (task->read_size == -1) {
log_tag("%s:%u:%s:%s: Read error at position %u. %s.\n", es(errno), blockcur, disk->name, esc_tag(task->file->sub), task->file_pos, strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Read error at position %" PRIu64 ". %s.\n", es(errno), blockcur, disk->name, esc_tag(task->file->sub), task->file_pos, strerror(errno));
if (is_hw(errno)) {
/* LCOV_EXCL_START */
log_fatal_errno(errno, disk->name);
@ -219,7 +219,7 @@ static void scrub_parity_reader(struct snapraid_worker* worker, struct snapraid_
/* read the parity */
ret = parity_read(parity_handle, blockcur, buffer, state->block_size);
if (ret == -1) {
log_tag("parity_%s:%u:%s: Read error. %s.\n", es(errno), blockcur, lev_config_name(level), strerror(errno));
log_tag("parity_%s:%" PRIu64 ":%s: Read error. %s.\n", es(errno), blockcur, lev_config_name(level), strerror(errno));
if (is_hw(errno)) {
/* LCOV_EXCL_START */
log_fatal_errno(errno, lev_config_name(level));
@ -446,7 +446,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
if (io_error >= state->opt.io_error_limit) {
/* LCOV_EXCL_START */
log_fatal(EIO, "DANGER! Too many input/output errors in the %s disk. It isn't possible to continue.\n", disk->dir);
log_fatal(EIO, "Stopping at block %u\n", blockcur);
log_fatal(EIO, "Stopping at block %" PRIu64 "\n", blockcur);
goto bail;
/* LCOV_EXCL_STOP */
}
@ -485,12 +485,12 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
/* it's a silent error only if we are dealing with synced files */
if (file_is_unsynced) {
log_tag("error:%u:%s:%s: Data error at position %u, diff hash bits %u/%zu\n", blockcur, disk->name, esc_tag(file->sub), file_pos, diff, BLOCK_HASH_SIZE * 8);
log_tag("error:%" PRIu64 ":%s:%s: Data error at position %" PRIu64 ", diff hash bits %u/%zu\n", blockcur, disk->name, esc_tag(file->sub), file_pos, diff, BLOCK_HASH_SIZE * 8);
++soft_error;
error_on_this_block = 1;
} else {
log_tag("error_data:%u:%s:%s: Data error at position %u, diff hash bits %u/%zu\n", blockcur, disk->name, esc_tag(file->sub), file_pos, diff, BLOCK_HASH_SIZE * 8);
log_error(EDATA, "Data error in file '%s' at position '%u', diff hash bits %u/%zu\n", task->path, file_pos, diff, BLOCK_HASH_SIZE * 8);
log_tag("error_data:%" PRIu64 ":%s:%s: Data error at position %" PRIu64 ", diff hash bits %u/%zu\n", blockcur, disk->name, esc_tag(file->sub), file_pos, diff, BLOCK_HASH_SIZE * 8);
log_error(EDATA, "Data error in file '%s' at position '%" PRIu64 "', diff hash bits %u/%zu\n", task->path, file_pos, diff, BLOCK_HASH_SIZE * 8);
++silent_error;
silent_error_on_this_block = 1;
}
@ -544,7 +544,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
if (io_error >= state->opt.io_error_limit) {
/* LCOV_EXCL_START */
log_fatal(EIO, "DANGER! Too many input/output errors in the %s disk. It isn't possible to continue.\n", lev_name(levcur));
log_fatal(EIO, "Stopping at block %u\n", blockcur);
log_fatal(EIO, "Stopping at block %" PRIu64 "\n", blockcur);
goto bail;
/* LCOV_EXCL_STOP */
}
@ -577,13 +577,13 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
/* it's a silent error only if we are dealing with synced blocks */
if (block_is_unsynced) {
log_tag("parity_error:%u:%s: Data error, diff parity bits %u/%u\n", blockcur, lev_config_name(l), diff, state->block_size * 8);
log_tag("parity_error:%" PRIu64 ":%s: Data error, diff parity bits %u/%u\n", blockcur, lev_config_name(l), diff, state->block_size * 8);
++soft_error;
error_on_this_block = 1;
} else {
log_tag("parity_error_data:%u:%s: Data error, diff parity bits %u/%u\n", blockcur, lev_config_name(l), diff, state->block_size * 8);
log_error(EDATA, "Data error in parity '%s' at position '%u', diff parity bits %u/%u\n", lev_config_name(l), blockcur, diff, state->block_size * 8);
log_error(EDATA, "Data error in parity '%s' at position '%u', diff parity bits %u/%u\n", lev_config_name(l), blockcur, diff, state->block_size * 8);
log_tag("parity_error_data:%" PRIu64 ":%s: Data error, diff parity bits %u/%u\n", blockcur, lev_config_name(l), diff, state->block_size * 8);
log_error(EDATA, "Data error in parity '%s' at position '%" PRIu64 "', diff parity bits %u/%u\n", lev_config_name(l), blockcur, diff, state->block_size * 8);
log_error(EDATA, "Data error in parity '%s' at position '%" PRIu64 "', diff parity bits %u/%u\n", lev_config_name(l), blockcur, diff, state->block_size * 8);
++silent_error;
silent_error_on_this_block = 1;
}
@ -720,7 +720,7 @@ bail:
ret = handle_close(&handle[j]);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("%s:%u:%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
if (is_hw(errno)) {
@ -897,9 +897,9 @@ int state_scrub(struct snapraid_state* state, int plan100, int olderthan)
ps.lastlimit = 0;
}
log_tag("count_limit:%u\n", countlimit);
log_tag("count_limit:%" PRIu64 "\n", countlimit);
log_tag("time_limit:%" PRIu64 "\n", (uint64_t)ps.timelimit);
log_tag("last_limit:%u\n", ps.lastlimit);
log_tag("last_limit:%" PRIu64 "\n", ps.lastlimit);
} else {
/* avoid compiler warnings */
ps.timelimit = 0;
@ -911,7 +911,7 @@ int state_scrub(struct snapraid_state* state, int plan100, int olderthan)
ret = parity_open(&parity_handle[l], &state->parity[l], l, state->file_mode, state->block_size, state->opt.parity_limit_size);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("parity_%s:%u:%s: Open error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_tag("parity_%s:%" PRIu64 ":%s: Open error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_fatal_errno(errno, lev_config_name(l));
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
@ -930,7 +930,7 @@ int state_scrub(struct snapraid_state* state, int plan100, int olderthan)
ret = parity_close(&parity_handle[l]);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("parity_%s:%u:%s: Close error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_tag("parity_%s:%" PRIu64 ":%s: Close error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_fatal_errno(errno, lev_config_name(l));
++process_error;

View file

@ -1079,7 +1079,7 @@ int snapraid_main(int argc, char* argv[])
}
break;
case 'S' :
blockstart = strtoul(optarg, &e, 0);
blockstart = strtoull(optarg, &e, 0);
if (e == optarg || *e) {
/* LCOV_EXCL_START */
log_fatal(EUSER, "Invalid start position '%s'\n", optarg);
@ -1088,7 +1088,7 @@ int snapraid_main(int argc, char* argv[])
}
break;
case 'B' :
blockcount = strtoul(optarg, &e, 0);
blockcount = strtoull(optarg, &e, 0);
if (e == optarg || *e) {
/* LCOV_EXCL_START */
log_fatal(EUSER, "Invalid count number '%s'\n", optarg);

View file

@ -2104,14 +2104,14 @@ static void decoding_error(const char* path, STREAM* f)
static void state_read_content(struct snapraid_state* state, const char* path, STREAM* f)
{
block_off_t blockmax;
unsigned count_file;
unsigned count_hardlink;
unsigned count_symlink;
unsigned count_dir;
unsigned count_bad;
unsigned count_rehash;
unsigned count_unsynced;
unsigned count_unscrubbed;
uint64_t count_file;
uint64_t count_hardlink;
uint64_t count_symlink;
uint64_t count_dir;
uint64_t count_bad;
uint64_t count_rehash;
uint64_t count_unsynced;
uint64_t count_unscrubbed;
int crc_checked;
char buffer[PATH_MAX];
int ret;
@ -2290,12 +2290,12 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
v_idx = 0;
while (v_idx < file->blockmax) {
block_off_t v_pos;
uint32_t v_count;
block_off_t v_count;
/* get the "subcommand */
c = sgetc(f);
ret = sgetb32(f, &v_pos);
ret = sgetb64(f, &v_pos);
if (ret < 0) {
/* LCOV_EXCL_START */
decoding_error(path, f);
@ -2303,7 +2303,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* LCOV_EXCL_STOP */
}
ret = sgetb32(f, &v_count);
ret = sgetb64(f, &v_count);
if (ret < 0) {
/* LCOV_EXCL_START */
decoding_error(path, f);
@ -2322,7 +2322,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
if (v_count > blockmax || v_pos > blockmax - v_count) {
/* LCOV_EXCL_START */
decoding_error(path, f);
log_fatal(EINTERNAL, "Internal inconsistency: Block size %u/%u!\n", blockmax, v_pos + v_count);
log_fatal(EINTERNAL, "Internal inconsistency: Block size %" PRIu64 "/%" PRIu64 "!\n", blockmax, v_pos + v_count);
os_abort();
/* LCOV_EXCL_STOP */
}
@ -2395,7 +2395,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
} else if (c == 'i') {
/* "inf" command */
snapraid_info info;
uint32_t v_pos;
block_off_t v_pos;
uint64_t v_oldest;
ret = sgetb64(f, &v_oldest);
@ -2413,9 +2413,9 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
int justsynced;
uint64_t t64;
uint32_t flag;
uint32_t v_count;
block_off_t v_count;
ret = sgetb32(f, &v_count);
ret = sgetb64(f, &v_count);
if (ret < 0) {
/* LCOV_EXCL_START */
decoding_error(path, f);
@ -2426,7 +2426,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
if (v_count > blockmax || v_pos > blockmax - v_count) {
/* LCOV_EXCL_START */
decoding_error(path, f);
log_fatal(EINTERNAL, "Internal inconsistency: Info size %u/%u!\n", blockmax, v_pos + v_count);
log_fatal(EINTERNAL, "Internal inconsistency: Info size %" PRIu64 "/%" PRIu64 "!\n", blockmax, v_pos + v_count);
os_abort();
/* LCOV_EXCL_STOP */
}
@ -2507,7 +2507,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
}
} else if (c == 'h') {
/* hole */
uint32_t v_pos;
block_off_t v_pos;
struct snapraid_disk* disk;
uint32_t mapping;
@ -2523,11 +2523,11 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
v_pos = 0;
while (v_pos < blockmax) {
uint32_t v_idx;
uint32_t v_count;
block_off_t v_idx;
block_off_t v_count;
struct snapraid_file* deleted;
ret = sgetb32(f, &v_count);
ret = sgetb64(f, &v_count);
if (ret < 0) {
/* LCOV_EXCL_START */
decoding_error(path, f);
@ -2538,7 +2538,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
if (v_count > blockmax || v_pos > blockmax - v_count) {
/* LCOV_EXCL_START */
decoding_error(path, f);
log_fatal(EINTERNAL, "Internal inconsistency: Hole size %u/%u!\n", blockmax, v_pos + v_count);
log_fatal(EINTERNAL, "Internal inconsistency: Hole size %" PRIu64 "/%" PRIu64 "!\n", blockmax, v_pos + v_count);
os_abort();
/* LCOV_EXCL_STOP */
}
@ -2599,8 +2599,8 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
}
} else if (c == 'd') {
/* dealloc */
uint32_t v_count;
uint32_t v_pos;
block_off_t v_count;
block_off_t v_pos;
struct snapraid_disk* disk;
uint32_t mapping;
@ -2614,7 +2614,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
}
disk = tommy_array_get(&disk_mapping, mapping);
ret = sgetb32(f, &v_count);
ret = sgetb64(f, &v_count);
if (ret < 0) {
/* LCOV_EXCL_START */
decoding_error(path, f);
@ -2622,7 +2622,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* LCOV_EXCL_STOP */
}
log_tag("content_info:dealloc:%s:%u\n", esc_tag(disk->name), v_count);
log_tag("content_info:dealloc:%s:%" PRIu64 "\n", esc_tag(disk->name), v_count);
for (v_pos = 0; v_pos < v_count; ++v_pos) {
char sub[PATH_MAX];
@ -2973,7 +2973,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* LCOV_EXCL_STOP */
}
} else if (c == 'x') {
ret = sgetb32(f, &blockmax);
ret = sgetb64(f, &blockmax);
if (ret < 0) {
/* LCOV_EXCL_START */
decoding_error(path, f);
@ -2983,9 +2983,9 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
} else if (c == 'm' || c == 'M') {
struct snapraid_map* map;
char uuid[UUID_MAX];
uint32_t v_pos;
uint32_t v_total_blocks;
uint32_t v_free_blocks;
uint32_t v_idx;
block_off_t v_total_blocks;
block_off_t v_free_blocks;
struct snapraid_disk* disk;
ret = sgetbs(f, buffer, sizeof(buffer));
@ -2996,7 +2996,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* LCOV_EXCL_STOP */
}
ret = sgetb32(f, &v_pos);
ret = sgetb32(f, &v_idx);
if (ret < 0) {
/* LCOV_EXCL_START */
decoding_error(path, f);
@ -3006,7 +3006,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* from SnapRAID 7.0 the 'M' command includes the free space */
if (c == 'M') {
ret = sgetb32(f, &v_total_blocks);
ret = sgetb64(f, &v_total_blocks);
if (ret < 0) {
/* LCOV_EXCL_START */
decoding_error(path, f);
@ -3014,7 +3014,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* LCOV_EXCL_STOP */
}
ret = sgetb32(f, &v_free_blocks);
ret = sgetb64(f, &v_free_blocks);
if (ret < 0) {
/* LCOV_EXCL_START */
decoding_error(path, f);
@ -3068,7 +3068,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* LCOV_EXCL_STOP */
}
map = map_alloc(disk->name, v_pos, v_total_blocks, v_free_blocks, uuid);
map = map_alloc(disk->name, v_idx, v_total_blocks, v_free_blocks, uuid);
tommy_list_insert_tail(&state->maplist, &map->node, map);
@ -3083,8 +3083,8 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
*/
char v_uuid[UUID_MAX];
uint32_t v_level;
uint32_t v_total_blocks;
uint32_t v_free_blocks;
block_off_t v_total_blocks;
block_off_t v_free_blocks;
ret = sgetb32(f, &v_level);
if (ret < 0) {
@ -3094,7 +3094,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* LCOV_EXCL_STOP */
}
ret = sgetb32(f, &v_total_blocks);
ret = sgetb64(f, &v_total_blocks);
if (ret < 0) {
/* LCOV_EXCL_START */
decoding_error(path, f);
@ -3102,7 +3102,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* LCOV_EXCL_STOP */
}
ret = sgetb32(f, &v_free_blocks);
ret = sgetb64(f, &v_free_blocks);
if (ret < 0) {
/* LCOV_EXCL_START */
decoding_error(path, f);
@ -3156,8 +3156,8 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
} else if (c == 'Q') {
/* from SnapRAID 11.0 the 'Q' command include size info and multi file support */
uint32_t v_level;
uint32_t v_total_blocks;
uint32_t v_free_blocks;
block_off_t v_total_blocks;
block_off_t v_free_blocks;
uint32_t v_split_mac;
unsigned s;
@ -3169,7 +3169,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* LCOV_EXCL_STOP */
}
ret = sgetb32(f, &v_total_blocks);
ret = sgetb64(f, &v_total_blocks);
if (ret < 0) {
/* LCOV_EXCL_START */
decoding_error(path, f);
@ -3177,7 +3177,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* LCOV_EXCL_STOP */
}
ret = sgetb32(f, &v_free_blocks);
ret = sgetb64(f, &v_free_blocks);
if (ret < 0) {
/* LCOV_EXCL_START */
decoding_error(path, f);
@ -3362,7 +3362,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* check that the stored parity size matches the loaded state */
if (blockmax != parity_allocated_size(state)) {
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: Parity size %u/%u in '%s' at offset %" PRIi64 "\n", blockmax, parity_allocated_size(state), path, stell(f));
log_fatal(EINTERNAL, "Internal inconsistency: Parity size %" PRIu64 "/%" PRIu64 " in '%s' at offset %" PRIi64 "\n", blockmax, parity_allocated_size(state), path, stell(f));
if (state->opt.skip_content_check) {
log_fatal(ECONTENT, "Overriding.\n");
blockmax = parity_allocated_size(state);
@ -3372,21 +3372,21 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* LCOV_EXCL_STOP */
}
msg_verbose("%8u files\n", count_file);
msg_verbose("%8u hardlinks\n", count_hardlink);
msg_verbose("%8u symlinks\n", count_symlink);
msg_verbose("%8u empty dirs\n", count_dir);
msg_verbose("%8" PRIu64 " files\n", count_file);
msg_verbose("%8" PRIu64 " hardlinks\n", count_hardlink);
msg_verbose("%8" PRIu64 " symlinks\n", count_symlink);
msg_verbose("%8" PRIu64 " empty dirs\n", count_dir);
log_tag("content_info:file:%u\n", count_file);
log_tag("content_info:hardlink:%u\n", count_hardlink);
log_tag("content_info:symlink:%u\n", count_symlink);
log_tag("content_info:dir_empty:%u\n", count_dir);
log_tag("content_info:file:%" PRIu64 "\n", count_file);
log_tag("content_info:hardlink:%" PRIu64 "\n", count_hardlink);
log_tag("content_info:symlink:%" PRIu64 "\n", count_symlink);
log_tag("content_info:dir_empty:%" PRIu64 "\n", count_dir);
log_tag("content_info:block:%u\n", blockmax);
log_tag("content_info:block_bad:%u\n", count_bad);
log_tag("content_info:block_rehash:%u\n", count_rehash);
log_tag("content_info:block_unsynced:%u\n", count_unsynced);
log_tag("content_info:block_unscrubbed:%u\n", count_unscrubbed);
log_tag("content_info:block:%" PRIu64 "\n", blockmax);
log_tag("content_info:block_bad:%" PRIu64 "\n", count_bad);
log_tag("content_info:block_rehash:%" PRIu64 "\n", count_rehash);
log_tag("content_info:block_unsynced:%" PRIu64 "\n", count_unsynced);
log_tag("content_info:block_unscrubbed:%" PRIu64 "\n", count_unscrubbed);
/* store the blocks counters */
state->rehash_blocks = count_rehash;
@ -3414,14 +3414,14 @@ struct state_write_thread_context {
/* output (required to postpone the output to the terminal after the latest write) */
uint32_t crc;
unsigned count_file;
unsigned count_hardlink;
unsigned count_symlink;
unsigned count_dir;
unsigned count_bad;
unsigned count_rehash;
unsigned count_unsynced;
unsigned count_unscrubbed;
uint64_t count_file;
uint64_t count_hardlink;
uint64_t count_symlink;
uint64_t count_dir;
uint64_t count_bad;
uint64_t count_rehash;
uint64_t count_unsynced;
uint64_t count_unscrubbed;
};
static void* state_write_thread(void* arg)
@ -3435,14 +3435,14 @@ static void* state_write_thread(void* arg)
STREAM* f = context->f;
uint32_t crc;
uint64_t t64;
unsigned count_file;
unsigned count_hardlink;
unsigned count_symlink;
unsigned count_dir;
unsigned count_bad;
unsigned count_rehash;
unsigned count_unsynced;
unsigned count_unscrubbed;
uint64_t count_file;
uint64_t count_hardlink;
uint64_t count_symlink;
uint64_t count_dir;
uint64_t count_bad;
uint64_t count_rehash;
uint64_t count_unsynced;
uint64_t count_unscrubbed;
tommy_node* i;
block_off_t idx;
block_off_t begin;
@ -3480,7 +3480,7 @@ static void* state_write_thread(void* arg)
sputc('z', f);
sputb32(state->block_size, f);
sputc('x', f);
sputb32(blockmax, f);
sputb64(blockmax, f);
/* hash size */
sputc('y', f);
@ -3560,8 +3560,8 @@ static void* state_write_thread(void* arg)
sputc('M', f);
sputbs(map->name, f);
sputb32(map->position, f);
sputb32(map->total_blocks, f);
sputb32(map->free_blocks, f);
sputb64(map->total_blocks, f);
sputb64(map->free_blocks, f);
sputbs(map->uuid, f);
if (context->first) {
log_tag("content_data:%s:%" PRIi64 ":%" PRIi64 "\n",
@ -3585,8 +3585,8 @@ static void* state_write_thread(void* arg)
for (l = 0; l < state->level; ++l) {
sputc('Q', f);
sputb32(l, f);
sputb32(state->parity[l].total_blocks, f);
sputb32(state->parity[l].free_blocks, f);
sputb64(state->parity[l].total_blocks, f);
sputb64(state->parity[l].free_blocks, f);
if (context->first) {
log_tag("content_parity:%s:%" PRIi64 ":%" PRIi64 "\n",
lev_config_name(l),
@ -3664,7 +3664,7 @@ static void* state_write_thread(void* arg)
while (begin < file->blockmax) {
unsigned v_state = block_state_get(fs_file2block_get(file, begin));
block_off_t v_pos = fs_file2par_get(disk, file, begin);
uint32_t v_count;
block_off_t v_count;
block_off_t end;
@ -3690,15 +3690,15 @@ static void* state_write_thread(void* arg)
break;
default :
/* LCOV_EXCL_START */
log_fatal(EINTERNAL, "Internal inconsistency: State for block %u state %u\n", v_pos, v_state);
log_fatal(EINTERNAL, "Internal inconsistency: State for block %" PRIu64 " state %u\n", v_pos, v_state);
goto bail;
/* LCOV_EXCL_STOP */
}
sputb32(v_pos, f);
sputb64(v_pos, f);
v_count = end - begin;
sputb32(v_count, f);
sputb64(v_count, f);
/* write hashes */
for (idx = begin; idx < end; ++idx) {
@ -3788,7 +3788,7 @@ static void* state_write_thread(void* arg)
++end;
}
sputb32(end - begin, f);
sputb64(end - begin, f);
if (is_deleted) {
/* write the run of deleted blocks with hash */
@ -3826,10 +3826,10 @@ static void* state_write_thread(void* arg)
sputc('d', f);
sputb32(disk->mapping_idx, f);
uint32_t v_count = tommy_list_count(&disk->dealloclist);
block_off_t v_count = tommy_list_count(&disk->dealloclist);
sputb32(v_count, f);
log_tag("content_info:dealloc:%s:%u\n", esc_tag(disk->name), v_count);
sputb64(v_count, f);
log_tag("content_info:dealloc:%s:%" PRIu64 "\n", esc_tag(disk->name), v_count);
/* for each file */
for (j = tommy_list_head(&disk->dealloclist); j != 0; j = j->next) {
@ -3895,7 +3895,7 @@ static void* state_write_thread(void* arg)
}
count = end - begin;
sputb32(count, f);
sputb64(count, f);
/* if there is info */
if (info) {
@ -4029,14 +4029,14 @@ static void state_write_content(struct snapraid_state* state, uint32_t* out_crc)
int mapping_idx;
block_off_t idx;
uint32_t crc;
unsigned count_file;
unsigned count_hardlink;
unsigned count_symlink;
unsigned count_dir;
unsigned count_bad;
unsigned count_rehash;
unsigned count_unsynced;
unsigned count_unscrubbed;
block_off_t count_file;
block_off_t count_hardlink;
block_off_t count_symlink;
block_off_t count_dir;
block_off_t count_bad;
block_off_t count_rehash;
block_off_t count_unsynced;
block_off_t count_unscrubbed;
/* blocks of all array */
blockmax = parity_allocated_size(state);
@ -4357,21 +4357,21 @@ static void state_write_content(struct snapraid_state* state, uint32_t* out_crc)
free(context);
#endif
msg_verbose("%8u files\n", count_file);
msg_verbose("%8u hardlinks\n", count_hardlink);
msg_verbose("%8u symlinks\n", count_symlink);
msg_verbose("%8u empty dirs\n", count_dir);
msg_verbose("%8" PRIu64 " files\n", count_file);
msg_verbose("%8" PRIu64 " hardlinks\n", count_hardlink);
msg_verbose("%8" PRIu64 " symlinks\n", count_symlink);
msg_verbose("%8" PRIu64 " empty dirs\n", count_dir);
log_tag("content_info:file:%u\n", count_file);
log_tag("content_info:hardlink:%u\n", count_hardlink);
log_tag("content_info:symlink:%u\n", count_symlink);
log_tag("content_info:dir_empty:%u\n", count_dir);
log_tag("content_info:file:%" PRIu64 "\n", count_file);
log_tag("content_info:hardlink:%" PRIu64 "\n", count_hardlink);
log_tag("content_info:symlink:%" PRIu64 "\n", count_symlink);
log_tag("content_info:dir_empty:%" PRIu64 "\n", count_dir);
log_tag("content_info:block:%u\n", blockmax);
log_tag("content_info:block_bad:%u\n", count_bad);
log_tag("content_info:block_rehash:%u\n", count_rehash);
log_tag("content_info:block_unsynced:%u\n", count_unsynced);
log_tag("content_info:block_unscrubbed:%u\n", count_unscrubbed);
log_tag("content_info:block:%" PRIu64 "\n", blockmax);
log_tag("content_info:block_bad:%" PRIu64 "\n", count_bad);
log_tag("content_info:block_rehash:%" PRIu64 "\n", count_rehash);
log_tag("content_info:block_unsynced:%" PRIu64 "\n", count_unsynced);
log_tag("content_info:block_unscrubbed:%" PRIu64 "\n", count_unscrubbed);
/* store the blocks counters */
state->rehash_blocks = count_rehash;
@ -4957,7 +4957,7 @@ int state_progress_begin(struct snapraid_state* state, block_off_t blockstart, b
time_t now;
if (state->opt.gui) {
log_tag("run:begin:%u:%u:%u\n", blockstart, blockmax, countmax);
log_tag("run:begin:%" PRIu64 ":%" PRIu64 ":%" PRIu64 "\n", blockstart, blockmax, countmax);
log_flush();
}
@ -5463,7 +5463,7 @@ int state_progress(struct snapraid_state* state, struct snapraid_io* io, block_o
} else {
str_steady[0] = 0;
}
log_tag("run:pos:%u:%u:%" PRIu64 ":%u:%s:%s:%s:%" PRIu64 ":%s:%s\n", blockpos, countpos, countsize, out_perc, str_eta, str_size_speed, str_cpu, (uint64_t)elapsed, str_temp, str_steady);
log_tag("run:pos:%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%u:%s:%s:%s:%" PRIu64 ":%s:%s\n", blockpos, countpos, countsize, out_perc, str_eta, str_size_speed, str_cpu, (uint64_t)elapsed, str_temp, str_steady);
log_flush();
} else {
msg_bar("%u%%, %u MB", out_perc, (unsigned)(countsize / MEGA));
@ -5500,8 +5500,8 @@ int state_progress(struct snapraid_state* state, struct snapraid_io* io, block_o
msg_bar("\n");
msg_flush();
}
log_fatal(EUSER, "Stopping for interruption at block %u\n", blockpos);
log_tag("sigint:%u: SIGINT received\n", blockpos);
log_fatal(EUSER, "Stopping for interruption at block %" PRIu64 "\n", blockpos);
log_tag("sigint:%" PRIu64 ": SIGINT received\n", blockpos);
log_flush();
return 1;
/* LCOV_EXCL_STOP */
@ -5728,7 +5728,7 @@ int state_flush(struct snapraid_state* state, struct snapraid_io* io, struct sna
int ret = parity_sync(&parity_handle[l]);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("parity_error_io:%u:%s: Sync error. %s.\n", blockcur, lev_config_name(l), strerror(errno));
log_tag("parity_error_io:%" PRIu64 ":%s: Sync error. %s.\n", blockcur, lev_config_name(l), strerror(errno));
log_fatal(errno, "DANGER! Unexpected input/output error in disk %s. It isn't possible to continue.\n", lev_config_name(l));
return -1;
/* LCOV_EXCL_STOP */

View file

@ -65,19 +65,19 @@ int state_status(struct snapraid_state* state)
blockmax = parity_allocated_size(state);
log_tag("summary:block_size:%u\n", state->block_size);
log_tag("summary:parity_block_count:%u\n", blockmax);
log_tag("summary:parity_block_count:%" PRIu64 "\n", blockmax);
/* get the minimum parity free space */
parity_block_free = state->parity[0].free_blocks;
for (l = 0; l < state->level; ++l) {
log_tag("summary:parity_block_total:%s:%u\n", lev_config_name(l), state->parity[l].total_blocks);
log_tag("summary:parity_block_free:%s:%u\n", lev_config_name(l), state->parity[l].free_blocks);
log_tag("summary:parity_block_total:%s:%" PRIu64 "\n", lev_config_name(l), state->parity[l].total_blocks);
log_tag("summary:parity_block_free:%s:%" PRIu64 "\n", lev_config_name(l), state->parity[l].free_blocks);
if (state->parity[l].free_blocks < parity_block_free)
parity_block_free = state->parity[l].free_blocks;
if (state->parity[l].free_blocks != 0)
free_not_zero = 1;
}
log_tag("summary:parity_block_free_min:%u\n", parity_block_free);
log_tag("summary:parity_block_free_min:%" PRIu64 "\n", parity_block_free);
printf("SnapRAID status report:\n");
printf("\n");
@ -224,17 +224,17 @@ int state_status(struct snapraid_state* state)
printf(" %s\n", disk->name);
log_tag("summary:disk_file_count:%s:%u\n", disk->name, disk_file_count);
log_tag("summary:disk_block_count:%s:%u\n", disk->name, disk_block_count);
log_tag("summary:disk_block_count:%s:%" PRIu64 "\n", disk->name, disk_block_count);
log_tag("summary:disk_fragmented_file_count:%s:%u\n", disk->name, disk_file_fragmented);
log_tag("summary:disk_excess_fragment_count:%s:%u\n", disk->name, disk_extra_fragment);
log_tag("summary:disk_zerosubsecond_file_count:%s:%u\n", disk->name, disk_file_zerosubsecond);
log_tag("summary:disk_file_size:%s:%" PRIu64 "\n", disk->name, disk_file_size);
log_tag("summary:disk_block_allocated:%s:%u\n", disk->name, disk_block_latest_used + 1);
log_tag("summary:disk_block_total:%s:%u\n", disk->name, disk->total_blocks);
log_tag("summary:disk_block_free:%s:%u\n", disk->name, disk->free_blocks);
log_tag("summary:disk_block_max_by_space:%s:%u\n", disk->name, disk_block_max_by_space);
log_tag("summary:disk_block_max_by_parity:%s:%u\n", disk->name, disk_block_max_by_parity);
log_tag("summary:disk_block_max:%s:%u\n", disk->name, disk_block_max);
log_tag("summary:disk_block_allocated:%s:%" PRIu64 "\n", disk->name, disk_block_latest_used + 1);
log_tag("summary:disk_block_total:%s:%" PRIu64 "\n", disk->name, disk->total_blocks);
log_tag("summary:disk_block_free:%s:%" PRIu64 "\n", disk->name, disk->free_blocks);
log_tag("summary:disk_block_max_by_space:%s:%" PRIu64 "\n", disk->name, disk_block_max_by_space);
log_tag("summary:disk_block_max_by_parity:%s:%" PRIu64 "\n", disk->name, disk_block_max_by_parity);
log_tag("summary:disk_block_max:%s:%" PRIu64 "\n", disk->name, disk_block_max);
log_tag("summary:disk_space_wasted:%s:%" PRId64 "\n", disk->name, wasted);
disk_used_bytes = disk_block_count * (uint64_t)state->block_size;
@ -326,7 +326,7 @@ int state_status(struct snapraid_state* state)
log_tag("scrub_graph_range:%u:%u\n", GRAPH_COLUMN, barmax);
for (i = 0; i < GRAPH_COLUMN; ++i) {
unsigned days_ago = dayoldest - (dayoldest - daynewest) * i / (GRAPH_COLUMN - 1);
log_tag("scrub_graph_bar:%u:%u:%u:%u\n", i, days_ago, bar_scrubbed[i], bar_new[i]);
log_tag("scrub_graph_bar:%" PRIu64 ":%u:%u:%u\n", i, days_ago, bar_scrubbed[i], bar_new[i]);
}
printf("\n\n");
@ -334,11 +334,11 @@ int state_status(struct snapraid_state* state)
/* print the graph */
for (y = 0; y < GRAPH_ROW; ++y) {
if (y == 0)
printf("%3u%%|", barmax * 100 / count);
printf("%3" PRIu64 "%%|", barmax * 100 / count);
else if (y == GRAPH_ROW - 1)
printf(" 0%%|");
else if (y == GRAPH_ROW / 2)
printf("%3u%%|", barmax * 50 / count);
printf("%3" PRIu64 "%%|", barmax * 50 / count);
else
printf(" |");
for (x = 0; x < GRAPH_COLUMN; ++x) {
@ -451,9 +451,9 @@ int state_status(struct snapraid_state* state)
/* break the range */
if (range_count) {
if (range_count == 1) {
printf(" %u", range_start);
printf(" %" PRIu64 "", range_start);
} else {
printf(" %u-%u", range_start, range_start + range_count - 1);
printf(" %" PRIu64 "-%" PRIu64 "", range_start, range_start + range_count - 1);
}
bad_count += range_count;
++bad_range;
@ -462,7 +462,7 @@ int state_status(struct snapraid_state* state)
}
if (bad_range > 100) {
printf(" and %u more...", state->bad_blocks - bad_count);
printf(" and %" PRIu64 " more...", state->bad_blocks - bad_count);
break;
}
}

View file

@ -137,9 +137,9 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
* This one is really an unexpected error, because we are only reading
* and closing a descriptor should never fail
*/
log_tag("%s:%u:%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(report->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(report->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping at block %u\n", blockcur);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", blockcur);
if (is_hw(errno)) {
++io_error;
@ -153,7 +153,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
ret = handle_open(&handle[j], file, state->file_mode, 0);
if (ret == -1) {
log_tag("%s:%u:%s:%s: Open error. %s.\n", es(errno), blockcur, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Open error. %s.\n", es(errno), blockcur, disk->name, esc_tag(file->sub), strerror(errno));
if (errno == ENOENT) {
log_error_errno(errno, disk->name);
@ -177,7 +177,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
log_fatal_errno(errno, disk->name);
if (is_hw(errno)) {
log_fatal(errno, "Stopping at block %u\n", blockcur);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", blockcur);
++io_error;
} else {
log_fatal(errno, "Stopping to allow recovery. Try with 'snapraid check -f /%s'\n", fmt_poll(disk, file->sub));
@ -194,14 +194,14 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
|| handle[j].st.st_ino != file->inode
) {
if (handle[j].st.st_size != file->size) {
log_tag("error:%u:%s:%s: Unexpected size change\n", blockcur, disk->name, esc_tag(file->sub));
log_tag("error:%" PRIu64 ":%s:%s: Unexpected size change\n", blockcur, disk->name, esc_tag(file->sub));
log_error(ESOFT, "Unexpected size change at file '%s' from %" PRIu64 " to %" PRIu64 ".\n", handle[j].path, file->size, (uint64_t)handle[j].st.st_size);
} else if (handle[j].st.st_mtime != file->mtime_sec
|| STAT_NSEC(&handle[j].st) != file->mtime_nsec) {
log_tag("error:%u:%s:%s: Unexpected time change\n", blockcur, disk->name, esc_tag(file->sub));
log_tag("error:%" PRIu64 ":%s:%s: Unexpected time change\n", blockcur, disk->name, esc_tag(file->sub));
log_error(ESOFT, "Unexpected time change at file '%s' from %" PRIu64 ".%d to %" PRIu64 ".%d.\n", handle[j].path, file->mtime_sec, file->mtime_nsec, (uint64_t)handle[j].st.st_mtime, STAT_NSEC(&handle[j].st));
} else {
log_tag("error:%u:%s:%s: Unexpected inode change\n", blockcur, disk->name, esc_tag(file->sub));
log_tag("error:%" PRIu64 ":%s:%s: Unexpected inode change\n", blockcur, disk->name, esc_tag(file->sub));
log_error(ESOFT, "Unexpected inode change from %" PRIu64 " to %" PRIu64 " at file '%s'.\n", file->inode, (uint64_t)handle[j].st.st_ino, handle[j].path);
}
log_error_errno(ENOENT, disk->name); /* same message for ENOENT */
@ -218,11 +218,11 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
read_size = handle_read(&handle[j], file_pos, buffer, state->block_size, 0);
if (read_size == -1) {
/* LCOV_EXCL_START */
log_tag("%s:%u:%s:%s: Read error at position %u. %s.\n", es(errno), blockcur, disk->name, esc_tag(file->sub), file_pos, strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Read error at position %" PRIu64 ". %s.\n", es(errno), blockcur, disk->name, esc_tag(file->sub), file_pos, strerror(errno));
log_fatal_errno(errno, disk->name);
if (is_hw(errno)) {
log_fatal(errno, "Stopping at block %u\n", blockcur);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", blockcur);
++io_error;
} else {
log_fatal(errno, "Stopping to allow recovery. Try with 'snapraid check -f /%s'\n", fmt_poll(disk, file->sub));
@ -252,8 +252,8 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
if (block_state == BLOCK_STATE_REP) {
/* compare the hash */
if (memcmp(hash, block->hash, BLOCK_HASH_SIZE) != 0) {
log_tag("error_data:%u:%s:%s: Unexpected data change\n", blockcur, disk->name, esc_tag(file->sub));
log_error(EDATA, "Data change at file '%s' at position '%u'\n", handle[j].path, file_pos);
log_tag("error_data:%" PRIu64 ":%s:%s: Unexpected data change\n", blockcur, disk->name, esc_tag(file->sub));
log_error(EDATA, "Data change at file '%s' at position '%" PRIu64 "'\n", handle[j].path, file_pos);
log_error(EDATA, "WARNING! Unexpected data modification of a file without parity!\n");
if (file_flag_has(file, FILE_IS_COPY)) {
@ -305,9 +305,9 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
* This one is really an unexpected error, because we are only reading
* and closing a descriptor should never fail
*/
log_tag("%s:%u:%s:%s: Close error. %s.\n", es(errno), blockmax, disk->name, esc_tag(report->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Close error. %s.\n", es(errno), blockmax, disk->name, esc_tag(report->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping at block %u\n", blockmax);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", blockmax);
if (is_hw(errno)) {
++io_error;
@ -354,7 +354,7 @@ bail:
ret = handle_close(&handle[j]);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("%s:%u:%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
if (is_hw(errno)) {
@ -506,9 +506,9 @@ static void sync_data_reader(struct snapraid_worker* worker, struct snapraid_tas
* This one is really an unexpected error, because we are only reading
* and closing a descriptor should never fail
*/
log_tag("%s:%u:%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(report->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(report->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping at block %u\n", blockcur);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", blockcur);
if (is_hw(errno)) {
task->state = TASK_STATE_IOERROR;
@ -522,7 +522,7 @@ static void sync_data_reader(struct snapraid_worker* worker, struct snapraid_tas
ret = handle_open(handle, task->file, state->file_mode, 0);
if (ret == -1) {
log_tag("%s:%u:%s:%s: Open error. %s.\n", es(errno), blockcur, disk->name, esc_tag(task->file->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Open error. %s.\n", es(errno), blockcur, disk->name, esc_tag(task->file->sub), strerror(errno));
if (errno == ENOENT) {
log_error_errno(errno, disk->name);
@ -546,7 +546,7 @@ static void sync_data_reader(struct snapraid_worker* worker, struct snapraid_tas
log_fatal_errno(errno, disk->name);
if (is_hw(errno)) {
log_fatal(errno, "Stopping at block %u\n", blockcur);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", blockcur);
task->state = TASK_STATE_IOERROR;
} else {
log_fatal(errno, "Stopping to allow recovery. Try with 'snapraid check -f /%s'\n", fmt_poll(disk, task->file->sub));
@ -562,7 +562,7 @@ static void sync_data_reader(struct snapraid_worker* worker, struct snapraid_tas
|| STAT_NSEC(&handle->st) != task->file->mtime_nsec
|| handle->st.st_ino != task->file->inode
) {
log_tag("error:%u:%s:%s: Unexpected attribute change\n", blockcur, disk->name, esc_tag(task->file->sub));
log_tag("error:%" PRIu64 ":%s:%s: Unexpected attribute change\n", blockcur, disk->name, esc_tag(task->file->sub));
if (handle->st.st_size != task->file->size) {
log_error(ESOFT, "Unexpected size change at file '%s' from %" PRIu64 " to %" PRIu64 ".\n", handle->path, task->file->size, (uint64_t)handle->st.st_size);
} else if (handle->st.st_mtime != task->file->mtime_sec
@ -584,7 +584,7 @@ static void sync_data_reader(struct snapraid_worker* worker, struct snapraid_tas
task->read_size = handle_read(handle, task->file_pos, buffer, state->block_size, 0);
if (task->read_size == -1) {
/* LCOV_EXCL_START */
log_tag("%s:%u:%s:%s: Read error at position %u. %s.\n", es(errno), blockcur, disk->name, esc_tag(task->file->sub), task->file_pos, strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Read error at position %" PRIu64 ". %s.\n", es(errno), blockcur, disk->name, esc_tag(task->file->sub), task->file_pos, strerror(errno));
if (is_hw(errno)) {
log_fatal_errno(errno, disk->name);
@ -619,7 +619,7 @@ static void sync_parity_writer(struct snapraid_worker* worker, struct snapraid_t
ret = parity_write(parity_handle, blockcur, buffer, state->block_size);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("parity_%s:%u:%s: Write error. %s.\n", es(errno), blockcur, lev_config_name(level), strerror(errno));
log_tag("parity_%s:%" PRIu64 ":%s: Write error. %s.\n", es(errno), blockcur, lev_config_name(level), strerror(errno));
if (is_hw(errno)) {
log_fatal_errno(errno, lev_config_name(level));
@ -627,7 +627,7 @@ static void sync_parity_writer(struct snapraid_worker* worker, struct snapraid_t
task->state = TASK_STATE_IOERROR_CONTINUE;
} else {
log_fatal_errno(errno, lev_config_name(level));
log_fatal(errno, "Stopping at block %u\n", blockcur);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", blockcur);
task->state = TASK_STATE_ERROR;
}
return;
@ -906,7 +906,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
if (io_error >= state->opt.io_error_limit) {
/* LCOV_EXCL_START */
log_fatal(EIO, "DANGER! Too many input/output errors in the %s disk. It isn't possible to continue.\n", disk->dir);
log_fatal(EIO, "Stopping at block %u\n", blockcur);
log_fatal(EIO, "Stopping at block %" PRIu64 "\n", blockcur);
goto bail;
/* LCOV_EXCL_STOP */
}
@ -943,8 +943,8 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
if (memcmp(hash, block->hash, BLOCK_HASH_SIZE) != 0) {
/* if the file has invalid parity, it's a REP changed during the sync */
if (block_has_invalid_parity(block)) {
log_tag("error:%u:%s:%s: Unexpected data change\n", blockcur, disk->name, esc_tag(file->sub));
log_error(ESOFT, "Data change at file '%s' at position '%u'\n", task->path, file_pos);
log_tag("error:%" PRIu64 ":%s:%s: Unexpected data change\n", blockcur, disk->name, esc_tag(file->sub));
log_error(ESOFT, "Data change at file '%s' at position '%" PRIu64 "'\n", task->path, file_pos);
log_error(ESOFT, "WARNING! Unexpected data modification of a file without parity!\n");
if (file_flag_has(file, FILE_IS_COPY)) {
@ -966,8 +966,8 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
continue;
} else { /* otherwise it's a BLK with silent error */
unsigned diff = memdiff(hash, block->hash, BLOCK_HASH_SIZE);
log_tag("error_data:%u:%s:%s: Data error at position %u, diff hash bits %u/%zu\n", blockcur, disk->name, esc_tag(file->sub), file_pos, diff, BLOCK_HASH_SIZE * 8);
log_error(EDATA, "Data error in file '%s' at position '%u', diff hash bits %u/%zu\n", task->path, file_pos, diff, BLOCK_HASH_SIZE * 8);
log_tag("error_data:%" PRIu64 ":%s:%s: Data error at position %" PRIu64 ", diff hash bits %u/%zu\n", blockcur, disk->name, esc_tag(file->sub), file_pos, diff, BLOCK_HASH_SIZE * 8);
log_error(EDATA, "Data error in file '%s' at position '%" PRIu64 "', diff hash bits %u/%zu\n", task->path, file_pos, diff, BLOCK_HASH_SIZE * 8);
/* save the failed block for the fix */
failed[failed_count].index = diskcur;
@ -1117,12 +1117,12 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
ret = parity_read(&parity_handle[l], blockcur, buffer[diskmax + l], state->block_size);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("parity_%s:%u:%s: Read error. %s.\n", es(errno), blockcur, lev_config_name(l), strerror(errno));
log_tag("parity_%s:%" PRIu64 ":%s: Read error. %s.\n", es(errno), blockcur, lev_config_name(l), strerror(errno));
if (is_hw(errno)) {
log_fatal_errno(errno, lev_config_name(l));
if (io_error >= state->opt.io_error_limit) {
log_fatal(errno, "DANGER! Too many input/output errors in the %s disk. It isn't possible to continue.\n", lev_config_name(l));
log_fatal(errno, "Stopping at block %u\n", blockcur);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", blockcur);
++io_error;
goto bail;
}
@ -1133,7 +1133,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
}
log_fatal_errno(errno, lev_config_name(l));
log_fatal(errno, "Stopping at block %u\n", blockcur);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", blockcur);
++soft_error;
goto bail;
/* LCOV_EXCL_STOP */
@ -1313,7 +1313,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
if (io_error >= state->opt.io_error_limit) {
/* LCOV_EXCL_START */
log_fatal(EIO, "DANGER! Too many input/output errors in a parity disk. It isn't possible to continue.\n");
log_fatal(EIO, "Stopping at block %u\n", blockcur);
log_fatal(EIO, "Stopping at block %" PRIu64 "\n", blockcur);
goto bail;
/* LCOV_EXCL_STOP */
}
@ -1359,7 +1359,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
ret = state_flush(state, &io, parity_handle, blockcur);
if (ret == -1) {
/* LCOV_EXCL_START */
log_fatal(errno, "Stopping at block %u\n", blockcur);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", blockcur);
++io_error;
goto bail;
/* LCOV_EXCL_STOP */
@ -1396,7 +1396,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
ret = state_flush(state, &io, parity_handle, blockcur);
if (ret == -1) {
/* LCOV_EXCL_START */
log_fatal(EIO, "Stopping at block %u\n", blockcur);
log_fatal(EIO, "Stopping at block %" PRIu64 "\n", blockcur);
++io_error;
goto bail;
/* LCOV_EXCL_STOP */
@ -1422,7 +1422,7 @@ end:
ret = state_flush(state, &io, parity_handle, blockcur);
if (ret == -1) {
/* LCOV_EXCL_START */
log_fatal(errno, "Stopping at block %u\n", blockcur);
log_fatal(errno, "Stopping at block %" PRIu64 "\n", blockcur);
++io_error;
goto bail;
/* LCOV_EXCL_STOP */
@ -1485,7 +1485,7 @@ bail:
ret = handle_close(&handle[j]);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("%s:%u:%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("%s:%" PRIu64 ":%s:%s: Close error. %s.\n", es(errno), blockcur, disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
if (is_hw(errno)) {
@ -1548,7 +1548,7 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
if (blockstart > blockmax) {
/* LCOV_EXCL_START */
log_fatal(EUSER, "Error in the starting block %u. It is larger than the parity size %u.\n", blockstart, blockmax);
log_fatal(EUSER, "Error in the starting block %" PRIu64 ". It is larger than the parity size %" PRIu64 ".\n", blockstart, blockmax);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -1578,7 +1578,7 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
/* if the file is too small */
if (parityblocks < used_paritymax) {
log_fatal(ESOFT, "WARNING! The %s parity has only %u blocks instead of %u.\n", lev_name(l), parityblocks, used_paritymax);
log_fatal(ESOFT, "WARNING! The %s parity has only %" PRIu64 " blocks instead of %" PRIu64 ".\n", lev_name(l), parityblocks, used_paritymax);
}
/* keep the smallest parity number of blocks */
@ -1701,7 +1701,7 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
ret = parity_close(&parity_handle[l]);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("parity_%s:%u:%s: Close error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_tag("parity_%s:%" PRIu64 ":%s: Close error. %s.\n", es(errno), blockmax, lev_config_name(l), strerror(errno));
log_fatal_errno(errno, lev_config_name(l));
++process_error;