diff --git a/cmdline/check.c b/cmdline/check.c index 81a720c6..ab641b8f 100644 --- a/cmdline/check.c +++ b/cmdline/check.c @@ -882,7 +882,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna /* post process the files */ ret = file_post(state, fix, i, handle, diskmax); if (ret == -1) { - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++unrecoverable_error; goto bail; } @@ -978,7 +978,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna if (ret == -1) { /* LCOV_EXCL_START */ ferr("DANGER! Unexpected close error in a data disk, it isn't possible to check.\n"); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++unrecoverable_error; goto bail; /* LCOV_EXCL_STOP */ @@ -995,7 +995,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna } else { ferr("DANGER! Without a working data disk, it isn't possible to fix errors on it.\n"); } - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++unrecoverable_error; goto bail; /* LCOV_EXCL_STOP */ @@ -1055,7 +1055,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna if (ret == -1) { /* LCOV_EXCL_START */ ferr("DANGER! Unexpected truncate error in a data disk, it isn't possible to fix.\n"); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++unrecoverable_error; goto bail; /* LCOV_EXCL_STOP */ @@ -1249,7 +1249,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna /* we do not use DANGER because it could be ENOSPC which is not always correctly reported */ ferr("WARNING! Without a working data disk, it isn't possible to fix errors on it.\n"); } - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++unrecoverable_error; goto bail; /* LCOV_EXCL_STOP */ @@ -1282,7 +1282,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna /* LCOV_EXCL_START */ /* we do not use DANGER because it could be ENOSPC which is not always correctly reported */ ferr("WARNING! Without a working %s disk, it isn't possible to fix errors on it.\n", lev_name(l)); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++unrecoverable_error; goto bail; /* LCOV_EXCL_STOP */ @@ -1316,7 +1316,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna /* post process the files */ ret = file_post(state, fix, i, handle, diskmax); if (ret == -1) { - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++unrecoverable_error; goto bail; } @@ -1391,7 +1391,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna if (ret != 0) { /* LCOV_EXCL_START */ ferr("WARNING! Without a working data disk, it isn't possible to fix errors on it.\n"); - printf("Stopping\n"); + ferr("Stopping\n"); ++unrecoverable_error; goto bail; /* LCOV_EXCL_STOP */ @@ -1409,7 +1409,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna /* we do not use DANGER because it could be ENOSPC which is not always correctly reported */ ferr("WARNING! Without a working data disk, it isn't possible to fix errors on it.\n"); } - printf("Stopping\n"); + ferr("Stopping\n"); ++unrecoverable_error; goto bail; /* LCOV_EXCL_STOP */ @@ -1423,7 +1423,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna ferr("Error timing file '%s'. %s.\n", file->sub, strerror(errno)); ferr("WARNING! Without a working data disk, it isn't possible to fix errors on it.\n"); - printf("Stopping\n"); + ferr("Stopping\n"); ++unrecoverable_error; goto bail; /* LCOV_EXCL_STOP */ @@ -1434,7 +1434,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna if (ret != 0) { /* LCOV_EXCL_START */ ferr("WARNING! Without a working data disk, it isn't possible to fix errors on it.\n"); - printf("Stopping\n"); + ferr("Stopping\n"); ++unrecoverable_error; goto bail; /* LCOV_EXCL_STOP */ @@ -1557,7 +1557,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna if (ret != 0) { /* LCOV_EXCL_START */ ferr("WARNING! Without a working data disk, it isn't possible to fix errors on it.\n"); - printf("Stopping\n"); + ferr("Stopping\n"); ++unrecoverable_error; goto bail; /* LCOV_EXCL_STOP */ @@ -1569,7 +1569,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna /* LCOV_EXCL_START */ ferr("Error removing '%s'. %s.\n", path, strerror(errno)); ferr("WARNING! Without a working data disk, it isn't possible to fix errors on it.\n"); - printf("Stopping\n"); + ferr("Stopping\n"); ++unrecoverable_error; goto bail; /* LCOV_EXCL_STOP */ @@ -1587,7 +1587,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna /* we do not use DANGER because it could be ENOSPC which is not always correctly reported */ ferr("WARNING! Without a working data disk, it isn't possible to fix errors on it.\n"); } - printf("Stopping\n"); + ferr("Stopping\n"); ++unrecoverable_error; goto bail; /* LCOV_EXCL_STOP */ @@ -1606,7 +1606,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna /* we do not use DANGER because it could be ENOSPC which is not always correctly reported */ ferr("WARNING! Without a working data disk, it isn't possible to fix errors on it.\n"); } - printf("Stopping\n"); + ferr("Stopping\n"); ++unrecoverable_error; goto bail; /* LCOV_EXCL_STOP */ @@ -1662,7 +1662,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna if (ret != 0) { /* LCOV_EXCL_START */ ferr("WARNING! Without a working data disk, it isn't possible to fix errors on it.\n"); - printf("Stopping\n"); + ferr("Stopping\n"); ++unrecoverable_error; goto bail; /* LCOV_EXCL_STOP */ @@ -1679,7 +1679,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna /* we do not use DANGER because it could be ENOSPC which is not always correctly reported */ ferr("WARNING! Without a working data disk, it isn't possible to fix errors on it.\n"); } - printf("Stopping\n"); + ferr("Stopping\n"); ++unrecoverable_error; goto bail; /* LCOV_EXCL_STOP */ diff --git a/cmdline/dry.c b/cmdline/dry.c index 03783229..0a7c25c4 100644 --- a/cmdline/dry.c +++ b/cmdline/dry.c @@ -84,7 +84,7 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit /* LCOV_EXCL_START */ ftag("error:%u:%s:%s: Close error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("DANGER! Unexpected close error in a data disk, it isn't possible to dry.\n"); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++error; goto bail; /* LCOV_EXCL_STOP */ @@ -95,7 +95,7 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit if (ret == -1) { /* LCOV_EXCL_START */ ferr("DANGER! Unexpected open error in a data disk, it isn't possible to dry.\n"); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++error; goto bail; /* LCOV_EXCL_STOP */ diff --git a/cmdline/scrub.c b/cmdline/scrub.c index 643592dd..63b90db2 100644 --- a/cmdline/scrub.c +++ b/cmdline/scrub.c @@ -231,7 +231,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par ftag("error:%u:%s:%s: Close EIO error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("DANGER! Unexpected input/output close error in a data disk, it isn't possible to scrub.\n"); ferr("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle[j].path); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++io_error; goto bail; } @@ -239,7 +239,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par ftag("error:%u:%s:%s: Close error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("WARNING! Unexpected close error in a data disk, it isn't possible to scrub.\n"); ferr("Ensure that file '%s' can be accessed.\n", handle[j].path); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++error; goto bail; /* LCOV_EXCL_STOP */ @@ -255,7 +255,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par ftag("error:%u:%s:%s: Open EIO error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("DANGER! Unexpected input/output open error in a data disk, it isn't possible to scrub.\n"); ferr("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle[j].path); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++io_error; goto bail; /* LCOV_EXCL_STOP */ @@ -293,7 +293,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par /* LCOV_EXCL_START */ ferr("DANGER! Unexpected input/output read error in a data disk, it isn't possible to scrub.\n"); ferr("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle[j].path); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++io_error; goto bail; /* LCOV_EXCL_STOP */ @@ -371,7 +371,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par /* LCOV_EXCL_START */ ferr("DANGER! Unexpected input/output read error in the %s disk, it isn't possible to scrub.\n", lev_name(l)); ferr("Ensure that disk '%s' is sane and can be read.\n", lev_config_name(l)); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++io_error; goto bail; /* LCOV_EXCL_STOP */ diff --git a/cmdline/state.c b/cmdline/state.c index a006bc89..c4443538 100644 --- a/cmdline/state.c +++ b/cmdline/state.c @@ -4792,7 +4792,7 @@ int state_progress(struct snapraid_state* state, block_off_t blockpos, block_off /* LCOV_EXCL_START */ if (!state->opt.gui) { printf("\n"); - printf("Stopping for interruption at block %u\n", blockpos); + ferr("Stopping for interruption at block %u\n", blockpos); } ftag("sigint:%u: SIGINT received\n", blockpos); fflush_log(); diff --git a/cmdline/sync.c b/cmdline/sync.c index 2283ab35..8fdec709 100644 --- a/cmdline/sync.c +++ b/cmdline/sync.c @@ -135,7 +135,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta ftag("error:%u:%s:%s: Close EIO error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("DANGER! Unexpected input/output close error in a data disk, it isn't possible to sync.\n"); ferr("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle[j].path); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++io_error; goto bail; } @@ -143,7 +143,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta ftag("error:%u:%s:%s: Close error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("WARNING! Unexpected close error in a data disk, it isn't possible to sync.\n"); ferr("Ensure that file '%s' can be accessed.\n", handle[j].path); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++error; goto bail; /* LCOV_EXCL_STOP */ @@ -159,7 +159,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta ftag("error:%u:%s:%s: Open EIO error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("DANGER! Unexpected input/output open error in a data disk, it isn't possible to sync.\n"); ferr("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle[j].path); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++io_error; goto bail; /* LCOV_EXCL_STOP */ @@ -190,7 +190,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta ftag("error:%u:%s:%s: Open error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("WARNING! Unexpected open error in a data disk, it isn't possible to sync.\n"); ferr("Ensure that file '%s' can be accessed.\n", handle[j].path); - printf("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", file->sub); + ferr("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", file->sub); ++error; goto bail; /* LCOV_EXCL_STOP */ @@ -230,7 +230,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta ftag("error:%u:%s:%s: Read EIO error at position %u. %s\n", i, disk->name, file->sub, block_file_pos(block), strerror(errno)); ferr("DANGER! Unexpected input/output read error in a data disk, it isn't possible to sync.\n"); ferr("Ensure that disk '%s' is sane and that file '%s' can be read.\n", disk->dir, handle[j].path); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++io_error; goto bail; } @@ -238,7 +238,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta ftag("error:%u:%s:%s: Read error at position %u. %s\n", i, disk->name, file->sub, block_file_pos(block), strerror(errno)); ferr("WARNING! Unexpected read error in a data disk, it isn't possible to sync.\n"); ferr("Ensure that file '%s' can be read.\n", handle[j].path); - printf("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", file->sub); + ferr("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", file->sub); ++error; goto bail; /* LCOV_EXCL_STOP */ @@ -290,7 +290,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta ftag("error:%u:%s:%s: Close EIO error. %s\n", blockmax, disk->name, file->sub, strerror(errno)); ferr("DANGER! Unexpected input/output close error in a data disk, it isn't possible to sync.\n"); ferr("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle[j].path); - printf("Stopping at block %u\n", blockmax); + ferr("Stopping at block %u\n", blockmax); ++io_error; goto bail; } @@ -298,7 +298,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta ftag("error:%u:%s:%s: Close error. %s\n", blockmax, disk->name, file->sub, strerror(errno)); ferr("WARNING! Unexpected close error in a data disk, it isn't possible to sync.\n"); ferr("Ensure that file '%s' can be accessed.\n", handle[j].path); - printf("Stopping at block %u\n", blockmax); + ferr("Stopping at block %u\n", blockmax); ++error; goto bail; /* LCOV_EXCL_STOP */ @@ -605,7 +605,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari ftag("error:%u:%s:%s: Close EIO error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("DANGER! Unexpected input/output close error in a data disk, it isn't possible to sync.\n"); ferr("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle[j].path); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++io_error; goto bail; } @@ -613,7 +613,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari ftag("error:%u:%s:%s: Close error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("WARNING! Unexpected close error in a data disk, it isn't possible to sync.\n"); ferr("Ensure that file '%s' can be accessed.\n", handle[j].path); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++error; goto bail; /* LCOV_EXCL_STOP */ @@ -629,7 +629,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari ftag("error:%u:%s:%s: Open EIO error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("DANGER! Unexpected input/output open error in a data disk, it isn't possible to sync.\n"); ferr("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle[j].path); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++io_error; goto bail; /* LCOV_EXCL_STOP */ @@ -662,7 +662,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari ftag("error:%u:%s:%s: Open error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("WARNING! Unexpected open error in a data disk, it isn't possible to sync.\n"); ferr("Ensure that file '%s' can be accessed.\n", handle[j].path); - printf("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", file->sub); + ferr("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", file->sub); ++error; goto bail; /* LCOV_EXCL_STOP */ @@ -704,7 +704,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari if (io_error >= state->opt.io_error_limit) { ferr("DANGER! Unexpected input/output read error in a data disk, it isn't possible to sync.\n"); ferr("Ensure that disk '%s' is sane and that file '%s' can be read.\n", disk->dir, handle[j].path); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++io_error; goto bail; } @@ -718,7 +718,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari ftag("error:%u:%s:%s: Read error at position %u. %s\n", i, disk->name, file->sub, block_file_pos(block), strerror(errno)); ferr("WARNING! Unexpected read error in a data disk, it isn't possible to sync.\n"); ferr("Ensure that file '%s' can be read.\n", handle[j].path); - printf("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", file->sub); + ferr("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", file->sub); ++error; goto bail; /* LCOV_EXCL_STOP */ @@ -870,7 +870,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari if (io_error >= state->opt.io_error_limit) { ferr("DANGER! Unexpected input/output read error in the %s disk, it isn't possible to sync.\n", lev_name(l)); ferr("Ensure that disk '%s' is sane and can be read.\n", lev_config_name(l)); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++io_error; goto bail; } @@ -884,7 +884,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari ftag("parity_error:%u:%s: Read error. %s\n", i, lev_config_name(l), strerror(errno)); ferr("WARNING! Unexpected read error in the %s disk, it isn't possible to sync.\n", lev_name(l)); ferr("Ensure that disk '%s' can be read.\n", lev_config_name(l)); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++error; goto bail; /* LCOV_EXCL_STOP */ @@ -965,7 +965,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari if (io_error >= state->opt.io_error_limit) { ferr("DANGER! Unexpected input/output write error in the %s disk, it isn't possible to sync.\n", lev_name(l)); ferr("Ensure that disk '%s' is sane and can be written.\n", lev_config_name(l)); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++io_error; goto bail; } @@ -979,7 +979,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari ftag("parity_error:%u:%s: Write error. %s\n", i, lev_config_name(l), strerror(errno)); ferr("WARNING! Unexpected write error in the %s disk, it isn't possible to sync.\n", lev_name(l)); ferr("Ensure that disk '%s' has some free space available.\n", lev_config_name(l)); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++error; goto bail; /* LCOV_EXCL_STOP */ @@ -1085,7 +1085,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari ftag("parity_error:%u:%s: Sync error\n", i, lev_config_name(l)); ferr("DANGER! Unexpected sync error in %s disk.\n", lev_name(l)); ferr("Ensure that disk '%s' is sane.\n", lev_config_name(l)); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++error; goto bail; /* LCOV_EXCL_STOP */ @@ -1116,7 +1116,7 @@ end: ftag("parity_error:%u:%s: Sync error\n", i, lev_config_name(l)); ferr("DANGER! Unexpected sync error in %s disk.\n", lev_name(l)); ferr("Ensure that disk '%s' is sane.\n", lev_config_name(l)); - printf("Stopping at block %u\n", i); + ferr("Stopping at block %u\n", i); ++error; goto bail; /* LCOV_EXCL_STOP */