本文整理汇总了Python中fuse.Direntry方法的典型用法代码示例。如果您正苦于以下问题:Python fuse.Direntry方法的具体用法?Python fuse.Direntry怎么用?Python fuse.Direntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fuse
的用法示例。
在下文中一共展示了fuse.Direntry方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: readdir
# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Direntry [as 别名]
def readdir(self, path, offset):
if path == "/":
for pid in self.tasks:
result = fuse.Direntry(str(pid))
result.type = stat.S_IFREG
result.st_size = self.address_space_size
yield result
示例2: readdir
# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Direntry [as 别名]
def readdir(self, path, offset):
for item in top_level_dir.contents:
yield fuse.Direntry(item.name)
示例3: readdir
# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Direntry [as 别名]
def readdir(self, path, offset):
log('--readdir(%r)\n' % path)
node = cache_get(self.top, path)
yield fuse.Direntry('.')
yield fuse.Direntry('..')
for sub in node.subs():
yield fuse.Direntry(sub.name)
示例4: readdir
# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Direntry [as 别名]
def readdir(self, path, offset): # {{{3
# Bug fix: When you use the -o use_ino option, directory entries must have
# an "ino" field, otherwise not a single directory entry will be listed!
try:
self.__log_call('readdir', 'readdir(%r, %i)', path, offset)
node_id, inode = self.__path2keys(path)
yield fuse.Direntry('.', ino=inode)
yield fuse.Direntry('..')
query = "SELECT t.inode, s.value FROM tree t, strings s WHERE t.parent_id = ? AND t.name = s.id"
for inode, name in self.conn.execute(query, (node_id,)).fetchall():
yield fuse.Direntry(str(name), ino=inode)
except Exception, e:
self.__except_to_status('readdir', e)
示例5: readdir
# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Direntry [as 别名]
def readdir(self, path, offset):
print('Readdir!')
for e in os.listdir("." + path):
yield fuse.Direntry(e)
示例6: readdir
# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Direntry [as 别名]
def readdir(self, path, offset):
print "readdir", path, offset
dirents = [".", ".."]
if path == "/":
dirents.extend(["a", "b", "c"])
else:
dirents.extend(["fuse_live.mkv"])
for r in dirents:
yield fuse.Direntry(r)
示例7: readdir
# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Direntry [as 别名]
def readdir(self, path, offset):
debug('UnderlyingFs.readdir', path, offset)
real_path = self._get_real_path(path)
dirents = []
if os.path.isdir(real_path):
dirents.extend([ '.', '..' ])
dirents.extend(os.listdir(real_path))
# return a generator over the entries in the directory
return (fuse.Direntry(r) for r in dirents)
示例8: readdir
# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Direntry [as 别名]
def readdir(self, path, offset):
debug('VirtualFS.readdir', path, offset)
virtual_path = self.get_relative_path(path)
if virtual_path is not None:
is_file = stat.S_ISREG(self.cacher.getattr(os.sep + virtual_path).st_mode)
if is_file:
yield fuse.Direntry('cached')
else:
for f in self.cacher.readdir(os.sep + virtual_path, offset):
yield fuse.Direntry(f.name)
yield None
if path == '/':
yield fuse.Direntry(self.root)