예제 #1
0
파일: all.py 프로젝트: darkfeline/dbooru
 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
예제 #2
0
 def statfs(self):
     return do_os(os.statvfs, self._root)
예제 #3
0
 def release(self):
     do_os(os.close, self.fh)
예제 #4
0
 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)
예제 #5
0
 def read(self, off, size):
     return do_os(os.pread, self.fh, size, off)
예제 #6
0
 def fsync(self, datasync):
     if datasync:
         do_os(os.fdatasync, self.fh)
     else:
         do_os(os.fsync, self.fh)
예제 #7
0
 def write(self, off, buf):
     return do_os(os.pwrite, self.fh, buf, off)