X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fvhashify.c;h=1cfb875fa59645ca17c0aa59b331b8247a54a23e;hb=d785768db196e4c62934f765a1d7d455310d6fe5;hp=5e37887753fee0cfc73382c0e88eaa80bd47d54a;hpb=9c78378bebc1a9f3d400f422df8ede9efea57dea;p=util-vserver.git diff --git a/src/vhashify.c b/src/vhashify.c index 5e37887..1cfb875 100644 --- a/src/vhashify.c +++ b/src/vhashify.c @@ -20,6 +20,8 @@ # include #endif +#define UTIL_VSERVER_UNIFY_MTIME_OPTIONAL + #include "vhashify.h" #include "util.h" @@ -70,6 +72,7 @@ #define CMD_SLEDGE 0x1002 #define CMD_MANUALLY 0x1003 #define CMD_REFRESH 0x1004 +#define CMD_NOMTIME 0x1005 struct option const CMDLINE_OPTIONS[] = { @@ -80,6 +83,7 @@ CMDLINE_OPTIONS[] = { { "sledgehammer", no_argument, 0, CMD_SLEDGE }, { "manually", no_argument, 0, CMD_MANUALLY }, { "refresh", no_argument, 0, CMD_REFRESH }, + { "ignore-mtime", no_argument, 0, CMD_NOMTIME }, { "dry-run", no_argument, 0, 'n' }, { "verbose", no_argument, 0, 'v' }, { 0,0,0,0 } @@ -289,7 +293,7 @@ addStatHash(hashFunctionContext *h_ctx, struct stat const * const st) SET_ATTR(gid), SET_ATTR(rdev), SET_ATTR(size), - SET_ATTR(mtime) + .mtime = (global_args->ignore_mtime ? 0 : st->st_mtime), }; #undef SET_ATTR @@ -688,6 +692,7 @@ int main(int argc, char *argv[]) .insecure = 0, .dry_run = false, .do_refresh = false, + .ignore_mtime = false, }; Vector_init(&global_info.hash_dirs, sizeof(struct HashDirInfo)); @@ -706,12 +711,13 @@ int main(int argc, char *argv[]) case CMD_INSECURE : args.insecure = 1; break; case CMD_SLEDGE : args.insecure = 2; break; case CMD_REFRESH : args.do_refresh = true; break; + case CMD_NOMTIME : args.ignore_mtime = true; break; case 'n' : args.dry_run = true; break; case 'v' : ++args.verbosity; break; default : WRITE_MSG(2, "Try '"); WRITE_STR(2, argv[0]); - WRITE_MSG(2, " --help\" for more information.\n"); + WRITE_MSG(2, " --help' for more information.\n"); return EXIT_FAILURE; break; }