本文整理汇总了Python中fuse.Fuse.main方法的典型用法代码示例。如果您正苦于以下问题:Python Fuse.main方法的具体用法?Python Fuse.main怎么用?Python Fuse.main使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fuse.Fuse
的用法示例。
在下文中一共展示了Fuse.main方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from fuse import Fuse [as 别名]
# 或者: from fuse.Fuse import main [as 别名]
def main(self, *a, **kw):
# Setup physical memory
if hasattr(self, "domain"):
self.xai = pyxa_instance(self.domain)
else:
self.parser.error("PyXaFS: must provide a Xen domain to mount")
Fuse.main(self, *a, **kw)
示例2: main
# 需要导入模块: from fuse import Fuse [as 别名]
# 或者: from fuse.Fuse import main [as 别名]
def main(self, *a, **kw):
# Setup physical memory
if hasattr(self, "domain"):
self.vm = pyvmi.init(self.domain, "partial")
else:
self.parser.error("PyVmiFS: must provide a Xen domain to mount")
Fuse.main(self, *a, **kw)
示例3: main
# 需要导入模块: from fuse import Fuse [as 别名]
# 或者: from fuse.Fuse import main [as 别名]
def main(self, *a, **kw):
"""
Main entry point. Mounts filesystem and daemonizes.
"""
self.file_class = self.UnfsFile
return Fuse.main(self, *a, **kw)
示例4: main
# 需要导入模块: from fuse import Fuse [as 别名]
# 或者: from fuse.Fuse import main [as 别名]
def main(self):
options, args = self.parser.parse_args()
if not args:
print("No image file specied.")
return
self.session = session.Session(
filename=args[0], logging=2, profile=options.profile)
# List all processes and hold on to their address spaces.
self.tasks = {}
for task in self.session.plugins.pslist(session=self.session).list_eprocess():
address_space = task.get_process_address_space()
process_name = u"%s_%s" % (task.UniqueProcessId, task.ImageFileName)
# Remove funky chars from the filename
process_name = re.sub("[^a-zA-Z0-9._]", "_", process_name)
if address_space:
self.tasks[process_name] = address_space
# Make a special entry for the kernel here.
self.tasks['kernel'] = self.session.kernel_address_space
## Prepare the file class - this will be used to read specific
## files:
self.file_class = self.ASFuseFile
self.file_class.fs = self
if self.session.profile.metadata("memory_model") == "64bit":
self.address_space_size = 0xfffffffffffffff
else:
self.address_space_size = 0xffffffff
return Fuse.main(self)
示例5: main
# 需要导入模块: from fuse import Fuse [as 别名]
# 或者: from fuse.Fuse import main [as 别名]
def main(self, args=None):
'''
Mainline of the FUSE client filesystem. This directly overrides
the Fuse.main() method to allow us to manually shutdown things
after the FUSE event loop has finished.
'''
class FuseFileWrapper(tsumufs.FuseFile):
'''
Inner class to wrap the FuseFile class with the reference to this thread,
allowing us to get at the GetContext() call. Essentially we're creating a
closure here. Ugly, but it's the only way to get the uid and gid into the
FuseFile thread.
Idea borrowed directly from Robie Basak in his email to fuse-dev, which is
visible at <http://www.nabble.com/Python%3A-Pass-parameters-to-file_class-to18301066.html#a20066429>.
'''
def __new__(cls, path, *args, **kwargs):
kwargs.update(self.GetContext())
klass = tsumufs.getManager(path).getFileClass(path) or tsumufs.FuseFile
return klass(path, *args, **kwargs)
def __init__(self2, *args, **kwargs):
kwargs.update(self.GetContext())
tsumufs.FuseFile.__init__(self2, *args, **kwargs)
self.file_class = FuseFileWrapper
self._debug('Trying fsinit()')
if self.fsinit():
result = Fuse.main(self, args)
self._debug('Fuse main event loop exite')
self._debug('Setting event and condition states.')
tsumufs.unmounted.set()
self._debug('Waiting for the sync thread to finish.')
self._syncThread.join()
self._debug('Shutdown complete.')
self._debug("---BEGIN-GEN-BENCHMARK-REPORT---")
metrics=""
for key in tsumufs.metrics._metrics.keys():
self._debug(" %s: %s " % (str(key) , str(tsumufs.metrics._metrics[key])))
self._debug("---END-GEN-BENCHMARK-REPORT---")
else:
self._debug('fsinit() failed...')
result = False
return result
示例6: main
# 需要导入模块: from fuse import Fuse [as 别名]
# 或者: from fuse.Fuse import main [as 别名]
def main(self, *args, **kwargs):
fuse = self
class FileClass(GstreamerFS.File):
def __init__(self, *args, **kwargs):
syslog.syslog('fuse: %s' % fuse)
syslog.syslog('self: %s' % self)
GstreamerFS.File.__init__(self, fuse, *args, **kwargs)
self.file_class = FileClass
return Fuse.main(self, *args, **kwargs)
示例7: main
# 需要导入模块: from fuse import Fuse [as 别名]
# 或者: from fuse.Fuse import main [as 别名]
def main(self):
options, args = self.parser.parse_args()
self.img = images.SelectImage(options.type, args)
self.offset = parse_int(options.offset)
self.fs = pytsk3.FS_Info(self.img, offset = self.offset)
## Prepare the file class - this will be used to read specific
## files:
self.file_class = self.TSKFuseFile
self.file_class.fs = self.fs
return Fuse.main(self)
示例8: main
# 需要导入模块: from fuse import Fuse [as 别名]
# 或者: from fuse.Fuse import main [as 别名]
def main(self, *a, **kw):
if not self.fuse_args.getmod('showhelp'):
self._validate_args()
self.db = PhotoDb(self.root)
self.views = GetViews(self.db)
if self.db.TryLock():
logging.info('Acquired database lock, will write/update it')
else:
logging.error(('Failed to acquire database lock, '
'another instance is already running'))
sys.exit(0)
return Fuse.main(self, *a, **kw)
示例9: main
# 需要导入模块: from fuse import Fuse [as 别名]
# 或者: from fuse.Fuse import main [as 别名]
def main(self, *a, **kw):
self.restore = int(self.restore) != 0
self.shares = int(self.shares)
self.required = int(self.required)
assert self.required >= 1
assert self.required <= self.shares
if self.restore:
self.file_class = self.ZfecRestoreFile
self.decoder = zfec.Decoder(self.required, self.shares)
else:
self.file_class = self.ZfecFile
self.encoder = zfec.Encoder(self.required, self.shares)
return Fuse.main(self, *a, **kw)
示例10: main
# 需要导入模块: from fuse import Fuse [as 别名]
# 或者: from fuse.Fuse import main [as 别名]
def main(self):
self.offset = parse_int(self.offset)
args = self.cmdline[1]
if len(args) != 1:
raise RuntimeError( "You must specify a single image name to load - try -h for help ")
print "Opening filesystem in %s" % args[0]
self.img = Img_Info(args[0])
self.fs = pytsk3.FS_Info(self.img, offset = self.offset)
## Prepare the file class - this will be used to read specific
## files:
self.file_class = self.TSKFuseFile
self.file_class.fs = self.fs
return Fuse.main(self)
示例11: main
# 需要导入模块: from fuse import Fuse [as 别名]
# 或者: from fuse.Fuse import main [as 别名]
def main(self, *a, **kw):
self.file_class = self.MusicFSFile
return Fuse.main(self, *a, **kw)
示例12: main
# 需要导入模块: from fuse import Fuse [as 别名]
# 或者: from fuse.Fuse import main [as 别名]
def main(self, *a, **kw):
# Define the file class locally as that seems to be the easiest way to
# inject instance specific data into it...
server = self
if server.fuse_args.mount_expected():
server.__initialize()
class DhtfsFile(object):
def __init__(self, path, flags, *mode):
# set logger
self.logger = server.logger
self.logger.info("###### Initiating file object In function : %s" % sys._getframe().f_code.co_name)
# set the dirs which are associated with this file
self.dirs = [x for x in os.path.dirname(path).split(os.path.sep) if x != '']
# Get actual path for the specified path
actualPath = server.getActualPath(path)
newCreated = False
if os.path.basename(actualPath) == Dhtfs.MISSING_FILE:
# File is not yet created. Create file
self.logger.info("Actual path missing")
actualPath = server.generateNewFileName()
newCreated = True
if path in server.fileCache:
self.logger.info("CACHE: Remove entry for path %s" % path)
del server.fileCache[path]
self.file = os.fdopen(os.open(os.path.join(server.root, actualPath), flags, *mode),
flag2mode(flags))
self.fd = self.file.fileno()
filename = os.path.basename(path)
self.fi = TagFile(actualPath, filename)
if newCreated:
self.logger.info("Adding tags %s, to file %s" %(self.dirs, self.fi))
# Add tag information for the newly created file
server.tagdir.addDirsToFiles([self.fi], self.dirs)
def read(self, length, offset):
self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
self.file.seek(offset)
return self.file.read(length)
def write(self, buf, offset):
self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
self.file.seek(offset)
self.file.write(buf)
return len(buf)
def release(self, flags):
self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
self.file.close()
def fsync(self, isfsyncfile):
self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
if isfsyncfile and hasattr(os, 'fdatasync'):
os.fdatasync(self.fd)
else:
os.fsync(self.fd)
def flush(self):
self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
self.file.flush()
# cf. xmp_flush() in fusexmp_fh.c
os.close(os.dup(self.fd))
def fgetattr(self):
self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
return os.fstat(self.fd)
def ftruncate(self, len):
self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
self.file.truncate(len)
self.file_class = DhtfsFile
return Fuse.main(self, *a, **kw)
示例13: main
# 需要导入模块: from fuse import Fuse [as 别名]
# 或者: from fuse.Fuse import main [as 别名]
def main(self, *a, **kw):
dir_struct_module = importlib.import_module('dir_structure.' + self.struct)
self.dir_struct = dir_struct_module.get_dir_structure()
self.file_class = self.get_file_class(self.dir_struct)
return Fuse.main(self, *a, **kw)
示例14: main
# 需要导入模块: from fuse import Fuse [as 别名]
# 或者: from fuse.Fuse import main [as 别名]
def main(self, *a, **kw):
self.file_class = self.PyFlagVFSFile
return Fuse.main(self, *a, **kw)
示例15: main
# 需要导入模块: from fuse import Fuse [as 别名]
# 或者: from fuse.Fuse import main [as 别名]
def main(self):
options, args = self.parser.parse_args()
self.fd = images.SelectImage(options.type, args)
return Fuse.main(self)