Example #1
0
 def __init__(self):
     super(PyFS, self).__init__()
     self._next_fh = count()
     self._flags_for_open_files = {}  # file handle -> fh
     for name in ("json", "os", "sys"):
         add_module(name)
     self._log = logging.getLogger(self.__class__.__name__)
Example #2
0
 def write(self, buf, offset):
     if not self.append and offset != 0:
         log.debug("Must either append to or truncate a file.")
         raise IOError(-errno.EPERM)
     if buf.strip():
         add_module(buf.strip())
     return len(buf)
Example #3
0
 def write(self, path, data, offset, fh):
     if fh not in self._flags_for_open_files:
         # EBADFD = "File descriptor in bad state" (not sure it's correct)
         raise fuse.FuseOSError(errno.EBADFD)
     if not self._flags_for_open_files[fh] & os.O_APPEND and offset != 0:
         self._log.debug("Must either append to or truncate a file.")
         raise fuse.FuseOSError(-errno.EPERM)
     if data.strip():
         add_module(data.strip())
     return len(data)
Example #4
0
 def __init__(self):
     super(PyFS, self).__init__(dash_s_do='setsingle')
     for name in ("json", "os", "sys"):
         add_module(name)