diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-07-14 23:49:17 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-07-14 23:49:17 +0200 |
commit | 8099d78f447fd77b215e2cc6a6bab2097a0d4d54 (patch) | |
tree | bba4ffff4d1ed703f7ea918f7608d9689ab1e9ce /sys/src/cmd/cwfs | |
parent | b494f61baa98f9ebb17cae13257d056af995b9f3 (diff) |
cwfs: noatime flag
Diffstat (limited to 'sys/src/cmd/cwfs')
-rw-r--r-- | sys/src/cmd/cwfs/all.h | 1 | ||||
-rw-r--r-- | sys/src/cmd/cwfs/con.c | 10 | ||||
-rw-r--r-- | sys/src/cmd/cwfs/config.c | 23 | ||||
-rw-r--r-- | sys/src/cmd/cwfs/dentry.c | 22 |
4 files changed, 41 insertions, 15 deletions
diff --git a/sys/src/cmd/cwfs/all.h b/sys/src/cmd/cwfs/all.h index 3c29ecc5b..05d5d4c48 100644 --- a/sys/src/cmd/cwfs/all.h +++ b/sys/src/cmd/cwfs/all.h @@ -84,6 +84,7 @@ ulong chatflag; ulong authdebugflag; int noattach; /* attach is disabled */ int noauth; /* auth is disable */ +int noatime; /* atime is disabled */ int wstatallow; /* set to circumvent wstat permissions */ int writeallow; /* set to circumvent write permissions */ int duallow; /* single user to allow du */ diff --git a/sys/src/cmd/cwfs/con.c b/sys/src/cmd/cwfs/con.c index 61ab25806..496915d0e 100644 --- a/sys/src/cmd/cwfs/con.c +++ b/sys/src/cmd/cwfs/con.c @@ -690,7 +690,14 @@ void cmd_noauth(int, char *[]) { noauth = !noauth; - print("authentication %s\n", noauth ? "disabled" : "enabled"); + print("auth %s\n", noauth ? "disabled" : "enabled"); +} + +void +cmd_noatime(int, char *[]) +{ + noatime = !noatime; + print("atime %s\n", noatime ? "disabled" : "enabled"); } void @@ -767,6 +774,7 @@ installcmds(void) cmd_install("hangup", "chan -- clunk files", cmd_hangup); cmd_install("printconf", "-- print configuration", cmd_printconf); cmd_install("noauth", "toggle noauth flag", cmd_noauth); + cmd_install("noatime", "toggle noatime flag", cmd_noatime); cmd_install("noattach", "toggle noattach flag", cmd_noattach); cmd_install("files", "report on files structure", cmd_files); diff --git a/sys/src/cmd/cwfs/config.c b/sys/src/cmd/cwfs/config.c index d371a8bed..8609790a8 100644 --- a/sys/src/cmd/cwfs/config.c +++ b/sys/src/cmd/cwfs/config.c @@ -22,6 +22,7 @@ static int copyworm = 0, copydev = 0; static char *src, *dest; static int noauthset = 0; +static int noatimeset = 0; static int readonlyset = 0; static int resetparams; @@ -432,6 +433,8 @@ mergeconf(Iobuf *p) if(!noauthset) noauth = 0; + if(!noatimeset) + noatime = 0; if(!readonlyset) readonly = 0; for (cp = p->iobuf; *cp != '\0'; cp++) { @@ -448,6 +451,9 @@ mergeconf(Iobuf *p) } else if(strcmp(word, "noauth") == 0){ if(!noauthset) noauth = 1; + } else if(strcmp(word, "noatime") == 0){ + if(!noatimeset) + noatime = 1; } else if(strcmp(word, "readonly") == 0){ if(!readonlyset) readonly = 1; @@ -595,6 +601,8 @@ start: fs->conf); if(noauth) cp = seprint(cp, ep, "noauth\n"); + if(noatime) + cp = seprint(cp, ep, "noatime\n"); if(readonly) cp = seprint(cp, ep, "readonly\n"); if(conf.newcache) @@ -605,7 +613,7 @@ start: putbuf(p); f.modconf = f.newconf = 0; - noauthset = readonlyset = 0; + noauthset = noatimeset = readonlyset = 0; goto start; } putbuf(p); @@ -993,19 +1001,26 @@ arginit(void) } if(strcmp(word, "noattach") == 0) { noattach = !noattach; - print("attach is now %s\n", noattach ? "disallowed" : "allowed"); + print("attach %s\n", noattach ? "disallowed" : "allowed"); continue; } if(strcmp(word, "noauth") == 0) { noauth = !noauth; - print("auth is now %s\n", noauth ? "disabled" : "enabled"); + print("auth %s\n", noauth ? "disabled" : "enabled"); noauthset++; f.modconf = 1; continue; } + if(strcmp(word, "noatime") == 0) { + noatime = !noatime; + print("atime %s\n", noatime ? "disabled" : "enabled"); + noatimeset++; + f.modconf = 1; + continue; + } if(strcmp(word, "readonly") == 0) { readonly = !readonly; - print("filesystem is now %s\n", readonly ? "readonly" : "writable"); + print("filesystem %s\n", readonly ? "readonly" : "writable"); readonlyset++; f.modconf = 1; continue; diff --git a/sys/src/cmd/cwfs/dentry.c b/sys/src/cmd/cwfs/dentry.c index e34090e4c..ad0d55d0e 100644 --- a/sys/src/cmd/cwfs/dentry.c +++ b/sys/src/cmd/cwfs/dentry.c @@ -13,16 +13,18 @@ accessdir(Iobuf *p, Dentry *d, int f, int uid) { Timet t; - if(p && p->dev->type != Devro) { - p->flags |= Bmod; - t = time(nil); - if(f & (FREAD|FWRITE)) - d->atime = t; - if(f & FWRITE) { - d->mtime = t; - d->muid = uid; - d->qid.version++; - } + if(p == nil || p->dev->type == Devro) + return; + f &= FREAD|FWRITE; + if(f != FWRITE && noatime) + return; + p->flags |= Bmod; + t = time(nil); + d->atime = t; + if(f & FWRITE){ + d->mtime = t; + d->muid = uid; + d->qid.version++; } } |