aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2009-07-23 21:52:44 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2009-07-23 21:52:44 (GMT)
commited2e6b90331ad530fe213ef9113cc128b375f54b (patch)
tree3e771f7e4d1407d8e054ec120849091786f2051f
parent2177ea8b15f3c0bbe5c5acb5739bd42cfb365b7a (diff)
downloadfusearchive-ed2e6b90331ad530fe213ef9113cc128b375f54b.zip
fusearchive-ed2e6b90331ad530fe213ef9113cc128b375f54b.tar.gz
fusearchive-ed2e6b90331ad530fe213ef9113cc128b375f54b.tar.bz2
Get rid of some unused functions
-rwxr-xr-xfusearchive.py66
1 files changed, 0 insertions, 66 deletions
diff --git a/fusearchive.py b/fusearchive.py
index ea2d99e..f97911b 100755
--- a/fusearchive.py
+++ b/fusearchive.py
@@ -32,15 +32,6 @@ def dmsg(level,message):
if level <= debug_level:
print str(level) + ": " + str(message)
-def flag2mode(flags):
- md = {os.O_RDONLY: 'r', os.O_WRONLY: 'w', os.O_RDWR: 'w+'}
- m = md[flags & (os.O_RDONLY | os.O_WRONLY | os.O_RDWR)]
-
- if flags | os.O_APPEND:
- m = m.replace('w', 'a', 1)
-
- return m
-
# This will write out a data block, it will return a key that can get this
# data back later
def save_chunk( chunk ):
@@ -129,63 +120,6 @@ def load_chunk( key ):
return chunk
-# Inflate a file, src is a packed file, dest is where the unpacked file
-# should go
-# we assume our chunks are in storage/
-def inflate( src, dest ):
- dmsg( 1, "inflate!" )
-
- out = open( dest, "w" )
-
- dmsg( 3, "Unpickling: " + src )
- # TODO: return an IO error if inflating fails
- inp = gzip.open( src, "r" )
- magic = pickle.load( inp )
- inp.close()
- dmsg( 3, "Got data: " + str( magic ) )
-
- #pdb.set_trace()
-
- # Now unserialize the chunks back in to a file
- for key in magic[ 'data' ]:
- out.write( load_chunk( key ) )
-
- dmsg( 2, "File inflated" )
- out.close()
-
-# TODO: deflate only if the file has been modified
-
-# Deflate a file, src is the unpacked file, dest is where we want to pack
-# to, and we assume storage/ is where chunks are stored
-def deflate( src, dest ):
- dmsg( 2, "deflate!" )
- inp = open( src, "r" )
-
- hashs = []
- # This is retarded:
- # http://groups.google.com/group/comp.lang.python/browse_thread/thread/ed25388487b3ac7b
- #
- # Why can't I just do:
- # while( chunk = inp.read( magic_blocksize ) ):
- # I though python was supposed to be easier! :(
-
- while True:
- chunk = inp.read( magic_blocksize )
- if len( chunk ) == 0:
- break
-
- key = save_chunk( chunk )
- hashs.append( key )
-
- inp.close()
-
- out = gzip.open( dest, "w" )
- pickle.dump( {
- 'stat': os.stat( src ),
- 'data': hashs
- }, out )
- out.close()
-
class FuseArchiveStat(fuse.Stat):
def __init__(self, stat):
self.st_mode = stat.st_mode