fix
diff --git a/ChangeLog b/ChangeLog
index 991f023..16ed905 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-08-02 Miklos Szeredi <miklos@szeredi.hu>
+
+ * highlevel-lib: added mount options "attr_timeout" and
+ "entry_timeout". These options control the length of time file
+ attributes and entries (names) are cached. Both default to 1.0
+ second.
+
2005-08-01 Miklos Szeredi <miklos@szeredi.hu>
* Added missing symbols to versionscript (Joshua J. Berry)
diff --git a/lib/fuse.c b/lib/fuse.c
index a798eaf..b3203d2 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -62,9 +62,6 @@
#define FUSE_MAX_PATH 4096
-#define ENTRY_REVALIDATE_TIME 1.0 /* sec */
-#define ATTR_REVALIDATE_TIME 1.0 /* sec */
-
struct fuse {
struct fuse_ll *fll;
int flags;
@@ -83,6 +80,8 @@
uid_t uid;
gid_t gid;
mode_t umask;
+ double entry_timeout;
+ double attr_timeout;
};
struct node {
@@ -516,8 +515,8 @@
else {
e->ino = node->nodeid;
e->generation = node->generation;
- e->entry_timeout = ENTRY_REVALIDATE_TIME;
- e->attr_timeout = ATTR_REVALIDATE_TIME;
+ e->entry_timeout = f->entry_timeout;
+ e->attr_timeout = f->attr_timeout;
set_stat(f, e->ino, &e->attr);
if (f->flags & FUSE_DEBUG) {
printf(" NODEID: %lu\n", (unsigned long) e->ino);
@@ -634,7 +633,7 @@
pthread_rwlock_unlock(&f->tree_lock);
if (!err) {
set_stat(f, ino, &buf);
- fuse_reply_attr(req, &buf, ATTR_REVALIDATE_TIME);
+ fuse_reply_attr(req, &buf, f->attr_timeout);
} else
reply_err(req, err);
}
@@ -719,7 +718,7 @@
pthread_rwlock_unlock(&f->tree_lock);
if (!err) {
set_stat(f, ino, &buf);
- fuse_reply_attr(req, &buf, ATTR_REVALIDATE_TIME);
+ fuse_reply_attr(req, &buf, f->attr_timeout);
} else
reply_err(req, err);
}
@@ -1707,7 +1706,9 @@
strcmp(opt, "kernel_cache") == 0 ||
begins_with(opt, "umask=") ||
begins_with(opt, "uid=") ||
- begins_with(opt, "gid="))
+ begins_with(opt, "gid=") ||
+ begins_with(opt, "entry_timeout=") ||
+ begins_with(opt, "attr_timeout="))
return 1;
else
return 0;
@@ -1750,6 +1751,10 @@
f->flags |= FUSE_SET_UID;
else if(sscanf(opt, "gid=%u", &f->gid) == 1)
f->flags |= FUSE_SET_GID;
+ else if (sscanf(opt, "entry_timeout=%lf", &f->entry_timeout) == 1)
+ /* nop */;
+ else if (sscanf(opt, "attr_timeout=%lf", &f->attr_timeout) == 1)
+ /* nop */;
else
fprintf(stderr, "fuse: warning: unknown option `%s'\n", opt);
}
@@ -1782,6 +1787,9 @@
goto out;
}
+ f->entry_timeout = 1.0;
+ f->attr_timeout = 1.0;
+
if (parse_lib_opts(f, opts, &llopts) == -1)
goto out_free;