aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/Makefile7
-rw-r--r--python/fuse.py72
-rwxr-xr-xpython/xmp.py83
3 files changed, 84 insertions, 78 deletions
diff --git a/python/Makefile b/python/Makefile
index dfaf492..8b7ea80 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -1,10 +1,5 @@
_fusemodule.so: _fusemodule.c
gcc -g3 -I/usr/include/python1.5 _fusemodule.c -Wl,-shared -o _fusemodule.so -Wimplicit -lfuse && python -c 'import _fuse'
-demo: _fusemodule.so
- -sudo umount tmp
- fusermount tmp ./fuse.py
-
-
clean:
- rm _fusemodule.so *.pyc *.pyo
+ rm -f _fusemodule.so *.pyc *.pyo
diff --git a/python/fuse.py b/python/fuse.py
index 74b2380..ec1e633 100644
--- a/python/fuse.py
+++ b/python/fuse.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
#
# Copyright (C) 2001 Jeff Epler <jepler@unpythonic.dhs.org>
#
@@ -8,7 +7,6 @@
from _fuse import main, DEBUG
import os
-from stat import *
from errno import *
class ErrnoWrapper:
@@ -38,73 +36,3 @@ class Fuse:
d[a] = ErrnoWrapper(getattr(self, a))
apply(main, (), d)
-class Xmp(Fuse):
- flags = 1
-
- def getattr(self, path):
- return os.lstat(path)
-
- def readlink(self, path):
- return os.readlink(path)
-
- def getdir(self, path):
- return map(lambda x: (x,0), os.listdir(path))
-
- def unlink(self, path):
- return os.unlink(path)
-
- def rmdir(self, path):
- return os.rmdir(path)
-
- def symlink(self, path, path1):
- return os.symlink(path, path1)
-
- def rename(self, path, path1):
- return os.rename(path, path1)
-
- def link(self, path, path1):
- return os.link(path, path1)
-
- def chmod(self, path, mode):
- return os.chmod(path, mode)
-
- def chown(self, path, user, group):
- return os.chown(path, user, group)
-
- def truncate(self, path, size):
- f = open(path, "w+")
- return f.truncate(size)
-
- def mknod(self, path, mode, dev):
- """ Python has no os.mknod, so we can only do some things """
- if S_ISREG(mode):
- open(path, "w")
- else:
- return -EINVAL
-
- def mkdir(self, path, mode):
- return os.mkdir(path, mode)
-
- def utime(self, path, times):
- return os.utime(path, times)
-
- def open(self, path, flags):
- os.close(os.open(path, flags))
- return 0
-
- def read(self, path, len, offset):
- f = open(path, "r")
- f.seek(offset)
- return f.read(len)
-
- def write(self, path, buf, off):
- f = open(path, "r+")
- f.seek(off)
- f.write(buf)
- return len(buf)
-
-if __name__ == '__main__':
- server = Xmp()
- server.flags = 0
- server.multithreaded = 1;
- server.main()
diff --git a/python/xmp.py b/python/xmp.py
new file mode 100755
index 0000000..271e269
--- /dev/null
+++ b/python/xmp.py
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2001 Jeff Epler <jepler@unpythonic.dhs.org>
+#
+# This program can be distributed under the terms of the GNU GPL.
+# See the file COPYING.
+#
+
+from fuse import Fuse
+import os
+from errno import *
+from stat import *
+
+class Xmp(Fuse):
+ flags = 1
+
+ def getattr(self, path):
+ return os.lstat(path)
+
+ def readlink(self, path):
+ return os.readlink(path)
+
+ def getdir(self, path):
+ return map(lambda x: (x,0), os.listdir(path))
+
+ def unlink(self, path):
+ return os.unlink(path)
+
+ def rmdir(self, path):
+ return os.rmdir(path)
+
+ def symlink(self, path, path1):
+ return os.symlink(path, path1)
+
+ def rename(self, path, path1):
+ return os.rename(path, path1)
+
+ def link(self, path, path1):
+ return os.link(path, path1)
+
+ def chmod(self, path, mode):
+ return os.chmod(path, mode)
+
+ def chown(self, path, user, group):
+ return os.chown(path, user, group)
+
+ def truncate(self, path, size):
+ f = open(path, "w+")
+ return f.truncate(size)
+
+ def mknod(self, path, mode, dev):
+ """ Python has no os.mknod, so we can only do some things """
+ if S_ISREG(mode):
+ open(path, "w")
+ else:
+ return -EINVAL
+
+ def mkdir(self, path, mode):
+ return os.mkdir(path, mode)
+
+ def utime(self, path, times):
+ return os.utime(path, times)
+
+ def open(self, path, flags):
+ os.close(os.open(path, flags))
+ return 0
+
+ def read(self, path, len, offset):
+ f = open(path, "r")
+ f.seek(offset)
+ return f.read(len)
+
+ def write(self, path, buf, off):
+ f = open(path, "r+")
+ f.seek(off)
+ f.write(buf)
+ return len(buf)
+
+if __name__ == '__main__':
+ server = Xmp()
+ server.flags = 0
+ server.multithreaded = 1;
+ server.main()