New option --gui-touch-before

This commit is contained in:
Andrea Mazzoleni 2026-03-10 23:43:21 +01:00
parent df5b389afd
commit e48cdacce5
4 changed files with 24 additions and 10 deletions

View file

@ -1,6 +1,11 @@
SnapRAID HISTORY
================
14.0rc3 ?/03/2026
==================
* Added new --gui options for better interaction with SnapRAID Daemon.
* Removed the UAC request for Windows executable.
14.0rc2 08/03/2026
==================
* Extended Windows support to be on par with the Linux version.
@ -8,7 +13,7 @@ SnapRAID HISTORY
14.0rc1 01/03/2026
==================
* More log tags for all commands in preparation for the upcoming SnapRAID
daemon. Pre-release will be available at https://github.com/amadvance/snapraid-daemon.
Daemon. Pre-release will be available at https://github.com/amadvance/snapraid-daemon.
Note that this is the minimal SnapRAID version required to use the daemon.
* Fixed a crash on macOS when filesystem doesn't report UUID
* Added support for local exclusion rules via .snapraidignore files placed

View file

@ -649,8 +649,9 @@ void config(char* conf, size_t conf_size, const char* argv0)
#define OPT_GUI 501
#define OPT_GUI_VERBOSE 502
#define OPT_GUI_RESCAN_AFTER 503
#define OPT_GUI_THRESHOLD_REMOVES 504
#define OPT_GUI_THRESHOLD_UPDATES 505
#define OPT_GUI_TOUCH_BEFORE 504
#define OPT_GUI_THRESHOLD_REMOVES 505
#define OPT_GUI_THRESHOLD_UPDATES 506
/**
* Test options
@ -750,8 +751,9 @@ static struct option long_options[] = {
{ "gui", 0, 0, OPT_GUI }, /* undocumented GUI interface option (it was also 'G' in the past) */
{ "gui-verbose", 0, 0, OPT_GUI_VERBOSE }, /* undocumented GUI interface option */
{ "gui-rescan-after", 0, 0, OPT_GUI_RESCAN_AFTER }, /* undocumented GUI, force a rescan after the command to log differences */
{ "gui-threshold-removes", 1, 0, OPT_GUI_THRESHOLD_REMOVES }, /* abort sync if too many removed files */
{ "gui-threshold-updates", 1, 0, OPT_GUI_THRESHOLD_UPDATES }, /* abort sync if too many updated files */
{ "gui-touch-before", 0, 0, OPT_GUI_TOUCH_BEFORE }, /* undocumented GUI, force a touch before the command */
{ "gui-threshold-removes", 1, 0, OPT_GUI_THRESHOLD_REMOVES }, /* undocumented GUI, abort sync if too many removed files */
{ "gui-threshold-updates", 1, 0, OPT_GUI_THRESHOLD_UPDATES }, /* undocumented GUI, abort sync if too many updated files */
/* The following are test specific options, DO NOT USE! */
@ -1251,6 +1253,9 @@ int snapraid_main(int argc, char* argv[])
case OPT_GUI_RESCAN_AFTER :
opt.gui_rescan_after = 1;
break;
case OPT_GUI_TOUCH_BEFORE :
opt.gui_touch_before = 1;
break;
case OPT_GUI_THRESHOLD_REMOVES :
opt.gui_threshold_removes = strtoul(optarg, &e, 0);
if (!e || *e) {
@ -1868,6 +1873,9 @@ int snapraid_main(int argc, char* argv[])
if (state.opt.force_realloc)
state_locate_mark_tail_blocks_for_resync(&state, opt.parity_tail);
if (opt.gui_touch_before)
state_touch(&state);
state_scan(&state);
if (opt.gui_threshold_removes != 0 && state.removed_files > opt.gui_threshold_removes) {

View file

@ -69,6 +69,7 @@ struct snapraid_option {
int gui; /**< GUI output. */
int gui_verbose; /**< GUI verbose output. */
int gui_rescan_after; /**< GUI force a rescan after the command. */
int gui_touch_before; /**< GUI force a touch before the command. */
unsigned gui_threshold_removes; /**< GUI abort sync if too many removed files */
unsigned gui_threshold_updates; /**< GUI abort sync if too many updated files */
int auditonly; /**< In check, checks only the hash and not the parity. */

View file

@ -81,7 +81,7 @@ void state_touch(struct snapraid_state* state)
f = open(path, flags);
if (f == -1) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error opening file '%s'. %s.\n", path, strerror(errno));
log_error(errno, "Error opening file '%s'. %s.\n", path, strerror(errno));
continue;
/* LCOV_EXCL_STOP */
}
@ -92,7 +92,7 @@ void state_touch(struct snapraid_state* state)
if (ret == -1) {
/* LCOV_EXCL_START */
close(f);
log_fatal(errno, "Error accessing file '%s'. %s.\n", path, strerror(errno));
log_error(errno, "Error accessing file '%s'. %s.\n", path, strerror(errno));
continue;
/* LCOV_EXCL_STOP */
}
@ -102,7 +102,7 @@ void state_touch(struct snapraid_state* state)
if (ret != 0) {
/* LCOV_EXCL_START */
close(f);
log_fatal(errno, "Error timing file '%s'. %s.\n", path, strerror(errno));
log_error(errno, "Error timing file '%s'. %s.\n", path, strerror(errno));
continue;
/* LCOV_EXCL_STOP */
}
@ -114,7 +114,7 @@ void state_touch(struct snapraid_state* state)
if (ret == -1) {
/* LCOV_EXCL_START */
close(f);
log_fatal(errno, "Error accessing file '%s'. %s.\n", path, strerror(errno));
log_error(errno, "Error accessing file '%s'. %s.\n", path, strerror(errno));
continue;
/* LCOV_EXCL_STOP */
}
@ -123,7 +123,7 @@ void state_touch(struct snapraid_state* state)
ret = close(f);
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error closing file '%s'. %s.\n", path, strerror(errno));
log_error(errno, "Error closing file '%s'. %s.\n", path, strerror(errno));
continue;
/* LCOV_EXCL_STOP */
}