Python fuse.Direntry() Examples

The following are 8 code examples of fuse.Direntry(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module fuse , or try the search function .
Example #1
Source File: address_space_fuse.py    From rekall with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #2
Source File: main.py    From spreadsheetfs with MIT License 5 votes vote down vote up
def readdir(self, path, offset):
        for item in top_level_dir.contents:
            yield fuse.Direntry(item.name) 
Example #3
Source File: fuse-cmd.py    From honeything with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #4
Source File: dedupfs.py    From tgcloud with Apache License 2.0 5 votes vote down vote up
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) 
Example #5
Source File: accessfs.py    From allura with Apache License 2.0 5 votes vote down vote up
def readdir(self, path, offset):
        print('Readdir!')
        for e in os.listdir("." + path):
            yield fuse.Direntry(e) 
Example #6
Source File: dlna_fuse.py    From dlna_live_streaming with GNU General Public License v2.0 5 votes vote down vote up
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) 
Example #7
Source File: pcachefs.py    From pcachefs with Apache License 2.0 5 votes vote down vote up
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) 
Example #8
Source File: vfs.py    From pcachefs with Apache License 2.0 5 votes vote down vote up
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)