summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2018-02-14 20:35:36 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2018-02-14 20:35:36 +0100
commitb19280009679f31bd3cf05a9a7df95ef121cef0b (patch)
tree18e9d9ba420819d13125a09a9da568511c36a807 /sys
parentdf6a30f3c0e2be41161101db0d62f5c02d93bbc0 (diff)
ftpfs: no caching by default, add -c flag to enable it (patch by mycroftiv)
Diffstat (limited to 'sys')
-rw-r--r--sys/man/4/ftpfs15
-rw-r--r--sys/src/cmd/ip/ftpfs/ftpfs.c6
2 files changed, 13 insertions, 8 deletions
diff --git a/sys/man/4/ftpfs b/sys/man/4/ftpfs
index 0a827b0ee..e1f37c537 100644
--- a/sys/man/4/ftpfs
+++ b/sys/man/4/ftpfs
@@ -4,7 +4,7 @@ ftpfs \- file transfer protocol (FTP) file system
.SH SYNOPSIS
.B ftpfs
[
-.B -/dqnt
+.B -/dqntc
]
[
.B -m
@@ -90,6 +90,10 @@ To avoid seeing startup messages from the server use option
To see all messages from the server use option
.BR -d .
.PP
+By default ftpfs only caches while a file operation is in progress. The
+.BR -c
+flag enables caching, increasing performance but allowing outdated file and directory data to persist.
+.PP
Some systems will hangup an ftp connection that has no activity
for a given period. The
.BR -K
@@ -183,13 +187,8 @@ only one directory, usually
However, walking to any valid directory on that machine will succeed
and cause that directory entry to appear under the mount point.
.PP
-.I Ftpfs
-caches files and directories. A directory will fall from the cache
-after 5 quiescent minutes or if the local user changes the
-directory by writing or removing a file.
-Otherwise, remote
-changes to the directory that occur after the directory has
-been cached might not be immediately visible.
+If caching is active, remote
+changes that have been cached will not be visible.
Attempting to walk to
.IB directory /.flush.ftpfs
will flush
diff --git a/sys/src/cmd/ip/ftpfs/ftpfs.c b/sys/src/cmd/ip/ftpfs/ftpfs.c
index b67dde99e..e254284c4 100644
--- a/sys/src/cmd/ip/ftpfs/ftpfs.c
+++ b/sys/src/cmd/ip/ftpfs/ftpfs.c
@@ -85,6 +85,7 @@ char *nouid = "?uid?";
char *nosuchfile = "file does not exist";
char *keyspec = "";
+int docache = 0;
void
usage(void)
@@ -149,6 +150,9 @@ main(int argc, char *argv[])
case 'q':
quiet = 1;
break;
+ case 'c':
+ docache = 1;
+ break;
} ARGEND
if(argc != 1)
usage();
@@ -582,6 +586,8 @@ rclunk(Fid *f)
f->node->opens--;
}
f->busy = 0;
+ if(!docache && ISCACHED(f->node))
+ uncache(f->node);
return 0;
}