mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Rename internal esc/quote functions
No functional change
This commit is contained in:
parent
20cd1f86f8
commit
256db0e595
13 changed files with 122 additions and 127 deletions
|
|
@ -338,7 +338,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("entry:%u:%s:%s:%s:%s:%s:%u:\n", j, desc, hash, data, disk->name, esc(file->sub, esc_buffer), file_pos);
|
||||
log_tag("entry:%u:%s:%s:%s:%s:%s:%u:\n", j, desc, hash, data, disk->name, esc_tag(file->sub, esc_buffer), file_pos);
|
||||
} else {
|
||||
log_tag("entry:%u:%s:%s:%s:\n", j, desc, hash, data);
|
||||
}
|
||||
|
|
@ -663,7 +663,7 @@ static int file_post(struct snapraid_state* state, int fix, unsigned i, struct s
|
|||
ret = handle_close(&handle[j]);
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", i, disk->name, esc(file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", i, disk->name, esc_tag(file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected close error in a data disk.\n");
|
||||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
|
@ -679,7 +679,7 @@ static int file_post(struct snapraid_state* state, int fix, unsigned i, struct s
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
log_tag("status:unrecoverable:%s:%s\n", disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("status:unrecoverable:%s:%s\n", disk->name, esc_tag(file->sub, esc_buffer));
|
||||
msg_info("unrecoverable %s\n", path);
|
||||
|
||||
/* and do not set the time if damaged */
|
||||
|
|
@ -699,7 +699,7 @@ static int file_post(struct snapraid_state* state, int fix, unsigned i, struct s
|
|||
ret = handle_close(&handle[j]);
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", i, disk->name, esc(handle[j].file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", i, disk->name, esc_tag(handle[j].file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected close error in a data disk.\n");
|
||||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
|
@ -710,14 +710,14 @@ static int file_post(struct snapraid_state* state, int fix, unsigned i, struct s
|
|||
ret = handle_open(&handle[j], file, state->file_mode, log_error, 0);
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("error:%u:%s:%s: Open error. %s\n", i, disk->name, esc(file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Open error. %s\n", i, disk->name, esc_tag(file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("WARNING! Without a working data disk, it isn't possible to fix errors on it.\n");
|
||||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
}
|
||||
|
||||
log_tag("status:recovered:%s:%s\n", disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("status:recovered:%s:%s\n", disk->name, esc_tag(file->sub, esc_buffer));
|
||||
msg_info("recovered %s\n", path);
|
||||
|
||||
inode = handle[j].st.st_ino;
|
||||
|
|
@ -750,26 +750,26 @@ static int file_post(struct snapraid_state* state, int fix, unsigned i, struct s
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
} else {
|
||||
log_tag("collision:%s:%s:%s: Not setting modification time to avoid inode collision\n", disk->name, esc(file->sub, esc_buffer), esc(collide_file->sub, esc_buffer_alt));
|
||||
log_tag("collision:%s:%s:%s: Not setting modification time to avoid inode collision\n", disk->name, esc_tag(file->sub, esc_buffer), esc_tag(collide_file->sub, esc_buffer_alt));
|
||||
}
|
||||
} else {
|
||||
/* we are not fixing, but only checking */
|
||||
/* print just the final status */
|
||||
if (file_flag_has(file, FILE_IS_DAMAGED)) {
|
||||
if (state->opt.auditonly) {
|
||||
log_tag("status:damaged:%s:%s\n", disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("status:damaged:%s:%s\n", disk->name, esc_tag(file->sub, esc_buffer));
|
||||
msg_info("damaged %s\n", path);
|
||||
} else {
|
||||
log_tag("status:unrecoverable:%s:%s\n", disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("status:unrecoverable:%s:%s\n", disk->name, esc_tag(file->sub, esc_buffer));
|
||||
msg_info("unrecoverable %s\n", path);
|
||||
}
|
||||
} else if (file_flag_has(file, FILE_IS_FIXED)) {
|
||||
log_tag("status:recoverable:%s:%s\n", disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("status:recoverable:%s:%s\n", disk->name, esc_tag(file->sub, esc_buffer));
|
||||
msg_info("recoverable %s\n", path);
|
||||
} else {
|
||||
/* we don't use msg_verbose() because it also goes into the log */
|
||||
if (msg_level >= MSG_VERBOSE) {
|
||||
log_tag("status:correct:%s:%s\n", disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("status:correct:%s:%s\n", disk->name, esc_tag(file->sub, esc_buffer));
|
||||
msg_info("correct %s\n", path);
|
||||
}
|
||||
}
|
||||
|
|
@ -785,7 +785,7 @@ close_and_continue:
|
|||
ret = handle_close(&handle[j]);
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", i, disk->name, esc(file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", i, disk->name, esc_tag(file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected close error in a data disk.\n");
|
||||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
|
@ -1008,7 +1008,7 @@ 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("error:%u:%s:%s: Close error. %s\n", i, disk->name, esc(handle[j].file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", i, disk->name, esc_tag(handle[j].file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected close error in a data disk.\n");
|
||||
log_fatal("Stopping at block %u\n", i);
|
||||
++unrecoverable_error;
|
||||
|
|
@ -1058,7 +1058,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: Open error at position %u\n", i, disk->name, esc(file->sub, esc_buffer), file_pos);
|
||||
log_tag("error:%u:%s:%s: Open error at position %u\n", i, disk->name, esc_tag(file->sub, esc_buffer), file_pos);
|
||||
++error;
|
||||
|
||||
/* mark the file as missing, to avoid to retry to open it again */
|
||||
|
|
@ -1091,7 +1091,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
&& handle[j].st.st_size > file->size
|
||||
) {
|
||||
log_error("File '%s' is larger than expected.\n", handle[j].path);
|
||||
log_tag("error:%u:%s:%s: Size error\n", i, disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("error:%u:%s:%s: Size error\n", i, disk->name, esc_tag(file->sub, esc_buffer));
|
||||
++error;
|
||||
|
||||
if (fix) {
|
||||
|
|
@ -1105,7 +1105,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
log_tag("fixed:%u:%s:%s: Fixed size\n", i, disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("fixed:%u:%s:%s: Fixed size\n", i, disk->name, esc_tag(file->sub, esc_buffer));
|
||||
++recovered_error;
|
||||
}
|
||||
}
|
||||
|
|
@ -1131,7 +1131,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: Read error at position %u\n", i, disk->name, esc(file->sub, esc_buffer), file_pos);
|
||||
log_tag("error:%u:%s:%s: Read error at position %u\n", i, disk->name, esc_tag(file->sub, esc_buffer), file_pos);
|
||||
++error;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1180,7 +1180,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 bits %u\n", i, disk->name, esc(file->sub, esc_buffer), file_pos, diff);
|
||||
log_tag("error:%u:%s:%s: Data error at position %u, diff bits %u\n", i, disk->name, esc_tag(file->sub, esc_buffer), file_pos, diff);
|
||||
++error;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1242,7 +1242,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(failed[j].file->sub, esc_buffer), failed[j].file_pos);
|
||||
log_tag("unrecoverable:%u:%s:%s: Unrecoverable error at position %u\n", i, failed[j].disk->name, esc_tag(failed[j].file->sub, esc_buffer), failed[j].file_pos);
|
||||
}
|
||||
|
||||
/* keep track of damaged files */
|
||||
|
|
@ -1260,7 +1260,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(failed[j].file->sub, esc_buffer), failed[j].file_pos);
|
||||
log_tag("unrecoverable:%u:%s:%s: Unrecoverable unsynced error at position %u\n", i, failed[j].disk->name, esc_tag(failed[j].file->sub, esc_buffer), failed[j].file_pos);
|
||||
}
|
||||
}
|
||||
if (partial_recover_error != 0) {
|
||||
|
|
@ -1328,7 +1328,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
/* note that it could be also marked as damaged in other iterations */
|
||||
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(failed[j].file->sub, esc_buffer), failed[j].file_pos);
|
||||
log_tag("fixed:%u:%s:%s: Fixed data error at position %u\n", i, failed[j].disk->name, esc_tag(failed[j].file->sub, esc_buffer), failed[j].file_pos);
|
||||
++recovered_error;
|
||||
}
|
||||
|
||||
|
|
@ -1437,17 +1437,17 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
unsuccesful = 1;
|
||||
|
||||
log_error("Error stating empty file '%s'. %s.\n", path, strerror(errno));
|
||||
log_tag("error:%s:%s: Empty file stat error\n", disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("error:%s:%s: Empty file stat error\n", disk->name, esc_tag(file->sub, esc_buffer));
|
||||
++error;
|
||||
} else if (!S_ISREG(st.st_mode)) {
|
||||
unsuccesful = 1;
|
||||
|
||||
log_tag("error:%s:%s: Empty file error for not regular file\n", disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("error:%s:%s: Empty file error for not regular file\n", disk->name, esc_tag(file->sub, esc_buffer));
|
||||
++error;
|
||||
} else if (st.st_size != 0) {
|
||||
unsuccesful = 1;
|
||||
|
||||
log_tag("error:%s:%s: Empty file error for size '%" PRIu64 "'\n", disk->name, esc(file->sub, esc_buffer), st.st_size);
|
||||
log_tag("error:%s:%s: Empty file error for size '%" PRIu64 "'\n", disk->name, esc_tag(file->sub, esc_buffer), st.st_size);
|
||||
++error;
|
||||
}
|
||||
|
||||
|
|
@ -1508,10 +1508,10 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
log_tag("fixed:%s:%s: Fixed empty file\n", disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("fixed:%s:%s: Fixed empty file\n", disk->name, esc_tag(file->sub, esc_buffer));
|
||||
++recovered_error;
|
||||
|
||||
log_tag("status:recovered:%s:%s\n", disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("status:recovered:%s:%s\n", disk->name, esc_tag(file->sub, esc_buffer));
|
||||
msg_info("recovered %s%s\n", disk->dir, file->sub);
|
||||
}
|
||||
}
|
||||
|
|
@ -1545,12 +1545,12 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
unsuccesful = 1;
|
||||
|
||||
log_error("Error stating hardlink '%s'. %s.\n", path, strerror(errno));
|
||||
log_tag("hardlink_error:%s:%s:%s: Hardlink stat error\n", disk->name, esc(slink->sub, esc_buffer), esc(slink->linkto, esc_buffer_alt));
|
||||
log_tag("hardlink_error:%s:%s:%s: Hardlink stat error\n", disk->name, esc_tag(slink->sub, esc_buffer), esc_tag(slink->linkto, esc_buffer_alt));
|
||||
++error;
|
||||
} else if (!S_ISREG(st.st_mode)) {
|
||||
unsuccesful = 1;
|
||||
|
||||
log_tag("hardlink_error:%s:%s:%s: Hardlink error for not regular file\n", disk->name, esc(slink->sub, esc_buffer), esc(slink->linkto, esc_buffer_alt));
|
||||
log_tag("hardlink_error:%s:%s:%s: Hardlink error for not regular file\n", disk->name, esc_tag(slink->sub, esc_buffer), esc_tag(slink->linkto, esc_buffer_alt));
|
||||
++error;
|
||||
}
|
||||
|
||||
|
|
@ -1575,18 +1575,18 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
}
|
||||
|
||||
log_error("Error stating hardlink-to '%s'. %s.\n", pathto, strerror(errno));
|
||||
log_tag("hardlink_error:%s:%s:%s: Hardlink to stat error\n", disk->name, esc(slink->sub, esc_buffer), esc(slink->linkto, esc_buffer_alt));
|
||||
log_tag("hardlink_error:%s:%s:%s: Hardlink to stat error\n", disk->name, esc_tag(slink->sub, esc_buffer), esc_tag(slink->linkto, esc_buffer_alt));
|
||||
++error;
|
||||
} else if (!S_ISREG(stto.st_mode)) {
|
||||
unsuccesful = 1;
|
||||
|
||||
log_tag("hardlink_error:%s:%s:%s: Hardlink-to error for not regular file\n", disk->name, esc(slink->sub, esc_buffer), esc(slink->linkto, esc_buffer_alt));
|
||||
log_tag("hardlink_error:%s:%s:%s: Hardlink-to error for not regular file\n", disk->name, esc_tag(slink->sub, esc_buffer), esc_tag(slink->linkto, esc_buffer_alt));
|
||||
++error;
|
||||
} else if (!unsuccesful && st.st_ino != stto.st_ino) {
|
||||
unsuccesful = 1;
|
||||
|
||||
log_error("Mismatch hardlink '%s' and '%s'. Different inode.\n", path, pathto);
|
||||
log_tag("hardlink_error:%s:%s:%s: Hardlink mismatch for different inode\n", disk->name, esc(slink->sub, esc_buffer), esc(slink->linkto, esc_buffer_alt));
|
||||
log_tag("hardlink_error:%s:%s:%s: Hardlink mismatch for different inode\n", disk->name, esc_tag(slink->sub, esc_buffer), esc_tag(slink->linkto, esc_buffer_alt));
|
||||
++error;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1597,13 +1597,13 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
unsuccesful = 1;
|
||||
|
||||
log_error("Error reading symlink '%s'. %s.\n", path, strerror(errno));
|
||||
log_tag("symlink_error:%s:%s: Symlink read error\n", disk->name, esc(slink->sub, esc_buffer));
|
||||
log_tag("symlink_error:%s:%s: Symlink read error\n", disk->name, esc_tag(slink->sub, esc_buffer));
|
||||
++error;
|
||||
} else if (ret >= PATH_MAX) {
|
||||
unsuccesful = 1;
|
||||
|
||||
log_error("Error reading symlink '%s'. Symlink too long.\n", path);
|
||||
log_tag("symlink_error:%s:%s: Symlink read error\n", disk->name, esc(slink->sub, esc_buffer));
|
||||
log_tag("symlink_error:%s:%s: Symlink read error\n", disk->name, esc_tag(slink->sub, esc_buffer));
|
||||
++error;
|
||||
} else {
|
||||
linkto[ret] = 0;
|
||||
|
|
@ -1611,7 +1611,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
if (strcmp(linkto, slink->linkto) != 0) {
|
||||
unsuccesful = 1;
|
||||
|
||||
log_tag("symlink_error:%s:%s: Symlink data error '%s' instead of '%s'\n", disk->name, esc(slink->sub, esc_buffer), linkto, slink->linkto);
|
||||
log_tag("symlink_error:%s:%s: Symlink data error '%s' instead of '%s'\n", disk->name, esc_tag(slink->sub, esc_buffer), linkto, slink->linkto);
|
||||
++error;
|
||||
}
|
||||
}
|
||||
|
|
@ -1659,7 +1659,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
log_tag("hardlink_fixed:%s:%s: Fixed hardlink error\n", disk->name, esc(slink->sub, esc_buffer));
|
||||
log_tag("hardlink_fixed:%s:%s: Fixed hardlink error\n", disk->name, esc_tag(slink->sub, esc_buffer));
|
||||
++recovered_error;
|
||||
} else {
|
||||
ret = symlink(slink->linkto, path);
|
||||
|
|
@ -1678,11 +1678,11 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
log_tag("symlink_fixed:%s:%s: Fixed symlink error\n", disk->name, esc(slink->sub, esc_buffer));
|
||||
log_tag("symlink_fixed:%s:%s: Fixed symlink error\n", disk->name, esc_tag(slink->sub, esc_buffer));
|
||||
++recovered_error;
|
||||
}
|
||||
|
||||
log_tag("status:recovered:%s:%s\n", disk->name, esc(slink->sub, esc_buffer));
|
||||
log_tag("status:recovered:%s:%s\n", disk->name, esc_tag(slink->sub, esc_buffer));
|
||||
msg_info("recovered %s%s\n", disk->dir, slink->sub);
|
||||
}
|
||||
}
|
||||
|
|
@ -1711,12 +1711,12 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
unsuccesful = 1;
|
||||
|
||||
log_error("Error stating dir '%s'. %s.\n", path, strerror(errno));
|
||||
log_tag("dir_error:%s:%s: Dir stat error\n", disk->name, esc(dir->sub, esc_buffer));
|
||||
log_tag("dir_error:%s:%s: Dir stat error\n", disk->name, esc_tag(dir->sub, esc_buffer));
|
||||
++error;
|
||||
} else if (!S_ISDIR(st.st_mode)) {
|
||||
unsuccesful = 1;
|
||||
|
||||
log_tag("dir_error:%s:%s: Dir error for not directory\n", disk->name, esc(dir->sub, esc_buffer));
|
||||
log_tag("dir_error:%s:%s: Dir error for not directory\n", disk->name, esc_tag(dir->sub, esc_buffer));
|
||||
++error;
|
||||
}
|
||||
|
||||
|
|
@ -1749,10 +1749,10 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
log_tag("dir_fixed:%s:%s: Fixed dir error\n", disk->name, esc(dir->sub, esc_buffer));
|
||||
log_tag("dir_fixed:%s:%s: Fixed dir error\n", disk->name, esc_tag(dir->sub, esc_buffer));
|
||||
++recovered_error;
|
||||
|
||||
log_tag("status:recovered:%s:%s\n", disk->name, esc(dir->sub, esc_buffer));
|
||||
log_tag("status:recovered:%s:%s\n", disk->name, esc_tag(dir->sub, esc_buffer));
|
||||
msg_info("recovered %s%s\n", disk->dir, dir->sub);
|
||||
}
|
||||
}
|
||||
|
|
@ -1768,7 +1768,7 @@ bail:
|
|||
ret = handle_close(&handle[j]);
|
||||
if (ret == -1) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockmax, disk->name, esc(file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockmax, disk->name, esc_tag(file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected close error in a data disk.\n");
|
||||
++unrecoverable_error;
|
||||
/* continue, as we are already exiting */
|
||||
|
|
|
|||
|
|
@ -747,7 +747,7 @@ static void state_smart(unsigned n, tommy_list* low)
|
|||
|
||||
log_tag("smart:%s:%s\n", devinfo->file, devinfo->name);
|
||||
if (devinfo->smart_serial[0])
|
||||
log_tag("attr:%s:%s:serial:%s\n", devinfo->file, devinfo->name, esc(devinfo->smart_serial, esc_buffer));
|
||||
log_tag("attr:%s:%s:serial:%s\n", devinfo->file, devinfo->name, esc_tag(devinfo->smart_serial, esc_buffer));
|
||||
if (afr != 0)
|
||||
log_tag("attr:%s:%s:afr:%g\n", devinfo->file, devinfo->name, afr);
|
||||
if (devinfo->smart[SMART_SIZE] != SMART_UNASSIGNED)
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ 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 */
|
||||
if (errno == EIO) {
|
||||
log_tag("error:%u:%s:%s: Close EIO error. %s\n", blockcur, disk->name, esc(report->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close EIO error. %s\n", blockcur, disk->name, esc_tag(report->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected input/output close error in a data disk, it isn't possible to dry.\n");
|
||||
log_fatal("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle->path);
|
||||
log_fatal("Stopping at block %u\n", blockcur);
|
||||
|
|
@ -90,7 +90,7 @@ static void dry_data_reader(struct snapraid_worker* worker, struct snapraid_task
|
|||
return;
|
||||
}
|
||||
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockcur, disk->name, esc(report->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockcur, disk->name, esc_tag(report->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("WARNING! Unexpected close error in a data disk, it isn't possible to dry.\n");
|
||||
log_fatal("Ensure that file '%s' can be accessed.\n", handle->path);
|
||||
log_fatal("Stopping at block %u\n", blockcur);
|
||||
|
|
@ -104,7 +104,7 @@ static void dry_data_reader(struct snapraid_worker* worker, struct snapraid_task
|
|||
if (ret == -1) {
|
||||
if (errno == EIO) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("error:%u:%s:%s: Open EIO error. %s\n", blockcur, disk->name, esc(task->file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Open EIO error. %s\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected input/output open error in a data disk, it isn't possible to dry.\n");
|
||||
log_fatal("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle->path);
|
||||
log_fatal("Stopping at block %u\n", blockcur);
|
||||
|
|
@ -113,7 +113,7 @@ static void dry_data_reader(struct snapraid_worker* worker, struct snapraid_task
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
log_tag("error:%u:%s:%s: Open error. %s\n", blockcur, disk->name, esc(task->file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Open error. %s\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer), strerror(errno));
|
||||
task->state = TASK_STATE_ERROR_CONTINUE;
|
||||
return;
|
||||
}
|
||||
|
|
@ -121,13 +121,13 @@ 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, log_error, 0);
|
||||
if (task->read_size == -1) {
|
||||
if (errno == EIO) {
|
||||
log_tag("error:%u:%s:%s: Read EIO error at position %u. %s\n", blockcur, disk->name, esc(task->file->sub, esc_buffer), task->file_pos, strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Read EIO error at position %u. %s\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer), task->file_pos, strerror(errno));
|
||||
log_error("Input/Output error in file '%s' at position '%u'\n", handle->path, task->file_pos);
|
||||
task->state = TASK_STATE_IOERROR_CONTINUE;
|
||||
return;
|
||||
}
|
||||
|
||||
log_tag("error:%u:%s:%s: Read error at position %u. %s\n", blockcur, disk->name, esc(task->file->sub, esc_buffer), task->file_pos, strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Read error at position %u. %s\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer), task->file_pos, strerror(errno));
|
||||
task->state = TASK_STATE_ERROR_CONTINUE;
|
||||
return;
|
||||
}
|
||||
|
|
@ -360,7 +360,7 @@ bail:
|
|||
ret = handle_close(&handle[j]);
|
||||
if (ret == -1) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockmax, disk->name, esc(file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockmax, disk->name, esc_tag(file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected close error in a data disk.\n");
|
||||
++error;
|
||||
/* continue, as we are already exiting */
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ void state_dup(struct snapraid_state* state)
|
|||
if (found) {
|
||||
++count;
|
||||
size += found->file->size;
|
||||
log_tag("dup:%s:%s:%s:%s:%" PRIu64 ": dup\n", disk->name, esc(file->sub, esc_buffer), found->disk->name, esc(found->file->sub, esc_buffer_alt), found->file->size);
|
||||
log_tag("dup:%s:%s:%s:%s:%" PRIu64 ": dup\n", disk->name, esc_tag(file->sub, esc_buffer), found->disk->name, esc_tag(found->file->sub, esc_buffer_alt), found->file->size);
|
||||
printf("%12" PRIu64 " %s%s = %s%s\n", file->size, disk->dir, file->sub, found->disk->dir, found->file->sub);
|
||||
hash_free(hash);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ void state_list(struct snapraid_state* state)
|
|||
++file_count;
|
||||
file_size += file->size;
|
||||
|
||||
log_tag("file:%s:%s:%" PRIu64 ":%" PRIi64 ":%u:%" PRIi64 "\n", disk->name, esc(file->sub, esc_buffer), file->size, file->mtime_sec, file->mtime_nsec, file->inode);
|
||||
log_tag("file:%s:%s:%" PRIu64 ":%" PRIi64 ":%u:%" PRIi64 "\n", disk->name, esc_tag(file->sub, esc_buffer), file->size, file->mtime_sec, file->mtime_nsec, file->inode);
|
||||
|
||||
t = file->mtime_sec;
|
||||
#if HAVE_LOCALTIME_R
|
||||
|
|
@ -100,7 +100,7 @@ void state_list(struct snapraid_state* state)
|
|||
|
||||
++link_count;
|
||||
|
||||
log_tag("link_%s:%s:%s:%s\n", type, disk->name, esc(slink->sub, esc_buffer), esc(slink->linkto, esc_buffer_alt));
|
||||
log_tag("link_%s:%s:%s:%s\n", type, disk->name, esc_tag(slink->sub, esc_buffer), esc_tag(slink->linkto, esc_buffer_alt));
|
||||
|
||||
printf("%12s ", type);
|
||||
printf(" ");
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ void parity_overflow(struct snapraid_state* state, data_off_t size)
|
|||
if (file->blockmax > 0) {
|
||||
block_off_t parity_pos = fs_file2par_get(disk, file, file->blockmax - 1);
|
||||
if (parity_pos >= blockalloc) {
|
||||
log_tag("outofparity:%s:%s\n", disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("outofparity:%s:%s\n", disk->name, esc_tag(file->sub, esc_buffer));
|
||||
if (first) {
|
||||
first = 0;
|
||||
log_fatal("\nYour data requires more parity than the available space.\n");
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ static void scan_link(struct snapraid_scan* scan, int is_diff, const char* sub,
|
|||
++scan->count_equal;
|
||||
|
||||
if (state->opt.gui) {
|
||||
log_tag("scan:equal:%s:%s\n", disk->name, esc(slink->sub, esc_buffer));
|
||||
log_tag("scan:equal:%s:%s\n", disk->name, esc_tag(slink->sub, esc_buffer));
|
||||
}
|
||||
} else {
|
||||
/* it's an update */
|
||||
|
|
@ -120,7 +120,7 @@ static void scan_link(struct snapraid_scan* scan, int is_diff, const char* sub,
|
|||
|
||||
++scan->count_change;
|
||||
|
||||
log_tag("scan:update:%s:%s\n", disk->name, esc(slink->sub, esc_buffer));
|
||||
log_tag("scan:update:%s:%s\n", disk->name, esc_tag(slink->sub, esc_buffer));
|
||||
if (is_diff) {
|
||||
printf("update %s%s\n", disk->dir, slink->sub);
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ static void scan_link(struct snapraid_scan* scan, int is_diff, const char* sub,
|
|||
/* create the new link */
|
||||
++scan->count_insert;
|
||||
|
||||
log_tag("scan:add:%s:%s\n", disk->name, esc(sub, esc_buffer));
|
||||
log_tag("scan:add:%s:%s\n", disk->name, esc_tag(sub, esc_buffer));
|
||||
if (is_diff) {
|
||||
printf("add %s%s\n", disk->dir, sub);
|
||||
}
|
||||
|
|
@ -697,7 +697,7 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub,
|
|||
/* if the path is different, it means a moved file with the same inode */
|
||||
++scan->count_move;
|
||||
|
||||
log_tag("scan:move:%s:%s:%s\n", disk->name, esc(file->sub, esc_buffer), esc(sub, esc_buffer_alt));
|
||||
log_tag("scan:move:%s:%s:%s\n", disk->name, esc_tag(file->sub, esc_buffer), esc_tag(sub, esc_buffer_alt));
|
||||
if (is_diff) {
|
||||
printf("move %s%s -> %s%s\n", disk->dir, file->sub, disk->dir, sub);
|
||||
}
|
||||
|
|
@ -718,7 +718,7 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub,
|
|||
++scan->count_equal;
|
||||
|
||||
if (state->opt.gui) {
|
||||
log_tag("scan:equal:%s:%s\n", disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("scan:equal:%s:%s\n", disk->name, esc_tag(file->sub, esc_buffer));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -834,7 +834,7 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub,
|
|||
/* like when restoring a backup that restores also the timestamp */
|
||||
++scan->count_restore;
|
||||
|
||||
log_tag("scan:restore:%s:%s\n", disk->name, esc(sub, esc_buffer));
|
||||
log_tag("scan:restore:%s:%s\n", disk->name, esc_tag(sub, esc_buffer));
|
||||
if (is_diff) {
|
||||
printf("restore %s%s\n", disk->dir, sub);
|
||||
}
|
||||
|
|
@ -857,7 +857,7 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub,
|
|||
++scan->count_equal;
|
||||
|
||||
if (state->opt.gui) {
|
||||
log_tag("scan:equal:%s:%s\n", disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("scan:equal:%s:%s\n", disk->name, esc_tag(file->sub, esc_buffer));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -900,10 +900,9 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub,
|
|||
if (is_original_file_size_different_than_zero && st->st_size == 0) {
|
||||
if (!state->opt.force_zero) {
|
||||
/* LCOV_EXCL_START */
|
||||
char quote_buffer[QUOTE_MAX];
|
||||
log_fatal("The file '%s%s' has unexpected zero size!\n", disk->dir, sub);
|
||||
log_fatal("It's possible that after a kernel crash this file was lost,\n");
|
||||
log_fatal("and you can use 'snapraid fix -f %s' to recover it.\n", quote('/', sub, quote_buffer));
|
||||
log_fatal("and you can use 'snapraid fix -f %s' to recover it.\n", esc_shell('/', sub, esc_buffer));
|
||||
if (!is_diff) {
|
||||
log_fatal("If this an expected condition you can '%s' anyway using 'snapraid --force-zero %s'\n", state->command, state->command);
|
||||
exit(EXIT_FAILURE);
|
||||
|
|
@ -950,7 +949,7 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub,
|
|||
/* revert old counter and use the copy one */
|
||||
++scan->count_copy;
|
||||
|
||||
log_tag("scan:copy:%s:%s:%s:%s\n", other_disk->name, esc(other_file->sub, esc_buffer), disk->name, esc(file->sub, esc_buffer_alt));
|
||||
log_tag("scan:copy:%s:%s:%s:%s\n", other_disk->name, esc_tag(other_file->sub, esc_buffer), disk->name, esc_tag(file->sub, esc_buffer_alt));
|
||||
if (is_diff) {
|
||||
printf("copy %s%s -> %s%s\n", other_disk->dir, other_file->sub, disk->dir, file->sub);
|
||||
}
|
||||
|
|
@ -970,7 +969,7 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub,
|
|||
if (is_file_already_present) {
|
||||
++scan->count_change;
|
||||
|
||||
log_tag("scan:update:%s:%s: %" PRIu64 " %" PRIu64 ".%d -> %" PRIu64 " %" PRIu64 ".%d\n", disk->name, esc(sub, esc_buffer),
|
||||
log_tag("scan:update:%s:%s: %" PRIu64 " %" PRIu64 ".%d -> %" PRIu64 " %" PRIu64 ".%d\n", disk->name, esc_tag(sub, esc_buffer),
|
||||
(uint64_t)file_already_present_size, (uint64_t)file_already_present_mtime_sec, file_already_present_mtime_nsec,
|
||||
(uint64_t)file->size, (uint64_t)file->mtime_sec, file->mtime_nsec
|
||||
);
|
||||
|
|
@ -981,7 +980,7 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub,
|
|||
} else {
|
||||
++scan->count_insert;
|
||||
|
||||
log_tag("scan:add:%s:%s\n", disk->name, esc(sub, esc_buffer));
|
||||
log_tag("scan:add:%s:%s\n", disk->name, esc_tag(sub, esc_buffer));
|
||||
if (is_diff) {
|
||||
printf("add %s%s\n", disk->dir, sub);
|
||||
}
|
||||
|
|
@ -1527,7 +1526,7 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
|||
if (!file_flag_has(file, FILE_IS_PRESENT)) {
|
||||
++scan->count_remove;
|
||||
|
||||
log_tag("scan:remove:%s:%s\n", disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("scan:remove:%s:%s\n", disk->name, esc_tag(file->sub, esc_buffer));
|
||||
if (is_diff) {
|
||||
printf("remove %s%s\n", disk->dir, file->sub);
|
||||
}
|
||||
|
|
@ -1548,7 +1547,7 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
|||
if (!link_flag_has(slink, FILE_IS_PRESENT)) {
|
||||
++scan->count_remove;
|
||||
|
||||
log_tag("scan:remove:%s:%s\n", disk->name, esc(slink->sub, esc_buffer));
|
||||
log_tag("scan:remove:%s:%s\n", disk->name, esc_tag(slink->sub, esc_buffer));
|
||||
if (is_diff) {
|
||||
printf("remove %s%s\n", disk->dir, slink->sub);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ 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 */
|
||||
if (errno == EIO) {
|
||||
log_tag("error:%u:%s:%s: Close EIO error. %s\n", blockcur, disk->name, esc(report->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close EIO error. %s\n", blockcur, disk->name, esc_tag(report->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected input/output close error in a data disk, it isn't possible to scrub.\n");
|
||||
log_fatal("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle->path);
|
||||
log_fatal("Stopping at block %u\n", blockcur);
|
||||
|
|
@ -153,7 +153,7 @@ static void scrub_data_reader(struct snapraid_worker* worker, struct snapraid_ta
|
|||
return;
|
||||
}
|
||||
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockcur, disk->name, esc(report->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockcur, disk->name, esc_tag(report->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("WARNING! Unexpected close error in a data disk, it isn't possible to scrub.\n");
|
||||
log_fatal("Ensure that file '%s' can be accessed.\n", handle->path);
|
||||
log_fatal("Stopping at block %u\n", blockcur);
|
||||
|
|
@ -167,7 +167,7 @@ static void scrub_data_reader(struct snapraid_worker* worker, struct snapraid_ta
|
|||
if (ret == -1) {
|
||||
if (errno == EIO) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("error:%u:%s:%s: Open EIO error. %s\n", blockcur, disk->name, esc(task->file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Open EIO error. %s\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected input/output open error in a data disk, it isn't possible to scrub.\n");
|
||||
log_fatal("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle->path);
|
||||
log_fatal("Stopping at block %u\n", blockcur);
|
||||
|
|
@ -176,7 +176,7 @@ static void scrub_data_reader(struct snapraid_worker* worker, struct snapraid_ta
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
log_tag("error:%u:%s:%s: Open error. %s\n", blockcur, disk->name, esc(task->file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Open error. %s\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer), strerror(errno));
|
||||
task->state = TASK_STATE_ERROR_CONTINUE;
|
||||
return;
|
||||
}
|
||||
|
|
@ -199,13 +199,13 @@ 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, log_error, 0);
|
||||
if (task->read_size == -1) {
|
||||
if (errno == EIO) {
|
||||
log_tag("error:%u:%s:%s: Read EIO error at position %u. %s\n", blockcur, disk->name, esc(task->file->sub, esc_buffer), task->file_pos, strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Read EIO error at position %u. %s\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer), task->file_pos, strerror(errno));
|
||||
log_error("Input/Output error in file '%s' at position '%u'\n", handle->path, task->file_pos);
|
||||
task->state = TASK_STATE_IOERROR_CONTINUE;
|
||||
return;
|
||||
}
|
||||
|
||||
log_tag("error:%u:%s:%s: Read error at position %u. %s\n", blockcur, disk->name, esc(task->file->sub, esc_buffer), task->file_pos, strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Read error at position %u. %s\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer), task->file_pos, strerror(errno));
|
||||
task->state = TASK_STATE_ERROR_CONTINUE;
|
||||
return;
|
||||
}
|
||||
|
|
@ -469,7 +469,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
|
|||
if (memcmp(hash, block->hash, BLOCK_HASH_SIZE) != 0) {
|
||||
unsigned diff = memdiff(hash, block->hash, BLOCK_HASH_SIZE);
|
||||
|
||||
log_tag("error:%u:%s:%s: Data error at position %u, diff bits %u\n", blockcur, disk->name, esc(file->sub, esc_buffer), file_pos, diff);
|
||||
log_tag("error:%u:%s:%s: Data error at position %u, diff bits %u\n", blockcur, disk->name, esc_tag(file->sub, esc_buffer), file_pos, diff);
|
||||
|
||||
/* it's a silent error only if we are dealing with synced files */
|
||||
if (file_is_unsynced) {
|
||||
|
|
@ -677,7 +677,7 @@ bail:
|
|||
ret = handle_close(&handle[j]);
|
||||
if (ret == -1) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockcur, disk->name, esc(file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockcur, disk->name, esc_tag(file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected close error in a data disk.\n");
|
||||
++error;
|
||||
/* continue, as we are already exiting */
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ void memory(void)
|
|||
void test(int argc, char* argv[])
|
||||
{
|
||||
int i;
|
||||
char buffer[QUOTE_MAX];
|
||||
char buffer[ESC_MAX];
|
||||
|
||||
/* special testing code for quoting */
|
||||
if (argc < 2 || strcmp(argv[1], "test") != 0)
|
||||
|
|
@ -101,17 +101,17 @@ void test(int argc, char* argv[])
|
|||
for (i = 2; i < argc; ++i) {
|
||||
printf("argv[%d]\n", i);
|
||||
printf("\t#%s#\n", argv[i]);
|
||||
printf("\t#%s#\n", quote(0, argv[i], buffer));
|
||||
printf("\t#%s#\n", esc_shell(0, argv[i], buffer));
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
assert(strcmp(quote(0, " ", buffer), "\" \"") == 0);
|
||||
assert(strcmp(quote(0, " \" ", buffer), "\" \"\\\"\" \"") == 0);
|
||||
assert(strcmp(quote(0, "&|()<>^", buffer), "^&^|^(^)^<^>^^") == 0);
|
||||
assert(strcmp(quote(0, "&|()<>^ ", buffer), "\"&|()<>^ \"") == 0);
|
||||
assert(strcmp(esc_shell(0, " ", buffer), "\" \"") == 0);
|
||||
assert(strcmp(esc_shell(0, " \" ", buffer), "\" \"\\\"\" \"") == 0);
|
||||
assert(strcmp(esc_shell(0, "&|()<>^", buffer), "^&^|^(^)^<^>^^") == 0);
|
||||
assert(strcmp(esc_shell(0, "&|()<>^ ", buffer), "\"&|()<>^ \"") == 0);
|
||||
#else
|
||||
assert(strcmp(quote(0, ",._+:@%%/-", buffer), ",._+:@%%/-") == 0);
|
||||
assert(strcmp(quote(0, " ", buffer), "\\ ") == 0);
|
||||
assert(strcmp(esc_shell(0, ",._+:@%%/-", buffer), ",._+:@%%/-") == 0);
|
||||
assert(strcmp(esc_shell(0, " ", buffer), "\\ ") == 0);
|
||||
#endif
|
||||
|
||||
printf("Everything OK\n");
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ void printp(double v, size_t pad)
|
|||
*p++ = to; \
|
||||
break
|
||||
|
||||
const char* esc(const char* str, char* buffer)
|
||||
const char* esc_tag(const char* str, char* buffer)
|
||||
{
|
||||
char* begin = buffer;
|
||||
char* end = begin + ESC_MAX;
|
||||
|
|
@ -425,15 +425,15 @@ const char* esc(const char* str, char* buffer)
|
|||
|
||||
bail:
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Escape too long\n");
|
||||
log_fatal("Escape for log too long\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
const char* quote(char prefix, const char* str, char* buffer)
|
||||
const char* esc_shell(char prefix, const char* str, char* buffer)
|
||||
{
|
||||
char* begin = buffer;
|
||||
char* end = begin + QUOTE_MAX;
|
||||
char* end = begin + ESC_MAX;
|
||||
char* p = begin;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
@ -568,7 +568,7 @@ const char* quote(char prefix, const char* str, char* buffer)
|
|||
|
||||
bail:
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Quote too long\n");
|
||||
log_fatal("Escape for shell too long\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,17 +222,15 @@ void printp(double v, size_t pad);
|
|||
*
|
||||
* Chars ':', '\n', '\r' and '\' are escaped to '\d', '\\n', '\\r' and '\\'.
|
||||
*/
|
||||
const char* esc(const char* str, char* buffer);
|
||||
|
||||
#define QUOTE_MAX (PATH_MAX*2 + 1)
|
||||
const char* esc_tag(const char* str, char* buffer);
|
||||
|
||||
/**
|
||||
* Quote a string for the shell.
|
||||
* Escape a string for the shell.
|
||||
*
|
||||
* \param prefix Char to prefix at the string.
|
||||
* \param buffer Preallocated buffer of QUOTE_MAX size.
|
||||
* \param buffer Preallocated buffer of ESC_MAX size.
|
||||
*/
|
||||
const char* quote(char prefix, const char* str, char* buffer);
|
||||
const char* esc_shell(char prefix, const char* str, char* buffer);
|
||||
|
||||
/**
|
||||
* Polish a string.
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
|
|||
unsigned silent_error;
|
||||
unsigned io_error;
|
||||
char esc_buffer[ESC_MAX];
|
||||
char quote_buffer[QUOTE_MAX];
|
||||
|
||||
/* maps the disks to handles */
|
||||
handle = handle_mapping(state, &diskmax);
|
||||
|
|
@ -140,7 +139,7 @@ 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 */
|
||||
if (errno == EIO) {
|
||||
log_tag("error:%u:%s:%s: Close EIO error. %s\n", i, disk->name, esc(report->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close EIO error. %s\n", i, disk->name, esc_tag(report->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected input/output close error in a data disk, it isn't possible to sync.\n");
|
||||
log_fatal("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle[j].path);
|
||||
log_fatal("Stopping at block %u\n", i);
|
||||
|
|
@ -148,7 +147,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
|
|||
goto bail;
|
||||
}
|
||||
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", i, disk->name, esc(report->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", i, disk->name, esc_tag(report->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("WARNING! Unexpected close error in a data disk, it isn't possible to sync.\n");
|
||||
log_fatal("Ensure that file '%s' can be accessed.\n", handle[j].path);
|
||||
log_fatal("Stopping at block %u\n", i);
|
||||
|
|
@ -162,7 +161,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
|
|||
if (ret == -1) {
|
||||
if (errno == EIO) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("error:%u:%s:%s: Open EIO error. %s\n", i, disk->name, esc(file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Open EIO error. %s\n", i, disk->name, esc_tag(file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected input/output open error in a data disk, it isn't possible to sync.\n");
|
||||
log_fatal("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle[j].path);
|
||||
log_fatal("Stopping at block %u\n", i);
|
||||
|
|
@ -172,7 +171,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
|
|||
}
|
||||
|
||||
if (errno == ENOENT) {
|
||||
log_tag("error:%u:%s:%s: Open ENOENT error. %s\n", i, disk->name, esc(file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Open ENOENT error. %s\n", i, disk->name, esc_tag(file->sub, esc_buffer), strerror(errno));
|
||||
log_error("Missing file '%s'.\n", handle[j].path);
|
||||
log_error("WARNING! You cannot modify data disk during a sync.\n");
|
||||
log_error("Rerun the sync command when finished.\n");
|
||||
|
|
@ -183,7 +182,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
|
|||
}
|
||||
|
||||
if (errno == EACCES) {
|
||||
log_tag("error:%u:%s:%s: Open EACCES error. %s\n", i, disk->name, esc(file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Open EACCES error. %s\n", i, disk->name, esc_tag(file->sub, esc_buffer), strerror(errno));
|
||||
log_error("No access at file '%s'.\n", handle[j].path);
|
||||
log_error("WARNING! Please fix the access permission in the data disk.\n");
|
||||
log_error("Rerun the sync command when finished.\n");
|
||||
|
|
@ -193,10 +192,10 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
|
|||
}
|
||||
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("error:%u:%s:%s: Open error. %s\n", i, disk->name, esc(file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Open error. %s\n", i, disk->name, esc_tag(file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("WARNING! Unexpected open error in a data disk, it isn't possible to sync.\n");
|
||||
log_fatal("Ensure that file '%s' can be accessed.\n", handle[j].path);
|
||||
log_fatal("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", quote('/', file->sub, quote_buffer));
|
||||
log_fatal("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", esc_shell('/', file->sub, esc_buffer));
|
||||
++error;
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
|
@ -208,7 +207,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
|
|||
|| STAT_NSEC(&handle[j].st) != file->mtime_nsec
|
||||
|| handle[j].st.st_ino != file->inode
|
||||
) {
|
||||
log_tag("error:%u:%s:%s: Unexpected attribute change\n", i, disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("error:%u:%s:%s: Unexpected attribute change\n", i, disk->name, esc_tag(file->sub, esc_buffer));
|
||||
if (handle[j].st.st_size != file->size) {
|
||||
log_error("Unexpected size change at file '%s' from %" PRIu64 " to %" PRIu64 ".\n", handle[j].path, file->size, handle[j].st.st_size);
|
||||
} else if (handle[j].st.st_mtime != file->mtime_sec
|
||||
|
|
@ -229,7 +228,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
|
|||
if (read_size == -1) {
|
||||
/* LCOV_EXCL_START */
|
||||
if (errno == EIO) {
|
||||
log_tag("error:%u:%s:%s: Read EIO error at position %u. %s\n", i, disk->name, esc(file->sub, esc_buffer), file_pos, strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Read EIO error at position %u. %s\n", i, disk->name, esc_tag(file->sub, esc_buffer), file_pos, strerror(errno));
|
||||
log_fatal("DANGER! Unexpected input/output read error in a data disk, it isn't possible to sync.\n");
|
||||
log_fatal("Ensure that disk '%s' is sane and that file '%s' can be read.\n", disk->dir, handle[j].path);
|
||||
log_fatal("Stopping at block %u\n", i);
|
||||
|
|
@ -237,10 +236,10 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
|
|||
goto bail;
|
||||
}
|
||||
|
||||
log_tag("error:%u:%s:%s: Read error at position %u. %s\n", i, disk->name, esc(file->sub, esc_buffer), file_pos, strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Read error at position %u. %s\n", i, disk->name, esc_tag(file->sub, esc_buffer), file_pos, strerror(errno));
|
||||
log_fatal("WARNING! Unexpected read error in a data disk, it isn't possible to sync.\n");
|
||||
log_fatal("Ensure that file '%s' can be read.\n", handle[j].path);
|
||||
log_fatal("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", quote('/', file->sub, quote_buffer));
|
||||
log_fatal("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", esc_shell('/', file->sub, esc_buffer));
|
||||
++error;
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
|
@ -264,7 +263,7 @@ 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:%u:%s:%s: Unexpected data change\n", i, disk->name, esc(file->sub, esc_buffer));
|
||||
log_tag("error:%u:%s:%s: Unexpected data change\n", i, disk->name, esc_tag(file->sub, esc_buffer));
|
||||
log_error("Data change at file '%s' at position '%u'\n", handle[j].path, file_pos);
|
||||
log_error("WARNING! Unexpected data modification of a file without parity!\n");
|
||||
|
||||
|
|
@ -320,7 +319,7 @@ 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 */
|
||||
if (errno == EIO) {
|
||||
log_tag("error:%u:%s:%s: Close EIO error. %s\n", blockmax, disk->name, esc(report->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close EIO error. %s\n", blockmax, disk->name, esc_tag(report->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected input/output close error in a data disk, it isn't possible to sync.\n");
|
||||
log_fatal("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle[j].path);
|
||||
log_fatal("Stopping at block %u\n", blockmax);
|
||||
|
|
@ -328,7 +327,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
|
|||
goto bail;
|
||||
}
|
||||
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockmax, disk->name, esc(report->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockmax, disk->name, esc_tag(report->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("WARNING! Unexpected close error in a data disk, it isn't possible to sync.\n");
|
||||
log_fatal("Ensure that file '%s' can be accessed.\n", handle[j].path);
|
||||
log_fatal("Stopping at block %u\n", blockmax);
|
||||
|
|
@ -375,7 +374,7 @@ bail:
|
|||
struct snapraid_disk* disk = handle[j].disk;
|
||||
ret = handle_close(&handle[j]);
|
||||
if (ret == -1) {
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", i, disk->name, esc(file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", i, disk->name, esc_tag(file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected close error in a data disk.\n");
|
||||
++error;
|
||||
/* continue, as we are already exiting */
|
||||
|
|
@ -482,7 +481,6 @@ static void sync_data_reader(struct snapraid_worker* worker, struct snapraid_tas
|
|||
unsigned char* buffer = task->buffer;
|
||||
int ret;
|
||||
char esc_buffer[ESC_MAX];
|
||||
char quote_buffer[QUOTE_MAX];
|
||||
|
||||
/* if the disk position is not used */
|
||||
if (!disk) {
|
||||
|
|
@ -517,7 +515,7 @@ 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 */
|
||||
if (errno == EIO) {
|
||||
log_tag("error:%u:%s:%s: Close EIO error. %s\n", blockcur, disk->name, esc(report->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close EIO error. %s\n", blockcur, disk->name, esc_tag(report->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected input/output close error in a data disk, it isn't possible to sync.\n");
|
||||
log_fatal("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle->path);
|
||||
log_fatal("Stopping at block %u\n", blockcur);
|
||||
|
|
@ -525,7 +523,7 @@ static void sync_data_reader(struct snapraid_worker* worker, struct snapraid_tas
|
|||
return;
|
||||
}
|
||||
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockcur, disk->name, esc(report->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockcur, disk->name, esc_tag(report->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("WARNING! Unexpected close error in a data disk, it isn't possible to sync.\n");
|
||||
log_fatal("Ensure that file '%s' can be accessed.\n", handle->path);
|
||||
log_fatal("Stopping at block %u\n", blockcur);
|
||||
|
|
@ -539,7 +537,7 @@ static void sync_data_reader(struct snapraid_worker* worker, struct snapraid_tas
|
|||
if (ret == -1) {
|
||||
if (errno == EIO) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("error:%u:%s:%s: Open EIO error. %s\n", blockcur, disk->name, esc(task->file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Open EIO error. %s\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected input/output open error in a data disk, it isn't possible to sync.\n");
|
||||
log_fatal("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, handle->path);
|
||||
log_fatal("Stopping at block %u\n", blockcur);
|
||||
|
|
@ -549,7 +547,7 @@ static void sync_data_reader(struct snapraid_worker* worker, struct snapraid_tas
|
|||
}
|
||||
|
||||
if (errno == ENOENT) {
|
||||
log_tag("error:%u:%s:%s: Open ENOENT error. %s\n", blockcur, disk->name, esc(task->file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Open ENOENT error. %s\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer), strerror(errno));
|
||||
log_error("Missing file '%s'.\n", handle->path);
|
||||
log_error("WARNING! You cannot modify data disk during a sync.\n");
|
||||
log_error("Rerun the sync command when finished.\n");
|
||||
|
|
@ -560,7 +558,7 @@ static void sync_data_reader(struct snapraid_worker* worker, struct snapraid_tas
|
|||
}
|
||||
|
||||
if (errno == EACCES) {
|
||||
log_tag("error:%u:%s:%s: Open EACCES error. %s\n", blockcur, disk->name, esc(task->file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Open EACCES error. %s\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer), strerror(errno));
|
||||
log_error("No access at file '%s'.\n", handle->path);
|
||||
log_error("WARNING! Please fix the access permission in the data disk.\n");
|
||||
log_error("Rerun the sync command when finished.\n");
|
||||
|
|
@ -570,10 +568,10 @@ static void sync_data_reader(struct snapraid_worker* worker, struct snapraid_tas
|
|||
}
|
||||
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("error:%u:%s:%s: Open error. %s\n", blockcur, disk->name, esc(task->file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Open error. %s\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("WARNING! Unexpected open error in a data disk, it isn't possible to sync.\n");
|
||||
log_fatal("Ensure that file '%s' can be accessed.\n", handle->path);
|
||||
log_fatal("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", quote('/', task->file->sub, quote_buffer));
|
||||
log_fatal("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", esc_shell('/', task->file->sub, esc_buffer));
|
||||
task->state = TASK_STATE_ERROR;
|
||||
return;
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
|
@ -585,7 +583,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(task->file->sub, esc_buffer));
|
||||
log_tag("error:%u:%s:%s: Unexpected attribute change\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer));
|
||||
if (handle->st.st_size != task->file->size) {
|
||||
log_error("Unexpected size change at file '%s' from %" PRIu64 " to %" PRIu64 ".\n", handle->path, task->file->size, handle->st.st_size);
|
||||
} else if (handle->st.st_mtime != task->file->mtime_sec
|
||||
|
|
@ -606,16 +604,16 @@ static void sync_data_reader(struct snapraid_worker* worker, struct snapraid_tas
|
|||
if (task->read_size == -1) {
|
||||
/* LCOV_EXCL_START */
|
||||
if (errno == EIO) {
|
||||
log_tag("error:%u:%s:%s: Read EIO error at position %u. %s\n", blockcur, disk->name, esc(task->file->sub, esc_buffer), task->file_pos, strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Read EIO error at position %u. %s\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer), task->file_pos, strerror(errno));
|
||||
log_error("Input/Output error in file '%s' at position '%u'\n", handle->path, task->file_pos);
|
||||
task->state = TASK_STATE_IOERROR_CONTINUE;
|
||||
return;
|
||||
}
|
||||
|
||||
log_tag("error:%u:%s:%s: Read error at position %u. %s\n", blockcur, disk->name, esc(task->file->sub, esc_buffer), task->file_pos, strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Read error at position %u. %s\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer), task->file_pos, strerror(errno));
|
||||
log_fatal("WARNING! Unexpected read error in a data disk, it isn't possible to sync.\n");
|
||||
log_fatal("Ensure that file '%s' can be read.\n", handle->path);
|
||||
log_fatal("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", quote('/', task->file->sub, quote_buffer));
|
||||
log_fatal("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", esc_shell('/', task->file->sub, esc_buffer));
|
||||
task->state = TASK_STATE_ERROR;
|
||||
return;
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
|
@ -937,7 +935,7 @@ 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(file->sub, esc_buffer));
|
||||
log_tag("error:%u:%s:%s: Unexpected data change\n", blockcur, disk->name, esc_tag(file->sub, esc_buffer));
|
||||
log_error("Data change at file '%s' at position '%u'\n", task->path, file_pos);
|
||||
log_error("WARNING! Unexpected data modification of a file without parity!\n");
|
||||
|
||||
|
|
@ -958,7 +956,7 @@ 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:%u:%s:%s: Data error at position %u, diff bits %u\n", blockcur, disk->name, esc(file->sub, esc_buffer), file_pos, diff);
|
||||
log_tag("error:%u:%s:%s: Data error at position %u, diff bits %u\n", blockcur, disk->name, esc_tag(file->sub, esc_buffer), file_pos, diff);
|
||||
log_error("Data error in file '%s' at position '%u', diff bits %u\n", task->path, file_pos, diff);
|
||||
|
||||
/* save the failed block for the fix */
|
||||
|
|
@ -1380,7 +1378,7 @@ bail:
|
|||
ret = handle_close(&handle[j]);
|
||||
if (ret == -1) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockcur, disk->name, esc(file->sub, esc_buffer), strerror(errno));
|
||||
log_tag("error:%u:%s:%s: Close error. %s\n", blockcur, disk->name, esc_tag(file->sub, esc_buffer), strerror(errno));
|
||||
log_fatal("DANGER! Unexpected close error in a data disk.\n");
|
||||
++error;
|
||||
/* continue, as we are already exiting */
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ void state_touch(struct snapraid_state* state)
|
|||
/* state changed, we need to update it */
|
||||
state->need_write = 1;
|
||||
|
||||
log_tag("touch:%s:%s: %" PRIu64 ".%d\n", disk->name, esc(file->sub, esc_buffer), (uint64_t)st.st_mtime, (int)STAT_NSEC(&st));
|
||||
log_tag("touch:%s:%s: %" PRIu64 ".%d\n", disk->name, esc_tag(file->sub, esc_buffer), (uint64_t)st.st_mtime, (int)STAT_NSEC(&st));
|
||||
msg_info("touch %s%s\n", disk->dir, file->sub);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue