本文整理汇总了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
示例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
示例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
示例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