aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <miklos@szeredi.hu>2004-09-27 17:07:10 +0000
committerGravatar Miklos Szeredi <miklos@szeredi.hu>2004-09-27 17:07:10 +0000
commitb054dd18911ad395e11012db4fffcbc1d0385ae4 (patch)
treec0d794f8836774ccd7f1de152faf447ada9aa0ce
parent1f18db5137cd1023a0b357976c0b103b8282ea71 (diff)
patch by Steven James
-rw-r--r--python/_fusemodule.c19
-rw-r--r--python/fuse.py20
-rwxr-xr-xpython/xmp.py1
3 files changed, 37 insertions, 3 deletions
diff --git a/python/_fusemodule.c b/python/_fusemodule.c
index 60fb66c..fba65b4 100644
--- a/python/_fusemodule.c
+++ b/python/_fusemodule.c
@@ -474,6 +474,24 @@ Fuse_main(PyObject *self, PyObject *args, PyObject *kw)
// List of functions defined in the module
//@-at
//@@c
+static char FuseInvalidate__doc__[] =
+ "Tell Fuse kernel module to explicitly invalidate a cached inode's contents\n";
+
+static PyObject *FuseInvalidate( PyObject *self, PyObject *args) {
+ char *path;
+ PyObject *ret;
+ int err;
+
+ PyString_Check(args);
+
+ path = PyString_AsString(args);
+
+ err = fuse_invalidate(fuse, path);
+
+ ret = PyInt_FromLong(err);
+
+ return(ret);
+}
static char FuseGetContext__doc__[] =
"Return the context of a filesystem operation in a dict. uid, gid, pid\n";
@@ -505,6 +523,7 @@ static PyObject *FuseGetContext( PyObject *self, PyObject *args) {
static PyMethodDef Fuse_methods[] = {
{"main", (PyCFunction)Fuse_main, METH_VARARGS|METH_KEYWORDS},
{"FuseGetContext", (PyCFunction)FuseGetContext, METH_VARARGS, FuseGetContext__doc__},
+ {"FuseInvalidate", (PyCFunction)FuseInvalidate, METH_VARARGS, FuseInvalidate__doc__},
{NULL, NULL} /* sentinel */
};
diff --git a/python/fuse.py b/python/fuse.py
index 3b0cd6d..ece9686 100644
--- a/python/fuse.py
+++ b/python/fuse.py
@@ -21,7 +21,8 @@ try:
except:
pass
-from _fuse import main
+from _fuse import main, FuseGetContext, FuseInvalidate
+from string import join
import os, sys
from errno import *
@@ -82,6 +83,13 @@ class Fuse:
self.optdict[k] = v
except:
self.optlist.append(o)
+
+ def GetContext(self):
+ return FuseGetContext(self)
+
+ def Invalidate(self, path):
+ return FuseInvalidate(self, path)
+
#@-node:__init__
#@+node:main
def main(self):
@@ -91,8 +99,16 @@ class Fuse:
if hasattr( self, 'debug'):
d['lopts'] = 'debug';
- d['kopts'] = 'allow_other,kernel_cache';
+ k=[]
+ if hasattr(self,'allow_other'):
+ k.append('allow_other')
+
+ if hasattr(self,'kernel_cache'):
+ k.append('kernel_cache')
+ if len(k):
+ d['kopts'] = join(k,',')
+
for a in self._attrs:
if hasattr(self,a):
d[a] = ErrnoWrapper(getattr(self, a))
diff --git a/python/xmp.py b/python/xmp.py
index e3ad741..946bca8 100755
--- a/python/xmp.py
+++ b/python/xmp.py
@@ -179,7 +179,6 @@ class Xmp(Fuse):
if __name__ == '__main__':
server = Xmp()
- server.flags = 0
server.multithreaded = 1;
server.main()
#@-node:mainline