From e61e7db8dacb520adce7d3b7e8ba6c7e4f6bce6a Mon Sep 17 00:00:00 2001 From: Steve Slaven Date: Thu, 23 Jul 2009 13:53:23 -0700 Subject: Added some warnings and removed some ; diff --git a/fusearchive.py b/fusearchive.py index 92717cf..2b06e0e 100755 --- a/fusearchive.py +++ b/fusearchive.py @@ -55,13 +55,13 @@ def save_chunk( chunk ): # We make the hexdigest here, yeah we could just call hexdigest() # but we need to essentially do this same thing to reassemble the # file anyway - hexdigest = ''.join( [ "%02x" % ord( x ) for x in chars ] ); + hexdigest = ''.join( [ "%02x" % ord( x ) for x in chars ] ) # Subparts just needs the first N chars subparts = [ "%02x" % ord( x ) for x in chars[ :magic_depth ] ] dmsg( 4, subparts ) - subpath = '/'.join( subparts ); + subpath = '/'.join( subparts ) dmsg( 3, "Subpath: " + subpath ) # Make sure this sub path exists @@ -109,13 +109,13 @@ def load_chunk( key ): dmsg( 4, chars ) # Todo: make a digest -> path function to share with deflate - hexdigest = ''.join( [ "%02x" % ord( x ) for x in chars ] ); + hexdigest = ''.join( [ "%02x" % ord( x ) for x in chars ] ) dmsg( 3, "Hash is: " + hash + " sub " + seq ) subparts = [ "%02x" % ord( x ) for x in chars[ :magic_depth ] ] - subpath = '/'.join( subparts ); + subpath = '/'.join( subparts ) dmsg( 3, "Subpath: " + subpath ) - subpath += "/" + hexdigest + "_" + str( seq ); + subpath += "/" + hexdigest + "_" + str( seq ) dmsg( 3, "Chunk path: " + subpath ) @@ -161,7 +161,7 @@ def deflate( src, dest ): dmsg( 2, "deflate!" ) inp = open( src, "r" ) - hashs = []; + hashs = [] # This is retarded: # http://groups.google.com/group/comp.lang.python/browse_thread/thread/ed25388487b3ac7b # @@ -339,7 +339,7 @@ class FuseArchive(Fuse): def __init__(self, path, flags, *mode): # Inflate the file dmsg( 1, "Init file: " + path ) - self.orig_path = path; + self.orig_path = path # init rw and offset self.offset = 0 @@ -386,6 +386,7 @@ class FuseArchive(Fuse): self.direct_io = False self.keep_cache = False + pdb.set_trace() dmsg( 3, str(self) + " init complete" ) def _load_chunk( self, index ): @@ -480,6 +481,8 @@ class FuseArchive(Fuse): }, out ) out.close() + return 1 + # Currently we treat fsync as flush since we don't keep any data # hanging around anyway in fh stuff @@ -500,13 +503,13 @@ class FuseArchive(Fuse): return os.lstat( "./tree" + self.orig_path ) def ftruncate(self, len): + if len > 0: + print "WARNING: ftruncate is broken!!!" + self.chunks = [] self._load_chunk( 0 ) self._fflush() - if len > 0: - print "WARNING: ftruncate is broken!!!" - def lock(self, cmd, owner, **kw): dmsg( 3, "WARNING: locking unsupported" ) return -- cgit v0.10.2