summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-11-05 17:48:53 +0000
committergVisor bot <gvisor-bot@google.com>2021-11-05 17:48:53 +0000
commitf62d5f516175c78eff1857ca938e2c53afb6b7a5 (patch)
tree6203c02fcf397d3a8059f4b2df4d607ca432579e /pkg
parenta1f6772e7e32a6d8899e5511d226ac7f9b017455 (diff)
parentce4f4283badb6b07baf9f8e6d99e7a5fd15c92db (diff)
Merge release-20211101.0-21-gce4f4283b (automated)
Diffstat (limited to 'pkg')
-rw-r--r--pkg/abi/linux/fuse.go111
-rw-r--r--pkg/abi/linux/linux_abi_autogen_unsafe.go3050
-rw-r--r--pkg/abi/linux/linux_amd64_abi_autogen_unsafe.go128
-rw-r--r--pkg/abi/linux/linux_arm64_abi_autogen_unsafe.go128
-rw-r--r--pkg/abi/linux/msgqueue.go12
-rw-r--r--pkg/abi/linux/netfilter.go30
-rw-r--r--pkg/abi/linux/netfilter_ipv6.go32
-rw-r--r--pkg/abi/linux/socket.go3
-rw-r--r--pkg/lisafs/client.go2
-rw-r--r--pkg/lisafs/lisafs_abi_autogen_unsafe.go976
-rw-r--r--pkg/lisafs/message.go511
-rw-r--r--pkg/lisafs/sample_message.go41
-rw-r--r--pkg/marshal/marshal.go14
-rw-r--r--pkg/marshal/marshal_impl_util.go8
-rw-r--r--pkg/marshal/primitive/primitive.go16
-rw-r--r--pkg/marshal/primitive/primitive_abi_autogen_unsafe.go144
-rw-r--r--pkg/sentry/arch/arch_amd64_abi_autogen_unsafe.go80
-rw-r--r--pkg/sentry/arch/arch_arm64_abi_autogen_unsafe.go132
-rw-r--r--pkg/sentry/fsimpl/fuse/fusefs.go16
-rw-r--r--pkg/sentry/fsimpl/fuse/request_response.go4
-rw-r--r--pkg/sentry/kernel/auth/auth_abi_autogen_unsafe.go36
-rw-r--r--pkg/sentry/kernel/kernel_abi_autogen_unsafe.go36
-rw-r--r--pkg/sentry/loader/elf.go3
-rw-r--r--pkg/sentry/socket/control/control.go63
-rw-r--r--pkg/sentry/socket/control/control_vfs2.go5
-rw-r--r--pkg/sentry/socket/hostinet/socket.go14
-rw-r--r--pkg/sentry/socket/hostinet/stack.go6
-rw-r--r--pkg/sentry/socket/netfilter/extensions.go5
-rw-r--r--pkg/sentry/socket/netfilter/ipv4.go5
-rw-r--r--pkg/sentry/socket/netfilter/ipv6.go5
-rw-r--r--pkg/sentry/socket/netfilter/netfilter.go7
-rw-r--r--pkg/sentry/socket/netfilter/netfilter_abi_autogen_unsafe.go40
-rw-r--r--pkg/sentry/socket/netfilter/owner_matcher.go2
-rw-r--r--pkg/sentry/socket/netfilter/targets.go15
-rw-r--r--pkg/sentry/socket/netfilter/tcp_matcher.go2
-rw-r--r--pkg/sentry/socket/netfilter/udp_matcher.go2
-rw-r--r--pkg/sentry/socket/netlink/socket.go2
-rw-r--r--pkg/sentry/socket/netstack/netstack.go14
-rw-r--r--pkg/sentry/socket/socket.go14
-rw-r--r--pkg/sentry/strace/socket.go131
-rw-r--r--pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go140
-rw-r--r--pkg/sentry/syscalls/linux/vfs2/vfs2_abi_autogen_unsafe.go70
42 files changed, 3362 insertions, 2693 deletions
diff --git a/pkg/abi/linux/fuse.go b/pkg/abi/linux/fuse.go
index 1070b457c..1112dadd6 100644
--- a/pkg/abi/linux/fuse.go
+++ b/pkg/abi/linux/fuse.go
@@ -352,6 +352,22 @@ type FUSEEntryOut struct {
Attr FUSEAttr
}
+// CString represents a null terminated string which can be marshalled.
+type CString string
+
+// MarshalBytes implements marshal.Marshallable.MarshalBytes.
+func (s *CString) MarshalBytes(buf []byte) []byte {
+ copy(buf, *s)
+ buf[len(*s)] = 0 // null char
+ return buf[s.SizeBytes():]
+}
+
+// SizeBytes implements marshal.Marshallable.SizeBytes.
+func (s *CString) SizeBytes() int {
+ // 1 extra byte for null-terminated string.
+ return len(*s) + 1
+}
+
// FUSELookupIn is the request sent by the kernel to the daemon
// to look up a file name.
//
@@ -360,18 +376,17 @@ type FUSELookupIn struct {
marshal.StubMarshallable
// Name is a file name to be looked up.
- Name string
+ Name CString
}
// MarshalBytes serializes r.name to the dst buffer.
-func (r *FUSELookupIn) MarshalBytes(buf []byte) {
- copy(buf, r.Name)
+func (r *FUSELookupIn) MarshalBytes(buf []byte) []byte {
+ return r.Name.MarshalBytes(buf)
}
// SizeBytes is the size of the memory representation of FUSELookupIn.
-// 1 extra byte for null-terminated string.
func (r *FUSELookupIn) SizeBytes() int {
- return len(r.Name) + 1
+ return r.Name.SizeBytes()
}
// MAX_NON_LFS indicates the maximum offset without large file support.
@@ -530,19 +545,18 @@ type FUSECreateIn struct {
CreateMeta FUSECreateMeta
// Name is the name of the node to create.
- Name string
+ Name CString
}
// MarshalBytes serializes r.CreateMeta and r.Name to the dst buffer.
-func (r *FUSECreateIn) MarshalBytes(buf []byte) {
- r.CreateMeta.MarshalBytes(buf[:r.CreateMeta.SizeBytes()])
- copy(buf[r.CreateMeta.SizeBytes():], r.Name)
+func (r *FUSECreateIn) MarshalBytes(buf []byte) []byte {
+ buf = r.CreateMeta.MarshalBytes(buf)
+ return r.Name.MarshalBytes(buf)
}
// SizeBytes is the size of the memory representation of FUSECreateIn.
-// 1 extra byte for null-terminated string.
func (r *FUSECreateIn) SizeBytes() int {
- return r.CreateMeta.SizeBytes() + len(r.Name) + 1
+ return r.CreateMeta.SizeBytes() + r.Name.SizeBytes()
}
// FUSEMknodMeta contains all the static fields of FUSEMknodIn,
@@ -573,19 +587,18 @@ type FUSEMknodIn struct {
MknodMeta FUSEMknodMeta
// Name is the name of the node to create.
- Name string
+ Name CString
}
// MarshalBytes serializes r.MknodMeta and r.Name to the dst buffer.
-func (r *FUSEMknodIn) MarshalBytes(buf []byte) {
- r.MknodMeta.MarshalBytes(buf[:r.MknodMeta.SizeBytes()])
- copy(buf[r.MknodMeta.SizeBytes():], r.Name)
+func (r *FUSEMknodIn) MarshalBytes(buf []byte) []byte {
+ buf = r.MknodMeta.MarshalBytes(buf)
+ return r.Name.MarshalBytes(buf)
}
// SizeBytes is the size of the memory representation of FUSEMknodIn.
-// 1 extra byte for null-terminated string.
func (r *FUSEMknodIn) SizeBytes() int {
- return r.MknodMeta.SizeBytes() + len(r.Name) + 1
+ return r.MknodMeta.SizeBytes() + r.Name.SizeBytes()
}
// FUSESymLinkIn is the request sent by the kernel to the daemon,
@@ -596,30 +609,30 @@ type FUSESymLinkIn struct {
marshal.StubMarshallable
// Name of symlink to create.
- Name string
+ Name CString
// Target of the symlink.
- Target string
+ Target CString
}
// MarshalBytes serializes r.Name and r.Target to the dst buffer.
-// Left null-termination at end of r.Name and r.Target.
-func (r *FUSESymLinkIn) MarshalBytes(buf []byte) {
- copy(buf, r.Name)
- copy(buf[len(r.Name)+1:], r.Target)
+func (r *FUSESymLinkIn) MarshalBytes(buf []byte) []byte {
+ buf = r.Name.MarshalBytes(buf)
+ return r.Target.MarshalBytes(buf)
}
// SizeBytes is the size of the memory representation of FUSESymLinkIn.
-// 2 extra bytes for null-terminated string.
func (r *FUSESymLinkIn) SizeBytes() int {
- return len(r.Name) + len(r.Target) + 2
+ return r.Name.SizeBytes() + r.Target.SizeBytes()
}
// FUSEEmptyIn is used by operations without request body.
type FUSEEmptyIn struct{ marshal.StubMarshallable }
// MarshalBytes do nothing for marshal.
-func (r *FUSEEmptyIn) MarshalBytes(buf []byte) {}
+func (r *FUSEEmptyIn) MarshalBytes(buf []byte) []byte {
+ return buf
+}
// SizeBytes is 0 for empty request.
func (r *FUSEEmptyIn) SizeBytes() int {
@@ -649,19 +662,18 @@ type FUSEMkdirIn struct {
MkdirMeta FUSEMkdirMeta
// Name of the directory to create.
- Name string
+ Name CString
}
// MarshalBytes serializes r.MkdirMeta and r.Name to the dst buffer.
-func (r *FUSEMkdirIn) MarshalBytes(buf []byte) {
- r.MkdirMeta.MarshalBytes(buf[:r.MkdirMeta.SizeBytes()])
- copy(buf[r.MkdirMeta.SizeBytes():], r.Name)
+func (r *FUSEMkdirIn) MarshalBytes(buf []byte) []byte {
+ buf = r.MkdirMeta.MarshalBytes(buf)
+ return r.Name.MarshalBytes(buf)
}
// SizeBytes is the size of the memory representation of FUSEMkdirIn.
-// 1 extra byte for null-terminated Name string.
func (r *FUSEMkdirIn) SizeBytes() int {
- return r.MkdirMeta.SizeBytes() + len(r.Name) + 1
+ return r.MkdirMeta.SizeBytes() + r.Name.SizeBytes()
}
// FUSERmDirIn is the request sent by the kernel to the daemon
@@ -672,17 +684,17 @@ type FUSERmDirIn struct {
marshal.StubMarshallable
// Name is a directory name to be removed.
- Name string
+ Name CString
}
// MarshalBytes serializes r.name to the dst buffer.
-func (r *FUSERmDirIn) MarshalBytes(buf []byte) {
- copy(buf, r.Name)
+func (r *FUSERmDirIn) MarshalBytes(buf []byte) []byte {
+ return r.Name.MarshalBytes(buf)
}
// SizeBytes is the size of the memory representation of FUSERmDirIn.
func (r *FUSERmDirIn) SizeBytes() int {
- return len(r.Name) + 1
+ return r.Name.SizeBytes()
}
// FUSEDirents is a list of Dirents received from the FUSE daemon server.
@@ -738,7 +750,7 @@ func (r *FUSEDirents) SizeBytes() int {
}
// UnmarshalBytes deserializes FUSEDirents from the src buffer.
-func (r *FUSEDirents) UnmarshalBytes(src []byte) {
+func (r *FUSEDirents) UnmarshalBytes(src []byte) []byte {
for {
if len(src) <= (*FUSEDirentMeta)(nil).SizeBytes() {
break
@@ -754,11 +766,10 @@ func (r *FUSEDirents) UnmarshalBytes(src []byte) {
// to do this. Linux allocates 1 page to store all the dirents and then
// simply reads them from the page.
var dirent FUSEDirent
- dirent.UnmarshalBytes(src)
+ src = dirent.UnmarshalBytes(src)
r.Dirents = append(r.Dirents, &dirent)
-
- src = src[dirent.SizeBytes():]
}
+ return src
}
// SizeBytes is the size of the memory representation of FUSEDirent.
@@ -772,20 +783,20 @@ func (r *FUSEDirent) SizeBytes() int {
}
// UnmarshalBytes deserializes FUSEDirent from the src buffer.
-func (r *FUSEDirent) UnmarshalBytes(src []byte) {
- r.Meta.UnmarshalBytes(src)
- src = src[r.Meta.SizeBytes():]
+func (r *FUSEDirent) UnmarshalBytes(src []byte) []byte {
+ src = r.Meta.UnmarshalBytes(src)
if r.Meta.NameLen > FUSE_NAME_MAX {
// The name is too long and therefore invalid. We don't
// need to unmarshal the name since it'll be thrown away.
- return
+ return src
}
buf := make([]byte, r.Meta.NameLen)
name := primitive.ByteSlice(buf)
name.UnmarshalBytes(src[:r.Meta.NameLen])
r.Name = string(name)
+ return src[r.Meta.NameLen:]
}
// FATTR_* consts are the attribute flags defined in include/uapi/linux/fuse.h.
@@ -863,17 +874,15 @@ type FUSEUnlinkIn struct {
marshal.StubMarshallable
// Name of the node to unlink.
- Name string
+ Name CString
}
-// MarshalBytes serializes r.name to the dst buffer, which should
-// have size len(r.Name) + 1 and last byte set to 0.
-func (r *FUSEUnlinkIn) MarshalBytes(buf []byte) {
- copy(buf, r.Name)
+// MarshalBytes serializes r.name to the dst buffer.
+func (r *FUSEUnlinkIn) MarshalBytes(buf []byte) []byte {
+ return r.Name.MarshalBytes(buf)
}
// SizeBytes is the size of the memory representation of FUSEUnlinkIn.
-// 1 extra byte for null-terminated Name string.
func (r *FUSEUnlinkIn) SizeBytes() int {
- return len(r.Name) + 1
+ return r.Name.SizeBytes()
}
diff --git a/pkg/abi/linux/linux_abi_autogen_unsafe.go b/pkg/abi/linux/linux_abi_autogen_unsafe.go
index b71bd1432..f27f98b2d 100644
--- a/pkg/abi/linux/linux_abi_autogen_unsafe.go
+++ b/pkg/abi/linux/linux_abi_autogen_unsafe.go
@@ -148,7 +148,7 @@ func (i *IOCallback) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *IOCallback) MarshalBytes(dst []byte) {
+func (i *IOCallback) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Data))
dst = dst[8:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Key))
@@ -173,10 +173,11 @@ func (i *IOCallback) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ResFD))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *IOCallback) UnmarshalBytes(src []byte) {
+func (i *IOCallback) UnmarshalBytes(src []byte) []byte {
i.Data = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
i.Key = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -201,6 +202,7 @@ func (i *IOCallback) UnmarshalBytes(src []byte) {
src = src[4:]
i.ResFD = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -210,13 +212,17 @@ func (i *IOCallback) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *IOCallback) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
+func (i *IOCallback) MarshalUnsafe(dst []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *IOCallback) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
+func (i *IOCallback) UnmarshalUnsafe(src []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -281,7 +287,7 @@ func (i *IOEvent) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *IOEvent) MarshalBytes(dst []byte) {
+func (i *IOEvent) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Data))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Obj))
@@ -290,10 +296,11 @@ func (i *IOEvent) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Result2))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *IOEvent) UnmarshalBytes(src []byte) {
+func (i *IOEvent) UnmarshalBytes(src []byte) []byte {
i.Data = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
i.Obj = uint64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -302,6 +309,7 @@ func (i *IOEvent) UnmarshalBytes(src []byte) {
src = src[8:]
i.Result2 = int64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -311,13 +319,17 @@ func (i *IOEvent) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *IOEvent) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
+func (i *IOEvent) MarshalUnsafe(dst []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *IOEvent) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
+func (i *IOEvent) UnmarshalUnsafe(src []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -382,7 +394,7 @@ func (b *BPFInstruction) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (b *BPFInstruction) MarshalBytes(dst []byte) {
+func (b *BPFInstruction) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(b.OpCode))
dst = dst[2:]
dst[0] = byte(b.JumpIfTrue)
@@ -391,10 +403,11 @@ func (b *BPFInstruction) MarshalBytes(dst []byte) {
dst = dst[1:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(b.K))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (b *BPFInstruction) UnmarshalBytes(src []byte) {
+func (b *BPFInstruction) UnmarshalBytes(src []byte) []byte {
b.OpCode = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
b.JumpIfTrue = uint8(src[0])
@@ -403,6 +416,7 @@ func (b *BPFInstruction) UnmarshalBytes(src []byte) {
src = src[1:]
b.K = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -412,13 +426,17 @@ func (b *BPFInstruction) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (b *BPFInstruction) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(b), uintptr(b.SizeBytes()))
+func (b *BPFInstruction) MarshalUnsafe(dst []byte) []byte {
+ size := b.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(b), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (b *BPFInstruction) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(b), unsafe.Pointer(&src[0]), uintptr(b.SizeBytes()))
+func (b *BPFInstruction) UnmarshalUnsafe(src []byte) []byte {
+ size := b.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(b), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -559,23 +577,25 @@ func (c *CapUserData) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (c *CapUserData) MarshalBytes(dst []byte) {
+func (c *CapUserData) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Effective))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Permitted))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Inheritable))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (c *CapUserData) UnmarshalBytes(src []byte) {
+func (c *CapUserData) UnmarshalBytes(src []byte) []byte {
c.Effective = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
c.Permitted = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
c.Inheritable = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -585,13 +605,17 @@ func (c *CapUserData) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (c *CapUserData) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(c.SizeBytes()))
+func (c *CapUserData) MarshalUnsafe(dst []byte) []byte {
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (c *CapUserData) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(c.SizeBytes()))
+func (c *CapUserData) UnmarshalUnsafe(src []byte) []byte {
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -732,19 +756,21 @@ func (c *CapUserHeader) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (c *CapUserHeader) MarshalBytes(dst []byte) {
+func (c *CapUserHeader) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Version))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Pid))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (c *CapUserHeader) UnmarshalBytes(src []byte) {
+func (c *CapUserHeader) UnmarshalBytes(src []byte) []byte {
c.Version = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
c.Pid = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -754,13 +780,17 @@ func (c *CapUserHeader) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (c *CapUserHeader) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(c.SizeBytes()))
+func (c *CapUserHeader) MarshalUnsafe(dst []byte) []byte {
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (c *CapUserHeader) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(c.SizeBytes()))
+func (c *CapUserHeader) UnmarshalUnsafe(src []byte) []byte {
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -826,7 +856,7 @@ func (e *ElfHeader64) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (e *ElfHeader64) MarshalBytes(dst []byte) {
+func (e *ElfHeader64) MarshalBytes(dst []byte) []byte {
for idx := 0; idx < 16; idx++ {
dst[0] = byte(e.Ident[idx])
dst = dst[1:]
@@ -857,10 +887,11 @@ func (e *ElfHeader64) MarshalBytes(dst []byte) {
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shstrndx))
dst = dst[2:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (e *ElfHeader64) UnmarshalBytes(src []byte) {
+func (e *ElfHeader64) UnmarshalBytes(src []byte) []byte {
for idx := 0; idx < 16; idx++ {
e.Ident[idx] = src[0]
src = src[1:]
@@ -891,6 +922,7 @@ func (e *ElfHeader64) UnmarshalBytes(src []byte) {
src = src[2:]
e.Shstrndx = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -900,13 +932,17 @@ func (e *ElfHeader64) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (e *ElfHeader64) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(e.SizeBytes()))
+func (e *ElfHeader64) MarshalUnsafe(dst []byte) []byte {
+ size := e.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (e *ElfHeader64) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(e.SizeBytes()))
+func (e *ElfHeader64) UnmarshalUnsafe(src []byte) []byte {
+ size := e.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -971,7 +1007,7 @@ func (e *ElfProg64) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (e *ElfProg64) MarshalBytes(dst []byte) {
+func (e *ElfProg64) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Type))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Flags))
@@ -988,10 +1024,11 @@ func (e *ElfProg64) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Align))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (e *ElfProg64) UnmarshalBytes(src []byte) {
+func (e *ElfProg64) UnmarshalBytes(src []byte) []byte {
e.Type = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
e.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -1008,6 +1045,7 @@ func (e *ElfProg64) UnmarshalBytes(src []byte) {
src = src[8:]
e.Align = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -1017,13 +1055,17 @@ func (e *ElfProg64) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (e *ElfProg64) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(e.SizeBytes()))
+func (e *ElfProg64) MarshalUnsafe(dst []byte) []byte {
+ size := e.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (e *ElfProg64) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(e.SizeBytes()))
+func (e *ElfProg64) UnmarshalUnsafe(src []byte) []byte {
+ size := e.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1088,7 +1130,7 @@ func (e *ElfSection64) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (e *ElfSection64) MarshalBytes(dst []byte) {
+func (e *ElfSection64) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Name))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Type))
@@ -1109,10 +1151,11 @@ func (e *ElfSection64) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Entsize))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (e *ElfSection64) UnmarshalBytes(src []byte) {
+func (e *ElfSection64) UnmarshalBytes(src []byte) []byte {
e.Name = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
e.Type = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -1133,6 +1176,7 @@ func (e *ElfSection64) UnmarshalBytes(src []byte) {
src = src[8:]
e.Entsize = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -1142,13 +1186,17 @@ func (e *ElfSection64) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (e *ElfSection64) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(e.SizeBytes()))
+func (e *ElfSection64) MarshalUnsafe(dst []byte) []byte {
+ size := e.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (e *ElfSection64) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(e.SizeBytes()))
+func (e *ElfSection64) UnmarshalUnsafe(src []byte) []byte {
+ size := e.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1215,19 +1263,17 @@ func (s *SockErrCMsgIPv4) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SockErrCMsgIPv4) MarshalBytes(dst []byte) {
- s.SockExtendedErr.MarshalBytes(dst[:s.SockExtendedErr.SizeBytes()])
- dst = dst[s.SockExtendedErr.SizeBytes():]
- s.Offender.MarshalBytes(dst[:s.Offender.SizeBytes()])
- dst = dst[s.Offender.SizeBytes():]
+func (s *SockErrCMsgIPv4) MarshalBytes(dst []byte) []byte {
+ dst = s.SockExtendedErr.MarshalBytes(dst)
+ dst = s.Offender.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SockErrCMsgIPv4) UnmarshalBytes(src []byte) {
- s.SockExtendedErr.UnmarshalBytes(src[:s.SockExtendedErr.SizeBytes()])
- src = src[s.SockExtendedErr.SizeBytes():]
- s.Offender.UnmarshalBytes(src[:s.Offender.SizeBytes()])
- src = src[s.Offender.SizeBytes():]
+func (s *SockErrCMsgIPv4) UnmarshalBytes(src []byte) []byte {
+ src = s.SockExtendedErr.UnmarshalBytes(src)
+ src = s.Offender.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -1237,23 +1283,25 @@ func (s *SockErrCMsgIPv4) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SockErrCMsgIPv4) MarshalUnsafe(dst []byte) {
+func (s *SockErrCMsgIPv4) MarshalUnsafe(dst []byte) []byte {
if s.Offender.Packed() && s.SockExtendedErr.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SockErrCMsgIPv4) UnmarshalUnsafe(src []byte) {
+func (s *SockErrCMsgIPv4) UnmarshalUnsafe(src []byte) []byte {
if s.Offender.Packed() && s.SockExtendedErr.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1345,19 +1393,17 @@ func (s *SockErrCMsgIPv6) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SockErrCMsgIPv6) MarshalBytes(dst []byte) {
- s.SockExtendedErr.MarshalBytes(dst[:s.SockExtendedErr.SizeBytes()])
- dst = dst[s.SockExtendedErr.SizeBytes():]
- s.Offender.MarshalBytes(dst[:s.Offender.SizeBytes()])
- dst = dst[s.Offender.SizeBytes():]
+func (s *SockErrCMsgIPv6) MarshalBytes(dst []byte) []byte {
+ dst = s.SockExtendedErr.MarshalBytes(dst)
+ dst = s.Offender.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SockErrCMsgIPv6) UnmarshalBytes(src []byte) {
- s.SockExtendedErr.UnmarshalBytes(src[:s.SockExtendedErr.SizeBytes()])
- src = src[s.SockExtendedErr.SizeBytes():]
- s.Offender.UnmarshalBytes(src[:s.Offender.SizeBytes()])
- src = src[s.Offender.SizeBytes():]
+func (s *SockErrCMsgIPv6) UnmarshalBytes(src []byte) []byte {
+ src = s.SockExtendedErr.UnmarshalBytes(src)
+ src = s.Offender.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -1367,23 +1413,25 @@ func (s *SockErrCMsgIPv6) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SockErrCMsgIPv6) MarshalUnsafe(dst []byte) {
+func (s *SockErrCMsgIPv6) MarshalUnsafe(dst []byte) []byte {
if s.Offender.Packed() && s.SockExtendedErr.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SockErrCMsgIPv6) UnmarshalUnsafe(src []byte) {
+func (s *SockErrCMsgIPv6) UnmarshalUnsafe(src []byte) []byte {
if s.Offender.Packed() && s.SockExtendedErr.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1473,7 +1521,7 @@ func (s *SockExtendedErr) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SockExtendedErr) MarshalBytes(dst []byte) {
+func (s *SockExtendedErr) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno))
dst = dst[4:]
dst[0] = byte(s.Origin)
@@ -1488,10 +1536,11 @@ func (s *SockExtendedErr) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Data))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SockExtendedErr) UnmarshalBytes(src []byte) {
+func (s *SockExtendedErr) UnmarshalBytes(src []byte) []byte {
s.Errno = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
s.Origin = uint8(src[0])
@@ -1506,6 +1555,7 @@ func (s *SockExtendedErr) UnmarshalBytes(src []byte) {
src = src[4:]
s.Data = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -1515,13 +1565,17 @@ func (s *SockExtendedErr) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SockExtendedErr) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *SockExtendedErr) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SockExtendedErr) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *SockExtendedErr) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1586,19 +1640,21 @@ func (f *FOwnerEx) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FOwnerEx) MarshalBytes(dst []byte) {
+func (f *FOwnerEx) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Type))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FOwnerEx) UnmarshalBytes(src []byte) {
+func (f *FOwnerEx) UnmarshalBytes(src []byte) []byte {
f.Type = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
f.PID = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -1608,13 +1664,17 @@ func (f *FOwnerEx) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FOwnerEx) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FOwnerEx) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FOwnerEx) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FOwnerEx) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1681,7 +1741,7 @@ func (f *Flock) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *Flock) MarshalBytes(dst []byte) {
+func (f *Flock) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.Type))
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.Whence))
@@ -1696,10 +1756,11 @@ func (f *Flock) MarshalBytes(dst []byte) {
dst = dst[4:]
// Padding: dst[:sizeof(byte)*4] ~= [4]byte{0}
dst = dst[1*(4):]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *Flock) UnmarshalBytes(src []byte) {
+func (f *Flock) UnmarshalBytes(src []byte) []byte {
f.Type = int16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
f.Whence = int16(hostarch.ByteOrder.Uint16(src[:2]))
@@ -1714,6 +1775,7 @@ func (f *Flock) UnmarshalBytes(src []byte) {
src = src[4:]
// Padding: ~ copy([4]byte(f._), src[:sizeof(byte)*4])
src = src[1*(4):]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -1723,13 +1785,17 @@ func (f *Flock) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *Flock) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *Flock) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *Flock) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *Flock) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1795,13 +1861,15 @@ func (m *FileMode) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *FileMode) MarshalBytes(dst []byte) {
+func (m *FileMode) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(*m))
+ return dst[2:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *FileMode) UnmarshalBytes(src []byte) {
+func (m *FileMode) UnmarshalBytes(src []byte) []byte {
*m = FileMode(uint16(hostarch.ByteOrder.Uint16(src[:2])))
+ return src[2:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -1812,13 +1880,17 @@ func (m *FileMode) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (m *FileMode) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(m.SizeBytes()))
+func (m *FileMode) MarshalUnsafe(dst []byte) []byte {
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (m *FileMode) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(m.SizeBytes()))
+func (m *FileMode) UnmarshalUnsafe(src []byte) []byte {
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1887,7 +1959,7 @@ func (s *Statx) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *Statx) MarshalBytes(dst []byte) {
+func (s *Statx) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Mask))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Blksize))
@@ -1912,14 +1984,10 @@ func (s *Statx) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.AttributesMask))
dst = dst[8:]
- s.Atime.MarshalBytes(dst[:s.Atime.SizeBytes()])
- dst = dst[s.Atime.SizeBytes():]
- s.Btime.MarshalBytes(dst[:s.Btime.SizeBytes()])
- dst = dst[s.Btime.SizeBytes():]
- s.Ctime.MarshalBytes(dst[:s.Ctime.SizeBytes()])
- dst = dst[s.Ctime.SizeBytes():]
- s.Mtime.MarshalBytes(dst[:s.Mtime.SizeBytes()])
- dst = dst[s.Mtime.SizeBytes():]
+ dst = s.Atime.MarshalBytes(dst)
+ dst = s.Btime.MarshalBytes(dst)
+ dst = s.Ctime.MarshalBytes(dst)
+ dst = s.Mtime.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.RdevMajor))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.RdevMinor))
@@ -1928,10 +1996,11 @@ func (s *Statx) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.DevMinor))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *Statx) UnmarshalBytes(src []byte) {
+func (s *Statx) UnmarshalBytes(src []byte) []byte {
s.Mask = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
s.Blksize = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -1956,14 +2025,10 @@ func (s *Statx) UnmarshalBytes(src []byte) {
src = src[8:]
s.AttributesMask = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
- s.Atime.UnmarshalBytes(src[:s.Atime.SizeBytes()])
- src = src[s.Atime.SizeBytes():]
- s.Btime.UnmarshalBytes(src[:s.Btime.SizeBytes()])
- src = src[s.Btime.SizeBytes():]
- s.Ctime.UnmarshalBytes(src[:s.Ctime.SizeBytes()])
- src = src[s.Ctime.SizeBytes():]
- s.Mtime.UnmarshalBytes(src[:s.Mtime.SizeBytes()])
- src = src[s.Mtime.SizeBytes():]
+ src = s.Atime.UnmarshalBytes(src)
+ src = s.Btime.UnmarshalBytes(src)
+ src = s.Ctime.UnmarshalBytes(src)
+ src = s.Mtime.UnmarshalBytes(src)
s.RdevMajor = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
s.RdevMinor = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -1972,6 +2037,7 @@ func (s *Statx) UnmarshalBytes(src []byte) {
src = src[4:]
s.DevMinor = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -1981,23 +2047,25 @@ func (s *Statx) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *Statx) MarshalUnsafe(dst []byte) {
+func (s *Statx) MarshalUnsafe(dst []byte) []byte {
if s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type Statx doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type Statx doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *Statx) UnmarshalUnsafe(src []byte) {
+func (s *Statx) UnmarshalUnsafe(src []byte) []byte {
if s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type Statx doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type Statx doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -2097,15 +2165,14 @@ func CopyStatxSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Statx) (
// Unmarshal as much as possible, even on error. First handle full objects.
limit := length/size
for idx := 0; idx < limit; idx++ {
- dst[idx].UnmarshalBytes(buf[size*idx:size*(idx+1)])
+ buf = dst[idx].UnmarshalBytes(buf)
}
// Handle any final partial object. buf is guaranteed to be long enough for the
// final element, but may not contain valid data for the entire range. This may
// result in unmarshalling zero values for some parts of the object.
if length%size != 0 {
- idx := limit
- dst[idx].UnmarshalBytes(buf[size*idx:size*(idx+1)])
+ dst[limit].UnmarshalBytes(buf)
}
return length, err
@@ -2139,8 +2206,9 @@ func CopyStatxSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Statx)
if !src[0].Packed() {
// Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes.
buf := cc.CopyScratchBuffer(size * count)
+ curBuf := buf
for idx := 0; idx < count; idx++ {
- src[idx].MarshalBytes(buf[size*idx:size*(idx+1)])
+ curBuf = src[idx].MarshalBytes(curBuf)
}
return cc.CopyOutBytes(addr, buf)
}
@@ -2173,7 +2241,7 @@ func MarshalUnsafeStatxSlice(src []Statx, dst []byte) (int, error) {
if !src[0].Packed() {
// Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes.
for idx := 0; idx < count; idx++ {
- src[idx].MarshalBytes(dst[size*idx:(size)*(idx+1)])
+ dst = src[idx].MarshalBytes(dst)
}
return size * count, nil
}
@@ -2194,7 +2262,7 @@ func UnmarshalUnsafeStatxSlice(dst []Statx, src []byte) (int, error) {
if !dst[0].Packed() {
// Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes.
for idx := 0; idx < count; idx++ {
- dst[idx].UnmarshalBytes(src[size*idx:size*(idx+1)])
+ src = dst[idx].UnmarshalBytes(src)
}
return size * count, nil
}
@@ -2212,7 +2280,7 @@ func (s *Statfs) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *Statfs) MarshalBytes(dst []byte) {
+func (s *Statfs) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Type))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlockSize))
@@ -2241,10 +2309,11 @@ func (s *Statfs) MarshalBytes(dst []byte) {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Spare[idx]))
dst = dst[8:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *Statfs) UnmarshalBytes(src []byte) {
+func (s *Statfs) UnmarshalBytes(src []byte) []byte {
s.Type = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
s.BlockSize = int64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -2273,6 +2342,7 @@ func (s *Statfs) UnmarshalBytes(src []byte) {
s.Spare[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -2282,13 +2352,17 @@ func (s *Statfs) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *Statfs) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *Statfs) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *Statfs) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *Statfs) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -2353,7 +2427,7 @@ func (f *FUSEAttr) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEAttr) MarshalBytes(dst []byte) {
+func (f *FUSEAttr) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Ino))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Size))
@@ -2386,10 +2460,11 @@ func (f *FUSEAttr) MarshalBytes(dst []byte) {
dst = dst[4:]
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEAttr) UnmarshalBytes(src []byte) {
+func (f *FUSEAttr) UnmarshalBytes(src []byte) []byte {
f.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
f.Size = uint64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -2422,6 +2497,7 @@ func (f *FUSEAttr) UnmarshalBytes(src []byte) {
src = src[4:]
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -2431,13 +2507,17 @@ func (f *FUSEAttr) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEAttr) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSEAttr) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEAttr) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSEAttr) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -2502,7 +2582,7 @@ func (f *FUSECreateMeta) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSECreateMeta) MarshalBytes(dst []byte) {
+func (f *FUSECreateMeta) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode))
@@ -2511,10 +2591,11 @@ func (f *FUSECreateMeta) MarshalBytes(dst []byte) {
dst = dst[4:]
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSECreateMeta) UnmarshalBytes(src []byte) {
+func (f *FUSECreateMeta) UnmarshalBytes(src []byte) []byte {
f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -2523,6 +2604,7 @@ func (f *FUSECreateMeta) UnmarshalBytes(src []byte) {
src = src[4:]
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -2532,13 +2614,17 @@ func (f *FUSECreateMeta) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSECreateMeta) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSECreateMeta) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSECreateMeta) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSECreateMeta) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -2603,7 +2689,7 @@ func (f *FUSEDirentMeta) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEDirentMeta) MarshalBytes(dst []byte) {
+func (f *FUSEDirentMeta) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Ino))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Off))
@@ -2612,10 +2698,11 @@ func (f *FUSEDirentMeta) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Type))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEDirentMeta) UnmarshalBytes(src []byte) {
+func (f *FUSEDirentMeta) UnmarshalBytes(src []byte) []byte {
f.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
f.Off = uint64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -2624,6 +2711,7 @@ func (f *FUSEDirentMeta) UnmarshalBytes(src []byte) {
src = src[4:]
f.Type = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -2633,13 +2721,17 @@ func (f *FUSEDirentMeta) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEDirentMeta) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSEDirentMeta) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEDirentMeta) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSEDirentMeta) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -2705,7 +2797,7 @@ func (f *FUSEEntryOut) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEEntryOut) MarshalBytes(dst []byte) {
+func (f *FUSEEntryOut) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.NodeID))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Generation))
@@ -2718,12 +2810,12 @@ func (f *FUSEEntryOut) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AttrValidNSec))
dst = dst[4:]
- f.Attr.MarshalBytes(dst[:f.Attr.SizeBytes()])
- dst = dst[f.Attr.SizeBytes():]
+ dst = f.Attr.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEEntryOut) UnmarshalBytes(src []byte) {
+func (f *FUSEEntryOut) UnmarshalBytes(src []byte) []byte {
f.NodeID = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
f.Generation = uint64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -2736,8 +2828,8 @@ func (f *FUSEEntryOut) UnmarshalBytes(src []byte) {
src = src[4:]
f.AttrValidNSec = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
- f.Attr.UnmarshalBytes(src[:f.Attr.SizeBytes()])
- src = src[f.Attr.SizeBytes():]
+ src = f.Attr.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -2747,23 +2839,25 @@ func (f *FUSEEntryOut) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEEntryOut) MarshalUnsafe(dst []byte) {
+func (f *FUSEEntryOut) MarshalUnsafe(dst []byte) []byte {
if f.Attr.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
- } else {
- // Type FUSEEntryOut doesn't have a packed layout in memory, fallback to MarshalBytes.
- f.MarshalBytes(dst)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
+ // Type FUSEEntryOut doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return f.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEEntryOut) UnmarshalUnsafe(src []byte) {
+func (f *FUSEEntryOut) UnmarshalUnsafe(src []byte) []byte {
if f.Attr.Packed() {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
- } else {
- // Type FUSEEntryOut doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- f.UnmarshalBytes(src)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type FUSEEntryOut doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return f.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -2853,23 +2947,25 @@ func (f *FUSEGetAttrIn) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEGetAttrIn) MarshalBytes(dst []byte) {
+func (f *FUSEGetAttrIn) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GetAttrFlags))
dst = dst[4:]
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEGetAttrIn) UnmarshalBytes(src []byte) {
+func (f *FUSEGetAttrIn) UnmarshalBytes(src []byte) []byte {
f.GetAttrFlags = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -2879,13 +2975,17 @@ func (f *FUSEGetAttrIn) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEGetAttrIn) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSEGetAttrIn) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEGetAttrIn) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSEGetAttrIn) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -2951,27 +3051,27 @@ func (f *FUSEGetAttrOut) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEGetAttrOut) MarshalBytes(dst []byte) {
+func (f *FUSEGetAttrOut) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.AttrValid))
dst = dst[8:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AttrValidNsec))
dst = dst[4:]
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
- f.Attr.MarshalBytes(dst[:f.Attr.SizeBytes()])
- dst = dst[f.Attr.SizeBytes():]
+ dst = f.Attr.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEGetAttrOut) UnmarshalBytes(src []byte) {
+func (f *FUSEGetAttrOut) UnmarshalBytes(src []byte) []byte {
f.AttrValid = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
f.AttrValidNsec = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
- f.Attr.UnmarshalBytes(src[:f.Attr.SizeBytes()])
- src = src[f.Attr.SizeBytes():]
+ src = f.Attr.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -2981,23 +3081,25 @@ func (f *FUSEGetAttrOut) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEGetAttrOut) MarshalUnsafe(dst []byte) {
+func (f *FUSEGetAttrOut) MarshalUnsafe(dst []byte) []byte {
if f.Attr.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
- } else {
- // Type FUSEGetAttrOut doesn't have a packed layout in memory, fallback to MarshalBytes.
- f.MarshalBytes(dst)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
+ // Type FUSEGetAttrOut doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return f.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEGetAttrOut) UnmarshalUnsafe(src []byte) {
+func (f *FUSEGetAttrOut) UnmarshalUnsafe(src []byte) []byte {
if f.Attr.Packed() {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
- } else {
- // Type FUSEGetAttrOut doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- f.UnmarshalBytes(src)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type FUSEGetAttrOut doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return f.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3089,13 +3191,11 @@ func (f *FUSEHeaderIn) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEHeaderIn) MarshalBytes(dst []byte) {
+func (f *FUSEHeaderIn) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Len))
dst = dst[4:]
- f.Opcode.MarshalBytes(dst[:f.Opcode.SizeBytes()])
- dst = dst[f.Opcode.SizeBytes():]
- f.Unique.MarshalBytes(dst[:f.Unique.SizeBytes()])
- dst = dst[f.Unique.SizeBytes():]
+ dst = f.Opcode.MarshalBytes(dst)
+ dst = f.Unique.MarshalBytes(dst)
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.NodeID))
dst = dst[8:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.UID))
@@ -3106,16 +3206,15 @@ func (f *FUSEHeaderIn) MarshalBytes(dst []byte) {
dst = dst[4:]
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEHeaderIn) UnmarshalBytes(src []byte) {
+func (f *FUSEHeaderIn) UnmarshalBytes(src []byte) []byte {
f.Len = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
- f.Opcode.UnmarshalBytes(src[:f.Opcode.SizeBytes()])
- src = src[f.Opcode.SizeBytes():]
- f.Unique.UnmarshalBytes(src[:f.Unique.SizeBytes()])
- src = src[f.Unique.SizeBytes():]
+ src = f.Opcode.UnmarshalBytes(src)
+ src = f.Unique.UnmarshalBytes(src)
f.NodeID = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
f.UID = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -3126,6 +3225,7 @@ func (f *FUSEHeaderIn) UnmarshalBytes(src []byte) {
src = src[4:]
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -3135,23 +3235,25 @@ func (f *FUSEHeaderIn) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEHeaderIn) MarshalUnsafe(dst []byte) {
+func (f *FUSEHeaderIn) MarshalUnsafe(dst []byte) []byte {
if f.Opcode.Packed() && f.Unique.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
- } else {
- // Type FUSEHeaderIn doesn't have a packed layout in memory, fallback to MarshalBytes.
- f.MarshalBytes(dst)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
+ // Type FUSEHeaderIn doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return f.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEHeaderIn) UnmarshalUnsafe(src []byte) {
+func (f *FUSEHeaderIn) UnmarshalUnsafe(src []byte) []byte {
if f.Opcode.Packed() && f.Unique.Packed() {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
- } else {
- // Type FUSEHeaderIn doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- f.UnmarshalBytes(src)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type FUSEHeaderIn doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return f.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3242,23 +3344,23 @@ func (f *FUSEHeaderOut) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEHeaderOut) MarshalBytes(dst []byte) {
+func (f *FUSEHeaderOut) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Len))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Error))
dst = dst[4:]
- f.Unique.MarshalBytes(dst[:f.Unique.SizeBytes()])
- dst = dst[f.Unique.SizeBytes():]
+ dst = f.Unique.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEHeaderOut) UnmarshalBytes(src []byte) {
+func (f *FUSEHeaderOut) UnmarshalBytes(src []byte) []byte {
f.Len = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
f.Error = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
- f.Unique.UnmarshalBytes(src[:f.Unique.SizeBytes()])
- src = src[f.Unique.SizeBytes():]
+ src = f.Unique.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -3268,23 +3370,25 @@ func (f *FUSEHeaderOut) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEHeaderOut) MarshalUnsafe(dst []byte) {
+func (f *FUSEHeaderOut) MarshalUnsafe(dst []byte) []byte {
if f.Unique.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
- } else {
- // Type FUSEHeaderOut doesn't have a packed layout in memory, fallback to MarshalBytes.
- f.MarshalBytes(dst)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
+ // Type FUSEHeaderOut doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return f.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEHeaderOut) UnmarshalUnsafe(src []byte) {
+func (f *FUSEHeaderOut) UnmarshalUnsafe(src []byte) []byte {
if f.Unique.Packed() {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
- } else {
- // Type FUSEHeaderOut doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- f.UnmarshalBytes(src)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type FUSEHeaderOut doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return f.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3374,7 +3478,7 @@ func (f *FUSEInitIn) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEInitIn) MarshalBytes(dst []byte) {
+func (f *FUSEInitIn) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Major))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Minor))
@@ -3383,10 +3487,11 @@ func (f *FUSEInitIn) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEInitIn) UnmarshalBytes(src []byte) {
+func (f *FUSEInitIn) UnmarshalBytes(src []byte) []byte {
f.Major = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
f.Minor = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -3395,6 +3500,7 @@ func (f *FUSEInitIn) UnmarshalBytes(src []byte) {
src = src[4:]
f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -3404,13 +3510,17 @@ func (f *FUSEInitIn) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEInitIn) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSEInitIn) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEInitIn) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSEInitIn) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3476,7 +3586,7 @@ func (f *FUSEInitOut) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEInitOut) MarshalBytes(dst []byte) {
+func (f *FUSEInitOut) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Major))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Minor))
@@ -3499,10 +3609,11 @@ func (f *FUSEInitOut) MarshalBytes(dst []byte) {
dst = dst[2:]
// Padding: dst[:sizeof(uint32)*8] ~= [8]uint32{0}
dst = dst[4*(8):]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEInitOut) UnmarshalBytes(src []byte) {
+func (f *FUSEInitOut) UnmarshalBytes(src []byte) []byte {
f.Major = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
f.Minor = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -3525,6 +3636,7 @@ func (f *FUSEInitOut) UnmarshalBytes(src []byte) {
src = src[2:]
// Padding: ~ copy([8]uint32(f._), src[:sizeof(uint32)*8])
src = src[4*(8):]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -3534,13 +3646,17 @@ func (f *FUSEInitOut) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEInitOut) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSEInitOut) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEInitOut) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSEInitOut) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3605,19 +3721,21 @@ func (f *FUSEMkdirMeta) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEMkdirMeta) MarshalBytes(dst []byte) {
+func (f *FUSEMkdirMeta) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEMkdirMeta) UnmarshalBytes(src []byte) {
+func (f *FUSEMkdirMeta) UnmarshalBytes(src []byte) []byte {
f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -3627,13 +3745,17 @@ func (f *FUSEMkdirMeta) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEMkdirMeta) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSEMkdirMeta) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEMkdirMeta) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSEMkdirMeta) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3698,7 +3820,7 @@ func (f *FUSEMknodMeta) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEMknodMeta) MarshalBytes(dst []byte) {
+func (f *FUSEMknodMeta) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Rdev))
@@ -3707,10 +3829,11 @@ func (f *FUSEMknodMeta) MarshalBytes(dst []byte) {
dst = dst[4:]
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEMknodMeta) UnmarshalBytes(src []byte) {
+func (f *FUSEMknodMeta) UnmarshalBytes(src []byte) []byte {
f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
f.Rdev = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -3719,6 +3842,7 @@ func (f *FUSEMknodMeta) UnmarshalBytes(src []byte) {
src = src[4:]
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -3728,13 +3852,17 @@ func (f *FUSEMknodMeta) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEMknodMeta) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSEMknodMeta) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEMknodMeta) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSEMknodMeta) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3800,13 +3928,15 @@ func (f *FUSEOpID) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEOpID) MarshalBytes(dst []byte) {
+func (f *FUSEOpID) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(*f))
+ return dst[8:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEOpID) UnmarshalBytes(src []byte) {
+func (f *FUSEOpID) UnmarshalBytes(src []byte) []byte {
*f = FUSEOpID(uint64(hostarch.ByteOrder.Uint64(src[:8])))
+ return src[8:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -3817,13 +3947,17 @@ func (f *FUSEOpID) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEOpID) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSEOpID) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEOpID) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSEOpID) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3889,13 +4023,15 @@ func (f *FUSEOpcode) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEOpcode) MarshalBytes(dst []byte) {
+func (f *FUSEOpcode) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(*f))
+ return dst[4:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEOpcode) UnmarshalBytes(src []byte) {
+func (f *FUSEOpcode) UnmarshalBytes(src []byte) []byte {
*f = FUSEOpcode(uint32(hostarch.ByteOrder.Uint32(src[:4])))
+ return src[4:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -3906,13 +4042,17 @@ func (f *FUSEOpcode) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEOpcode) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSEOpcode) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEOpcode) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSEOpcode) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3977,19 +4117,21 @@ func (f *FUSEOpenIn) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEOpenIn) MarshalBytes(dst []byte) {
+func (f *FUSEOpenIn) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags))
dst = dst[4:]
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEOpenIn) UnmarshalBytes(src []byte) {
+func (f *FUSEOpenIn) UnmarshalBytes(src []byte) []byte {
f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -3999,13 +4141,17 @@ func (f *FUSEOpenIn) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEOpenIn) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSEOpenIn) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEOpenIn) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSEOpenIn) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -4070,23 +4216,25 @@ func (f *FUSEOpenOut) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEOpenOut) MarshalBytes(dst []byte) {
+func (f *FUSEOpenOut) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh))
dst = dst[8:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.OpenFlag))
dst = dst[4:]
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEOpenOut) UnmarshalBytes(src []byte) {
+func (f *FUSEOpenOut) UnmarshalBytes(src []byte) []byte {
f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
f.OpenFlag = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -4096,13 +4244,17 @@ func (f *FUSEOpenOut) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEOpenOut) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSEOpenOut) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEOpenOut) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSEOpenOut) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -4167,7 +4319,7 @@ func (f *FUSEReadIn) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEReadIn) MarshalBytes(dst []byte) {
+func (f *FUSEReadIn) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset))
@@ -4182,10 +4334,11 @@ func (f *FUSEReadIn) MarshalBytes(dst []byte) {
dst = dst[4:]
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEReadIn) UnmarshalBytes(src []byte) {
+func (f *FUSEReadIn) UnmarshalBytes(src []byte) []byte {
f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -4200,6 +4353,7 @@ func (f *FUSEReadIn) UnmarshalBytes(src []byte) {
src = src[4:]
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -4209,13 +4363,17 @@ func (f *FUSEReadIn) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEReadIn) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSEReadIn) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEReadIn) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSEReadIn) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -4280,7 +4438,7 @@ func (f *FUSEReleaseIn) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEReleaseIn) MarshalBytes(dst []byte) {
+func (f *FUSEReleaseIn) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh))
dst = dst[8:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags))
@@ -4289,10 +4447,11 @@ func (f *FUSEReleaseIn) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEReleaseIn) UnmarshalBytes(src []byte) {
+func (f *FUSEReleaseIn) UnmarshalBytes(src []byte) []byte {
f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -4301,6 +4460,7 @@ func (f *FUSEReleaseIn) UnmarshalBytes(src []byte) {
src = src[4:]
f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -4310,13 +4470,17 @@ func (f *FUSEReleaseIn) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEReleaseIn) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSEReleaseIn) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEReleaseIn) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSEReleaseIn) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -4381,7 +4545,7 @@ func (f *FUSESetAttrIn) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSESetAttrIn) MarshalBytes(dst []byte) {
+func (f *FUSESetAttrIn) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Valid))
dst = dst[4:]
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
@@ -4414,10 +4578,11 @@ func (f *FUSESetAttrIn) MarshalBytes(dst []byte) {
dst = dst[4:]
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSESetAttrIn) UnmarshalBytes(src []byte) {
+func (f *FUSESetAttrIn) UnmarshalBytes(src []byte) []byte {
f.Valid = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
@@ -4450,6 +4615,7 @@ func (f *FUSESetAttrIn) UnmarshalBytes(src []byte) {
src = src[4:]
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -4459,13 +4625,17 @@ func (f *FUSESetAttrIn) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSESetAttrIn) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSESetAttrIn) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSESetAttrIn) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSESetAttrIn) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -4530,7 +4700,7 @@ func (f *FUSEWriteIn) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEWriteIn) MarshalBytes(dst []byte) {
+func (f *FUSEWriteIn) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset))
@@ -4545,10 +4715,11 @@ func (f *FUSEWriteIn) MarshalBytes(dst []byte) {
dst = dst[4:]
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEWriteIn) UnmarshalBytes(src []byte) {
+func (f *FUSEWriteIn) UnmarshalBytes(src []byte) []byte {
f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -4563,6 +4734,7 @@ func (f *FUSEWriteIn) UnmarshalBytes(src []byte) {
src = src[4:]
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -4572,13 +4744,17 @@ func (f *FUSEWriteIn) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEWriteIn) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSEWriteIn) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEWriteIn) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSEWriteIn) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -4643,19 +4819,21 @@ func (f *FUSEWriteOut) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FUSEWriteOut) MarshalBytes(dst []byte) {
+func (f *FUSEWriteOut) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size))
dst = dst[4:]
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FUSEWriteOut) UnmarshalBytes(src []byte) {
+func (f *FUSEWriteOut) UnmarshalBytes(src []byte) []byte {
f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -4665,13 +4843,17 @@ func (f *FUSEWriteOut) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FUSEWriteOut) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FUSEWriteOut) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FUSEWriteOut) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FUSEWriteOut) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -4736,23 +4918,25 @@ func (r *RobustListHead) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (r *RobustListHead) MarshalBytes(dst []byte) {
+func (r *RobustListHead) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.List))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.FutexOffset))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.ListOpPending))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (r *RobustListHead) UnmarshalBytes(src []byte) {
+func (r *RobustListHead) UnmarshalBytes(src []byte) []byte {
r.List = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
r.FutexOffset = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
r.ListOpPending = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -4762,13 +4946,17 @@ func (r *RobustListHead) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (r *RobustListHead) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(r.SizeBytes()))
+func (r *RobustListHead) MarshalUnsafe(dst []byte) []byte {
+ size := r.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (r *RobustListHead) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(r.SizeBytes()))
+func (r *RobustListHead) UnmarshalUnsafe(src []byte) []byte {
+ size := r.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -4833,19 +5021,21 @@ func (d *DigestMetadata) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (d *DigestMetadata) MarshalBytes(dst []byte) {
+func (d *DigestMetadata) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(d.DigestAlgorithm))
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(d.DigestSize))
dst = dst[2:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (d *DigestMetadata) UnmarshalBytes(src []byte) {
+func (d *DigestMetadata) UnmarshalBytes(src []byte) []byte {
d.DigestAlgorithm = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
d.DigestSize = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -4855,13 +5045,17 @@ func (d *DigestMetadata) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (d *DigestMetadata) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(d), uintptr(d.SizeBytes()))
+func (d *DigestMetadata) MarshalUnsafe(dst []byte) []byte {
+ size := d.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(d), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (d *DigestMetadata) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(d), unsafe.Pointer(&src[0]), uintptr(d.SizeBytes()))
+func (d *DigestMetadata) UnmarshalUnsafe(src []byte) []byte {
+ size := d.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(d), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -4926,7 +5120,7 @@ func (i *IPCPerm) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *IPCPerm) MarshalBytes(dst []byte) {
+func (i *IPCPerm) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Key))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.UID))
@@ -4951,10 +5145,11 @@ func (i *IPCPerm) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.unused2))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *IPCPerm) UnmarshalBytes(src []byte) {
+func (i *IPCPerm) UnmarshalBytes(src []byte) []byte {
i.Key = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
i.UID = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -4979,6 +5174,7 @@ func (i *IPCPerm) UnmarshalBytes(src []byte) {
src = src[8:]
i.unused2 = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -4988,13 +5184,17 @@ func (i *IPCPerm) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *IPCPerm) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
+func (i *IPCPerm) MarshalUnsafe(dst []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *IPCPerm) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
+func (i *IPCPerm) UnmarshalUnsafe(src []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -5061,7 +5261,7 @@ func (s *Sysinfo) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *Sysinfo) MarshalBytes(dst []byte) {
+func (s *Sysinfo) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Uptime))
dst = dst[8:]
for idx := 0; idx < 3; idx++ {
@@ -5090,10 +5290,11 @@ func (s *Sysinfo) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Unit))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *Sysinfo) UnmarshalBytes(src []byte) {
+func (s *Sysinfo) UnmarshalBytes(src []byte) []byte {
s.Uptime = int64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
for idx := 0; idx < 3; idx++ {
@@ -5122,6 +5323,7 @@ func (s *Sysinfo) UnmarshalBytes(src []byte) {
src = src[8:]
s.Unit = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -5131,15 +5333,15 @@ func (s *Sysinfo) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *Sysinfo) MarshalUnsafe(dst []byte) {
+func (s *Sysinfo) MarshalUnsafe(dst []byte) []byte {
// Type Sysinfo doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *Sysinfo) UnmarshalUnsafe(src []byte) {
+func (s *Sysinfo) UnmarshalUnsafe(src []byte) []byte {
// Type Sysinfo doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -5185,13 +5387,15 @@ func (n *NumaPolicy) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (n *NumaPolicy) MarshalBytes(dst []byte) {
+func (n *NumaPolicy) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(*n))
+ return dst[4:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (n *NumaPolicy) UnmarshalBytes(src []byte) {
+func (n *NumaPolicy) UnmarshalBytes(src []byte) []byte {
*n = NumaPolicy(int32(hostarch.ByteOrder.Uint32(src[:4])))
+ return src[4:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -5202,13 +5406,17 @@ func (n *NumaPolicy) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (n *NumaPolicy) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(n.SizeBytes()))
+func (n *NumaPolicy) MarshalUnsafe(dst []byte) []byte {
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (n *NumaPolicy) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(n.SizeBytes()))
+func (n *NumaPolicy) UnmarshalUnsafe(src []byte) []byte {
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -5274,7 +5482,7 @@ func (m *MqAttr) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *MqAttr) MarshalBytes(dst []byte) {
+func (m *MqAttr) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqFlags))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqMaxmsg))
@@ -5285,10 +5493,11 @@ func (m *MqAttr) MarshalBytes(dst []byte) {
dst = dst[8:]
// Padding: dst[:sizeof(int64)*4] ~= [4]int64{0}
dst = dst[8*(4):]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *MqAttr) UnmarshalBytes(src []byte) {
+func (m *MqAttr) UnmarshalBytes(src []byte) []byte {
m.MqFlags = int64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
m.MqMaxmsg = int64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -5299,6 +5508,7 @@ func (m *MqAttr) UnmarshalBytes(src []byte) {
src = src[8:]
// Padding: ~ copy([4]int64(m._), src[:sizeof(int64)*4])
src = src[8*(4):]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -5308,13 +5518,17 @@ func (m *MqAttr) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (m *MqAttr) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(m.SizeBytes()))
+func (m *MqAttr) MarshalUnsafe(dst []byte) []byte {
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (m *MqAttr) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(m.SizeBytes()))
+func (m *MqAttr) UnmarshalUnsafe(src []byte) []byte {
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -5381,15 +5595,15 @@ func (b *MsgBuf) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (b *MsgBuf) MarshalUnsafe(dst []byte) {
+func (b *MsgBuf) MarshalUnsafe(dst []byte) []byte {
// Type MsgBuf doesn't have a packed layout in memory, fallback to MarshalBytes.
- b.MarshalBytes(dst)
+ return b.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (b *MsgBuf) UnmarshalUnsafe(src []byte) {
+func (b *MsgBuf) UnmarshalUnsafe(src []byte) []byte {
// Type MsgBuf doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- b.UnmarshalBytes(src)
+ return b.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -5434,7 +5648,7 @@ func (m *MsgInfo) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *MsgInfo) MarshalBytes(dst []byte) {
+func (m *MsgInfo) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgPool))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMap))
@@ -5451,10 +5665,11 @@ func (m *MsgInfo) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(m.MsgSeg))
dst = dst[2:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *MsgInfo) UnmarshalBytes(src []byte) {
+func (m *MsgInfo) UnmarshalBytes(src []byte) []byte {
m.MsgPool = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
m.MsgMap = int32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -5471,6 +5686,7 @@ func (m *MsgInfo) UnmarshalBytes(src []byte) {
src = src[4:]
m.MsgSeg = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -5480,15 +5696,15 @@ func (m *MsgInfo) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (m *MsgInfo) MarshalUnsafe(dst []byte) {
+func (m *MsgInfo) MarshalUnsafe(dst []byte) []byte {
// Type MsgInfo doesn't have a packed layout in memory, fallback to MarshalBytes.
- m.MarshalBytes(dst)
+ return m.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (m *MsgInfo) UnmarshalUnsafe(src []byte) {
+func (m *MsgInfo) UnmarshalUnsafe(src []byte) []byte {
// Type MsgInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- m.UnmarshalBytes(src)
+ return m.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -5537,15 +5753,11 @@ func (m *MsqidDS) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *MsqidDS) MarshalBytes(dst []byte) {
- m.MsgPerm.MarshalBytes(dst[:m.MsgPerm.SizeBytes()])
- dst = dst[m.MsgPerm.SizeBytes():]
- m.MsgStime.MarshalBytes(dst[:m.MsgStime.SizeBytes()])
- dst = dst[m.MsgStime.SizeBytes():]
- m.MsgRtime.MarshalBytes(dst[:m.MsgRtime.SizeBytes()])
- dst = dst[m.MsgRtime.SizeBytes():]
- m.MsgCtime.MarshalBytes(dst[:m.MsgCtime.SizeBytes()])
- dst = dst[m.MsgCtime.SizeBytes():]
+func (m *MsqidDS) MarshalBytes(dst []byte) []byte {
+ dst = m.MsgPerm.MarshalBytes(dst)
+ dst = m.MsgStime.MarshalBytes(dst)
+ dst = m.MsgRtime.MarshalBytes(dst)
+ dst = m.MsgCtime.MarshalBytes(dst)
hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgCbytes))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgQnum))
@@ -5560,18 +5772,15 @@ func (m *MsqidDS) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.unused5))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *MsqidDS) UnmarshalBytes(src []byte) {
- m.MsgPerm.UnmarshalBytes(src[:m.MsgPerm.SizeBytes()])
- src = src[m.MsgPerm.SizeBytes():]
- m.MsgStime.UnmarshalBytes(src[:m.MsgStime.SizeBytes()])
- src = src[m.MsgStime.SizeBytes():]
- m.MsgRtime.UnmarshalBytes(src[:m.MsgRtime.SizeBytes()])
- src = src[m.MsgRtime.SizeBytes():]
- m.MsgCtime.UnmarshalBytes(src[:m.MsgCtime.SizeBytes()])
- src = src[m.MsgCtime.SizeBytes():]
+func (m *MsqidDS) UnmarshalBytes(src []byte) []byte {
+ src = m.MsgPerm.UnmarshalBytes(src)
+ src = m.MsgStime.UnmarshalBytes(src)
+ src = m.MsgRtime.UnmarshalBytes(src)
+ src = m.MsgCtime.UnmarshalBytes(src)
m.MsgCbytes = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
m.MsgQnum = uint64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -5586,6 +5795,7 @@ func (m *MsqidDS) UnmarshalBytes(src []byte) {
src = src[8:]
m.unused5 = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -5595,23 +5805,25 @@ func (m *MsqidDS) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (m *MsqidDS) MarshalUnsafe(dst []byte) {
+func (m *MsqidDS) MarshalUnsafe(dst []byte) []byte {
if m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(m.SizeBytes()))
- } else {
- // Type MsqidDS doesn't have a packed layout in memory, fallback to MarshalBytes.
- m.MarshalBytes(dst)
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size))
+ return dst[size:]
}
+ // Type MsqidDS doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return m.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (m *MsqidDS) UnmarshalUnsafe(src []byte) {
+func (m *MsqidDS) UnmarshalUnsafe(src []byte) []byte {
if m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() {
- gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(m.SizeBytes()))
- } else {
- // Type MsqidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- m.UnmarshalBytes(src)
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type MsqidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return m.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -5702,23 +5914,25 @@ func (i *IFConf) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *IFConf) MarshalBytes(dst []byte) {
+func (i *IFConf) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Len))
dst = dst[4:]
// Padding: dst[:sizeof(byte)*4] ~= [4]byte{0}
dst = dst[1*(4):]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Ptr))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *IFConf) UnmarshalBytes(src []byte) {
+func (i *IFConf) UnmarshalBytes(src []byte) []byte {
i.Len = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
// Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4])
src = src[1*(4):]
i.Ptr = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -5728,13 +5942,17 @@ func (i *IFConf) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *IFConf) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
+func (i *IFConf) MarshalUnsafe(dst []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *IFConf) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
+func (i *IFConf) UnmarshalUnsafe(src []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -5801,7 +6019,7 @@ func (ifr *IFReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (ifr *IFReq) MarshalBytes(dst []byte) {
+func (ifr *IFReq) MarshalBytes(dst []byte) []byte {
for idx := 0; idx < IFNAMSIZ; idx++ {
dst[0] = byte(ifr.IFName[idx])
dst = dst[1:]
@@ -5810,10 +6028,11 @@ func (ifr *IFReq) MarshalBytes(dst []byte) {
dst[0] = byte(ifr.Data[idx])
dst = dst[1:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (ifr *IFReq) UnmarshalBytes(src []byte) {
+func (ifr *IFReq) UnmarshalBytes(src []byte) []byte {
for idx := 0; idx < IFNAMSIZ; idx++ {
ifr.IFName[idx] = src[0]
src = src[1:]
@@ -5822,6 +6041,7 @@ func (ifr *IFReq) UnmarshalBytes(src []byte) {
ifr.Data[idx] = src[0]
src = src[1:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -5831,13 +6051,17 @@ func (ifr *IFReq) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (ifr *IFReq) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(ifr), uintptr(ifr.SizeBytes()))
+func (ifr *IFReq) MarshalUnsafe(dst []byte) []byte {
+ size := ifr.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(ifr), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (ifr *IFReq) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(ifr), unsafe.Pointer(&src[0]), uintptr(ifr.SizeBytes()))
+func (ifr *IFReq) UnmarshalUnsafe(src []byte) []byte {
+ size := ifr.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(ifr), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -5903,19 +6127,21 @@ func (en *ErrorName) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (en *ErrorName) MarshalBytes(dst []byte) {
+func (en *ErrorName) MarshalBytes(dst []byte) []byte {
for idx := 0; idx < XT_FUNCTION_MAXNAMELEN; idx++ {
dst[0] = byte(en[idx])
dst = dst[1:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (en *ErrorName) UnmarshalBytes(src []byte) {
+func (en *ErrorName) UnmarshalBytes(src []byte) []byte {
for idx := 0; idx < XT_FUNCTION_MAXNAMELEN; idx++ {
en[idx] = src[0]
src = src[1:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -5926,13 +6152,17 @@ func (en *ErrorName) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (en *ErrorName) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&en[0]), uintptr(en.SizeBytes()))
+func (en *ErrorName) MarshalUnsafe(dst []byte) []byte {
+ size := en.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&en[0]), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (en *ErrorName) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(en), unsafe.Pointer(&src[0]), uintptr(en.SizeBytes()))
+func (en *ErrorName) UnmarshalUnsafe(src []byte) []byte {
+ size := en.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(en), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -5998,19 +6228,21 @@ func (en *ExtensionName) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (en *ExtensionName) MarshalBytes(dst []byte) {
+func (en *ExtensionName) MarshalBytes(dst []byte) []byte {
for idx := 0; idx < XT_EXTENSION_MAXNAMELEN; idx++ {
dst[0] = byte(en[idx])
dst = dst[1:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (en *ExtensionName) UnmarshalBytes(src []byte) {
+func (en *ExtensionName) UnmarshalBytes(src []byte) []byte {
for idx := 0; idx < XT_EXTENSION_MAXNAMELEN; idx++ {
en[idx] = src[0]
src = src[1:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -6021,13 +6253,17 @@ func (en *ExtensionName) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (en *ExtensionName) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&en[0]), uintptr(en.SizeBytes()))
+func (en *ExtensionName) MarshalUnsafe(dst []byte) []byte {
+ size := en.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&en[0]), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (en *ExtensionName) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(en), unsafe.Pointer(&src[0]), uintptr(en.SizeBytes()))
+func (en *ExtensionName) UnmarshalUnsafe(src []byte) []byte {
+ size := en.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(en), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -6094,9 +6330,8 @@ func (i *IPTEntry) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *IPTEntry) MarshalBytes(dst []byte) {
- i.IP.MarshalBytes(dst[:i.IP.SizeBytes()])
- dst = dst[i.IP.SizeBytes():]
+func (i *IPTEntry) MarshalBytes(dst []byte) []byte {
+ dst = i.IP.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NFCache))
dst = dst[4:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.TargetOffset))
@@ -6105,14 +6340,13 @@ func (i *IPTEntry) MarshalBytes(dst []byte) {
dst = dst[2:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Comeback))
dst = dst[4:]
- i.Counters.MarshalBytes(dst[:i.Counters.SizeBytes()])
- dst = dst[i.Counters.SizeBytes():]
+ dst = i.Counters.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *IPTEntry) UnmarshalBytes(src []byte) {
- i.IP.UnmarshalBytes(src[:i.IP.SizeBytes()])
- src = src[i.IP.SizeBytes():]
+func (i *IPTEntry) UnmarshalBytes(src []byte) []byte {
+ src = i.IP.UnmarshalBytes(src)
i.NFCache = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
i.TargetOffset = uint16(hostarch.ByteOrder.Uint16(src[:2]))
@@ -6121,8 +6355,8 @@ func (i *IPTEntry) UnmarshalBytes(src []byte) {
src = src[2:]
i.Comeback = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
- i.Counters.UnmarshalBytes(src[:i.Counters.SizeBytes()])
- src = src[i.Counters.SizeBytes():]
+ src = i.Counters.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -6132,23 +6366,25 @@ func (i *IPTEntry) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *IPTEntry) MarshalUnsafe(dst []byte) {
+func (i *IPTEntry) MarshalUnsafe(dst []byte) []byte {
if i.Counters.Packed() && i.IP.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
- } else {
- // Type IPTEntry doesn't have a packed layout in memory, fallback to MarshalBytes.
- i.MarshalBytes(dst)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
+ // Type IPTEntry doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return i.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *IPTEntry) UnmarshalUnsafe(src []byte) {
+func (i *IPTEntry) UnmarshalUnsafe(src []byte) []byte {
if i.Counters.Packed() && i.IP.Packed() {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
- } else {
- // Type IPTEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- i.UnmarshalBytes(src)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type IPTEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return i.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -6240,23 +6476,23 @@ func (i *IPTGetEntries) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *IPTGetEntries) MarshalBytes(dst []byte) {
- i.Name.MarshalBytes(dst[:i.Name.SizeBytes()])
- dst = dst[i.Name.SizeBytes():]
+func (i *IPTGetEntries) MarshalBytes(dst []byte) []byte {
+ dst = i.Name.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size))
dst = dst[4:]
// Padding: dst[:sizeof(byte)*4] ~= [4]byte{0}
dst = dst[1*(4):]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *IPTGetEntries) UnmarshalBytes(src []byte) {
- i.Name.UnmarshalBytes(src[:i.Name.SizeBytes()])
- src = src[i.Name.SizeBytes():]
+func (i *IPTGetEntries) UnmarshalBytes(src []byte) []byte {
+ src = i.Name.UnmarshalBytes(src)
i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
// Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4])
src = src[1*(4):]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -6266,23 +6502,25 @@ func (i *IPTGetEntries) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *IPTGetEntries) MarshalUnsafe(dst []byte) {
+func (i *IPTGetEntries) MarshalUnsafe(dst []byte) []byte {
if i.Name.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
- } else {
- // Type IPTGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes.
- i.MarshalBytes(dst)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
+ // Type IPTGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return i.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *IPTGetEntries) UnmarshalUnsafe(src []byte) {
+func (i *IPTGetEntries) UnmarshalUnsafe(src []byte) []byte {
if i.Name.Packed() {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
- } else {
- // Type IPTGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- i.UnmarshalBytes(src)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type IPTGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return i.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -6375,9 +6613,8 @@ func (i *IPTGetinfo) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *IPTGetinfo) MarshalBytes(dst []byte) {
- i.Name.MarshalBytes(dst[:i.Name.SizeBytes()])
- dst = dst[i.Name.SizeBytes():]
+func (i *IPTGetinfo) MarshalBytes(dst []byte) []byte {
+ dst = i.Name.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks))
dst = dst[4:]
for idx := 0; idx < NF_INET_NUMHOOKS; idx++ {
@@ -6392,12 +6629,12 @@ func (i *IPTGetinfo) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *IPTGetinfo) UnmarshalBytes(src []byte) {
- i.Name.UnmarshalBytes(src[:i.Name.SizeBytes()])
- src = src[i.Name.SizeBytes():]
+func (i *IPTGetinfo) UnmarshalBytes(src []byte) []byte {
+ src = i.Name.UnmarshalBytes(src)
i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
for idx := 0; idx < NF_INET_NUMHOOKS; idx++ {
@@ -6412,6 +6649,7 @@ func (i *IPTGetinfo) UnmarshalBytes(src []byte) {
src = src[4:]
i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -6421,23 +6659,25 @@ func (i *IPTGetinfo) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *IPTGetinfo) MarshalUnsafe(dst []byte) {
+func (i *IPTGetinfo) MarshalUnsafe(dst []byte) []byte {
if i.Name.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
- } else {
- // Type IPTGetinfo doesn't have a packed layout in memory, fallback to MarshalBytes.
- i.MarshalBytes(dst)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
+ // Type IPTGetinfo doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return i.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *IPTGetinfo) UnmarshalUnsafe(src []byte) {
+func (i *IPTGetinfo) UnmarshalUnsafe(src []byte) []byte {
if i.Name.Packed() {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
- } else {
- // Type IPTGetinfo doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- i.UnmarshalBytes(src)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type IPTGetinfo doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return i.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -6535,15 +6775,11 @@ func (i *IPTIP) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *IPTIP) MarshalBytes(dst []byte) {
- i.Src.MarshalBytes(dst[:i.Src.SizeBytes()])
- dst = dst[i.Src.SizeBytes():]
- i.Dst.MarshalBytes(dst[:i.Dst.SizeBytes()])
- dst = dst[i.Dst.SizeBytes():]
- i.SrcMask.MarshalBytes(dst[:i.SrcMask.SizeBytes()])
- dst = dst[i.SrcMask.SizeBytes():]
- i.DstMask.MarshalBytes(dst[:i.DstMask.SizeBytes()])
- dst = dst[i.DstMask.SizeBytes():]
+func (i *IPTIP) MarshalBytes(dst []byte) []byte {
+ dst = i.Src.MarshalBytes(dst)
+ dst = i.Dst.MarshalBytes(dst)
+ dst = i.SrcMask.MarshalBytes(dst)
+ dst = i.DstMask.MarshalBytes(dst)
for idx := 0; idx < IFNAMSIZ; idx++ {
dst[0] = byte(i.InputInterface[idx])
dst = dst[1:]
@@ -6566,18 +6802,15 @@ func (i *IPTIP) MarshalBytes(dst []byte) {
dst = dst[1:]
dst[0] = byte(i.InverseFlags)
dst = dst[1:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *IPTIP) UnmarshalBytes(src []byte) {
- i.Src.UnmarshalBytes(src[:i.Src.SizeBytes()])
- src = src[i.Src.SizeBytes():]
- i.Dst.UnmarshalBytes(src[:i.Dst.SizeBytes()])
- src = src[i.Dst.SizeBytes():]
- i.SrcMask.UnmarshalBytes(src[:i.SrcMask.SizeBytes()])
- src = src[i.SrcMask.SizeBytes():]
- i.DstMask.UnmarshalBytes(src[:i.DstMask.SizeBytes()])
- src = src[i.DstMask.SizeBytes():]
+func (i *IPTIP) UnmarshalBytes(src []byte) []byte {
+ src = i.Src.UnmarshalBytes(src)
+ src = i.Dst.UnmarshalBytes(src)
+ src = i.SrcMask.UnmarshalBytes(src)
+ src = i.DstMask.UnmarshalBytes(src)
for idx := 0; idx < IFNAMSIZ; idx++ {
i.InputInterface[idx] = src[0]
src = src[1:]
@@ -6600,6 +6833,7 @@ func (i *IPTIP) UnmarshalBytes(src []byte) {
src = src[1:]
i.InverseFlags = uint8(src[0])
src = src[1:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -6609,23 +6843,25 @@ func (i *IPTIP) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *IPTIP) MarshalUnsafe(dst []byte) {
+func (i *IPTIP) MarshalUnsafe(dst []byte) []byte {
if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
- } else {
- // Type IPTIP doesn't have a packed layout in memory, fallback to MarshalBytes.
- i.MarshalBytes(dst)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
+ // Type IPTIP doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return i.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *IPTIP) UnmarshalUnsafe(src []byte) {
+func (i *IPTIP) UnmarshalUnsafe(src []byte) []byte {
if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
- } else {
- // Type IPTIP doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- i.UnmarshalBytes(src)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type IPTIP doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return i.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -6716,7 +6952,7 @@ func (i *IPTOwnerInfo) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *IPTOwnerInfo) MarshalBytes(dst []byte) {
+func (i *IPTOwnerInfo) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.UID))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.GID))
@@ -6733,10 +6969,11 @@ func (i *IPTOwnerInfo) MarshalBytes(dst []byte) {
dst = dst[1:]
dst[0] = byte(i.Invert)
dst = dst[1:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *IPTOwnerInfo) UnmarshalBytes(src []byte) {
+func (i *IPTOwnerInfo) UnmarshalBytes(src []byte) []byte {
i.UID = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
i.GID = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -6753,6 +6990,7 @@ func (i *IPTOwnerInfo) UnmarshalBytes(src []byte) {
src = src[1:]
i.Invert = uint8(src[0])
src = src[1:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -6762,15 +7000,15 @@ func (i *IPTOwnerInfo) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *IPTOwnerInfo) MarshalUnsafe(dst []byte) {
+func (i *IPTOwnerInfo) MarshalUnsafe(dst []byte) []byte {
// Type IPTOwnerInfo doesn't have a packed layout in memory, fallback to MarshalBytes.
- i.MarshalBytes(dst)
+ return i.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *IPTOwnerInfo) UnmarshalUnsafe(src []byte) {
+func (i *IPTOwnerInfo) UnmarshalUnsafe(src []byte) []byte {
// Type IPTOwnerInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- i.UnmarshalBytes(src)
+ return i.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -6818,9 +7056,8 @@ func (i *IPTReplace) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *IPTReplace) MarshalBytes(dst []byte) {
- i.Name.MarshalBytes(dst[:i.Name.SizeBytes()])
- dst = dst[i.Name.SizeBytes():]
+func (i *IPTReplace) MarshalBytes(dst []byte) []byte {
+ dst = i.Name.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries))
@@ -6839,12 +7076,12 @@ func (i *IPTReplace) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Counters))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *IPTReplace) UnmarshalBytes(src []byte) {
- i.Name.UnmarshalBytes(src[:i.Name.SizeBytes()])
- src = src[i.Name.SizeBytes():]
+func (i *IPTReplace) UnmarshalBytes(src []byte) []byte {
+ src = i.Name.UnmarshalBytes(src)
i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -6863,6 +7100,7 @@ func (i *IPTReplace) UnmarshalBytes(src []byte) {
src = src[4:]
i.Counters = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -6872,23 +7110,25 @@ func (i *IPTReplace) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *IPTReplace) MarshalUnsafe(dst []byte) {
+func (i *IPTReplace) MarshalUnsafe(dst []byte) []byte {
if i.Name.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
- } else {
- // Type IPTReplace doesn't have a packed layout in memory, fallback to MarshalBytes.
- i.MarshalBytes(dst)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
+ // Type IPTReplace doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return i.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *IPTReplace) UnmarshalUnsafe(src []byte) {
+func (i *IPTReplace) UnmarshalUnsafe(src []byte) []byte {
if i.Name.Packed() {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
- } else {
- // Type IPTReplace doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- i.UnmarshalBytes(src)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type IPTReplace doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return i.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -6980,15 +7220,15 @@ func (ke *KernelIPTEntry) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (ke *KernelIPTEntry) MarshalUnsafe(dst []byte) {
+func (ke *KernelIPTEntry) MarshalUnsafe(dst []byte) []byte {
// Type KernelIPTEntry doesn't have a packed layout in memory, fallback to MarshalBytes.
- ke.MarshalBytes(dst)
+ return ke.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (ke *KernelIPTEntry) UnmarshalUnsafe(src []byte) {
+func (ke *KernelIPTEntry) UnmarshalUnsafe(src []byte) []byte {
// Type KernelIPTEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- ke.UnmarshalBytes(src)
+ return ke.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -7035,15 +7275,15 @@ func (ke *KernelIPTGetEntries) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (ke *KernelIPTGetEntries) MarshalUnsafe(dst []byte) {
+func (ke *KernelIPTGetEntries) MarshalUnsafe(dst []byte) []byte {
// Type KernelIPTGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes.
- ke.MarshalBytes(dst)
+ return ke.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (ke *KernelIPTGetEntries) UnmarshalUnsafe(src []byte) {
+func (ke *KernelIPTGetEntries) UnmarshalUnsafe(src []byte) []byte {
// Type KernelIPTGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- ke.UnmarshalBytes(src)
+ return ke.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -7089,19 +7329,19 @@ func (n *NfNATIPV4MultiRangeCompat) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (n *NfNATIPV4MultiRangeCompat) MarshalBytes(dst []byte) {
+func (n *NfNATIPV4MultiRangeCompat) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.RangeSize))
dst = dst[4:]
- n.RangeIPV4.MarshalBytes(dst[:n.RangeIPV4.SizeBytes()])
- dst = dst[n.RangeIPV4.SizeBytes():]
+ dst = n.RangeIPV4.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (n *NfNATIPV4MultiRangeCompat) UnmarshalBytes(src []byte) {
+func (n *NfNATIPV4MultiRangeCompat) UnmarshalBytes(src []byte) []byte {
n.RangeSize = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
- n.RangeIPV4.UnmarshalBytes(src[:n.RangeIPV4.SizeBytes()])
- src = src[n.RangeIPV4.SizeBytes():]
+ src = n.RangeIPV4.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -7111,23 +7351,25 @@ func (n *NfNATIPV4MultiRangeCompat) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (n *NfNATIPV4MultiRangeCompat) MarshalUnsafe(dst []byte) {
+func (n *NfNATIPV4MultiRangeCompat) MarshalUnsafe(dst []byte) []byte {
if n.RangeIPV4.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(n.SizeBytes()))
- } else {
- // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fallback to MarshalBytes.
- n.MarshalBytes(dst)
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size))
+ return dst[size:]
}
+ // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return n.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (n *NfNATIPV4MultiRangeCompat) UnmarshalUnsafe(src []byte) {
+func (n *NfNATIPV4MultiRangeCompat) UnmarshalUnsafe(src []byte) []byte {
if n.RangeIPV4.Packed() {
- gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(n.SizeBytes()))
- } else {
- // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- n.UnmarshalBytes(src)
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return n.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -7219,7 +7461,7 @@ func (n *NfNATIPV4Range) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (n *NfNATIPV4Range) MarshalBytes(dst []byte) {
+func (n *NfNATIPV4Range) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Flags))
dst = dst[4:]
for idx := 0; idx < 4; idx++ {
@@ -7234,10 +7476,11 @@ func (n *NfNATIPV4Range) MarshalBytes(dst []byte) {
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MaxPort))
dst = dst[2:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (n *NfNATIPV4Range) UnmarshalBytes(src []byte) {
+func (n *NfNATIPV4Range) UnmarshalBytes(src []byte) []byte {
n.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
for idx := 0; idx < 4; idx++ {
@@ -7252,6 +7495,7 @@ func (n *NfNATIPV4Range) UnmarshalBytes(src []byte) {
src = src[2:]
n.MaxPort = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -7261,13 +7505,17 @@ func (n *NfNATIPV4Range) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (n *NfNATIPV4Range) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(n.SizeBytes()))
+func (n *NfNATIPV4Range) MarshalUnsafe(dst []byte) []byte {
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (n *NfNATIPV4Range) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(n.SizeBytes()))
+func (n *NfNATIPV4Range) UnmarshalUnsafe(src []byte) []byte {
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -7333,19 +7581,21 @@ func (tn *TableName) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (tn *TableName) MarshalBytes(dst []byte) {
+func (tn *TableName) MarshalBytes(dst []byte) []byte {
for idx := 0; idx < XT_TABLE_MAXNAMELEN; idx++ {
dst[0] = byte(tn[idx])
dst = dst[1:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (tn *TableName) UnmarshalBytes(src []byte) {
+func (tn *TableName) UnmarshalBytes(src []byte) []byte {
for idx := 0; idx < XT_TABLE_MAXNAMELEN; idx++ {
tn[idx] = src[0]
src = src[1:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -7356,13 +7606,17 @@ func (tn *TableName) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (tn *TableName) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&tn[0]), uintptr(tn.SizeBytes()))
+func (tn *TableName) MarshalUnsafe(dst []byte) []byte {
+ size := tn.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&tn[0]), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (tn *TableName) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(tn), unsafe.Pointer(&src[0]), uintptr(tn.SizeBytes()))
+func (tn *TableName) UnmarshalUnsafe(src []byte) []byte {
+ size := tn.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(tn), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -7427,19 +7681,21 @@ func (x *XTCounters) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (x *XTCounters) MarshalBytes(dst []byte) {
+func (x *XTCounters) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(x.Pcnt))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(x.Bcnt))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (x *XTCounters) UnmarshalBytes(src []byte) {
+func (x *XTCounters) UnmarshalBytes(src []byte) []byte {
x.Pcnt = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
x.Bcnt = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -7449,13 +7705,17 @@ func (x *XTCounters) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (x *XTCounters) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(x.SizeBytes()))
+func (x *XTCounters) MarshalUnsafe(dst []byte) []byte {
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (x *XTCounters) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(x.SizeBytes()))
+func (x *XTCounters) UnmarshalUnsafe(src []byte) []byte {
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -7521,23 +7781,23 @@ func (x *XTEntryMatch) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (x *XTEntryMatch) MarshalBytes(dst []byte) {
+func (x *XTEntryMatch) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.MatchSize))
dst = dst[2:]
- x.Name.MarshalBytes(dst[:x.Name.SizeBytes()])
- dst = dst[x.Name.SizeBytes():]
+ dst = x.Name.MarshalBytes(dst)
dst[0] = byte(x.Revision)
dst = dst[1:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (x *XTEntryMatch) UnmarshalBytes(src []byte) {
+func (x *XTEntryMatch) UnmarshalBytes(src []byte) []byte {
x.MatchSize = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
- x.Name.UnmarshalBytes(src[:x.Name.SizeBytes()])
- src = src[x.Name.SizeBytes():]
+ src = x.Name.UnmarshalBytes(src)
x.Revision = uint8(src[0])
src = src[1:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -7547,23 +7807,25 @@ func (x *XTEntryMatch) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (x *XTEntryMatch) MarshalUnsafe(dst []byte) {
+func (x *XTEntryMatch) MarshalUnsafe(dst []byte) []byte {
if x.Name.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(x.SizeBytes()))
- } else {
- // Type XTEntryMatch doesn't have a packed layout in memory, fallback to MarshalBytes.
- x.MarshalBytes(dst)
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size))
+ return dst[size:]
}
+ // Type XTEntryMatch doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return x.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (x *XTEntryMatch) UnmarshalUnsafe(src []byte) {
+func (x *XTEntryMatch) UnmarshalUnsafe(src []byte) []byte {
if x.Name.Packed() {
- gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(x.SizeBytes()))
- } else {
- // Type XTEntryMatch doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- x.UnmarshalBytes(src)
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type XTEntryMatch doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return x.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -7654,23 +7916,23 @@ func (x *XTEntryTarget) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (x *XTEntryTarget) MarshalBytes(dst []byte) {
+func (x *XTEntryTarget) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.TargetSize))
dst = dst[2:]
- x.Name.MarshalBytes(dst[:x.Name.SizeBytes()])
- dst = dst[x.Name.SizeBytes():]
+ dst = x.Name.MarshalBytes(dst)
dst[0] = byte(x.Revision)
dst = dst[1:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (x *XTEntryTarget) UnmarshalBytes(src []byte) {
+func (x *XTEntryTarget) UnmarshalBytes(src []byte) []byte {
x.TargetSize = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
- x.Name.UnmarshalBytes(src[:x.Name.SizeBytes()])
- src = src[x.Name.SizeBytes():]
+ src = x.Name.UnmarshalBytes(src)
x.Revision = uint8(src[0])
src = src[1:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -7680,23 +7942,25 @@ func (x *XTEntryTarget) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (x *XTEntryTarget) MarshalUnsafe(dst []byte) {
+func (x *XTEntryTarget) MarshalUnsafe(dst []byte) []byte {
if x.Name.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(x.SizeBytes()))
- } else {
- // Type XTEntryTarget doesn't have a packed layout in memory, fallback to MarshalBytes.
- x.MarshalBytes(dst)
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size))
+ return dst[size:]
}
+ // Type XTEntryTarget doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return x.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (x *XTEntryTarget) UnmarshalUnsafe(src []byte) {
+func (x *XTEntryTarget) UnmarshalUnsafe(src []byte) []byte {
if x.Name.Packed() {
- gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(x.SizeBytes()))
- } else {
- // Type XTEntryTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- x.UnmarshalBytes(src)
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type XTEntryTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return x.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -7789,23 +8053,21 @@ func (x *XTErrorTarget) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (x *XTErrorTarget) MarshalBytes(dst []byte) {
- x.Target.MarshalBytes(dst[:x.Target.SizeBytes()])
- dst = dst[x.Target.SizeBytes():]
- x.Name.MarshalBytes(dst[:x.Name.SizeBytes()])
- dst = dst[x.Name.SizeBytes():]
+func (x *XTErrorTarget) MarshalBytes(dst []byte) []byte {
+ dst = x.Target.MarshalBytes(dst)
+ dst = x.Name.MarshalBytes(dst)
// Padding: dst[:sizeof(byte)*2] ~= [2]byte{0}
dst = dst[1*(2):]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (x *XTErrorTarget) UnmarshalBytes(src []byte) {
- x.Target.UnmarshalBytes(src[:x.Target.SizeBytes()])
- src = src[x.Target.SizeBytes():]
- x.Name.UnmarshalBytes(src[:x.Name.SizeBytes()])
- src = src[x.Name.SizeBytes():]
+func (x *XTErrorTarget) UnmarshalBytes(src []byte) []byte {
+ src = x.Target.UnmarshalBytes(src)
+ src = x.Name.UnmarshalBytes(src)
// Padding: ~ copy([2]byte(x._), src[:sizeof(byte)*2])
src = src[1*(2):]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -7815,23 +8077,25 @@ func (x *XTErrorTarget) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (x *XTErrorTarget) MarshalUnsafe(dst []byte) {
+func (x *XTErrorTarget) MarshalUnsafe(dst []byte) []byte {
if x.Name.Packed() && x.Target.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(x.SizeBytes()))
- } else {
- // Type XTErrorTarget doesn't have a packed layout in memory, fallback to MarshalBytes.
- x.MarshalBytes(dst)
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size))
+ return dst[size:]
}
+ // Type XTErrorTarget doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return x.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (x *XTErrorTarget) UnmarshalUnsafe(src []byte) {
+func (x *XTErrorTarget) UnmarshalUnsafe(src []byte) []byte {
if x.Name.Packed() && x.Target.Packed() {
- gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(x.SizeBytes()))
- } else {
- // Type XTErrorTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- x.UnmarshalBytes(src)
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type XTErrorTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return x.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -7922,19 +8186,19 @@ func (x *XTGetRevision) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (x *XTGetRevision) MarshalBytes(dst []byte) {
- x.Name.MarshalBytes(dst[:x.Name.SizeBytes()])
- dst = dst[x.Name.SizeBytes():]
+func (x *XTGetRevision) MarshalBytes(dst []byte) []byte {
+ dst = x.Name.MarshalBytes(dst)
dst[0] = byte(x.Revision)
dst = dst[1:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (x *XTGetRevision) UnmarshalBytes(src []byte) {
- x.Name.UnmarshalBytes(src[:x.Name.SizeBytes()])
- src = src[x.Name.SizeBytes():]
+func (x *XTGetRevision) UnmarshalBytes(src []byte) []byte {
+ src = x.Name.UnmarshalBytes(src)
x.Revision = uint8(src[0])
src = src[1:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -7944,23 +8208,25 @@ func (x *XTGetRevision) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (x *XTGetRevision) MarshalUnsafe(dst []byte) {
+func (x *XTGetRevision) MarshalUnsafe(dst []byte) []byte {
if x.Name.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(x.SizeBytes()))
- } else {
- // Type XTGetRevision doesn't have a packed layout in memory, fallback to MarshalBytes.
- x.MarshalBytes(dst)
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size))
+ return dst[size:]
}
+ // Type XTGetRevision doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return x.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (x *XTGetRevision) UnmarshalUnsafe(src []byte) {
+func (x *XTGetRevision) UnmarshalUnsafe(src []byte) []byte {
if x.Name.Packed() {
- gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(x.SizeBytes()))
- } else {
- // Type XTGetRevision doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- x.UnmarshalBytes(src)
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type XTGetRevision doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return x.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -8053,23 +8319,21 @@ func (x *XTRedirectTarget) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (x *XTRedirectTarget) MarshalBytes(dst []byte) {
- x.Target.MarshalBytes(dst[:x.Target.SizeBytes()])
- dst = dst[x.Target.SizeBytes():]
- x.NfRange.MarshalBytes(dst[:x.NfRange.SizeBytes()])
- dst = dst[x.NfRange.SizeBytes():]
+func (x *XTRedirectTarget) MarshalBytes(dst []byte) []byte {
+ dst = x.Target.MarshalBytes(dst)
+ dst = x.NfRange.MarshalBytes(dst)
// Padding: dst[:sizeof(byte)*4] ~= [4]byte{0}
dst = dst[1*(4):]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (x *XTRedirectTarget) UnmarshalBytes(src []byte) {
- x.Target.UnmarshalBytes(src[:x.Target.SizeBytes()])
- src = src[x.Target.SizeBytes():]
- x.NfRange.UnmarshalBytes(src[:x.NfRange.SizeBytes()])
- src = src[x.NfRange.SizeBytes():]
+func (x *XTRedirectTarget) UnmarshalBytes(src []byte) []byte {
+ src = x.Target.UnmarshalBytes(src)
+ src = x.NfRange.UnmarshalBytes(src)
// Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4])
src = src[1*(4):]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -8079,23 +8343,25 @@ func (x *XTRedirectTarget) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (x *XTRedirectTarget) MarshalUnsafe(dst []byte) {
+func (x *XTRedirectTarget) MarshalUnsafe(dst []byte) []byte {
if x.NfRange.Packed() && x.Target.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(x.SizeBytes()))
- } else {
- // Type XTRedirectTarget doesn't have a packed layout in memory, fallback to MarshalBytes.
- x.MarshalBytes(dst)
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size))
+ return dst[size:]
}
+ // Type XTRedirectTarget doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return x.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (x *XTRedirectTarget) UnmarshalUnsafe(src []byte) {
+func (x *XTRedirectTarget) UnmarshalUnsafe(src []byte) []byte {
if x.NfRange.Packed() && x.Target.Packed() {
- gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(x.SizeBytes()))
- } else {
- // Type XTRedirectTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- x.UnmarshalBytes(src)
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type XTRedirectTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return x.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -8188,23 +8454,21 @@ func (x *XTSNATTarget) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (x *XTSNATTarget) MarshalBytes(dst []byte) {
- x.Target.MarshalBytes(dst[:x.Target.SizeBytes()])
- dst = dst[x.Target.SizeBytes():]
- x.NfRange.MarshalBytes(dst[:x.NfRange.SizeBytes()])
- dst = dst[x.NfRange.SizeBytes():]
+func (x *XTSNATTarget) MarshalBytes(dst []byte) []byte {
+ dst = x.Target.MarshalBytes(dst)
+ dst = x.NfRange.MarshalBytes(dst)
// Padding: dst[:sizeof(byte)*4] ~= [4]byte{0}
dst = dst[1*(4):]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (x *XTSNATTarget) UnmarshalBytes(src []byte) {
- x.Target.UnmarshalBytes(src[:x.Target.SizeBytes()])
- src = src[x.Target.SizeBytes():]
- x.NfRange.UnmarshalBytes(src[:x.NfRange.SizeBytes()])
- src = src[x.NfRange.SizeBytes():]
+func (x *XTSNATTarget) UnmarshalBytes(src []byte) []byte {
+ src = x.Target.UnmarshalBytes(src)
+ src = x.NfRange.UnmarshalBytes(src)
// Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4])
src = src[1*(4):]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -8214,23 +8478,25 @@ func (x *XTSNATTarget) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (x *XTSNATTarget) MarshalUnsafe(dst []byte) {
+func (x *XTSNATTarget) MarshalUnsafe(dst []byte) []byte {
if x.NfRange.Packed() && x.Target.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(x.SizeBytes()))
- } else {
- // Type XTSNATTarget doesn't have a packed layout in memory, fallback to MarshalBytes.
- x.MarshalBytes(dst)
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size))
+ return dst[size:]
}
+ // Type XTSNATTarget doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return x.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (x *XTSNATTarget) UnmarshalUnsafe(src []byte) {
+func (x *XTSNATTarget) UnmarshalUnsafe(src []byte) []byte {
if x.NfRange.Packed() && x.Target.Packed() {
- gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(x.SizeBytes()))
- } else {
- // Type XTSNATTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- x.UnmarshalBytes(src)
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type XTSNATTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return x.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -8322,23 +8588,23 @@ func (x *XTStandardTarget) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (x *XTStandardTarget) MarshalBytes(dst []byte) {
- x.Target.MarshalBytes(dst[:x.Target.SizeBytes()])
- dst = dst[x.Target.SizeBytes():]
+func (x *XTStandardTarget) MarshalBytes(dst []byte) []byte {
+ dst = x.Target.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(x.Verdict))
dst = dst[4:]
// Padding: dst[:sizeof(byte)*4] ~= [4]byte{0}
dst = dst[1*(4):]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (x *XTStandardTarget) UnmarshalBytes(src []byte) {
- x.Target.UnmarshalBytes(src[:x.Target.SizeBytes()])
- src = src[x.Target.SizeBytes():]
+func (x *XTStandardTarget) UnmarshalBytes(src []byte) []byte {
+ src = x.Target.UnmarshalBytes(src)
x.Verdict = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
// Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4])
src = src[1*(4):]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -8348,23 +8614,25 @@ func (x *XTStandardTarget) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (x *XTStandardTarget) MarshalUnsafe(dst []byte) {
+func (x *XTStandardTarget) MarshalUnsafe(dst []byte) []byte {
if x.Target.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(x.SizeBytes()))
- } else {
- // Type XTStandardTarget doesn't have a packed layout in memory, fallback to MarshalBytes.
- x.MarshalBytes(dst)
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size))
+ return dst[size:]
}
+ // Type XTStandardTarget doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return x.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (x *XTStandardTarget) UnmarshalUnsafe(src []byte) {
+func (x *XTStandardTarget) UnmarshalUnsafe(src []byte) []byte {
if x.Target.Packed() {
- gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(x.SizeBytes()))
- } else {
- // Type XTStandardTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- x.UnmarshalBytes(src)
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type XTStandardTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return x.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -8454,7 +8722,7 @@ func (x *XTTCP) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (x *XTTCP) MarshalBytes(dst []byte) {
+func (x *XTTCP) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortStart))
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortEnd))
@@ -8471,10 +8739,11 @@ func (x *XTTCP) MarshalBytes(dst []byte) {
dst = dst[1:]
dst[0] = byte(x.InverseFlags)
dst = dst[1:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (x *XTTCP) UnmarshalBytes(src []byte) {
+func (x *XTTCP) UnmarshalBytes(src []byte) []byte {
x.SourcePortStart = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
x.SourcePortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2]))
@@ -8491,6 +8760,7 @@ func (x *XTTCP) UnmarshalBytes(src []byte) {
src = src[1:]
x.InverseFlags = uint8(src[0])
src = src[1:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -8500,13 +8770,17 @@ func (x *XTTCP) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (x *XTTCP) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(x.SizeBytes()))
+func (x *XTTCP) MarshalUnsafe(dst []byte) []byte {
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (x *XTTCP) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(x.SizeBytes()))
+func (x *XTTCP) UnmarshalUnsafe(src []byte) []byte {
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -8571,7 +8845,7 @@ func (x *XTUDP) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (x *XTUDP) MarshalBytes(dst []byte) {
+func (x *XTUDP) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortStart))
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortEnd))
@@ -8584,10 +8858,11 @@ func (x *XTUDP) MarshalBytes(dst []byte) {
dst = dst[1:]
// Padding: dst[:sizeof(uint8)] ~= uint8(0)
dst = dst[1:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (x *XTUDP) UnmarshalBytes(src []byte) {
+func (x *XTUDP) UnmarshalBytes(src []byte) []byte {
x.SourcePortStart = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
x.SourcePortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2]))
@@ -8600,6 +8875,7 @@ func (x *XTUDP) UnmarshalBytes(src []byte) {
src = src[1:]
// Padding: var _ uint8 ~= src[:sizeof(uint8)]
src = src[1:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -8609,13 +8885,17 @@ func (x *XTUDP) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (x *XTUDP) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(x.SizeBytes()))
+func (x *XTUDP) MarshalUnsafe(dst []byte) []byte {
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (x *XTUDP) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(x.SizeBytes()))
+func (x *XTUDP) UnmarshalUnsafe(src []byte) []byte {
+ size := x.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -8683,9 +8963,8 @@ func (i *IP6TEntry) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *IP6TEntry) MarshalBytes(dst []byte) {
- i.IPv6.MarshalBytes(dst[:i.IPv6.SizeBytes()])
- dst = dst[i.IPv6.SizeBytes():]
+func (i *IP6TEntry) MarshalBytes(dst []byte) []byte {
+ dst = i.IPv6.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NFCache))
dst = dst[4:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.TargetOffset))
@@ -8696,14 +8975,13 @@ func (i *IP6TEntry) MarshalBytes(dst []byte) {
dst = dst[4:]
// Padding: dst[:sizeof(byte)*4] ~= [4]byte{0}
dst = dst[1*(4):]
- i.Counters.MarshalBytes(dst[:i.Counters.SizeBytes()])
- dst = dst[i.Counters.SizeBytes():]
+ dst = i.Counters.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *IP6TEntry) UnmarshalBytes(src []byte) {
- i.IPv6.UnmarshalBytes(src[:i.IPv6.SizeBytes()])
- src = src[i.IPv6.SizeBytes():]
+func (i *IP6TEntry) UnmarshalBytes(src []byte) []byte {
+ src = i.IPv6.UnmarshalBytes(src)
i.NFCache = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
i.TargetOffset = uint16(hostarch.ByteOrder.Uint16(src[:2]))
@@ -8714,8 +8992,8 @@ func (i *IP6TEntry) UnmarshalBytes(src []byte) {
src = src[4:]
// Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4])
src = src[1*(4):]
- i.Counters.UnmarshalBytes(src[:i.Counters.SizeBytes()])
- src = src[i.Counters.SizeBytes():]
+ src = i.Counters.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -8725,23 +9003,25 @@ func (i *IP6TEntry) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *IP6TEntry) MarshalUnsafe(dst []byte) {
+func (i *IP6TEntry) MarshalUnsafe(dst []byte) []byte {
if i.Counters.Packed() && i.IPv6.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
- } else {
- // Type IP6TEntry doesn't have a packed layout in memory, fallback to MarshalBytes.
- i.MarshalBytes(dst)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
+ // Type IP6TEntry doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return i.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *IP6TEntry) UnmarshalUnsafe(src []byte) {
+func (i *IP6TEntry) UnmarshalUnsafe(src []byte) []byte {
if i.Counters.Packed() && i.IPv6.Packed() {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
- } else {
- // Type IP6TEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- i.UnmarshalBytes(src)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type IP6TEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return i.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -8840,15 +9120,11 @@ func (i *IP6TIP) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *IP6TIP) MarshalBytes(dst []byte) {
- i.Src.MarshalBytes(dst[:i.Src.SizeBytes()])
- dst = dst[i.Src.SizeBytes():]
- i.Dst.MarshalBytes(dst[:i.Dst.SizeBytes()])
- dst = dst[i.Dst.SizeBytes():]
- i.SrcMask.MarshalBytes(dst[:i.SrcMask.SizeBytes()])
- dst = dst[i.SrcMask.SizeBytes():]
- i.DstMask.MarshalBytes(dst[:i.DstMask.SizeBytes()])
- dst = dst[i.DstMask.SizeBytes():]
+func (i *IP6TIP) MarshalBytes(dst []byte) []byte {
+ dst = i.Src.MarshalBytes(dst)
+ dst = i.Dst.MarshalBytes(dst)
+ dst = i.SrcMask.MarshalBytes(dst)
+ dst = i.DstMask.MarshalBytes(dst)
for idx := 0; idx < IFNAMSIZ; idx++ {
dst[0] = byte(i.InputInterface[idx])
dst = dst[1:]
@@ -8875,18 +9151,15 @@ func (i *IP6TIP) MarshalBytes(dst []byte) {
dst = dst[1:]
// Padding: dst[:sizeof(byte)*3] ~= [3]byte{0}
dst = dst[1*(3):]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *IP6TIP) UnmarshalBytes(src []byte) {
- i.Src.UnmarshalBytes(src[:i.Src.SizeBytes()])
- src = src[i.Src.SizeBytes():]
- i.Dst.UnmarshalBytes(src[:i.Dst.SizeBytes()])
- src = src[i.Dst.SizeBytes():]
- i.SrcMask.UnmarshalBytes(src[:i.SrcMask.SizeBytes()])
- src = src[i.SrcMask.SizeBytes():]
- i.DstMask.UnmarshalBytes(src[:i.DstMask.SizeBytes()])
- src = src[i.DstMask.SizeBytes():]
+func (i *IP6TIP) UnmarshalBytes(src []byte) []byte {
+ src = i.Src.UnmarshalBytes(src)
+ src = i.Dst.UnmarshalBytes(src)
+ src = i.SrcMask.UnmarshalBytes(src)
+ src = i.DstMask.UnmarshalBytes(src)
for idx := 0; idx < IFNAMSIZ; idx++ {
i.InputInterface[idx] = src[0]
src = src[1:]
@@ -8913,6 +9186,7 @@ func (i *IP6TIP) UnmarshalBytes(src []byte) {
src = src[1:]
// Padding: ~ copy([3]byte(i._), src[:sizeof(byte)*3])
src = src[1*(3):]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -8922,23 +9196,25 @@ func (i *IP6TIP) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *IP6TIP) MarshalUnsafe(dst []byte) {
+func (i *IP6TIP) MarshalUnsafe(dst []byte) []byte {
if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
- } else {
- // Type IP6TIP doesn't have a packed layout in memory, fallback to MarshalBytes.
- i.MarshalBytes(dst)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
+ // Type IP6TIP doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return i.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *IP6TIP) UnmarshalUnsafe(src []byte) {
+func (i *IP6TIP) UnmarshalUnsafe(src []byte) []byte {
if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
- } else {
- // Type IP6TIP doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- i.UnmarshalBytes(src)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type IP6TIP doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return i.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -9031,9 +9307,8 @@ func (i *IP6TReplace) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *IP6TReplace) MarshalBytes(dst []byte) {
- i.Name.MarshalBytes(dst[:i.Name.SizeBytes()])
- dst = dst[i.Name.SizeBytes():]
+func (i *IP6TReplace) MarshalBytes(dst []byte) []byte {
+ dst = i.Name.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries))
@@ -9052,12 +9327,12 @@ func (i *IP6TReplace) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Counters))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *IP6TReplace) UnmarshalBytes(src []byte) {
- i.Name.UnmarshalBytes(src[:i.Name.SizeBytes()])
- src = src[i.Name.SizeBytes():]
+func (i *IP6TReplace) UnmarshalBytes(src []byte) []byte {
+ src = i.Name.UnmarshalBytes(src)
i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -9076,6 +9351,7 @@ func (i *IP6TReplace) UnmarshalBytes(src []byte) {
src = src[4:]
i.Counters = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -9085,23 +9361,25 @@ func (i *IP6TReplace) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *IP6TReplace) MarshalUnsafe(dst []byte) {
+func (i *IP6TReplace) MarshalUnsafe(dst []byte) []byte {
if i.Name.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
- } else {
- // Type IP6TReplace doesn't have a packed layout in memory, fallback to MarshalBytes.
- i.MarshalBytes(dst)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
+ // Type IP6TReplace doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return i.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *IP6TReplace) UnmarshalUnsafe(src []byte) {
+func (i *IP6TReplace) UnmarshalUnsafe(src []byte) []byte {
if i.Name.Packed() {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
- } else {
- // Type IP6TReplace doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- i.UnmarshalBytes(src)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type IP6TReplace doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return i.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -9193,15 +9471,15 @@ func (ke *KernelIP6TEntry) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (ke *KernelIP6TEntry) MarshalUnsafe(dst []byte) {
+func (ke *KernelIP6TEntry) MarshalUnsafe(dst []byte) []byte {
// Type KernelIP6TEntry doesn't have a packed layout in memory, fallback to MarshalBytes.
- ke.MarshalBytes(dst)
+ return ke.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (ke *KernelIP6TEntry) UnmarshalUnsafe(src []byte) {
+func (ke *KernelIP6TEntry) UnmarshalUnsafe(src []byte) []byte {
// Type KernelIP6TEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- ke.UnmarshalBytes(src)
+ return ke.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -9248,15 +9526,15 @@ func (ke *KernelIP6TGetEntries) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (ke *KernelIP6TGetEntries) MarshalUnsafe(dst []byte) {
+func (ke *KernelIP6TGetEntries) MarshalUnsafe(dst []byte) []byte {
// Type KernelIP6TGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes.
- ke.MarshalBytes(dst)
+ return ke.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (ke *KernelIP6TGetEntries) UnmarshalUnsafe(src []byte) {
+func (ke *KernelIP6TGetEntries) UnmarshalUnsafe(src []byte) []byte {
// Type KernelIP6TGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- ke.UnmarshalBytes(src)
+ return ke.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -9303,31 +9581,29 @@ func (n *NFNATRange) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (n *NFNATRange) MarshalBytes(dst []byte) {
+func (n *NFNATRange) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Flags))
dst = dst[4:]
- n.MinAddr.MarshalBytes(dst[:n.MinAddr.SizeBytes()])
- dst = dst[n.MinAddr.SizeBytes():]
- n.MaxAddr.MarshalBytes(dst[:n.MaxAddr.SizeBytes()])
- dst = dst[n.MaxAddr.SizeBytes():]
+ dst = n.MinAddr.MarshalBytes(dst)
+ dst = n.MaxAddr.MarshalBytes(dst)
hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MinProto))
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MaxProto))
dst = dst[2:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (n *NFNATRange) UnmarshalBytes(src []byte) {
+func (n *NFNATRange) UnmarshalBytes(src []byte) []byte {
n.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
- n.MinAddr.UnmarshalBytes(src[:n.MinAddr.SizeBytes()])
- src = src[n.MinAddr.SizeBytes():]
- n.MaxAddr.UnmarshalBytes(src[:n.MaxAddr.SizeBytes()])
- src = src[n.MaxAddr.SizeBytes():]
+ src = n.MinAddr.UnmarshalBytes(src)
+ src = n.MaxAddr.UnmarshalBytes(src)
n.MinProto = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
n.MaxProto = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -9337,23 +9613,25 @@ func (n *NFNATRange) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (n *NFNATRange) MarshalUnsafe(dst []byte) {
+func (n *NFNATRange) MarshalUnsafe(dst []byte) []byte {
if n.MaxAddr.Packed() && n.MinAddr.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(n.SizeBytes()))
- } else {
- // Type NFNATRange doesn't have a packed layout in memory, fallback to MarshalBytes.
- n.MarshalBytes(dst)
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size))
+ return dst[size:]
}
+ // Type NFNATRange doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return n.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (n *NFNATRange) UnmarshalUnsafe(src []byte) {
+func (n *NFNATRange) UnmarshalUnsafe(src []byte) []byte {
if n.MaxAddr.Packed() && n.MinAddr.Packed() {
- gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(n.SizeBytes()))
- } else {
- // Type NFNATRange doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- n.UnmarshalBytes(src)
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type NFNATRange doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return n.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -9443,19 +9721,21 @@ func (n *NetlinkAttrHeader) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (n *NetlinkAttrHeader) MarshalBytes(dst []byte) {
+func (n *NetlinkAttrHeader) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Length))
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Type))
dst = dst[2:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (n *NetlinkAttrHeader) UnmarshalBytes(src []byte) {
+func (n *NetlinkAttrHeader) UnmarshalBytes(src []byte) []byte {
n.Length = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
n.Type = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -9465,13 +9745,17 @@ func (n *NetlinkAttrHeader) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (n *NetlinkAttrHeader) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(n.SizeBytes()))
+func (n *NetlinkAttrHeader) MarshalUnsafe(dst []byte) []byte {
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (n *NetlinkAttrHeader) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(n.SizeBytes()))
+func (n *NetlinkAttrHeader) UnmarshalUnsafe(src []byte) []byte {
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -9537,19 +9821,19 @@ func (n *NetlinkErrorMessage) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (n *NetlinkErrorMessage) MarshalBytes(dst []byte) {
+func (n *NetlinkErrorMessage) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Error))
dst = dst[4:]
- n.Header.MarshalBytes(dst[:n.Header.SizeBytes()])
- dst = dst[n.Header.SizeBytes():]
+ dst = n.Header.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (n *NetlinkErrorMessage) UnmarshalBytes(src []byte) {
+func (n *NetlinkErrorMessage) UnmarshalBytes(src []byte) []byte {
n.Error = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
- n.Header.UnmarshalBytes(src[:n.Header.SizeBytes()])
- src = src[n.Header.SizeBytes():]
+ src = n.Header.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -9559,23 +9843,25 @@ func (n *NetlinkErrorMessage) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (n *NetlinkErrorMessage) MarshalUnsafe(dst []byte) {
+func (n *NetlinkErrorMessage) MarshalUnsafe(dst []byte) []byte {
if n.Header.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(n.SizeBytes()))
- } else {
- // Type NetlinkErrorMessage doesn't have a packed layout in memory, fallback to MarshalBytes.
- n.MarshalBytes(dst)
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size))
+ return dst[size:]
}
+ // Type NetlinkErrorMessage doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return n.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (n *NetlinkErrorMessage) UnmarshalUnsafe(src []byte) {
+func (n *NetlinkErrorMessage) UnmarshalUnsafe(src []byte) []byte {
if n.Header.Packed() {
- gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(n.SizeBytes()))
- } else {
- // Type NetlinkErrorMessage doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- n.UnmarshalBytes(src)
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type NetlinkErrorMessage doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return n.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -9665,7 +9951,7 @@ func (n *NetlinkMessageHeader) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (n *NetlinkMessageHeader) MarshalBytes(dst []byte) {
+func (n *NetlinkMessageHeader) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Length))
dst = dst[4:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Type))
@@ -9676,10 +9962,11 @@ func (n *NetlinkMessageHeader) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.PortID))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (n *NetlinkMessageHeader) UnmarshalBytes(src []byte) {
+func (n *NetlinkMessageHeader) UnmarshalBytes(src []byte) []byte {
n.Length = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
n.Type = uint16(hostarch.ByteOrder.Uint16(src[:2]))
@@ -9690,6 +9977,7 @@ func (n *NetlinkMessageHeader) UnmarshalBytes(src []byte) {
src = src[4:]
n.PortID = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -9699,13 +9987,17 @@ func (n *NetlinkMessageHeader) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (n *NetlinkMessageHeader) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(n.SizeBytes()))
+func (n *NetlinkMessageHeader) MarshalUnsafe(dst []byte) []byte {
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (n *NetlinkMessageHeader) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(n.SizeBytes()))
+func (n *NetlinkMessageHeader) UnmarshalUnsafe(src []byte) []byte {
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -9770,7 +10062,7 @@ func (s *SockAddrNetlink) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SockAddrNetlink) MarshalBytes(dst []byte) {
+func (s *SockAddrNetlink) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family))
dst = dst[2:]
// Padding: dst[:sizeof(uint16)] ~= uint16(0)
@@ -9779,10 +10071,11 @@ func (s *SockAddrNetlink) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Groups))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SockAddrNetlink) UnmarshalBytes(src []byte) {
+func (s *SockAddrNetlink) UnmarshalBytes(src []byte) []byte {
s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
// Padding: var _ uint16 ~= src[:sizeof(uint16)]
@@ -9791,6 +10084,7 @@ func (s *SockAddrNetlink) UnmarshalBytes(src []byte) {
src = src[4:]
s.Groups = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -9800,13 +10094,17 @@ func (s *SockAddrNetlink) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SockAddrNetlink) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *SockAddrNetlink) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SockAddrNetlink) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *SockAddrNetlink) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -9871,7 +10169,7 @@ func (i *InterfaceAddrMessage) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *InterfaceAddrMessage) MarshalBytes(dst []byte) {
+func (i *InterfaceAddrMessage) MarshalBytes(dst []byte) []byte {
dst[0] = byte(i.Family)
dst = dst[1:]
dst[0] = byte(i.PrefixLen)
@@ -9882,10 +10180,11 @@ func (i *InterfaceAddrMessage) MarshalBytes(dst []byte) {
dst = dst[1:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Index))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *InterfaceAddrMessage) UnmarshalBytes(src []byte) {
+func (i *InterfaceAddrMessage) UnmarshalBytes(src []byte) []byte {
i.Family = uint8(src[0])
src = src[1:]
i.PrefixLen = uint8(src[0])
@@ -9896,6 +10195,7 @@ func (i *InterfaceAddrMessage) UnmarshalBytes(src []byte) {
src = src[1:]
i.Index = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -9905,13 +10205,17 @@ func (i *InterfaceAddrMessage) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *InterfaceAddrMessage) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
+func (i *InterfaceAddrMessage) MarshalUnsafe(dst []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *InterfaceAddrMessage) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
+func (i *InterfaceAddrMessage) UnmarshalUnsafe(src []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -9976,7 +10280,7 @@ func (i *InterfaceInfoMessage) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *InterfaceInfoMessage) MarshalBytes(dst []byte) {
+func (i *InterfaceInfoMessage) MarshalBytes(dst []byte) []byte {
dst[0] = byte(i.Family)
dst = dst[1:]
// Padding: dst[:sizeof(uint8)] ~= uint8(0)
@@ -9989,10 +10293,11 @@ func (i *InterfaceInfoMessage) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Change))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *InterfaceInfoMessage) UnmarshalBytes(src []byte) {
+func (i *InterfaceInfoMessage) UnmarshalBytes(src []byte) []byte {
i.Family = uint8(src[0])
src = src[1:]
// Padding: var _ uint8 ~= src[:sizeof(uint8)]
@@ -10005,6 +10310,7 @@ func (i *InterfaceInfoMessage) UnmarshalBytes(src []byte) {
src = src[4:]
i.Change = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -10014,13 +10320,17 @@ func (i *InterfaceInfoMessage) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *InterfaceInfoMessage) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
+func (i *InterfaceInfoMessage) MarshalUnsafe(dst []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *InterfaceInfoMessage) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
+func (i *InterfaceInfoMessage) UnmarshalUnsafe(src []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -10085,7 +10395,7 @@ func (r *RouteMessage) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (r *RouteMessage) MarshalBytes(dst []byte) {
+func (r *RouteMessage) MarshalBytes(dst []byte) []byte {
dst[0] = byte(r.Family)
dst = dst[1:]
dst[0] = byte(r.DstLen)
@@ -10104,10 +10414,11 @@ func (r *RouteMessage) MarshalBytes(dst []byte) {
dst = dst[1:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Flags))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (r *RouteMessage) UnmarshalBytes(src []byte) {
+func (r *RouteMessage) UnmarshalBytes(src []byte) []byte {
r.Family = uint8(src[0])
src = src[1:]
r.DstLen = uint8(src[0])
@@ -10126,6 +10437,7 @@ func (r *RouteMessage) UnmarshalBytes(src []byte) {
src = src[1:]
r.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -10135,13 +10447,17 @@ func (r *RouteMessage) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (r *RouteMessage) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(r.SizeBytes()))
+func (r *RouteMessage) MarshalUnsafe(dst []byte) []byte {
+ size := r.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (r *RouteMessage) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(r.SizeBytes()))
+func (r *RouteMessage) UnmarshalUnsafe(src []byte) []byte {
+ size := r.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -10206,23 +10522,25 @@ func (p *PollFD) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (p *PollFD) MarshalBytes(dst []byte) {
+func (p *PollFD) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(p.FD))
dst = dst[4:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(p.Events))
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(p.REvents))
dst = dst[2:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (p *PollFD) UnmarshalBytes(src []byte) {
+func (p *PollFD) UnmarshalBytes(src []byte) []byte {
p.FD = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
p.Events = int16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
p.REvents = int16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -10232,13 +10550,17 @@ func (p *PollFD) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (p *PollFD) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(p), uintptr(p.SizeBytes()))
+func (p *PollFD) MarshalUnsafe(dst []byte) []byte {
+ size := p.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(p), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (p *PollFD) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(p), unsafe.Pointer(&src[0]), uintptr(p.SizeBytes()))
+func (p *PollFD) UnmarshalUnsafe(src []byte) []byte {
+ size := p.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(p), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -10379,7 +10701,7 @@ func (r *RSeqCriticalSection) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (r *RSeqCriticalSection) MarshalBytes(dst []byte) {
+func (r *RSeqCriticalSection) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Version))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Flags))
@@ -10390,10 +10712,11 @@ func (r *RSeqCriticalSection) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Abort))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (r *RSeqCriticalSection) UnmarshalBytes(src []byte) {
+func (r *RSeqCriticalSection) UnmarshalBytes(src []byte) []byte {
r.Version = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
r.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -10404,6 +10727,7 @@ func (r *RSeqCriticalSection) UnmarshalBytes(src []byte) {
src = src[8:]
r.Abort = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -10413,13 +10737,17 @@ func (r *RSeqCriticalSection) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (r *RSeqCriticalSection) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(r.SizeBytes()))
+func (r *RSeqCriticalSection) MarshalUnsafe(dst []byte) []byte {
+ size := r.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (r *RSeqCriticalSection) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(r.SizeBytes()))
+func (r *RSeqCriticalSection) UnmarshalUnsafe(src []byte) []byte {
+ size := r.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -10486,11 +10814,9 @@ func (r *Rusage) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (r *Rusage) MarshalBytes(dst []byte) {
- r.UTime.MarshalBytes(dst[:r.UTime.SizeBytes()])
- dst = dst[r.UTime.SizeBytes():]
- r.STime.MarshalBytes(dst[:r.STime.SizeBytes()])
- dst = dst[r.STime.SizeBytes():]
+func (r *Rusage) MarshalBytes(dst []byte) []byte {
+ dst = r.UTime.MarshalBytes(dst)
+ dst = r.STime.MarshalBytes(dst)
hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MaxRSS))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.IXRSS))
@@ -10519,14 +10845,13 @@ func (r *Rusage) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NIvCSw))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (r *Rusage) UnmarshalBytes(src []byte) {
- r.UTime.UnmarshalBytes(src[:r.UTime.SizeBytes()])
- src = src[r.UTime.SizeBytes():]
- r.STime.UnmarshalBytes(src[:r.STime.SizeBytes()])
- src = src[r.STime.SizeBytes():]
+func (r *Rusage) UnmarshalBytes(src []byte) []byte {
+ src = r.UTime.UnmarshalBytes(src)
+ src = r.STime.UnmarshalBytes(src)
r.MaxRSS = int64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
r.IXRSS = int64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -10555,6 +10880,7 @@ func (r *Rusage) UnmarshalBytes(src []byte) {
src = src[8:]
r.NIvCSw = int64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -10564,23 +10890,25 @@ func (r *Rusage) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (r *Rusage) MarshalUnsafe(dst []byte) {
+func (r *Rusage) MarshalUnsafe(dst []byte) []byte {
if r.STime.Packed() && r.UTime.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(r.SizeBytes()))
- } else {
- // Type Rusage doesn't have a packed layout in memory, fallback to MarshalBytes.
- r.MarshalBytes(dst)
+ size := r.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size))
+ return dst[size:]
}
+ // Type Rusage doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return r.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (r *Rusage) UnmarshalUnsafe(src []byte) {
+func (r *Rusage) UnmarshalUnsafe(src []byte) []byte {
if r.STime.Packed() && r.UTime.Packed() {
- gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(r.SizeBytes()))
- } else {
- // Type Rusage doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- r.UnmarshalBytes(src)
+ size := r.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type Rusage doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return r.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -10671,7 +10999,7 @@ func (s *SeccompData) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SeccompData) MarshalBytes(dst []byte) {
+func (s *SeccompData) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Nr))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Arch))
@@ -10682,10 +11010,11 @@ func (s *SeccompData) MarshalBytes(dst []byte) {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Args[idx]))
dst = dst[8:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SeccompData) UnmarshalBytes(src []byte) {
+func (s *SeccompData) UnmarshalBytes(src []byte) []byte {
s.Nr = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
s.Arch = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -10696,6 +11025,7 @@ func (s *SeccompData) UnmarshalBytes(src []byte) {
s.Args[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -10705,13 +11035,17 @@ func (s *SeccompData) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SeccompData) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *SeccompData) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SeccompData) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *SeccompData) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -10776,7 +11110,7 @@ func (s *SemInfo) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SemInfo) MarshalBytes(dst []byte) {
+func (s *SemInfo) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMap))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMni))
@@ -10797,10 +11131,11 @@ func (s *SemInfo) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemAem))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SemInfo) UnmarshalBytes(src []byte) {
+func (s *SemInfo) UnmarshalBytes(src []byte) []byte {
s.SemMap = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
s.SemMni = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -10821,6 +11156,7 @@ func (s *SemInfo) UnmarshalBytes(src []byte) {
src = src[4:]
s.SemAem = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -10830,13 +11166,17 @@ func (s *SemInfo) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SemInfo) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *SemInfo) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SemInfo) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *SemInfo) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -10901,23 +11241,25 @@ func (s *Sembuf) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *Sembuf) MarshalBytes(dst []byte) {
+func (s *Sembuf) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemNum))
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemOp))
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemFlg))
dst = dst[2:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *Sembuf) UnmarshalBytes(src []byte) {
+func (s *Sembuf) UnmarshalBytes(src []byte) []byte {
s.SemNum = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
s.SemOp = int16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
s.SemFlg = int16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -10927,13 +11269,17 @@ func (s *Sembuf) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *Sembuf) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *Sembuf) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *Sembuf) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *Sembuf) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -11075,7 +11421,7 @@ func (s *ShmInfo) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *ShmInfo) MarshalBytes(dst []byte) {
+func (s *ShmInfo) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UsedIDs))
dst = dst[4:]
// Padding: dst[:sizeof(byte)*4] ~= [4]byte{0}
@@ -11090,10 +11436,11 @@ func (s *ShmInfo) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SwapSuccesses))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *ShmInfo) UnmarshalBytes(src []byte) {
+func (s *ShmInfo) UnmarshalBytes(src []byte) []byte {
s.UsedIDs = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
// Padding: ~ copy([4]byte(s._), src[:sizeof(byte)*4])
@@ -11108,6 +11455,7 @@ func (s *ShmInfo) UnmarshalBytes(src []byte) {
src = src[8:]
s.SwapSuccesses = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -11117,13 +11465,17 @@ func (s *ShmInfo) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *ShmInfo) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *ShmInfo) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *ShmInfo) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *ShmInfo) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -11188,7 +11540,7 @@ func (s *ShmParams) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *ShmParams) MarshalBytes(dst []byte) {
+func (s *ShmParams) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMax))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMin))
@@ -11199,10 +11551,11 @@ func (s *ShmParams) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmAll))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *ShmParams) UnmarshalBytes(src []byte) {
+func (s *ShmParams) UnmarshalBytes(src []byte) []byte {
s.ShmMax = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
s.ShmMin = uint64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -11213,6 +11566,7 @@ func (s *ShmParams) UnmarshalBytes(src []byte) {
src = src[8:]
s.ShmAll = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -11222,13 +11576,17 @@ func (s *ShmParams) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *ShmParams) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *ShmParams) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *ShmParams) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *ShmParams) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -11297,17 +11655,13 @@ func (s *ShmidDS) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *ShmidDS) MarshalBytes(dst []byte) {
- s.ShmPerm.MarshalBytes(dst[:s.ShmPerm.SizeBytes()])
- dst = dst[s.ShmPerm.SizeBytes():]
+func (s *ShmidDS) MarshalBytes(dst []byte) []byte {
+ dst = s.ShmPerm.MarshalBytes(dst)
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSegsz))
dst = dst[8:]
- s.ShmAtime.MarshalBytes(dst[:s.ShmAtime.SizeBytes()])
- dst = dst[s.ShmAtime.SizeBytes():]
- s.ShmDtime.MarshalBytes(dst[:s.ShmDtime.SizeBytes()])
- dst = dst[s.ShmDtime.SizeBytes():]
- s.ShmCtime.MarshalBytes(dst[:s.ShmCtime.SizeBytes()])
- dst = dst[s.ShmCtime.SizeBytes():]
+ dst = s.ShmAtime.MarshalBytes(dst)
+ dst = s.ShmDtime.MarshalBytes(dst)
+ dst = s.ShmCtime.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.ShmCpid))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.ShmLpid))
@@ -11318,20 +11672,17 @@ func (s *ShmidDS) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Unused5))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *ShmidDS) UnmarshalBytes(src []byte) {
- s.ShmPerm.UnmarshalBytes(src[:s.ShmPerm.SizeBytes()])
- src = src[s.ShmPerm.SizeBytes():]
+func (s *ShmidDS) UnmarshalBytes(src []byte) []byte {
+ src = s.ShmPerm.UnmarshalBytes(src)
s.ShmSegsz = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
- s.ShmAtime.UnmarshalBytes(src[:s.ShmAtime.SizeBytes()])
- src = src[s.ShmAtime.SizeBytes():]
- s.ShmDtime.UnmarshalBytes(src[:s.ShmDtime.SizeBytes()])
- src = src[s.ShmDtime.SizeBytes():]
- s.ShmCtime.UnmarshalBytes(src[:s.ShmCtime.SizeBytes()])
- src = src[s.ShmCtime.SizeBytes():]
+ src = s.ShmAtime.UnmarshalBytes(src)
+ src = s.ShmDtime.UnmarshalBytes(src)
+ src = s.ShmCtime.UnmarshalBytes(src)
s.ShmCpid = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
s.ShmLpid = int32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -11342,6 +11693,7 @@ func (s *ShmidDS) UnmarshalBytes(src []byte) {
src = src[8:]
s.Unused5 = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -11351,23 +11703,25 @@ func (s *ShmidDS) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *ShmidDS) MarshalUnsafe(dst []byte) {
+func (s *ShmidDS) MarshalUnsafe(dst []byte) []byte {
if s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type ShmidDS doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type ShmidDS doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *ShmidDS) UnmarshalUnsafe(src []byte) {
+func (s *ShmidDS) UnmarshalUnsafe(src []byte) []byte {
if s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type ShmidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type ShmidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -11458,27 +11812,27 @@ func (s *SigAction) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SigAction) MarshalBytes(dst []byte) {
+func (s *SigAction) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Handler))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Flags))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Restorer))
dst = dst[8:]
- s.Mask.MarshalBytes(dst[:s.Mask.SizeBytes()])
- dst = dst[s.Mask.SizeBytes():]
+ dst = s.Mask.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SigAction) UnmarshalBytes(src []byte) {
+func (s *SigAction) UnmarshalBytes(src []byte) []byte {
s.Handler = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
s.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
s.Restorer = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
- s.Mask.UnmarshalBytes(src[:s.Mask.SizeBytes()])
- src = src[s.Mask.SizeBytes():]
+ src = s.Mask.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -11488,23 +11842,25 @@ func (s *SigAction) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SigAction) MarshalUnsafe(dst []byte) {
+func (s *SigAction) MarshalUnsafe(dst []byte) []byte {
if s.Mask.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type SigAction doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type SigAction doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SigAction) UnmarshalUnsafe(src []byte) {
+func (s *SigAction) UnmarshalUnsafe(src []byte) []byte {
if s.Mask.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type SigAction doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type SigAction doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -11595,7 +11951,7 @@ func (s *Sigevent) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *Sigevent) MarshalBytes(dst []byte) {
+func (s *Sigevent) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Value))
dst = dst[8:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo))
@@ -11608,10 +11964,11 @@ func (s *Sigevent) MarshalBytes(dst []byte) {
dst[0] = byte(s.UnRemainder[idx])
dst = dst[1:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *Sigevent) UnmarshalBytes(src []byte) {
+func (s *Sigevent) UnmarshalBytes(src []byte) []byte {
s.Value = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
s.Signo = int32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -11624,6 +11981,7 @@ func (s *Sigevent) UnmarshalBytes(src []byte) {
s.UnRemainder[idx] = src[0]
src = src[1:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -11633,13 +11991,17 @@ func (s *Sigevent) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *Sigevent) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *Sigevent) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *Sigevent) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *Sigevent) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -11705,7 +12067,7 @@ func (s *SignalInfo) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SignalInfo) MarshalBytes(dst []byte) {
+func (s *SignalInfo) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno))
@@ -11718,10 +12080,11 @@ func (s *SignalInfo) MarshalBytes(dst []byte) {
dst[0] = byte(s.Fields[idx])
dst = dst[1:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SignalInfo) UnmarshalBytes(src []byte) {
+func (s *SignalInfo) UnmarshalBytes(src []byte) []byte {
s.Signo = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
s.Errno = int32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -11734,6 +12097,7 @@ func (s *SignalInfo) UnmarshalBytes(src []byte) {
s.Fields[idx] = src[0]
src = src[1:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -11743,13 +12107,17 @@ func (s *SignalInfo) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SignalInfo) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *SignalInfo) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SignalInfo) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *SignalInfo) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -11815,13 +12183,15 @@ func (s *SignalSet) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SignalSet) MarshalBytes(dst []byte) {
+func (s *SignalSet) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(*s))
+ return dst[8:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SignalSet) UnmarshalBytes(src []byte) {
+func (s *SignalSet) UnmarshalBytes(src []byte) []byte {
*s = SignalSet(uint64(hostarch.ByteOrder.Uint64(src[:8])))
+ return src[8:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -11832,13 +12202,17 @@ func (s *SignalSet) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SignalSet) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *SignalSet) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SignalSet) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *SignalSet) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -11903,7 +12277,7 @@ func (s *SignalStack) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SignalStack) MarshalBytes(dst []byte) {
+func (s *SignalStack) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Addr))
dst = dst[8:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Flags))
@@ -11912,10 +12286,11 @@ func (s *SignalStack) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Size))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SignalStack) UnmarshalBytes(src []byte) {
+func (s *SignalStack) UnmarshalBytes(src []byte) []byte {
s.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
s.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -11924,6 +12299,7 @@ func (s *SignalStack) UnmarshalBytes(src []byte) {
src = src[4:]
s.Size = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -11933,13 +12309,17 @@ func (s *SignalStack) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SignalStack) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *SignalStack) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SignalStack) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *SignalStack) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -12005,7 +12385,7 @@ func (s *SignalfdSiginfo) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SignalfdSiginfo) MarshalBytes(dst []byte) {
+func (s *SignalfdSiginfo) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno))
@@ -12042,10 +12422,11 @@ func (s *SignalfdSiginfo) MarshalBytes(dst []byte) {
dst = dst[2:]
// Padding: dst[:sizeof(uint8)*48] ~= [48]uint8{0}
dst = dst[1*(48):]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SignalfdSiginfo) UnmarshalBytes(src []byte) {
+func (s *SignalfdSiginfo) UnmarshalBytes(src []byte) []byte {
s.Signo = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
s.Errno = int32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -12082,6 +12463,7 @@ func (s *SignalfdSiginfo) UnmarshalBytes(src []byte) {
src = src[2:]
// Padding: ~ copy([48]uint8(s._), src[:sizeof(uint8)*48])
src = src[1*(48):]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -12091,15 +12473,15 @@ func (s *SignalfdSiginfo) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SignalfdSiginfo) MarshalUnsafe(dst []byte) {
+func (s *SignalfdSiginfo) MarshalUnsafe(dst []byte) []byte {
// Type SignalfdSiginfo doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SignalfdSiginfo) UnmarshalUnsafe(src []byte) {
+func (s *SignalfdSiginfo) UnmarshalUnsafe(src []byte) []byte {
// Type SignalfdSiginfo doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -12144,23 +12526,25 @@ func (c *ControlMessageCredentials) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (c *ControlMessageCredentials) MarshalBytes(dst []byte) {
+func (c *ControlMessageCredentials) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.PID))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.UID))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.GID))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (c *ControlMessageCredentials) UnmarshalBytes(src []byte) {
+func (c *ControlMessageCredentials) UnmarshalBytes(src []byte) []byte {
c.PID = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
c.UID = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
c.GID = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -12170,13 +12554,17 @@ func (c *ControlMessageCredentials) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (c *ControlMessageCredentials) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(c.SizeBytes()))
+func (c *ControlMessageCredentials) MarshalUnsafe(dst []byte) []byte {
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (c *ControlMessageCredentials) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(c.SizeBytes()))
+func (c *ControlMessageCredentials) UnmarshalUnsafe(src []byte) []byte {
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -12241,23 +12629,25 @@ func (c *ControlMessageHeader) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (c *ControlMessageHeader) MarshalBytes(dst []byte) {
+func (c *ControlMessageHeader) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.Length))
dst = dst[8:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Level))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Type))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (c *ControlMessageHeader) UnmarshalBytes(src []byte) {
+func (c *ControlMessageHeader) UnmarshalBytes(src []byte) []byte {
c.Length = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
c.Level = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
c.Type = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -12267,13 +12657,17 @@ func (c *ControlMessageHeader) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (c *ControlMessageHeader) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(c.SizeBytes()))
+func (c *ControlMessageHeader) MarshalUnsafe(dst []byte) []byte {
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (c *ControlMessageHeader) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(c.SizeBytes()))
+func (c *ControlMessageHeader) UnmarshalUnsafe(src []byte) []byte {
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -12340,23 +12734,21 @@ func (c *ControlMessageIPPacketInfo) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (c *ControlMessageIPPacketInfo) MarshalBytes(dst []byte) {
+func (c *ControlMessageIPPacketInfo) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.NIC))
dst = dst[4:]
- c.LocalAddr.MarshalBytes(dst[:c.LocalAddr.SizeBytes()])
- dst = dst[c.LocalAddr.SizeBytes():]
- c.DestinationAddr.MarshalBytes(dst[:c.DestinationAddr.SizeBytes()])
- dst = dst[c.DestinationAddr.SizeBytes():]
+ dst = c.LocalAddr.MarshalBytes(dst)
+ dst = c.DestinationAddr.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (c *ControlMessageIPPacketInfo) UnmarshalBytes(src []byte) {
+func (c *ControlMessageIPPacketInfo) UnmarshalBytes(src []byte) []byte {
c.NIC = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
- c.LocalAddr.UnmarshalBytes(src[:c.LocalAddr.SizeBytes()])
- src = src[c.LocalAddr.SizeBytes():]
- c.DestinationAddr.UnmarshalBytes(src[:c.DestinationAddr.SizeBytes()])
- src = src[c.DestinationAddr.SizeBytes():]
+ src = c.LocalAddr.UnmarshalBytes(src)
+ src = c.DestinationAddr.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -12366,23 +12758,25 @@ func (c *ControlMessageIPPacketInfo) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (c *ControlMessageIPPacketInfo) MarshalUnsafe(dst []byte) {
+func (c *ControlMessageIPPacketInfo) MarshalUnsafe(dst []byte) []byte {
if c.DestinationAddr.Packed() && c.LocalAddr.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(c.SizeBytes()))
- } else {
- // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fallback to MarshalBytes.
- c.MarshalBytes(dst)
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size))
+ return dst[size:]
}
+ // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return c.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (c *ControlMessageIPPacketInfo) UnmarshalUnsafe(src []byte) {
+func (c *ControlMessageIPPacketInfo) UnmarshalUnsafe(src []byte) []byte {
if c.DestinationAddr.Packed() && c.LocalAddr.Packed() {
- gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(c.SizeBytes()))
- } else {
- // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- c.UnmarshalBytes(src)
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return c.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -12473,19 +12867,19 @@ func (c *ControlMessageIPv6PacketInfo) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (c *ControlMessageIPv6PacketInfo) MarshalBytes(dst []byte) {
- c.Addr.MarshalBytes(dst[:c.Addr.SizeBytes()])
- dst = dst[c.Addr.SizeBytes():]
+func (c *ControlMessageIPv6PacketInfo) MarshalBytes(dst []byte) []byte {
+ dst = c.Addr.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.NIC))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (c *ControlMessageIPv6PacketInfo) UnmarshalBytes(src []byte) {
- c.Addr.UnmarshalBytes(src[:c.Addr.SizeBytes()])
- src = src[c.Addr.SizeBytes():]
+func (c *ControlMessageIPv6PacketInfo) UnmarshalBytes(src []byte) []byte {
+ src = c.Addr.UnmarshalBytes(src)
c.NIC = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -12495,23 +12889,25 @@ func (c *ControlMessageIPv6PacketInfo) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (c *ControlMessageIPv6PacketInfo) MarshalUnsafe(dst []byte) {
+func (c *ControlMessageIPv6PacketInfo) MarshalUnsafe(dst []byte) []byte {
if c.Addr.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(c.SizeBytes()))
- } else {
- // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fallback to MarshalBytes.
- c.MarshalBytes(dst)
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size))
+ return dst[size:]
}
+ // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return c.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (c *ControlMessageIPv6PacketInfo) UnmarshalUnsafe(src []byte) {
+func (c *ControlMessageIPv6PacketInfo) UnmarshalUnsafe(src []byte) []byte {
if c.Addr.Packed() {
- gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(c.SizeBytes()))
- } else {
- // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- c.UnmarshalBytes(src)
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return c.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -12602,19 +12998,21 @@ func (i *Inet6Addr) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *Inet6Addr) MarshalBytes(dst []byte) {
+func (i *Inet6Addr) MarshalBytes(dst []byte) []byte {
for idx := 0; idx < 16; idx++ {
dst[0] = byte(i[idx])
dst = dst[1:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *Inet6Addr) UnmarshalBytes(src []byte) {
+func (i *Inet6Addr) UnmarshalBytes(src []byte) []byte {
for idx := 0; idx < 16; idx++ {
i[idx] = src[0]
src = src[1:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -12625,13 +13023,17 @@ func (i *Inet6Addr) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *Inet6Addr) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&i[0]), uintptr(i.SizeBytes()))
+func (i *Inet6Addr) MarshalUnsafe(dst []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&i[0]), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *Inet6Addr) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
+func (i *Inet6Addr) UnmarshalUnsafe(src []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -12697,19 +13099,19 @@ func (i *Inet6MulticastRequest) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *Inet6MulticastRequest) MarshalBytes(dst []byte) {
- i.MulticastAddr.MarshalBytes(dst[:i.MulticastAddr.SizeBytes()])
- dst = dst[i.MulticastAddr.SizeBytes():]
+func (i *Inet6MulticastRequest) MarshalBytes(dst []byte) []byte {
+ dst = i.MulticastAddr.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.InterfaceIndex))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *Inet6MulticastRequest) UnmarshalBytes(src []byte) {
- i.MulticastAddr.UnmarshalBytes(src[:i.MulticastAddr.SizeBytes()])
- src = src[i.MulticastAddr.SizeBytes():]
+func (i *Inet6MulticastRequest) UnmarshalBytes(src []byte) []byte {
+ src = i.MulticastAddr.UnmarshalBytes(src)
i.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -12719,23 +13121,25 @@ func (i *Inet6MulticastRequest) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *Inet6MulticastRequest) MarshalUnsafe(dst []byte) {
+func (i *Inet6MulticastRequest) MarshalUnsafe(dst []byte) []byte {
if i.MulticastAddr.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
- } else {
- // Type Inet6MulticastRequest doesn't have a packed layout in memory, fallback to MarshalBytes.
- i.MarshalBytes(dst)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
+ // Type Inet6MulticastRequest doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return i.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *Inet6MulticastRequest) UnmarshalUnsafe(src []byte) {
+func (i *Inet6MulticastRequest) UnmarshalUnsafe(src []byte) []byte {
if i.MulticastAddr.Packed() {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
- } else {
- // Type Inet6MulticastRequest doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- i.UnmarshalBytes(src)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type Inet6MulticastRequest doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return i.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -12826,19 +13230,21 @@ func (i *InetAddr) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *InetAddr) MarshalBytes(dst []byte) {
+func (i *InetAddr) MarshalBytes(dst []byte) []byte {
for idx := 0; idx < 4; idx++ {
dst[0] = byte(i[idx])
dst = dst[1:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *InetAddr) UnmarshalBytes(src []byte) {
+func (i *InetAddr) UnmarshalBytes(src []byte) []byte {
for idx := 0; idx < 4; idx++ {
i[idx] = src[0]
src = src[1:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -12849,13 +13255,17 @@ func (i *InetAddr) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *InetAddr) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&i[0]), uintptr(i.SizeBytes()))
+func (i *InetAddr) MarshalUnsafe(dst []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&i[0]), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *InetAddr) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
+func (i *InetAddr) UnmarshalUnsafe(src []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -12922,19 +13332,17 @@ func (i *InetMulticastRequest) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *InetMulticastRequest) MarshalBytes(dst []byte) {
- i.MulticastAddr.MarshalBytes(dst[:i.MulticastAddr.SizeBytes()])
- dst = dst[i.MulticastAddr.SizeBytes():]
- i.InterfaceAddr.MarshalBytes(dst[:i.InterfaceAddr.SizeBytes()])
- dst = dst[i.InterfaceAddr.SizeBytes():]
+func (i *InetMulticastRequest) MarshalBytes(dst []byte) []byte {
+ dst = i.MulticastAddr.MarshalBytes(dst)
+ dst = i.InterfaceAddr.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *InetMulticastRequest) UnmarshalBytes(src []byte) {
- i.MulticastAddr.UnmarshalBytes(src[:i.MulticastAddr.SizeBytes()])
- src = src[i.MulticastAddr.SizeBytes():]
- i.InterfaceAddr.UnmarshalBytes(src[:i.InterfaceAddr.SizeBytes()])
- src = src[i.InterfaceAddr.SizeBytes():]
+func (i *InetMulticastRequest) UnmarshalBytes(src []byte) []byte {
+ src = i.MulticastAddr.UnmarshalBytes(src)
+ src = i.InterfaceAddr.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -12944,23 +13352,25 @@ func (i *InetMulticastRequest) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *InetMulticastRequest) MarshalUnsafe(dst []byte) {
+func (i *InetMulticastRequest) MarshalUnsafe(dst []byte) []byte {
if i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
- } else {
- // Type InetMulticastRequest doesn't have a packed layout in memory, fallback to MarshalBytes.
- i.MarshalBytes(dst)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
+ // Type InetMulticastRequest doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return i.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *InetMulticastRequest) UnmarshalUnsafe(src []byte) {
+func (i *InetMulticastRequest) UnmarshalUnsafe(src []byte) []byte {
if i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
- } else {
- // Type InetMulticastRequest doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- i.UnmarshalBytes(src)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type InetMulticastRequest doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return i.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -13051,19 +13461,19 @@ func (i *InetMulticastRequestWithNIC) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *InetMulticastRequestWithNIC) MarshalBytes(dst []byte) {
- i.InetMulticastRequest.MarshalBytes(dst[:i.InetMulticastRequest.SizeBytes()])
- dst = dst[i.InetMulticastRequest.SizeBytes():]
+func (i *InetMulticastRequestWithNIC) MarshalBytes(dst []byte) []byte {
+ dst = i.InetMulticastRequest.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.InterfaceIndex))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *InetMulticastRequestWithNIC) UnmarshalBytes(src []byte) {
- i.InetMulticastRequest.UnmarshalBytes(src[:i.InetMulticastRequest.SizeBytes()])
- src = src[i.InetMulticastRequest.SizeBytes():]
+func (i *InetMulticastRequestWithNIC) UnmarshalBytes(src []byte) []byte {
+ src = i.InetMulticastRequest.UnmarshalBytes(src)
i.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -13073,23 +13483,25 @@ func (i *InetMulticastRequestWithNIC) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *InetMulticastRequestWithNIC) MarshalUnsafe(dst []byte) {
+func (i *InetMulticastRequestWithNIC) MarshalUnsafe(dst []byte) []byte {
if i.InetMulticastRequest.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
- } else {
- // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fallback to MarshalBytes.
- i.MarshalBytes(dst)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
+ // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return i.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *InetMulticastRequestWithNIC) UnmarshalUnsafe(src []byte) {
+func (i *InetMulticastRequestWithNIC) UnmarshalUnsafe(src []byte) []byte {
if i.InetMulticastRequest.Packed() {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
- } else {
- // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- i.UnmarshalBytes(src)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return i.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -13179,19 +13591,21 @@ func (l *Linger) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (l *Linger) MarshalBytes(dst []byte) {
+func (l *Linger) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(l.OnOff))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(l.Linger))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (l *Linger) UnmarshalBytes(src []byte) {
+func (l *Linger) UnmarshalBytes(src []byte) []byte {
l.OnOff = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
l.Linger = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -13201,13 +13615,17 @@ func (l *Linger) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (l *Linger) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(l), uintptr(l.SizeBytes()))
+func (l *Linger) MarshalUnsafe(dst []byte) []byte {
+ size := l.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(l), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (l *Linger) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(l), unsafe.Pointer(&src[0]), uintptr(l.SizeBytes()))
+func (l *Linger) UnmarshalUnsafe(src []byte) []byte {
+ size := l.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(l), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -13274,27 +13692,27 @@ func (s *SockAddrInet) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SockAddrInet) MarshalBytes(dst []byte) {
+func (s *SockAddrInet) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family))
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Port))
dst = dst[2:]
- s.Addr.MarshalBytes(dst[:s.Addr.SizeBytes()])
- dst = dst[s.Addr.SizeBytes():]
+ dst = s.Addr.MarshalBytes(dst)
// Padding: dst[:sizeof(uint8)*8] ~= [8]uint8{0}
dst = dst[1*(8):]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SockAddrInet) UnmarshalBytes(src []byte) {
+func (s *SockAddrInet) UnmarshalBytes(src []byte) []byte {
s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
s.Port = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
- s.Addr.UnmarshalBytes(src[:s.Addr.SizeBytes()])
- src = src[s.Addr.SizeBytes():]
+ src = s.Addr.UnmarshalBytes(src)
// Padding: ~ copy([8]uint8(s._), src[:sizeof(uint8)*8])
src = src[1*(8):]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -13304,23 +13722,25 @@ func (s *SockAddrInet) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SockAddrInet) MarshalUnsafe(dst []byte) {
+func (s *SockAddrInet) MarshalUnsafe(dst []byte) []byte {
if s.Addr.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type SockAddrInet doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type SockAddrInet doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SockAddrInet) UnmarshalUnsafe(src []byte) {
+func (s *SockAddrInet) UnmarshalUnsafe(src []byte) []byte {
if s.Addr.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type SockAddrInet doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type SockAddrInet doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -13411,7 +13831,7 @@ func (s *SockAddrInet6) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SockAddrInet6) MarshalBytes(dst []byte) {
+func (s *SockAddrInet6) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family))
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Port))
@@ -13424,10 +13844,11 @@ func (s *SockAddrInet6) MarshalBytes(dst []byte) {
}
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Scope_id))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SockAddrInet6) UnmarshalBytes(src []byte) {
+func (s *SockAddrInet6) UnmarshalBytes(src []byte) []byte {
s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
s.Port = uint16(hostarch.ByteOrder.Uint16(src[:2]))
@@ -13440,6 +13861,7 @@ func (s *SockAddrInet6) UnmarshalBytes(src []byte) {
}
s.Scope_id = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -13449,13 +13871,17 @@ func (s *SockAddrInet6) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SockAddrInet6) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *SockAddrInet6) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SockAddrInet6) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *SockAddrInet6) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -13521,7 +13947,7 @@ func (s *SockAddrLink) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SockAddrLink) MarshalBytes(dst []byte) {
+func (s *SockAddrLink) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family))
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Protocol))
@@ -13538,10 +13964,11 @@ func (s *SockAddrLink) MarshalBytes(dst []byte) {
dst[0] = byte(s.HardwareAddr[idx])
dst = dst[1:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SockAddrLink) UnmarshalBytes(src []byte) {
+func (s *SockAddrLink) UnmarshalBytes(src []byte) []byte {
s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
s.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2]))
@@ -13558,6 +13985,7 @@ func (s *SockAddrLink) UnmarshalBytes(src []byte) {
s.HardwareAddr[idx] = src[0]
src = src[1:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -13567,13 +13995,17 @@ func (s *SockAddrLink) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SockAddrLink) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *SockAddrLink) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SockAddrLink) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *SockAddrLink) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -13639,23 +14071,25 @@ func (s *SockAddrUnix) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SockAddrUnix) MarshalBytes(dst []byte) {
+func (s *SockAddrUnix) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family))
dst = dst[2:]
for idx := 0; idx < UnixPathMax; idx++ {
dst[0] = byte(s.Path[idx])
dst = dst[1:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SockAddrUnix) UnmarshalBytes(src []byte) {
+func (s *SockAddrUnix) UnmarshalBytes(src []byte) []byte {
s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
for idx := 0; idx < UnixPathMax; idx++ {
s.Path[idx] = int8(src[0])
src = src[1:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -13665,13 +14099,17 @@ func (s *SockAddrUnix) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SockAddrUnix) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *SockAddrUnix) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SockAddrUnix) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *SockAddrUnix) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -13736,7 +14174,7 @@ func (t *TCPInfo) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (t *TCPInfo) MarshalBytes(dst []byte) {
+func (t *TCPInfo) MarshalBytes(dst []byte) []byte {
dst[0] = byte(t.State)
dst = dst[1:]
dst[0] = byte(t.CaState)
@@ -13841,10 +14279,11 @@ func (t *TCPInfo) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ReordSeen))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (t *TCPInfo) UnmarshalBytes(src []byte) {
+func (t *TCPInfo) UnmarshalBytes(src []byte) []byte {
t.State = uint8(src[0])
src = src[1:]
t.CaState = uint8(src[0])
@@ -13949,6 +14388,7 @@ func (t *TCPInfo) UnmarshalBytes(src []byte) {
src = src[4:]
t.ReordSeen = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -13958,13 +14398,17 @@ func (t *TCPInfo) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (t *TCPInfo) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(t.SizeBytes()))
+func (t *TCPInfo) MarshalUnsafe(dst []byte) []byte {
+ size := t.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (t *TCPInfo) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(t.SizeBytes()))
+func (t *TCPInfo) UnmarshalUnsafe(src []byte) []byte {
+ size := t.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -14030,13 +14474,15 @@ func (c *ClockT) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (c *ClockT) MarshalBytes(dst []byte) {
+func (c *ClockT) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(*c))
+ return dst[8:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (c *ClockT) UnmarshalBytes(src []byte) {
+func (c *ClockT) UnmarshalBytes(src []byte) []byte {
*c = ClockT(int64(hostarch.ByteOrder.Uint64(src[:8])))
+ return src[8:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -14047,13 +14493,17 @@ func (c *ClockT) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (c *ClockT) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(c.SizeBytes()))
+func (c *ClockT) MarshalUnsafe(dst []byte) []byte {
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (c *ClockT) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(c.SizeBytes()))
+func (c *ClockT) UnmarshalUnsafe(src []byte) []byte {
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -14120,19 +14570,17 @@ func (i *ItimerVal) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *ItimerVal) MarshalBytes(dst []byte) {
- i.Interval.MarshalBytes(dst[:i.Interval.SizeBytes()])
- dst = dst[i.Interval.SizeBytes():]
- i.Value.MarshalBytes(dst[:i.Value.SizeBytes()])
- dst = dst[i.Value.SizeBytes():]
+func (i *ItimerVal) MarshalBytes(dst []byte) []byte {
+ dst = i.Interval.MarshalBytes(dst)
+ dst = i.Value.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *ItimerVal) UnmarshalBytes(src []byte) {
- i.Interval.UnmarshalBytes(src[:i.Interval.SizeBytes()])
- src = src[i.Interval.SizeBytes():]
- i.Value.UnmarshalBytes(src[:i.Value.SizeBytes()])
- src = src[i.Value.SizeBytes():]
+func (i *ItimerVal) UnmarshalBytes(src []byte) []byte {
+ src = i.Interval.UnmarshalBytes(src)
+ src = i.Value.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -14142,23 +14590,25 @@ func (i *ItimerVal) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *ItimerVal) MarshalUnsafe(dst []byte) {
+func (i *ItimerVal) MarshalUnsafe(dst []byte) []byte {
if i.Interval.Packed() && i.Value.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
- } else {
- // Type ItimerVal doesn't have a packed layout in memory, fallback to MarshalBytes.
- i.MarshalBytes(dst)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
+ // Type ItimerVal doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return i.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *ItimerVal) UnmarshalUnsafe(src []byte) {
+func (i *ItimerVal) UnmarshalUnsafe(src []byte) []byte {
if i.Interval.Packed() && i.Value.Packed() {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
- } else {
- // Type ItimerVal doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- i.UnmarshalBytes(src)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type ItimerVal doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return i.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -14250,19 +14700,17 @@ func (i *Itimerspec) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *Itimerspec) MarshalBytes(dst []byte) {
- i.Interval.MarshalBytes(dst[:i.Interval.SizeBytes()])
- dst = dst[i.Interval.SizeBytes():]
- i.Value.MarshalBytes(dst[:i.Value.SizeBytes()])
- dst = dst[i.Value.SizeBytes():]
+func (i *Itimerspec) MarshalBytes(dst []byte) []byte {
+ dst = i.Interval.MarshalBytes(dst)
+ dst = i.Value.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *Itimerspec) UnmarshalBytes(src []byte) {
- i.Interval.UnmarshalBytes(src[:i.Interval.SizeBytes()])
- src = src[i.Interval.SizeBytes():]
- i.Value.UnmarshalBytes(src[:i.Value.SizeBytes()])
- src = src[i.Value.SizeBytes():]
+func (i *Itimerspec) UnmarshalBytes(src []byte) []byte {
+ src = i.Interval.UnmarshalBytes(src)
+ src = i.Value.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -14272,23 +14720,25 @@ func (i *Itimerspec) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *Itimerspec) MarshalUnsafe(dst []byte) {
+func (i *Itimerspec) MarshalUnsafe(dst []byte) []byte {
if i.Interval.Packed() && i.Value.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
- } else {
- // Type Itimerspec doesn't have a packed layout in memory, fallback to MarshalBytes.
- i.MarshalBytes(dst)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
+ // Type Itimerspec doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return i.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *Itimerspec) UnmarshalUnsafe(src []byte) {
+func (i *Itimerspec) UnmarshalUnsafe(src []byte) []byte {
if i.Interval.Packed() && i.Value.Packed() {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
- } else {
- // Type Itimerspec doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- i.UnmarshalBytes(src)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type Itimerspec doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return i.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -14378,23 +14828,25 @@ func (sxts *StatxTimestamp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (sxts *StatxTimestamp) MarshalBytes(dst []byte) {
+func (sxts *StatxTimestamp) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(sxts.Sec))
dst = dst[8:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(sxts.Nsec))
dst = dst[4:]
// Padding: dst[:sizeof(int32)] ~= int32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (sxts *StatxTimestamp) UnmarshalBytes(src []byte) {
+func (sxts *StatxTimestamp) UnmarshalBytes(src []byte) []byte {
sxts.Sec = int64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
sxts.Nsec = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
// Padding: var _ int32 ~= src[:sizeof(int32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -14404,13 +14856,17 @@ func (sxts *StatxTimestamp) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (sxts *StatxTimestamp) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(sxts), uintptr(sxts.SizeBytes()))
+func (sxts *StatxTimestamp) MarshalUnsafe(dst []byte) []byte {
+ size := sxts.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(sxts), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (sxts *StatxTimestamp) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(sxts), unsafe.Pointer(&src[0]), uintptr(sxts.SizeBytes()))
+func (sxts *StatxTimestamp) UnmarshalUnsafe(src []byte) []byte {
+ size := sxts.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(sxts), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -14476,13 +14932,15 @@ func (t *TimeT) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (t *TimeT) MarshalBytes(dst []byte) {
+func (t *TimeT) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(*t))
+ return dst[8:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (t *TimeT) UnmarshalBytes(src []byte) {
+func (t *TimeT) UnmarshalBytes(src []byte) []byte {
*t = TimeT(int64(hostarch.ByteOrder.Uint64(src[:8])))
+ return src[8:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -14493,13 +14951,17 @@ func (t *TimeT) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (t *TimeT) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(t.SizeBytes()))
+func (t *TimeT) MarshalUnsafe(dst []byte) []byte {
+ size := t.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (t *TimeT) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(t.SizeBytes()))
+func (t *TimeT) UnmarshalUnsafe(src []byte) []byte {
+ size := t.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -14565,13 +15027,15 @@ func (t *TimerID) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (t *TimerID) MarshalBytes(dst []byte) {
+func (t *TimerID) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(*t))
+ return dst[4:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (t *TimerID) UnmarshalBytes(src []byte) {
+func (t *TimerID) UnmarshalBytes(src []byte) []byte {
*t = TimerID(int32(hostarch.ByteOrder.Uint32(src[:4])))
+ return src[4:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -14582,13 +15046,17 @@ func (t *TimerID) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (t *TimerID) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(t.SizeBytes()))
+func (t *TimerID) MarshalUnsafe(dst []byte) []byte {
+ size := t.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (t *TimerID) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(t.SizeBytes()))
+func (t *TimerID) UnmarshalUnsafe(src []byte) []byte {
+ size := t.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -14653,19 +15121,21 @@ func (ts *Timespec) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (ts *Timespec) MarshalBytes(dst []byte) {
+func (ts *Timespec) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(ts.Sec))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(ts.Nsec))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (ts *Timespec) UnmarshalBytes(src []byte) {
+func (ts *Timespec) UnmarshalBytes(src []byte) []byte {
ts.Sec = int64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
ts.Nsec = int64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -14675,13 +15145,17 @@ func (ts *Timespec) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (ts *Timespec) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(ts), uintptr(ts.SizeBytes()))
+func (ts *Timespec) MarshalUnsafe(dst []byte) []byte {
+ size := ts.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(ts), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (ts *Timespec) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(ts), unsafe.Pointer(&src[0]), uintptr(ts.SizeBytes()))
+func (ts *Timespec) UnmarshalUnsafe(src []byte) []byte {
+ size := ts.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(ts), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -14822,19 +15296,21 @@ func (tv *Timeval) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (tv *Timeval) MarshalBytes(dst []byte) {
+func (tv *Timeval) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(tv.Sec))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(tv.Usec))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (tv *Timeval) UnmarshalBytes(src []byte) {
+func (tv *Timeval) UnmarshalBytes(src []byte) []byte {
tv.Sec = int64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
tv.Usec = int64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -14844,13 +15320,17 @@ func (tv *Timeval) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (tv *Timeval) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(tv), uintptr(tv.SizeBytes()))
+func (tv *Timeval) MarshalUnsafe(dst []byte) []byte {
+ size := tv.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(tv), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (tv *Timeval) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(tv), unsafe.Pointer(&src[0]), uintptr(tv.SizeBytes()))
+func (tv *Timeval) UnmarshalUnsafe(src []byte) []byte {
+ size := tv.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(tv), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -14995,27 +15475,21 @@ func (t *Tms) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (t *Tms) MarshalBytes(dst []byte) {
- t.UTime.MarshalBytes(dst[:t.UTime.SizeBytes()])
- dst = dst[t.UTime.SizeBytes():]
- t.STime.MarshalBytes(dst[:t.STime.SizeBytes()])
- dst = dst[t.STime.SizeBytes():]
- t.CUTime.MarshalBytes(dst[:t.CUTime.SizeBytes()])
- dst = dst[t.CUTime.SizeBytes():]
- t.CSTime.MarshalBytes(dst[:t.CSTime.SizeBytes()])
- dst = dst[t.CSTime.SizeBytes():]
+func (t *Tms) MarshalBytes(dst []byte) []byte {
+ dst = t.UTime.MarshalBytes(dst)
+ dst = t.STime.MarshalBytes(dst)
+ dst = t.CUTime.MarshalBytes(dst)
+ dst = t.CSTime.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (t *Tms) UnmarshalBytes(src []byte) {
- t.UTime.UnmarshalBytes(src[:t.UTime.SizeBytes()])
- src = src[t.UTime.SizeBytes():]
- t.STime.UnmarshalBytes(src[:t.STime.SizeBytes()])
- src = src[t.STime.SizeBytes():]
- t.CUTime.UnmarshalBytes(src[:t.CUTime.SizeBytes()])
- src = src[t.CUTime.SizeBytes():]
- t.CSTime.UnmarshalBytes(src[:t.CSTime.SizeBytes()])
- src = src[t.CSTime.SizeBytes():]
+func (t *Tms) UnmarshalBytes(src []byte) []byte {
+ src = t.UTime.UnmarshalBytes(src)
+ src = t.STime.UnmarshalBytes(src)
+ src = t.CUTime.UnmarshalBytes(src)
+ src = t.CSTime.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -15025,23 +15499,25 @@ func (t *Tms) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (t *Tms) MarshalUnsafe(dst []byte) {
+func (t *Tms) MarshalUnsafe(dst []byte) []byte {
if t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(t.SizeBytes()))
- } else {
- // Type Tms doesn't have a packed layout in memory, fallback to MarshalBytes.
- t.MarshalBytes(dst)
+ size := t.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size))
+ return dst[size:]
}
+ // Type Tms doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return t.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (t *Tms) UnmarshalUnsafe(src []byte) {
+func (t *Tms) UnmarshalUnsafe(src []byte) []byte {
if t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() {
- gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(t.SizeBytes()))
- } else {
- // Type Tms doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- t.UnmarshalBytes(src)
+ size := t.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type Tms doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return t.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -15131,19 +15607,21 @@ func (u *Utime) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (u *Utime) MarshalBytes(dst []byte) {
+func (u *Utime) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Actime))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Modtime))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (u *Utime) UnmarshalBytes(src []byte) {
+func (u *Utime) UnmarshalBytes(src []byte) []byte {
u.Actime = int64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
u.Modtime = int64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -15153,13 +15631,17 @@ func (u *Utime) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (u *Utime) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(u.SizeBytes()))
+func (u *Utime) MarshalUnsafe(dst []byte) []byte {
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (u *Utime) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(u.SizeBytes()))
+func (u *Utime) UnmarshalUnsafe(src []byte) []byte {
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -15225,7 +15707,7 @@ func (t *Termios) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (t *Termios) MarshalBytes(dst []byte) {
+func (t *Termios) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.InputFlags))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.OutputFlags))
@@ -15240,10 +15722,11 @@ func (t *Termios) MarshalBytes(dst []byte) {
dst[0] = byte(t.ControlCharacters[idx])
dst = dst[1:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (t *Termios) UnmarshalBytes(src []byte) {
+func (t *Termios) UnmarshalBytes(src []byte) []byte {
t.InputFlags = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
t.OutputFlags = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -15258,6 +15741,7 @@ func (t *Termios) UnmarshalBytes(src []byte) {
t.ControlCharacters[idx] = uint8(src[0])
src = src[1:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -15267,13 +15751,17 @@ func (t *Termios) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (t *Termios) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(t.SizeBytes()))
+func (t *Termios) MarshalUnsafe(dst []byte) []byte {
+ size := t.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (t *Termios) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(t.SizeBytes()))
+func (t *Termios) UnmarshalUnsafe(src []byte) []byte {
+ size := t.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -15339,23 +15827,25 @@ func (w *WindowSize) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (w *WindowSize) MarshalBytes(dst []byte) {
+func (w *WindowSize) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Rows))
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Cols))
dst = dst[2:]
// Padding: dst[:sizeof(byte)*4] ~= [4]byte{0}
dst = dst[1*(4):]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (w *WindowSize) UnmarshalBytes(src []byte) {
+func (w *WindowSize) UnmarshalBytes(src []byte) []byte {
w.Rows = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
w.Cols = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
// Padding: ~ copy([4]byte(w._), src[:sizeof(byte)*4])
src = src[1*(4):]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -15365,13 +15855,17 @@ func (w *WindowSize) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (w *WindowSize) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(w), uintptr(w.SizeBytes()))
+func (w *WindowSize) MarshalUnsafe(dst []byte) []byte {
+ size := w.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(w), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (w *WindowSize) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(w), unsafe.Pointer(&src[0]), uintptr(w.SizeBytes()))
+func (w *WindowSize) UnmarshalUnsafe(src []byte) []byte {
+ size := w.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(w), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -15436,7 +15930,7 @@ func (w *Winsize) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (w *Winsize) MarshalBytes(dst []byte) {
+func (w *Winsize) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Row))
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Col))
@@ -15445,10 +15939,11 @@ func (w *Winsize) MarshalBytes(dst []byte) {
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Ypixel))
dst = dst[2:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (w *Winsize) UnmarshalBytes(src []byte) {
+func (w *Winsize) UnmarshalBytes(src []byte) []byte {
w.Row = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
w.Col = uint16(hostarch.ByteOrder.Uint16(src[:2]))
@@ -15457,6 +15952,7 @@ func (w *Winsize) UnmarshalBytes(src []byte) {
src = src[2:]
w.Ypixel = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -15466,13 +15962,17 @@ func (w *Winsize) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (w *Winsize) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(w), uintptr(w.SizeBytes()))
+func (w *Winsize) MarshalUnsafe(dst []byte) []byte {
+ size := w.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(w), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (w *Winsize) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(w), unsafe.Pointer(&src[0]), uintptr(w.SizeBytes()))
+func (w *Winsize) UnmarshalUnsafe(src []byte) []byte {
+ size := w.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(w), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -15543,7 +16043,7 @@ func (u *UtsName) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (u *UtsName) MarshalBytes(dst []byte) {
+func (u *UtsName) MarshalBytes(dst []byte) []byte {
for idx := 0; idx < (UTSLen+1); idx++ {
dst[0] = byte(u.Sysname[idx])
dst = dst[1:]
@@ -15568,10 +16068,11 @@ func (u *UtsName) MarshalBytes(dst []byte) {
dst[0] = byte(u.Domainname[idx])
dst = dst[1:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (u *UtsName) UnmarshalBytes(src []byte) {
+func (u *UtsName) UnmarshalBytes(src []byte) []byte {
for idx := 0; idx < (UTSLen+1); idx++ {
u.Sysname[idx] = src[0]
src = src[1:]
@@ -15596,6 +16097,7 @@ func (u *UtsName) UnmarshalBytes(src []byte) {
u.Domainname[idx] = src[0]
src = src[1:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -15605,13 +16107,17 @@ func (u *UtsName) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (u *UtsName) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(u.SizeBytes()))
+func (u *UtsName) MarshalUnsafe(dst []byte) []byte {
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (u *UtsName) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(u.SizeBytes()))
+func (u *UtsName) UnmarshalUnsafe(src []byte) []byte {
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
diff --git a/pkg/abi/linux/linux_amd64_abi_autogen_unsafe.go b/pkg/abi/linux/linux_amd64_abi_autogen_unsafe.go
index 770b19c2f..75ce7393f 100644
--- a/pkg/abi/linux/linux_amd64_abi_autogen_unsafe.go
+++ b/pkg/abi/linux/linux_amd64_abi_autogen_unsafe.go
@@ -37,23 +37,25 @@ func (e *EpollEvent) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (e *EpollEvent) MarshalBytes(dst []byte) {
+func (e *EpollEvent) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Events))
dst = dst[4:]
for idx := 0; idx < 2; idx++ {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Data[idx]))
dst = dst[4:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (e *EpollEvent) UnmarshalBytes(src []byte) {
+func (e *EpollEvent) UnmarshalBytes(src []byte) []byte {
e.Events = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
for idx := 0; idx < 2; idx++ {
e.Data[idx] = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -63,13 +65,17 @@ func (e *EpollEvent) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (e *EpollEvent) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(e.SizeBytes()))
+func (e *EpollEvent) MarshalUnsafe(dst []byte) []byte {
+ size := e.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (e *EpollEvent) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(e.SizeBytes()))
+func (e *EpollEvent) UnmarshalUnsafe(src []byte) []byte {
+ size := e.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -214,7 +220,7 @@ func (s *Stat) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *Stat) MarshalBytes(dst []byte) {
+func (s *Stat) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Dev))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Ino))
@@ -237,18 +243,16 @@ func (s *Stat) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Blocks))
dst = dst[8:]
- s.ATime.MarshalBytes(dst[:s.ATime.SizeBytes()])
- dst = dst[s.ATime.SizeBytes():]
- s.MTime.MarshalBytes(dst[:s.MTime.SizeBytes()])
- dst = dst[s.MTime.SizeBytes():]
- s.CTime.MarshalBytes(dst[:s.CTime.SizeBytes()])
- dst = dst[s.CTime.SizeBytes():]
+ dst = s.ATime.MarshalBytes(dst)
+ dst = s.MTime.MarshalBytes(dst)
+ dst = s.CTime.MarshalBytes(dst)
// Padding: dst[:sizeof(int64)*3] ~= [3]int64{0}
dst = dst[8*(3):]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *Stat) UnmarshalBytes(src []byte) {
+func (s *Stat) UnmarshalBytes(src []byte) []byte {
s.Dev = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
s.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -271,14 +275,12 @@ func (s *Stat) UnmarshalBytes(src []byte) {
src = src[8:]
s.Blocks = int64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
- s.ATime.UnmarshalBytes(src[:s.ATime.SizeBytes()])
- src = src[s.ATime.SizeBytes():]
- s.MTime.UnmarshalBytes(src[:s.MTime.SizeBytes()])
- src = src[s.MTime.SizeBytes():]
- s.CTime.UnmarshalBytes(src[:s.CTime.SizeBytes()])
- src = src[s.CTime.SizeBytes():]
+ src = s.ATime.UnmarshalBytes(src)
+ src = s.MTime.UnmarshalBytes(src)
+ src = s.CTime.UnmarshalBytes(src)
// Padding: ~ copy([3]int64(s._), src[:sizeof(int64)*3])
src = src[8*(3):]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -288,23 +290,25 @@ func (s *Stat) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *Stat) MarshalUnsafe(dst []byte) {
+func (s *Stat) MarshalUnsafe(dst []byte) []byte {
if s.ATime.Packed() && s.CTime.Packed() && s.MTime.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type Stat doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type Stat doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *Stat) UnmarshalUnsafe(src []byte) {
+func (s *Stat) UnmarshalUnsafe(src []byte) []byte {
if s.ATime.Packed() && s.CTime.Packed() && s.MTime.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type Stat doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type Stat doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -394,7 +398,7 @@ func (p *PtraceRegs) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (p *PtraceRegs) MarshalBytes(dst []byte) {
+func (p *PtraceRegs) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(p.R15))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(p.R14))
@@ -449,10 +453,11 @@ func (p *PtraceRegs) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(p.Gs))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (p *PtraceRegs) UnmarshalBytes(src []byte) {
+func (p *PtraceRegs) UnmarshalBytes(src []byte) []byte {
p.R15 = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
p.R14 = uint64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -507,6 +512,7 @@ func (p *PtraceRegs) UnmarshalBytes(src []byte) {
src = src[8:]
p.Gs = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -516,13 +522,17 @@ func (p *PtraceRegs) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (p *PtraceRegs) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(p), uintptr(p.SizeBytes()))
+func (p *PtraceRegs) MarshalUnsafe(dst []byte) []byte {
+ size := p.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(p), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (p *PtraceRegs) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(p), unsafe.Pointer(&src[0]), uintptr(p.SizeBytes()))
+func (p *PtraceRegs) UnmarshalUnsafe(src []byte) []byte {
+ size := p.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(p), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -590,15 +600,12 @@ func (s *SemidDS) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SemidDS) MarshalBytes(dst []byte) {
- s.SemPerm.MarshalBytes(dst[:s.SemPerm.SizeBytes()])
- dst = dst[s.SemPerm.SizeBytes():]
- s.SemOTime.MarshalBytes(dst[:s.SemOTime.SizeBytes()])
- dst = dst[s.SemOTime.SizeBytes():]
+func (s *SemidDS) MarshalBytes(dst []byte) []byte {
+ dst = s.SemPerm.MarshalBytes(dst)
+ dst = s.SemOTime.MarshalBytes(dst)
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.unused1))
dst = dst[8:]
- s.SemCTime.MarshalBytes(dst[:s.SemCTime.SizeBytes()])
- dst = dst[s.SemCTime.SizeBytes():]
+ dst = s.SemCTime.MarshalBytes(dst)
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.unused2))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SemNSems))
@@ -607,18 +614,16 @@ func (s *SemidDS) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.unused4))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SemidDS) UnmarshalBytes(src []byte) {
- s.SemPerm.UnmarshalBytes(src[:s.SemPerm.SizeBytes()])
- src = src[s.SemPerm.SizeBytes():]
- s.SemOTime.UnmarshalBytes(src[:s.SemOTime.SizeBytes()])
- src = src[s.SemOTime.SizeBytes():]
+func (s *SemidDS) UnmarshalBytes(src []byte) []byte {
+ src = s.SemPerm.UnmarshalBytes(src)
+ src = s.SemOTime.UnmarshalBytes(src)
s.unused1 = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
- s.SemCTime.UnmarshalBytes(src[:s.SemCTime.SizeBytes()])
- src = src[s.SemCTime.SizeBytes():]
+ src = s.SemCTime.UnmarshalBytes(src)
s.unused2 = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
s.SemNSems = uint64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -627,6 +632,7 @@ func (s *SemidDS) UnmarshalBytes(src []byte) {
src = src[8:]
s.unused4 = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -636,23 +642,25 @@ func (s *SemidDS) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SemidDS) MarshalUnsafe(dst []byte) {
+func (s *SemidDS) MarshalUnsafe(dst []byte) []byte {
if s.SemCTime.Packed() && s.SemOTime.Packed() && s.SemPerm.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type SemidDS doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type SemidDS doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SemidDS) UnmarshalUnsafe(src []byte) {
+func (s *SemidDS) UnmarshalUnsafe(src []byte) []byte {
if s.SemCTime.Packed() && s.SemOTime.Packed() && s.SemPerm.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type SemidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type SemidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
diff --git a/pkg/abi/linux/linux_arm64_abi_autogen_unsafe.go b/pkg/abi/linux/linux_arm64_abi_autogen_unsafe.go
index 06c2aec98..f23283a7b 100644
--- a/pkg/abi/linux/linux_arm64_abi_autogen_unsafe.go
+++ b/pkg/abi/linux/linux_arm64_abi_autogen_unsafe.go
@@ -37,7 +37,7 @@ func (e *EpollEvent) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (e *EpollEvent) MarshalBytes(dst []byte) {
+func (e *EpollEvent) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Events))
dst = dst[4:]
// Padding: dst[:sizeof(int32)] ~= int32(0)
@@ -46,10 +46,11 @@ func (e *EpollEvent) MarshalBytes(dst []byte) {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Data[idx]))
dst = dst[4:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (e *EpollEvent) UnmarshalBytes(src []byte) {
+func (e *EpollEvent) UnmarshalBytes(src []byte) []byte {
e.Events = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
// Padding: var _ int32 ~= src[:sizeof(int32)]
@@ -58,6 +59,7 @@ func (e *EpollEvent) UnmarshalBytes(src []byte) {
e.Data[idx] = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -67,13 +69,17 @@ func (e *EpollEvent) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (e *EpollEvent) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(e.SizeBytes()))
+func (e *EpollEvent) MarshalUnsafe(dst []byte) []byte {
+ size := e.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (e *EpollEvent) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(e.SizeBytes()))
+func (e *EpollEvent) UnmarshalUnsafe(src []byte) []byte {
+ size := e.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -218,7 +224,7 @@ func (s *Stat) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *Stat) MarshalBytes(dst []byte) {
+func (s *Stat) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Dev))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Ino))
@@ -243,18 +249,16 @@ func (s *Stat) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Blocks))
dst = dst[8:]
- s.ATime.MarshalBytes(dst[:s.ATime.SizeBytes()])
- dst = dst[s.ATime.SizeBytes():]
- s.MTime.MarshalBytes(dst[:s.MTime.SizeBytes()])
- dst = dst[s.MTime.SizeBytes():]
- s.CTime.MarshalBytes(dst[:s.CTime.SizeBytes()])
- dst = dst[s.CTime.SizeBytes():]
+ dst = s.ATime.MarshalBytes(dst)
+ dst = s.MTime.MarshalBytes(dst)
+ dst = s.CTime.MarshalBytes(dst)
// Padding: dst[:sizeof(int32)*2] ~= [2]int32{0}
dst = dst[4*(2):]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *Stat) UnmarshalBytes(src []byte) {
+func (s *Stat) UnmarshalBytes(src []byte) []byte {
s.Dev = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
s.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -279,14 +283,12 @@ func (s *Stat) UnmarshalBytes(src []byte) {
src = src[4:]
s.Blocks = int64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
- s.ATime.UnmarshalBytes(src[:s.ATime.SizeBytes()])
- src = src[s.ATime.SizeBytes():]
- s.MTime.UnmarshalBytes(src[:s.MTime.SizeBytes()])
- src = src[s.MTime.SizeBytes():]
- s.CTime.UnmarshalBytes(src[:s.CTime.SizeBytes()])
- src = src[s.CTime.SizeBytes():]
+ src = s.ATime.UnmarshalBytes(src)
+ src = s.MTime.UnmarshalBytes(src)
+ src = s.CTime.UnmarshalBytes(src)
// Padding: ~ copy([2]int32(s._), src[:sizeof(int32)*2])
src = src[4*(2):]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -296,23 +298,25 @@ func (s *Stat) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *Stat) MarshalUnsafe(dst []byte) {
+func (s *Stat) MarshalUnsafe(dst []byte) []byte {
if s.ATime.Packed() && s.CTime.Packed() && s.MTime.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type Stat doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type Stat doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *Stat) UnmarshalUnsafe(src []byte) {
+func (s *Stat) UnmarshalUnsafe(src []byte) []byte {
if s.ATime.Packed() && s.CTime.Packed() && s.MTime.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type Stat doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type Stat doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -403,7 +407,7 @@ func (p *PtraceRegs) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (p *PtraceRegs) MarshalBytes(dst []byte) {
+func (p *PtraceRegs) MarshalBytes(dst []byte) []byte {
for idx := 0; idx < 31; idx++ {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(p.Regs[idx]))
dst = dst[8:]
@@ -414,10 +418,11 @@ func (p *PtraceRegs) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(p.Pstate))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (p *PtraceRegs) UnmarshalBytes(src []byte) {
+func (p *PtraceRegs) UnmarshalBytes(src []byte) []byte {
for idx := 0; idx < 31; idx++ {
p.Regs[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
@@ -428,6 +433,7 @@ func (p *PtraceRegs) UnmarshalBytes(src []byte) {
src = src[8:]
p.Pstate = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -437,13 +443,17 @@ func (p *PtraceRegs) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (p *PtraceRegs) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(p), uintptr(p.SizeBytes()))
+func (p *PtraceRegs) MarshalUnsafe(dst []byte) []byte {
+ size := p.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(p), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (p *PtraceRegs) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(p), unsafe.Pointer(&src[0]), uintptr(p.SizeBytes()))
+func (p *PtraceRegs) UnmarshalUnsafe(src []byte) []byte {
+ size := p.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(p), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -511,35 +521,31 @@ func (s *SemidDS) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SemidDS) MarshalBytes(dst []byte) {
- s.SemPerm.MarshalBytes(dst[:s.SemPerm.SizeBytes()])
- dst = dst[s.SemPerm.SizeBytes():]
- s.SemOTime.MarshalBytes(dst[:s.SemOTime.SizeBytes()])
- dst = dst[s.SemOTime.SizeBytes():]
- s.SemCTime.MarshalBytes(dst[:s.SemCTime.SizeBytes()])
- dst = dst[s.SemCTime.SizeBytes():]
+func (s *SemidDS) MarshalBytes(dst []byte) []byte {
+ dst = s.SemPerm.MarshalBytes(dst)
+ dst = s.SemOTime.MarshalBytes(dst)
+ dst = s.SemCTime.MarshalBytes(dst)
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SemNSems))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.unused3))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.unused4))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SemidDS) UnmarshalBytes(src []byte) {
- s.SemPerm.UnmarshalBytes(src[:s.SemPerm.SizeBytes()])
- src = src[s.SemPerm.SizeBytes():]
- s.SemOTime.UnmarshalBytes(src[:s.SemOTime.SizeBytes()])
- src = src[s.SemOTime.SizeBytes():]
- s.SemCTime.UnmarshalBytes(src[:s.SemCTime.SizeBytes()])
- src = src[s.SemCTime.SizeBytes():]
+func (s *SemidDS) UnmarshalBytes(src []byte) []byte {
+ src = s.SemPerm.UnmarshalBytes(src)
+ src = s.SemOTime.UnmarshalBytes(src)
+ src = s.SemCTime.UnmarshalBytes(src)
s.SemNSems = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
s.unused3 = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
s.unused4 = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -549,23 +555,25 @@ func (s *SemidDS) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SemidDS) MarshalUnsafe(dst []byte) {
+func (s *SemidDS) MarshalUnsafe(dst []byte) []byte {
if s.SemCTime.Packed() && s.SemOTime.Packed() && s.SemPerm.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type SemidDS doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type SemidDS doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SemidDS) UnmarshalUnsafe(src []byte) {
+func (s *SemidDS) UnmarshalUnsafe(src []byte) []byte {
if s.SemCTime.Packed() && s.SemOTime.Packed() && s.SemPerm.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type SemidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type SemidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
diff --git a/pkg/abi/linux/msgqueue.go b/pkg/abi/linux/msgqueue.go
index 0612a8214..6f8eb4dd9 100644
--- a/pkg/abi/linux/msgqueue.go
+++ b/pkg/abi/linux/msgqueue.go
@@ -82,15 +82,15 @@ func (b *MsgBuf) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (b *MsgBuf) MarshalBytes(dst []byte) {
- b.Type.MarshalUnsafe(dst)
- b.Text.MarshalBytes(dst[b.Type.SizeBytes():])
+func (b *MsgBuf) MarshalBytes(dst []byte) []byte {
+ dst = b.Type.MarshalUnsafe(dst)
+ return b.Text.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (b *MsgBuf) UnmarshalBytes(src []byte) {
- b.Type.UnmarshalUnsafe(src)
- b.Text.UnmarshalBytes(src[b.Type.SizeBytes():])
+func (b *MsgBuf) UnmarshalBytes(src []byte) []byte {
+ src = b.Type.UnmarshalUnsafe(src)
+ return b.Text.UnmarshalBytes(src)
}
// MsgInfo is equivelant to struct msginfo. Source: include/uapi/linux/msg.h
diff --git a/pkg/abi/linux/netfilter.go b/pkg/abi/linux/netfilter.go
index 3fd05483a..1470a5578 100644
--- a/pkg/abi/linux/netfilter.go
+++ b/pkg/abi/linux/netfilter.go
@@ -144,15 +144,15 @@ func (ke *KernelIPTEntry) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (ke *KernelIPTEntry) MarshalBytes(dst []byte) {
- ke.Entry.MarshalUnsafe(dst)
- ke.Elems.MarshalBytes(dst[ke.Entry.SizeBytes():])
+func (ke *KernelIPTEntry) MarshalBytes(dst []byte) []byte {
+ dst = ke.Entry.MarshalUnsafe(dst)
+ return ke.Elems.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (ke *KernelIPTEntry) UnmarshalBytes(src []byte) {
- ke.Entry.UnmarshalUnsafe(src)
- ke.Elems.UnmarshalBytes(src[ke.Entry.SizeBytes():])
+func (ke *KernelIPTEntry) UnmarshalBytes(src []byte) []byte {
+ src = ke.Entry.UnmarshalUnsafe(src)
+ return ke.Elems.UnmarshalBytes(src)
}
var _ marshal.Marshallable = (*KernelIPTEntry)(nil)
@@ -455,23 +455,21 @@ func (ke *KernelIPTGetEntries) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (ke *KernelIPTGetEntries) MarshalBytes(dst []byte) {
- ke.IPTGetEntries.MarshalUnsafe(dst)
- marshalledUntil := ke.IPTGetEntries.SizeBytes()
+func (ke *KernelIPTGetEntries) MarshalBytes(dst []byte) []byte {
+ dst = ke.IPTGetEntries.MarshalUnsafe(dst)
for i := range ke.Entrytable {
- ke.Entrytable[i].MarshalBytes(dst[marshalledUntil:])
- marshalledUntil += ke.Entrytable[i].SizeBytes()
+ dst = ke.Entrytable[i].MarshalBytes(dst)
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (ke *KernelIPTGetEntries) UnmarshalBytes(src []byte) {
- ke.IPTGetEntries.UnmarshalUnsafe(src)
- unmarshalledUntil := ke.IPTGetEntries.SizeBytes()
+func (ke *KernelIPTGetEntries) UnmarshalBytes(src []byte) []byte {
+ src = ke.IPTGetEntries.UnmarshalUnsafe(src)
for i := range ke.Entrytable {
- ke.Entrytable[i].UnmarshalBytes(src[unmarshalledUntil:])
- unmarshalledUntil += ke.Entrytable[i].SizeBytes()
+ src = ke.Entrytable[i].UnmarshalBytes(src)
}
+ return src
}
var _ marshal.Marshallable = (*KernelIPTGetEntries)(nil)
diff --git a/pkg/abi/linux/netfilter_ipv6.go b/pkg/abi/linux/netfilter_ipv6.go
index f8c0e891e..aba0202ef 100644
--- a/pkg/abi/linux/netfilter_ipv6.go
+++ b/pkg/abi/linux/netfilter_ipv6.go
@@ -84,23 +84,21 @@ func (ke *KernelIP6TGetEntries) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (ke *KernelIP6TGetEntries) MarshalBytes(dst []byte) {
- ke.IPTGetEntries.MarshalUnsafe(dst)
- marshalledUntil := ke.IPTGetEntries.SizeBytes()
+func (ke *KernelIP6TGetEntries) MarshalBytes(dst []byte) []byte {
+ dst = ke.IPTGetEntries.MarshalUnsafe(dst)
for i := range ke.Entrytable {
- ke.Entrytable[i].MarshalBytes(dst[marshalledUntil:])
- marshalledUntil += ke.Entrytable[i].SizeBytes()
+ dst = ke.Entrytable[i].MarshalBytes(dst)
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (ke *KernelIP6TGetEntries) UnmarshalBytes(src []byte) {
- ke.IPTGetEntries.UnmarshalUnsafe(src)
- unmarshalledUntil := ke.IPTGetEntries.SizeBytes()
+func (ke *KernelIP6TGetEntries) UnmarshalBytes(src []byte) []byte {
+ src = ke.IPTGetEntries.UnmarshalUnsafe(src)
for i := range ke.Entrytable {
- ke.Entrytable[i].UnmarshalBytes(src[unmarshalledUntil:])
- unmarshalledUntil += ke.Entrytable[i].SizeBytes()
+ src = ke.Entrytable[i].UnmarshalBytes(src)
}
+ return src
}
var _ marshal.Marshallable = (*KernelIP6TGetEntries)(nil)
@@ -166,17 +164,19 @@ func (ke *KernelIP6TEntry) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (ke *KernelIP6TEntry) MarshalBytes(dst []byte) {
- ke.Entry.MarshalUnsafe(dst)
- ke.Elems.MarshalBytes(dst[ke.Entry.SizeBytes():])
+func (ke *KernelIP6TEntry) MarshalBytes(dst []byte) []byte {
+ dst = ke.Entry.MarshalUnsafe(dst)
+ return ke.Elems.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (ke *KernelIP6TEntry) UnmarshalBytes(src []byte) {
- ke.Entry.UnmarshalUnsafe(src)
- ke.Elems.UnmarshalBytes(src[ke.Entry.SizeBytes():])
+func (ke *KernelIP6TEntry) UnmarshalBytes(src []byte) []byte {
+ src = ke.Entry.UnmarshalUnsafe(src)
+ return ke.Elems.UnmarshalBytes(src)
}
+var _ marshal.Marshallable = (*KernelIP6TEntry)(nil)
+
// IP6TIP contains information for matching a packet's IP header.
// It corresponds to struct ip6t_ip6 in
// include/uapi/linux/netfilter_ipv6/ip6_tables.h.
diff --git a/pkg/abi/linux/socket.go b/pkg/abi/linux/socket.go
index f60e42997..a31690a04 100644
--- a/pkg/abi/linux/socket.go
+++ b/pkg/abi/linux/socket.go
@@ -555,9 +555,6 @@ type ControlMessageIPv6PacketInfo struct {
// ControlMessageCredentials struct.
var SizeOfControlMessageCredentials = (*ControlMessageCredentials)(nil).SizeBytes()
-// A ControlMessageRights is an SCM_RIGHTS socket control message.
-type ControlMessageRights []int32
-
// SizeOfControlMessageRight is the size of a single element in
// ControlMessageRights.
const SizeOfControlMessageRight = 4
diff --git a/pkg/lisafs/client.go b/pkg/lisafs/client.go
index ccf1b9f72..e0f278b5c 100644
--- a/pkg/lisafs/client.go
+++ b/pkg/lisafs/client.go
@@ -313,7 +313,7 @@ func (c *Client) SyncFDs(ctx context.Context, fds []FDID) error {
// implicit conversion to an interface leads to an allocation.
//
// Precondition: reqMarshal and respUnmarshal must be non-nil.
-func (c *Client) SndRcvMessage(m MID, payloadLen uint32, reqMarshal func(dst []byte), respUnmarshal func(src []byte), respFDs []int) error {
+func (c *Client) SndRcvMessage(m MID, payloadLen uint32, reqMarshal func(dst []byte) []byte, respUnmarshal func(src []byte) []byte, respFDs []int) error {
if !c.IsSupported(m) {
return unix.EOPNOTSUPP
}
diff --git a/pkg/lisafs/lisafs_abi_autogen_unsafe.go b/pkg/lisafs/lisafs_abi_autogen_unsafe.go
index 828c75a4e..1df29512b 100644
--- a/pkg/lisafs/lisafs_abi_autogen_unsafe.go
+++ b/pkg/lisafs/lisafs_abi_autogen_unsafe.go
@@ -58,23 +58,23 @@ func (c *channelHeader) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (c *channelHeader) MarshalBytes(dst []byte) {
- c.message.MarshalBytes(dst[:c.message.SizeBytes()])
- dst = dst[c.message.SizeBytes():]
+func (c *channelHeader) MarshalBytes(dst []byte) []byte {
+ dst = c.message.MarshalBytes(dst)
dst[0] = byte(c.numFDs)
dst = dst[1:]
// Padding: dst[:sizeof(uint8)] ~= uint8(0)
dst = dst[1:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (c *channelHeader) UnmarshalBytes(src []byte) {
- c.message.UnmarshalBytes(src[:c.message.SizeBytes()])
- src = src[c.message.SizeBytes():]
+func (c *channelHeader) UnmarshalBytes(src []byte) []byte {
+ src = c.message.UnmarshalBytes(src)
c.numFDs = uint8(src[0])
src = src[1:]
// Padding: var _ uint8 ~= src[:sizeof(uint8)]
src = src[1:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -84,23 +84,25 @@ func (c *channelHeader) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (c *channelHeader) MarshalUnsafe(dst []byte) {
+func (c *channelHeader) MarshalUnsafe(dst []byte) []byte {
if c.message.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(c.SizeBytes()))
- } else {
- // Type channelHeader doesn't have a packed layout in memory, fallback to MarshalBytes.
- c.MarshalBytes(dst)
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size))
+ return dst[size:]
}
+ // Type channelHeader doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return c.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (c *channelHeader) UnmarshalUnsafe(src []byte) {
+func (c *channelHeader) UnmarshalUnsafe(src []byte) []byte {
if c.message.Packed() {
- gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(c.SizeBytes()))
- } else {
- // Type channelHeader doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- c.UnmarshalBytes(src)
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type channelHeader doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return c.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -191,13 +193,15 @@ func (f *FDID) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FDID) MarshalBytes(dst []byte) {
+func (f *FDID) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(*f))
+ return dst[4:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FDID) UnmarshalBytes(src []byte) {
+func (f *FDID) UnmarshalBytes(src []byte) []byte {
*f = FDID(uint32(hostarch.ByteOrder.Uint32(src[:4])))
+ return src[4:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -208,13 +212,17 @@ func (f *FDID) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FDID) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
+func (f *FDID) MarshalUnsafe(dst []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FDID) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
+func (f *FDID) UnmarshalUnsafe(src []byte) []byte {
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -357,19 +365,21 @@ func (c *ChannelResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (c *ChannelResp) MarshalBytes(dst []byte) {
+func (c *ChannelResp) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.dataOffset))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.dataLength))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (c *ChannelResp) UnmarshalBytes(src []byte) {
+func (c *ChannelResp) UnmarshalBytes(src []byte) []byte {
c.dataOffset = int64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
c.dataLength = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -379,13 +389,17 @@ func (c *ChannelResp) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (c *ChannelResp) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(c.SizeBytes()))
+func (c *ChannelResp) MarshalUnsafe(dst []byte) []byte {
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (c *ChannelResp) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(c.SizeBytes()))
+func (c *ChannelResp) UnmarshalUnsafe(src []byte) []byte {
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -451,19 +465,19 @@ func (c *ConnectReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (c *ConnectReq) MarshalBytes(dst []byte) {
- c.FD.MarshalBytes(dst[:c.FD.SizeBytes()])
- dst = dst[c.FD.SizeBytes():]
+func (c *ConnectReq) MarshalBytes(dst []byte) []byte {
+ dst = c.FD.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.SockType))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (c *ConnectReq) UnmarshalBytes(src []byte) {
- c.FD.UnmarshalBytes(src[:c.FD.SizeBytes()])
- src = src[c.FD.SizeBytes():]
+func (c *ConnectReq) UnmarshalBytes(src []byte) []byte {
+ src = c.FD.UnmarshalBytes(src)
c.SockType = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -473,23 +487,25 @@ func (c *ConnectReq) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (c *ConnectReq) MarshalUnsafe(dst []byte) {
+func (c *ConnectReq) MarshalUnsafe(dst []byte) []byte {
if c.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(c.SizeBytes()))
- } else {
- // Type ConnectReq doesn't have a packed layout in memory, fallback to MarshalBytes.
- c.MarshalBytes(dst)
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size))
+ return dst[size:]
}
+ // Type ConnectReq doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return c.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (c *ConnectReq) UnmarshalUnsafe(src []byte) {
+func (c *ConnectReq) UnmarshalUnsafe(src []byte) []byte {
if c.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(c.SizeBytes()))
- } else {
- // Type ConnectReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- c.UnmarshalBytes(src)
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type ConnectReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return c.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -579,15 +595,17 @@ func (e *ErrorResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (e *ErrorResp) MarshalBytes(dst []byte) {
+func (e *ErrorResp) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.errno))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (e *ErrorResp) UnmarshalBytes(src []byte) {
+func (e *ErrorResp) UnmarshalBytes(src []byte) []byte {
e.errno = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -597,13 +615,17 @@ func (e *ErrorResp) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (e *ErrorResp) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(e.SizeBytes()))
+func (e *ErrorResp) MarshalUnsafe(dst []byte) []byte {
+ size := e.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (e *ErrorResp) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(e.SizeBytes()))
+func (e *ErrorResp) UnmarshalUnsafe(src []byte) []byte {
+ size := e.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -669,9 +691,8 @@ func (f *FAllocateReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FAllocateReq) MarshalBytes(dst []byte) {
- f.FD.MarshalBytes(dst[:f.FD.SizeBytes()])
- dst = dst[f.FD.SizeBytes():]
+func (f *FAllocateReq) MarshalBytes(dst []byte) []byte {
+ dst = f.FD.MarshalBytes(dst)
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Mode))
@@ -680,12 +701,12 @@ func (f *FAllocateReq) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Length))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FAllocateReq) UnmarshalBytes(src []byte) {
- f.FD.UnmarshalBytes(src[:f.FD.SizeBytes()])
- src = src[f.FD.SizeBytes():]
+func (f *FAllocateReq) UnmarshalBytes(src []byte) []byte {
+ src = f.FD.UnmarshalBytes(src)
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
f.Mode = uint64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -694,6 +715,7 @@ func (f *FAllocateReq) UnmarshalBytes(src []byte) {
src = src[8:]
f.Length = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -703,23 +725,25 @@ func (f *FAllocateReq) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FAllocateReq) MarshalUnsafe(dst []byte) {
+func (f *FAllocateReq) MarshalUnsafe(dst []byte) []byte {
if f.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
- } else {
- // Type FAllocateReq doesn't have a packed layout in memory, fallback to MarshalBytes.
- f.MarshalBytes(dst)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
+ // Type FAllocateReq doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return f.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FAllocateReq) UnmarshalUnsafe(src []byte) {
+func (f *FAllocateReq) UnmarshalUnsafe(src []byte) []byte {
if f.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
- } else {
- // Type FAllocateReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- f.UnmarshalBytes(src)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type FAllocateReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return f.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -810,23 +834,23 @@ func (f *FListXattrReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FListXattrReq) MarshalBytes(dst []byte) {
- f.FD.MarshalBytes(dst[:f.FD.SizeBytes()])
- dst = dst[f.FD.SizeBytes():]
+func (f *FListXattrReq) MarshalBytes(dst []byte) []byte {
+ dst = f.FD.MarshalBytes(dst)
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Size))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FListXattrReq) UnmarshalBytes(src []byte) {
- f.FD.UnmarshalBytes(src[:f.FD.SizeBytes()])
- src = src[f.FD.SizeBytes():]
+func (f *FListXattrReq) UnmarshalBytes(src []byte) []byte {
+ src = f.FD.UnmarshalBytes(src)
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
f.Size = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -836,23 +860,25 @@ func (f *FListXattrReq) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FListXattrReq) MarshalUnsafe(dst []byte) {
+func (f *FListXattrReq) MarshalUnsafe(dst []byte) []byte {
if f.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
- } else {
- // Type FListXattrReq doesn't have a packed layout in memory, fallback to MarshalBytes.
- f.MarshalBytes(dst)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
+ // Type FListXattrReq doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return f.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FListXattrReq) UnmarshalUnsafe(src []byte) {
+func (f *FListXattrReq) UnmarshalUnsafe(src []byte) []byte {
if f.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
- } else {
- // Type FListXattrReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- f.UnmarshalBytes(src)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type FListXattrReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return f.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -943,15 +969,15 @@ func (f *FStatFSReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FStatFSReq) MarshalBytes(dst []byte) {
- f.FD.MarshalBytes(dst[:f.FD.SizeBytes()])
- dst = dst[f.FD.SizeBytes():]
+func (f *FStatFSReq) MarshalBytes(dst []byte) []byte {
+ dst = f.FD.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FStatFSReq) UnmarshalBytes(src []byte) {
- f.FD.UnmarshalBytes(src[:f.FD.SizeBytes()])
- src = src[f.FD.SizeBytes():]
+func (f *FStatFSReq) UnmarshalBytes(src []byte) []byte {
+ src = f.FD.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -961,23 +987,25 @@ func (f *FStatFSReq) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FStatFSReq) MarshalUnsafe(dst []byte) {
+func (f *FStatFSReq) MarshalUnsafe(dst []byte) []byte {
if f.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
- } else {
- // Type FStatFSReq doesn't have a packed layout in memory, fallback to MarshalBytes.
- f.MarshalBytes(dst)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
+ // Type FStatFSReq doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return f.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FStatFSReq) UnmarshalUnsafe(src []byte) {
+func (f *FStatFSReq) UnmarshalUnsafe(src []byte) []byte {
if f.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
- } else {
- // Type FStatFSReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- f.UnmarshalBytes(src)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type FStatFSReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return f.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1068,15 +1096,15 @@ func (f *FlushReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FlushReq) MarshalBytes(dst []byte) {
- f.FD.MarshalBytes(dst[:f.FD.SizeBytes()])
- dst = dst[f.FD.SizeBytes():]
+func (f *FlushReq) MarshalBytes(dst []byte) []byte {
+ dst = f.FD.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FlushReq) UnmarshalBytes(src []byte) {
- f.FD.UnmarshalBytes(src[:f.FD.SizeBytes()])
- src = src[f.FD.SizeBytes():]
+func (f *FlushReq) UnmarshalBytes(src []byte) []byte {
+ src = f.FD.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -1086,23 +1114,25 @@ func (f *FlushReq) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FlushReq) MarshalUnsafe(dst []byte) {
+func (f *FlushReq) MarshalUnsafe(dst []byte) []byte {
if f.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
- } else {
- // Type FlushReq doesn't have a packed layout in memory, fallback to MarshalBytes.
- f.MarshalBytes(dst)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
+ // Type FlushReq doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return f.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FlushReq) UnmarshalUnsafe(src []byte) {
+func (f *FlushReq) UnmarshalUnsafe(src []byte) []byte {
if f.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
- } else {
- // Type FlushReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- f.UnmarshalBytes(src)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type FlushReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return f.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1193,13 +1223,15 @@ func (gid *GID) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (gid *GID) MarshalBytes(dst []byte) {
+func (gid *GID) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(*gid))
+ return dst[4:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (gid *GID) UnmarshalBytes(src []byte) {
+func (gid *GID) UnmarshalBytes(src []byte) []byte {
*gid = GID(uint32(hostarch.ByteOrder.Uint32(src[:4])))
+ return src[4:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -1210,13 +1242,17 @@ func (gid *GID) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (gid *GID) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(gid), uintptr(gid.SizeBytes()))
+func (gid *GID) MarshalUnsafe(dst []byte) []byte {
+ size := gid.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(gid), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (gid *GID) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(gid), unsafe.Pointer(&src[0]), uintptr(gid.SizeBytes()))
+func (gid *GID) UnmarshalUnsafe(src []byte) []byte {
+ size := gid.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(gid), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1282,19 +1318,19 @@ func (g *Getdents64Req) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (g *Getdents64Req) MarshalBytes(dst []byte) {
- g.DirFD.MarshalBytes(dst[:g.DirFD.SizeBytes()])
- dst = dst[g.DirFD.SizeBytes():]
+func (g *Getdents64Req) MarshalBytes(dst []byte) []byte {
+ dst = g.DirFD.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(g.Count))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (g *Getdents64Req) UnmarshalBytes(src []byte) {
- g.DirFD.UnmarshalBytes(src[:g.DirFD.SizeBytes()])
- src = src[g.DirFD.SizeBytes():]
+func (g *Getdents64Req) UnmarshalBytes(src []byte) []byte {
+ src = g.DirFD.UnmarshalBytes(src)
g.Count = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -1304,23 +1340,25 @@ func (g *Getdents64Req) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (g *Getdents64Req) MarshalUnsafe(dst []byte) {
+func (g *Getdents64Req) MarshalUnsafe(dst []byte) []byte {
if g.DirFD.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(g), uintptr(g.SizeBytes()))
- } else {
- // Type Getdents64Req doesn't have a packed layout in memory, fallback to MarshalBytes.
- g.MarshalBytes(dst)
+ size := g.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(g), uintptr(size))
+ return dst[size:]
}
+ // Type Getdents64Req doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return g.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (g *Getdents64Req) UnmarshalUnsafe(src []byte) {
+func (g *Getdents64Req) UnmarshalUnsafe(src []byte) []byte {
if g.DirFD.Packed() {
- gohacks.Memmove(unsafe.Pointer(g), unsafe.Pointer(&src[0]), uintptr(g.SizeBytes()))
- } else {
- // Type Getdents64Req doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- g.UnmarshalBytes(src)
+ size := g.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(g), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type Getdents64Req doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return g.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1412,23 +1450,21 @@ func (i *Inode) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *Inode) MarshalBytes(dst []byte) {
- i.ControlFD.MarshalBytes(dst[:i.ControlFD.SizeBytes()])
- dst = dst[i.ControlFD.SizeBytes():]
+func (i *Inode) MarshalBytes(dst []byte) []byte {
+ dst = i.ControlFD.MarshalBytes(dst)
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
- i.Stat.MarshalBytes(dst[:i.Stat.SizeBytes()])
- dst = dst[i.Stat.SizeBytes():]
+ dst = i.Stat.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *Inode) UnmarshalBytes(src []byte) {
- i.ControlFD.UnmarshalBytes(src[:i.ControlFD.SizeBytes()])
- src = src[i.ControlFD.SizeBytes():]
+func (i *Inode) UnmarshalBytes(src []byte) []byte {
+ src = i.ControlFD.UnmarshalBytes(src)
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
- i.Stat.UnmarshalBytes(src[:i.Stat.SizeBytes()])
- src = src[i.Stat.SizeBytes():]
+ src = i.Stat.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -1438,23 +1474,25 @@ func (i *Inode) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *Inode) MarshalUnsafe(dst []byte) {
+func (i *Inode) MarshalUnsafe(dst []byte) []byte {
if i.ControlFD.Packed() && i.Stat.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
- } else {
- // Type Inode doesn't have a packed layout in memory, fallback to MarshalBytes.
- i.MarshalBytes(dst)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
+ // Type Inode doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return i.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *Inode) UnmarshalUnsafe(src []byte) {
+func (i *Inode) UnmarshalUnsafe(src []byte) []byte {
if i.ControlFD.Packed() && i.Stat.Packed() {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
- } else {
- // Type Inode doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- i.UnmarshalBytes(src)
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type Inode doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return i.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1554,15 +1592,14 @@ func CopyInodeSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Inode) (
// Unmarshal as much as possible, even on error. First handle full objects.
limit := length/size
for idx := 0; idx < limit; idx++ {
- dst[idx].UnmarshalBytes(buf[size*idx:size*(idx+1)])
+ buf = dst[idx].UnmarshalBytes(buf)
}
// Handle any final partial object. buf is guaranteed to be long enough for the
// final element, but may not contain valid data for the entire range. This may
// result in unmarshalling zero values for some parts of the object.
if length%size != 0 {
- idx := limit
- dst[idx].UnmarshalBytes(buf[size*idx:size*(idx+1)])
+ dst[limit].UnmarshalBytes(buf)
}
return length, err
@@ -1596,8 +1633,9 @@ func CopyInodeSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Inode)
if !src[0].Packed() {
// Type Inode doesn't have a packed layout in memory, fall back to MarshalBytes.
buf := cc.CopyScratchBuffer(size * count)
+ curBuf := buf
for idx := 0; idx < count; idx++ {
- src[idx].MarshalBytes(buf[size*idx:size*(idx+1)])
+ curBuf = src[idx].MarshalBytes(curBuf)
}
return cc.CopyOutBytes(addr, buf)
}
@@ -1630,7 +1668,7 @@ func MarshalUnsafeInodeSlice(src []Inode, dst []byte) (int, error) {
if !src[0].Packed() {
// Type Inode doesn't have a packed layout in memory, fall back to MarshalBytes.
for idx := 0; idx < count; idx++ {
- src[idx].MarshalBytes(dst[size*idx:(size)*(idx+1)])
+ dst = src[idx].MarshalBytes(dst)
}
return size * count, nil
}
@@ -1651,7 +1689,7 @@ func UnmarshalUnsafeInodeSlice(dst []Inode, src []byte) (int, error) {
if !dst[0].Packed() {
// Type Inode doesn't have a packed layout in memory, fall back to UnmarshalBytes.
for idx := 0; idx < count; idx++ {
- dst[idx].UnmarshalBytes(src[size*idx:size*(idx+1)])
+ src = dst[idx].UnmarshalBytes(src)
}
return size * count, nil
}
@@ -1668,15 +1706,15 @@ func (l *LinkAtResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (l *LinkAtResp) MarshalBytes(dst []byte) {
- l.Link.MarshalBytes(dst[:l.Link.SizeBytes()])
- dst = dst[l.Link.SizeBytes():]
+func (l *LinkAtResp) MarshalBytes(dst []byte) []byte {
+ dst = l.Link.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (l *LinkAtResp) UnmarshalBytes(src []byte) {
- l.Link.UnmarshalBytes(src[:l.Link.SizeBytes()])
- src = src[l.Link.SizeBytes():]
+func (l *LinkAtResp) UnmarshalBytes(src []byte) []byte {
+ src = l.Link.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -1686,23 +1724,25 @@ func (l *LinkAtResp) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (l *LinkAtResp) MarshalUnsafe(dst []byte) {
+func (l *LinkAtResp) MarshalUnsafe(dst []byte) []byte {
if l.Link.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(l), uintptr(l.SizeBytes()))
- } else {
- // Type LinkAtResp doesn't have a packed layout in memory, fallback to MarshalBytes.
- l.MarshalBytes(dst)
+ size := l.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(l), uintptr(size))
+ return dst[size:]
}
+ // Type LinkAtResp doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return l.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (l *LinkAtResp) UnmarshalUnsafe(src []byte) {
+func (l *LinkAtResp) UnmarshalUnsafe(src []byte) []byte {
if l.Link.Packed() {
- gohacks.Memmove(unsafe.Pointer(l), unsafe.Pointer(&src[0]), uintptr(l.SizeBytes()))
- } else {
- // Type LinkAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- l.UnmarshalBytes(src)
+ size := l.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(l), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type LinkAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return l.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1793,13 +1833,15 @@ func (m *MID) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *MID) MarshalBytes(dst []byte) {
+func (m *MID) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(*m))
+ return dst[2:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *MID) UnmarshalBytes(src []byte) {
+func (m *MID) UnmarshalBytes(src []byte) []byte {
*m = MID(uint16(hostarch.ByteOrder.Uint16(src[:2])))
+ return src[2:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -1810,13 +1852,17 @@ func (m *MID) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (m *MID) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(m.SizeBytes()))
+func (m *MID) MarshalUnsafe(dst []byte) []byte {
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (m *MID) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(m.SizeBytes()))
+func (m *MID) UnmarshalUnsafe(src []byte) []byte {
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1960,15 +2006,15 @@ func (m *MkdirAtResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *MkdirAtResp) MarshalBytes(dst []byte) {
- m.ChildDir.MarshalBytes(dst[:m.ChildDir.SizeBytes()])
- dst = dst[m.ChildDir.SizeBytes():]
+func (m *MkdirAtResp) MarshalBytes(dst []byte) []byte {
+ dst = m.ChildDir.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *MkdirAtResp) UnmarshalBytes(src []byte) {
- m.ChildDir.UnmarshalBytes(src[:m.ChildDir.SizeBytes()])
- src = src[m.ChildDir.SizeBytes():]
+func (m *MkdirAtResp) UnmarshalBytes(src []byte) []byte {
+ src = m.ChildDir.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -1978,23 +2024,25 @@ func (m *MkdirAtResp) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (m *MkdirAtResp) MarshalUnsafe(dst []byte) {
+func (m *MkdirAtResp) MarshalUnsafe(dst []byte) []byte {
if m.ChildDir.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(m.SizeBytes()))
- } else {
- // Type MkdirAtResp doesn't have a packed layout in memory, fallback to MarshalBytes.
- m.MarshalBytes(dst)
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size))
+ return dst[size:]
}
+ // Type MkdirAtResp doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return m.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (m *MkdirAtResp) UnmarshalUnsafe(src []byte) {
+func (m *MkdirAtResp) UnmarshalUnsafe(src []byte) []byte {
if m.ChildDir.Packed() {
- gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(m.SizeBytes()))
- } else {
- // Type MkdirAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- m.UnmarshalBytes(src)
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type MkdirAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return m.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -2085,15 +2133,15 @@ func (m *MknodAtResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *MknodAtResp) MarshalBytes(dst []byte) {
- m.Child.MarshalBytes(dst[:m.Child.SizeBytes()])
- dst = dst[m.Child.SizeBytes():]
+func (m *MknodAtResp) MarshalBytes(dst []byte) []byte {
+ dst = m.Child.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *MknodAtResp) UnmarshalBytes(src []byte) {
- m.Child.UnmarshalBytes(src[:m.Child.SizeBytes()])
- src = src[m.Child.SizeBytes():]
+func (m *MknodAtResp) UnmarshalBytes(src []byte) []byte {
+ src = m.Child.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -2103,23 +2151,25 @@ func (m *MknodAtResp) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (m *MknodAtResp) MarshalUnsafe(dst []byte) {
+func (m *MknodAtResp) MarshalUnsafe(dst []byte) []byte {
if m.Child.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(m.SizeBytes()))
- } else {
- // Type MknodAtResp doesn't have a packed layout in memory, fallback to MarshalBytes.
- m.MarshalBytes(dst)
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size))
+ return dst[size:]
}
+ // Type MknodAtResp doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return m.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (m *MknodAtResp) UnmarshalUnsafe(src []byte) {
+func (m *MknodAtResp) UnmarshalUnsafe(src []byte) []byte {
if m.Child.Packed() {
- gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(m.SizeBytes()))
- } else {
- // Type MknodAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- m.UnmarshalBytes(src)
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type MknodAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return m.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -2210,19 +2260,19 @@ func (o *OpenAtReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (o *OpenAtReq) MarshalBytes(dst []byte) {
- o.FD.MarshalBytes(dst[:o.FD.SizeBytes()])
- dst = dst[o.FD.SizeBytes():]
+func (o *OpenAtReq) MarshalBytes(dst []byte) []byte {
+ dst = o.FD.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(o.Flags))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (o *OpenAtReq) UnmarshalBytes(src []byte) {
- o.FD.UnmarshalBytes(src[:o.FD.SizeBytes()])
- src = src[o.FD.SizeBytes():]
+func (o *OpenAtReq) UnmarshalBytes(src []byte) []byte {
+ src = o.FD.UnmarshalBytes(src)
o.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -2232,23 +2282,25 @@ func (o *OpenAtReq) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (o *OpenAtReq) MarshalUnsafe(dst []byte) {
+func (o *OpenAtReq) MarshalUnsafe(dst []byte) []byte {
if o.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(o), uintptr(o.SizeBytes()))
- } else {
- // Type OpenAtReq doesn't have a packed layout in memory, fallback to MarshalBytes.
- o.MarshalBytes(dst)
+ size := o.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(o), uintptr(size))
+ return dst[size:]
}
+ // Type OpenAtReq doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return o.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (o *OpenAtReq) UnmarshalUnsafe(src []byte) {
+func (o *OpenAtReq) UnmarshalUnsafe(src []byte) []byte {
if o.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(o), unsafe.Pointer(&src[0]), uintptr(o.SizeBytes()))
- } else {
- // Type OpenAtReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- o.UnmarshalBytes(src)
+ size := o.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(o), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type OpenAtReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return o.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -2339,15 +2391,15 @@ func (o *OpenAtResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (o *OpenAtResp) MarshalBytes(dst []byte) {
- o.NewFD.MarshalBytes(dst[:o.NewFD.SizeBytes()])
- dst = dst[o.NewFD.SizeBytes():]
+func (o *OpenAtResp) MarshalBytes(dst []byte) []byte {
+ dst = o.NewFD.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (o *OpenAtResp) UnmarshalBytes(src []byte) {
- o.NewFD.UnmarshalBytes(src[:o.NewFD.SizeBytes()])
- src = src[o.NewFD.SizeBytes():]
+func (o *OpenAtResp) UnmarshalBytes(src []byte) []byte {
+ src = o.NewFD.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -2357,23 +2409,25 @@ func (o *OpenAtResp) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (o *OpenAtResp) MarshalUnsafe(dst []byte) {
+func (o *OpenAtResp) MarshalUnsafe(dst []byte) []byte {
if o.NewFD.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(o), uintptr(o.SizeBytes()))
- } else {
- // Type OpenAtResp doesn't have a packed layout in memory, fallback to MarshalBytes.
- o.MarshalBytes(dst)
+ size := o.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(o), uintptr(size))
+ return dst[size:]
}
+ // Type OpenAtResp doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return o.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (o *OpenAtResp) UnmarshalUnsafe(src []byte) {
+func (o *OpenAtResp) UnmarshalUnsafe(src []byte) []byte {
if o.NewFD.Packed() {
- gohacks.Memmove(unsafe.Pointer(o), unsafe.Pointer(&src[0]), uintptr(o.SizeBytes()))
- } else {
- // Type OpenAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- o.UnmarshalBytes(src)
+ size := o.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(o), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type OpenAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return o.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -2465,23 +2519,21 @@ func (o *OpenCreateAtResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (o *OpenCreateAtResp) MarshalBytes(dst []byte) {
- o.Child.MarshalBytes(dst[:o.Child.SizeBytes()])
- dst = dst[o.Child.SizeBytes():]
- o.NewFD.MarshalBytes(dst[:o.NewFD.SizeBytes()])
- dst = dst[o.NewFD.SizeBytes():]
+func (o *OpenCreateAtResp) MarshalBytes(dst []byte) []byte {
+ dst = o.Child.MarshalBytes(dst)
+ dst = o.NewFD.MarshalBytes(dst)
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (o *OpenCreateAtResp) UnmarshalBytes(src []byte) {
- o.Child.UnmarshalBytes(src[:o.Child.SizeBytes()])
- src = src[o.Child.SizeBytes():]
- o.NewFD.UnmarshalBytes(src[:o.NewFD.SizeBytes()])
- src = src[o.NewFD.SizeBytes():]
+func (o *OpenCreateAtResp) UnmarshalBytes(src []byte) []byte {
+ src = o.Child.UnmarshalBytes(src)
+ src = o.NewFD.UnmarshalBytes(src)
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -2491,23 +2543,25 @@ func (o *OpenCreateAtResp) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (o *OpenCreateAtResp) MarshalUnsafe(dst []byte) {
+func (o *OpenCreateAtResp) MarshalUnsafe(dst []byte) []byte {
if o.Child.Packed() && o.NewFD.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(o), uintptr(o.SizeBytes()))
- } else {
- // Type OpenCreateAtResp doesn't have a packed layout in memory, fallback to MarshalBytes.
- o.MarshalBytes(dst)
+ size := o.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(o), uintptr(size))
+ return dst[size:]
}
+ // Type OpenCreateAtResp doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return o.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (o *OpenCreateAtResp) UnmarshalUnsafe(src []byte) {
+func (o *OpenCreateAtResp) UnmarshalUnsafe(src []byte) []byte {
if o.Child.Packed() && o.NewFD.Packed() {
- gohacks.Memmove(unsafe.Pointer(o), unsafe.Pointer(&src[0]), uintptr(o.SizeBytes()))
- } else {
- // Type OpenCreateAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- o.UnmarshalBytes(src)
+ size := o.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(o), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type OpenCreateAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return o.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -2598,23 +2652,23 @@ func (p *PReadReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (p *PReadReq) MarshalBytes(dst []byte) {
+func (p *PReadReq) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(p.Offset))
dst = dst[8:]
- p.FD.MarshalBytes(dst[:p.FD.SizeBytes()])
- dst = dst[p.FD.SizeBytes():]
+ dst = p.FD.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(p.Count))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (p *PReadReq) UnmarshalBytes(src []byte) {
+func (p *PReadReq) UnmarshalBytes(src []byte) []byte {
p.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
- p.FD.UnmarshalBytes(src[:p.FD.SizeBytes()])
- src = src[p.FD.SizeBytes():]
+ src = p.FD.UnmarshalBytes(src)
p.Count = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -2624,23 +2678,25 @@ func (p *PReadReq) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (p *PReadReq) MarshalUnsafe(dst []byte) {
+func (p *PReadReq) MarshalUnsafe(dst []byte) []byte {
if p.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(p), uintptr(p.SizeBytes()))
- } else {
- // Type PReadReq doesn't have a packed layout in memory, fallback to MarshalBytes.
- p.MarshalBytes(dst)
+ size := p.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(p), uintptr(size))
+ return dst[size:]
}
+ // Type PReadReq doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return p.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (p *PReadReq) UnmarshalUnsafe(src []byte) {
+func (p *PReadReq) UnmarshalUnsafe(src []byte) []byte {
if p.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(p), unsafe.Pointer(&src[0]), uintptr(p.SizeBytes()))
- } else {
- // Type PReadReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- p.UnmarshalBytes(src)
+ size := p.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(p), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type PReadReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return p.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -2730,15 +2786,17 @@ func (p *PWriteResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (p *PWriteResp) MarshalBytes(dst []byte) {
+func (p *PWriteResp) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(p.Count))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (p *PWriteResp) UnmarshalBytes(src []byte) {
+func (p *PWriteResp) UnmarshalBytes(src []byte) []byte {
p.Count = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -2748,13 +2806,17 @@ func (p *PWriteResp) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (p *PWriteResp) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(p), uintptr(p.SizeBytes()))
+func (p *PWriteResp) MarshalUnsafe(dst []byte) []byte {
+ size := p.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(p), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (p *PWriteResp) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(p), unsafe.Pointer(&src[0]), uintptr(p.SizeBytes()))
+func (p *PWriteResp) UnmarshalUnsafe(src []byte) []byte {
+ size := p.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(p), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -2820,15 +2882,15 @@ func (r *ReadLinkAtReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (r *ReadLinkAtReq) MarshalBytes(dst []byte) {
- r.FD.MarshalBytes(dst[:r.FD.SizeBytes()])
- dst = dst[r.FD.SizeBytes():]
+func (r *ReadLinkAtReq) MarshalBytes(dst []byte) []byte {
+ dst = r.FD.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (r *ReadLinkAtReq) UnmarshalBytes(src []byte) {
- r.FD.UnmarshalBytes(src[:r.FD.SizeBytes()])
- src = src[r.FD.SizeBytes():]
+func (r *ReadLinkAtReq) UnmarshalBytes(src []byte) []byte {
+ src = r.FD.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -2838,23 +2900,25 @@ func (r *ReadLinkAtReq) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (r *ReadLinkAtReq) MarshalUnsafe(dst []byte) {
+func (r *ReadLinkAtReq) MarshalUnsafe(dst []byte) []byte {
if r.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(r.SizeBytes()))
- } else {
- // Type ReadLinkAtReq doesn't have a packed layout in memory, fallback to MarshalBytes.
- r.MarshalBytes(dst)
+ size := r.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size))
+ return dst[size:]
}
+ // Type ReadLinkAtReq doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return r.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (r *ReadLinkAtReq) UnmarshalUnsafe(src []byte) {
+func (r *ReadLinkAtReq) UnmarshalUnsafe(src []byte) []byte {
if r.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(r.SizeBytes()))
- } else {
- // Type ReadLinkAtReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- r.UnmarshalBytes(src)
+ size := r.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type ReadLinkAtReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return r.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -2949,47 +3013,39 @@ func (s *SetStatReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SetStatReq) MarshalBytes(dst []byte) {
- s.FD.MarshalBytes(dst[:s.FD.SizeBytes()])
- dst = dst[s.FD.SizeBytes():]
+func (s *SetStatReq) MarshalBytes(dst []byte) []byte {
+ dst = s.FD.MarshalBytes(dst)
// Padding: dst[:sizeof(uint32)] ~= uint32(0)
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Mask))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Mode))
dst = dst[4:]
- s.UID.MarshalBytes(dst[:s.UID.SizeBytes()])
- dst = dst[s.UID.SizeBytes():]
- s.GID.MarshalBytes(dst[:s.GID.SizeBytes()])
- dst = dst[s.GID.SizeBytes():]
+ dst = s.UID.MarshalBytes(dst)
+ dst = s.GID.MarshalBytes(dst)
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Size))
dst = dst[8:]
- s.Atime.MarshalBytes(dst[:s.Atime.SizeBytes()])
- dst = dst[s.Atime.SizeBytes():]
- s.Mtime.MarshalBytes(dst[:s.Mtime.SizeBytes()])
- dst = dst[s.Mtime.SizeBytes():]
+ dst = s.Atime.MarshalBytes(dst)
+ dst = s.Mtime.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SetStatReq) UnmarshalBytes(src []byte) {
- s.FD.UnmarshalBytes(src[:s.FD.SizeBytes()])
- src = src[s.FD.SizeBytes():]
+func (s *SetStatReq) UnmarshalBytes(src []byte) []byte {
+ src = s.FD.UnmarshalBytes(src)
// Padding: var _ uint32 ~= src[:sizeof(uint32)]
src = src[4:]
s.Mask = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
s.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
- s.UID.UnmarshalBytes(src[:s.UID.SizeBytes()])
- src = src[s.UID.SizeBytes():]
- s.GID.UnmarshalBytes(src[:s.GID.SizeBytes()])
- src = src[s.GID.SizeBytes():]
+ src = s.UID.UnmarshalBytes(src)
+ src = s.GID.UnmarshalBytes(src)
s.Size = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
- s.Atime.UnmarshalBytes(src[:s.Atime.SizeBytes()])
- src = src[s.Atime.SizeBytes():]
- s.Mtime.UnmarshalBytes(src[:s.Mtime.SizeBytes()])
- src = src[s.Mtime.SizeBytes():]
+ src = s.Atime.UnmarshalBytes(src)
+ src = s.Mtime.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -2999,23 +3055,25 @@ func (s *SetStatReq) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SetStatReq) MarshalUnsafe(dst []byte) {
+func (s *SetStatReq) MarshalUnsafe(dst []byte) []byte {
if s.Atime.Packed() && s.FD.Packed() && s.GID.Packed() && s.Mtime.Packed() && s.UID.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type SetStatReq doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type SetStatReq doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SetStatReq) UnmarshalUnsafe(src []byte) {
+func (s *SetStatReq) UnmarshalUnsafe(src []byte) []byte {
if s.Atime.Packed() && s.FD.Packed() && s.GID.Packed() && s.Mtime.Packed() && s.UID.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type SetStatReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type SetStatReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3105,19 +3163,21 @@ func (s *SetStatResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SetStatResp) MarshalBytes(dst []byte) {
+func (s *SetStatResp) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.FailureMask))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.FailureErrNo))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SetStatResp) UnmarshalBytes(src []byte) {
+func (s *SetStatResp) UnmarshalBytes(src []byte) []byte {
s.FailureMask = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
s.FailureErrNo = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -3127,13 +3187,17 @@ func (s *SetStatResp) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SetStatResp) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *SetStatResp) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SetStatResp) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *SetStatResp) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3198,7 +3262,7 @@ func (s *StatFS) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *StatFS) MarshalBytes(dst []byte) {
+func (s *StatFS) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Type))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlockSize))
@@ -3215,10 +3279,11 @@ func (s *StatFS) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.NameLength))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *StatFS) UnmarshalBytes(src []byte) {
+func (s *StatFS) UnmarshalBytes(src []byte) []byte {
s.Type = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
s.BlockSize = int64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -3235,6 +3300,7 @@ func (s *StatFS) UnmarshalBytes(src []byte) {
src = src[8:]
s.NameLength = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -3244,13 +3310,17 @@ func (s *StatFS) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *StatFS) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *StatFS) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *StatFS) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *StatFS) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3316,15 +3386,15 @@ func (s *StatReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *StatReq) MarshalBytes(dst []byte) {
- s.FD.MarshalBytes(dst[:s.FD.SizeBytes()])
- dst = dst[s.FD.SizeBytes():]
+func (s *StatReq) MarshalBytes(dst []byte) []byte {
+ dst = s.FD.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *StatReq) UnmarshalBytes(src []byte) {
- s.FD.UnmarshalBytes(src[:s.FD.SizeBytes()])
- src = src[s.FD.SizeBytes():]
+func (s *StatReq) UnmarshalBytes(src []byte) []byte {
+ src = s.FD.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -3334,23 +3404,25 @@ func (s *StatReq) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *StatReq) MarshalUnsafe(dst []byte) {
+func (s *StatReq) MarshalUnsafe(dst []byte) []byte {
if s.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type StatReq doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type StatReq doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *StatReq) UnmarshalUnsafe(src []byte) {
+func (s *StatReq) UnmarshalUnsafe(src []byte) []byte {
if s.FD.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type StatReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type StatReq doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3441,15 +3513,15 @@ func (s *SymlinkAtResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SymlinkAtResp) MarshalBytes(dst []byte) {
- s.Symlink.MarshalBytes(dst[:s.Symlink.SizeBytes()])
- dst = dst[s.Symlink.SizeBytes():]
+func (s *SymlinkAtResp) MarshalBytes(dst []byte) []byte {
+ dst = s.Symlink.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SymlinkAtResp) UnmarshalBytes(src []byte) {
- s.Symlink.UnmarshalBytes(src[:s.Symlink.SizeBytes()])
- src = src[s.Symlink.SizeBytes():]
+func (s *SymlinkAtResp) UnmarshalBytes(src []byte) []byte {
+ src = s.Symlink.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -3459,23 +3531,25 @@ func (s *SymlinkAtResp) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SymlinkAtResp) MarshalUnsafe(dst []byte) {
+func (s *SymlinkAtResp) MarshalUnsafe(dst []byte) []byte {
if s.Symlink.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type SymlinkAtResp doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type SymlinkAtResp doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SymlinkAtResp) UnmarshalUnsafe(src []byte) {
+func (s *SymlinkAtResp) UnmarshalUnsafe(src []byte) []byte {
if s.Symlink.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type SymlinkAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type SymlinkAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3566,13 +3640,15 @@ func (uid *UID) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (uid *UID) MarshalBytes(dst []byte) {
+func (uid *UID) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(*uid))
+ return dst[4:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (uid *UID) UnmarshalBytes(src []byte) {
+func (uid *UID) UnmarshalBytes(src []byte) []byte {
*uid = UID(uint32(hostarch.ByteOrder.Uint32(src[:4])))
+ return src[4:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -3583,13 +3659,17 @@ func (uid *UID) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (uid *UID) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(uid), uintptr(uid.SizeBytes()))
+func (uid *UID) MarshalUnsafe(dst []byte) []byte {
+ size := uid.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(uid), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (uid *UID) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(uid), unsafe.Pointer(&src[0]), uintptr(uid.SizeBytes()))
+func (uid *UID) UnmarshalUnsafe(src []byte) []byte {
+ size := uid.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(uid), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3658,31 +3738,25 @@ func (c *createCommon) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (c *createCommon) MarshalBytes(dst []byte) {
- c.DirFD.MarshalBytes(dst[:c.DirFD.SizeBytes()])
- dst = dst[c.DirFD.SizeBytes():]
- c.Mode.MarshalBytes(dst[:c.Mode.SizeBytes()])
- dst = dst[c.Mode.SizeBytes():]
+func (c *createCommon) MarshalBytes(dst []byte) []byte {
+ dst = c.DirFD.MarshalBytes(dst)
+ dst = c.Mode.MarshalBytes(dst)
// Padding: dst[:sizeof(uint16)] ~= uint16(0)
dst = dst[2:]
- c.UID.MarshalBytes(dst[:c.UID.SizeBytes()])
- dst = dst[c.UID.SizeBytes():]
- c.GID.MarshalBytes(dst[:c.GID.SizeBytes()])
- dst = dst[c.GID.SizeBytes():]
+ dst = c.UID.MarshalBytes(dst)
+ dst = c.GID.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (c *createCommon) UnmarshalBytes(src []byte) {
- c.DirFD.UnmarshalBytes(src[:c.DirFD.SizeBytes()])
- src = src[c.DirFD.SizeBytes():]
- c.Mode.UnmarshalBytes(src[:c.Mode.SizeBytes()])
- src = src[c.Mode.SizeBytes():]
+func (c *createCommon) UnmarshalBytes(src []byte) []byte {
+ src = c.DirFD.UnmarshalBytes(src)
+ src = c.Mode.UnmarshalBytes(src)
// Padding: var _ uint16 ~= src[:sizeof(uint16)]
src = src[2:]
- c.UID.UnmarshalBytes(src[:c.UID.SizeBytes()])
- src = src[c.UID.SizeBytes():]
- c.GID.UnmarshalBytes(src[:c.GID.SizeBytes()])
- src = src[c.GID.SizeBytes():]
+ src = c.UID.UnmarshalBytes(src)
+ src = c.GID.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -3692,23 +3766,25 @@ func (c *createCommon) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (c *createCommon) MarshalUnsafe(dst []byte) {
+func (c *createCommon) MarshalUnsafe(dst []byte) []byte {
if c.DirFD.Packed() && c.GID.Packed() && c.Mode.Packed() && c.UID.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(c.SizeBytes()))
- } else {
- // Type createCommon doesn't have a packed layout in memory, fallback to MarshalBytes.
- c.MarshalBytes(dst)
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size))
+ return dst[size:]
}
+ // Type createCommon doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return c.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (c *createCommon) UnmarshalUnsafe(src []byte) {
+func (c *createCommon) UnmarshalUnsafe(src []byte) []byte {
if c.DirFD.Packed() && c.GID.Packed() && c.Mode.Packed() && c.UID.Packed() {
- gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(c.SizeBytes()))
- } else {
- // Type createCommon doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- c.UnmarshalBytes(src)
+ size := c.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type createCommon doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return c.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3800,15 +3876,15 @@ func (m *MsgDynamic) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (m *MsgDynamic) MarshalUnsafe(dst []byte) {
+func (m *MsgDynamic) MarshalUnsafe(dst []byte) []byte {
// Type MsgDynamic doesn't have a packed layout in memory, fallback to MarshalBytes.
- m.MarshalBytes(dst)
+ return m.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (m *MsgDynamic) UnmarshalUnsafe(src []byte) {
+func (m *MsgDynamic) UnmarshalUnsafe(src []byte) []byte {
// Type MsgDynamic doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- m.UnmarshalBytes(src)
+ return m.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -3853,7 +3929,7 @@ func (m *MsgSimple) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *MsgSimple) MarshalBytes(dst []byte) {
+func (m *MsgSimple) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(m.A))
dst = dst[2:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(m.B))
@@ -3862,10 +3938,11 @@ func (m *MsgSimple) MarshalBytes(dst []byte) {
dst = dst[4:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.D))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *MsgSimple) UnmarshalBytes(src []byte) {
+func (m *MsgSimple) UnmarshalBytes(src []byte) []byte {
m.A = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
m.B = uint16(hostarch.ByteOrder.Uint16(src[:2]))
@@ -3874,6 +3951,7 @@ func (m *MsgSimple) UnmarshalBytes(src []byte) {
src = src[4:]
m.D = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -3883,13 +3961,17 @@ func (m *MsgSimple) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (m *MsgSimple) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(m.SizeBytes()))
+func (m *MsgSimple) MarshalUnsafe(dst []byte) []byte {
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (m *MsgSimple) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(m.SizeBytes()))
+func (m *MsgSimple) UnmarshalUnsafe(src []byte) []byte {
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -4032,15 +4114,15 @@ func (v *P9Version) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (v *P9Version) MarshalUnsafe(dst []byte) {
+func (v *P9Version) MarshalUnsafe(dst []byte) []byte {
// Type P9Version doesn't have a packed layout in memory, fallback to MarshalBytes.
- v.MarshalBytes(dst)
+ return v.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (v *P9Version) UnmarshalUnsafe(src []byte) {
+func (v *P9Version) UnmarshalUnsafe(src []byte) []byte {
// Type P9Version doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- v.UnmarshalBytes(src)
+ return v.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -4086,23 +4168,23 @@ func (s *sockHeader) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *sockHeader) MarshalBytes(dst []byte) {
+func (s *sockHeader) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.payloadLen))
dst = dst[4:]
- s.message.MarshalBytes(dst[:s.message.SizeBytes()])
- dst = dst[s.message.SizeBytes():]
+ dst = s.message.MarshalBytes(dst)
// Padding: dst[:sizeof(uint16)] ~= uint16(0)
dst = dst[2:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *sockHeader) UnmarshalBytes(src []byte) {
+func (s *sockHeader) UnmarshalBytes(src []byte) []byte {
s.payloadLen = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
- s.message.UnmarshalBytes(src[:s.message.SizeBytes()])
- src = src[s.message.SizeBytes():]
+ src = s.message.UnmarshalBytes(src)
// Padding: var _ uint16 ~= src[:sizeof(uint16)]
src = src[2:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -4112,23 +4194,25 @@ func (s *sockHeader) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *sockHeader) MarshalUnsafe(dst []byte) {
+func (s *sockHeader) MarshalUnsafe(dst []byte) []byte {
if s.message.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type sockHeader doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type sockHeader doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *sockHeader) UnmarshalUnsafe(src []byte) {
+func (s *sockHeader) UnmarshalUnsafe(src []byte) []byte {
if s.message.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type sockHeader doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type sockHeader doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
diff --git a/pkg/lisafs/message.go b/pkg/lisafs/message.go
index 722afd0be..0d7c30ce3 100644
--- a/pkg/lisafs/message.go
+++ b/pkg/lisafs/message.go
@@ -157,7 +157,6 @@ func MaxMessageSize() uint32 {
// TODO(gvisor.dev/issue/6450): Once this is resolved:
// * Update manual implementations and function signatures.
// * Update RPC handlers and appropriate callers to handle errors correctly.
-// * Update manual implementations to get rid of buffer shifting.
// UID represents a user ID.
//
@@ -180,10 +179,10 @@ func (gid GID) Ok() bool {
}
// NoopMarshal is a noop implementation of marshal.Marshallable.MarshalBytes.
-func NoopMarshal([]byte) {}
+func NoopMarshal(b []byte) []byte { return b }
// NoopUnmarshal is a noop implementation of marshal.Marshallable.UnmarshalBytes.
-func NoopUnmarshal([]byte) {}
+func NoopUnmarshal(b []byte) []byte { return b }
// SizedString represents a string in memory. The marshalled string bytes are
// preceded by a uint32 signifying the string length.
@@ -195,21 +194,20 @@ func (s *SizedString) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SizedString) MarshalBytes(dst []byte) {
+func (s *SizedString) MarshalBytes(dst []byte) []byte {
strLen := primitive.Uint32(len(*s))
- strLen.MarshalUnsafe(dst)
- dst = dst[strLen.SizeBytes():]
+ dst = strLen.MarshalUnsafe(dst)
// Copy without any allocation.
- copy(dst[:strLen], *s)
+ return dst[copy(dst[:strLen], *s):]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SizedString) UnmarshalBytes(src []byte) {
+func (s *SizedString) UnmarshalBytes(src []byte) []byte {
var strLen primitive.Uint32
- strLen.UnmarshalUnsafe(src)
- src = src[strLen.SizeBytes():]
+ src = strLen.UnmarshalUnsafe(src)
// Take the hit, this leads to an allocation + memcpy. No way around it.
*s = SizedString(src[:strLen])
+ return src[strLen:]
}
// StringArray represents an array of SizedStrings in memory. The marshalled
@@ -227,22 +225,20 @@ func (s *StringArray) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *StringArray) MarshalBytes(dst []byte) {
+func (s *StringArray) MarshalBytes(dst []byte) []byte {
arrLen := primitive.Uint32(len(*s))
- arrLen.MarshalUnsafe(dst)
- dst = dst[arrLen.SizeBytes():]
+ dst = arrLen.MarshalUnsafe(dst)
for _, str := range *s {
sstr := SizedString(str)
- sstr.MarshalBytes(dst)
- dst = dst[sstr.SizeBytes():]
+ dst = sstr.MarshalBytes(dst)
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *StringArray) UnmarshalBytes(src []byte) {
+func (s *StringArray) UnmarshalBytes(src []byte) []byte {
var arrLen primitive.Uint32
- arrLen.UnmarshalUnsafe(src)
- src = src[arrLen.SizeBytes():]
+ src = arrLen.UnmarshalUnsafe(src)
if cap(*s) < int(arrLen) {
*s = make([]string, arrLen)
@@ -252,10 +248,10 @@ func (s *StringArray) UnmarshalBytes(src []byte) {
for i := primitive.Uint32(0); i < arrLen; i++ {
var sstr SizedString
- sstr.UnmarshalBytes(src)
- src = src[sstr.SizeBytes():]
+ src = sstr.UnmarshalBytes(src)
(*s)[i] = string(sstr)
}
+ return src
}
// Inode represents an inode on the remote filesystem.
@@ -278,13 +274,13 @@ func (m *MountReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *MountReq) MarshalBytes(dst []byte) {
- m.MountPath.MarshalBytes(dst)
+func (m *MountReq) MarshalBytes(dst []byte) []byte {
+ return m.MountPath.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *MountReq) UnmarshalBytes(src []byte) {
- m.MountPath.UnmarshalBytes(src)
+func (m *MountReq) UnmarshalBytes(src []byte) []byte {
+ return m.MountPath.UnmarshalBytes(src)
}
// MountResp represents a Mount response.
@@ -306,28 +302,30 @@ func (m *MountResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *MountResp) MarshalBytes(dst []byte) {
- m.Root.MarshalUnsafe(dst)
- dst = dst[m.Root.SizeBytes():]
- m.MaxMessageSize.MarshalUnsafe(dst)
- dst = dst[m.MaxMessageSize.SizeBytes():]
+func (m *MountResp) MarshalBytes(dst []byte) []byte {
+ dst = m.Root.MarshalUnsafe(dst)
+ dst = m.MaxMessageSize.MarshalUnsafe(dst)
numSupported := primitive.Uint16(len(m.SupportedMs))
- numSupported.MarshalBytes(dst)
- dst = dst[numSupported.SizeBytes():]
- MarshalUnsafeMIDSlice(m.SupportedMs, dst)
+ dst = numSupported.MarshalBytes(dst)
+ n, err := MarshalUnsafeMIDSlice(m.SupportedMs, dst)
+ if err != nil {
+ panic(err)
+ }
+ return dst[n:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *MountResp) UnmarshalBytes(src []byte) {
- m.Root.UnmarshalUnsafe(src)
- src = src[m.Root.SizeBytes():]
- m.MaxMessageSize.UnmarshalUnsafe(src)
- src = src[m.MaxMessageSize.SizeBytes():]
+func (m *MountResp) UnmarshalBytes(src []byte) []byte {
+ src = m.Root.UnmarshalUnsafe(src)
+ src = m.MaxMessageSize.UnmarshalUnsafe(src)
var numSupported primitive.Uint16
- numSupported.UnmarshalBytes(src)
- src = src[numSupported.SizeBytes():]
+ src = numSupported.UnmarshalBytes(src)
m.SupportedMs = make([]MID, numSupported)
- UnmarshalUnsafeMIDSlice(m.SupportedMs, src)
+ n, err := UnmarshalUnsafeMIDSlice(m.SupportedMs, src)
+ if err != nil {
+ panic(err)
+ }
+ return src[n:]
}
// ChannelResp is the response to the create channel request.
@@ -391,17 +389,15 @@ func (w *WalkReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (w *WalkReq) MarshalBytes(dst []byte) {
- w.DirFD.MarshalUnsafe(dst)
- dst = dst[w.DirFD.SizeBytes():]
- w.Path.MarshalBytes(dst)
+func (w *WalkReq) MarshalBytes(dst []byte) []byte {
+ dst = w.DirFD.MarshalUnsafe(dst)
+ return w.Path.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (w *WalkReq) UnmarshalBytes(src []byte) {
- w.DirFD.UnmarshalUnsafe(src)
- src = src[w.DirFD.SizeBytes():]
- w.Path.UnmarshalBytes(src)
+func (w *WalkReq) UnmarshalBytes(src []byte) []byte {
+ src = w.DirFD.UnmarshalUnsafe(src)
+ return w.Path.UnmarshalBytes(src)
}
// WalkStatus is used to indicate the reason for partial/unsuccessful server
@@ -438,32 +434,36 @@ func (w *WalkResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (w *WalkResp) MarshalBytes(dst []byte) {
- w.Status.MarshalUnsafe(dst)
- dst = dst[w.Status.SizeBytes():]
+func (w *WalkResp) MarshalBytes(dst []byte) []byte {
+ dst = w.Status.MarshalUnsafe(dst)
numInodes := primitive.Uint32(len(w.Inodes))
- numInodes.MarshalUnsafe(dst)
- dst = dst[numInodes.SizeBytes():]
+ dst = numInodes.MarshalUnsafe(dst)
- MarshalUnsafeInodeSlice(w.Inodes, dst)
+ n, err := MarshalUnsafeInodeSlice(w.Inodes, dst)
+ if err != nil {
+ panic(err)
+ }
+ return dst[n:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (w *WalkResp) UnmarshalBytes(src []byte) {
- w.Status.UnmarshalUnsafe(src)
- src = src[w.Status.SizeBytes():]
+func (w *WalkResp) UnmarshalBytes(src []byte) []byte {
+ src = w.Status.UnmarshalUnsafe(src)
var numInodes primitive.Uint32
- numInodes.UnmarshalUnsafe(src)
- src = src[numInodes.SizeBytes():]
+ src = numInodes.UnmarshalUnsafe(src)
if cap(w.Inodes) < int(numInodes) {
w.Inodes = make([]Inode, numInodes)
} else {
w.Inodes = w.Inodes[:numInodes]
}
- UnmarshalUnsafeInodeSlice(w.Inodes, src)
+ n, err := UnmarshalUnsafeInodeSlice(w.Inodes, src)
+ if err != nil {
+ panic(err)
+ }
+ return src[n:]
}
// WalkStatResp is used to communicate stat results for WalkStat.
@@ -477,26 +477,32 @@ func (w *WalkStatResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (w *WalkStatResp) MarshalBytes(dst []byte) {
+func (w *WalkStatResp) MarshalBytes(dst []byte) []byte {
numStats := primitive.Uint32(len(w.Stats))
- numStats.MarshalUnsafe(dst)
- dst = dst[numStats.SizeBytes():]
+ dst = numStats.MarshalUnsafe(dst)
- linux.MarshalUnsafeStatxSlice(w.Stats, dst)
+ n, err := linux.MarshalUnsafeStatxSlice(w.Stats, dst)
+ if err != nil {
+ panic(err)
+ }
+ return dst[n:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (w *WalkStatResp) UnmarshalBytes(src []byte) {
+func (w *WalkStatResp) UnmarshalBytes(src []byte) []byte {
var numStats primitive.Uint32
- numStats.UnmarshalUnsafe(src)
- src = src[numStats.SizeBytes():]
+ src = numStats.UnmarshalUnsafe(src)
if cap(w.Stats) < int(numStats) {
w.Stats = make([]linux.Statx, numStats)
} else {
w.Stats = w.Stats[:numStats]
}
- linux.UnmarshalUnsafeStatxSlice(w.Stats, src)
+ n, err := linux.UnmarshalUnsafeStatxSlice(w.Stats, src)
+ if err != nil {
+ panic(err)
+ }
+ return src[n:]
}
// OpenAtReq is used to open existing FDs with the specified flags.
@@ -536,21 +542,17 @@ func (o *OpenCreateAtReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (o *OpenCreateAtReq) MarshalBytes(dst []byte) {
- o.createCommon.MarshalUnsafe(dst)
- dst = dst[o.createCommon.SizeBytes():]
- o.Name.MarshalBytes(dst)
- dst = dst[o.Name.SizeBytes():]
- o.Flags.MarshalUnsafe(dst)
+func (o *OpenCreateAtReq) MarshalBytes(dst []byte) []byte {
+ dst = o.createCommon.MarshalUnsafe(dst)
+ dst = o.Name.MarshalBytes(dst)
+ return o.Flags.MarshalUnsafe(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (o *OpenCreateAtReq) UnmarshalBytes(src []byte) {
- o.createCommon.UnmarshalUnsafe(src)
- src = src[o.createCommon.SizeBytes():]
- o.Name.UnmarshalBytes(src)
- src = src[o.Name.SizeBytes():]
- o.Flags.UnmarshalUnsafe(src)
+func (o *OpenCreateAtReq) UnmarshalBytes(src []byte) []byte {
+ src = o.createCommon.UnmarshalUnsafe(src)
+ src = o.Name.UnmarshalBytes(src)
+ return o.Flags.UnmarshalUnsafe(src)
}
// OpenCreateAtResp is used to communicate successful OpenCreateAt results.
@@ -573,24 +575,30 @@ func (f *FdArray) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FdArray) MarshalBytes(dst []byte) {
+func (f *FdArray) MarshalBytes(dst []byte) []byte {
arrLen := primitive.Uint32(len(*f))
- arrLen.MarshalUnsafe(dst)
- dst = dst[arrLen.SizeBytes():]
- MarshalUnsafeFDIDSlice(*f, dst)
+ dst = arrLen.MarshalUnsafe(dst)
+ n, err := MarshalUnsafeFDIDSlice(*f, dst)
+ if err != nil {
+ panic(err)
+ }
+ return dst[n:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FdArray) UnmarshalBytes(src []byte) {
+func (f *FdArray) UnmarshalBytes(src []byte) []byte {
var arrLen primitive.Uint32
- arrLen.UnmarshalUnsafe(src)
- src = src[arrLen.SizeBytes():]
+ src = arrLen.UnmarshalUnsafe(src)
if cap(*f) < int(arrLen) {
*f = make(FdArray, arrLen)
} else {
*f = (*f)[:arrLen]
}
- UnmarshalUnsafeFDIDSlice(*f, src)
+ n, err := UnmarshalUnsafeFDIDSlice(*f, src)
+ if err != nil {
+ panic(err)
+ }
+ return src[n:]
}
// CloseReq is used to close(2) FDs.
@@ -604,13 +612,13 @@ func (c *CloseReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (c *CloseReq) MarshalBytes(dst []byte) {
- c.FDs.MarshalBytes(dst)
+func (c *CloseReq) MarshalBytes(dst []byte) []byte {
+ return c.FDs.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (c *CloseReq) UnmarshalBytes(src []byte) {
- c.FDs.UnmarshalBytes(src)
+func (c *CloseReq) UnmarshalBytes(src []byte) []byte {
+ return c.FDs.UnmarshalBytes(src)
}
// FsyncReq is used to fsync(2) FDs.
@@ -624,13 +632,13 @@ func (f *FsyncReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FsyncReq) MarshalBytes(dst []byte) {
- f.FDs.MarshalBytes(dst)
+func (f *FsyncReq) MarshalBytes(dst []byte) []byte {
+ return f.FDs.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FsyncReq) UnmarshalBytes(src []byte) {
- f.FDs.UnmarshalBytes(src)
+func (f *FsyncReq) UnmarshalBytes(src []byte) []byte {
+ return f.FDs.UnmarshalBytes(src)
}
// PReadReq is used to pread(2) on an FD.
@@ -654,20 +662,18 @@ func (r *PReadResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (r *PReadResp) MarshalBytes(dst []byte) {
- r.NumBytes.MarshalUnsafe(dst)
- dst = dst[r.NumBytes.SizeBytes():]
- copy(dst[:r.NumBytes], r.Buf[:r.NumBytes])
+func (r *PReadResp) MarshalBytes(dst []byte) []byte {
+ dst = r.NumBytes.MarshalUnsafe(dst)
+ return dst[copy(dst[:r.NumBytes], r.Buf[:r.NumBytes]):]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (r *PReadResp) UnmarshalBytes(src []byte) {
- r.NumBytes.UnmarshalUnsafe(src)
- src = src[r.NumBytes.SizeBytes():]
+func (r *PReadResp) UnmarshalBytes(src []byte) []byte {
+ src = r.NumBytes.UnmarshalUnsafe(src)
// We expect the client to have already allocated r.Buf. r.Buf probably
// (optimally) points to usermem. Directly copy into that.
- copy(r.Buf[:r.NumBytes], src[:r.NumBytes])
+ return src[copy(r.Buf[:r.NumBytes], src[:r.NumBytes]):]
}
// PWriteReq is used to pwrite(2) on an FD.
@@ -684,28 +690,23 @@ func (w *PWriteReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (w *PWriteReq) MarshalBytes(dst []byte) {
- w.Offset.MarshalUnsafe(dst)
- dst = dst[w.Offset.SizeBytes():]
- w.FD.MarshalUnsafe(dst)
- dst = dst[w.FD.SizeBytes():]
- w.NumBytes.MarshalUnsafe(dst)
- dst = dst[w.NumBytes.SizeBytes():]
- copy(dst[:w.NumBytes], w.Buf[:w.NumBytes])
+func (w *PWriteReq) MarshalBytes(dst []byte) []byte {
+ dst = w.Offset.MarshalUnsafe(dst)
+ dst = w.FD.MarshalUnsafe(dst)
+ dst = w.NumBytes.MarshalUnsafe(dst)
+ return dst[copy(dst[:w.NumBytes], w.Buf[:w.NumBytes]):]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (w *PWriteReq) UnmarshalBytes(src []byte) {
- w.Offset.UnmarshalUnsafe(src)
- src = src[w.Offset.SizeBytes():]
- w.FD.UnmarshalUnsafe(src)
- src = src[w.FD.SizeBytes():]
- w.NumBytes.UnmarshalUnsafe(src)
- src = src[w.NumBytes.SizeBytes():]
+func (w *PWriteReq) UnmarshalBytes(src []byte) []byte {
+ src = w.Offset.UnmarshalUnsafe(src)
+ src = w.FD.UnmarshalUnsafe(src)
+ src = w.NumBytes.UnmarshalUnsafe(src)
// This is an optimization. Assuming that the server is making this call, it
// is safe to just point to src rather than allocating and copying.
w.Buf = src[:w.NumBytes]
+ return src[w.NumBytes:]
}
// PWriteResp is used to return the result of pwrite(2).
@@ -727,17 +728,15 @@ func (m *MkdirAtReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *MkdirAtReq) MarshalBytes(dst []byte) {
- m.createCommon.MarshalUnsafe(dst)
- dst = dst[m.createCommon.SizeBytes():]
- m.Name.MarshalBytes(dst)
+func (m *MkdirAtReq) MarshalBytes(dst []byte) []byte {
+ dst = m.createCommon.MarshalUnsafe(dst)
+ return m.Name.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *MkdirAtReq) UnmarshalBytes(src []byte) {
- m.createCommon.UnmarshalUnsafe(src)
- src = src[m.createCommon.SizeBytes():]
- m.Name.UnmarshalBytes(src)
+func (m *MkdirAtReq) UnmarshalBytes(src []byte) []byte {
+ src = m.createCommon.UnmarshalUnsafe(src)
+ return m.Name.UnmarshalBytes(src)
}
// MkdirAtResp is the response to a successful MkdirAt request.
@@ -761,25 +760,19 @@ func (m *MknodAtReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *MknodAtReq) MarshalBytes(dst []byte) {
- m.createCommon.MarshalUnsafe(dst)
- dst = dst[m.createCommon.SizeBytes():]
- m.Name.MarshalBytes(dst)
- dst = dst[m.Name.SizeBytes():]
- m.Minor.MarshalUnsafe(dst)
- dst = dst[m.Minor.SizeBytes():]
- m.Major.MarshalUnsafe(dst)
+func (m *MknodAtReq) MarshalBytes(dst []byte) []byte {
+ dst = m.createCommon.MarshalUnsafe(dst)
+ dst = m.Name.MarshalBytes(dst)
+ dst = m.Minor.MarshalUnsafe(dst)
+ return m.Major.MarshalUnsafe(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *MknodAtReq) UnmarshalBytes(src []byte) {
- m.createCommon.UnmarshalUnsafe(src)
- src = src[m.createCommon.SizeBytes():]
- m.Name.UnmarshalBytes(src)
- src = src[m.Name.SizeBytes():]
- m.Minor.UnmarshalUnsafe(src)
- src = src[m.Minor.SizeBytes():]
- m.Major.UnmarshalUnsafe(src)
+func (m *MknodAtReq) UnmarshalBytes(src []byte) []byte {
+ src = m.createCommon.UnmarshalUnsafe(src)
+ src = m.Name.UnmarshalBytes(src)
+ src = m.Minor.UnmarshalUnsafe(src)
+ return m.Major.UnmarshalUnsafe(src)
}
// MknodAtResp is the response to a successful MknodAt request.
@@ -804,29 +797,21 @@ func (s *SymlinkAtReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SymlinkAtReq) MarshalBytes(dst []byte) {
- s.DirFD.MarshalUnsafe(dst)
- dst = dst[s.DirFD.SizeBytes():]
- s.Name.MarshalBytes(dst)
- dst = dst[s.Name.SizeBytes():]
- s.Target.MarshalBytes(dst)
- dst = dst[s.Target.SizeBytes():]
- s.UID.MarshalUnsafe(dst)
- dst = dst[s.UID.SizeBytes():]
- s.GID.MarshalUnsafe(dst)
+func (s *SymlinkAtReq) MarshalBytes(dst []byte) []byte {
+ dst = s.DirFD.MarshalUnsafe(dst)
+ dst = s.Name.MarshalBytes(dst)
+ dst = s.Target.MarshalBytes(dst)
+ dst = s.UID.MarshalUnsafe(dst)
+ return s.GID.MarshalUnsafe(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SymlinkAtReq) UnmarshalBytes(src []byte) {
- s.DirFD.UnmarshalUnsafe(src)
- src = src[s.DirFD.SizeBytes():]
- s.Name.UnmarshalBytes(src)
- src = src[s.Name.SizeBytes():]
- s.Target.UnmarshalBytes(src)
- src = src[s.Target.SizeBytes():]
- s.UID.UnmarshalUnsafe(src)
- src = src[s.UID.SizeBytes():]
- s.GID.UnmarshalUnsafe(src)
+func (s *SymlinkAtReq) UnmarshalBytes(src []byte) []byte {
+ src = s.DirFD.UnmarshalUnsafe(src)
+ src = s.Name.UnmarshalBytes(src)
+ src = s.Target.UnmarshalBytes(src)
+ src = s.UID.UnmarshalUnsafe(src)
+ return s.GID.UnmarshalUnsafe(src)
}
// SymlinkAtResp is the response to a successful SymlinkAt request.
@@ -849,21 +834,17 @@ func (l *LinkAtReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (l *LinkAtReq) MarshalBytes(dst []byte) {
- l.DirFD.MarshalUnsafe(dst)
- dst = dst[l.DirFD.SizeBytes():]
- l.Target.MarshalUnsafe(dst)
- dst = dst[l.Target.SizeBytes():]
- l.Name.MarshalBytes(dst)
+func (l *LinkAtReq) MarshalBytes(dst []byte) []byte {
+ dst = l.DirFD.MarshalUnsafe(dst)
+ dst = l.Target.MarshalUnsafe(dst)
+ return l.Name.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (l *LinkAtReq) UnmarshalBytes(src []byte) {
- l.DirFD.UnmarshalUnsafe(src)
- src = src[l.DirFD.SizeBytes():]
- l.Target.UnmarshalUnsafe(src)
- src = src[l.Target.SizeBytes():]
- l.Name.UnmarshalBytes(src)
+func (l *LinkAtReq) UnmarshalBytes(src []byte) []byte {
+ src = l.DirFD.UnmarshalUnsafe(src)
+ src = l.Target.UnmarshalUnsafe(src)
+ return l.Name.UnmarshalBytes(src)
}
// LinkAtResp is used to respond to a successful LinkAt request.
@@ -923,13 +904,13 @@ func (r *ReadLinkAtResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (r *ReadLinkAtResp) MarshalBytes(dst []byte) {
- r.Target.MarshalBytes(dst)
+func (r *ReadLinkAtResp) MarshalBytes(dst []byte) []byte {
+ return r.Target.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (r *ReadLinkAtResp) UnmarshalBytes(src []byte) {
- r.Target.UnmarshalBytes(src)
+func (r *ReadLinkAtResp) UnmarshalBytes(src []byte) []byte {
+ return r.Target.UnmarshalBytes(src)
}
// FlushReq is used to make Flush requests.
@@ -963,21 +944,17 @@ func (u *UnlinkAtReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (u *UnlinkAtReq) MarshalBytes(dst []byte) {
- u.DirFD.MarshalUnsafe(dst)
- dst = dst[u.DirFD.SizeBytes():]
- u.Name.MarshalBytes(dst)
- dst = dst[u.Name.SizeBytes():]
- u.Flags.MarshalUnsafe(dst)
+func (u *UnlinkAtReq) MarshalBytes(dst []byte) []byte {
+ dst = u.DirFD.MarshalUnsafe(dst)
+ dst = u.Name.MarshalBytes(dst)
+ return u.Flags.MarshalUnsafe(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (u *UnlinkAtReq) UnmarshalBytes(src []byte) {
- u.DirFD.UnmarshalUnsafe(src)
- src = src[u.DirFD.SizeBytes():]
- u.Name.UnmarshalBytes(src)
- src = src[u.Name.SizeBytes():]
- u.Flags.UnmarshalUnsafe(src)
+func (u *UnlinkAtReq) UnmarshalBytes(src []byte) []byte {
+ src = u.DirFD.UnmarshalUnsafe(src)
+ src = u.Name.UnmarshalBytes(src)
+ return u.Flags.UnmarshalUnsafe(src)
}
// RenameAtReq is used to make Rename requests. Note that the request takes in
@@ -994,21 +971,17 @@ func (r *RenameAtReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (r *RenameAtReq) MarshalBytes(dst []byte) {
- r.Renamed.MarshalUnsafe(dst)
- dst = dst[r.Renamed.SizeBytes():]
- r.NewDir.MarshalUnsafe(dst)
- dst = dst[r.NewDir.SizeBytes():]
- r.NewName.MarshalBytes(dst)
+func (r *RenameAtReq) MarshalBytes(dst []byte) []byte {
+ dst = r.Renamed.MarshalUnsafe(dst)
+ dst = r.NewDir.MarshalUnsafe(dst)
+ return r.NewName.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (r *RenameAtReq) UnmarshalBytes(src []byte) {
- r.Renamed.UnmarshalUnsafe(src)
- src = src[r.Renamed.SizeBytes():]
- r.NewDir.UnmarshalUnsafe(src)
- src = src[r.NewDir.SizeBytes():]
- r.NewName.UnmarshalBytes(src)
+func (r *RenameAtReq) UnmarshalBytes(src []byte) []byte {
+ src = r.Renamed.UnmarshalUnsafe(src)
+ src = r.NewDir.UnmarshalUnsafe(src)
+ return r.NewName.UnmarshalBytes(src)
}
// Getdents64Req is used to make Getdents64 requests.
@@ -1039,33 +1012,23 @@ func (d *Dirent64) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (d *Dirent64) MarshalBytes(dst []byte) {
- d.Ino.MarshalUnsafe(dst)
- dst = dst[d.Ino.SizeBytes():]
- d.DevMinor.MarshalUnsafe(dst)
- dst = dst[d.DevMinor.SizeBytes():]
- d.DevMajor.MarshalUnsafe(dst)
- dst = dst[d.DevMajor.SizeBytes():]
- d.Off.MarshalUnsafe(dst)
- dst = dst[d.Off.SizeBytes():]
- d.Type.MarshalUnsafe(dst)
- dst = dst[d.Type.SizeBytes():]
- d.Name.MarshalBytes(dst)
+func (d *Dirent64) MarshalBytes(dst []byte) []byte {
+ dst = d.Ino.MarshalUnsafe(dst)
+ dst = d.DevMinor.MarshalUnsafe(dst)
+ dst = d.DevMajor.MarshalUnsafe(dst)
+ dst = d.Off.MarshalUnsafe(dst)
+ dst = d.Type.MarshalUnsafe(dst)
+ return d.Name.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (d *Dirent64) UnmarshalBytes(src []byte) {
- d.Ino.UnmarshalUnsafe(src)
- src = src[d.Ino.SizeBytes():]
- d.DevMinor.UnmarshalUnsafe(src)
- src = src[d.DevMinor.SizeBytes():]
- d.DevMajor.UnmarshalUnsafe(src)
- src = src[d.DevMajor.SizeBytes():]
- d.Off.UnmarshalUnsafe(src)
- src = src[d.Off.SizeBytes():]
- d.Type.UnmarshalUnsafe(src)
- src = src[d.Type.SizeBytes():]
- d.Name.UnmarshalBytes(src)
+func (d *Dirent64) UnmarshalBytes(src []byte) []byte {
+ src = d.Ino.UnmarshalUnsafe(src)
+ src = d.DevMinor.UnmarshalUnsafe(src)
+ src = d.DevMajor.UnmarshalUnsafe(src)
+ src = d.Off.UnmarshalUnsafe(src)
+ src = d.Type.UnmarshalUnsafe(src)
+ return d.Name.UnmarshalBytes(src)
}
// Getdents64Resp is used to communicate getdents64 results.
@@ -1083,31 +1046,29 @@ func (g *Getdents64Resp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (g *Getdents64Resp) MarshalBytes(dst []byte) {
+func (g *Getdents64Resp) MarshalBytes(dst []byte) []byte {
numDirents := primitive.Uint32(len(g.Dirents))
- numDirents.MarshalUnsafe(dst)
- dst = dst[numDirents.SizeBytes():]
+ dst = numDirents.MarshalUnsafe(dst)
for i := range g.Dirents {
- g.Dirents[i].MarshalBytes(dst)
- dst = dst[g.Dirents[i].SizeBytes():]
+ dst = g.Dirents[i].MarshalBytes(dst)
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (g *Getdents64Resp) UnmarshalBytes(src []byte) {
+func (g *Getdents64Resp) UnmarshalBytes(src []byte) []byte {
var numDirents primitive.Uint32
- numDirents.UnmarshalUnsafe(src)
+ src = numDirents.UnmarshalUnsafe(src)
if cap(g.Dirents) < int(numDirents) {
g.Dirents = make([]Dirent64, numDirents)
} else {
g.Dirents = g.Dirents[:numDirents]
}
- src = src[numDirents.SizeBytes():]
for i := range g.Dirents {
- g.Dirents[i].UnmarshalBytes(src)
- src = src[g.Dirents[i].SizeBytes():]
+ src = g.Dirents[i].UnmarshalBytes(src)
}
+ return src
}
// FGetXattrReq is used to make FGetXattr requests. The response to this is
@@ -1124,21 +1085,17 @@ func (g *FGetXattrReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (g *FGetXattrReq) MarshalBytes(dst []byte) {
- g.FD.MarshalUnsafe(dst)
- dst = dst[g.FD.SizeBytes():]
- g.BufSize.MarshalUnsafe(dst)
- dst = dst[g.BufSize.SizeBytes():]
- g.Name.MarshalBytes(dst)
+func (g *FGetXattrReq) MarshalBytes(dst []byte) []byte {
+ dst = g.FD.MarshalUnsafe(dst)
+ dst = g.BufSize.MarshalUnsafe(dst)
+ return g.Name.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (g *FGetXattrReq) UnmarshalBytes(src []byte) {
- g.FD.UnmarshalUnsafe(src)
- src = src[g.FD.SizeBytes():]
- g.BufSize.UnmarshalUnsafe(src)
- src = src[g.BufSize.SizeBytes():]
- g.Name.UnmarshalBytes(src)
+func (g *FGetXattrReq) UnmarshalBytes(src []byte) []byte {
+ src = g.FD.UnmarshalUnsafe(src)
+ src = g.BufSize.UnmarshalUnsafe(src)
+ return g.Name.UnmarshalBytes(src)
}
// FGetXattrResp is used to respond to FGetXattr request.
@@ -1152,13 +1109,13 @@ func (g *FGetXattrResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (g *FGetXattrResp) MarshalBytes(dst []byte) {
- g.Value.MarshalBytes(dst)
+func (g *FGetXattrResp) MarshalBytes(dst []byte) []byte {
+ return g.Value.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (g *FGetXattrResp) UnmarshalBytes(src []byte) {
- g.Value.UnmarshalBytes(src)
+func (g *FGetXattrResp) UnmarshalBytes(src []byte) []byte {
+ return g.Value.UnmarshalBytes(src)
}
// FSetXattrReq is used to make FSetXattr requests. It has no response.
@@ -1175,25 +1132,19 @@ func (s *FSetXattrReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *FSetXattrReq) MarshalBytes(dst []byte) {
- s.FD.MarshalUnsafe(dst)
- dst = dst[s.FD.SizeBytes():]
- s.Flags.MarshalUnsafe(dst)
- dst = dst[s.Flags.SizeBytes():]
- s.Name.MarshalBytes(dst)
- dst = dst[s.Name.SizeBytes():]
- s.Value.MarshalBytes(dst)
+func (s *FSetXattrReq) MarshalBytes(dst []byte) []byte {
+ dst = s.FD.MarshalUnsafe(dst)
+ dst = s.Flags.MarshalUnsafe(dst)
+ dst = s.Name.MarshalBytes(dst)
+ return s.Value.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *FSetXattrReq) UnmarshalBytes(src []byte) {
- s.FD.UnmarshalUnsafe(src)
- src = src[s.FD.SizeBytes():]
- s.Flags.UnmarshalUnsafe(src)
- src = src[s.Flags.SizeBytes():]
- s.Name.UnmarshalBytes(src)
- src = src[s.Name.SizeBytes():]
- s.Value.UnmarshalBytes(src)
+func (s *FSetXattrReq) UnmarshalBytes(src []byte) []byte {
+ src = s.FD.UnmarshalUnsafe(src)
+ src = s.Flags.UnmarshalUnsafe(src)
+ src = s.Name.UnmarshalBytes(src)
+ return s.Value.UnmarshalBytes(src)
}
// FRemoveXattrReq is used to make FRemoveXattr requests. It has no response.
@@ -1208,17 +1159,15 @@ func (r *FRemoveXattrReq) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (r *FRemoveXattrReq) MarshalBytes(dst []byte) {
- r.FD.MarshalUnsafe(dst)
- dst = dst[r.FD.SizeBytes():]
- r.Name.MarshalBytes(dst)
+func (r *FRemoveXattrReq) MarshalBytes(dst []byte) []byte {
+ dst = r.FD.MarshalUnsafe(dst)
+ return r.Name.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (r *FRemoveXattrReq) UnmarshalBytes(src []byte) {
- r.FD.UnmarshalUnsafe(src)
- src = src[r.FD.SizeBytes():]
- r.Name.UnmarshalBytes(src)
+func (r *FRemoveXattrReq) UnmarshalBytes(src []byte) []byte {
+ src = r.FD.UnmarshalUnsafe(src)
+ return r.Name.UnmarshalBytes(src)
}
// FListXattrReq is used to make FListXattr requests.
@@ -1241,11 +1190,11 @@ func (l *FListXattrResp) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (l *FListXattrResp) MarshalBytes(dst []byte) {
- l.Xattrs.MarshalBytes(dst)
+func (l *FListXattrResp) MarshalBytes(dst []byte) []byte {
+ return l.Xattrs.MarshalBytes(dst)
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (l *FListXattrResp) UnmarshalBytes(src []byte) {
- l.Xattrs.UnmarshalBytes(src)
+func (l *FListXattrResp) UnmarshalBytes(src []byte) []byte {
+ return l.Xattrs.UnmarshalBytes(src)
}
diff --git a/pkg/lisafs/sample_message.go b/pkg/lisafs/sample_message.go
index 3868dfa08..745736b6d 100644
--- a/pkg/lisafs/sample_message.go
+++ b/pkg/lisafs/sample_message.go
@@ -53,18 +53,24 @@ func (m *MsgDynamic) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *MsgDynamic) MarshalBytes(dst []byte) {
- m.N.MarshalUnsafe(dst)
- dst = dst[m.N.SizeBytes():]
- MarshalUnsafeMsg1Slice(m.Arr, dst)
+func (m *MsgDynamic) MarshalBytes(dst []byte) []byte {
+ dst = m.N.MarshalUnsafe(dst)
+ n, err := MarshalUnsafeMsg1Slice(m.Arr, dst)
+ if err != nil {
+ panic(err)
+ }
+ return dst[n:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *MsgDynamic) UnmarshalBytes(src []byte) {
- m.N.UnmarshalUnsafe(src)
- src = src[m.N.SizeBytes():]
+func (m *MsgDynamic) UnmarshalBytes(src []byte) []byte {
+ src = m.N.UnmarshalUnsafe(src)
m.Arr = make([]MsgSimple, m.N)
- UnmarshalUnsafeMsg1Slice(m.Arr, src)
+ n, err := UnmarshalUnsafeMsg1Slice(m.Arr, src)
+ if err != nil {
+ panic(err)
+ }
+ return src[n:]
}
// Randomize randomizes the contents of m.
@@ -90,21 +96,18 @@ func (v *P9Version) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (v *P9Version) MarshalBytes(dst []byte) {
- v.MSize.MarshalUnsafe(dst)
- dst = dst[v.MSize.SizeBytes():]
+func (v *P9Version) MarshalBytes(dst []byte) []byte {
+ dst = v.MSize.MarshalUnsafe(dst)
versionLen := primitive.Uint16(len(v.Version))
- versionLen.MarshalUnsafe(dst)
- dst = dst[versionLen.SizeBytes():]
- copy(dst, v.Version)
+ dst = versionLen.MarshalUnsafe(dst)
+ return dst[copy(dst, v.Version):]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (v *P9Version) UnmarshalBytes(src []byte) {
- v.MSize.UnmarshalUnsafe(src)
- src = src[v.MSize.SizeBytes():]
+func (v *P9Version) UnmarshalBytes(src []byte) []byte {
+ src = v.MSize.UnmarshalUnsafe(src)
var versionLen primitive.Uint16
- versionLen.UnmarshalUnsafe(src)
- src = src[versionLen.SizeBytes():]
+ src = versionLen.UnmarshalUnsafe(src)
v.Version = string(src[:versionLen])
+ return src[versionLen:]
}
diff --git a/pkg/marshal/marshal.go b/pkg/marshal/marshal.go
index 7da450ce8..9e34eae80 100644
--- a/pkg/marshal/marshal.go
+++ b/pkg/marshal/marshal.go
@@ -59,13 +59,15 @@ type Marshallable interface {
// likely make use of the type of these fields).
SizeBytes() int
- // MarshalBytes serializes a copy of a type to dst.
+ // MarshalBytes serializes a copy of a type to dst and returns the remaining
+ // buffer.
// Precondition: dst must be at least SizeBytes() in length.
- MarshalBytes(dst []byte)
+ MarshalBytes(dst []byte) []byte
- // UnmarshalBytes deserializes a type from src.
+ // UnmarshalBytes deserializes a type from src and returns the remaining
+ // buffer.
// Precondition: src must be at least SizeBytes() in length.
- UnmarshalBytes(src []byte)
+ UnmarshalBytes(src []byte) []byte
// Packed returns true if the marshalled size of the type is the same as the
// size it occupies in memory. This happens when the type has no fields
@@ -86,7 +88,7 @@ type Marshallable interface {
// return false, MarshalUnsafe should fall back to the safer but slower
// MarshalBytes.
// Precondition: dst must be at least SizeBytes() in length.
- MarshalUnsafe(dst []byte)
+ MarshalUnsafe(dst []byte) []byte
// UnmarshalUnsafe deserializes a type by directly copying to the underlying
// memory allocated for the object by the runtime.
@@ -96,7 +98,7 @@ type Marshallable interface {
// UnmarshalUnsafe should fall back to the safer but slower unmarshal
// mechanism implemented in UnmarshalBytes.
// Precondition: src must be at least SizeBytes() in length.
- UnmarshalUnsafe(src []byte)
+ UnmarshalUnsafe(src []byte) []byte
// CopyIn deserializes a Marshallable type from a task's memory. This may
// only be called from a task goroutine. This is more efficient than calling
diff --git a/pkg/marshal/marshal_impl_util.go b/pkg/marshal/marshal_impl_util.go
index 9e6a6fa29..6c1cf7a4c 100644
--- a/pkg/marshal/marshal_impl_util.go
+++ b/pkg/marshal/marshal_impl_util.go
@@ -38,12 +38,12 @@ func (StubMarshallable) SizeBytes() int {
}
// MarshalBytes implements Marshallable.MarshalBytes.
-func (StubMarshallable) MarshalBytes(dst []byte) {
+func (StubMarshallable) MarshalBytes(dst []byte) []byte {
panic("Please implement your own MarshalBytes function")
}
// UnmarshalBytes implements Marshallable.UnmarshalBytes.
-func (StubMarshallable) UnmarshalBytes(src []byte) {
+func (StubMarshallable) UnmarshalBytes(src []byte) []byte {
panic("Please implement your own UnmarshalBytes function")
}
@@ -53,12 +53,12 @@ func (StubMarshallable) Packed() bool {
}
// MarshalUnsafe implements Marshallable.MarshalUnsafe.
-func (StubMarshallable) MarshalUnsafe(dst []byte) {
+func (StubMarshallable) MarshalUnsafe(dst []byte) []byte {
panic("Please implement your own MarshalUnsafe function")
}
// UnmarshalUnsafe implements Marshallable.UnmarshalUnsafe.
-func (StubMarshallable) UnmarshalUnsafe(src []byte) {
+func (StubMarshallable) UnmarshalUnsafe(src []byte) []byte {
panic("Please implement your own UnmarshalUnsafe function")
}
diff --git a/pkg/marshal/primitive/primitive.go b/pkg/marshal/primitive/primitive.go
index 1c49cf082..7ece26933 100644
--- a/pkg/marshal/primitive/primitive.go
+++ b/pkg/marshal/primitive/primitive.go
@@ -76,13 +76,13 @@ func (b *ByteSlice) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (b *ByteSlice) MarshalBytes(dst []byte) {
- copy(dst, *b)
+func (b *ByteSlice) MarshalBytes(dst []byte) []byte {
+ return dst[copy(dst, *b):]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (b *ByteSlice) UnmarshalBytes(src []byte) {
- copy(*b, src)
+func (b *ByteSlice) UnmarshalBytes(src []byte) []byte {
+ return src[copy(*b, src):]
}
// Packed implements marshal.Marshallable.Packed.
@@ -91,13 +91,13 @@ func (b *ByteSlice) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (b *ByteSlice) MarshalUnsafe(dst []byte) {
- b.MarshalBytes(dst)
+func (b *ByteSlice) MarshalUnsafe(dst []byte) []byte {
+ return b.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (b *ByteSlice) UnmarshalUnsafe(src []byte) {
- b.UnmarshalBytes(src)
+func (b *ByteSlice) UnmarshalUnsafe(src []byte) []byte {
+ return b.UnmarshalBytes(src)
}
// CopyIn implements marshal.Marshallable.CopyIn.
diff --git a/pkg/marshal/primitive/primitive_abi_autogen_unsafe.go b/pkg/marshal/primitive/primitive_abi_autogen_unsafe.go
index 51e9e7144..792c0a693 100644
--- a/pkg/marshal/primitive/primitive_abi_autogen_unsafe.go
+++ b/pkg/marshal/primitive/primitive_abi_autogen_unsafe.go
@@ -29,13 +29,15 @@ func (i *Int16) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *Int16) MarshalBytes(dst []byte) {
+func (i *Int16) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(*i))
+ return dst[2:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *Int16) UnmarshalBytes(src []byte) {
+func (i *Int16) UnmarshalBytes(src []byte) []byte {
*i = Int16(int16(hostarch.ByteOrder.Uint16(src[:2])))
+ return src[2:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -46,13 +48,17 @@ func (i *Int16) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *Int16) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
+func (i *Int16) MarshalUnsafe(dst []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *Int16) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
+func (i *Int16) UnmarshalUnsafe(src []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -196,13 +202,15 @@ func (i *Int32) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *Int32) MarshalBytes(dst []byte) {
+func (i *Int32) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(*i))
+ return dst[4:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *Int32) UnmarshalBytes(src []byte) {
+func (i *Int32) UnmarshalBytes(src []byte) []byte {
*i = Int32(int32(hostarch.ByteOrder.Uint32(src[:4])))
+ return src[4:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -213,13 +221,17 @@ func (i *Int32) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *Int32) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
+func (i *Int32) MarshalUnsafe(dst []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *Int32) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
+func (i *Int32) UnmarshalUnsafe(src []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -363,13 +375,15 @@ func (i *Int64) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *Int64) MarshalBytes(dst []byte) {
+func (i *Int64) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(*i))
+ return dst[8:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *Int64) UnmarshalBytes(src []byte) {
+func (i *Int64) UnmarshalBytes(src []byte) []byte {
*i = Int64(int64(hostarch.ByteOrder.Uint64(src[:8])))
+ return src[8:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -380,13 +394,17 @@ func (i *Int64) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *Int64) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
+func (i *Int64) MarshalUnsafe(dst []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *Int64) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
+func (i *Int64) UnmarshalUnsafe(src []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -530,13 +548,15 @@ func (i *Int8) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (i *Int8) MarshalBytes(dst []byte) {
+func (i *Int8) MarshalBytes(dst []byte) []byte {
dst[0] = byte(*i)
+ return dst[1:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (i *Int8) UnmarshalBytes(src []byte) {
+func (i *Int8) UnmarshalBytes(src []byte) []byte {
*i = Int8(int8(src[0]))
+ return src[1:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -547,13 +567,17 @@ func (i *Int8) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (i *Int8) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(i.SizeBytes()))
+func (i *Int8) MarshalUnsafe(dst []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (i *Int8) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(i.SizeBytes()))
+func (i *Int8) UnmarshalUnsafe(src []byte) []byte {
+ size := i.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -697,13 +721,15 @@ func (u *Uint16) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (u *Uint16) MarshalBytes(dst []byte) {
+func (u *Uint16) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(*u))
+ return dst[2:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (u *Uint16) UnmarshalBytes(src []byte) {
+func (u *Uint16) UnmarshalBytes(src []byte) []byte {
*u = Uint16(uint16(hostarch.ByteOrder.Uint16(src[:2])))
+ return src[2:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -714,13 +740,17 @@ func (u *Uint16) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (u *Uint16) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(u.SizeBytes()))
+func (u *Uint16) MarshalUnsafe(dst []byte) []byte {
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (u *Uint16) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(u.SizeBytes()))
+func (u *Uint16) UnmarshalUnsafe(src []byte) []byte {
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -864,13 +894,15 @@ func (u *Uint32) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (u *Uint32) MarshalBytes(dst []byte) {
+func (u *Uint32) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(*u))
+ return dst[4:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (u *Uint32) UnmarshalBytes(src []byte) {
+func (u *Uint32) UnmarshalBytes(src []byte) []byte {
*u = Uint32(uint32(hostarch.ByteOrder.Uint32(src[:4])))
+ return src[4:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -881,13 +913,17 @@ func (u *Uint32) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (u *Uint32) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(u.SizeBytes()))
+func (u *Uint32) MarshalUnsafe(dst []byte) []byte {
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (u *Uint32) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(u.SizeBytes()))
+func (u *Uint32) UnmarshalUnsafe(src []byte) []byte {
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1031,13 +1067,15 @@ func (u *Uint64) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (u *Uint64) MarshalBytes(dst []byte) {
+func (u *Uint64) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(*u))
+ return dst[8:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (u *Uint64) UnmarshalBytes(src []byte) {
+func (u *Uint64) UnmarshalBytes(src []byte) []byte {
*u = Uint64(uint64(hostarch.ByteOrder.Uint64(src[:8])))
+ return src[8:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -1048,13 +1086,17 @@ func (u *Uint64) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (u *Uint64) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(u.SizeBytes()))
+func (u *Uint64) MarshalUnsafe(dst []byte) []byte {
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (u *Uint64) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(u.SizeBytes()))
+func (u *Uint64) UnmarshalUnsafe(src []byte) []byte {
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -1198,13 +1240,15 @@ func (u *Uint8) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (u *Uint8) MarshalBytes(dst []byte) {
+func (u *Uint8) MarshalBytes(dst []byte) []byte {
dst[0] = byte(*u)
+ return dst[1:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (u *Uint8) UnmarshalBytes(src []byte) {
+func (u *Uint8) UnmarshalBytes(src []byte) []byte {
*u = Uint8(uint8(src[0]))
+ return src[1:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -1215,13 +1259,17 @@ func (u *Uint8) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (u *Uint8) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(u.SizeBytes()))
+func (u *Uint8) MarshalUnsafe(dst []byte) []byte {
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (u *Uint8) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(u.SizeBytes()))
+func (u *Uint8) UnmarshalUnsafe(src []byte) []byte {
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
diff --git a/pkg/sentry/arch/arch_amd64_abi_autogen_unsafe.go b/pkg/sentry/arch/arch_amd64_abi_autogen_unsafe.go
index dd850b1b8..42cc106a1 100644
--- a/pkg/sentry/arch/arch_amd64_abi_autogen_unsafe.go
+++ b/pkg/sentry/arch/arch_amd64_abi_autogen_unsafe.go
@@ -36,7 +36,7 @@ func (s *SignalContext64) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SignalContext64) MarshalBytes(dst []byte) {
+func (s *SignalContext64) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.R8))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.R9))
@@ -85,8 +85,7 @@ func (s *SignalContext64) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Trapno))
dst = dst[8:]
- s.Oldmask.MarshalBytes(dst[:s.Oldmask.SizeBytes()])
- dst = dst[s.Oldmask.SizeBytes():]
+ dst = s.Oldmask.MarshalBytes(dst)
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Cr2))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Fpstate))
@@ -95,10 +94,11 @@ func (s *SignalContext64) MarshalBytes(dst []byte) {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Reserved[idx]))
dst = dst[8:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SignalContext64) UnmarshalBytes(src []byte) {
+func (s *SignalContext64) UnmarshalBytes(src []byte) []byte {
s.R8 = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
s.R9 = uint64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -147,8 +147,7 @@ func (s *SignalContext64) UnmarshalBytes(src []byte) {
src = src[8:]
s.Trapno = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
- s.Oldmask.UnmarshalBytes(src[:s.Oldmask.SizeBytes()])
- src = src[s.Oldmask.SizeBytes():]
+ src = s.Oldmask.UnmarshalBytes(src)
s.Cr2 = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
s.Fpstate = uint64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -157,6 +156,7 @@ func (s *SignalContext64) UnmarshalBytes(src []byte) {
s.Reserved[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -166,23 +166,25 @@ func (s *SignalContext64) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SignalContext64) MarshalUnsafe(dst []byte) {
+func (s *SignalContext64) MarshalUnsafe(dst []byte) []byte {
if s.Oldmask.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type SignalContext64 doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type SignalContext64 doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SignalContext64) UnmarshalUnsafe(src []byte) {
+func (s *SignalContext64) UnmarshalUnsafe(src []byte) []byte {
if s.Oldmask.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type SignalContext64 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type SignalContext64 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -275,31 +277,27 @@ func (u *UContext64) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (u *UContext64) MarshalBytes(dst []byte) {
+func (u *UContext64) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Flags))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Link))
dst = dst[8:]
- u.Stack.MarshalBytes(dst[:u.Stack.SizeBytes()])
- dst = dst[u.Stack.SizeBytes():]
- u.MContext.MarshalBytes(dst[:u.MContext.SizeBytes()])
- dst = dst[u.MContext.SizeBytes():]
- u.Sigset.MarshalBytes(dst[:u.Sigset.SizeBytes()])
- dst = dst[u.Sigset.SizeBytes():]
+ dst = u.Stack.MarshalBytes(dst)
+ dst = u.MContext.MarshalBytes(dst)
+ dst = u.Sigset.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (u *UContext64) UnmarshalBytes(src []byte) {
+func (u *UContext64) UnmarshalBytes(src []byte) []byte {
u.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
u.Link = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
- u.Stack.UnmarshalBytes(src[:u.Stack.SizeBytes()])
- src = src[u.Stack.SizeBytes():]
- u.MContext.UnmarshalBytes(src[:u.MContext.SizeBytes()])
- src = src[u.MContext.SizeBytes():]
- u.Sigset.UnmarshalBytes(src[:u.Sigset.SizeBytes()])
- src = src[u.Sigset.SizeBytes():]
+ src = u.Stack.UnmarshalBytes(src)
+ src = u.MContext.UnmarshalBytes(src)
+ src = u.Sigset.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -309,23 +307,25 @@ func (u *UContext64) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (u *UContext64) MarshalUnsafe(dst []byte) {
+func (u *UContext64) MarshalUnsafe(dst []byte) []byte {
if u.MContext.Packed() && u.Sigset.Packed() && u.Stack.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(u.SizeBytes()))
- } else {
- // Type UContext64 doesn't have a packed layout in memory, fallback to MarshalBytes.
- u.MarshalBytes(dst)
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
+ return dst[size:]
}
+ // Type UContext64 doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return u.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (u *UContext64) UnmarshalUnsafe(src []byte) {
+func (u *UContext64) UnmarshalUnsafe(src []byte) []byte {
if u.MContext.Packed() && u.Sigset.Packed() && u.Stack.Packed() {
- gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(u.SizeBytes()))
- } else {
- // Type UContext64 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- u.UnmarshalBytes(src)
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type UContext64 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return u.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
diff --git a/pkg/sentry/arch/arch_arm64_abi_autogen_unsafe.go b/pkg/sentry/arch/arch_arm64_abi_autogen_unsafe.go
index 52ca0b185..035134fa7 100644
--- a/pkg/sentry/arch/arch_arm64_abi_autogen_unsafe.go
+++ b/pkg/sentry/arch/arch_arm64_abi_autogen_unsafe.go
@@ -38,9 +38,8 @@ func (f *FpsimdContext) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (f *FpsimdContext) MarshalBytes(dst []byte) {
- f.Head.MarshalBytes(dst[:f.Head.SizeBytes()])
- dst = dst[f.Head.SizeBytes():]
+func (f *FpsimdContext) MarshalBytes(dst []byte) []byte {
+ dst = f.Head.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Fpsr))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Fpcr))
@@ -49,12 +48,12 @@ func (f *FpsimdContext) MarshalBytes(dst []byte) {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Vregs[idx]))
dst = dst[8:]
}
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (f *FpsimdContext) UnmarshalBytes(src []byte) {
- f.Head.UnmarshalBytes(src[:f.Head.SizeBytes()])
- src = src[f.Head.SizeBytes():]
+func (f *FpsimdContext) UnmarshalBytes(src []byte) []byte {
+ src = f.Head.UnmarshalBytes(src)
f.Fpsr = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
f.Fpcr = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -63,6 +62,7 @@ func (f *FpsimdContext) UnmarshalBytes(src []byte) {
f.Vregs[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
}
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -72,23 +72,25 @@ func (f *FpsimdContext) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (f *FpsimdContext) MarshalUnsafe(dst []byte) {
+func (f *FpsimdContext) MarshalUnsafe(dst []byte) []byte {
if f.Head.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(f.SizeBytes()))
- } else {
- // Type FpsimdContext doesn't have a packed layout in memory, fallback to MarshalBytes.
- f.MarshalBytes(dst)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size))
+ return dst[size:]
}
+ // Type FpsimdContext doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return f.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (f *FpsimdContext) UnmarshalUnsafe(src []byte) {
+func (f *FpsimdContext) UnmarshalUnsafe(src []byte) []byte {
if f.Head.Packed() {
- gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(f.SizeBytes()))
- } else {
- // Type FpsimdContext doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- f.UnmarshalBytes(src)
+ size := f.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type FpsimdContext doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return f.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -181,7 +183,7 @@ func (s *SignalContext64) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SignalContext64) MarshalBytes(dst []byte) {
+func (s *SignalContext64) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FaultAddr))
dst = dst[8:]
for idx := 0; idx < 31; idx++ {
@@ -198,12 +200,12 @@ func (s *SignalContext64) MarshalBytes(dst []byte) {
dst[0] = byte(s._pad[idx])
dst = dst[1:]
}
- s.Fpsimd64.MarshalBytes(dst[:s.Fpsimd64.SizeBytes()])
- dst = dst[s.Fpsimd64.SizeBytes():]
+ dst = s.Fpsimd64.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SignalContext64) UnmarshalBytes(src []byte) {
+func (s *SignalContext64) UnmarshalBytes(src []byte) []byte {
s.FaultAddr = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
for idx := 0; idx < 31; idx++ {
@@ -220,8 +222,8 @@ func (s *SignalContext64) UnmarshalBytes(src []byte) {
s._pad[idx] = src[0]
src = src[1:]
}
- s.Fpsimd64.UnmarshalBytes(src[:s.Fpsimd64.SizeBytes()])
- src = src[s.Fpsimd64.SizeBytes():]
+ src = s.Fpsimd64.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -231,23 +233,25 @@ func (s *SignalContext64) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SignalContext64) MarshalUnsafe(dst []byte) {
+func (s *SignalContext64) MarshalUnsafe(dst []byte) []byte {
if s.Fpsimd64.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
- } else {
- // Type SignalContext64 doesn't have a packed layout in memory, fallback to MarshalBytes.
- s.MarshalBytes(dst)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
+ // Type SignalContext64 doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return s.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SignalContext64) UnmarshalUnsafe(src []byte) {
+func (s *SignalContext64) UnmarshalUnsafe(src []byte) []byte {
if s.Fpsimd64.Packed() {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
- } else {
- // Type SignalContext64 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- s.UnmarshalBytes(src)
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type SignalContext64 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return s.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -342,15 +346,13 @@ func (u *UContext64) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (u *UContext64) MarshalBytes(dst []byte) {
+func (u *UContext64) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Flags))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Link))
dst = dst[8:]
- u.Stack.MarshalBytes(dst[:u.Stack.SizeBytes()])
- dst = dst[u.Stack.SizeBytes():]
- u.Sigset.MarshalBytes(dst[:u.Sigset.SizeBytes()])
- dst = dst[u.Sigset.SizeBytes():]
+ dst = u.Stack.MarshalBytes(dst)
+ dst = u.Sigset.MarshalBytes(dst)
for idx := 0; idx < 120; idx++ {
dst[0] = byte(u._pad[idx])
dst = dst[1:]
@@ -359,20 +361,18 @@ func (u *UContext64) MarshalBytes(dst []byte) {
dst[0] = byte(u._pad2[idx])
dst = dst[1:]
}
- u.MContext.MarshalBytes(dst[:u.MContext.SizeBytes()])
- dst = dst[u.MContext.SizeBytes():]
+ dst = u.MContext.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (u *UContext64) UnmarshalBytes(src []byte) {
+func (u *UContext64) UnmarshalBytes(src []byte) []byte {
u.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
u.Link = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
- u.Stack.UnmarshalBytes(src[:u.Stack.SizeBytes()])
- src = src[u.Stack.SizeBytes():]
- u.Sigset.UnmarshalBytes(src[:u.Sigset.SizeBytes()])
- src = src[u.Sigset.SizeBytes():]
+ src = u.Stack.UnmarshalBytes(src)
+ src = u.Sigset.UnmarshalBytes(src)
for idx := 0; idx < 120; idx++ {
u._pad[idx] = src[0]
src = src[1:]
@@ -381,8 +381,8 @@ func (u *UContext64) UnmarshalBytes(src []byte) {
u._pad2[idx] = src[0]
src = src[1:]
}
- u.MContext.UnmarshalBytes(src[:u.MContext.SizeBytes()])
- src = src[u.MContext.SizeBytes():]
+ src = u.MContext.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -392,23 +392,25 @@ func (u *UContext64) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (u *UContext64) MarshalUnsafe(dst []byte) {
+func (u *UContext64) MarshalUnsafe(dst []byte) []byte {
if u.MContext.Packed() && u.Sigset.Packed() && u.Stack.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(u.SizeBytes()))
- } else {
- // Type UContext64 doesn't have a packed layout in memory, fallback to MarshalBytes.
- u.MarshalBytes(dst)
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
+ return dst[size:]
}
+ // Type UContext64 doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return u.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (u *UContext64) UnmarshalUnsafe(src []byte) {
+func (u *UContext64) UnmarshalUnsafe(src []byte) []byte {
if u.MContext.Packed() && u.Sigset.Packed() && u.Stack.Packed() {
- gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(u.SizeBytes()))
- } else {
- // Type UContext64 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- u.UnmarshalBytes(src)
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type UContext64 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return u.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -498,19 +500,21 @@ func (a *aarch64Ctx) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (a *aarch64Ctx) MarshalBytes(dst []byte) {
+func (a *aarch64Ctx) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.Magic))
dst = dst[4:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.Size))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (a *aarch64Ctx) UnmarshalBytes(src []byte) {
+func (a *aarch64Ctx) UnmarshalBytes(src []byte) []byte {
a.Magic = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
a.Size = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -520,13 +524,17 @@ func (a *aarch64Ctx) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (a *aarch64Ctx) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(a), uintptr(a.SizeBytes()))
+func (a *aarch64Ctx) MarshalUnsafe(dst []byte) []byte {
+ size := a.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(a), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (a *aarch64Ctx) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(a), unsafe.Pointer(&src[0]), uintptr(a.SizeBytes()))
+func (a *aarch64Ctx) UnmarshalUnsafe(src []byte) []byte {
+ size := a.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(a), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
diff --git a/pkg/sentry/fsimpl/fuse/fusefs.go b/pkg/sentry/fsimpl/fuse/fusefs.go
index af16098d2..00b520c31 100644
--- a/pkg/sentry/fsimpl/fuse/fusefs.go
+++ b/pkg/sentry/fsimpl/fuse/fusefs.go
@@ -489,7 +489,7 @@ func (i *inode) Open(ctx context.Context, rp *vfs.ResolvingPath, d *kernfs.Dentr
// Lookup implements kernfs.Inode.Lookup.
func (i *inode) Lookup(ctx context.Context, name string) (kernfs.Inode, error) {
- in := linux.FUSELookupIn{Name: name}
+ in := linux.FUSELookupIn{Name: linux.CString(name)}
return i.newEntry(ctx, name, 0, linux.FUSE_LOOKUP, &in)
}
@@ -520,7 +520,7 @@ func (i *inode) NewFile(ctx context.Context, name string, opts vfs.OpenOptions)
Mode: uint32(opts.Mode) | linux.S_IFREG,
Umask: uint32(kernelTask.FSContext().Umask()),
},
- Name: name,
+ Name: linux.CString(name),
}
return i.newEntry(ctx, name, linux.S_IFREG, linux.FUSE_CREATE, &in)
}
@@ -533,7 +533,7 @@ func (i *inode) NewNode(ctx context.Context, name string, opts vfs.MknodOptions)
Rdev: linux.MakeDeviceID(uint16(opts.DevMajor), opts.DevMinor),
Umask: uint32(kernel.TaskFromContext(ctx).FSContext().Umask()),
},
- Name: name,
+ Name: linux.CString(name),
}
return i.newEntry(ctx, name, opts.Mode.FileType(), linux.FUSE_MKNOD, &in)
}
@@ -541,8 +541,8 @@ func (i *inode) NewNode(ctx context.Context, name string, opts vfs.MknodOptions)
// NewSymlink implements kernfs.Inode.NewSymlink.
func (i *inode) NewSymlink(ctx context.Context, name, target string) (kernfs.Inode, error) {
in := linux.FUSESymLinkIn{
- Name: name,
- Target: target,
+ Name: linux.CString(name),
+ Target: linux.CString(target),
}
return i.newEntry(ctx, name, linux.S_IFLNK, linux.FUSE_SYMLINK, &in)
}
@@ -554,7 +554,7 @@ func (i *inode) Unlink(ctx context.Context, name string, child kernfs.Inode) err
log.Warningf("fusefs.Inode.newEntry: couldn't get kernel task from context", i.nodeID)
return linuxerr.EINVAL
}
- in := linux.FUSEUnlinkIn{Name: name}
+ in := linux.FUSEUnlinkIn{Name: linux.CString(name)}
req := i.fs.conn.NewRequest(auth.CredentialsFromContext(ctx), uint32(kernelTask.ThreadID()), i.nodeID, linux.FUSE_UNLINK, &in)
res, err := i.fs.conn.Call(kernelTask, req)
if err != nil {
@@ -571,7 +571,7 @@ func (i *inode) NewDir(ctx context.Context, name string, opts vfs.MkdirOptions)
Mode: uint32(opts.Mode),
Umask: uint32(kernel.TaskFromContext(ctx).FSContext().Umask()),
},
- Name: name,
+ Name: linux.CString(name),
}
return i.newEntry(ctx, name, linux.S_IFDIR, linux.FUSE_MKDIR, &in)
}
@@ -581,7 +581,7 @@ func (i *inode) RmDir(ctx context.Context, name string, child kernfs.Inode) erro
fusefs := i.fs
task, creds := kernel.TaskFromContext(ctx), auth.CredentialsFromContext(ctx)
- in := linux.FUSERmDirIn{Name: name}
+ in := linux.FUSERmDirIn{Name: linux.CString(name)}
req := fusefs.conn.NewRequest(creds, uint32(task.ThreadID()), i.nodeID, linux.FUSE_RMDIR, &in)
res, err := i.fs.conn.Call(task, req)
if err != nil {
diff --git a/pkg/sentry/fsimpl/fuse/request_response.go b/pkg/sentry/fsimpl/fuse/request_response.go
index 8a72489fa..ec76ec2a4 100644
--- a/pkg/sentry/fsimpl/fuse/request_response.go
+++ b/pkg/sentry/fsimpl/fuse/request_response.go
@@ -41,7 +41,7 @@ type fuseInitRes struct {
}
// UnmarshalBytes deserializes src to the initOut attribute in a fuseInitRes.
-func (r *fuseInitRes) UnmarshalBytes(src []byte) {
+func (r *fuseInitRes) UnmarshalBytes(src []byte) []byte {
out := &r.initOut
// Introduced before FUSE kernel version 7.13.
@@ -70,7 +70,7 @@ func (r *fuseInitRes) UnmarshalBytes(src []byte) {
out.MaxPages = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
}
- _ = src // Remove unused warning.
+ return src
}
// SizeBytes is the size of the payload of the FUSE_INIT response.
diff --git a/pkg/sentry/kernel/auth/auth_abi_autogen_unsafe.go b/pkg/sentry/kernel/auth/auth_abi_autogen_unsafe.go
index 393dcea8c..770e66602 100644
--- a/pkg/sentry/kernel/auth/auth_abi_autogen_unsafe.go
+++ b/pkg/sentry/kernel/auth/auth_abi_autogen_unsafe.go
@@ -23,13 +23,15 @@ func (gid *GID) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (gid *GID) MarshalBytes(dst []byte) {
+func (gid *GID) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(*gid))
+ return dst[4:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (gid *GID) UnmarshalBytes(src []byte) {
+func (gid *GID) UnmarshalBytes(src []byte) []byte {
*gid = GID(uint32(hostarch.ByteOrder.Uint32(src[:4])))
+ return src[4:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -40,13 +42,17 @@ func (gid *GID) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (gid *GID) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(gid), uintptr(gid.SizeBytes()))
+func (gid *GID) MarshalUnsafe(dst []byte) []byte {
+ size := gid.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(gid), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (gid *GID) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(gid), unsafe.Pointer(&src[0]), uintptr(gid.SizeBytes()))
+func (gid *GID) UnmarshalUnsafe(src []byte) []byte {
+ size := gid.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(gid), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -190,13 +196,15 @@ func (uid *UID) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (uid *UID) MarshalBytes(dst []byte) {
+func (uid *UID) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(*uid))
+ return dst[4:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (uid *UID) UnmarshalBytes(src []byte) {
+func (uid *UID) UnmarshalBytes(src []byte) []byte {
*uid = UID(uint32(hostarch.ByteOrder.Uint32(src[:4])))
+ return src[4:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -207,13 +215,17 @@ func (uid *UID) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (uid *UID) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(uid), uintptr(uid.SizeBytes()))
+func (uid *UID) MarshalUnsafe(dst []byte) []byte {
+ size := uid.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(uid), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (uid *UID) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(uid), unsafe.Pointer(&src[0]), uintptr(uid.SizeBytes()))
+func (uid *UID) UnmarshalUnsafe(src []byte) []byte {
+ size := uid.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(uid), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
diff --git a/pkg/sentry/kernel/kernel_abi_autogen_unsafe.go b/pkg/sentry/kernel/kernel_abi_autogen_unsafe.go
index 83ed0f8ac..fe5ee7463 100644
--- a/pkg/sentry/kernel/kernel_abi_autogen_unsafe.go
+++ b/pkg/sentry/kernel/kernel_abi_autogen_unsafe.go
@@ -23,13 +23,15 @@ func (tid *ThreadID) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (tid *ThreadID) MarshalBytes(dst []byte) {
+func (tid *ThreadID) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(*tid))
+ return dst[4:]
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (tid *ThreadID) UnmarshalBytes(src []byte) {
+func (tid *ThreadID) UnmarshalBytes(src []byte) []byte {
*tid = ThreadID(int32(hostarch.ByteOrder.Uint32(src[:4])))
+ return src[4:]
}
// Packed implements marshal.Marshallable.Packed.
@@ -40,13 +42,17 @@ func (tid *ThreadID) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (tid *ThreadID) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(tid), uintptr(tid.SizeBytes()))
+func (tid *ThreadID) MarshalUnsafe(dst []byte) []byte {
+ size := tid.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(tid), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (tid *ThreadID) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(tid), unsafe.Pointer(&src[0]), uintptr(tid.SizeBytes()))
+func (tid *ThreadID) UnmarshalUnsafe(src []byte) []byte {
+ size := tid.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(tid), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -111,7 +117,7 @@ func (v *vdsoParams) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (v *vdsoParams) MarshalBytes(dst []byte) {
+func (v *vdsoParams) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(v.monotonicReady))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(v.monotonicBaseCycles))
@@ -128,10 +134,11 @@ func (v *vdsoParams) MarshalBytes(dst []byte) {
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(v.realtimeFrequency))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (v *vdsoParams) UnmarshalBytes(src []byte) {
+func (v *vdsoParams) UnmarshalBytes(src []byte) []byte {
v.monotonicReady = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
v.monotonicBaseCycles = int64(hostarch.ByteOrder.Uint64(src[:8]))
@@ -148,6 +155,7 @@ func (v *vdsoParams) UnmarshalBytes(src []byte) {
src = src[8:]
v.realtimeFrequency = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -157,13 +165,17 @@ func (v *vdsoParams) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (v *vdsoParams) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(v), uintptr(v.SizeBytes()))
+func (v *vdsoParams) MarshalUnsafe(dst []byte) []byte {
+ size := v.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(v), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (v *vdsoParams) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(v), unsafe.Pointer(&src[0]), uintptr(v.SizeBytes()))
+func (v *vdsoParams) UnmarshalUnsafe(src []byte) []byte {
+ size := v.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(v), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
diff --git a/pkg/sentry/loader/elf.go b/pkg/sentry/loader/elf.go
index fb213d109..09b148164 100644
--- a/pkg/sentry/loader/elf.go
+++ b/pkg/sentry/loader/elf.go
@@ -212,8 +212,7 @@ func parseHeader(ctx context.Context, f fullReader) (elfInfo, error) {
phdrs := make([]elf.ProgHeader, hdr.Phnum)
for i := range phdrs {
var prog64 linux.ElfProg64
- prog64.UnmarshalUnsafe(phdrBuf[:prog64Size])
- phdrBuf = phdrBuf[prog64Size:]
+ phdrBuf = prog64.UnmarshalUnsafe(phdrBuf)
phdrs[i] = elf.ProgHeader{
Type: elf.ProgType(prog64.Type),
Flags: elf.ProgFlag(prog64.Flags),
diff --git a/pkg/sentry/socket/control/control.go b/pkg/sentry/socket/control/control.go
index 6077b2150..4b036b323 100644
--- a/pkg/sentry/socket/control/control.go
+++ b/pkg/sentry/socket/control/control.go
@@ -17,6 +17,8 @@
package control
import (
+ "time"
+
"gvisor.dev/gvisor/pkg/abi/linux"
"gvisor.dev/gvisor/pkg/bits"
"gvisor.dev/gvisor/pkg/context"
@@ -29,7 +31,6 @@ import (
"gvisor.dev/gvisor/pkg/sentry/kernel/auth"
"gvisor.dev/gvisor/pkg/sentry/socket"
"gvisor.dev/gvisor/pkg/sentry/socket/unix/transport"
- "time"
)
// SCMCredentials represents a SCM_CREDENTIALS socket control message.
@@ -63,10 +64,10 @@ type RightsFiles []*fs.File
// NewSCMRights creates a new SCM_RIGHTS socket control message representation
// using local sentry FDs.
-func NewSCMRights(t *kernel.Task, fds []int32) (SCMRights, error) {
+func NewSCMRights(t *kernel.Task, fds []primitive.Int32) (SCMRights, error) {
files := make(RightsFiles, 0, len(fds))
for _, fd := range fds {
- file := t.GetFile(fd)
+ file := t.GetFile(int32(fd))
if file == nil {
files.Release(t)
return nil, linuxerr.EBADF
@@ -486,26 +487,25 @@ func CmsgsSpace(t *kernel.Task, cmsgs socket.ControlMessages) int {
func Parse(t *kernel.Task, socketOrEndpoint interface{}, buf []byte, width uint) (socket.ControlMessages, error) {
var (
cmsgs socket.ControlMessages
- fds linux.ControlMessageRights
+ fds []primitive.Int32
)
- for i := 0; i < len(buf); {
- if i+linux.SizeOfControlMessageHeader > len(buf) {
+ for len(buf) > 0 {
+ if linux.SizeOfControlMessageHeader > len(buf) {
return cmsgs, linuxerr.EINVAL
}
var h linux.ControlMessageHeader
- h.UnmarshalUnsafe(buf[i : i+linux.SizeOfControlMessageHeader])
+ buf = h.UnmarshalUnsafe(buf)
if h.Length < uint64(linux.SizeOfControlMessageHeader) {
return socket.ControlMessages{}, linuxerr.EINVAL
}
- if h.Length > uint64(len(buf)-i) {
- return socket.ControlMessages{}, linuxerr.EINVAL
- }
- i += linux.SizeOfControlMessageHeader
length := int(h.Length) - linux.SizeOfControlMessageHeader
+ if length > len(buf) {
+ return socket.ControlMessages{}, linuxerr.EINVAL
+ }
switch h.Level {
case linux.SOL_SOCKET:
@@ -518,11 +518,9 @@ func Parse(t *kernel.Task, socketOrEndpoint interface{}, buf []byte, width uint)
return socket.ControlMessages{}, linuxerr.EINVAL
}
- for j := i; j < i+rightsSize; j += linux.SizeOfControlMessageRight {
- fds = append(fds, int32(hostarch.ByteOrder.Uint32(buf[j:j+linux.SizeOfControlMessageRight])))
- }
-
- i += bits.AlignUp(length, width)
+ curFDs := make([]primitive.Int32, numRights)
+ primitive.UnmarshalUnsafeInt32Slice(curFDs, buf[:rightsSize])
+ fds = append(fds, curFDs...)
case linux.SCM_CREDENTIALS:
if length < linux.SizeOfControlMessageCredentials {
@@ -530,23 +528,21 @@ func Parse(t *kernel.Task, socketOrEndpoint interface{}, buf []byte, width uint)
}
var creds linux.ControlMessageCredentials
- creds.UnmarshalUnsafe(buf[i : i+linux.SizeOfControlMessageCredentials])
+ creds.UnmarshalUnsafe(buf)
scmCreds, err := NewSCMCredentials(t, creds)
if err != nil {
return socket.ControlMessages{}, err
}
cmsgs.Unix.Credentials = scmCreds
- i += bits.AlignUp(length, width)
case linux.SO_TIMESTAMP:
if length < linux.SizeOfTimeval {
return socket.ControlMessages{}, linuxerr.EINVAL
}
var ts linux.Timeval
- ts.UnmarshalUnsafe(buf[i : i+linux.SizeOfTimeval])
+ ts.UnmarshalUnsafe(buf)
cmsgs.IP.Timestamp = ts.ToTime()
cmsgs.IP.HasTimestamp = true
- i += bits.AlignUp(length, width)
default:
// Unknown message type.
@@ -560,9 +556,8 @@ func Parse(t *kernel.Task, socketOrEndpoint interface{}, buf []byte, width uint)
}
cmsgs.IP.HasTOS = true
var tos primitive.Uint8
- tos.UnmarshalUnsafe(buf[i : i+linux.SizeOfControlMessageTOS])
+ tos.UnmarshalUnsafe(buf)
cmsgs.IP.TOS = uint8(tos)
- i += bits.AlignUp(length, width)
case linux.IP_PKTINFO:
if length < linux.SizeOfControlMessageIPPacketInfo {
@@ -571,19 +566,16 @@ func Parse(t *kernel.Task, socketOrEndpoint interface{}, buf []byte, width uint)
cmsgs.IP.HasIPPacketInfo = true
var packetInfo linux.ControlMessageIPPacketInfo
- packetInfo.UnmarshalUnsafe(buf[i : i+linux.SizeOfControlMessageIPPacketInfo])
-
+ packetInfo.UnmarshalUnsafe(buf)
cmsgs.IP.PacketInfo = packetInfo
- i += bits.AlignUp(length, width)
case linux.IP_RECVORIGDSTADDR:
var addr linux.SockAddrInet
if length < addr.SizeBytes() {
return socket.ControlMessages{}, linuxerr.EINVAL
}
- addr.UnmarshalUnsafe(buf[i : i+addr.SizeBytes()])
+ addr.UnmarshalUnsafe(buf)
cmsgs.IP.OriginalDstAddress = &addr
- i += bits.AlignUp(length, width)
case linux.IP_RECVERR:
var errCmsg linux.SockErrCMsgIPv4
@@ -591,9 +583,8 @@ func Parse(t *kernel.Task, socketOrEndpoint interface{}, buf []byte, width uint)
return socket.ControlMessages{}, linuxerr.EINVAL
}
- errCmsg.UnmarshalBytes(buf[i : i+errCmsg.SizeBytes()])
+ errCmsg.UnmarshalBytes(buf)
cmsgs.IP.SockErr = &errCmsg
- i += bits.AlignUp(length, width)
default:
return socket.ControlMessages{}, linuxerr.EINVAL
@@ -606,18 +597,16 @@ func Parse(t *kernel.Task, socketOrEndpoint interface{}, buf []byte, width uint)
}
cmsgs.IP.HasTClass = true
var tclass primitive.Uint32
- tclass.UnmarshalUnsafe(buf[i : i+linux.SizeOfControlMessageTClass])
+ tclass.UnmarshalUnsafe(buf)
cmsgs.IP.TClass = uint32(tclass)
- i += bits.AlignUp(length, width)
case linux.IPV6_RECVORIGDSTADDR:
var addr linux.SockAddrInet6
if length < addr.SizeBytes() {
return socket.ControlMessages{}, linuxerr.EINVAL
}
- addr.UnmarshalUnsafe(buf[i : i+addr.SizeBytes()])
+ addr.UnmarshalUnsafe(buf)
cmsgs.IP.OriginalDstAddress = &addr
- i += bits.AlignUp(length, width)
case linux.IPV6_RECVERR:
var errCmsg linux.SockErrCMsgIPv6
@@ -625,9 +614,8 @@ func Parse(t *kernel.Task, socketOrEndpoint interface{}, buf []byte, width uint)
return socket.ControlMessages{}, linuxerr.EINVAL
}
- errCmsg.UnmarshalBytes(buf[i : i+errCmsg.SizeBytes()])
+ errCmsg.UnmarshalBytes(buf)
cmsgs.IP.SockErr = &errCmsg
- i += bits.AlignUp(length, width)
default:
return socket.ControlMessages{}, linuxerr.EINVAL
@@ -635,6 +623,11 @@ func Parse(t *kernel.Task, socketOrEndpoint interface{}, buf []byte, width uint)
default:
return socket.ControlMessages{}, linuxerr.EINVAL
}
+ if shift := bits.AlignUp(length, width); shift > len(buf) {
+ buf = buf[:0]
+ } else {
+ buf = buf[shift:]
+ }
}
if cmsgs.Unix.Credentials == nil {
diff --git a/pkg/sentry/socket/control/control_vfs2.go b/pkg/sentry/socket/control/control_vfs2.go
index 0a989cbeb..a638cb955 100644
--- a/pkg/sentry/socket/control/control_vfs2.go
+++ b/pkg/sentry/socket/control/control_vfs2.go
@@ -18,6 +18,7 @@ import (
"gvisor.dev/gvisor/pkg/abi/linux"
"gvisor.dev/gvisor/pkg/context"
"gvisor.dev/gvisor/pkg/errors/linuxerr"
+ "gvisor.dev/gvisor/pkg/marshal/primitive"
"gvisor.dev/gvisor/pkg/sentry/kernel"
"gvisor.dev/gvisor/pkg/sentry/socket/unix/transport"
"gvisor.dev/gvisor/pkg/sentry/vfs"
@@ -45,10 +46,10 @@ type RightsFilesVFS2 []*vfs.FileDescription
// NewSCMRightsVFS2 creates a new SCM_RIGHTS socket control message
// representation using local sentry FDs.
-func NewSCMRightsVFS2(t *kernel.Task, fds []int32) (SCMRightsVFS2, error) {
+func NewSCMRightsVFS2(t *kernel.Task, fds []primitive.Int32) (SCMRightsVFS2, error) {
files := make(RightsFilesVFS2, 0, len(fds))
for _, fd := range fds {
- file := t.GetFileVFS2(fd)
+ file := t.GetFileVFS2(int32(fd))
if file == nil {
files.Release(t)
return nil, linuxerr.EBADF
diff --git a/pkg/sentry/socket/hostinet/socket.go b/pkg/sentry/socket/hostinet/socket.go
index 6e2318f75..a31f3ebec 100644
--- a/pkg/sentry/socket/hostinet/socket.go
+++ b/pkg/sentry/socket/hostinet/socket.go
@@ -578,7 +578,7 @@ func parseUnixControlMessages(unixControlMessages []unix.SocketControlMessage) s
case linux.SO_TIMESTAMP:
controlMessages.IP.HasTimestamp = true
ts := linux.Timeval{}
- ts.UnmarshalUnsafe(unixCmsg.Data[:linux.SizeOfTimeval])
+ ts.UnmarshalUnsafe(unixCmsg.Data)
controlMessages.IP.Timestamp = ts.ToTime()
}
@@ -587,18 +587,18 @@ func parseUnixControlMessages(unixControlMessages []unix.SocketControlMessage) s
case linux.IP_TOS:
controlMessages.IP.HasTOS = true
var tos primitive.Uint8
- tos.UnmarshalUnsafe(unixCmsg.Data[:tos.SizeBytes()])
+ tos.UnmarshalUnsafe(unixCmsg.Data)
controlMessages.IP.TOS = uint8(tos)
case linux.IP_PKTINFO:
controlMessages.IP.HasIPPacketInfo = true
var packetInfo linux.ControlMessageIPPacketInfo
- packetInfo.UnmarshalUnsafe(unixCmsg.Data[:packetInfo.SizeBytes()])
+ packetInfo.UnmarshalUnsafe(unixCmsg.Data)
controlMessages.IP.PacketInfo = packetInfo
case linux.IP_RECVORIGDSTADDR:
var addr linux.SockAddrInet
- addr.UnmarshalUnsafe(unixCmsg.Data[:addr.SizeBytes()])
+ addr.UnmarshalUnsafe(unixCmsg.Data)
controlMessages.IP.OriginalDstAddress = &addr
case unix.IP_RECVERR:
@@ -612,12 +612,12 @@ func parseUnixControlMessages(unixControlMessages []unix.SocketControlMessage) s
case linux.IPV6_TCLASS:
controlMessages.IP.HasTClass = true
var tclass primitive.Uint32
- tclass.UnmarshalUnsafe(unixCmsg.Data[:tclass.SizeBytes()])
+ tclass.UnmarshalUnsafe(unixCmsg.Data)
controlMessages.IP.TClass = uint32(tclass)
case linux.IPV6_RECVORIGDSTADDR:
var addr linux.SockAddrInet6
- addr.UnmarshalUnsafe(unixCmsg.Data[:addr.SizeBytes()])
+ addr.UnmarshalUnsafe(unixCmsg.Data)
controlMessages.IP.OriginalDstAddress = &addr
case unix.IPV6_RECVERR:
@@ -631,7 +631,7 @@ func parseUnixControlMessages(unixControlMessages []unix.SocketControlMessage) s
case linux.TCP_INQ:
controlMessages.IP.HasInq = true
var inq primitive.Int32
- inq.UnmarshalUnsafe(unixCmsg.Data[:linux.SizeOfControlMessageInq])
+ inq.UnmarshalUnsafe(unixCmsg.Data)
controlMessages.IP.Inq = int32(inq)
}
}
diff --git a/pkg/sentry/socket/hostinet/stack.go b/pkg/sentry/socket/hostinet/stack.go
index 61111ac6c..c84ab3fb7 100644
--- a/pkg/sentry/socket/hostinet/stack.go
+++ b/pkg/sentry/socket/hostinet/stack.go
@@ -138,7 +138,7 @@ func ExtractHostInterfaces(links []syscall.NetlinkMessage, addrs []syscall.Netli
return fmt.Errorf("RTM_GETLINK returned RTM_NEWLINK message with invalid data length (%d bytes, expected at least %d bytes)", len(link.Data), unix.SizeofIfInfomsg)
}
var ifinfo linux.InterfaceInfoMessage
- ifinfo.UnmarshalUnsafe(link.Data[:ifinfo.SizeBytes()])
+ ifinfo.UnmarshalUnsafe(link.Data)
inetIF := inet.Interface{
DeviceType: ifinfo.Type,
Flags: ifinfo.Flags,
@@ -169,7 +169,7 @@ func ExtractHostInterfaces(links []syscall.NetlinkMessage, addrs []syscall.Netli
return fmt.Errorf("RTM_GETADDR returned RTM_NEWADDR message with invalid data length (%d bytes, expected at least %d bytes)", len(addr.Data), unix.SizeofIfAddrmsg)
}
var ifaddr linux.InterfaceAddrMessage
- ifaddr.UnmarshalUnsafe(addr.Data[:ifaddr.SizeBytes()])
+ ifaddr.UnmarshalUnsafe(addr.Data)
inetAddr := inet.InterfaceAddr{
Family: ifaddr.Family,
PrefixLen: ifaddr.PrefixLen,
@@ -201,7 +201,7 @@ func ExtractHostRoutes(routeMsgs []syscall.NetlinkMessage) ([]inet.Route, error)
}
var ifRoute linux.RouteMessage
- ifRoute.UnmarshalUnsafe(routeMsg.Data[:ifRoute.SizeBytes()])
+ ifRoute.UnmarshalUnsafe(routeMsg.Data)
inetRoute := inet.Route{
Family: ifRoute.Family,
DstLen: ifRoute.DstLen,
diff --git a/pkg/sentry/socket/netfilter/extensions.go b/pkg/sentry/socket/netfilter/extensions.go
index 3f1b4a17b..7606d2bbb 100644
--- a/pkg/sentry/socket/netfilter/extensions.go
+++ b/pkg/sentry/socket/netfilter/extensions.go
@@ -80,9 +80,8 @@ func marshalEntryMatch(name string, data []byte) []byte {
copy(matcher.Name[:], name)
buf := make([]byte, size)
- entryLen := matcher.XTEntryMatch.SizeBytes()
- matcher.XTEntryMatch.MarshalUnsafe(buf[:entryLen])
- copy(buf[entryLen:], matcher.Data)
+ bufRemain := matcher.XTEntryMatch.MarshalUnsafe(buf)
+ copy(bufRemain, matcher.Data)
return buf
}
diff --git a/pkg/sentry/socket/netfilter/ipv4.go b/pkg/sentry/socket/netfilter/ipv4.go
index af31cbc5b..6cbfee8b6 100644
--- a/pkg/sentry/socket/netfilter/ipv4.go
+++ b/pkg/sentry/socket/netfilter/ipv4.go
@@ -141,10 +141,9 @@ func modifyEntries4(task *kernel.Task, stk *stack.Stack, optVal []byte, replace
nflog("optVal has insufficient size for entry %d", len(optVal))
return nil, syserr.ErrInvalidArgument
}
- var entry linux.IPTEntry
- entry.UnmarshalUnsafe(optVal[:entry.SizeBytes()])
initialOptValLen := len(optVal)
- optVal = optVal[entry.SizeBytes():]
+ var entry linux.IPTEntry
+ optVal = entry.UnmarshalUnsafe(optVal)
if entry.TargetOffset < linux.SizeOfIPTEntry {
nflog("entry has too-small target offset %d", entry.TargetOffset)
diff --git a/pkg/sentry/socket/netfilter/ipv6.go b/pkg/sentry/socket/netfilter/ipv6.go
index 6cefe0b9c..902707abf 100644
--- a/pkg/sentry/socket/netfilter/ipv6.go
+++ b/pkg/sentry/socket/netfilter/ipv6.go
@@ -144,10 +144,9 @@ func modifyEntries6(task *kernel.Task, stk *stack.Stack, optVal []byte, replace
nflog("optVal has insufficient size for entry %d", len(optVal))
return nil, syserr.ErrInvalidArgument
}
- var entry linux.IP6TEntry
- entry.UnmarshalUnsafe(optVal[:entry.SizeBytes()])
initialOptValLen := len(optVal)
- optVal = optVal[entry.SizeBytes():]
+ var entry linux.IP6TEntry
+ optVal = entry.UnmarshalUnsafe(optVal)
if entry.TargetOffset < linux.SizeOfIP6TEntry {
nflog("entry has too-small target offset %d", entry.TargetOffset)
diff --git a/pkg/sentry/socket/netfilter/netfilter.go b/pkg/sentry/socket/netfilter/netfilter.go
index 01f2f8c77..f2cdf091d 100644
--- a/pkg/sentry/socket/netfilter/netfilter.go
+++ b/pkg/sentry/socket/netfilter/netfilter.go
@@ -176,9 +176,7 @@ func setHooksAndUnderflow(info *linux.IPTGetinfo, table stack.Table, offset uint
// net/ipv4/netfilter/ip_tables.c:translate_table for reference.
func SetEntries(task *kernel.Task, stk *stack.Stack, optVal []byte, ipv6 bool) *syserr.Error {
var replace linux.IPTReplace
- replaceBuf := optVal[:linux.SizeOfIPTReplace]
- optVal = optVal[linux.SizeOfIPTReplace:]
- replace.UnmarshalBytes(replaceBuf)
+ optVal = replace.UnmarshalBytes(optVal)
var table stack.Table
switch replace.Name.String() {
@@ -306,8 +304,7 @@ func parseMatchers(task *kernel.Task, filter stack.IPHeaderFilter, optVal []byte
return nil, fmt.Errorf("optVal has insufficient size for entry match: %d", len(optVal))
}
var match linux.XTEntryMatch
- buf := optVal[:match.SizeBytes()]
- match.UnmarshalUnsafe(buf)
+ match.UnmarshalUnsafe(optVal)
nflog("set entries: parsed entry match %q: %+v", match.Name.String(), match)
// Check some invariants.
diff --git a/pkg/sentry/socket/netfilter/netfilter_abi_autogen_unsafe.go b/pkg/sentry/socket/netfilter/netfilter_abi_autogen_unsafe.go
index 786b62935..65e39de64 100644
--- a/pkg/sentry/socket/netfilter/netfilter_abi_autogen_unsafe.go
+++ b/pkg/sentry/socket/netfilter/netfilter_abi_autogen_unsafe.go
@@ -26,19 +26,17 @@ func (n *nfNATTarget) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (n *nfNATTarget) MarshalBytes(dst []byte) {
- n.Target.MarshalBytes(dst[:n.Target.SizeBytes()])
- dst = dst[n.Target.SizeBytes():]
- n.Range.MarshalBytes(dst[:n.Range.SizeBytes()])
- dst = dst[n.Range.SizeBytes():]
+func (n *nfNATTarget) MarshalBytes(dst []byte) []byte {
+ dst = n.Target.MarshalBytes(dst)
+ dst = n.Range.MarshalBytes(dst)
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (n *nfNATTarget) UnmarshalBytes(src []byte) {
- n.Target.UnmarshalBytes(src[:n.Target.SizeBytes()])
- src = src[n.Target.SizeBytes():]
- n.Range.UnmarshalBytes(src[:n.Range.SizeBytes()])
- src = src[n.Range.SizeBytes():]
+func (n *nfNATTarget) UnmarshalBytes(src []byte) []byte {
+ src = n.Target.UnmarshalBytes(src)
+ src = n.Range.UnmarshalBytes(src)
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -48,23 +46,25 @@ func (n *nfNATTarget) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (n *nfNATTarget) MarshalUnsafe(dst []byte) {
+func (n *nfNATTarget) MarshalUnsafe(dst []byte) []byte {
if n.Range.Packed() && n.Target.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(n.SizeBytes()))
- } else {
- // Type nfNATTarget doesn't have a packed layout in memory, fallback to MarshalBytes.
- n.MarshalBytes(dst)
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size))
+ return dst[size:]
}
+ // Type nfNATTarget doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return n.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (n *nfNATTarget) UnmarshalUnsafe(src []byte) {
+func (n *nfNATTarget) UnmarshalUnsafe(src []byte) []byte {
if n.Range.Packed() && n.Target.Packed() {
- gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(n.SizeBytes()))
- } else {
- // Type nfNATTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- n.UnmarshalBytes(src)
+ size := n.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type nfNATTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return n.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
diff --git a/pkg/sentry/socket/netfilter/owner_matcher.go b/pkg/sentry/socket/netfilter/owner_matcher.go
index 6eff2ae65..d83d7e535 100644
--- a/pkg/sentry/socket/netfilter/owner_matcher.go
+++ b/pkg/sentry/socket/netfilter/owner_matcher.go
@@ -73,7 +73,7 @@ func (ownerMarshaler) unmarshal(task *kernel.Task, buf []byte, filter stack.IPHe
// For alignment reasons, the match's total size may
// exceed what's strictly necessary to hold matchData.
var matchData linux.IPTOwnerInfo
- matchData.UnmarshalUnsafe(buf[:linux.SizeOfIPTOwnerInfo])
+ matchData.UnmarshalUnsafe(buf)
nflog("parsed IPTOwnerInfo: %+v", matchData)
var owner OwnerMatcher
diff --git a/pkg/sentry/socket/netfilter/targets.go b/pkg/sentry/socket/netfilter/targets.go
index b9c15daab..eaf601543 100644
--- a/pkg/sentry/socket/netfilter/targets.go
+++ b/pkg/sentry/socket/netfilter/targets.go
@@ -199,7 +199,7 @@ func (*standardTargetMaker) unmarshal(buf []byte, filter stack.IPHeaderFilter) (
return nil, syserr.ErrInvalidArgument
}
var standardTarget linux.XTStandardTarget
- standardTarget.UnmarshalUnsafe(buf[:standardTarget.SizeBytes()])
+ standardTarget.UnmarshalUnsafe(buf)
if standardTarget.Verdict < 0 {
// A Verdict < 0 indicates a non-jump verdict.
@@ -253,7 +253,6 @@ func (*errorTargetMaker) unmarshal(buf []byte, filter stack.IPHeaderFilter) (tar
return nil, syserr.ErrInvalidArgument
}
var errTgt linux.XTErrorTarget
- buf = buf[:linux.SizeOfXTErrorTarget]
errTgt.UnmarshalUnsafe(buf)
// Error targets are used in 2 cases:
@@ -316,7 +315,6 @@ func (*redirectTargetMaker) unmarshal(buf []byte, filter stack.IPHeaderFilter) (
}
var rt linux.XTRedirectTarget
- buf = buf[:linux.SizeOfXTRedirectTarget]
rt.UnmarshalUnsafe(buf)
// Copy linux.XTRedirectTarget to stack.RedirectTarget.
@@ -405,8 +403,7 @@ func (*nfNATTargetMaker) unmarshal(buf []byte, filter stack.IPHeaderFilter) (tar
}
var natRange linux.NFNATRange
- buf = buf[linux.SizeOfXTEntryTarget:nfNATMarshalledSize]
- natRange.UnmarshalUnsafe(buf)
+ natRange.UnmarshalUnsafe(buf[linux.SizeOfXTEntryTarget:])
// We don't support port or address ranges.
if natRange.MinAddr != natRange.MaxAddr {
@@ -477,7 +474,6 @@ func (*snatTargetMakerV4) unmarshal(buf []byte, filter stack.IPHeaderFilter) (ta
}
var st linux.XTSNATTarget
- buf = buf[:linux.SizeOfXTSNATTarget]
st.UnmarshalUnsafe(buf)
// Copy linux.XTSNATTarget to stack.SNATTarget.
@@ -557,8 +553,7 @@ func (*snatTargetMakerV6) unmarshal(buf []byte, filter stack.IPHeaderFilter) (ta
}
var natRange linux.NFNATRange
- buf = buf[linux.SizeOfXTEntryTarget:nfNATMarshalledSize]
- natRange.UnmarshalUnsafe(buf)
+ natRange.UnmarshalUnsafe(buf[linux.SizeOfXTEntryTarget:])
// TODO(gvisor.dev/issue/5697): Support port or address ranges.
if natRange.MinAddr != natRange.MaxAddr {
@@ -621,7 +616,9 @@ func parseTarget(filter stack.IPHeaderFilter, optVal []byte, ipv6 bool) (stack.T
return nil, syserr.ErrInvalidArgument
}
var target linux.XTEntryTarget
- target.UnmarshalUnsafe(optVal[:target.SizeBytes()])
+ // Do not advance optVal as targetMake.unmarshal() may unmarshal
+ // XTEntryTarget again but with some added fields.
+ target.UnmarshalUnsafe(optVal)
return unmarshalTarget(target, filter, optVal)
}
diff --git a/pkg/sentry/socket/netfilter/tcp_matcher.go b/pkg/sentry/socket/netfilter/tcp_matcher.go
index e5b73a976..a621a6a16 100644
--- a/pkg/sentry/socket/netfilter/tcp_matcher.go
+++ b/pkg/sentry/socket/netfilter/tcp_matcher.go
@@ -59,7 +59,7 @@ func (tcpMarshaler) unmarshal(_ *kernel.Task, buf []byte, filter stack.IPHeaderF
// For alignment reasons, the match's total size may
// exceed what's strictly necessary to hold matchData.
var matchData linux.XTTCP
- matchData.UnmarshalUnsafe(buf[:matchData.SizeBytes()])
+ matchData.UnmarshalUnsafe(buf)
nflog("parseMatchers: parsed XTTCP: %+v", matchData)
if matchData.Option != 0 ||
diff --git a/pkg/sentry/socket/netfilter/udp_matcher.go b/pkg/sentry/socket/netfilter/udp_matcher.go
index aa72ee70c..2ca854764 100644
--- a/pkg/sentry/socket/netfilter/udp_matcher.go
+++ b/pkg/sentry/socket/netfilter/udp_matcher.go
@@ -59,7 +59,7 @@ func (udpMarshaler) unmarshal(_ *kernel.Task, buf []byte, filter stack.IPHeaderF
// For alignment reasons, the match's total size may exceed what's
// strictly necessary to hold matchData.
var matchData linux.XTUDP
- matchData.UnmarshalUnsafe(buf[:matchData.SizeBytes()])
+ matchData.UnmarshalUnsafe(buf)
nflog("parseMatchers: parsed XTUDP: %+v", matchData)
if matchData.InverseFlags != 0 {
diff --git a/pkg/sentry/socket/netlink/socket.go b/pkg/sentry/socket/netlink/socket.go
index 267155807..19c8f340d 100644
--- a/pkg/sentry/socket/netlink/socket.go
+++ b/pkg/sentry/socket/netlink/socket.go
@@ -223,7 +223,7 @@ func ExtractSockAddr(b []byte) (*linux.SockAddrNetlink, *syserr.Error) {
}
var sa linux.SockAddrNetlink
- sa.UnmarshalUnsafe(b[:sa.SizeBytes()])
+ sa.UnmarshalUnsafe(b)
if sa.Family != linux.AF_NETLINK {
return nil, syserr.ErrInvalidArgument
diff --git a/pkg/sentry/socket/netstack/netstack.go b/pkg/sentry/socket/netstack/netstack.go
index c35cf06f6..e38c4e5da 100644
--- a/pkg/sentry/socket/netstack/netstack.go
+++ b/pkg/sentry/socket/netstack/netstack.go
@@ -660,7 +660,7 @@ func (s *socketOpsCommon) Bind(_ *kernel.Task, sockaddr []byte) *syserr.Error {
if len(sockaddr) < sockAddrLinkSize {
return syserr.ErrInvalidArgument
}
- a.UnmarshalBytes(sockaddr[:sockAddrLinkSize])
+ a.UnmarshalBytes(sockaddr)
addr = tcpip.FullAddress{
NIC: tcpip.NICID(a.InterfaceIndex),
@@ -1839,7 +1839,7 @@ func setSockOptSocket(t *kernel.Task, s socket.SocketOps, ep commonEndpoint, nam
}
var v linux.Timeval
- v.UnmarshalBytes(optVal[:linux.SizeOfTimeval])
+ v.UnmarshalBytes(optVal)
if v.Usec < 0 || v.Usec >= int64(time.Second/time.Microsecond) {
return syserr.ErrDomain
}
@@ -1852,7 +1852,7 @@ func setSockOptSocket(t *kernel.Task, s socket.SocketOps, ep commonEndpoint, nam
}
var v linux.Timeval
- v.UnmarshalBytes(optVal[:linux.SizeOfTimeval])
+ v.UnmarshalBytes(optVal)
if v.Usec < 0 || v.Usec >= int64(time.Second/time.Microsecond) {
return syserr.ErrDomain
}
@@ -1883,7 +1883,7 @@ func setSockOptSocket(t *kernel.Task, s socket.SocketOps, ep commonEndpoint, nam
}
var v linux.Linger
- v.UnmarshalBytes(optVal[:linux.SizeOfLinger])
+ v.UnmarshalBytes(optVal)
if v != (linux.Linger{}) {
socket.SetSockOptEmitUnimplementedEvent(t, name)
@@ -2222,12 +2222,12 @@ func copyInMulticastRequest(optVal []byte, allowAddr bool) (linux.InetMulticastR
if len(optVal) >= inetMulticastRequestWithNICSize {
var req linux.InetMulticastRequestWithNIC
- req.UnmarshalUnsafe(optVal[:inetMulticastRequestWithNICSize])
+ req.UnmarshalUnsafe(optVal)
return req, nil
}
var req linux.InetMulticastRequestWithNIC
- req.InetMulticastRequest.UnmarshalUnsafe(optVal[:inetMulticastRequestSize])
+ req.InetMulticastRequest.UnmarshalUnsafe(optVal)
return req, nil
}
@@ -2237,7 +2237,7 @@ func copyInMulticastV6Request(optVal []byte) (linux.Inet6MulticastRequest, *syse
}
var req linux.Inet6MulticastRequest
- req.UnmarshalUnsafe(optVal[:inet6MulticastRequestSize])
+ req.UnmarshalUnsafe(optVal)
return req, nil
}
diff --git a/pkg/sentry/socket/socket.go b/pkg/sentry/socket/socket.go
index fc5431eb1..01073df72 100644
--- a/pkg/sentry/socket/socket.go
+++ b/pkg/sentry/socket/socket.go
@@ -595,19 +595,19 @@ func UnmarshalSockAddr(family int, data []byte) linux.SockAddr {
switch family {
case unix.AF_INET:
var addr linux.SockAddrInet
- addr.UnmarshalUnsafe(data[:addr.SizeBytes()])
+ addr.UnmarshalUnsafe(data)
return &addr
case unix.AF_INET6:
var addr linux.SockAddrInet6
- addr.UnmarshalUnsafe(data[:addr.SizeBytes()])
+ addr.UnmarshalUnsafe(data)
return &addr
case unix.AF_UNIX:
var addr linux.SockAddrUnix
- addr.UnmarshalUnsafe(data[:addr.SizeBytes()])
+ addr.UnmarshalUnsafe(data)
return &addr
case unix.AF_NETLINK:
var addr linux.SockAddrNetlink
- addr.UnmarshalUnsafe(data[:addr.SizeBytes()])
+ addr.UnmarshalUnsafe(data)
return &addr
default:
panic(fmt.Sprintf("Unsupported socket family %v", family))
@@ -738,7 +738,7 @@ func AddressAndFamily(addr []byte) (tcpip.FullAddress, uint16, *syserr.Error) {
if len(addr) < sockAddrInetSize {
return tcpip.FullAddress{}, family, syserr.ErrInvalidArgument
}
- a.UnmarshalUnsafe(addr[:sockAddrInetSize])
+ a.UnmarshalUnsafe(addr)
out := tcpip.FullAddress{
Addr: BytesToIPAddress(a.Addr[:]),
@@ -751,7 +751,7 @@ func AddressAndFamily(addr []byte) (tcpip.FullAddress, uint16, *syserr.Error) {
if len(addr) < sockAddrInet6Size {
return tcpip.FullAddress{}, family, syserr.ErrInvalidArgument
}
- a.UnmarshalUnsafe(addr[:sockAddrInet6Size])
+ a.UnmarshalUnsafe(addr)
out := tcpip.FullAddress{
Addr: BytesToIPAddress(a.Addr[:]),
@@ -767,7 +767,7 @@ func AddressAndFamily(addr []byte) (tcpip.FullAddress, uint16, *syserr.Error) {
if len(addr) < sockAddrLinkSize {
return tcpip.FullAddress{}, family, syserr.ErrInvalidArgument
}
- a.UnmarshalUnsafe(addr[:sockAddrLinkSize])
+ a.UnmarshalUnsafe(addr)
// TODO(https://gvisor.dev/issue/6530): Do not assume all interfaces have
// an ethernet address.
if a.Family != linux.AF_PACKET || a.HardwareAddrLen != header.EthernetAddressSize {
diff --git a/pkg/sentry/strace/socket.go b/pkg/sentry/strace/socket.go
index f4aab25b0..b164d9107 100644
--- a/pkg/sentry/strace/socket.go
+++ b/pkg/sentry/strace/socket.go
@@ -161,12 +161,10 @@ var controlMessageType = map[int32]string{
linux.SO_TIMESTAMP: "SO_TIMESTAMP",
}
-func unmarshalControlMessageRights(src []byte) linux.ControlMessageRights {
+func unmarshalControlMessageRights(src []byte) []primitive.Int32 {
count := len(src) / linux.SizeOfControlMessageRight
- cmr := make(linux.ControlMessageRights, count)
- for i, _ := range cmr {
- cmr[i] = int32(hostarch.ByteOrder.Uint32(src[i*linux.SizeOfControlMessageRight:]))
- }
+ cmr := make([]primitive.Int32, count)
+ primitive.UnmarshalUnsafeInt32Slice(cmr, src)
return cmr
}
@@ -182,14 +180,14 @@ func cmsghdr(t *kernel.Task, addr hostarch.Addr, length uint64, maxBytes uint64)
var strs []string
- for i := 0; i < len(buf); {
- if i+linux.SizeOfControlMessageHeader > len(buf) {
+ for len(buf) > 0 {
+ if linux.SizeOfControlMessageHeader > len(buf) {
strs = append(strs, "{invalid control message (too short)}")
break
}
var h linux.ControlMessageHeader
- h.UnmarshalUnsafe(buf[i : i+linux.SizeOfControlMessageHeader])
+ buf = h.UnmarshalUnsafe(buf)
var skipData bool
level := "SOL_SOCKET"
@@ -204,7 +202,9 @@ func cmsghdr(t *kernel.Task, addr hostarch.Addr, length uint64, maxBytes uint64)
typ = fmt.Sprint(h.Type)
}
- if h.Length > uint64(len(buf)-i) {
+ width := t.Arch().Width()
+ length := int(h.Length) - linux.SizeOfControlMessageHeader
+ if length > len(buf) {
strs = append(strs, fmt.Sprintf(
"{level=%s, type=%s, length=%d, content extends beyond buffer}",
level,
@@ -214,9 +214,6 @@ func cmsghdr(t *kernel.Task, addr hostarch.Addr, length uint64, maxBytes uint64)
break
}
- i += linux.SizeOfControlMessageHeader
- width := t.Arch().Width()
- length := int(h.Length) - linux.SizeOfControlMessageHeader
if length < 0 {
strs = append(strs, fmt.Sprintf(
"{level=%s, type=%s, length=%d, content too short}",
@@ -229,78 +226,80 @@ func cmsghdr(t *kernel.Task, addr hostarch.Addr, length uint64, maxBytes uint64)
if skipData {
strs = append(strs, fmt.Sprintf("{level=%s, type=%s, length=%d}", level, typ, h.Length))
- i += bits.AlignUp(length, width)
- continue
- }
-
- switch h.Type {
- case linux.SCM_RIGHTS:
- rightsSize := bits.AlignDown(length, linux.SizeOfControlMessageRight)
- fds := unmarshalControlMessageRights(buf[i : i+rightsSize])
- rights := make([]string, 0, len(fds))
- for _, fd := range fds {
- rights = append(rights, fmt.Sprint(fd))
- }
+ } else {
+ switch h.Type {
+ case linux.SCM_RIGHTS:
+ rightsSize := bits.AlignDown(length, linux.SizeOfControlMessageRight)
+ fds := unmarshalControlMessageRights(buf[:rightsSize])
+ rights := make([]string, 0, len(fds))
+ for _, fd := range fds {
+ rights = append(rights, fmt.Sprint(fd))
+ }
- strs = append(strs, fmt.Sprintf(
- "{level=%s, type=%s, length=%d, content: %s}",
- level,
- typ,
- h.Length,
- strings.Join(rights, ","),
- ))
-
- case linux.SCM_CREDENTIALS:
- if length < linux.SizeOfControlMessageCredentials {
strs = append(strs, fmt.Sprintf(
- "{level=%s, type=%s, length=%d, content too short}",
+ "{level=%s, type=%s, length=%d, content: %s}",
level,
typ,
h.Length,
+ strings.Join(rights, ","),
))
- break
- }
- var creds linux.ControlMessageCredentials
- creds.UnmarshalUnsafe(buf[i : i+linux.SizeOfControlMessageCredentials])
+ case linux.SCM_CREDENTIALS:
+ if length < linux.SizeOfControlMessageCredentials {
+ strs = append(strs, fmt.Sprintf(
+ "{level=%s, type=%s, length=%d, content too short}",
+ level,
+ typ,
+ h.Length,
+ ))
+ break
+ }
- strs = append(strs, fmt.Sprintf(
- "{level=%s, type=%s, length=%d, pid: %d, uid: %d, gid: %d}",
- level,
- typ,
- h.Length,
- creds.PID,
- creds.UID,
- creds.GID,
- ))
+ var creds linux.ControlMessageCredentials
+ creds.UnmarshalUnsafe(buf)
- case linux.SO_TIMESTAMP:
- if length < linux.SizeOfTimeval {
strs = append(strs, fmt.Sprintf(
- "{level=%s, type=%s, length=%d, content too short}",
+ "{level=%s, type=%s, length=%d, pid: %d, uid: %d, gid: %d}",
level,
typ,
h.Length,
+ creds.PID,
+ creds.UID,
+ creds.GID,
))
- break
- }
- var tv linux.Timeval
- tv.UnmarshalUnsafe(buf[i : i+linux.SizeOfTimeval])
+ case linux.SO_TIMESTAMP:
+ if length < linux.SizeOfTimeval {
+ strs = append(strs, fmt.Sprintf(
+ "{level=%s, type=%s, length=%d, content too short}",
+ level,
+ typ,
+ h.Length,
+ ))
+ break
+ }
- strs = append(strs, fmt.Sprintf(
- "{level=%s, type=%s, length=%d, Sec: %d, Usec: %d}",
- level,
- typ,
- h.Length,
- tv.Sec,
- tv.Usec,
- ))
+ var tv linux.Timeval
+ tv.UnmarshalUnsafe(buf)
- default:
- panic("unreachable")
+ strs = append(strs, fmt.Sprintf(
+ "{level=%s, type=%s, length=%d, Sec: %d, Usec: %d}",
+ level,
+ typ,
+ h.Length,
+ tv.Sec,
+ tv.Usec,
+ ))
+
+ default:
+ panic("unreachable")
+ }
+ }
+ if shift := bits.AlignUp(length, width); shift > len(buf) {
+ buf = buf[:0]
+ } else {
+ buf = buf[shift:]
}
- i += bits.AlignUp(length, width)
}
return fmt.Sprintf("%#x %s", addr, strings.Join(strs, ", "))
diff --git a/pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go b/pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go
index 409927919..2ebafff21 100644
--- a/pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go
+++ b/pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go
@@ -28,19 +28,19 @@ func (d *direntHdr) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (d *direntHdr) MarshalBytes(dst []byte) {
- d.OldHdr.MarshalBytes(dst[:d.OldHdr.SizeBytes()])
- dst = dst[d.OldHdr.SizeBytes():]
+func (d *direntHdr) MarshalBytes(dst []byte) []byte {
+ dst = d.OldHdr.MarshalBytes(dst)
dst[0] = byte(d.Typ)
dst = dst[1:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (d *direntHdr) UnmarshalBytes(src []byte) {
- d.OldHdr.UnmarshalBytes(src[:d.OldHdr.SizeBytes()])
- src = src[d.OldHdr.SizeBytes():]
+func (d *direntHdr) UnmarshalBytes(src []byte) []byte {
+ src = d.OldHdr.UnmarshalBytes(src)
d.Typ = uint8(src[0])
src = src[1:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -50,15 +50,15 @@ func (d *direntHdr) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (d *direntHdr) MarshalUnsafe(dst []byte) {
+func (d *direntHdr) MarshalUnsafe(dst []byte) []byte {
// Type direntHdr doesn't have a packed layout in memory, fallback to MarshalBytes.
- d.MarshalBytes(dst)
+ return d.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (d *direntHdr) UnmarshalUnsafe(src []byte) {
+func (d *direntHdr) UnmarshalUnsafe(src []byte) []byte {
// Type direntHdr doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- d.UnmarshalBytes(src)
+ return d.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -103,23 +103,25 @@ func (o *oldDirentHdr) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (o *oldDirentHdr) MarshalBytes(dst []byte) {
+func (o *oldDirentHdr) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(o.Ino))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(o.Off))
dst = dst[8:]
hostarch.ByteOrder.PutUint16(dst[:2], uint16(o.Reclen))
dst = dst[2:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (o *oldDirentHdr) UnmarshalBytes(src []byte) {
+func (o *oldDirentHdr) UnmarshalBytes(src []byte) []byte {
o.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
o.Off = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
o.Reclen = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -129,15 +131,15 @@ func (o *oldDirentHdr) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (o *oldDirentHdr) MarshalUnsafe(dst []byte) {
+func (o *oldDirentHdr) MarshalUnsafe(dst []byte) []byte {
// Type oldDirentHdr doesn't have a packed layout in memory, fallback to MarshalBytes.
- o.MarshalBytes(dst)
+ return o.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (o *oldDirentHdr) UnmarshalUnsafe(src []byte) {
+func (o *oldDirentHdr) UnmarshalUnsafe(src []byte) []byte {
// Type oldDirentHdr doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- o.UnmarshalBytes(src)
+ return o.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -182,19 +184,21 @@ func (r *rlimit64) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (r *rlimit64) MarshalBytes(dst []byte) {
+func (r *rlimit64) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Cur))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Max))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (r *rlimit64) UnmarshalBytes(src []byte) {
+func (r *rlimit64) UnmarshalBytes(src []byte) []byte {
r.Cur = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
r.Max = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -204,13 +208,17 @@ func (r *rlimit64) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (r *rlimit64) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(r.SizeBytes()))
+func (r *rlimit64) MarshalUnsafe(dst []byte) []byte {
+ size := r.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (r *rlimit64) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(r.SizeBytes()))
+func (r *rlimit64) UnmarshalUnsafe(src []byte) []byte {
+ size := r.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -275,15 +283,17 @@ func (s *SchedParam) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *SchedParam) MarshalBytes(dst []byte) {
+func (s *SchedParam) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.schedPriority))
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *SchedParam) UnmarshalBytes(src []byte) {
+func (s *SchedParam) UnmarshalBytes(src []byte) []byte {
s.schedPriority = int32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -293,13 +303,17 @@ func (s *SchedParam) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *SchedParam) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *SchedParam) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *SchedParam) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *SchedParam) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -365,23 +379,25 @@ func (u *userSockFprog) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (u *userSockFprog) MarshalBytes(dst []byte) {
+func (u *userSockFprog) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint16(dst[:2], uint16(u.Len))
dst = dst[2:]
// Padding: dst[:sizeof(byte)*6] ~= [6]byte{0}
dst = dst[1*(6):]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Filter))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (u *userSockFprog) UnmarshalBytes(src []byte) {
+func (u *userSockFprog) UnmarshalBytes(src []byte) []byte {
u.Len = uint16(hostarch.ByteOrder.Uint16(src[:2]))
src = src[2:]
// Padding: ~ copy([6]byte(u._), src[:sizeof(byte)*6])
src = src[1*(6):]
u.Filter = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -391,13 +407,17 @@ func (u *userSockFprog) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (u *userSockFprog) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(u.SizeBytes()))
+func (u *userSockFprog) MarshalUnsafe(dst []byte) []byte {
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (u *userSockFprog) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(u.SizeBytes()))
+func (u *userSockFprog) UnmarshalUnsafe(src []byte) []byte {
+ size := u.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -462,7 +482,7 @@ func (m *MessageHeader64) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *MessageHeader64) MarshalBytes(dst []byte) {
+func (m *MessageHeader64) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.Name))
dst = dst[8:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.NameLen))
@@ -481,10 +501,11 @@ func (m *MessageHeader64) MarshalBytes(dst []byte) {
dst = dst[4:]
// Padding: dst[:sizeof(int32)] ~= int32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *MessageHeader64) UnmarshalBytes(src []byte) {
+func (m *MessageHeader64) UnmarshalBytes(src []byte) []byte {
m.Name = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
m.NameLen = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -503,6 +524,7 @@ func (m *MessageHeader64) UnmarshalBytes(src []byte) {
src = src[4:]
// Padding: var _ int32 ~= src[:sizeof(int32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -512,13 +534,17 @@ func (m *MessageHeader64) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (m *MessageHeader64) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(m.SizeBytes()))
+func (m *MessageHeader64) MarshalUnsafe(dst []byte) []byte {
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (m *MessageHeader64) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(m.SizeBytes()))
+func (m *MessageHeader64) UnmarshalUnsafe(src []byte) []byte {
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -584,23 +610,23 @@ func (m *multipleMessageHeader64) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *multipleMessageHeader64) MarshalBytes(dst []byte) {
- m.msgHdr.MarshalBytes(dst[:m.msgHdr.SizeBytes()])
- dst = dst[m.msgHdr.SizeBytes():]
+func (m *multipleMessageHeader64) MarshalBytes(dst []byte) []byte {
+ dst = m.msgHdr.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.msgLen))
dst = dst[4:]
// Padding: dst[:sizeof(int32)] ~= int32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *multipleMessageHeader64) UnmarshalBytes(src []byte) {
- m.msgHdr.UnmarshalBytes(src[:m.msgHdr.SizeBytes()])
- src = src[m.msgHdr.SizeBytes():]
+func (m *multipleMessageHeader64) UnmarshalBytes(src []byte) []byte {
+ src = m.msgHdr.UnmarshalBytes(src)
m.msgLen = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
// Padding: var _ int32 ~= src[:sizeof(int32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -610,23 +636,25 @@ func (m *multipleMessageHeader64) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (m *multipleMessageHeader64) MarshalUnsafe(dst []byte) {
+func (m *multipleMessageHeader64) MarshalUnsafe(dst []byte) []byte {
if m.msgHdr.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(m.SizeBytes()))
- } else {
- // Type multipleMessageHeader64 doesn't have a packed layout in memory, fallback to MarshalBytes.
- m.MarshalBytes(dst)
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size))
+ return dst[size:]
}
+ // Type multipleMessageHeader64 doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return m.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (m *multipleMessageHeader64) UnmarshalUnsafe(src []byte) {
+func (m *multipleMessageHeader64) UnmarshalUnsafe(src []byte) []byte {
if m.msgHdr.Packed() {
- gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(m.SizeBytes()))
- } else {
- // Type multipleMessageHeader64 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- m.UnmarshalBytes(src)
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type multipleMessageHeader64 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return m.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
diff --git a/pkg/sentry/syscalls/linux/vfs2/vfs2_abi_autogen_unsafe.go b/pkg/sentry/syscalls/linux/vfs2/vfs2_abi_autogen_unsafe.go
index 01b0d465f..fbbb520b9 100644
--- a/pkg/sentry/syscalls/linux/vfs2/vfs2_abi_autogen_unsafe.go
+++ b/pkg/sentry/syscalls/linux/vfs2/vfs2_abi_autogen_unsafe.go
@@ -23,19 +23,21 @@ func (s *sigSetWithSize) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (s *sigSetWithSize) MarshalBytes(dst []byte) {
+func (s *sigSetWithSize) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.sigsetAddr))
dst = dst[8:]
hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.sizeofSigset))
dst = dst[8:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (s *sigSetWithSize) UnmarshalBytes(src []byte) {
+func (s *sigSetWithSize) UnmarshalBytes(src []byte) []byte {
s.sigsetAddr = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
s.sizeofSigset = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -45,13 +47,17 @@ func (s *sigSetWithSize) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (s *sigSetWithSize) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes()))
+func (s *sigSetWithSize) MarshalUnsafe(dst []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (s *sigSetWithSize) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes()))
+func (s *sigSetWithSize) UnmarshalUnsafe(src []byte) []byte {
+ size := s.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -116,7 +122,7 @@ func (m *MessageHeader64) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *MessageHeader64) MarshalBytes(dst []byte) {
+func (m *MessageHeader64) MarshalBytes(dst []byte) []byte {
hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.Name))
dst = dst[8:]
hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.NameLen))
@@ -135,10 +141,11 @@ func (m *MessageHeader64) MarshalBytes(dst []byte) {
dst = dst[4:]
// Padding: dst[:sizeof(int32)] ~= int32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *MessageHeader64) UnmarshalBytes(src []byte) {
+func (m *MessageHeader64) UnmarshalBytes(src []byte) []byte {
m.Name = uint64(hostarch.ByteOrder.Uint64(src[:8]))
src = src[8:]
m.NameLen = uint32(hostarch.ByteOrder.Uint32(src[:4]))
@@ -157,6 +164,7 @@ func (m *MessageHeader64) UnmarshalBytes(src []byte) {
src = src[4:]
// Padding: var _ int32 ~= src[:sizeof(int32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -166,13 +174,17 @@ func (m *MessageHeader64) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (m *MessageHeader64) MarshalUnsafe(dst []byte) {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(m.SizeBytes()))
+func (m *MessageHeader64) MarshalUnsafe(dst []byte) []byte {
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size))
+ return dst[size:]
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (m *MessageHeader64) UnmarshalUnsafe(src []byte) {
- gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(m.SizeBytes()))
+func (m *MessageHeader64) UnmarshalUnsafe(src []byte) []byte {
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
// CopyOutN implements marshal.Marshallable.CopyOutN.
@@ -238,23 +250,23 @@ func (m *multipleMessageHeader64) SizeBytes() int {
}
// MarshalBytes implements marshal.Marshallable.MarshalBytes.
-func (m *multipleMessageHeader64) MarshalBytes(dst []byte) {
- m.msgHdr.MarshalBytes(dst[:m.msgHdr.SizeBytes()])
- dst = dst[m.msgHdr.SizeBytes():]
+func (m *multipleMessageHeader64) MarshalBytes(dst []byte) []byte {
+ dst = m.msgHdr.MarshalBytes(dst)
hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.msgLen))
dst = dst[4:]
// Padding: dst[:sizeof(int32)] ~= int32(0)
dst = dst[4:]
+ return dst
}
// UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
-func (m *multipleMessageHeader64) UnmarshalBytes(src []byte) {
- m.msgHdr.UnmarshalBytes(src[:m.msgHdr.SizeBytes()])
- src = src[m.msgHdr.SizeBytes():]
+func (m *multipleMessageHeader64) UnmarshalBytes(src []byte) []byte {
+ src = m.msgHdr.UnmarshalBytes(src)
m.msgLen = uint32(hostarch.ByteOrder.Uint32(src[:4]))
src = src[4:]
// Padding: var _ int32 ~= src[:sizeof(int32)]
src = src[4:]
+ return src
}
// Packed implements marshal.Marshallable.Packed.
@@ -264,23 +276,25 @@ func (m *multipleMessageHeader64) Packed() bool {
}
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
-func (m *multipleMessageHeader64) MarshalUnsafe(dst []byte) {
+func (m *multipleMessageHeader64) MarshalUnsafe(dst []byte) []byte {
if m.msgHdr.Packed() {
- gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(m.SizeBytes()))
- } else {
- // Type multipleMessageHeader64 doesn't have a packed layout in memory, fallback to MarshalBytes.
- m.MarshalBytes(dst)
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size))
+ return dst[size:]
}
+ // Type multipleMessageHeader64 doesn't have a packed layout in memory, fallback to MarshalBytes.
+ return m.MarshalBytes(dst)
}
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
-func (m *multipleMessageHeader64) UnmarshalUnsafe(src []byte) {
+func (m *multipleMessageHeader64) UnmarshalUnsafe(src []byte) []byte {
if m.msgHdr.Packed() {
- gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(m.SizeBytes()))
- } else {
- // Type multipleMessageHeader64 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
- m.UnmarshalBytes(src)
+ size := m.SizeBytes()
+ gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size))
+ return src[size:]
}
+ // Type multipleMessageHeader64 doesn't have a packed layout in memory, fallback to UnmarshalBytes.
+ return m.UnmarshalBytes(src)
}
// CopyOutN implements marshal.Marshallable.CopyOutN.