瀏覽代碼

Make fuse fs work on OS X

Jonas Borgström 12 年之前
父節點
當前提交
626777405d
共有 2 個文件被更改,包括 18 次插入3 次删除
  1. 13 1
      attic/fuse.py
  2. 5 2
      attic/testsuite/archiver.py

+ 13 - 1
attic/fuse.py

@@ -54,6 +54,18 @@ class AtticOperations(llfuse.Operations):
         self._inode_count += 1
         return self._inode_count
 
+    def statfs(self):
+        stat_ = llfuse.StatvfsData()
+        stat_.f_bsize = 512
+        stat_.f_frsize = 512
+        stat_.f_blocks = 0
+        stat_.f_bfree = 0
+        stat_.f_bavail = 0
+        stat_.f_files = 0
+        stat_.f_ffree = 0
+        stat_.f_favail = 0
+        return stat_
+
     def _find_inode(self, path):
         segments = os.fsencode(os.path.normpath(path)).split(b'/')
         inode = 1
@@ -142,7 +154,7 @@ class AtticOperations(llfuse.Operations):
         return os.fsencode(self.items[inode][b'source'])
 
     def mount(self, mountpoint):
-        llfuse.init(self, mountpoint, ['fsname=atticfs', 'nonempty', 'ro'])
+        llfuse.init(self, mountpoint, ['fsname=atticfs', 'ro'])
         try:
             llfuse.main(single=True)
         except:

+ 5 - 2
attic/testsuite/archiver.py

@@ -111,7 +111,7 @@ class ArchiverTestCase(AtticTestCase):
         os.chown('input/file1', 100, 200)
         # File mode
         os.chmod('input/file1', 0o7755)
-        os.chmod('input/dir2', 0o700)
+        os.chmod('input/dir2', 0o555)
         # Block device
         os.mknod('input/bdev', 0o600 | stat.S_IFBLK,  os.makedev(10, 20))
         # Char device
@@ -226,7 +226,10 @@ class ArchiverTestCase(AtticTestCase):
             self.wait_for_mount(mountpoint)
             self.assert_dirs_equal(self.input_path, os.path.join(mountpoint, 'input'), fuse=True)
         finally:
-            os.system('fusermount -u ' + mountpoint)
+            if sys.platform.startswith('linux'):
+                os.system('fusermount -u ' + mountpoint)
+            else:
+                os.system('umount ' + mountpoint)
             os.rmdir(mountpoint)
             # Give the daemon some time to exit
             time.sleep(.2)