]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
tahoefuse: return bogus but useful data to statfs call
authorrobk-tahoe <robk-tahoe@allmydata.com>
Wed, 7 May 2008 23:40:09 +0000 (16:40 -0700)
committerrobk-tahoe <robk-tahoe@allmydata.com>
Wed, 7 May 2008 23:40:09 +0000 (16:40 -0700)
previously tahoefuse returned the fs stat for the filesystem the fuse plugin
was running upon (e.g. '/').  this works ok until you need to copy more to
tahoe than the local machine has free disk space, at which point Finder will
refuse to copy 'too much' data.

this changes it so that tahoe always reports 2TiB used of an 8TiB filesystem
this is entirely bogus, but allows copies of up to 2TiB to be initiated.

mac/tahoefuse.py

index fe97577cc1ca86a8d4ad2549a7a5145382f6ca14..5fce5d442b7ec20c300f3e1e426fbcb83b59b906 100644 (file)
@@ -329,7 +329,22 @@ class TahoeFuse(fuse.Fuse):
             - f_ffree - nunber of free file inodes
         """
 
-        return os.statvfs(".")
+        block_size = 4096 # 4k
+        preferred_block_size = 131072 # 128k, c.f. seg_size
+        fs_size = 8*2**40 # 8Tb
+        fs_free = 2*2**40 # 2Tb
+
+        s = fuse.StatVfs(f_bsize = preferred_block_size,
+                         f_frsize = block_size,
+                         f_blocks = fs_size / block_size,
+                         f_bfree = fs_free / block_size,
+                         f_bavail = fs_free / block_size,
+                         f_files = 2**30, # total files
+                         f_ffree = 2**20, # available files
+                         f_favail = 2**20, # available files (root)
+                         f_flag = 2, # no suid
+                         f_namemax = 255) # max name length
+        return s
 
     def fsinit(self):
         self.log("fsinit()")