]> arthur.barton.de Git - bup.git/commitdiff
fuse: remove redundant custom Stat class
authorRob Browning <rlb@defaultvalue.org>
Sun, 28 Feb 2016 16:21:57 +0000 (10:21 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sun, 13 Mar 2016 23:03:31 +0000 (18:03 -0500)
It looks like our Stat class was just reinitializing all of the things
that the built in fuse.Stat class already initializes, so just rely on
theirs, and use their keyword initializers to avoid a few more
reinitializations.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
cmd/fuse-cmd.py
t/test-fuse.sh

index f2776e54853c60ddc0293ce48911ba4a5b59308c..66e2b87acdde63142b96a4431b7af0e316b1ab99 100755 (executable)
@@ -17,23 +17,6 @@ except ImportError:
     sys.exit(1)
 
 
-class Stat(fuse.Stat):
-    def __init__(self):
-        self.st_mode = 0
-        self.st_ino = 0
-        self.st_dev = 0
-        self.st_nlink = 0
-        self.st_uid = 0
-        self.st_gid = 0
-        self.st_size = 0
-        self.st_atime = 0
-        self.st_mtime = 0
-        self.st_ctime = 0
-        self.st_blocks = 0
-        self.st_blksize = 0
-        self.st_rdev = 0
-
-
 cache = {}
 def cache_get(top, path):
     parts = path.split('/')
@@ -74,10 +57,10 @@ class BupFs(fuse.Fuse):
             log('--getattr(%r)\n' % path)
         try:
             node = cache_get(self.top, path)
-            st = Stat()
-            st.st_mode = node.mode
-            st.st_nlink = node.nlinks()
-            st.st_size = node.size()  # Until/unless we store the size in m.
+            st = fuse.Stat(st_mode=node.mode,
+                           st_nlink=node.nlinks(),
+                           # Until/unless we store the size in m.
+                           st_size=node.size())
             if self.meta:
                 m = node.metadata()
                 if m:
index c61a1d25da4707d9acb249b3f5f4003860a94735..5949907b86c8c25c0969d06034a27ff62ac94b49 100755 (executable)
@@ -73,6 +73,9 @@ result=$(WVPASS ls mnt/src/latest) || exit $?
 WVPASSEQ "$result" "foo
 pre-epoch"
 
+result=$(WVPASS cat mnt/src/latest/foo) || exit $?
+WVPASSEQ "$result" "content"
+
 # Right now we don't detect new saves.
 WVPASS bup save -n src -d "$savestamp2" --strip src
 result=$(WVPASS ls mnt/src) || exit $?
@@ -86,7 +89,7 @@ WVPASS bup fuse --meta mnt
 result=$(TZ=UTC LC_ALL=C WVPASS ls -l mnt/src/latest/) || exit $?
 readonly user=$(WVPASS id -un) || $?
 readonly group=$(WVPASS id -gn) || $?
-WVPASSEQ "$result" "total 0
+WVPASSEQ "$result" "total 1
 -rw-r--r-- 1 $user $group 8 Nov 11  2011 foo
 -rw-r--r-- 1 $user $group 8 Jan  1  1970 pre-epoch"