Beispiel #1
0
 def _load_posix1e_acl_rec(self, port):
     if not posix1e: return
     data = vint.read_bvec(port)
     acl_reps = vint.unpack('ssss', data)
     if acl_reps[2] == '':
         acl_reps = acl_reps[:2]
     self.posix1e_acl = [posix1e.ACL(text=x) for x in acl_reps]
Beispiel #2
0
 def _load_common_rec(self, port, version=3):
     if version == 3:
         # Added trailing size to v2, negative when None.
         unpack_fmt = 'vvsvsvvVvVvVv'
     elif version == 2:
         unpack_fmt = 'vvsvsvvVvVvV'
     elif version == 1:
         unpack_fmt = 'VVsVsVvVvVvV'
     else:
         raise Exception('unexpected common_rec version %d' % version)
     data = vint.read_bvec(port)
     values = vint.unpack(unpack_fmt, data)
     if version == 3:
         (self.mode, self.uid, self.user, self.gid, self.group,
          self.rdev,
          self.atime, atime_ns,
          self.mtime, mtime_ns,
          self.ctime, ctime_ns, size) = values
         if size >= 0:
             self.size = size
     else:
         (self.mode, self.uid, self.user, self.gid, self.group,
          self.rdev,
          self.atime, atime_ns,
          self.mtime, mtime_ns,
          self.ctime, ctime_ns) = values
     self.atime = xstat.timespec_to_nsecs((self.atime, atime_ns))
     self.mtime = xstat.timespec_to_nsecs((self.mtime, mtime_ns))
     self.ctime = xstat.timespec_to_nsecs((self.ctime, ctime_ns))
Beispiel #3
0
 def _load_common_rec(self, port):
     data = vint.read_bvec(port)
     (self.mode, self.uid, self.user, self.gid, self.group, self.rdev,
      self.atime, atime_ns, self.mtime, mtime_ns, self.ctime,
      ctime_ns) = vint.unpack('VVsVsVvVvVvV', data)
     self.atime = xstat.timespec_to_nsecs((self.atime, atime_ns))
     self.mtime = xstat.timespec_to_nsecs((self.mtime, mtime_ns))
     self.ctime = xstat.timespec_to_nsecs((self.ctime, ctime_ns))
Beispiel #4
0
 def _load_common_rec(self, port):
     data = vint.read_bvec(port)
     (self.mode, self.uid, self.owner, self.gid, self.group, self.rdev,
      self.atime, atime_ns, self.mtime, mtime_ns, self.ctime,
      ctime_ns) = vint.unpack('VVsVsVvVvVvV', data)
     self.atime = FSTime.from_timespec((self.atime, atime_ns))
     self.mtime = FSTime.from_timespec((self.mtime, mtime_ns))
     self.ctime = FSTime.from_timespec((self.ctime, ctime_ns))
Beispiel #5
0
 def _load_common_rec(self, port, legacy_format=False):
     unpack_fmt = 'vvsvsvvVvVvV'
     if legacy_format:
         unpack_fmt = 'VVsVsVvVvVvV'
     data = vint.read_bvec(port)
     (self.mode, self.uid, self.user, self.gid, self.group, self.rdev,
      self.atime, atime_ns, self.mtime, mtime_ns, self.ctime,
      ctime_ns) = vint.unpack(unpack_fmt, data)
     self.atime = xstat.timespec_to_nsecs((self.atime, atime_ns))
     self.mtime = xstat.timespec_to_nsecs((self.mtime, mtime_ns))
     self.ctime = xstat.timespec_to_nsecs((self.ctime, ctime_ns))
Beispiel #6
0
 def _load_common_rec(self, port):
     data = vint.read_bvec(port)
     (self.mode,
      self.uid,
      self.owner,
      self.gid,
      self.group,
      self.rdev,
      self.atime,
      atime_ns,
      self.mtime,
      mtime_ns,
      self.ctime,
      ctime_ns) = vint.unpack('VVsVsVvVvVvV', data)
     self.atime = FSTime.from_timespec((self.atime, atime_ns))
     self.mtime = FSTime.from_timespec((self.mtime, mtime_ns))
     self.ctime = FSTime.from_timespec((self.ctime, ctime_ns))
