def _make_attr(self): statvfs = do_os(os.statvfs, self._root) now = time.time() attr = llfuse.EntryAttributes() # pylint: disable=no-member attr.st_ino = llfuse.ROOT_INODE attr.generation = 0 # used if inodes change after restart attr.entry_timeout = 300 attr.attr_timeout = 300 attr.st_mode = 0o777 | stat.S_IFDIR attr.st_nlink = 1 # Fix for subdirectories? attr.st_uid = do_os(os.getpid) attr.st_gid = do_os(os.getgid) attr.st_size = 4096 attr.st_blksize = statvfs.f_bsize attr.st_blocks = 1 attr.st_atime = now attr.st_ctime = now attr.st_mtime = now return attr
def statfs(self): return do_os(os.statvfs, self._root)
def release(self): do_os(os.close, self.fh)
def readdir(self, off): names = do_os(llfuse.listdir, self.fh) # pylint: disable=no-member while off < len(names): name = names[off] off += 1 yield (name.encode(), do_os(os.stat, name, dir_fd=self.fh), off)
def read(self, off, size): return do_os(os.pread, self.fh, size, off)
def fsync(self, datasync): if datasync: do_os(os.fdatasync, self.fh) else: do_os(os.fsync, self.fh)
def write(self, off, buf): return do_os(os.pwrite, self.fh, buf, off)