Lines Matching +full:pkt +full:- +full:size

4 handle plan9 server <-> client connections
35 # namedtuple so that we can create instances with all-None
38 'ino mode uid gid nlink rdev size blksize blocks '
53 from the Rerror reply, or from converting the errno in a dot-L
54 or dot-u Rerror reply. The error number may be None if the
56 None or empty string if a non-None errno supplies the error
74 if self.errno: # check for "is not None", or just non-false-y?
117 self.max_payload = 2**32 - self.size_coder.size
125 "suggest a max I/O size, for when self.maxio is 0 / unset"
129 "return a minimum size below which we refuse to work"
130 return self.size_coder.size + 100
157 Now available for normal protocol (size-prefixed) I/O.
172 self.max_payload = maxio - self.size_coder.size
175 "Reduce maximum I/O size per other-side request"
183 self.max_payload = maxio - self.size_coder.size
191 "Do a SHUT_WR on the outbound channel - can't send more"
215 If we can't even get the size, this still returns ''.
216 If we get a sensible size but are missing some data,
226 size_field = self.xread(self.size_coder.size)
227 if len(size_field) < self.size_coder.size:
232 '%s: EOF while reading size (got %d bytes)',
237 size = self.size_coder.unpack(size_field)[0] - self.size_coder.size
238 if size <= 0 or size > self.max_payload:
240 '%s: incoming size %d is insane '
242 self, size, self.max_payload)
243 # indicate EOF - should we raise an error instead, here?
245 data = self.xread(size)
246 return data, len(data) == size
256 # Return immediately for EOF or got-all-data.
266 more = self.channel.recv(nbytes - count)
284 size = len(data)
285 assert size >= 4
286 if size > self.max_payload:
288 'maximum {1}'.format(size, self.max_payload))
319 Note that we keep a table of fid-to-path in self.live_fids,
334 # allocate NOFID out of the 2**32-1 range, so as to avoid
335 # "knowing" that it's 2**32-1.
336 self.fidalloc = numalloc.NumAlloc(0, protocol.td.NOFID - 1)
349 "check for a monkey-wrench"
358 wrench[0] -= 1
368 Set a monkey-wrench. If repeat is not None it is the number of
370 set again with how=None). What is what to monkey-wrench, which
429 "retire the given tag - only used by the thread that handled the result"
495 Announce that we renamed using a fid - we'll try to update
498 NOTE: caller must provide a final-component.
504 - If newdir is None (default), we use stored path.
505 - Otherwise, newdir provides the best approximation
519 ncomps = ocomps[0:-1]
536 ofinal = ocomps[olen - 1]
544 # Skip fids without byte-string paths
557 if parts2[olen - 1] != ofinal:
585 pkt, is_full = super(P9Client, self).read()
586 if pkt == b'':
597 resp = self.proto.unpack(pkt)
599 resp = protocol.plain.unpack(pkt)
604 resp = self.proto.unpack(pkt, noerror=True)
606 header = self.proto.unpack_header(pkt, noerror=True)
608 '%s: (not even raw-decodable)', self)
649 # still waiting for a response - wait some more
744 version = version.decode('utf-8', 'surrogateescape')
761 # (should we wrap it with a connect-to-{0} msg?)
784 pkt = self.proto.Tattach(tag=tag, fid=fid, afid=afid,
787 super(P9Client, self).write(pkt)
816 pkt = self.proto.Twalk(tag=tag, fid=fid, newfid=newfid, nwname=0,
818 super(P9Client, self).write(pkt)
830 be rootfid to look up from '/' - we do not do / vs . here.
831 Caller must also provide a component-ized path (on purpose,
833 The components must be byte-strings as well, for the same
850 pkt = self.proto.Twalk(tag=tag, fid=fid, newfid=newfid,
852 super(P9Client, self).write(pkt)
888 return rfid, wqid[-1]
892 pkt = self.proto.Tstat(tag=tag, fid=rfid)
893 super(P9Client, self).write(pkt)
903 pkt = self.proto.Tclunk(tag=tag, fid=fid)
904 super(P9Client, self).write(pkt)
915 pkt = self.proto.Tremove(tag=tag, fid=fid)
916 super(P9Client, self).write(pkt)
931 the now-open file. perm is, e.g., 0644, 0755, etc.,
958 pkt = self.proto.Tcreate(tag=tag, fid=fid, name=name,
960 super(P9Client, self).write(pkt)
974 pkt = self.proto.Topen(tag=tag, fid=fid, mode=mode)
975 super(P9Client, self).write(pkt)
984 pkt = self.proto.Tlopen(tag=tag, fid=fid, flags=flags)
985 super(P9Client, self).write(pkt)
994 pkt = self.proto.Tread(tag=tag, fid=fid, offset=offset, count=count)
995 super(P9Client, self).write(pkt)
1006 pkt = self.proto.Twrite(tag=tag, fid=fid, offset=offset,
1008 super(P9Client, self).write(pkt)
1017 # - pass an actual stat object, or
1018 # - pass in all the individual to-set items by keyword, or
1019 # - mix and match a bit: get an existing stat, then use
1032 # read-only when stat-ing.
1045 'dev': 2**32 - 1,
1046 'mode': 2**32 - 1,
1047 'atime': 2**32 - 1,
1048 'mtime': 2**32 - 1,
1049 'length': 2**64 - 1,
1055 'n_uid': 2**32 - 1,
1056 'n_gid': 2**32 - 1,
1057 'n_muid': 2**32 - 1,
1073 pkt = self.proto.Twstat(tag=tag, fid=fid, data=data)
1074 super(P9Client, self).write(pkt)
1077 # For error viewing, switch all the do-not-change
1078 # and can't-change fields to None.
1087 # wstat worked - change path names if needed
1094 pkt = self.proto.Treaddir(tag=tag, fid=fid, offset=offset, count=count)
1095 super(P9Client, self).write(pkt)
1106 pkt = self.proto.Trename(tag=tag, fid=fid, dfid=dfid, name=name)
1107 super(P9Client, self).write(pkt)
1119 pkt = self.proto.Trenameat(tag=tag,
1122 super(P9Client, self).write(pkt)
1133 "invoke Tunlinkat - flags should be 0 or protocol.td.AT_REMOVEDIR"
1135 pkt = self.proto.Tunlinkat(tag=tag, dirfd=dirfd,
1137 super(P9Client, self).write(pkt)
1175 pkt = self.proto.Tlcreate(tag=tag, fid=fid, name=name,
1177 super(P9Client, self).write(pkt)
1190 pkt = self.proto.Tmkdir(tag=tag, dfid=dfid, name=name,
1192 super(P9Client, self).write(pkt)
1201 "issue Tgetattr.L - get what you ask for, or everything by default"
1203 pkt = self.proto.Tgetattr(tag=tag, fid=fid, request_mask=request_mask)
1204 super(P9Client, self).write(pkt)
1210 # Handle the simplest valid-bit tests:
1212 'size', 'blocks', 'gen', 'data_version'):
1234 # this is all pretty ad-hoc.
1236 # There's also one keyword-only argument, ctime=<anything>,
1245 # Start with an empty (all-zero) Tsetattr instance. We
1248 # but does not supply an incoming size (via "attrs" or a size=
1266 # numeric - if that's the case, we're good, set the
1270 if field in ('mode', 'uid', 'gid', 'size'):
1316 pkt = self.proto.pack(attrobj)
1317 super(P9Client, self).write(pkt)
1327 pkt = self.proto.Txattrwalk(tag=tag, fid=fid, newfid=newfid,
1329 super(P9Client, self).write(pkt)
1339 return newfid, resp.size
1354 Unix-style lookup. That is, lookup('/foo/bar') or
1364 Unix-style open()-with-option-to-create, or mkdir().
1393 # Only used if using dot-L, but make sure it's always provided
1400 fid, _ = self.lookup(startdir, components[:-1])
1406 components = components[-1:]
1416 pkt = self.proto.Twalk(tag=tag, fid=startdir, newfid=fid,
1418 super(P9Client, self).write(pkt)
1462 pkt = self.proto.Twalk(tag=tag, fid=startdir, newfid=fid,
1464 super(P9Client, self).write(pkt)
1481 Helper for creating dir-or-file. The fid argument is the
1517 # ? should we re-check qid? it should not have changed
1522 Unix-style mkdir.
1529 fid, _ = self.lookup(startdir, components[:-1])
1532 components = components[-1:]
1551 If no_dotl is True (or anything non-false-y), this uses the
1552 plain or .u readdir format, otherwise it uses dot-L readdir
1587 Raises OSError if this is applied to a non-directory.
1626 Implement readdir loop that uses dot-L style dirents.
1648 offset = ents[-1].offset
1654 Implement rm / rmdir, with optional -rf.
1672 # Note that we must check for "rm -r /" (len(components)==0).
1682 # This will fail if the directory is non-empty, unless of
1726 but if it's 'dir' we fail if the directory contains non-dir