diff options
Diffstat (limited to 'pkg/sentry/syscalls/linux')
-rw-r--r-- | pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go b/pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go index 862c286d9..956643160 100644 --- a/pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go +++ b/pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go @@ -23,156 +23,156 @@ var _ marshal.Marshallable = (*rlimit64)(nil) var _ marshal.Marshallable = (*userSockFprog)(nil) // SizeBytes implements marshal.Marshallable.SizeBytes. -func (d *direntHdr) SizeBytes() int { - return 1 + - (*oldDirentHdr)(nil).SizeBytes() +func (o *oldDirentHdr) SizeBytes() int { + return 18 } // MarshalBytes implements marshal.Marshallable.MarshalBytes. -func (d *direntHdr) MarshalBytes(dst []byte) { - d.OldHdr.MarshalBytes(dst[:d.OldHdr.SizeBytes()]) - dst = dst[d.OldHdr.SizeBytes():] - dst[0] = byte(d.Typ) - dst = dst[1:] +func (o *oldDirentHdr) MarshalBytes(dst []byte) { + usermem.ByteOrder.PutUint64(dst[:8], uint64(o.Ino)) + dst = dst[8:] + usermem.ByteOrder.PutUint64(dst[:8], uint64(o.Off)) + dst = dst[8:] + usermem.ByteOrder.PutUint16(dst[:2], uint16(o.Reclen)) + dst = dst[2:] } // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. -func (d *direntHdr) UnmarshalBytes(src []byte) { - d.OldHdr.UnmarshalBytes(src[:d.OldHdr.SizeBytes()]) - src = src[d.OldHdr.SizeBytes():] - d.Typ = uint8(src[0]) - src = src[1:] +func (o *oldDirentHdr) UnmarshalBytes(src []byte) { + o.Ino = uint64(usermem.ByteOrder.Uint64(src[:8])) + src = src[8:] + o.Off = uint64(usermem.ByteOrder.Uint64(src[:8])) + src = src[8:] + o.Reclen = uint16(usermem.ByteOrder.Uint16(src[:2])) + src = src[2:] } // Packed implements marshal.Marshallable.Packed. //go:nosplit -func (d *direntHdr) Packed() bool { +func (o *oldDirentHdr) Packed() bool { return false } // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. -func (d *direntHdr) MarshalUnsafe(dst []byte) { - // Type direntHdr doesn't have a packed layout in memory, fallback to MarshalBytes. - d.MarshalBytes(dst) +func (o *oldDirentHdr) MarshalUnsafe(dst []byte) { + // Type oldDirentHdr doesn't have a packed layout in memory, fallback to MarshalBytes. + o.MarshalBytes(dst) } // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. -func (d *direntHdr) UnmarshalUnsafe(src []byte) { - // Type direntHdr doesn't have a packed layout in memory, fallback to UnmarshalBytes. - d.UnmarshalBytes(src) +func (o *oldDirentHdr) UnmarshalUnsafe(src []byte) { + // Type oldDirentHdr doesn't have a packed layout in memory, fallback to UnmarshalBytes. + o.UnmarshalBytes(src) } // CopyOutN implements marshal.Marshallable.CopyOutN. //go:nosplit -func (d *direntHdr) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { - // Type direntHdr doesn't have a packed layout in memory, fall back to MarshalBytes. - buf := cc.CopyScratchBuffer(d.SizeBytes()) // escapes: okay. - d.MarshalBytes(buf) // escapes: fallback. +func (o *oldDirentHdr) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { + // Type oldDirentHdr doesn't have a packed layout in memory, fall back to MarshalBytes. + buf := cc.CopyScratchBuffer(o.SizeBytes()) // escapes: okay. + o.MarshalBytes(buf) // escapes: fallback. return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. } // CopyOut implements marshal.Marshallable.CopyOut. //go:nosplit -func (d *direntHdr) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { - return d.CopyOutN(cc, addr, d.SizeBytes()) +func (o *oldDirentHdr) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { + return o.CopyOutN(cc, addr, o.SizeBytes()) } // CopyIn implements marshal.Marshallable.CopyIn. //go:nosplit -func (d *direntHdr) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { - // Type direntHdr doesn't have a packed layout in memory, fall back to UnmarshalBytes. - buf := cc.CopyScratchBuffer(d.SizeBytes()) // escapes: okay. +func (o *oldDirentHdr) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { + // Type oldDirentHdr doesn't have a packed layout in memory, fall back to UnmarshalBytes. + buf := cc.CopyScratchBuffer(o.SizeBytes()) // escapes: okay. length, err := cc.CopyInBytes(addr, buf) // escapes: okay. // Unmarshal unconditionally. If we had a short copy-in, this results in a // partially unmarshalled struct. - d.UnmarshalBytes(buf) // escapes: fallback. + o.UnmarshalBytes(buf) // escapes: fallback. return length, err } // WriteTo implements io.WriterTo.WriteTo. -func (d *direntHdr) WriteTo(writer io.Writer) (int64, error) { - // Type direntHdr doesn't have a packed layout in memory, fall back to MarshalBytes. - buf := make([]byte, d.SizeBytes()) - d.MarshalBytes(buf) +func (o *oldDirentHdr) WriteTo(writer io.Writer) (int64, error) { + // Type oldDirentHdr doesn't have a packed layout in memory, fall back to MarshalBytes. + buf := make([]byte, o.SizeBytes()) + o.MarshalBytes(buf) length, err := writer.Write(buf) return int64(length), err } // SizeBytes implements marshal.Marshallable.SizeBytes. -func (o *oldDirentHdr) SizeBytes() int { - return 18 +func (d *direntHdr) SizeBytes() int { + return 1 + + (*oldDirentHdr)(nil).SizeBytes() } // MarshalBytes implements marshal.Marshallable.MarshalBytes. -func (o *oldDirentHdr) MarshalBytes(dst []byte) { - usermem.ByteOrder.PutUint64(dst[:8], uint64(o.Ino)) - dst = dst[8:] - usermem.ByteOrder.PutUint64(dst[:8], uint64(o.Off)) - dst = dst[8:] - usermem.ByteOrder.PutUint16(dst[:2], uint16(o.Reclen)) - dst = dst[2:] +func (d *direntHdr) MarshalBytes(dst []byte) { + d.OldHdr.MarshalBytes(dst[:d.OldHdr.SizeBytes()]) + dst = dst[d.OldHdr.SizeBytes():] + dst[0] = byte(d.Typ) + dst = dst[1:] } // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. -func (o *oldDirentHdr) UnmarshalBytes(src []byte) { - o.Ino = uint64(usermem.ByteOrder.Uint64(src[:8])) - src = src[8:] - o.Off = uint64(usermem.ByteOrder.Uint64(src[:8])) - src = src[8:] - o.Reclen = uint16(usermem.ByteOrder.Uint16(src[:2])) - src = src[2:] +func (d *direntHdr) UnmarshalBytes(src []byte) { + d.OldHdr.UnmarshalBytes(src[:d.OldHdr.SizeBytes()]) + src = src[d.OldHdr.SizeBytes():] + d.Typ = uint8(src[0]) + src = src[1:] } // Packed implements marshal.Marshallable.Packed. //go:nosplit -func (o *oldDirentHdr) Packed() bool { +func (d *direntHdr) Packed() bool { return false } // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. -func (o *oldDirentHdr) MarshalUnsafe(dst []byte) { - // Type oldDirentHdr doesn't have a packed layout in memory, fallback to MarshalBytes. - o.MarshalBytes(dst) +func (d *direntHdr) MarshalUnsafe(dst []byte) { + // Type direntHdr doesn't have a packed layout in memory, fallback to MarshalBytes. + d.MarshalBytes(dst) } // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. -func (o *oldDirentHdr) UnmarshalUnsafe(src []byte) { - // Type oldDirentHdr doesn't have a packed layout in memory, fallback to UnmarshalBytes. - o.UnmarshalBytes(src) +func (d *direntHdr) UnmarshalUnsafe(src []byte) { + // Type direntHdr doesn't have a packed layout in memory, fallback to UnmarshalBytes. + d.UnmarshalBytes(src) } // CopyOutN implements marshal.Marshallable.CopyOutN. //go:nosplit -func (o *oldDirentHdr) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { - // Type oldDirentHdr doesn't have a packed layout in memory, fall back to MarshalBytes. - buf := cc.CopyScratchBuffer(o.SizeBytes()) // escapes: okay. - o.MarshalBytes(buf) // escapes: fallback. +func (d *direntHdr) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { + // Type direntHdr doesn't have a packed layout in memory, fall back to MarshalBytes. + buf := cc.CopyScratchBuffer(d.SizeBytes()) // escapes: okay. + d.MarshalBytes(buf) // escapes: fallback. return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. } // CopyOut implements marshal.Marshallable.CopyOut. //go:nosplit -func (o *oldDirentHdr) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { - return o.CopyOutN(cc, addr, o.SizeBytes()) +func (d *direntHdr) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { + return d.CopyOutN(cc, addr, d.SizeBytes()) } // CopyIn implements marshal.Marshallable.CopyIn. //go:nosplit -func (o *oldDirentHdr) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { - // Type oldDirentHdr doesn't have a packed layout in memory, fall back to UnmarshalBytes. - buf := cc.CopyScratchBuffer(o.SizeBytes()) // escapes: okay. +func (d *direntHdr) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { + // Type direntHdr doesn't have a packed layout in memory, fall back to UnmarshalBytes. + buf := cc.CopyScratchBuffer(d.SizeBytes()) // escapes: okay. length, err := cc.CopyInBytes(addr, buf) // escapes: okay. // Unmarshal unconditionally. If we had a short copy-in, this results in a // partially unmarshalled struct. - o.UnmarshalBytes(buf) // escapes: fallback. + d.UnmarshalBytes(buf) // escapes: fallback. return length, err } // WriteTo implements io.WriterTo.WriteTo. -func (o *oldDirentHdr) WriteTo(writer io.Writer) (int64, error) { - // Type oldDirentHdr doesn't have a packed layout in memory, fall back to MarshalBytes. - buf := make([]byte, o.SizeBytes()) - o.MarshalBytes(buf) +func (d *direntHdr) WriteTo(writer io.Writer) (int64, error) { + // Type direntHdr doesn't have a packed layout in memory, fall back to MarshalBytes. + buf := make([]byte, d.SizeBytes()) + d.MarshalBytes(buf) length, err := writer.Write(buf) return int64(length), err } |