Beispiel #7
0
 def _load_common_rec(self, port):
     data = vint.read_bvec(port)
     (self.mode,
      self.uid,
      self.user,
      self.gid,
      self.group,
      self.rdev,
      self.atime,
      atime_ns,
      self.mtime,
      mtime_ns,
      self.ctime,
      ctime_ns) = vint.unpack('VVsVsVvVvVvV', data)
     self.atime = xstat.timespec_to_nsecs((self.atime, atime_ns))
     self.mtime = xstat.timespec_to_nsecs((self.mtime, mtime_ns))
     self.ctime = xstat.timespec_to_nsecs((self.ctime, ctime_ns))
Beispiel #8
0
 def path_info(self, paths):
     self.check_busy()
     self.conn.write('path-info\n')
     if not isinstance(paths, list):  # FIXME: check for "not oneshot".
         paths = list(paths)
     vint.write_vuint(self.conn, len(paths))
     for path in paths:
         vint.write_bvec(self.conn, path)
     result = []
     for path in paths:
         data = vint.read_bvec(self.conn)
         if data:
             result.append(vint.unpack('sss', data))
         else:
             result.append(None)
     self.check_ok()
     return result
Beispiel #9
0
 def _load_common_rec(self, port, legacy_format=False):
     unpack_fmt = 'vvsvsvvVvVvV'
     if legacy_format:
         unpack_fmt = 'VVsVsVvVvVvV'
     data = vint.read_bvec(port)
     (self.mode,
      self.uid,
      self.user,
      self.gid,
      self.group,
      self.rdev,
      self.atime,
      atime_ns,
      self.mtime,
      mtime_ns,
      self.ctime,
      ctime_ns) = vint.unpack(unpack_fmt, data)
     self.atime = xstat.timespec_to_nsecs((self.atime, atime_ns))
     self.mtime = xstat.timespec_to_nsecs((self.mtime, mtime_ns))
     self.ctime = xstat.timespec_to_nsecs((self.ctime, ctime_ns))
Beispiel #10
0
 def _load_posix1e_acl_rec(self, port):
     acl_rep = vint.unpack("ssss", vint.read_bvec(port))
     if acl_rep[2] == "":
         acl_rep = acl_rep[:2]
     self.posix1e_acl = acl_rep
Beispiel #11
0
 def _load_path_rec(self, port):
     self.path = vint.unpack("s", vint.read_bvec(port))[0]
Beispiel #12
0
 def _load_linux_attr_rec(self, port):
     data = vint.read_bvec(port)
     self.linux_attr = vint.unpack('V', data)[0]
Beispiel #13
0
 def _load_posix1e_acl_rec(self, port):
     acl_rep = vint.unpack('ssss', vint.read_bvec(port))
     if acl_rep[2] == b'':
         acl_rep = acl_rep[:2]
     self.posix1e_acl = acl_rep
Beispiel #14
0
 def _load_path_rec(self, port):
     self.path = vint.unpack('s', vint.read_bvec(port))[0]
Beispiel #15
0
def pack_and_unpack(types, *values):
    data = vint.pack(types, *values)
    return vint.unpack(types, data)
Beispiel #16
0
 def _load_posix1e_acl_rec(self, port):
     data = vint.read_bvec(port)
     acl_reps = vint.unpack("ssss", data)
     if acl_reps[2] == "":
         acl_reps = acl_reps[:2]
     self.posix1e_acl = [posix1e.ACL(text=x) for x in acl_reps]
Beispiel #17
0
 def _load_linux_attr_rec(self, port):
     data = vint.read_bvec(port)
     self.linux_attr = vint.unpack("V", data)[0]
Beispiel #18
0
 def _load_posix1e_acl_rec(self, port):
     data = vint.read_bvec(port)
     acl_reps = vint.unpack('ssss', data)
     if acl_reps[2] == '':
         acl_reps = acl_reps[:2]
     self.posix1e_acl = [posix1e.ACL(text=x) for x in acl_reps]
Beispiel #19
0
def pack_and_unpack(types, *values):
    data = vint.pack(types, *values)
    return vint.unpack(types, data)