From 9d3773a2d4f130015e0605369f24910d6aacca5e Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Mon, 18 Jan 2016 19:38:42 +0100 Subject: [PATCH] Rename the 'nano' command to 'touch' --- HISTORY | 4 ++-- Makefile.am | 4 ++-- cmdline/scan.c | 2 +- cmdline/snapraid.c | 14 +++++++------- cmdline/state.h | 2 +- cmdline/status.c | 2 +- cmdline/{nano.c => touch.c} | 8 ++++---- snapraid.1 | 4 ++-- snapraid.d | 4 ++-- snapraid.txt | 6 +++--- 10 files changed, 25 insertions(+), 25 deletions(-) rename cmdline/{nano.c => touch.c} (93%) diff --git a/HISTORY b/HISTORY index 32a099a9..3e3a9dca 100644 --- a/HISTORY +++ b/HISTORY @@ -16,9 +16,9 @@ SnapRAID HISTORY files in case a silent error is found during the hash verification check. * In the configuration file 'data' is now a synonymous of 'disk'. - * Adds the 'nano' command intended to arbitrarely set all the zero + * Adds the 'touch' command intended to arbitrarely set all the zero subsecond timestamps. This improves the SnapRAID capabilities to - identify files. The 'status' command recommend to run 'nano' if + identify files. The 'status' command recommends to run 'touch' if required. 9.3 2016/01 diff --git a/Makefile.am b/Makefile.am index 17a2f211..3c6f3ae4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,7 +34,7 @@ snapraid_SOURCES = \ cmdline/pool.c \ cmdline/parity.c \ cmdline/handle.c \ - cmdline/nano.c \ + cmdline/touch.c \ cmdline/device.c \ cmdline/fnmatch.c \ cmdline/selftest.c \ @@ -388,7 +388,7 @@ endif $(MSG) Nano touch -t 200102011234.56 bench/disk1/a/a* $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) sync - $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) nano + $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) touch $(MSG) Check the --gen-conf command $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --gen-conf bench/content $(MSG) Filter diff --git a/cmdline/scan.c b/cmdline/scan.c index f9a8bc37..cf47b603 100644 --- a/cmdline/scan.c +++ b/cmdline/scan.c @@ -625,7 +625,7 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub, * Cases found are: * - Linux FUSE with exFAT driver from https://code.google.com/p/exfat/. * Inodes are reassigned at every mount restarting from 1 and incrementing. - * As worse, the exFAT support in FUSE doesn't use subsecond precision in timestamps + * As worse, the exFAT support in FUSE doesn't use sub-second precision in timestamps * making inode collision more easy (exFAT by design supports 10ms precision). * - Linux VFAT kernel (3.2) driver. Inodes are fully reassigned at every mount. * diff --git a/cmdline/snapraid.c b/cmdline/snapraid.c index 47d91dd7..d42bfa23 100644 --- a/cmdline/snapraid.c +++ b/cmdline/snapraid.c @@ -432,7 +432,7 @@ void signal_init(void) #define OPERATION_STATUS 10 #define OPERATION_REWRITE 11 #define OPERATION_READ 12 -#define OPERATION_NANO 13 +#define OPERATION_TOUCH 13 #define OPERATION_SPINUP 14 #define OPERATION_SPINDOWN 15 #define OPERATION_DEVICES 16 @@ -828,8 +828,8 @@ int main(int argc, char* argv[]) operation = OPERATION_REWRITE; } else if (strcmp(argv[optind], "test-read") == 0) { operation = OPERATION_READ; - } else if (strcmp(argv[optind], "nano") == 0) { - operation = OPERATION_NANO; + } else if (strcmp(argv[optind], "touch") == 0) { + operation = OPERATION_TOUCH; } else if (strcmp(argv[optind], "up") == 0) { operation = OPERATION_SPINUP; } else if (strcmp(argv[optind], "down") == 0) { @@ -993,7 +993,7 @@ int main(int argc, char* argv[]) case OPERATION_REWRITE : case OPERATION_READ : case OPERATION_REHASH : - case OPERATION_NANO : + case OPERATION_TOUCH : case OPERATION_SPINUP : /* we want to do it in different threads to avoid blocking */ /* avoid to check and access parity disks if not needed */ opt.skip_parity_access = 1; @@ -1013,7 +1013,7 @@ int main(int argc, char* argv[]) case OPERATION_LIST : case OPERATION_DUP : case OPERATION_POOL : - case OPERATION_NANO : + case OPERATION_TOUCH : case OPERATION_SPINUP : case OPERATION_SPINDOWN : case OPERATION_DEVICES : @@ -1223,10 +1223,10 @@ int main(int argc, char* argv[]) state_read(&state); memory(); - } else if (operation == OPERATION_NANO) { + } else if (operation == OPERATION_TOUCH) { state_read(&state); - state_nano(&state); + state_touch(&state); /* intercept signals while operating */ signal_init(); diff --git a/cmdline/state.h b/cmdline/state.h index 721bde4e..382e67df 100644 --- a/cmdline/state.h +++ b/cmdline/state.h @@ -223,7 +223,7 @@ void state_scan(struct snapraid_state* state); /** * Set the nanosecond timestamp of all files that have a zero value. */ -void state_nano(struct snapraid_state* state); +void state_touch(struct snapraid_state* state); /** * Devices operations. diff --git a/cmdline/status.c b/cmdline/status.c index f5373564..a6d769cb 100644 --- a/cmdline/status.c +++ b/cmdline/status.c @@ -473,7 +473,7 @@ int state_status(struct snapraid_state* state) if (file_zerosubsecond) { printf("You have %u files with zero sub-second timestamp.\n", file_zerosubsecond); - printf("Run the 'nano' command to set it to a not zero value.\n"); + printf("Run the 'touch' command to set it to a not zero value.\n"); } else { printf("No file has a zero sub-second timestamp.\n"); } diff --git a/cmdline/nano.c b/cmdline/touch.c similarity index 93% rename from cmdline/nano.c rename to cmdline/touch.c index a26164a6..75b1805d 100644 --- a/cmdline/nano.c +++ b/cmdline/touch.c @@ -22,11 +22,11 @@ #include "state.h" #include "handle.h" -void state_nano(struct snapraid_state* state) +void state_touch(struct snapraid_state* state) { tommy_node* i; - msg_progress("Setting nanosecond timestamps...\n"); + msg_progress("Setting sub-second timestamps...\n"); /* for all disks */ for (i = state->disklist; i != 0; i = i->next) { @@ -125,8 +125,8 @@ void state_nano(struct snapraid_state* state) /* state changed, we need to update it */ state->need_write = 1; - log_tag("nano:%s:%s\n", disk->name, esc(file->sub)); - msg_info("nano %s%s\n", disk->dir, file->sub); + log_tag("touch:%s:%s: %" PRIu64 ".%d\n", disk->name, esc(file->sub), (uint64_t)st.st_mtime, (int)STAT_NSEC(&st)); + msg_info("touch %s%s\n", disk->dir, file->sub); } } } diff --git a/snapraid.1 b/snapraid.1 index f382ebbb..a4a96842 100644 --- a/snapraid.1 +++ b/snapraid.1 @@ -54,7 +54,7 @@ snapraid [\-c, \-\-conf CONFIG] .PD 0 .PP .PD - |up|down|pool|devices|nano|rehash + |up|down|pool|devices|touch|rehash .PD 0 .PP .PD @@ -913,7 +913,7 @@ array, but in some more complex configurations, you may have multiple low level devices used by a single disk in the array. .PP Nothing is modified. -.SS nano +.SS touch Sets arbitrarely the sub\-second timestamp of all the files that have it at zero. .PP diff --git a/snapraid.d b/snapraid.d index 0b4161a9..46e693b5 100644 --- a/snapraid.d +++ b/snapraid.d @@ -15,7 +15,7 @@ Synopsis : [-L, --error-limit NUMBER] : [-v, --verbose] [-q, --quiet] : status|smart|up|down|diff|sync|scrub|fix|check|list|dup - : |up|down|pool|devices|nano|rehash + : |up|down|pool|devices|touch|rehash :snapraid [-V, --version] [-H, --help] [-C, --gen-conf CONTENT] @@ -630,7 +630,7 @@ Commands Nothing is modified. - nano + touch Sets arbitrarely the sub-second timestamp of all the files that have it at zero. diff --git a/snapraid.txt b/snapraid.txt index 0a685687..32a58de6 100644 --- a/snapraid.txt +++ b/snapraid.txt @@ -19,7 +19,7 @@ snapraid [-c, --conf CONFIG] [-L, --error-limit NUMBER] [-v, --verbose] [-q, --quiet] status|smart|up|down|diff|sync|scrub|fix|check|list|dup - |up|down|pool|devices|nano|rehash + |up|down|pool|devices|touch|rehash snapraid [-V, --version] [-H, --help] [-C, --gen-conf CONTENT] @@ -684,8 +684,8 @@ low level devices used by a single disk in the array. Nothing is modified. -5.16 nano ---------- +5.16 touch +---------- Sets arbitrarely the sub-second timestamp of all the files that have it at zero.