当前位置: 首页>>代码示例>>Python>>正文


Python Fuse.main方法代码示例

本文整理汇总了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)
开发者ID:OpenXT-Extras,项目名称:xenaccess,代码行数:9,代码来源:pyxafs.py

示例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)
开发者ID:AndrewX192,项目名称:libvmi,代码行数:9,代码来源:pyvmifs.py

示例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)
开发者ID:dsturnbull,项目名称:unfs,代码行数:9,代码来源:unfs.py

示例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)
开发者ID:google,项目名称:rekall,代码行数:37,代码来源:address_space_fuse.py

示例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
开发者ID:lebauce,项目名称:tsumufs,代码行数:58,代码来源:fusethread.py

示例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)
开发者ID:LeonB,项目名称:gstreamerfs,代码行数:13,代码来源:FS.py

示例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)
开发者ID:danmilburn,项目名称:pytsk,代码行数:15,代码来源:tskfuse.py

示例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)
开发者ID:drseergio,项目名称:photofs,代码行数:16,代码来源:photofs_main.py

示例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)
开发者ID:peter-x,项目名称:zfec_fs,代码行数:16,代码来源:zfec_fs.py

示例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)
开发者ID:CarbonWolf,项目名称:aff4,代码行数:18,代码来源:tskfuse.py

示例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)
开发者ID:derVedro,项目名称:MusicDir,代码行数:6,代码来源:mountfs.py

示例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)
开发者ID:mtboswell,项目名称:dhtfs,代码行数:87,代码来源:Dhtfs.py

示例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)
开发者ID:erdavila,项目名称:gitviewfs,代码行数:7,代码来源:gitviewfs.py

示例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)
开发者ID:anarchivist,项目名称:pyflag,代码行数:6,代码来源:pyflag_fuse.py

示例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)
开发者ID:kamwoods,项目名称:bitcurator-fim,代码行数:7,代码来源:imgfuse.py


注:本文中的fuse.Fuse.main方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。