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


Python fuse.Stat方法代码示例

本文整理汇总了Python中fuse.Stat方法的典型用法代码示例。如果您正苦于以下问题:Python fuse.Stat方法的具体用法?Python fuse.Stat怎么用?Python fuse.Stat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fuse的用法示例。


在下文中一共展示了fuse.Stat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_stat

# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Stat [as 别名]
def make_stat(pid):
    """ Return a stat structure from TSK metadata struct """

    s = fuse.Stat()
    try:
        s.st_ino = int(pid)
    except ValueError:
        s.st_ino = 0

    s.st_dev = 0
    s.st_nlink = 1
    s.st_uid = 0
    s.st_gid = 0
    s.st_size = 1
    s.st_atime = 0
    s.st_mtime = 0
    s.st_ctime = 0
    s.st_blocks = 2
    s.st_rdev = 0

    return s 
开发者ID:google,项目名称:rekall,代码行数:23,代码来源:address_space_fuse.py

示例2: __init__

# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Stat [as 别名]
def __init__(self, st):
        fuse.Stat.__init__(self)

        self.st_mode = st.st_mode
        self.st_nlink = st.st_nlink
        self.st_size = st.st_size
        self.st_atime = st.st_atime
        self.st_mtime = st.st_mtime
        self.st_ctime = st.st_ctime

        self.st_dev = st.st_dev
        self.st_gid = st.st_gid
        self.st_ino = st.st_ino
        self.st_uid = st.st_uid

        self.st_rdev = st.st_rdev
        self.st_blksize = st.st_blksize 
开发者ID:ibizaman,项目名称:pcachefs,代码行数:19,代码来源:pcachefs.py

示例3: getattr

# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Stat [as 别名]
def getattr(self, path):
        log('--getattr(%r)\n' % path)
        try:
            node = cache_get(self.top, path)
            st = Stat()
            st.st_mode = node.mode
            st.st_nlink = node.nlinks()
            st.st_size = node.size()
            st.st_mtime = node.mtime
            st.st_ctime = node.ctime
            st.st_atime = node.atime
            return st
        except vfs.NoSuchFile:
            return -errno.ENOENT 
开发者ID:omererdem,项目名称:honeything,代码行数:16,代码来源:fuse-cmd.py

示例4: fake_stat

# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Stat [as 别名]
def fake_stat(virtual_file):
    """Create fuse stat from file."""
    if virtual_file is None:
        return E_NO_SUCH_FILE

    result = fuse.Stat()

    if virtual_file.is_read_only():
        result.st_mode = stat.S_IFREG | 0o444
    else:
        result.st_mode = stat.S_IFREG | 0o644

    # Always 1 for now (seems to be safe for files and dirs)
    result.st_nlink = 1

    result.st_size = virtual_file.size()

    # Must return seconds-since-epoch timestamps
    result.st_atime = virtual_file.atime()
    result.st_mtime = virtual_file.mtime()
    result.st_ctime = virtual_file.ctime()

    # You can set these to anything, they're set by FUSE
    result.st_dev = 1
    result.st_ino = 1

    # GetContext() returns uid/gid of the process that
    # initiated the syscall currently being handled
    context = fuse.FuseGetContext()
    if virtual_file.uid() is None:
        result.st_uid = context['uid']
    else:
        result.st_uid = virtual_file.uid()

    if virtual_file.gid() is None:
        result.st_gid = context['gid']
    else:
        result.st_gid = virtual_file.gid()

    return result 
开发者ID:ibizaman,项目名称:pcachefs,代码行数:42,代码来源:vfs.py


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